Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16026
| Path | csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail |
|---|---|
| From | John McKown <john.archie.mckown@gmail.com> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: Are there any plans for more readable, modern syntaxes for If statements? |
| Date | Fri, 13 Mar 2020 06:59:56 -0500 |
| Lines | 56 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.2590.1584100818.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> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| X-Trace | usenet.stanford.edu 1584100819 13324 209.51.188.17 (13 Mar 2020 12:00:19 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | bug-bash@gnu.org |
| To | Eli Schwartz <eschwartz@archlinux.org> |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=x+kRy1UaZE1ilIk3OdccVlNFXsK72hNfKVvlLfnLcZA=; b=stnk+C4+nKzlQryuyv+cM7ChaIVK9j7yTspjZ5OjJ3GzRY9OxCTeDv6SB53ivwjmvr TY2X70tS9g2JAODyrKO08xYhaECioYF7E6guKQjhKrlbExvtFSrAai5zFANbtRN4WupK QGr1MJUXCefvm2xWLivtWhmFa2/2fHvCZOUuX98IqhBRFDSdCTjha+l2zqoHPw9Qyx61 BKKVuC5WeNBfYeb9nv2Gkewd9al45uKlRIR3CEHifOX/kgu1BJa18RAt/6RKUdLwKh3G ryG5Osq8e6dx36ziDGxY50CQofsVUfAT4NNYEgEo/I0O1DucAGOz8Utw1WO+TQP7MbXy dzmw== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=x+kRy1UaZE1ilIk3OdccVlNFXsK72hNfKVvlLfnLcZA=; b=XRj8SybvPyzJCw055DJYCczloIvqzMcf/4ZRZxz8kODljOvZpA+mUwvMszzY+K+no0 h8fDF+MoAlS+D6MdBcv9P15lKkjOlecsWhIkfS688wqPgAcY6ARadSZVp6DcTu5OQGrl xMmrUFZ8xHdHNrr+pXlxex10xeJJqJ7OZcLHwDauXDAMjfMkUFaHrRZ5BRMoYwbudSJU sASUwmy97zc4NtJ8FTEzkSK+kvZ3L6KgRcq2f9xnrU2BFuRC9cdRLbK5driN2CkhiAU/ 5uT3Kllv0jVLK03G3anGhwqEaFJOVJR4hZvajk6rGAO+MTSDSw89zTFiA90j6z5mAa7B EjwQ== |
| X-Gm-Message-State | ANhLgQ04ICFHiIYCxYHPe7ezN3lEdF2pDXKdVT2t0Lcvt+dzZkO1efSC NCE4NrX8AIhePvWfa4rmzp0BYC/hW7Obx+Ijwwo= |
| X-Google-Smtp-Source | ADFU+vu2py4LEPmCtPibw7QCPAmHg6SQrvMx7phJS7MvpAv72SpptR81ugswZUtGNE/2PFCUWGtUKO0427J1nnAyNOg= |
| X-Received | by 2002:a1c:1d4d:: with SMTP id d74mr10365907wmd.123.1584100807734; Fri, 13 Mar 2020 05:00:07 -0700 (PDT) |
| In-Reply-To | <f1d0d39d-b6e6-c33e-7463-226f6994b99e@archlinux.org> |
| X-detected-operating-system | by eggs.gnu.org: Genre and OS details not recognized. |
| X-Received-From | 2a00:1450:4864:20::336 |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.23 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.23 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <https://lists.gnu.org/archive/html/bug-bash> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <CAAJSdjidSYg1yoWC7UbbLUUDF3ug9ekDtkOP7Er-JOjrLoDssQ@mail.gmail.com> |
| X-Mailman-Original-References | <CAB+qc9AAPQbzp92tv-FOR4Kh+2UdZyRwGiPOfNegVqv5UFnU5Q@mail.gmail.com> <f1d0d39d-b6e6-c33e-7463-226f6994b99e@archlinux.org> |
| Xref | csiph.com gnu.bash.bug:16026 |
Show key headers only | View raw
On Thu, Mar 12, 2020 at 4:01 PM Eli Schwartz <eschwartz@archlinux.org>
wrote:
> On 3/12/20 3:00 PM, Vaidas BoQsc wrote:
> > Are there any plans to have alternative, a more modern C or D like
> syntaxes
> > for IF statements, While loop and the like in Bash?
> >
> > Would it be better to just make a new shell and command language similar
> to
> > Bash instead of adding these alternatives?
>
> $ if (true) { echo success; }
> bash: syntax error near unexpected token `{'
> $ alias {=then }=fi
> $ if (true) { echo success; }
> success
>
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.
>
> Is this what you wanted? :p
>
> Personally, I don't really see the problem. I already need to remember
> how to do these in multiple languages, and any of them look weird from
> the context of another language. Can you describe why you feel the bash
> syntax isn't "modern enough"?
>
> What would you propose for backwards compatibility, and what is the
> likelihood people will actually use a different syntax to do the same
> thing, which only works on very new systems? What about POSIX sh scripts?
>
> This seems like a fairly big proposal for something I'm not even seeing
> a definite argument as being actually wrong.
>
> --
> Eli Schwartz
> Arch Linux Bug Wrangler and Trusted User
>
>
--
People in sleeping bags are the soft tacos of the bear world.
Maranatha! <><
John McKown
Back to gnu.bash.bug | Previous | Next | Find similar
Re: Are there any plans for more readable, modern syntaxes for If statements? John McKown <john.archie.mckown@gmail.com> - 2020-03-13 06:59 -0500
csiph-web