#
238468 |
|
15-Jul-2012 |
jilles |
sh: Expand assignment-like words specially for export/readonly/local.
Examples: export x=~ now expands the tilde local y=$1 is now safe, even if $1 contains IFS characters or metacharacters.
For a word to "look like an assignment", it must start with a name followed by an equals sign, none of which may be quoted.
The special treatment applies when the first word (potentially after "command") is "export", "readonly" or "local". There may be quoting characters but no expansions. If "local" is overridden with a function there is no special treatment ("export" and "readonly" cannot be overridden with a function).
If things like local arr=(1 2 3) are ever allowed in the future, they cannot call a "local" function. This would either be a run-time error or it would call the builtin.
This matches Austin Group bug #351, planned for the next issue of POSIX.1.
PR: bin/166771
|