bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Are there any plans for more readable, modern syntaxes for If statem


From: Eli Schwartz
Subject: Re: Are there any plans for more readable, modern syntaxes for If statements?
Date: Fri, 13 Mar 2020 09:27:34 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

On 3/13/20 7:59 AM, John McKown wrote:
> I do things like:
> 
> test <some relational test> && { true_command1;true_command2; : ; } || {
> false_command1; false_command2; false_command3; }
> 
> Notice the command : (colon) as the last command in the true. The reason
> that I put it there is to guarantee that the $? from the series of
> "true_commnds" is 0 (aka "true") so that the commands in the || are not
> executed.

OP: "I want readable, modern syntax for If statements, inspired by C."

You: "Don't use If, use &&, which doesn't look like a C If either."

I'm... not following? I mean, yes, the things which you do are valid
bash syntax, and yes, they seem to do what you want them to do, but I
don't *really* understand how they tie in to the premise of the thread.

In contrast, "abuse parser macros" is a valid if terrible answer to the
question of changing the syntax of a bash feature. Something which is
otherwise not really an option, since 40-year-old languages do not
change fundamental syntax on a whim as though they are, I dunno, perl6.

(I am still mindblown that "I want a modern syntax for XXXX" can
possibly lead to "imitate C, which is 50 years old and thus astoundingly
even less modern than the Bourne shell by an entire decade".)

-- 
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]