help-bash
[Top][All Lists]
Advanced

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

Re: Conditional operator in Shell Arithmetic section


From: uzibalqa
Subject: Re: Conditional operator in Shell Arithmetic section
Date: Sat, 18 Mar 2023 21:50:47 +0000

------- Original Message -------
On Sunday, March 19th, 2023 at 9:10 AM, Lawrence Velázquez <vq@larryv.me> wrote:


> On Sat, Mar 18, 2023, at 4:30 PM, uzibalqa wrote:
> 
> > This is how it is described in the Awk Manual
> > 
> > selector ? if-true-exp : if-false-exp
> > 
> > Which is much more informative.
> 
> 
> The gawk man page uses "expr1 ? expr2 : expr3", although there is
> also a bit of exposition.
> 
> > On Sunday, March 19th, 2023 at 7:41 AM, Lawrence Velázquez vq@larryv.me 
> > wrote:
> > 
> > > On Sat, Mar 18, 2023, at 1:59 PM, uzibalqa wrote:
> > > 
> > > > There needs to be at least one example of actual use in a typical
> > > > situation.
> > > 
> > > No, there doesn't.
> > 
> > There is need if you actually want to help readers.
> 
> 
> Your idea of who "readers" are and how much hand-holding they require
> is not the only idea.

Think more about it.  One cannot talk about how much when there in none.  I am 
suggesting one example at least (perhaps a small final subsection of the 
reference part).
 
> > The awk maintainers certainly understood the need for an actual use
> > case (getting the absolute value of x).
> 
> 
> You are talking about the gawk manual, which is written like a
> tutorial. It is appropriate for a tutorial to have many examples.
> This is fine.

I do not think it is missing any reference material.  So it is mostly complete.
 
> The bash "manual" is more or less the same as its man page and aims
> for concision, like a reference. The gawk man page is similar.
> This is also fine.

It is not fine because it does not make it complete.  If we are so focused 
about a solely reference document, there could be a tutorial with at least some 
examples for the esoteric parts.  Or a small appendix at the end.
 
> > > > I also suggest to include it in section "3.2.5.2
> > > > Conditional Constructs".
> > > 
> > > It's already in Section 6.5. It does not belong in 3.2.5.2.
> > 
> > If you look at the Awk Manual, some maintainers are surely convinced
> > that in belrongs in "6.3.4 Conditional Expressions".
> 
> 
> Not the same thing.
> 
> The "Conditional Expression" section of the gawk manual is about
> the ? : operator because "conditional expression" is what they
> call that operator.
> 
> The "Conditional Constructs" section of the bash manual is about
> the "if", "case", "select", "((...))", and "[[...]]" commands.
> The operators available within ((...)) and [[...]] are described
> elsewhere:

I found it hard to find because it is not self evident that it only applies to 
arithmetic operations and should be found there.  Perhaps have a link on the 
possibility of such conditional in case of arithmetic. 
 
> https://www.gnu.org/software/bash/manual/html_node/Bash-Conditional-Expressions.html
> https://www.gnu.org/software/bash/manual/html_node/Shell-Arithmetic.html
> 
> 
> --
> vq



reply via email to

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