Changing directories in the background

Noam Mendelson c60b-1eq at e260-1g.berkeley.edu
Wed May 1 16:13:41 AEST 1991


In article <gheim.910430005242 at lab14.eng.auburn.edu> gheim at eng.auburn.edu (Greg Heim) writes:
>I just tried the following:
>   cd /new/dir &
>by accident and my directory didn't change.  Can anybody tell me what happens
>internally here?

If cd is run in the background, the newly spawned process gets the new
cwd, not your shell.  Each process has its own cwd.  The process that's
spawned is terminated immediately (I would hope), so there's no harm done.

-- 
+==========================================================================+
| Noam Mendelson   ..!ucbvax!web!c60b-1eq       | "I haven't lost my mind, |
| c60b-1eq at web.Berkeley.EDU                     |  it's backed up on tape  |
| University of California at Berkeley          |  somewhere."             |



More information about the Comp.unix.questions mailing list