From e2334b1302b4bc62005c9df5586ee7964139062f Mon Sep 17 00:00:00 2001 From: skywarth Date: Thu, 28 Sep 2023 23:24:14 +0300 Subject: [PATCH] Fix: Use double-bracket test for battery status check Switched to the more robust `[[ ... ]]` test construct from the traditional `[ ... ]` to prevent potential malformed conditions when checking the battery status in Bash. --- segments/battery.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/segments/battery.sh b/segments/battery.sh index 28656f9c..7a6691d2 100755 --- a/segments/battery.sh +++ b/segments/battery.sh @@ -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 ;;