Re: wrapit / cd

From: Michael Notaro <mnotaro_at_nyahnyahspammersnyahnyah>
Date: Thu, 01 Nov 2007 09:25:39 -0500

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
Received on Thu Nov 01 2007 - 08:25:39 MDT

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