Skip to content

Commit aa6503c

Browse files
committed
deeper in bash
1 parent 33e4597 commit aa6503c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎battery‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22
# add to crontab
33
# */2 * * * * /usr/bin/battery
4+
# dependencies: espeak
45

56
DIR="/sys/class/power_supply/BAT0"
67
STATUS=$(cat "$DIR/status")
@@ -13,7 +14,7 @@ then
1314
then
1415
REMAIN=$(cat "$DIR/${PREFIX}_now")
1516
FULL=$(cat "$DIR/${PREFIX}_full")
16-
PRCT=$((100 * $REMAIN / $FULL))
17+
PRCT=$((100 * REMAIN / FULL))
1718
if [ $PRCT -le 15 ]
1819
then
1920
espeak "This is an emergency, This is an emergency, battery $PRCT percent, save, me"

0 commit comments

Comments
 (0)