Pre-requisites:
/run/user/user_id directory
terminal "clear" command may be busybox only (it is what I run). I should use the terminal ANSI escape code.
Should run in dash shell too (avoid bash like hell of course, don't be corpo naughty).
#!/bin/sh
f0=$(mktemp -p /run/user/$(id -u) -u)
cleanup ()
{
rm -f $f0
exit
}
trap cleanup 2
cp -f /proc/net/dev $f0
receive_prev=$(grep -F eth0 $f0 | cut -F 3)
transmit_prev=$(grep -F eth0 $f0 | cut -F 11)
sleep 10
while true
do
cp -f /proc/net/dev $f0
receive_new=$(grep -F eth0 $f0 | cut -F 3)
transmit_new=$(grep -F eth0 $f0 | cut -F 11)
clear
printf "RECEIVE:$(( ($receive_new - $receive_prev)*8/10000 ))\n"
printf "TRANSMIT:$(( ($transmit_new - $transmit_prev)*8/10000 ))"
receive_prev=$receive_new
transmit_prev=$transmit_new
sleep 10
done