zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: set temporary environment variables for builtins
Date: Sat, 16 Dec 2023 12:20:56 -0800	[thread overview]
Message-ID: <CAH+w=7YYSt+gi61uTrfbBZpH0REXnVFPWjpZa7a5f6mNfP4PxA@mail.gmail.com> (raw)
In-Reply-To: <12207c43-6c60-43b5-a993-f3c4dfa72cdb@zentaur.org>

On Sat, Dec 16, 2023 at 11:48 AM Clinton Bunch <cdb_zsh@zentaur.org> 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."


  reply	other threads:[~2023-12-16 20:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-16 17:59 Clinton Bunch
2023-12-16 18:53 ` Lawrence Velázquez
2023-12-16 19:48   ` Clinton Bunch
2023-12-16 20:20     ` Bart Schaefer [this message]
2023-12-16 20:21     ` Lawrence Velázquez
2023-12-16 20:27       ` Bart Schaefer
2023-12-16 20:31         ` Roman Perepelitsa
2023-12-16 20:35           ` Bart Schaefer
2023-12-16 23:53           ` Mikael Magnusson
2023-12-17  0:26         ` Lawrence Velázquez
2023-12-17  7:54           ` Roman Perepelitsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7YYSt+gi61uTrfbBZpH0REXnVFPWjpZa7a5f6mNfP4PxA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).