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: Lawrence Velázquez
Subject: Re: Conditional operator in Shell Arithmetic section
Date: Sat, 18 Mar 2023 17:10:40 -0400
User-agent: Cyrus-JMAP/3.9.0-alpha0-221-gec32977366-fm-20230306.001-gec329773

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.


> 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.

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.


>> > 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:

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]