티스토리 뷰

공부

[Sh] for date `start ~ end`

승가비 2021. 1. 9. 00:51
728x90
start=20200101
end=20201231

date=$start
while [ $date -le $end ]
do
    date=`date -d "$date+1 days" +%Y%m%d`
done

https://www.cyberciti.biz/faq/how-to-add-days-to-date-and-get-new-date-on-linux/

 

How to add days to date and get new date on Linux - nixCraft

Explains how to add or subtract days using date command calculation on Linux, Unix, and macOS/*BSD operating system command line.

www.cyberciti.biz

 

728x90

'공부' 카테고리의 다른 글

Date format day `EEE` or `EEEE`  (0) 2021.01.14
[Python] for by date  (0) 2021.01.09
[Hive] copy table (rename not supported on hive)  (0) 2021.01.09
[HDFS] remove trash for empty  (0) 2021.01.09
[Sh] merge files  (0) 2021.01.09
댓글