replace tr '\n' 'CHAR' with paste -sd 'CHAR' (#625)

This commit is contained in:
Kian Kasad authored and GitHub committed 2020-05-09 19:32:56 -04:00
1 parent 2b6b3822e3
commit 6577acae89
5 files changed
+6 -6

No files matched your search

+2 -2
View File
@@ -13,8 +13,8 @@ esac
rxfile="${XDG_CACHE_HOME:-$HOME/.cache}/rxlog"
txfile="${XDG_CACHE_HOME:-$HOME/.cache}/txlog"
rxcurrent="$(cat /sys/class/net/*/statistics/rx_bytes | tr '\n' '+' | sed 's/+$/\n/' | bc)"
txcurrent="$(cat /sys/class/net/*/statistics/tx_bytes | tr '\n' '+' | sed 's/+$/\n/' | bc)"
rxcurrent="$(cat /sys/class/net/*/statistics/rx_bytes | paste -sd '+' | bc)"
txcurrent="$(cat /sys/class/net/*/statistics/tx_bytes | paste -sd '+' | bc)"
printf "🔻%skB 🔺%skB\\n" \
"$(printf -- "(%s-%s)/1024\\n" "$rxcurrent" "$(cat "$rxfile")" | bc)" \