Re: NCL and standard in

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Wed, 23 Jul 2008 14:44:18 -0600

Sorry to bother you again. I just found out that the real cause of
NCL grabbing standard in was the lack of an "exit" statement at the
end of my original NCL program. With "exit", the NCL interpreter is
satisfied and returns to the calling shell without trying to read
any more commands.

The use of < /dev/null may be helpful in cases when one is not sure
how the NCL program will terminate. But it seems that it is not
necessary in general.

--Dave

Dave Allured wrote:
> Thanks to James Correia, Mary Haley, Daryl Herzmann, and Dennis Shea for
> all your good suggestions.
>
> Daryl's method (below) was elegant and worked like a charm in c shell.
>
> I had the order of my command line arguments reversed from NCL
> recommended ordering, so the following form may be better:
>
> ncl infile=\"filespec\" script.ncl < /dev/null
>
> I would like to suggest that this be added to the NCL command line
> documentation page in one or both of these general forms for use within
> shell scripts:
>
> ncl script.ncl < /dev/null
> ncl [arguments] script.ncl < /dev/null
>
> Thank you!
>
> --Dave
>
> 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

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jul 23 2008 - 14:44:18 MDT

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