成都创新互联网站制作重庆分公司

shell脚本一个时间循环

#!/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

文章题目:shell脚本一个时间循环
文章位置:http://cxhlcq.com/article/pcchoi.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部