paste directly on files, excluding lo
This commit is contained in:
parent
884dcbdc47
commit
d8272650bd
1 changed files with 2 additions and 2 deletions
|
@ -13,8 +13,8 @@ esac
|
||||||
logfile="${XDG_CACHE_HOME:-$HOME/.cache}/netlog"
|
logfile="${XDG_CACHE_HOME:-$HOME/.cache}/netlog"
|
||||||
prevdata="$(cat "$logfile")"
|
prevdata="$(cat "$logfile")"
|
||||||
|
|
||||||
rxcurrent="$(($(cat /sys/class/net/*/statistics/rx_bytes | paste -sd '+')))"
|
rxcurrent="$(($(paste -d '+' /sys/class/net/[ew]*/statistics/rx_bytes)))"
|
||||||
txcurrent="$(($(cat /sys/class/net/*/statistics/tx_bytes | paste -sd '+')))"
|
txcurrent="$(($(paste -d '+' /sys/class/net/[^lo]*/statistics/tx_bytes)))"
|
||||||
|
|
||||||
printf "🔻%sKiB 🔺%sKiB\\n" \
|
printf "🔻%sKiB 🔺%sKiB\\n" \
|
||||||
"$(((rxcurrent-${prevdata%% *})/1024))" \
|
"$(((rxcurrent-${prevdata%% *})/1024))" \
|
||||||
|
|
Loading…
Reference in a new issue