Re: wrong behaviour when unsetting/setting some variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Op 29-02-2024 om 12:24 schreef Christoph Anton Mitterer:
[...]
One might also argue like this:
* -a says "the export attribute shall be set for each variable to which
   an assignment is performed".

Further on, that same paragraph also contains:

| [...] or if the assignment is a result of the operation of the getopts or
| read utilities, the export attribute shall persist until the variable is
| unset.
So 'getopts' and 'read' are two examples of where the variable should be exported, and neither do an explicit shell assignment. While the language is indeed not very clear, this implies that the variable should indeed be exported in all cases where a variable assignment is actually performed.

AT&T ksh 93u+ was also broken in this regard. In ksh 93u+m, I've fixed it by moving the 'set -a' functionality into nv_putval(), its central shell assignment function, so that the variable gets exported whenever the shell performs an assignment for any reason and in any context.

--
||	modernish -- harness the shell
||	https://github.com/modernish/modernish
||
||	KornShell lives!
||	https://github.com/ksh93/ksh





[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux