Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: why not promote the plague ? (brace|rc|alternative|modern) syntax
- X-seq: zsh-users 30164
- From: Lawrence Velázquez <larryv@xxxxxxx>
- To: "Marc Chantreux" <mc@xxxxxxxxxx>
- Cc: zsh-users@xxxxxxx
- Subject: Re: why not promote the plague ? (brace|rc|alternative|modern) syntax
- Date: Mon, 16 Dec 2024 05:15:33 -0500
- Archived-at: <https://zsh.org/users/30164>
- Feedback-id: iaa214773:Fastmail
- In-reply-to: <Z1_v9XlKOIs_UYRL@prometheus>
- List-id: <zsh-users.zsh.org>
- References: <CAH+w=7YKdGJeBzQnYKjkdi5EFSSu=dp2fyLT4wJnk7=XTA0LbQ@mail.gmail.com> <Z1nfDWyISrBhsfXO@prometheus> <CAH+w=7Zm2Uo+Twr_iaCRPMt5xRGdfkF_HMOOP2VVoiNoLb53MA@mail.gmail.com> <Z1xLT543bNQso2vE@prometheus> <CAHYJk3Qsx_GPeqynnMxObaWpJhGQiiRuyn7ap++xTGtzpqtWdA@mail.gmail.com> <Z1y9zfe41McIKVrl@prometheus> <6c7981f1-72f8-4c15-8741-535838b70a1a@app.fastmail.com> <Z10zlKaQsun7_FUl@prometheus> <CAA=-s3wTkpVbqz=O1eBQbx-7Wgd8U=-XJSMupaoEOJDGi0eYfg@mail.gmail.com> <aa6412e5-41d9-495a-a1ec-5545ad690d94@app.fastmail.com> <Z1_v9XlKOIs_UYRL@prometheus>
On Mon, Dec 16, 2024, at 4:16 AM, Marc Chantreux wrote:
> On Sat, Dec 14, 2024 at 06:36:51PM -0500, Lawrence Velázquez wrote:
>> sublists, which POSIX calls AND-OR lists. For example, this:
>
> To me this is weird because it means punctuations are not treated
> the same way: \n ; | && || should be treated equally
I don't know what you mean by this.
> in zsh (AFAIU) it's not consistant with the function declaration:
>
> foo() hostname && hostname
> echo tadaaaa:
> hostname
>
> # prometheus
> # tadaaaa:
> # prometheus
>
> if {true} hostname && hostname
> echo tadaaaa:
>
> # prometheus
> # prometheus
> # tadaaaa:
That's right; the Bourne-style function definition syntax only
permits the body to be a command, not any sort of list (except
within a compound command). That leads to this fun comparison:
% setopt SHORT_LOOPS
% f() print abc && print xyz; f
xyz
abc
% function g; print abc && print xyz; g
abc
xyz
Yet another asterisk.
--
vq
Messages sorted by:
Reverse Date,
Date,
Thread,
Author