bash循环得到日期目录

 

 

 

 1 #!/bin/bash
 2 today=$(date "+%Y%m%d")
 3 echo 'today is :'${today}
 4 single_input="raw_data/"
 5 
 6 
 7 startday=$(date "+%Y%m%d" -d  '90 days ago')
 8 endday=$(date "+%Y%m%d" -d  '1 days ago')
 9 
10 curday=${startday}
11 while (( $curday <= $endday )) 
12 do
13   input=${single_input}${curday}/24
14     if [ $curday -eq $startday ];then
15         all_input=$input
16     else
17         all_input=$all_input","$input
18     fi
19     curday=`date -d "+1 day $curday" +%Y%m%d`
20 done
21 
22 echo $all_input

 

 

 

for i in `seq 00 23`; do
if [ $i -lt 10 ]
then
    i="0"$i
fi
dir=$to_root/$i
src=$from_root/part-0$i*
dfile=$dir/to.hadoop."done"

 

posted @ 2019-06-06 12:11  乐乐章  阅读(325)  评论(0编辑  收藏  举报