On 5 November 2015 00:53:25 CET, Walter Dnes <waltd...@waltdnes.org> wrote: > The attached script requires "make menuconfig" to have > >Power management and ACPI options ---> >[*] ACPI (Advanced Configuration and Power Interface) Support ---> ><*> Battery > >or CONFIG_ACPI_BATTERY enabled if you do .config manually. > > The script reads /sys/class/power_supply/BAT1/uevent on a laptop and >calculates the percentage of battery charge. Because it only reads >from >/sys, and does not write, it can be run by a regular user. The script >is primitive, and has to be stopped with {CTRL}{C}. > > The script runs in text mode, and can run in xterm or even a pure text >console. I've removed the #!/bin/bash at the top of the attached file >and chmod'ed it non-executable. The mailing list software seems to >reject any such attachments. You can source the file as is, or chmod >it >executable, and insert #!/bin/bash at the top. Note that there is an >ANSI escape sequence in the script, to keep the output in one location. >Regular cut-and-paste can fail if you try to copy from the screen.
FYI, on my laptop it's BAT0, not BAT1. -- Joost -- Sent from my Android device with K-9 Mail. Please excuse my brevity.