Another option I came up with based on the above answers. Now you can specify the start and end date.
#!/bin/bash datestart=20110101 dateend=20111231 for tmpd in {0..6} do date -d "$datestart $tmpd day" | grep -q Mon if [ $? = 0 ]; then break fi done for ((tmpw = $tmpd; $(date -d "$datestart $tmpw day" +%s) <= $(date -d "$dateend" +%s); tmpw += 7)) do echo `date -d "$datestart $tmpw day" +%d-%b-%Y` done
source share