Re: Changing Directories in the middle of an NCL script

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri, 24 Apr 2009 15:21:36 -0600 (MDT)

Each "system" call executes one set of commands in the shell, and
once you leave it, it returns to its original state.

So, if you use "system" to cd to a directory, you won't still be
in that directory if you call "system" again.

You can use the UNIX ";" character to execute a series of UNIX commands:

  cmd = "cd DIR1 ; do_what_im_doing_in_DIR1 ; cd DIR2 ; do_what_im_doing_in_DIR2"
  system(cmd)

--Mary

On Fri, 24 Apr 2009, wcapehar wrote:

> We¹re using NCL to do some processing that will require us to change
> directory ³amid-script.² In other words, we¹ll be doing something in dir1
> and then needing to cd into dir2 and do something else.
>
> doing it this way...
>
> system(³cd DIR1²)
> system(³do_what_im_doing_in_DIR1²)
> system(³cd DIR2²)
> system(³do_what_im_doing_in_DIR2²)
>
> ...doesn¹t do it...
>
> There is a need to do this
>
> There is an equivalent command in IDL, but is there one NCL? Or do I need
> to run a script in each directory, starting each with a shell command.
>
> ================================================================
> Bill Capehart <William.Capehart_at_sdsmt.edu> Associate Professor
> Institute of Atmospheric Sciences Land Surface Processes
> 213 Mineral Industries Building Hydrometeorology
> South Dakota School of Mines and Technology Ph: +1-605-394-1994
> 501 East Saint Joseph Street Fax: +1-605-394-6061
> Rapid City, SD 57701-3995 Mobile: +1-605-484-5692
> =================== http://capehart.sdsmt.edu ==================
>
>
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Apr 24 2009 - 15:21:36 MDT

This archive was generated by hypermail 2.2.0 : Mon Apr 27 2009 - 16:09:00 MDT