Re: ncl in c-shell script; exit if ncl script fails - update - final I hope

From: Bob Tomas <tomas_at_nyahnyahspammersnyahnyah>
Date: Thu, 8 Jun 2006 14:35:09 -0600 (MDT)

Hi again All,

Kieth Lindsay just pointed out a clever way to remove the limitation
I pointed out in my method regarding the syntax error issue:

         put the touch command in the c-shell script before executing
         the ncl script.

Bob

On Thu, 8 Jun 2006, Bob Tomas wrote:

> Hi All,
>
> I need to point out some limitations and correct some typo's
> to my "clever" solution.
>
> First, this doesn't work if the script fails while it is
> being parsed and there is incorrect syntax because the code
> never executes. Thus, the system "touch" and "rm" commands
> never execute.
>
> Second, the leading ! on the if statement needs to be removed
> and the conditional statement should contain the string
> abnormal_exit, not abnormal_ext.
>
> Those are the only errors I see at the moment...
>
>
> Bob
>
>
>
> On Thu, 8 Jun 2006, Mary Haley wrote:
>
>>
>> My apologies, this question slipped through the cracks. This is
>> something you can't currently do with NCL, but it has been on our
>> list of enhancements we'd like to make.
>>
>> Bob found a solution, which I thought was pretty clever:
>>
>> At the top of the ncl script: system("touch abnormal_exit")
>> at the end of the ncl script: system("\rm abnormal_exit")
>>
>> and in the c-shell script after the ncl script runs:
>>
>> if !(-e abnormal_ext) then
>> tell me
>> exit
>> endif
>>
>> --Mary
>>
>>
>> On Fri, 2 Jun 2006, Bob Tomas wrote:
>>
>>> Hello
>>>
>>> I have a c-shell script that does a number of things including running an
>>> ncl script. I'd like to exit the c-shell script if the ncl script doesn't
>>> complete normally. I tried this:
>>>
>>>
>>> ncl script_name.ncl || exit 1
>>>
>>>
>>> and
>>>
>>> ncl script_name.ncl || exit 1
>>> if($status != 0) then
>>> exit 1
>>> endif
>>>
>>> but these methods don't work. Is there some other way to simply do what
>>> I want?
>>>
>>> Thanks.
>>>
>>> Bob
>>> --
>>> -------------------------------------------------------------
>>> Robert A. Tomas
>>> National Center for Atmospheric Research
>>> Climate and Global Dynamics Division - Paleoclimatology
>>> 1850 Table Mesa Drive
>>> Boulder, CO 80305-3000
>>> e-mail: tomas_at_ucar.edu tel: 303-497-1342 fax: 303-497-1348
>>> _______________________________________________
>>> 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
>>
>
>

-- 
-------------------------------------------------------------
Robert A. Tomas
National Center for Atmospheric Research
Climate and Global Dynamics Division - Paleoclimatology
1850 Table Mesa Drive
Boulder, CO 80305-3000
e-mail: tomas_at_ucar.edu  tel: 303-497-1342  fax:  303-497-1348
Received on Thu Jun 08 2006 - 14:35:09 MDT

This archive was generated by hypermail 2.2.0 : Mon Jun 12 2006 - 06:59:59 MDT