Samuel Shuert | 3f82866 | 2024-02-10 20:45:50 -0500 | [diff] [blame^] | 1 | #!/bin/bash |
2 | |||||
3 | battery() { | ||||
4 | BAT=`ls /sys/class/power_supply | grep BAT | head -n 1` | ||||
5 | cat /sys/class/power_supply/${BAT}/capacity | ||||
6 | } | ||||
7 | battery_stat() { | ||||
8 | BAT=`ls /sys/class/power_supply | grep BAT | head -n 1` | ||||
9 | cat /sys/class/power_supply/${BAT}/status | ||||
10 | } | ||||
11 | |||||
12 | if [[ "$1" == "--bat" ]]; then | ||||
13 | battery | ||||
14 | elif [[ "$1" == "--bat-st" ]]; then | ||||
15 | battery_stat | ||||
16 | fi | ||||
17 |