Cosmetical

Suppress warnings like: RX yesterday:  eth0+eth1+wlan0+wlan1: Not enough data available yet.
This commit is contained in:
Igor Pečovnik 2020-12-03 17:37:41 +01:00 committed by GitHub
parent 5bdf27b876
commit dc0cebe3d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -234,6 +234,7 @@ if [[ $(command -v vnstat) ]]; then
traffic=$(vnstat -d 1 -i $PRIMARY_INTERFACE --oneline | cut -d";" -f4,5)
traffic_rx=$(echo $traffic | cut -d";" -f1,1 | sed -r 's/([0-9]+\.[0-9]{1})[0-9]*/\1/')
traffic_tx=$(echo $traffic | cut -d";" -f2,2 | sed -r 's/([0-9]+\.[0-9]{1})[0-9]*/\1/')
[[ "$traffic" == *"Not enough"* ]] && traffic_tx="n/a "; traffic_rx="n/a "
printf "${PRIMARY_DIRECTION^^} yesterday: "
if [[ $PRIMARY_DIRECTION == tx ]]; then
printf "\x1B[92m%s\x1B[0m" "$traffic_tx"