Dear Arlindo,<br><br>Thank you for your answer. I have installed MacPort successfully but when I try to sudo port install dos2unix, seems like can't connect to the server. Then I saw that it was trying to download the expat 2.0.1.tar.gz so I downloaded it manually and install. However when I run the dos2unix run_script.bat, it says "dos2unix accept only standard input and output".<br>
<br>Serge<br><br><div class="gmail_quote">On Tue, Sep 20, 2011 at 9:19 PM, Arlindo da Silva <span dir="ltr"><<a href="mailto:dasilva@alum.mit.edu">dasilva@alum.mit.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Tue, Sep 20, 2011 at 8:55 AM, Rafanoharana Serge Claudio <span dir="ltr"><<a href="mailto:rafanoharana@gmail.com" target="_blank">rafanoharana@gmail.com</a>></span> wrote:<br></div>
</div><div class="gmail_quote"><div><div></div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear all,<br><br>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...<br>In Windows, in order to make a time series data, I use .bat file which name is run_script.bat and which contains:<br>
<br>foreach m (1 2 3 4 5 6 7 8 9 10 11 12)<br>ncdump fpar_re_2001_$(m).nc > test.cdl<br>sed -n '1,1p' test.cdl > test1.cdl<br>cat header_fpar_re_2001.txt >> test1.cdl<br>echo "" >> test1.cdl<br>
echo "data:" >> test1.cdl<br>echo "" >> test1.cdl<br>echo " time = $(m) ; " >> test1.cdl<br>echo "" >> test1.cdl<br>sed -n '16,20000000p' test.cdl >> test1.cdl<br>
ncgen -o fpar_re_fnl_2001_$(m).nc test1.cdl<br>end<br><br>and I use command prompt to run it:<br><br>tcsh run_script.bat<br><br>and it works perfectly.<br><br><br>Now, I move to Mac OS X and try to run this script. I did:<br>
<br>csh run_script.bat<br><br>but always get an error: "foreach: Words not parenthesized."<br>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."<br>I changed the extension to .sh but always the same problem.<br><br></blockquote><div><br></div></div></div><div>Even though you have .bat in your script file name, from the above it is clear that you are running a c-shell script, an old habit of mine as well. The issue you are having on Mac OS X is most likely because your "run_script.bat" file was created on Windows and has the funny MS-DOS line ending characters. All you need to do is to run this utility on your file:</div>
<div><br></div><div>% dos2unix run_script.bat</div><div><br></div><div>Here is the catch: if dos2unix is not standard on Mac OS X. If it is not available in your system you can install it from macports with</div><div><br>
</div><div>% sudo port install dos2unix</div><div><br></div><div>If you don't have macports installed, see here: <a href="http://www.macports.org/" target="_blank">http://www.macports.org/</a> or ask your sys admin to install it for you. (It is possible that I included some version of dos2unix with the opengrads win32 superpack, I can't remember.)</div>
<div><br></div><div> Arlindo</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Any help would be very helpful.<br><br>Thank you,<br>
<font color="#888888"><br>
Serge<br><br>
</font><br></div>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><font color="#888888"><br><br clear="all"><div><br></div>-- <br>Arlindo da Silva<br><a href="mailto:dasilva@alum.mit.edu" target="_blank">dasilva@alum.mit.edu</a><br>
</font><br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Serge<br>