From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19255 invoked by alias); 20 Feb 2018 20:28:19 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23155 Received: (qmail 12474 invoked by uid 1010); 20 Feb 2018 20:28:19 -0000 X-Qmail-Scanner-Diagnostics: from mail-lf0-f51.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.215.51):SA:0(-1.9/5.0):. Processed in 6.603598 secs); 20 Feb 2018 20:28:19 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=8DE+95MJW2F6+TAqXxxCeQ0HnBfn2Px/fqPB6yQm8Kg=; b=PG9tOuIoX5Lzqwwqru5G7ipwFAY02J9ndwy+h4BrImN9WbvET0J9s8vcN9qBqU//bV 3RYrX897pwc0qc2KJKkFl2sAUSm8sP1c0hWhXTBe+ShfZIZXNLwpijZ1nydtFIGai1Z8 Qhrmf5QN41tEo/XWGxFZnpLdLwEwV31+V/68sIN81hm3AehhqDjvIhSXmGsa8DBW3DtU kXe7QYSLbnTLZ0JYYIc7kpvyzSQb0he2rE/ENxVrf2aWByUjY5OXYfUGSiUoFH56TdOr hg0NL8eO1H0pWpceoI+EctoQZOU0uh4dcgroRiddYsnP1cJwPQu/rtCHmWRinFseDIz9 vicA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=8DE+95MJW2F6+TAqXxxCeQ0HnBfn2Px/fqPB6yQm8Kg=; b=fh89fgdrgE28U8psbpqPSjzxB5cKaFiZgEEdJr4gSDahCJE+5dMXLQWaiTpIVFYyW4 AwGaoryP0/OPnHYyiVWVgfXXFG1QE++aEE4RrSPz2y1tm08rTii0qAVdpXShEcwFtq1X jD67Omp9ejT26xsAt0X434I3/mxfoESf7/mNGJWQAJjSCeTUU33P0GndDxsQhBurmOcB 1Qb1Rf6hYBz+bNNgo/RekCnOpJhKi2eJsLUlROs8xHEy+OSN9Uf8HpthkEP0o+Mz2vOA 57tptsTetRDdgS3Yqxp4DJ1PhUw8hafWyoa3FXIAWNXEVA6ba/50BHUi0X5Mdi3gGxql s25w== X-Gm-Message-State: APf1xPD1YrJw236SD/8VTkR2Ftg6JIbSf5Xm6PVK2nzJuCaLPuSlE1Ni c6SLa4T2LWD6H5pcFLkX9a57uCaAtwuCLXd5YngvCw== X-Google-Smtp-Source: AH8x226dnINEVVD+BaKlVKOQYASfjTLdcToBbItBerQf+43IW99MmxSqm36vuE9nS6qZwm0qzxCgRkofYDQhXXftk84= X-Received: by 10.46.54.1 with SMTP id d1mr631453lja.84.1519158488342; Tue, 20 Feb 2018 12:28:08 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <64c5472a-b174-00b6-7ab0-b65d664be675@eastlink.ca> <20180219215726.4c25cc7d@ntlworld.com> <20180220092659.2233e6ef@pwslap01u.europe.root.pri> <20180220170734.7f428bd6@pwslap01u.europe.root.pri> From: Bart Schaefer Date: Tue, 20 Feb 2018 12:28:07 -0800 Message-ID: Subject: Re: &&|| To: Ray Andrews Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" On Tue, Feb 20, 2018 at 11:24 AM, Ray Andrews wrote: > On 20/02/18 09:07 AM, Peter Stephenson wrote: >> >> You've now extended your demand so that it works with an else clause as > > Not 'extended' that is the entire point of my question. I'm expecting the > '||' to be identical to a logical 'else', there is no other issue. But "||" is not "else" and "&&" is not "if" -- rather they are "and" / "or" (which is why they use the symbols they do). first-statement AND second-statement OR third-statement The implicit grouping is left-to-right, so that's the same as { first-statement AND second-statement } OR third-statement Thus the first pair succeeds only when both succeed, and third-statement occurs when the first pair fails. To express this with if/else you would write if first-statement; then if second-statement; then true; else false; fi; else false; fi; if [[ $? -eq 0 ]]; then if third-statement; then true; else false; fi; else false; fi > Demand? I seek clarification I believe PWS meant "demand" in the sense of what your statement asks of the shell, not what you're asking him to explain. > Braces are > ignored as far as truth tests on the left of any && or ||. No, that's entirely wrong. Braces always return the final status of the enclosed list of statements. && and || always use the final status of the entire chain of any && or || to their left. The two are related only when the braces surround another chain of && or || but only in so far as that affects the final status of the braces.