shell script operate the date

How to increment a date in a bash script

Use the date command's ability to add days to existing dates.

The following:

DATE=2013-05-25

for i in {0..8}
do
   NEXT_DATE=$(date +%m-%d-%Y -d "$DATE + $i day")
   echo "$NEXT_DATE"
done

 

posted @ 2019-07-04 20:14  ChuckLu  阅读(177)  评论(0编辑  收藏  举报