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

Re: ksh Emulation Not Clearing Envariables



Variable assignments specified with special built-in utilities remain
	in effect after the built-in completes; this shall not be the case
	with a regular built-in or other utility.

Well...the variable assignment isn't occurring inside the function.
It's outside, put into the environment before the function is called.

Did you actually read the spec?
Nope.  I read the excerpts you provided, in the belief that
you meant them to clearly support your statements.  Shoot me
for not catching that "[v]ariable assignments specified with
special built-in utilities" meant "variable assignments
preceding the command name."

Maybe reading the `Simple Commands' section will convince you:

	If no command name results, variable assignments shall affect the
	current execution environment.  Otherwise, the variable assignments
	shall be exported for the execution environment of the command and
	shall not affect the current execution environment (except for special
	built-ins).
Yup, sure, that's pretty definitive.  What does it mean for

	X=one unset X

Nothing, I suppose.  unset will unset.  Never in a million years
would I have expected after

	X=one :

for X to persist, while after

	X=one true

X is unset.

I wonder what the original purpose was, here.  A "get out of jail
free card" that let code implementing the special built-ins slide?
These things (err, the SBIs) all look commands that *must* be implemented as built-ins, so perhaps in some implementation(s) there weren't the hooks to unset vars after they completed. POSIX just codified it so pre-existing
implementations could remain compliant?

Chet Ramey, ITS, CWRU chet@xxxxxxxxxxx http://tiswww.tis.cwru.edu/~chet/
Me
Chet Ramey, ITS, CWRU chet@xxxxxxxxxxx http://tiswww.tis.cwru.edu/~chet/

Chris <jepeway@xxxxxxxxxxxxxxxxx>.



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