X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=d3d73b1e29fd93fe44e64b66eb78cf55398c8c64;hb=3bc8fab4fdda5f441a51ad3e16fa3b8a07c16b53;hp=a19c9acaaf54f343698daa52473e681b6738dcc3;hpb=f95ed49fb1c35f205050dd9b509067bdcde98fb2;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index a19c9ac..d3d73b1 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -1729,8 +1729,8 @@ GRML_BATTERY_LEVEL='' local num local -A table for num in 0 1 ; do - table=( ${=${${${${${(M)${(f)"$(acpiconf -i $num)"}:#(State|Remaining capacity):*}%%( ##|%)}//:[ $'\t']##/@}// /-}//@/ }} ) - if [[ $table[State] != "not-present" ]] ; then + table=( ${=${${${${${(M)${(f)"$(acpiconf -i $num 2>&1)"}:#(State|Remaining capacity):*}%%( ##|%)}//:[ $'\t']##/@}// /-}//@/ }} ) + if [[ -n $table ]] && [[ $table[State] != "not-present" ]] ; then case $table[State] in *discharging*) if (( $table[Remaining-capacity] < 20 )) ; then