Skip to content

Instantly share code, notes, and snippets.

@yogesh-desai
Forked from chluehr/date_loop.sh
Created June 25, 2016 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yogesh-desai/1fe4c5c48244da0908e207e0f1069f1b to your computer and use it in GitHub Desktop.
Save yogesh-desai/1fe4c5c48244da0908e207e0f1069f1b to your computer and use it in GitHub Desktop.
Bash: Loop over dates
#!/bin/bash
now=`date +"%Y-%m-%d" -d "05/06/2012"`
end=`date +"%Y-%m-%d" -d "05/23/2012"`
while [ "$now" != "$end" ] ;
do
now=`date +"%Y-%m-%d" -d "$now + 1 day"`;
echo $now
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment