bin : ajout script batstat
This commit is contained in:
parent
5ff22f5b6a
commit
7cb3363539
1 changed files with 11 additions and 0 deletions
11
bin/batstat
Executable file
11
bin/batstat
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env sh
|
||||
set -e
|
||||
|
||||
battery_capacity=$(cat "/sys/class/power_supply/${1}/capacity")
|
||||
|
||||
if [ "$battery_capacity" -lt 25 ]; then echo critical
|
||||
elif [ "$battery_capacity" -lt 50 ]; then echo low
|
||||
elif [ "$battery_capacity" -lt 75 ]; then echo medium
|
||||
elif [ "$battery_capacity" -lt 100 ]; then echo high
|
||||
else echo full
|
||||
fi
|
Loading…
Reference in a new issue