battery level check thingy

This commit is contained in:
shockrahwow 2020-04-17 01:43:07 -07:00
parent 074866f91e
commit fc5a75071a

10
bat Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
# Shows current battery level from BAT0
# also a script to show off some tricks(hopefully)
raw=`echo -n ' / ' | cat /sys/class/power_supply/BAT0/energy_now - /sys/class/power_supply/BAT0/energy_full | tr -d '\n'`
digits=$(echo $raw | bc -l)
digits=${digits##.}
echo Battery %${digits:0:2}.${digits:3:2}