#!/bin/bash # #sh x.sh 2017010101 2017010301 stime=$1 etime=$2 while : do echo $stime stime=$(date -d "${stime:0:8} ${stime:8:2} 1hour" +%Y%m%d%H) if [[ $stime -gt $etime ]] then break fi done
#!/bin/bash # #sh x.sh 20170101 20170103 stime=$1 etime=$2 while : do stime=$(date -d "$stime 1day" +%Y%m%d) if [[ $stime -gt $etime ]]; then break; fi done
时间: 2024-12-14 07:46:41