cd in the background?

Daniel McGurl dsm at prism.gatech.EDU
Wed May 1 13:17:27 AEST 1991


In article <gheim.910430165314 at lab14.eng.auburn.edu> gheim at eng.auburn.edu (Greg Heim) writes:
>I posted this question to comp.unix.questions and got no response...
>The other day I accidentally entered  

>   cd /new/dir &

>and my directory remained unchanged.  Can anyone explain what is going on here?

Here's the problem.  Backgrounding creates a new shell for the process to
execute in.  The process executes and does the CD in the newly spawned 
shell.  Then the shell dies and the old shells variable remain the way
they were.

-- 
Danny McGurl                               "How straightforward the game
Office of Information Technology and       when all its rules are respected."
Information and Computer Science Major at:
Georgia Institute of Technology                     ARPA: dsm at prism.gatech.edu



More information about the Comp.unix.wizards mailing list