- 입력
staratdate
enddate
1
2
3
4
5
6
7
8
9
10
11
startdate='20210701'
enddate='20210707'
enddate=$( date -d "$enddate + 1 day" +%Y%m%d ) # rewrite in YYYYMMDD format
# and take last iteration into account
thedate=$( date -d "$startdate" +%Y%m%d )
while [ "$thedate" != "$enddate" ]; do
printf 'The date is "%s"\n' "$thedate"
beeline --hivevar DATE=$thedate -f query.hql
thedate=$( date -d "$thedate + 1 days" +%Y%m%d ) # increment by one day
done
1
2
3
4
5
6
7
8
9
10
11
12
startdate='2021-07-01'
enddate='2021-07-07'
enddate=$( date -d "$enddate + 1 day" +%Y-%m-%d )
thedate=$( date -d "$startdate" +%Y-%m-%d )
while [ "$thedate" != "$enddate" ]; do
printf 'The date is "%s"\n' "$thedate"
beeline --hivevar DATE=$thedate -f query.hql
thedate=$( date -d "$thedate + 1 days" +%Y-%m-%d ) # increment by one day
done