| Next | System Programming in Perl | 20 |
Here's the original shell, with its idea of the current directory

When we run do-cd, the shell forks a child process

The child process executes perl, which performs the cd

Perl forks a new process to run pwd

pwd reports that the current directory is /tmp, and exits
Then the perl exits

The original shell never cded anywhere
| Next | ![]() |
Copyright © 2003 M. J. Dominus |