#!/bin/sh
LANG=""
while true
do
up_time1=`ifconfig $1 | grep "TX packets" | awk '{print $2}' | awk -F':' '{print $2}'`
down_time1=`ifconfig $1 | grep "RX packets" | awk '{print $2}' | awk -F':' '{print $2}'`
sleep 1
clear
up_time2=`ifconfig $1 | grep "TX packets" | awk '{print $2}' | awk -F':' '{print $2}'`
down_time2=`ifconfig $1 | grep "RX packets" | awk '{print $2}' | awk -F':' '{print $2}'`
up_time=`expr $up_time2 - $up_time1`
down_time=`expr $down_time2 - $down_time1`
echo ${up_time}
up_time=`expr $up_time / 1024`
echo ${down_time}
down_time=`expr $down_time / 1024`
echo 上传速度: $up_time KB/s
echo 下载速度: $down_time KB/s
done