[gradsusr] script similar to batch in Mac OS X

Rafanoharana Serge Claudio rafanoharana at gmail.com
Tue Sep 20 08:55:13 EDT 2011


Dear all,

I guess that it is not the right place to ask this question, but I know that
it can be solved here that's why I'm asking...
In Windows, in order to make a time series data, I use .bat file which name
is run_script.bat and which contains:

foreach m (1 2 3 4 5 6 7 8 9 10 11 12)
ncdump fpar_re_2001_$(m).nc > test.cdl
sed -n '1,1p' test.cdl > test1.cdl
cat header_fpar_re_2001.txt >> test1.cdl
echo "" >> test1.cdl
echo "data:" >> test1.cdl
echo "" >> test1.cdl
echo " time = $(m) ; " >> test1.cdl
echo "" >> test1.cdl
sed -n '16,20000000p' test.cdl >> test1.cdl
ncgen -o fpar_re_fnl_2001_$(m).nc test1.cdl
end

and I use command prompt to run it:

tcsh run_script.bat

and it works perfectly.


Now, I move to Mac OS X and try to run this script. I did:

csh run_script.bat

but always get an error: "foreach: Words not parenthesized."
I have already changed the $(m) to ${m} and even type directly the name of
the file but always obtain the message "foreach: Words not parenthesized."
I changed the extension to .sh but always the same problem.

Any help would be very helpful.

Thank you,

Serge
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20110920/36924478/attachment-0003.html 


More information about the gradsusr mailing list