[ncl-talk] system/systemfunc commands

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Sun May 17 13:29:09 MDT 2020


Mark, it looks like you misinterpreted the last result.  I see the
following, according to my suggestion #2.  Cd to "test", this is what you
said you wanted.  Two different system commands, both including "cd".

Then you do a third system command without including "cd", and the previous
change directory is forgotten, as expected.  Please re-read my explanation
of sub shells.  Am I missing something in your question?

      .../mapp/ncl/test
      (0)     .../mapp/ncl/test
      .../mapp/ncl


On Sun, May 17, 2020 at 12:22 PM M P via ncl-talk <ncl-talk at ucar.edu> wrote:

> Thanks, the new code and response are below. I also modified the code
> after Dave's suggestion
> but that does not improve.
> I am sorry but that is a bummer,
> Mark
>
> (directory "./test" exits)
> begin
>
>    ncldir="./test"
>    command="cd " + ncldir
>
>    system("pwd")
>    system(command)
>    print(systemfunc(command))
>    system("pwd")
>
> end
>
> ..../mapp/ncl
> (0)     missing
> ..../mapp/ncl
>
> begin
>
>    ncldir="./test"
>    command="cd " + ncldir + "; pwd"
>
>    system("pwd")
>    system(command)
>    print(systemfunc(command))
>    system("pwd")
>
> end
>
> .../mapp/ncl
> .../mapp/ncl/test
> (0)     .../mapp/ncl/test
> .../mapp/ncl
>
>
>
>
> On Sun, May 17, 2020 at 12:01 PM Rick Brownrigg <brownrig at ucar.edu> wrote:
>
>> Is it possible the system(command) call is failing?  Try something like
>> this to verify:
>>
>>      print(systemfunc(command))
>>
>> Rick
>>
>> On Sun, May 17, 2020 at 11:33 AM M P via ncl-talk <ncl-talk at ucar.edu>
>> wrote:
>>
>>> Hello,
>>> I have a simple test script that is not doing the right thing.
>>> The output is the same for both first and second system calls
>>> so that the directory is not changed.
>>> Can you help with a solution?
>>> Thanks,
>>> Mark
>>>
>>> begin
>>>
>>>    ncldir="./test"
>>>    command="cd " + ncldir
>>>
>>>    system("pwd")
>>>    system(command)
>>>    system("pwd")
>>>
>>> end
>>>
>>> ..../mapp/ncl
>>> ..../mapp/ncl
>>>
>>> (same with systemfunc)
>>>
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200517/2ed3619a/attachment.html>


More information about the ncl-talk mailing list