$cat tt.sh #!/bin/bash start=`date +%s -d "2017-02-27 00:00:00"` end=`date +%s -d "2017-02-28 00:00:00"` while [ "$start" -le "$end" ] do day=`date -d @$start "+%Y%m%d"` echo $day start=$((start+86400)) done