3 ## Shows TX/RX over 1sec
4 ## By Michal Nazareicz (mina86/AT/mina86.com)
5 ## & Stanislaw Klekot (dozzie/AT/irc.pl)
6 ## Released to Public Domain
8 ## This is part of Tiny Applications Collection
9 ## -> http://tinyapps.sourceforge.net/
12 # usage: ./traf.sh <interface>
13 # <interface> can be a BRE
19 # shellcheck disable=SC2120
23 expr X
"${LINE%%:*}" : X
".*\\($INT\\)" >/dev
/null ||
continue
24 # shellcheck disable=SC2086
31 # shellcheck disable=SC2119
37 # shellcheck disable=SC2119
46 while [ "$I" -lt 15360 ]; do
47 if [ "$I" -lt "$TX" ]; then PT
="#$PT"; else PT
=" $PT"; fi
48 if [ "$I" -lt "$RX" ]; then PR
="$PR#"; else PR
="$PR "; fi
51 if [ "$TX" -gt 2048 ]; then TX
="$(( TX / 1024 )) K"; fi
52 if [ "$RX" -gt 2048 ]; then RX
="$(( RX / 1024 )) K"; fi
53 # printf "%s < %6s | %6s > %s\n" "$PT" "$TX" "$RX" "$PR"
54 printf "%6s %s | %s %6s\n" "$TX" "$PT" "$PR" "$RX"
58 # while [ $I -lt $TX -o $I -lt $RX ]; do
59 # if [ $I -gt $TX ]; then
60 # PROGRESS="$PROGRESS'"
61 # elif [ $I -gt $RX ]; then
62 # PROGRESS="$PROGRESS."
64 # PROGRESS="$PROGRESS:"
68 # if [ $TX -gt 2048 ]; then TX="$(( $TX / 1024 )) K"; fi
69 # if [ $RX -gt 2048 ]; then RX="$(( $RX / 1024 )) K"; fi
70 # printf "< %6s > %6s %s\n" "$TX" "$RX" "$PROGRESS"