Shell loop by day

Quite often I find that I need to create quick Unix scripts to run a set of commands day by day. ┬áHere’s a template loop I start with:

# 1=start date YYYY-MM-DD
# 2=end date YYYY-MM-DD

CURR_DATE=${1}
while [ `date +”%Y%m%d” -d “${CURR_DATE}”` -le `date +”%Y%m%d” -d “${2}”` ]
do
echo “Processing = ${CURR_DATE}”

## add your commands here…

CURR_DATE=`date +”%Y-%m-%d” -d “${CURR_DATE} + 1 day”`
done

echo “ALL DONE!”