[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: String substitution bug
From: |
Andreas Kähäri |
Subject: |
Re: String substitution bug |
Date: |
Sun, 24 Nov 2024 16:08:48 +0100 |
On Sun, Nov 24, 2024 at 09:31:42AM -0500, Greg Wooledge wrote:
> On Sun, Nov 24, 2024 at 22:51:43 +1000, Martin D Kealey wrote:
> > When one *doesn't *already know how it works, “using the syntax *[:class:]*”
> > could just as easily mean using *:class:* inside *[…]*.
>
> Yeah, good luck with that. I predict that if you offer a patch to
> make this clearer, there will be a huge amount of resistance.
>
> Similar cases exist elsewhere within the man page. For example, if you
> search for $! or $$ you will not find the section that documents them.
> You would have to know that $! is a "Special Parameter", and then search
> for Special Parameter to find it -- and even then, what you find is just
> a raw ! with no $ in front of it. (My patch to clarify this was
> rejected. It doesn't help that POSIX documents this exactly the same
> way, with just # and ! and ? rather than $# and $! and $? being shown.)
I don't agree that the special parameters should be written as $! etc.
since those are their _values_ when used in the shell (exactness is a
virtue in a manual). I also don't think that the bash manual should
have to teach users about anything, especially not about the syntax of
regular expressions etc. as these things are described in other manuals
on the user's system. The manual should be a reference manual, not a
tutorial.
I don't have a real opinion about the colon in the pattern matching
section (as I don't have an issue with the way the text is presented).
It may be worth aligning the presentation of the text in the manual with
the standard, but I don't think it's a bug as such.
>
> Another one that commonly trips people up is the ${parameter-word}
> expansion. The man page only has ${parameter:-word} shown. There's
> a paragraph above it that talks about "omitting the colon", but people
> don't see that.
>
> Newer editions of POSIX include a table that shows both
> ${parameter:-word} and ${parameter-word} (see
> <https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#tag_19_06_02>).
> Bash doesn't have that.
>
> In addition, POSIX puts the paragraph that mentions "omission of the
> <colon>" *below* the section that people see, rather than above it.
> So, if someone scans down the page until they find the eye-catching
> ${paramter:-word} definitions, and keeps reading from that point,
> they will eventually find the paragraph about the colons, even before
> the table. They don't have to read *backwards* to find it.
--
Andreas (Kusalananda) Kähäri
Uppsala, Sweden
.
- String substitution bug, marcel.plch, 2024/11/23
- Re: String substitution bug, Lawrence Velázquez, 2024/11/23
- Re: String substitution bug, marcel.plch, 2024/11/23
- Re: String substitution bug, Andreas Kähäri, 2024/11/24
- Re: String substitution bug, Martin D Kealey, 2024/11/24
- Re: String substitution bug, Oğuz, 2024/11/24
- Re: String substitution bug, Martin D Kealey, 2024/11/25
- Re: String substitution bug, Zachary Santer, 2024/11/25
- Re: String substitution bug, Greg Wooledge, 2024/11/24
- Re: String substitution bug,
Andreas Kähäri <=
- Re: String substitution bug, Lawrence Velázquez, 2024/11/24
- Re: String substitution bug, Andreas Kähäri, 2024/11/25
- Re: String substitution bug, Martin D Kealey, 2024/11/25
- Re: String substitution bug, Zachary Santer, 2024/11/24
- Re: String substitution bug, Andreas Kähäri, 2024/11/25
- Re: String substitution bug, Chet Ramey, 2024/11/25
- Re: String substitution bug, marcel.plch, 2024/11/25
- Re: String substitution bug, Lawrence Velázquez, 2024/11/25
- Re: String substitution bug, Lawrence Velázquez, 2024/11/25
- Re: String substitution bug, Chet Ramey, 2024/11/25