From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 4a2273cd for ; Wed, 9 Oct 2019 14:05:14 +0000 (UTC) Received: (qmail 7185 invoked by alias); 9 Oct 2019 14:05:08 -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: 24336 Received: (qmail 21828 invoked by uid 1010); 9 Oct 2019 14:05:08 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm1-f41.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25594. spamassassin: 3.4.2. Clear:RC:0(209.85.128.41):SA:0(-2.0/5.0):. Processed in 1.907229 secs); 09 Oct 2019 14:05:08 -0000 X-Envelope-From: stephane.chazelas@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.128.41 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=9CP6mpuGXBeSjTZvCkhSAZRDL0/lKvNCChqGEBegk7I=; b=Aihnc+T6ZS16QXuHCRHSBvY6jOjuuTj5IDS1Rp/HfmAIlsdsmdoQ1qGUFYvpIA0O5M QNljEg3pHCCBnofrYUF2k3TLYpY1MlocPTD9f/boyV30kQvA0xk4SUM/vdeEaXNglGSs 2n8qwgk0cdUNQmUyPeOJnsksBprk3OHQjkfVXu/UAdZl8iU1lkEES+LpQIYIvXKscGqg ceDkQzG2zfo5nmrjI4iWXuUp9PpST3iNKU1Kn3hwp50e9FBvJHdLsoyGjKDhhEDE92zJ yHuQtw5LWsZShgzyfK8owYOsrucZ2WwCrTyTo0P03qFoKOlDIoLbF8WeXIL/O08tz8yj LLjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=9CP6mpuGXBeSjTZvCkhSAZRDL0/lKvNCChqGEBegk7I=; b=hgUePOFSB90MniOB8skvDq2Gxr2Nr2NZrCp9xSNk2CnqzGfxXFcx1fRslUhHBP7SG/ wzt+sT8r9laxwtjJ2fM9Egq/wt8W0p38Gs+YrYysaIUZxYo6YFmRBV3x9QBrgqAFwXAq mveAaFJLBpq/iZ1yb6sigc/IISMQFGvRFenlgwYIB3ZRyv4r1Gj05cIMEZQDlcJPhTWB cqhs6Vpmjdy9oLeq9OofzqljRmVWBO3plfpV/3l4D5o/NZj3c8dw1wG/GOe3VMJfIxw7 RsAQEbkUi5nMkSg+WZ0JRw2b0Kb/0czDoQKFQoT14Yy6Gz2fLLZWivVxCr6F3RsPW6cc eV+A== X-Gm-Message-State: APjAAAVXMgbZemjqjEumgyXd8ipxprX4eSBv3oVLnokA9sX3KbhOyCy/ CfWuqNwsR+Ih4SJ5ZOA5HSY= X-Google-Smtp-Source: APXvYqwmq14OaSCAlvebLCW8GVcuD76FXBa+8lhwuTyE/6w6386Qr4D/s4633p9mP9x1tgMxr8SK4w== X-Received: by 2002:a1c:7917:: with SMTP id l23mr2620271wme.60.1570629872435; Wed, 09 Oct 2019 07:04:32 -0700 (PDT) Date: Wed, 9 Oct 2019 15:04:30 +0100 From: Stephane Chazelas To: Sebastian Gniazdowski Cc: Peter Stephenson , "zsh-users@zsh.org" Subject: Re: Feature request: a new warning option Message-ID: <20191009140430.or4to5cbhrebv5g7@chaz.gmail.com> Mail-Followup-To: Sebastian Gniazdowski , Peter Stephenson , "zsh-users@zsh.org" References: <1570627441.5764.11.camel@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 2019-10-09 15:41:41 +0200, Sebastian Gniazdowski: [...] > I thought that: > > [[ -z $ver ]] && ver="unknown (no .git/refs/heads/master)" || ver=${ver[1,7]} > > is more or equally readable to: > > if [[ -z $ver ]]; then > ver="unknown (no .git/refs/heads/master)" > else > ver=${ver[1,7]} > fi [...] but thyes are different things. a && b || c, is "run c unles both a and b succeed". You typically use these things in if statements like if a && b || c; then ... fi You could always do something like: alias -g '^=else' if ((x)){echo yes} ^ {echo no} (can be shortened to if((x)){echo yes} ^ {echo no} with zsh -o noglobqual -o shglob). Or even: alias -g '&|=else' alias '?=if' ? ((x)){echo yes}&|{echo no} -- Stephane