[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: |
Sun, 19 Mar 2023 14:40:26 +0000 |
------- Original Message -------
On Monday, March 20th, 2023 at 2:18 AM, Kerin Millar <kfm@plushkava.net> wrote:
> On Sun, 19 Mar 2023 13:17:14 +0000
> uzibalqa uzibalqa@proton.me wrote:
>
> > ------- Original Message -------
> > On Sunday, March 19th, 2023 at 10:56 AM, uzibalqa uzibalqa@proton.me wrote:
> >
> > > ------- Original Message -------
> > > On Sunday, March 19th, 2023 at 10:25 AM, Lawrence Velázquez vq@larryv.me
> > > wrote:
> > >
> > > > 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).
> >
> > What changes, additions, clarifications and improvements would you suggest
> > and do?
>
>
> The POSIX documentation states, "The evaluation of arithmetic expressions
> shall be equivalent to that described in Section 6.5, Expressions, of the ISO
> C standard." [] By contrast, the bash manual states, "The operators and their
> precedence, associativity, and values are the same as in the C language." The
> latter wording strikes me as being more digestible by its overall audience.
> On the other hand, the POSIX wording makes it rather more clear as to what to
> look for, and where to look within upon finding it, so there may yet be some
> room for improvement there. Further, the SEE ALSO section does not (directly)
> acknowledge the existence of "Shell Command Language" and "ISO/IEC 9899:2018"
> (C) in their capacity as distinct specifications. Perhaps it should.
>
> Otherwise, I'm not sure that there is much else to be done. The operator can
> be trivially searched for in a typical man pager e.g. by using \?.: as a
> pattern. Perhaps something could be done to make GNU info(1) more easily
> match the relevant section upon searching its index. However, in my
> experience, the majority of capable bash users act as though info doesn't
> exist, while newcomers struggle to use a pager effectively, let alone info.
> Introducing it as the "conditional (ternary) operator" might help some
> people, though it should be borne in mind that it is correctly referred to as
> the "conditional operator", irrespective of its provenance in languages other
> than sh and C.
We could see how to improve info so newcomers would likely use it.
I see no benefit in putting time and effort on info when nobody would use it.
I do use info as it is quicker getting information and examples from the
terminal. One problem that occurs to me is that in bash I cannot call info to
see for some examples. Whereas fol awk, sed, grep, find, I can see many
helpful examples.
As to your comment last, instead of introducing it as "conditional (ternary)
operator", we could still stay with "conditional operator" but with a side note
later on mentioning that it has been called "conditional ternary operator" in
sh and C. That way a search for "ternary" would get you to the right section.
> [*]
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap01.html#tagtcjh_15
>
> --
> Kerin Millar
- Re: Conditional operator in Shell Arithmetic section, (continued)
- Re: Conditional operator in Shell Arithmetic section, Greg Wooledge, 2023/03/18
- Re: Conditional operator in Shell Arithmetic section, Lawrence Velázquez, 2023/03/18
- Re: Conditional operator in Shell Arithmetic section, uzibalqa, 2023/03/18
- Re: Conditional operator in Shell Arithmetic section, alex xmb ratchev, 2023/03/18
- Re: Conditional operator in Shell Arithmetic section, Lawrence Velázquez, 2023/03/18
- Re: Conditional operator in Shell Arithmetic section, uzibalqa, 2023/03/18
- Re: Conditional operator in Shell Arithmetic section, Lawrence Velázquez, 2023/03/18
- Re: Conditional operator in Shell Arithmetic section, uzibalqa, 2023/03/18
- Re: Conditional operator in Shell Arithmetic section, uzibalqa, 2023/03/19
- Re: Conditional operator in Shell Arithmetic section, Kerin Millar, 2023/03/19
- Re: Conditional operator in Shell Arithmetic section,
uzibalqa <=