[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
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