Skip to content

Instantly share code, notes, and snippets.

@j450h1
Forked from chluehr/date_loop.sh
Created October 1, 2016 00:31
Show Gist options
  • Save j450h1/5d7d64f08fcd0711077eb6e6662a1ec4 to your computer and use it in GitHub Desktop.
Save j450h1/5d7d64f08fcd0711077eb6e6662a1ec4 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