Linux:sheel脚本for的用法,及日期参数+1day用法

记录下shell的for的用法,及参数是日期的情况下,该日期+1day的用法:

#!/usr/bin/env bash
source /app/catt/login.sh

p_days="20171208 20171210 20171230 20180103 20180104 20180105 20180106 20180107 20180108 20180109 20180113 20180116 20180118 20180119 20180120 20180127"

for p_day in $p_days;
do

p_hour_start=$p_day'00'
p_nextday=`date -d "$p_day +1 day" +"%Y%m%d"`
p_hour_end=$p_nextday'00'

echo ${p_hour_start},${p_hour_end} 

end

 

posted @ 2018-02-02 14:27  cctext  阅读(851)  评论(0编辑  收藏  举报