#!/bin/bash statnow(){ for N in $INTERFACES do echo $N $(ifconfig $N | grep bytes | sed -e 's/([^()]*)//g' | tr -dc '[^ 0-9]') done } result(){ echo "$1" $(($7-$4)) bits/sec ' ' } go(){ sleep 8 S2="$(statnow)" for N in $INTERFACES do A=$(echo "$S1" | grep $N) B=$(echo "$S2" | grep $N) result "$(printf "%-5s" $N)Upstream:" $A $B result ' Downstream:' X $A $B done } INTERFACES=$(ifconfig -a|cut -f1 -d' ') S1="$(statnow)" if echo "$@" | grep -q f then while true do go echo '' S1=$S2 done else go fi