We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 66e0910 + 25ef966 commit 5b0f4b5Copy full SHA for 5b0f4b5
scripts/battery.sh
@@ -9,18 +9,18 @@ linux_acpi() {
9
arg=$1
10
BAT=$(ls -d /sys/class/power_supply/*)
11
if [ ! -x "$(which acpi 2> /dev/null)" ];then
12
- case "$arg" in
13
- status)
14
- cat $BAT/status
15
- ;;
16
-
17
- percent)
18
- cat $BAT/capacity
19
20
21
- *)
22
23
- esac
+ for DEV in $BAT; do
+ case "$arg" in
+ status)
+ [ -f "$DEV/status" ] && cat "$DEV/status"
+ ;;
+ percent)
+ [ -f "$DEV/capacity" ] && cat "$DEV/capacity"
+ *)
+ esac
+ done
24
else
25
case "$arg" in
26
status)
0 commit comments