Skip to content

Commit 7810c8d

Browse files
jbleuzenmartinbeentjes
authored andcommitted
Fix: Don't process empty batteries variable (#56)
1 parent d64c7fe commit 7810c8d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

scripts/battery_percentage.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ print_battery_percentage() {
1010
pmset -g batt | grep -o "[0-9]\{1,3\}%"
1111
elif command_exists "upower"; then
1212
local batteries=( $(upower -e | grep battery) )
13+
if [ -z "$batteries" ]; then
14+
return
15+
fi
1316
local energy
1417
local energy_full
1518
for battery in ${batteries[@]}; do

0 commit comments

Comments
 (0)