I have a script that goes like this:
while :
do
Start_Time=$(date +"%s")
MAIN PROGRAM GOES HERE (CROPPED TO SHORTEN THINGS)
Run_Time=$(( $(date +"%s") - $Start_Time ))
if [[ $Run_Time < $Wait_Time ]]
then
Delay_Time=$(( $Wait_Time - $Run_Time ))
sleep $Delay_Time
else
echo "Delay exceeded"
echo $Run_Time
echo $Wait_Time
fi
done
And my problem is that sometimes even if the run time is smaller than the wait time it fails the < test
Here is an output from the last run:
Delay exceeded
Run_Time 4
Wait_Time 30