Skip to content

Instantly share code, notes, and snippets.

@RichardWarburton
Created February 3, 2014 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichardWarburton/8790679 to your computer and use it in GitHub Desktop.
Save RichardWarburton/8790679 to your computer and use it in GitHub Desktop.
World's simplest battery monitor
#!/bin/sh
BAT=/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/
now=`cat $BAT/energy_now`
full=`cat $BAT/energy_full`
echo "scale=3; $now / $full" | bc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment