diff --git a/bat b/bat new file mode 100755 index 0000000..f911b83 --- /dev/null +++ b/bat @@ -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}