in reply to `pwd`, sh, and the amd automounter
Some shells try to be clever and remember how you got to the directory you're currently in, and show you that when you type pwd. `pwd will run the /bin/pwd command, which will give you the honest-to-goodness directory you're in. It's resolved by looking at the current directory, then opening the parent directory and scanning it to get the name of the current directory, and so forth until it's in the root directory. Because of how it works, it will always return the One True Pathname, as it has no way of knowing about another path you may have taken to end up in this directory.
The Cwd module and $ENV{PWD} might help, though:
</code>#!/usr/bin/perl -w use strict; use Cwd qw(chdir); chdir("/service/dnscache"); print "\$ENV{PWD}=$ENV{PWD}\n"; print "`pwd`=",`pwd`;
|
|---|