bash shell date parsing, start with specific date and loop through each day in month

[radical@home ~]$ cat a.sh 
#!/bin/bash

START=`echo $1 | tr -d _`;

for (( c=0; c<$2; c++ ))
do
    echo -n "`date --date="$START +$c day" +%Y_%m_%d` ";
done

Now if you call this script with your params it will return what you wanted:

[radical@home ~]$ ./a.sh 2010_04_01 6
2010_04_01 2010_04_02 2010_04_03 2010_04_04 2010_04_05 2010_04_06

Very basic bash script should be able to do this:

#!/bin/bash 
start_date=20100501
num_days=5
for i in `seq 1 $num_days`
do 
    date=`date +%Y/%m/%d -d "${start_date}-${i} days"`
    echo $date # Use this however you want!
done

Output:
2010/04/30
2010/04/29
2010/04/28
2010/04/27
2010/04/26


Note: NONE of the solutions here will work with OS X. You would need, for example, something like this:

date -v-1d +%Y%m%d

That would print out yesterday for you. Or with underscores of course:

date -v-1d +%Y_%m_%d

So taking that into account, you should be able to adjust some of the loops in these examples with this command instead. -v option will easily allow you to add or subtract days, minutes, seconds, years, months, etc. -v+24d would add 24 days. and so on.