8 lines
215 B
Bash
Executable File
8 lines
215 B
Bash
Executable File
#!/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"
|