Ola Pessoal,
Sou uma iniciante no linux e preciso de ajuda.
Criei um script em bash que essencialmente faz 3 procedimentos em loop:
1. Utiliza um arquivo de vento
2. Executa CHIEF
3. Atualiza uma data:

Ou seja, eu tenho arquivos de vento (exemplo: GDHNNMC20060518002006052100S.fct.T126L28) na pasta '${HOME}/parise/WAM4.5-sep2008/Ventos' que serão renomeados para 'WIND_INPUT' e o comando 'CHIEF' será executado.
Após isso, a data contida no nome do arquivo do vento deverá ser atualizada para uma segunda rodada e assim por diante.

Script se chama 'roda.sh':

#!/bin/ksh -x
#
# Call as roda.sh <initial date> <number of model runs>
#
# Porto Alegre, October 2008
#
# Definition of directories
#
WAMDIR=${HOME}/parise/WAM4.5-sep2008/work_exec # wam exec directory
WINDDIR=${HOME}/parise/WAM4.5-sep2008/Ventos # wind files
#
# Some parameters
#
IDATE=$1
NFILES=$2 # number of wind files = number of model runs
cont=1

# start loop
#
while ((${cont}<=${NFILES})) ; do
#
# Initialize variables
#
# description of indexes used in this script:
# i: initial
# f: final
# n: new
#
year=`echo ${IDATE} | cut -c 1-4`
mon=`echo ${IDATE} | cut -c 5-6`
day=`echo ${IDATE} | cut -c 7-8`
ihr=`echo ${IDATE} | cut -c 9-10`
YEAR=$year
YEARf=$year
YEARn=$year
MONTH=$mon
MONTHf=$mon
MONTHn=$mon
DAY=$day
DAYf=$day
DAYn=$day
HOUR=$ihr
HOURn=$ihr
dataruni=0000000000
datarunf=0000000000
#
# cut variables names to the right length
#
typeset -Z2 MONTHf DAYf
typeset -Z4 YEARf
typeset -Z2 MONTH DAY HOUR
typeset -Z4 YEAR
typeset -Z2 HOURn
typeset -Z2 MONTHn DAYn
typeset -Z4 YEARn
typeset -Z10 dataruni datarunf
#
# decide if leap-year
#
set -A cm xxx Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
let ydf=${YEAR}-2000
if ((${ydf}%4!=0)) ; then
set -A im 0 31 28 31 30 31 30 31 31 30 31 30 31
else
set -A im 0 31 29 31 30 31 30 31 31 30 31 30 31
fi
#
# compute dates in filename
#
let DAYf=${DAY}+3 # sum 3 to initial day
if ((${DAYf}>${im[${MONTH}]})) ; then
let DAYf=${DAYf}-${im[${MONTH}]}
if ((${DAYf}<${DAY})) ; then
let MONTHf=${MONTH}+1
if ((${MONTHf}>12)) ; then
let YEARf=${YEAR}+1
MONTHf=01
fi
fi
fi
#

YEAR1=`echo ${YEAR} | cut -c 3-4`
YEAR2=`echo ${YEARf} | cut -c 3-4`
datai=${YEAR}${MONTH}${DAY}${HOUR}
dataf=${YEARf}${MONTHf}${DAYf}${HOUR}
dataruni=${YEAR1}${MONTH}${DAY}${HOUR}0000
datarunf=${YEAR2}${MONTHf}${DAYf}${HOUR}0000
#
# core of the loop; commands **********************************************
#
arq="GDHNNMC${datai}${dataf}S.fct.T126L28"

rm -f WIND_INPUT

ln -s ${WINDDIR}/${arq} WIND_INPUT # link the wind file to the file WIND_INPUT

sed -e '18s/^.*$/ '$dataruni' '$datarunf'/' < WAM_User.tpl > WAM_User # edit the WAM_User file.

./CHIEF # run the wave model


#
# Comment out the following lines if you wish to keep the intermediate WAM output files
#
if ((${cont}<${NFILES})) ; then
rm -f totalsea${datai}*
fi


# *************************************************************************
#
# increment dates and the variable cont
#
let HOURn=${HOUR}+24
if ((${HOURn}==24)) ; then
HOURn=00
let DAYn=${DAY}+1

if ((${DAYn}>${im[${MONTH}]})) ; then
echo ${DAY} ${DAYn}
let DAYn=${DAYn}-${im[${MONTH}]}
if ((${DAYn}<${DAY})) ; then
let MONTHn=${MONTH}+1
if ((${MONTHn}>12)) ; then
let YEARn=${YEAR}+1
MONTHn = 01
fi
fi
fi
fi
IDATE=${YEARn}${MONTHn}${DAYn}${HOURn}
let cont=${cont}+1
#
# end of loop
#
done


E o script é chamado da seguinte maneira:

# Call as roda.sh <initial date> <number of model runs>


./roda.sh 2006051800 3

Porem nao obtive resultado.
Alguem pode me dar uma ajuda?
Agradeceria muito.
Claudia Parise