Hash : a200ea59 Author : Thomas de Grivel Date : 2021-02-20T15:53:07
Download
1 2 3 4 5
#!/bin/sh MAX="$(sysctl -n hw.sensors.acpibat1.watthour0 | cut -d ' ' -f 1)" POWER="$(sysctl -n hw.sensors.acpibat1.watthour3 | cut -d ' ' -f 1)" PERCENT=$({ echo scale=1; echo "$POWER*100/$MAX"; } | bc) echo ${PERCENT}%