Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16027

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

From Eli Schwartz <eschwartz@archlinux.org>
Newsgroups gnu.bash.bug
Subject Re: Are there any plans for more readable, modern syntaxes for If statements?
Date 2020-03-13 09:27 -0400
Message-ID <mailman.2594.1584106066.2412.bug-bash@gnu.org> (permalink)
References <CAB+qc9AAPQbzp92tv-FOR4Kh+2UdZyRwGiPOfNegVqv5UFnU5Q@mail.gmail.com> <f1d0d39d-b6e6-c33e-7463-226f6994b99e@archlinux.org> <CAAJSdjidSYg1yoWC7UbbLUUDF3ug9ekDtkOP7Er-JOjrLoDssQ@mail.gmail.com> <81145cad-63a1-f67c-1cc1-3fbdaa5d2930@archlinux.org>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: Are there any plans for more readable, modern syntaxes for If statements? Eli Schwartz <eschwartz@archlinux.org> - 2020-03-13 09:27 -0400

csiph-web