mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
Use read instead of parameter expansions
This commit is contained in:
parent
52d9140820
commit
f15d753501
@ -11,13 +11,14 @@ case "$BLOCK_BUTTON" in
|
||||
esac
|
||||
|
||||
logfile="${XDG_CACHE_HOME:-$HOME/.cache}/netlog"
|
||||
prevdata="$(cat "$logfile")" || echo "0 0" > "$logfile"
|
||||
|
||||
[ -f "$logfile" ] && read rxprev txprev < "$logfile"
|
||||
|
||||
rxcurrent="$(($(paste -d '+' /sys/class/net/[ew]*/statistics/rx_bytes)))"
|
||||
txcurrent="$(($(paste -d '+' /sys/class/net/[ew]*/statistics/tx_bytes)))"
|
||||
|
||||
printf "🔻%sKiB 🔺%sKiB\\n" \
|
||||
"$(((rxcurrent-${prevdata%% *})/1024))" \
|
||||
"$(((txcurrent-${prevdata##* })/1024))"
|
||||
"$(((rxcurrent-rxprev)/1024))" \
|
||||
"$(((txcurrent-txprev)/1024))"
|
||||
|
||||
echo "$rxcurrent $txcurrent" > "$logfile"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user