create netlog if empty

it would not run without an existing nonempty log file
This commit is contained in:
Hekuran
2020-05-30 17:27:01 +02:00
committed by GitHub
parent d8272650bd
commit daf2829167

View File

@@ -14,6 +14,7 @@ logfile="${XDG_CACHE_HOME:-$HOME/.cache}/netlog"
prevdata="$(cat "$logfile")" prevdata="$(cat "$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" \