Fixed if statement variable

This commit is contained in:
Scott C. MacCallum 2024-11-26 15:08:47 -05:00
parent 7614fabb07
commit 3a9f673f22

View File

@ -35,16 +35,17 @@ group="scm"
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.
charge=$(cat /sys/class/power_supply/$battery/charge_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)
minutes=$(echo "scale=2; $hours * 60" | bc -l)