Skip to content

Instantly share code, notes, and snippets.

@wolfwood
Created November 12, 2013 22:39
Show Gist options
  • Save wolfwood/7440125 to your computer and use it in GitHub Desktop.
Save wolfwood/7440125 to your computer and use it in GitHub Desktop.
if [ -e /sys/bus/acpi/drivers/battery/PNP0C0A\:00/power_supply/BAT0/charge_now ]; then
echo scale=2 \; `cat /sys/bus/acpi/drivers/battery/PNP0C0A\:00/power_supply/BAT0/current_now` \* `cat /sys/bus/acpi/drivers/battery/PNP0C0A\:00/power_supply/BAT0/voltage_now` /1000000000000 |bc
else
echo scale=2 \; `cat /sys/bus/acpi/drivers/battery/PNP0C0A:00/power_supply/BAT0/power_now` /1000000 |bc
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment