Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Feature request: a new warning option
- X-seq: zsh-users 24336
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- Subject: Re: Feature request: a new warning option
- Date: Wed, 9 Oct 2019 15:04:30 +0100
- Cc: Peter Stephenson <p.stephenson@xxxxxxxxxxx>, "zsh-users@xxxxxxx" <zsh-users@xxxxxxx>
- 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==
- In-reply-to: <CAKc7PVBQnt_ZE3X=8gz5R_VURwaTL3mDL=X-7H__yYqAjvXoWA__41912.055101578$1570628583$gmane$org@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mail-followup-to: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>, Peter Stephenson <p.stephenson@xxxxxxxxxxx>, "zsh-users@xxxxxxx" <zsh-users@xxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVDN-GspoiS-iVR5ThdbDVbLWVNJWcZ=TyY0=9ydtPswAw@mail.gmail.com> <CAN=4vMraXtTooeYfBDGObA7xVhoC6JpHRz1C3CUHKiW=LY8Nuw@mail.gmail.com> <CAKc7PVChNY2jjRW2TSw0c=V6yXv+5cp1OsgikihLv0iUi2+h=g@mail.gmail.com> <CAN=4vMq9uM_myMu55xjZ-+483JUY+VnmeEd4kCpOqBc8SurwFg@mail.gmail.com> <CGME20191009131852epcas2p368527332310d5197425b853f2a78e07d@epcas2p3.samsung.com> <CAKc7PVA+Ch+XqDj4aZRErr28Qo+0sejvt-d7F7m09YooC9psUg@mail.gmail.com> <1570627441.5764.11.camel@samsung.com> <CAKc7PVBQnt_ZE3X=8gz5R_VURwaTL3mDL=X-7H__yYqAjvXoWA__41912.055101578$1570628583$gmane$org@mail.gmail.com>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author