dot_testing/simplestatus/power
2022-01-07 02:40:12 -06:00

12 lines
231 B
Bash
Executable File

#!/bin/sh
battery="sbs-20-000b"
perc=$(cat /sys/class/power_supply/$battery/capacity)
state=$(
cat /sys/class/power_supply/$battery/status | \
sed 's/Discharging/↓/g;s/Charging/↑/g'
)
printf "%s %s" "$perc" "$state"
exit