Skip to content

Instantly share code, notes, and snippets.

@taka011239
Last active August 29, 2015 14:04
Show Gist options
  • Save taka011239/d2438b5ca23247c68999 to your computer and use it in GitHub Desktop.
Save taka011239/d2438b5ca23247c68999 to your computer and use it in GitHub Desktop.
CLIでbatteryのステータスを%表示
acpi | grep -oE \[0-9\]+%
ioreg -l | awk '$3~/Capacity/{c[$3]=$5}END{OFMT="%.3f";max=c["\"MaxCapacity\""];print(max>0?100*c["\"CurrentCapacity\""]/max:"?")}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment