[ncl-talk] system/systemfunc commands

M P mzp3769 at gmail.com
Sun May 17 14:08:51 MDT 2020


Dave,
Thanks, I understand now. What I really wanted which is to go to
a destination directory where I can execute ncl and access the data (the
purpose being to have the code in my home
so that it is backed up and switch to a mount where data is stored).
I know there are ways around it but it seemed like the easiest and cleanest
to do it.
Mark

On Sun, May 17, 2020 at 1:29 PM Dave Allured - NOAA Affiliate <
dave.allured at noaa.gov> wrote:

> 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/fbf4be62/attachment.html>


More information about the ncl-talk mailing list