[ncl-talk] system/systemfunc commands

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Sun May 17 14:24:07 MDT 2020


I get it.  I have wanted to do that too, for similar reasons.  But we are
constrained by the limitations of sub shells on Unix/Linux systems.  Just
get used to one of the compromise approaches that I suggested earlier.
Pick whatever seems the most straightforward.


On Sun, May 17, 2020 at 2:09 PM M P <mzp3769 at gmail.com> wrote:

> 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)
>>>>>
>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200517/d1d27ba2/attachment.html>


More information about the ncl-talk mailing list