Created
January 11, 2014 10:55
-
-
Save willgarcia/8369459 to your computer and use it in GitHub Desktop.
mac geeklet - battery cycles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my_ac_adapt=`ioreg -w0 -l | grep ExternalConnected | awk '{print $5}'` | |
if [ "$my_ac_adapt" != "Yes" ] | |
then | |
cur_power=`ioreg -w0 -l | grep CurrentCapacity | awk '{print $5}'` | |
max_power=`ioreg -w0 -l | grep MaxCapacity | awk '{print $5}'` | |
bat_percent=`echo "scale=2;$cur_power / $max_power" | bc` | |
bat_percent=`echo "$bat_percent * 100" | bc | sed 's/.00//'` | |
cyc_count=`ioreg -w0 -l | grep "Cycle Count" | awk 'BEGIN { FS = "=" } ; {print $8}' | awk 'BEGIN { FS = "}" } ; {print $1}'` | |
#echo "Power : Battery ($bat_percent%)" | |
echo "Cycles : $cyc_count" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment