From 0233b8518931ba14a9304bf64edca9d3f5c1cf19 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Sun, 28 Jun 2020 20:19:48 +0200 Subject: [PATCH] Send error to /dev/null instead of separate check --- .local/bin/statusbar/battery | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.local/bin/statusbar/battery b/.local/bin/statusbar/battery index b60cb4b6..35365347 100755 --- a/.local/bin/statusbar/battery +++ b/.local/bin/statusbar/battery @@ -20,8 +20,7 @@ esac for battery in /sys/class/power_supply/BAT? do # Get its remaining capacity and charge status. - [ -f "$battery"/capacity ] || break - capacity=$(cat "$battery"/capacity) + capacity=$(cat "$battery"/capacity 2>/dev/null) || break status=$(sed "s/[Dd]ischarging/🔋/;s/[Nn]ot charging/🛑/;s/[Cc]harging/🔌/;s/[Uu]nknown/♻️/;s/[Ff]ull/⚡/" "$battery"/status) # If it is discharging and 25% or less, we will add a ❗ as a warning.