Re: NCL and standard in

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed, 23 Jul 2008 07:39:37 -0600

Actually, I use NCL for scripting any more. No 'escaping the shell' issues.

---
I  am not smart enough to use the bash shell.
Here is a C-shell example. The last line is pretty clear, isn't it.  :-)
#!/bin/csh -f
# test CLA [command line argument]
cat > test.ncl << "TEST"         # NCL code
   if (isvar("inputfile")) then
       print("inputfile="+inputfile)
   else
       print("Missing CLA")
   end if
"TEST"
 
 set a=foo.nc
 echo "===================="
 echo "echo: " $a
 echo "===================="
 echo "echo: " \'inputfile=$a\'
 echo "===================="
 eval ncl inputfile=\\\"$a\\\" test.ncl
 /bin/rm -f test.ncl
Daryl Herzmann wrote:
> Hi Dave,
>
> My two cents idea would be to run ncl in your bash script like so:
>
> ncl script.ncl infile=\"filespec\" < /dev/null
>
> That should cause ncl to read STDIN from /dev/null instead of what the 
> shell script is getting, but I am not positive this will work.
>
> daryl
>
> On Wed, 23 Jul 2008, Mary Haley wrote:
>
>> Dave,
>>
>> What happens if you try:
>>
>> ncl infile=\"filespec\" script.ncl
>>
>> I'm hoping that NCL will see that "script.ncl" and decide that
>> it is done reading input.
>>
>> When it's the other way, however, NCL may be thinking that
>> *everything* after the "script.ncl" is a command line option,
>> and so it reads it all in.
>>
>> --Mary
>>
>> On Tue, 22 Jul 2008, Dave Allured wrote:
>>
>>> Hi.  I would like to call an NCL script in batch mode within a loop 
>>> in a shell script.  The shell script is trying to read input from 
>>> standard in (Unix).  However, the first time NCL is called, it seems 
>>> to grab all of the remaining input from standard in.
>>>
>>> Is there a reasonable way to get NCL to not grab standard in?
>>>
>>> NCL version 5.0.1 pre-release on Mac OS 10.5 PPC.  I think I have 
>>> seen this before on earlier versions.  My invocation of NCL is 
>>> fairly normal:
>>>
>>>  ncl script.ncl infile=\"filespec\"
>>>
>>> Thank you for any advice.
>>>
>>> Dave Allured
>>> CU/CIRES Climate Diagnostics Center (CDC)
>>> http://cires.colorado.edu/science/centers/cdc/
>>> NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
>>> http://www.cdc.noaa.gov/
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk_at_ucar.edu
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk_at_ucar.edu
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jul 23 2008 - 07:39:37 MDT

This archive was generated by hypermail 2.2.0 : Fri Aug 01 2008 - 09:46:25 MDT