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

cd - and $OLDPWD, bug in the manual?



Hello all,

Some weeks ago I received lot's of help and comments a question about
"dirstack history". Thanks a lot. Now I'm not only happier, I'm also a
bit lazier.

[...]

Sometimes (but not all the time) I want to login and go immediately to
the last dir I was before logging out. Which I could do using "% cd -1",
but lazy as I am, I tried to do

% cd -

and this failed... I checked the manual and it says:

cd [ -sLP ] {+|-}n

   [...] specified.  If arg is `-', change to the value of $OLDPWD, the
   previous directory.

I tried setting OLDPWD, but "% cd -" would still not work.

This time I actually took a look into the code and indeed, "cd -" is not
using $OLDPWD, just a variable whose value should be reflected into the
value of $OLDPWD.

Do you guys agree with me that either the manual or
Src/builtin.c:cd_get_dest need to change?

Cheers,
Francisco



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