Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: `cd .` in non-existent directory leads into weird corner case



On 2012-04-03 13:04:52 +0900, Jun T. wrote:
> Once pwd is set to '.', $PWD has different value than pwd.
> Is this intensional?

Not only in this case.

mkdir -p tmpdir1/tmpdir2
cd tmpdir1/tmpdir2
pwd
echo "$PWD"
mv ../../tmpdir1 ../../tmpdir3
pwd
echo "$PWD"
cd ../..
rm -r tmpdir3

gives:

/tmp/tmpdir1/tmpdir2
/tmp/tmpdir1/tmpdir2
/tmp/tmpdir3/tmpdir2
/tmp/tmpdir1/tmpdir2

pdksh, mksh and posh behave like zsh, but dash, bash and ksh93
output /tmp/tmpdir1/tmpdir2 every time.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



Messages sorted by: Reverse Date, Date, Thread, Author