must compute unit inside of loop

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
This commit is contained in:
Dustin Kirkland 2009-06-16 16:46:32 -05:00
commit 26cf4fc69d

View file

@ -31,12 +31,12 @@ if [ "$1" = "--detail" ]; then
exit 0 exit 0
fi fi
unit="kB/s"
t2=`date +%s` t2=`date +%s`
ifconfig=`/sbin/ifconfig "$interface" | grep "RX bytes" | sed "s/.*:\(.*\) (.*:\(.*\) (.*/\1\n\2/"` ifconfig=`/sbin/ifconfig "$interface" | grep "RX bytes" | sed "s/.*:\(.*\) (.*:\(.*\) (.*/\1\n\2/"`
for i in up down; do for i in up down; do
cache="/var/run/screen/S-$USER/$PKG.network_$i" cache="/var/run/screen/S-$USER/$PKG.network_$i"
t1=`stat -c %Y "$cache"` 2>/dev/null || t1=0 t1=`stat -c %Y "$cache"` 2>/dev/null || t1=0
unit="kB/s"
if [ $t2 -le $t1 ]; then if [ $t2 -le $t1 ]; then
rate=0 rate=0
else else