Fixed if statement variable
This commit is contained in:
parent
7614fabb07
commit
3a9f673f22
@ -35,16 +35,17 @@ group="scm"
|
|||||||
|
|
||||||
battery="BAT0"
|
battery="BAT0"
|
||||||
|
|
||||||
# If the battery is fully charged, exit the program.
|
|
||||||
|
|
||||||
if (( minutes == 0 )); then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Calculate the number of minutes that the battery has left.
|
# Calculate the number of minutes that the battery has left.
|
||||||
|
|
||||||
charge=$(cat /sys/class/power_supply/$battery/charge_now)
|
charge=$(cat /sys/class/power_supply/$battery/charge_now)
|
||||||
discharge=$(cat /sys/class/power_supply/$battery/current_now)
|
discharge=$(cat /sys/class/power_supply/$battery/current_now)
|
||||||
|
|
||||||
|
# If the computer is plugged in, exit the program.
|
||||||
|
|
||||||
|
if (( discharge == 0 )); then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
hours=$(echo "scale=2; $charge / $discharge" | bc -l)
|
hours=$(echo "scale=2; $charge / $discharge" | bc -l)
|
||||||
minutes=$(echo "scale=2; $hours * 60" | bc -l)
|
minutes=$(echo "scale=2; $hours * 60" | bc -l)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user