<div dir="ltr"><div>FYI only: <br>The reverse of the original question. From an NCL script, pass a string to NCL&#39;s system procedure ...<br><br></div>An NCL script &#39;acting&#39; like a shell script to invoke another NCL script  :-)<br><div><div><br>===<br><br>The next release of NCL: 6.4.0 has an embarassingly simple utility function that I have used used that in someways simplifies text issues<br><br><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/cla_sq.shtml">http://www.ncl.ucar.edu/Document/Functions/Built-in/cla_sq.shtml</a><br><br>undef(&quot;cla_sq&quot;)<br>function cla_sq(sleft[1]:string, sright[1]:string)<br>; Simple utility used for creating Command Line Assignments (CLAs) within a script<br>; <br>; Return a string with a single quote (sq) at the<br>; beginning and end which enclose *nix sensitive characters.<br>;<br>; [1]  s  = cla_sq(&quot;PATH&quot;,&quot;./<a href="http://FIM.G5test.nc">FIM.G5test.nc</a>&quot;)  =&gt; &#39;PATH=&quot;./<a href="http://FIM.G5test.nc">FIM.G5test.nc</a>&quot;&#39;<br>;<br>; [2]<br>; asgn1 = cla_sq(  &quot;f&quot;, &quot;<a href="http://test.nc">test.nc</a>&quot;)             ; asgn1= &#39;f=&quot;<a href="http://test.nc">test.nc</a>&quot;&#39;<br>; asgn2 = cla_sq(  &quot;p&quot;, &quot;(/850,500,200/)&quot;)     ; asgn2= &#39;p=(/850,500,200/)&#39;<br>; asgn3 = cla_sq(&quot;var&quot;, &quot;(/&quot;T&quot;,&quot;Q&quot;/)&quot;          ; asgn3= &#39;var=(/&quot;T&quot;,&quot;Q&quot;/)&#39;<br>; cmd   = &quot;ncl year=2015 &quot;+asgn1+&quot; &quot;+asgn2+&quot; &quot;+asgn3+&quot; foo.ncl&quot;<br>; system(cmd)<br>;---<br>local sq<br>begin<br>   sq    = str_get_sq()      ; single quote character<br>   return(sq+ sleft +&quot;=&quot;+sright +sq)<br>end<br><br></div><div>Maybe it will be useful.<br><br></div><div>D<br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 1, 2016 at 2:12 AM, Karl-Hermann Wieners <span dir="ltr">&lt;<a href="mailto:karl-hermann.wieners@mpimet.mpg.de" target="_blank">karl-hermann.wieners@mpimet.mpg.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Annie,<br>
<span class=""><br>
On 03/22/2016 09:37 PM, Annie Seagram wrote:<br>
&gt; However, in a csh script how does one pass the title as a variable? It<br>
&gt; seems to crash when there are spaces. e.g.<br>
&gt;<br>
</span><span class="">&gt; This fails:<br>
&gt;<br>
&gt; #!/bin/csh -f<br>
&gt;<br>
&gt; set title = “This is a title”<br>
&gt;<br>
&gt; ncl year=2014 month=5 title= \&quot;{$title}\&quot; myscript.ncl<br>
&gt;<br>
&gt; The error:<br>
&gt;<br>
&gt; Missing }.<br>
<br>
</span>There are two answers to this:<br>
<br>
(1) Use double quotes instead of curlies:<br>
<span class=""><br>
#!/bin/csh -f<br>
set title = &quot;This is a title&quot;<br>
ncl year=2014 month=5 title=\&quot;&quot;$title&quot;\&quot; myscript.ncl<br>
<br>
</span>(2) If you need this often, you may want to try a wrapper script for<br>
ncl, called nclsh, (see gzipped attachment) which - if put in PATH - may<br>
be called like ncl, but passes any command line options as NCL args,<br>
creating quotes internally:<br>
<span class=""><br>
#!/bin/csh -f<br>
<br>
set title = &quot;This is a title&quot;<br>
</span>nclsh --year=2014 --month=5 --title=&quot;$title&quot; myscript.ncl<br>
<br>
More information may be found at<br>
<a href="https://code.zmaw.de/projects/nclsh/news/" rel="noreferrer" target="_blank">https://code.zmaw.de/projects/nclsh/news/</a><br>
<br>
Best,<br>
Karl<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Karl-Hermann Wieners<br>
Max-Planck-Institut für Meteorologie<br>
Bundesstraße 53<br>
20146 Hamburg<br>
Germany<br>
phone: <a href="tel:%2B49%2040%2041173%20161" value="+494041173161">+49 40 41173 161</a><br>
email: <a href="mailto:karl-hermann.wieners@mpimet.mpg.de">karl-hermann.wieners@mpimet.mpg.de</a><br>
</font></span><br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>