Fix arithmetic expansions

This commit is contained in:
Gregory Chamberlain 2020-05-31 21:26:05 +01:00
parent 63aef514d7
commit 43f0f899ae

View file

@ -14,12 +14,12 @@ update() {
sum=0
for arg; do
read -r i < "$arg"
sum=$(( "$sum" + "$i" ))
sum=$(( $sum + $i ))
done
cache=${XDG_CACHE_HOME:-$HOME/.cache}/${1##*/}
[ -f "$cache" ] && read -r old < "$cache" || old=0
printf %d\\n "$sum" > "$cache"
printf %d\\n $(( ("$sum" - "$old") / 1024 ))
printf %d\\n $(( ($sum - $old) / 1024 ))
}
rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)