#!/bin/bash

start_date="2004-11-01"
end_date="2005-01-01"

current_date="$start_date"

while [ "$current_date" != "$end_date" ]; do
    echo "$current_date"
    next_date=$(date -d "$current_date + 1 day" +%Y-%m-%d)
    cdo seldate,$current_date ../hourly_MAR_ISPOL.nc hourly_MAR_ISPOL_${current_date//-/}.nc
    current_date=$next_date
done

