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 18:25:11 -0400
User-agent: Cyrus-JMAP/3.9.0-alpha0-221-gec32977366-fm-20230306.001-gec329773

On Sat, Mar 18, 2023, at 5:50 PM, uzibalqa wrote:
> Think more about it.  One cannot talk about how much when there in 
> none.

I don't know what this means.


> I am suggesting one example at least (perhaps a small final 
> subsection of the reference part).

I do not think the bash manual needs an example for a feature that
is this common.  (Many, many, MANY languages have ? : or something
like it.  Do you want examples for + - * / too?)


> It is not fine because it does not make it complete.

The manual need not satisfy your personal notion of completeness.
It makes external references where appropriate, like so:

"The operators and their precedence, associativity, and values are
the same as in the C language."


> If we are so focused about a solely reference document, there
> could be a tutorial with at least some examples for the esoteric
> parts.

You can find such material elsewhere.  Any decent C teaching material
can tell you how ? : works and how you might use it in practice.  The
official bash manual is not the only place to learn about such things
(although finding good third-party material is admittedly fraught).

Also: "esoteric" does not mean "something I don't understand".


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

        ((...))

                (( expression ))

        The arithmetic expression is evaluated according to the
        rules described below (see Shell Arithmetic).

In the HTML manual "Shell Arithmetic" is linked.  There is nothing
about ? : that merits a special call-out.

Improvements to the index might be useful.  Perhaps additional text
to improve searchability (e.g., "ternary").


-- 
vq



reply via email to

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