<div dir="ltr"><div>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.</div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, May 17, 2020 at 2:09 PM M P <<a href="mailto:mzp3769@gmail.com">mzp3769@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dave,<div>Thanks, I understand now. What I really wanted which is to go to </div><div>a destination directory where I can execute ncl and access the data (the purpose being to have the code in my home</div><div>so that it is backed up and switch to a mount where data is stored).</div><div>I know there are ways around it but it seemed like the easiest and cleanest to do it.</div><div>Mark</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, May 17, 2020 at 1:29 PM Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>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".</div><div><br></div><div>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?<br><br> .../mapp/ncl/test<br> (0) .../mapp/ncl/test<br> .../mapp/ncl</div><div class="gmail_quote"><div dir="ltr" class="gmail_attr"><br></div><div dir="ltr" class="gmail_attr"><br></div><div dir="ltr" class="gmail_attr">On Sun, May 17, 2020 at 12:22 PM M P via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thanks, the new code and response are below. I also modified the code after Dave's suggestion<div>but that does not improve.</div><div>I am sorry but that is a bummer,<br><div>Mark <div><br></div></div><div>(directory "./test" exits)</div><div>begin<br><br> ncldir="./test"<br> command="cd " + ncldir<br><br> system("pwd")<br> system(command)<br> print(systemfunc(command))<br> system("pwd")<br><br>end<br></div><div><br></div><div><div>..../mapp/ncl</div><div>(0) missing<br>..../mapp/ncl<br></div><div><br></div></div><div>begin<br><br> ncldir="./test"<br> command="cd " + ncldir + "; pwd"<br><br> system("pwd")<br> system(command)<br> print(systemfunc(command))<br> system("pwd")<br><br>end<br><br>.../mapp/ncl</div><div>.../mapp/ncl/test<br>(0) .../mapp/ncl/test<br>.../mapp/ncl<br><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, May 17, 2020 at 12:01 PM Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Is it possible the system(command) call is failing? Try something like this to verify:</div><div><br></div><div> print(systemfunc(command))</div><div><br></div><div>Rick<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, May 17, 2020 at 11:33 AM M P via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello,<div>I have a simple test script that is not doing the right thing.</div><div><div>The output is the same for both first and second system calls</div><div>so that the directory is not changed.</div><div></div></div><div>Can you help with a solution?</div><div>Thanks,</div><div>Mark</div><div><br></div><div>begin<br><br> ncldir="./test"<br> command="cd " + ncldir<br><br> system("pwd")<br> system(command)<br> system("pwd")<br><br>end<br><br></div><div>..../mapp/ncl<br>..../mapp/ncl<br></div><div><br></div><div>(same with systemfunc)</div></div></blockquote></div></blockquote></div></blockquote></div></div></div></div>
</blockquote></div>
</blockquote></div></div>