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

cd does not update $PWD in a timely fashion.



I had this program changing the name of the current working directory and
noticed cd .; echo $PWD didn't pick up the changes.

The following code replicates the problem.

% set -x;mkdir foo; cd foo; mv ~/foo ~/bar; echo $PWD;pwd; readlink -f .;
cd .; echo $PWD ;pwd; readlink -f .; cd .; echo $PWD ;pwd; readlink -f .
+/bin/zsh:8> mkdir foo
+/bin/zsh:8> cd foo
+/bin/zsh:8> mv -i /home/han/foo /home/han/bar
+/bin/zsh:8> echo /home/han/foo
/home/han/foo
+/bin/zsh:8> pwd
/home/han/foo
+/bin/zsh:8> readlink -f .
/home/han/bar
+/bin/zsh:8> cd .
+/bin/zsh:8> echo /home/han/foo
/home/han/foo
+/bin/zsh:8> pwd
/home/han/bar
+/bin/zsh:8> readlink -f .
/home/han/bar
+/bin/zsh:8> cd .
+/bin/zsh:8> echo /home/han/bar
/home/han/bar
+/bin/zsh:8> pwd
/home/han/bar
+/bin/zsh:8> readlink -f .
/home/han/bar


With kind regards,
Han


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