| Next | Unix Command Internals | 16 | 
Another thing in the process is the current directory
This is why you can't write a shell script to change your current directory
        plover% pwd
        /home/mjd
        plover% cat do-cd
        #!/bin/sh
        cd /tmp
        echo "You just moved to `pwd`."
        plover% ./do-cd
        You just moved to /tmp.
        plover% pwd
        /home/mjd
The pwd command in the script thinks the directory changed
But the shell disagrees
Why?
| Next | ![]()  | 
    Copyright © 2002 M. J. Dominus |