1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-12-22 12:48:01 +00:00

[polybar] Fix network_usage garbage output

This commit is contained in:
Daniel Carrillo 2020-08-22 16:38:08 +02:00
parent 050ecb24e3
commit 90fcda188d

View File

@ -47,7 +47,8 @@ while true; do
bits_in=$((((current_bytes_in-last_value_in) / REFRESH) * 8))
bits_out=$((((current_bytes_out-last_value_out) / REFRESH) * 8))
output=$(LANG=C numfmt --to iec --format "%8.2f" -z "$bits_in" "$bits_out" 2>/dev/null)
output=$(LANG=C numfmt --to iec --format "%8.2f" "$bits_in" "$bits_out" \
| tr -d "\n" 2>/dev/null)
if ! echo "$output" | grep -qE '[0-9]{1,3}\.[0-9]{1,3}([K,M,G,B])?$'; then
output=" 0.01 0.01"