Remember that once wrote the script by the days of the cycle, the real date can be any day, like this:
1start_day=$ (Date-D"$TODAY -1days"+%y%m%d);2 3end_day=$ (Date-D"$TODAY-${cycle}days"+%y%m%d);4 5 for((; $END _day<= $START _day; end_day=$ (Date-D"$END _day +1days"+%y%m%d )))6 7 Do8 9 ... ..Ten One Done
$TODAY is the time parameter, such as 20141222, which is passed by the outside world;
Cycle is an integer that represents the number of days you want the loop to be, such as one months 30.
And then cycle the time to end_day each additional day, add enough 30 times, the loop terminates.
Now it suddenly takes 10 minutes to cycle through the fragments.
The thought of ' date-d ' 201412021311 +10minutes "+%h:%m ' such a way can be effective, but found that such a write. Try it, write like this.
' date-d ' 20141202 1311 +10minutes "+%h:%m" to work, it feels so wonderful ...
Changed it, only in a day to cycle
1Startpoint=0000;2Endpoint=0010;3 4 for((i=1; i<=144; i++))5 Do6Startpoint_format= 'Date-D"$startpoint"+%h:%M; '7Endpoint_format= 'Date-D"$endpoint"+%h:%M; '8 ...9Startpoint= 'Date-D"$startpoint +10minutes"+%h%M; 'TenEndpoint= 'Date-D"$endpoint +10minutes"+%h%M; ' One Done
This looks pretty good:)
You can also follow the time stamp increase or decrease to do the cycle, without this look comfortable:)
Linux Shell Date loops by Time fragment