paste directly on files, excluding lo

This commit is contained in:
Luke Smith 2020-05-30 11:09:12 -04:00
parent 884dcbdc47
commit d8272650bd
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252

View file

@ -13,8 +13,8 @@ esac
logfile="${XDG_CACHE_HOME:-$HOME/.cache}/netlog"
prevdata="$(cat "$logfile")"
rxcurrent="$(($(cat /sys/class/net/*/statistics/rx_bytes | paste -sd '+')))"
txcurrent="$(($(cat /sys/class/net/*/statistics/tx_bytes | paste -sd '+')))"
rxcurrent="$(($(paste -d '+' /sys/class/net/[ew]*/statistics/rx_bytes)))"
txcurrent="$(($(paste -d '+' /sys/class/net/[^lo]*/statistics/tx_bytes)))"
printf "🔻%sKiB 🔺%sKiB\\n" \
"$(((rxcurrent-${prevdata%% *})/1024))" \