vendredi 30 novembre 2018

Issue with including if statement in bash script

I am pretty new to bash scripting. I have my bash script below and I want to include an if statement when month (ij==09) equals 09 then "i" should be from 01 to 30. I tried several ways but did not work.

How can I include an if statement in the code below to achieve my task.? Any help is appreciated.

Thanks.

#!/bin/bash
        for ii in 2007 
        do
        for i in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 #Day of the Month
        do
        for ij in 09 10 # Month
        do
         for j in 0000 0100 0200 0300 0400 0500 0600 0700 0800 0900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300
         do
         cdo cat DAS_0125_H.A${ii}${ij}${i}.${j}.002_var.nc outfile_${ii}${ij}${i}.nc
         done
        done
        done
        done

Aucun commentaire:

Enregistrer un commentaire