From: zzapper <zsh@rayninfo.co.uk>
To: zsh-users@zsh.org
Subject: Re: if (()){}else{} documented?
Date: Wed, 21 Apr 2021 10:16:11 +0100 [thread overview]
Message-ID: <d59adc74-b55a-506c-9122-a2b56539a542@rayninfo.co.uk> (raw)
In-Reply-To: <e9997f9f-59bd-4619-ae20-d6e0e4c6ccdb@www.fastmail.com>
[-- Attachment #1: Type: text/plain, Size: 1939 bytes --]
On 20/04/2021 16:33, Lawrence Velázquez wrote:
> SIMPLE COMMANDS & PIPELINES
A /sublist/ is either a single pipeline, or a sequence of two or more
pipelines separated by ‘&&’ or ‘||’. If two pipelines are separated by
‘&&’, the second pipeline is executed only if the first succeeds
(returns a zero status). If two pipelines are separated by ‘||’, the
second is executed only if the first fails (returns a nonzero status).
Both operators have equal precedence and are left associative. The value
of the sublist is the value of the last pipeline executed. For example,
dmesg | grep panic && print yes
is a sublist consisting of two pipelines, the second just a simple
command which will be executed if and only if the grep command returns a
zero status. If it does not, the value of the sublist is that return
status, else it is the status returned by the print (almost certainly
zero).
A /list/ is a sequence of zero or more sublists, in which each sublist
is terminated by ‘;’, ‘&’, ‘&|’, ‘&!’, or a newline. This terminator may
optionally be omitted from the last sublist in the list when the list
appears as a complex command inside ‘(...)’ or ‘{...}’. When a sublist
is terminated by ‘;’ or newline, the shell waits for it to finish before
executing the next sublist. 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). A
backgrounded pipeline returns a status of zero.
More generally, a list can be seen as a set of any shell commands
whatsoever, including the complex commands below; this is implied
wherever the word ‘list’ appears in later descriptions. For example, the
commands in a shell function form a special sort of list.
lv thanks will digest
[-- Attachment #2: Type: text/html, Size: 2929 bytes --]
prev parent reply other threads:[~2021-04-21 9:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-20 14:40 david
2021-04-20 15:19 ` Marc Chantreux
2021-04-20 15:28 ` Lawrence Velázquez
2021-04-20 15:32 ` Marc Chantreux
2021-04-21 8:46 ` zzapper
2021-04-21 10:41 ` Marc Chantreux
2021-04-21 12:32 ` zzapper
2021-04-21 14:59 ` Marc Chantreux
2021-04-21 15:01 ` Marc Chantreux
2021-04-21 13:57 ` Bart Schaefer
2021-04-20 15:33 ` Lawrence Velázquez
2021-04-21 9:16 ` zzapper [this message]
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=d59adc74-b55a-506c-9122-a2b56539a542@rayninfo.co.uk \
--to=zsh@rayninfo.co.uk \
--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).