#!/bin/bash
step=1
j=1
for (( i = 0; i < j+1; i = (i+step) )); do
let j++
value=$(cat /sys/class/power_supply/rk-bat/capacity)
if [ $value -lt 80 ]; then
echo "The current battery level is $value%"
echo "Low battery, shut down after five seconds"
sleep 5
poweroff
fi
sleep 3
done