View Single Post
  #1   (View Single Post)  
Old 1st February 2018
bsd-keith bsd-keith is online now
Real Name: Keith
Open Source Software user
 
Join Date: Jun 2014
Location: Surrey/Hants Border, England
Posts: 344
Default How do I get the remaining battery percentage (6.2)

I used to be able to get the battery percentage in 6.0/6.1 using,
Code:
battatm=$(sysctl -n hw.sensors.acpibat0.amphour3 | sed s/.A.*//)
battfull=$(sysctl -n hw.sensors.acpibat0.amphour0 | sed s/.A.*//)
load=`echo "${battatm} / ${battfull} * 100" | bc`
echo ${load}
but it isn't working on 6.2, & I noticed amphour seems to be watthour now, but even changing that didn't work, something appears to have changed(?).
__________________
Linux since 1999, & also a BSD user.
Reply With Quote