save the file check every time

This commit is contained in:
Luke Smith 2020-05-30 11:41:29 -04:00
parent 1d95b2210e
commit 7ea15612b4
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252

View file

@ -11,10 +11,9 @@ case "$BLOCK_BUTTON" in
esac esac
logfile="${XDG_CACHE_HOME:-$HOME/.cache}/netlog" logfile="${XDG_CACHE_HOME:-$HOME/.cache}/netlog"
prevdata="$(cat "$logfile")" prevdata="$(cat "$logfile")" || echo "0 0" > "$logfile"
rxcurrent="$(($(paste -d '+' /sys/class/net/[ew]*/statistics/rx_bytes)))" rxcurrent="$(($(paste -d '+' /sys/class/net/[ew]*/statistics/rx_bytes)))"
[ -f "$logfile" ] || echo "0 0" > "$logfile"
txcurrent="$(($(paste -d '+' /sys/class/net/[^lo]*/statistics/tx_bytes)))" txcurrent="$(($(paste -d '+' /sys/class/net/[^lo]*/statistics/tx_bytes)))"
printf "🔻%sKiB 🔺%sKiB\\n" \ printf "🔻%sKiB 🔺%sKiB\\n" \