From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HTML_MESSAGE,MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5514 invoked from network); 21 Apr 2021 09:17:19 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 21 Apr 2021 09:17:19 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1618996639; b=oBJUw+slsyWk8+FNP24JKGz3Yd4t2l5hCf9kB3yiWIVcn6Yv98KjkQhG1P7w4JVsznwWnbSeo4 1k0Joc9fd74ZyJ050Y11b4cy1Jlua2RcmbEsdA3GaNI3MmPGJikd4SpIK0LPKUfIBRfawb/UK7 GZNgHKQTriyfRNbEN5neIwBaWCKxMCIqQTznTMSdMtD4KMBzGv3+VHx1sGmIQ4NckWQr3GHyeh qs+ZtuaMSmMIEfBGcoZTmevl1/ILSPAiGpxqYoRktlmfKYL4A4rpr0Wr2ZquWYV5nxB6i70mil a3hpXencaFOhiDFUOphrzUbP+lJnYoLrUCsIV4d4BNMv2w==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (p3plsmtp18-03-2.prod.phx3.secureserver.net) smtp.remote-ip=173.201.193.186; dmarc=none header.from=rayninfo.co.uk; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1618996639; bh=mlVeN4VGDjzX6qTOGU8+tTPzdcb1m/OErmgOVmiWR0c=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:DKIM-Signature; b=Noz4hqss5CetoEEd9WzrvGX7RgP4nyIW3+sPQhlg7IIeot3TElsMrtV5S0vJpkzQDyig5xdAOJ evaip7GPlhdA0KqtZIxccDd4COf2QTKi/s9ZyvGVagpCCJQjg1CPAZetgVOVfPteZEotiF8tz4 MtnxMq4JdUs1BzNnpRenZXyAQbAhBbwOpuOrijM9y0y6j8R+xIfy6TvQKmmEh/AgIqL+l7dj+P kPccM4i/StcfZOY8Oz3tiHDxvx8C/z9Hndc/jqW/udR/1WpW2XmJsCnjvyKx/lQ5WArpOH0oRz Qj/B3SJjPVl4ptGsJqomFTlaPBQ5F/Fil2EysMT33Ec0JA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:In-Reply-To:MIME-Version :Date:Message-ID:From:References:To:Subject:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=RtUDq+9L98sQ+NOmDcY3dh0CytYQVl97DNls1laMU18=; b=whkRwlVZ7kRc/YPFqk8i8Z+qCm nxpOICGZCvKhDf0jwnQ0kkiI5B31HBjIW/deRSWdp1l95Lqak1P07vKHn3b0Sj4ik/EbzWhwzKG0F x694jpT3ka3K7cJzctDSCv1aYpdqO7UFO1U6lkIJOuDvZ64+Pj+nrC4aDqYi+PBO/XKlkRrUr5UHU We0Uu4POz953TluIcyfUU88hoIboBsGkXQte+shDlgHXRUBM84QDCP+eIGq/mn/BofJX/kcfrXtBs gElfF3BQ+WSdyWpN4SXXZXk/RsWmY+IvDKKwiGAiNiVjULpvkDQaBbcPxKy1F3JvhRKTe2ITiYCC9 x4ziVtTQ==; Received: from authenticated user by zero.zsh.org with local id 1lZ8yz-0000xS-O5; Wed, 21 Apr 2021 09:17:17 +0000 Authentication-Results: zsh.org; iprev=pass (p3plsmtp18-03-2.prod.phx3.secureserver.net) smtp.remote-ip=173.201.193.186; dmarc=none header.from=rayninfo.co.uk; arc=none Received: from p3plsmtp18-03-2.prod.phx3.secureserver.net ([173.201.193.186]:40401 helo=p3plwbeout18-03.prod.phx3.secureserver.net) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1lZ8yQ-0000MA-MV; Wed, 21 Apr 2021 09:16:44 +0000 Received: from mailex.mailcore.me ([94.136.40.143]) by :WBEOUT: with ESMTP id Z8yNl7wqPYJBWZ8yOlNhUZ; Wed, 21 Apr 2021 02:16:40 -0700 X-CMAE-Analysis: v=2.4 cv=XfdMcK15 c=1 sm=1 tr=0 ts=607fed78 a=EhJYbXVJKsomWlz4CTV+qA==:117 a=MSuxXlsgQg/r+Vijqd6nqw==:17 a=toa1DQ_u1RAA:10 a=3YhXtTcJ-WEA:10 a=r77TgQKjGQsHNAKrUKIA:9 a=ewydMhvFEvwozS7weBsA:9 a=QEXdDO2ut3YA:10 a=ZLGELXoPAAAA:8 a=-irG-TrbZk4kWy1wYj8A:9 a=cuhY31Ds_R6060G3:21 a=_W_S_7VecoQA:10 a=CFiPc5v16LZhaT-MVE1c:22 X-SECURESERVER-ACCT: zsh@rayninfo.co.uk X-SID: Z8yNl7wqPYJBW Received: from [95.150.51.97] (helo=[192.168.1.231]) by smtp02.mailcore.me with esmtpa (Exim 4.92.3) (envelope-from ) id 1lZ8xv-0009I5-UI for zsh-users@zsh.org; Wed, 21 Apr 2021 10:16:39 +0100 Subject: Re: if (()){}else{} documented? To: zsh-users@zsh.org References: <1154b0e1-e5ad-70be-f620-1368c86f12ed@rayninfo.co.uk> From: zzapper Message-ID: Date: Wed, 21 Apr 2021 10:16:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------BAB1727EBB66B5B994983A6A" Content-Language: en-US X-Mailcore-Auth: 8308408 X-Mailcore-Domain: 840527 X-122-reg-Authenticated: 8308408 X-Originating-IP: 95.150.51.97 X-CMAE-Envelope: MS4xfJdo/dOE1kYHRObIUBkROuQvtoK0FmNbyA35AK/pqJGX7jgQCSWUODttilve/OQafOJlKokcPOIqkGpYAQQONDobYpU3q9ujlX9pWWNvBDXWyMiK+VGj Kv8NdaWwulTBS8KUMq8xxv/dSJd7hstJ9C4evMek/dPANB4W8cQXblrRLqBBLBu3fib7DdN1UC1SXw== X-Seq: 26692 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: This is a multi-part message in MIME format. --------------BAB1727EBB66B5B994983A6A Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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 --------------BAB1727EBB66B5B994983A6A Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit


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

--------------BAB1727EBB66B5B994983A6A--