[ncl-talk] Pass a string to ncl via csh that contains a space

Annie Seagram aseagram at sonomatech.com
Tue Mar 22 14:37:43 MDT 2016


I have seen a number of discussions regarding passing strings as variables to ncl scripts from csh (e.g. here<https://www.ncl.ucar.edu/Support/talk_archives/2010/2386.html)>) and I have read through the NCL systems interactions page<https://www.ncl.ucar.edu/Applications/system.shtml#SHCLA>, but I can't figure out how to pass a string that has a space in it.

For example, on the command line one could specify:
ncl year=2014 month=5 'title="This is a title"' myscript.ncl

However, in a csh script how does one pass the title as a variable? It seems to crash when there are spaces. e.g.

This works:
#!/bin/csh -f
set title = "Thisisatitle"
ncl year=2014 month=5 title= \"{$title}\" myscript.ncl

This fails:
#!/bin/csh -f
set title = "This is a title"
ncl year=2014 month=5 title= \"{$title}\" myscript.ncl

The error:
Missing }.
Missing }.

Is there a way to escape this behavior? I'd like to avoid setting environment variables.

Thanks for your help.

-annie

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160322/59aa5d9d/attachment.html 


More information about the ncl-talk mailing list