First of all, I'm a beginner on shell-script. This code I've done is not working.
I want to repeat a code for 30 seconds but it doesn't work. It just keep doing my logic indefinitely.
DIFF=0
while [ $DIFF < 30 ]; do
START=$(date +%s)
######## My logic #########
DIFF=$(( $END - $START ))
echo $DIFF
cd ..
sleep 5s
done
I think it's because I'm not doing the while clause properly?