diff options
Diffstat (limited to 'common/bin')
-rwxr-xr-x | common/bin/bandwidthtest | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/common/bin/bandwidthtest b/common/bin/bandwidthtest index baac413..5eded7f 100755 --- a/common/bin/bandwidthtest +++ b/common/bin/bandwidthtest @@ -1,7 +1,9 @@ #!/bin/sh -start="$(($(cat /sys/class/net/$1/statistics/rx_bytes | paste -sd '+')))" -end="$(($(cat /sys/class/net/$1/statistics/rx_bytes | paste -sd '+')))" +dev="$1" +start="$(($(cat /sys/class/net/$dev/statistics/rx_bytes | paste -sd '+')))" +end="$start" + if [ "$2" ]; then delay="$2" else @@ -11,7 +13,8 @@ fi printf "Recording bandwidth.\n" report() { -printf '%4dB\n' $(numfmt --to=iec $(($end - $start))) + end="$(($(cat /sys/class/net/$dev/statistics/rx_bytes | paste -sd '+')))" + numfmt --to=iec $(($end - $start)) } trap report SIGINT |