bash 定时任务
time1=$(date +%s -d '2014-01-13 22:46:05') for((;;)) do time2=$(date +%s) time3=$((time1 - time2)) if [ $time3 -le 0 ] then break; fi echo $time3 sleep $time3 done
补充说明:
shell 单括号运算符号:
a=$(date);
等同于:a=`date`;
双括号运算符:
a=$((1+2));
echo $a;
等同于:
a=`expr 1 + 2`