1日毎に交互に2つ処理を実行する|do two commands day by day
- 現在日時を1970年からの日数に変換し、その数が偶数、奇数で処理を振り分ける|calculate days from 1970. when the days is even, do one command and when the days is odd, do another command.
#!/bin/sh set -u A=`date +%s` echo $A is seconds from 1970-01-01 00:00:00 UTC . ((B=$A/(24*60*60))) echo $B is days from 1970-01-01 00:00:00 UTC . ((C=$B%2)) if [ $C -eq 0 ] then echo 'even' # write a command else echo 'odd' # write another command fi