#!/bin/bash

start_date="2022-11-01"
end_date="2022-12-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_nov2022.nc hourly_MAR_nov2022_${current_date//-/}.nc
    current_date=$next_date
done

