8 lines
215 B
Plaintext
8 lines
215 B
Plaintext
|
#!/usr/bin/env sh
|
||
|
|
||
|
current=$(sysctl -n hw.sensors.acpibat0.current0|cut -f1 -d' ')
|
||
|
voltage=$(sysctl -n hw.sensors.acpibat0.volt1|cut -f1 -d' ')
|
||
|
watts=$(bc -e "scale=2;$current*$voltage" -e "quit")
|
||
|
|
||
|
echo "${watts}W"
|