Qper on Nostr: QUESTION: I have a script to show my battery status ----- battery() { BAT=`ls ...
QUESTION:
I have a script to show my battery status
-----
battery() {
BAT=`ls /sys/class/power_supply | grep BAT | head -n 1`
cat /sys/class/power_supply/${BAT}/capacity
}
battery_stat() {
BAT=`ls /sys/class/power_supply | grep BAT | head -n 1`
cat /sys/class/power_supply/${BAT}/status
}
if [[ "$1" == "--bat" ]]; then
battery
elif [[ "$1" == "--bat-st" ]]; then
battery_stat
fi
---
But I have 2 batteries. and my scripting is far below par.. How can I edit this to show bot BAT0 and BAT1 as a result?
I have a script to show my battery status
-----
battery() {
BAT=`ls /sys/class/power_supply | grep BAT | head -n 1`
cat /sys/class/power_supply/${BAT}/capacity
}
battery_stat() {
BAT=`ls /sys/class/power_supply | grep BAT | head -n 1`
cat /sys/class/power_supply/${BAT}/status
}
if [[ "$1" == "--bat" ]]; then
battery
elif [[ "$1" == "--bat-st" ]]; then
battery_stat
fi
---
But I have 2 batteries. and my scripting is far below par.. How can I edit this to show bot BAT0 and BAT1 as a result?