Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: `exec env -i OLDPWD=$OLDPWD zsh` doesn't work
On Fri, 13 Jan 2017, Peter Stephenson wrote:
> OLDPWD seems to be slightly weirdly implemented at the moment. There's
> an internal variable storing it, but that's not explicitly tied to a
> shell variable; instead when the internal variable gets changed
> the shell variable also gets changed. So the internal variable isn't
> changed if you change the shell variable
This is actually semantically necessary, as I recall. There's no
prohibition on using OLDPWD and PWD as ordinary variables, as long as
you don't "cd" along the way.
And assigning to them is not supposed to behave like a "cd" or to
change the way "cd -" works, as far as I can tell.
Please don't make them into specials, we'll just have to find a way to
un-special them again for POSIX compatibility or something.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author