<div dir="ltr"><div>Hello All,</div><div><br></div><div>I am trying to run my ncl script from the following shell script:</div><div><br></div>#!/bash/bin<br>for i in {1..2}<br>do<br>echo $i<br>ncl myfile.ncl<br>done<br clear="all"><div><br></div><div>Runs perfectly fine =></div><div>[bidyut@localhost]$ sh test.sh <br>1<br> Copyright (C) 1995-2017 - All Rights Reserved<br> University Corporation for Atmospheric Research<br> NCAR Command Language Version 6.4.0<br> The use of this software is governed by a License Agreement.<br> See <a href="http://www.ncl.ucar.edu/">http://www.ncl.ucar.edu/</a> for more details.<br>(0)  Hello<br>2<br> Copyright (C) 1995-2017 - All Rights Reserved<br> University Corporation for Atmospheric Research<br> NCAR Command Language Version 6.4.0<br> The use of this software is governed by a License Agreement.<br> See <a href="http://www.ncl.ucar.edu/">http://www.ncl.ucar.edu/</a> for more details.<br>(0) Hello<br></div><div><br></div><div>But if I try to run:</div><div><br></div><div>#!/bash/bin<br>cat myfile| while read mname <br>do<br>echo "$mname"<br>echo "Running the NCL script"<br>ncl myfile.ncl<br>done<br></div><div><br></div><div>I get an error=></div><div>[bidyut@localhost]$ sh test1.sh <br>name1<br>Running the NCL script<br> Copyright (C) 1995-2017 - All Rights Reserved<br> University Corporation for Atmospheric Research<br> NCAR Command Language Version 6.4.0<br> The use of this software is governed by a License Agreement.<br> See <a href="http://www.ncl.ucar.edu/">http://www.ncl.ucar.edu/</a> for more details.<br>(0)     Hello<br>fatal:syntax error: line -1 before or near \n <br>name2<br>-----^<br><br>fatal:error in statement<br></div><div><br></div><div><br></div><div>What am I doing wrong?</div><div><br></div><div>FYI, Here are the associated file contents:</div><div>[bidyut@localhost]$ cat myfile<br>name1<br>name2<br></div><div><br></div><div>[bidyut@localhost]$ cat myfile.ncl <br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br><br>begin<br><br>print("Hello")<br><br>end<br></div><div><br></div><div>Thanks,</div><div>Bidyut</div></div>