Skip to content

Commit

Permalink
fix: 修复bat脚本多行带来的报错问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yaocccc committed Mar 1, 2023
1 parent 1a319fb commit 124d215
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DEF/statusbar/packages/bat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ signal=$(echo "^s$this^" | sed 's/_//')
[ ! "$(command -v acpi)" ] && echo command not found: acpi && exit

update() {
bat_text=$(acpi -b | sed '2,$d' | awk '{print $4}' | grep -Eo "[0-9]+")
[ ! "$bat_text" ] && bat_text=$(acpi -b | sed '2,$d' | awk '{print $5}' | grep -Eo "[0-9]+")
bat_text=$(acpi -b | sed '2,$d' | awk -F'[ %]' '{print $4}')
[ ! "$bat_text" ] && bat_text=$(acpi -b | sed '2,$d' | awk -F'[ %]' '{print $5}' | grep -Eo "[0-9]+")
[ ! "$(acpi -b | grep 'Battery 0' | grep Discharging)" ] && charge_icon=""
if [ "$bat_text" -ge 95 ]; then bat_icon=""; charge_icon="";
elif [ "$bat_text" -ge 90 ]; then bat_icon="";
Expand Down

0 comments on commit 124d215

Please sign in to comment.