dot_testing/simplestatus/power

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