Op 14-08-18 om 17:21 schreef Stephane Chazelas:
Hi, the spec for the "allexport" (set -a) shell option says:

POSIX2018> When this option is on, the export attribute shall
POSIX2018> be set for each variable to which an assignment is
POSIX2018> performed; see XBD Variable Assignment. If the
POSIX2018> assignment precedes a utility name in a command,
POSIX2018> the export attribute shall not persist in the
POSIX2018> current execution environment after the utility
POSIX2018> completes, with the exception that preceding one of
POSIX2018> the special built-in utilities causes the export
POSIX2018> attribute to persist after the built-in has
POSIX2018> completed. If the assignment does not precede a
POSIX2018> utility name in the command, or if the assignment
POSIX2018> is a result of the operation of the getopts or read
POSIX2018> utilities, the export attribute shall persist until
POSIX2018> the variable is unset.

the reference to "XBD Variable Assignment" would suggest it's
only meant to be done for variables assigned with an assignment.

But then it goes on about "getopts" and "read", but not "for",
and doesn't say if that applies to variables the shell sets by
itself like $IFS, $LINENO, $PPID, $PWD
[...]

I'd like to rekindle this old discussion. Thread archived at: https://www.mail-archive.com/austin-group-l@opengroup.org/msg02754.html

Today I received a pull request to make allexport work for ${var:=value} and ${var=value} on ksh 93u+m. This currently works on bash, dash, *BSD sh, and zsh, but not on ksh, pdksh/mksh, or yash.

Expansions of that form weren't mentioned in the 2018 discussion.

I need some clarity. Should ${var:=value} and ${var=value} honour allexport? Is this unspecified in POSIX terms or is support for this implied/intended by the current text? I think it might be, but shells differ too much.

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

  • Re: what variables a... Martijn Dekker via austin-group-l at The Open Group

Reply via email to