If you're dealing with a shell script and it's a common thing to traverse a time range, share it with you today:
Copy Code code as follows:
#!/usr/bin/env Bash
Date1= "$"
Date2= "$"
echo "Date1: $date 1"
echo "Date2: $date 2"
Tempdate= ' date-d '-0 day $date 1 "+%f"
Enddate= ' date-d '-0 day $date 2 "+%f"
Tempdatesec= ' date-d '-0 day $date 1 "+%s"
Enddatesec= ' date-d '-0 day $date 2 "+%s"
echo "####################################"
Echo ' tempdate: ' $tempdate
Echo ' EndDate: ' $enddate
#for i in ' seq 1 130 '; Todo
For i in ' SEQ 1 300 '; Todo
if [[$tempdateSec-lt $enddateSec]]; Then
Break
Fi
Echo $tempdate
Python pc_jibzhuanti_url.py $tempdate
Tempdate= ' date-d '-$i day $date 1 "+%f"
Tempdatesec= ' date-d '-$i day $date 1 "+%s"
Done
This is a reverse output time script, you need to enter two time parameters, one is the start time, one is the end time, such as input:
Copy Code code as follows:
./pc_jibzhuanti_url_run.sh 2014-06-30 2014-06-01
The result of the output is:
Copy Code code as follows:
Date1:2014-06-30
Date2:2014-06-01
####################################
Tempdate:2014-06-30
Enddate:2014-06-01
2014-06-30
2014-06-29
2014-06-28
2014-06-27
2014-06-26
2014-06-25
2014-06-24
2014-06-23
2014-06-22
2014-06-21
2014-06-20
2014-06-19
2014-06-18
2014-06-17
2014-06-16
2014-06-15
2014-06-14
2014-06-13
2014-06-12
2014-06-11
2014-06-10
2014-06-09
2014-06-08
2014-06-07
2014-06-06
2014-06-05
2014-06-04
2014-06-03
2014-06-02
2014-06-01
OK, take care of!!!!.