Changing directories in the background

James Cameron jc at raven.bu.edu
Wed May 1 13:36:00 AEST 1991


>>>>> On 30 Apr 91 05:52:42 GMT, gheim at eng.auburn.edu (Greg Heim) said:
Greg> Nntp-Posting-Host: lab14.eng.auburn.edu

Greg> Howdy,

Greg> I just tried the following:

Greg>    cd /new/dir &

Greg> by accident and my directory didn't change.  Can anybody tell me what happens
Greg> internally here?


Greg> Thanks in advance,

Greg> Greg



Well, to put it simply the & creates a child of the original, inherenting
the parents stuff, but not causing anything to happen to the parent.

Graphically, looks something like this:

____________________________________________________________________
|                                                                  |
|     Parent - (shell in this case)  certain commands work on this |
|              while others cause it to bear children (another     |
|              call for sex safe!)                                 |
___________________________________________________________________
         |                   |                     |
         |                   |                     |
         |                   |                     |
         |                   |                     |
   ----------------   ---------------    --------------------
   | shell scripts|   |  background |    |  Those programs  |
   ----------------   |     jobs    |    |  which do exec   |
               /\     ---------------    |      calls       |
                \\          /\           --------------------
                 \\         ||           /|
                  \\        ||          //
                   \\       ||         //
                    \\      ||        //
                     \\     ||       //
                      \\    ||      //

                         Children

Now, I am sure that others with have something to say about
this, but that is what I know....*8-)

jc
--
					-- James Cameron  (jc at raven.bu.edu)

Signal Processing and Interpretation Lab.  Boston, Mass  (617) 353-2879
------------------------------------------------------------------------------
"But to risk we must, for the greatest hazard in life is to risk nothing.  For
the man or woman who risks nothing, has nothing, does nothing, is nothing."
	(Quote from the eulogy for the late Christa McAuliffe.)



More information about the Comp.unix.questions mailing list