#!/bin/sh
#
#
exnum=131072
speed=Mbit/s
if [ $2 = "m" ];then
exnum=131072 #exnum=1024*1024/8
speed=Mbit/s
fi
if [ $2 = "k" ];then
exnum=1024
speed=KByte/s
fi
while true
do
firnum=`ifconfig $1|awk 'NR==7{print $2;exit}'|cut -c7-`
echo $firnum
sleep 1
sednum=`ifconfig $1|awk 'NR==7{print $2;exit}'|cut -c7-`
echo $sednum
getnum=$(($sednum-$firnum))
echo $getnum
tra=`echo "scale=4; $getnum/$exnum"|bc`
echo "The speed is ${tra} ${speed}"
done
阅读(2463) | 评论(0) | 转发(1) |