Re: wrapit / cd

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu, 01 Nov 2007 08:31:53 -0600

I would have thought that something like the following would work.
It is analogous to
     diri = "..."
     file = systemfunc("cd "+diri+" ; ls foo*)

so
     system ("cd "+diri+" ; WRAPIT ......)

Basically, use the fact the multiple Unix commands can
be separated the semi-colon.

Michael Notaro wrote:
> Thanks. I know how to loop through the directory names and even change
> directories,
> but how do I execute wrapit from each of those directories?
>
> If I use system(cd ...) and then on the next line, execute wrapit, it
> will not run the .so file
> in that directory since the system command is temporary.
>
> Mike
>
>
> On Oct 31, 2007, at 5:24 PM, Rick Grubin wrote:
>
>> Hi Mike
>>
>>> Is there any way in NCL to change to directory A, use wrapit to run a
>>> fortran file there, change to directory B, use wrapit to run a
>>> fortran file there, and so on?
>>>
>>> I want to loop through a list of directory-name strings in NCL,
>>> change to those directories, and use wrapit to run fortran programs
>>> in those directories. But system("cd ...") apparently only
>>> temporarily changes directory if that makes sense, meaning once NCL
>>> gets to the next line, it no longer is in that directory.
>>
>> The 'system()' function executes its command argument in a subshell,
>> meaning that whatever command you wish to run is a separate process
>> from your NCL session. Once it's done executing, you're "right back
>> where you started" so to speak. This is how the Unix 'system'
>> function operates.
>>
>> If your list of directory name strings is representative of a flat
>> file structure -- all directories have the same root -- then you
>> should be able to loop without difficult using 'system(cd ...)' by
>> iterating over your list of strings.
>>
>> If your list of directory name strings is a tree structure -- each
>> directory is a subdirectory of the previous -- then you'll need to
>> build a directory name string as you go, concatenating strings to be
>> able to change directory to successive levels down.
>>
>> Example #2 at:
>> http://www.ncl.ucar.edu/Document/Functions/Built-in/system.shtml
>> should give you an idea of how to do this, where you'd build a new
>> directory name each time instead of a new filename as in the example.
>>
>> If I didn't completely understand your question, could you please
>> explain a bit more?
>>
>> -Rick.
>> ----
>> Rick Grubin NCAR/TDD/CISL/VETS
>> Visualization + Enabling Technologies
>> grubin_at_ucar.edu 303.497.1832
>>
>>
>
> _______________________________________________
> 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
Received on Thu Nov 01 2007 - 08:31:53 MDT

This archive was generated by hypermail 2.2.0 : Fri Nov 02 2007 - 10:04:33 MDT