[shell]时间判断

1. 时间判断

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

END

posted @ 2021-11-19 13:41  LeoShi2020  阅读(1115)  评论(0编辑  收藏  举报