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

Re: set temporary environment variables for builtins



On Sat, Dec 16, 2023 at 11:48 AM Clinton Bunch <cdb_zsh@xxxxxxxxxxx> wrote:
>
> Still wondering why the standard syntax for setting a temporary
> environment variable doesn't work for builtins.
>
> I don't think I'm unusual in expecting this to work:

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_01
(2.9.1 Simple Commands)

"If the command name is not a special built-in utility or function,
the variable assignments shall be exported for the execution
environment of the command and
  (my emphasis) shall not affect the current execution environment
except as a side-effect of the expansions performed in step 4"

"print" is not a "special" built-in, so "shall not affect" applies.  "Step 4" is

"Each variable assignment shall be expanded for tilde expansion,
parameter expansion, command substitution, arithmetic expansion, and
quote removal prior to assigning the value."




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