Background: in addition to the main distro on this machine (Peppermint) I have a very skeletal experimental system made up of basic Slackware-current packages (just for fun). This boots, and I can play with it independently and update it, but it has CLI only, no X.
Because I am paranoid, I wanted to keep track of the battery charge state; I wouldn't want it to die on me during an update! So I wrote this little bash script
Code:
#!/bin/bash
#Script to monitor battery charge level
#
current=`cat /sys/class/power_supply/BAT0/charge_now`
full=`cat /sys/class/power_supply/BAT0/charge_full`
charge_level=$(($current*100/$full))
echo "Battery is $charge_level% charged"
exit 0