From: Stephane Chazelas <stephane@chazelas.org>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Suggested changes to Etc/FAQ
Date: Mon, 13 Nov 2023 07:13:38 +0000 [thread overview]
Message-ID: <2da3cd0f2900d052239dc94dc5b2dc44@chazelas.org> (raw)
In-Reply-To: <CAH+w=7YxP-5fZEdsBEvJXC9X1FVOv=v1z88MC2D1G5xDJQh0aA@mail.gmail.com>
About that:
> In cmd1 && cmd2 &, only cmd2 instead of the whole expression
> is run in the background in zsh. The manual implies this is
> a bug. Use { cmd1 && cmd2 } & as a workaround.
And in particular the "The manual implies this is a bug".
That section was added to the FAQ in October 1997. At the time, the
manual had:
> If a sublist is terminated
> by a `tt(&)', `tt(&|)', or `tt(&!)',
> the shell executes it in the background, and
> does not wait for it to finish.
But that was later (2000:
https://github.com/zsh-users/zsh/commit/ed8b82b9b1bf74392caf4f4683f367bc4cbbd193#diff-6a204419ff23048734de2793d1072ec031dcdcd08aeb14cf75c14ec953835bddL68)
changed to what we have today:
> If a sublist is terminated by
> a '&', '&|', or '&!', the shell executes the last pipeline in it in the
> background, and does not wait for it to finish (note the difference
> from
> other shells which execute the whole sublist in the background)
So that's no longer considered as a bug but works as documented.
So that "The manual implies this is a bug" should be removed I'd think
or
maybe replaced by something that notes that it was not originally
intentional.
{ cmd1 && cmd2 } & might be better as (cmd1 && cmd2) & so it's portable
to
other shells and makes it more evident that that runs in a subshell.
--
Stephane
next prev parent reply other threads:[~2023-11-13 7:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-11 5:10 Bart Schaefer
2023-11-11 11:59 ` Stephane Chazelas
2023-11-11 21:51 ` Bart Schaefer
2023-11-13 7:13 ` Stephane Chazelas [this message]
2023-11-13 14:18 ` Peter Stephenson
2023-11-16 2:32 ` Bart Schaefer
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=2da3cd0f2900d052239dc94dc5b2dc44@chazelas.org \
--to=stephane@chazelas.org \
--cc=schaefer@brasslantern.com \
--cc=zsh-workers@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).