On Tue, Aug 18, 2009 at 9:26 AM, Jan Ingvoldstad<frett...@gmail.com> wrote:
> You think it's a bug that PWD="/etc" doesn't change your working directory
> to /etc in bash?
> Please tell me you're joking.

It's not that unreasonable.  Given a variable that magically changes
depending on your working directory, having your working directory
change when you set that variable is eminently plausible.  Especially
since the cwd is completely under the shell's control.
And changing dirs by setting PWD wouldn't get you any capability you
don't have anyway via the cd builtin.

Notably, while many of the special shell parameters have documented
set behavior (setting RANDOM seeds the random number generator; many
special parameters are readonly; others lose their magic entirely when
unset), the behavior of setting PWD is not specified.  So a shell
could have PWD= do a cd() and even be within compliance.

> Here's another example of something that, if I understand you correctly, you
> find as unexpected behaviour:
> j...@krakas ~ >USER=root

If that were going to work, it would presumably work like su(1):

j...@krakas ~ > USER=root
j...@krakas ~ # _

But USER isn't even a shell-maintained variable.  It's set by login();
the shell just inherits it.  A better example would be UID - which is

Mark J. Reed <markjr...@gmail.com>

Reply via email to