What is Nostr?
Qper /
npub13ef…3cpe
2024-03-26 17:28:29

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?
Author Public Key
npub13efy59n66gh2rgp6fg0gfk6rlznudvc2j5la2r536xycqs085rwsga3cpe