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

Re: PWD parameter



On May 24,  2:51am, Zoltan Hidvegi wrote:
} Subject: Re: PWD parameter
}
} Why do you think that PWD is better be a special parameter?

Because I like that it can't be *un*set.  That means I can always rely
on using it in zsh scripts, rather than having to do the silly tests for
it being set and having to assign it from `pwd` to make sure it's there.

} Scripts do set PWD and if we want to allow people to
} use zsh as /bin/sh then we have to allow them to write PWD.
} If PWD is special, assignments will write directly to the internal pwd

Why is that necessary?  PWD could be a special parameter without tying it
to any C variable that zsh uses internally.  That just happened to be the
way it was done (prior to your patch).

I don't so much care that it's read-only as I do that it's never unset.
(Thinking about it, I might throw in "and always contains an absolute
path to a directory that existed at the time the variable was assiged.")

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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