Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

for loop on date in bash

d=2015-01-01
while [ "$d" != 2015-02-20 ]; do 
  echo $d
  d=$(date -I -d "$d + 1 day")

  # mac option for d decl (the +1d is equivalent to + 1 day)
  # d=$(date -j -v +1d -f "%Y-%m-%d" "2020-12-12" +%Y-%m-%d)
done
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #loop #date #bash
ADD COMMENT
Topic
Name
4+8 =