As long as the dates are in the format YYYY-MM-DD, you can compare them lexicographically and date to perform calendar arithmetic without conversion to seconds:
startdate=2013-03-15 enddate=2013-04-14 curr="$startdate" while true; do echo "$curr" [ "$curr" \< "$enddate" ] || break curr=$( date +%Y-%m-%d --date "$curr +1 day" ) done
With [ ... ] you need to avoid < to avoid confusion with the input redirection operator.
It has a start date stamp wart if it is greater than the end date.
chepner
source share