start_date='20201201' end_date='20201221' while [ "${start_date}" -le "${end_date}" ]; do start_date=`date -d "$start_date" +%Y-%m-%d` echo ${start_date} start_date=$(date -d "$start_date+1days" +%Y%m%d) done