On Wed, Sep 21, 2011 at 1:16 AM, Rafanoharana Serge Claudio <span dir="ltr">&lt;<a href="mailto:rafanoharana@gmail.com">rafanoharana@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
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&#39;t connect to the server.</blockquote><div><br></div><div>Either the server was down or your firewall is really strict...</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">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 &quot;dos2unix accept only standard input and output&quot;.<br>

<br></blockquote><div><br></div><div>Hmm. Here is what I get when running dos2unix installed  via mac ports:</div><div><br></div><div><div>% dos2unix junk.txt </div><div>dos2unix: converting file junk.txt to UNIX format ...</div>
</div><div><br></div><div>Which version of Mac OS X are you using?</div><div><br></div><div>    Arlindo</div><div> </div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Serge<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Tue, Sep 20, 2011 at 9:19 PM, Arlindo da Silva <span dir="ltr">&lt;<a href="mailto:dasilva@alum.mit.edu" target="_blank">dasilva@alum.mit.edu</a>&gt;</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>On Tue, Sep 20, 2011 at 8:55 AM, Rafanoharana Serge Claudio <span dir="ltr">&lt;<a href="mailto:rafanoharana@gmail.com" target="_blank">rafanoharana@gmail.com</a>&gt;</span> wrote:<br></div>
</div><div class="gmail_quote"><div><div></div><div><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&#39;s why I&#39;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 &gt; test.cdl<br>sed -n &#39;1,1p&#39; test.cdl &gt; test1.cdl<br>cat header_fpar_re_2001.txt &gt;&gt; test1.cdl<br>echo &quot;&quot; &gt;&gt; test1.cdl<br>



echo &quot;data:&quot; &gt;&gt; test1.cdl<br>echo &quot;&quot; &gt;&gt; test1.cdl<br>echo &quot; time = $(m) ; &quot; &gt;&gt; test1.cdl<br>echo &quot;&quot; &gt;&gt; test1.cdl<br>sed -n &#39;16,20000000p&#39; test.cdl &gt;&gt; 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: &quot;foreach: Words not parenthesized.&quot;<br>I have already changed the $(m) to ${m} and even type directly the name 
of the file but always obtain the message &quot;foreach: Words not 
parenthesized.&quot;<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 &quot;run_script.bat&quot; 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&#39;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&#39;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>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" 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><br><br clear="all"><br>-- <br></div></div><font color="#888888">Serge<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"><div><br></div>-- <br>Arlindo da Silva<br><a href="mailto:dasilva@alum.mit.edu">dasilva@alum.mit.edu</a><br>