zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-users@zsh.org
Subject: Re: &&||
Date: Tue, 20 Feb 2018 17:07:34 +0000	[thread overview]
Message-ID: <20180220170734.7f428bd6@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <ba9a569c-9462-0062-8630-ddc3bab1b1e3@eastlink.ca>

On Mon, 19 Feb 2018 23:54:38 -0800
Ray Andrews <rayandrews@eastlink.ca> wrote:

> On 20/02/18 01:26 AM, Peter Stephenson wrote:
> > I think you were trying to make the status depend only on what was
> > before the first "&&".  You can certainly do
> But isn't that exactly what I did do?

No.

> Appending to you code below:
> 
> > first-statement && {
> >     any-old-stuff
> > } || {something-else-entirely}

The status of first-statement only controls what's *inside* the { }.
That's what I showed.  You've now stuck something after it.  That's got
completely different rules, interacting both with the && outside the braces
as well as the last status from within the braces.

You've now extended your demand so that it works with an else clause as
well.  That can't be done simply by combining &&s and ||s on the same
level (without other fix-ups) because they don't have the same rules.

You could do this, I suppose.

first-statement && {
    any-old-stuff
    true
} || {something-else-entirely}

That works because

- if you don't execute first-statmement, you go direct to what's
following the "||";

- if you do execute it you then get to the true, which is the last
status for the brace, which causes what's following the "||" to be
ignored.

But you'd probably be (as my father would have said) stotting bonkers.
Though it is a pretty good illustration of the difference between the
two cases.

pws


  reply	other threads:[~2018-02-20 17:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-19 21:12 &&|| Ray Andrews
2018-02-19 21:57 ` &&|| Peter Stephenson
2018-02-19 22:47   ` &&|| Ray Andrews
2018-02-20  9:26     ` &&|| Peter Stephenson
2018-02-20  7:54       ` &&|| Ray Andrews
2018-02-20 17:07         ` Peter Stephenson [this message]
2018-02-20 19:24           ` &&|| Ray Andrews
2018-02-20 20:28             ` &&|| Bart Schaefer
2018-02-20 21:45               ` &&|| Ray Andrews
  -- strict thread matches above, loose matches on Subject: below --
2004-11-16 13:45 !!:$ keef
2004-11-16 14:22 ` !!:$ Peter Stephenson
2004-11-16 14:31   ` !!:$ Stephane Chazelas
2004-11-16 15:37   ` !!:$ Bart Schaefer
2004-11-16 16:08     ` !!:$ Peter Stephenson
2004-11-17  0:03 ` !!:$ Bart Schaefer
2004-11-17 19:25   ` !!:$ Danek Duvall
2004-11-18  1:10     ` !!:$ Bart Schaefer
2003-07-02 15:06 ?????? JEFF BICKLEY
2003-07-02 19:56 ` ?????? Thorsten Haude

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=20180220170734.7f428bd6@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.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).