diff options
author | Simon Parri <simonparri@ganzeria.com> | 2025-08-09 14:59:30 -0500 |
---|---|---|
committer | Simon Parri <simonparri@ganzeria.com> | 2025-08-09 14:59:30 -0500 |
commit | 7a9a19026044959b3e306ff497fb50200090639b (patch) | |
tree | 89f1fe660c6bb13d7031725ebedaf1e59e34f4ab /common/bin/bandwidthtest | |
parent | 525dea0487c9f5a533981f270153010c205188c8 (diff) | |
download | dotfiles-7a9a19026044959b3e306ff497fb50200090639b.tar.gz dotfiles-7a9a19026044959b3e306ff497fb50200090639b.zip |
Bin: Fix bandwidthtest
Diffstat (limited to 'common/bin/bandwidthtest')
-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 |