From 7a9a19026044959b3e306ff497fb50200090639b Mon Sep 17 00:00:00 2001 From: Simon Parri Date: Sat, 9 Aug 2025 14:59:30 -0500 Subject: Bin: Fix bandwidthtest --- common/bin/bandwidthtest | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'common/bin/bandwidthtest') 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 -- cgit v1.2.3