while true do sec=`date +%S` sec=$((10#${sec}+0)) if [[ ${sec} -ge 00 ]] && [[ ${sec} -le 30 ]] then echo "00s <= ${sec} <= 30s" sleep 2 else echo "${sec} continue" sleep 2 continue fi done