Skip to content

Commit

Permalink
Fix: Use double-bracket test for battery status check
Browse files Browse the repository at this point in the history
Switched to the more robust `[[ ... ]]` test construct from the traditional `[ ... ]` to prevent potential malformed conditions when checking the battery status in Bash.
  • Loading branch information
skywarth authored Sep 28, 2023
1 parent 0238aca commit e2334b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion segments/battery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ __battery_osx() {
BAT_NOW=$BATPATH/energy_now
fi

if [ "$1" = `cat $STATUS` -o "$1" = "" ]; then
if [[ "$1" = `cat $STATUS` || "$1" = "" ]]; then
__linux_get_bat
fi
;;
Expand Down

0 comments on commit e2334b1

Please sign in to comment.