Send error to /dev/null instead of separate check

This commit is contained in:
David Pedersen 2020-06-28 20:19:48 +02:00
parent 25576ab467
commit 0233b85189

View File

@ -20,8 +20,7 @@ esac
for battery in /sys/class/power_supply/BAT? for battery in /sys/class/power_supply/BAT?
do do
# Get its remaining capacity and charge status. # Get its remaining capacity and charge status.
[ -f "$battery"/capacity ] || break capacity=$(cat "$battery"/capacity 2>/dev/null) || break
capacity=$(cat "$battery"/capacity)
status=$(sed "s/[Dd]ischarging/🔋/;s/[Nn]ot charging/🛑/;s/[Cc]harging/🔌/;s/[Uu]nknown/♻️/;s/[Ff]ull/⚡/" "$battery"/status) 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. # If it is discharging and 25% or less, we will add a ❗ as a warning.