On Fri, Jan 17, 2025 at 23:32:18 -0500, Lawrence Velázquez wrote:
> Here's an attempt at clarification that restructures the section
> and describes the behavior of ${foo^x} more explicitly.  It also
> avoids the aforementioned confusion between the ^/, "operators"
> and the ^/, "expansions".
> 
>       *Case modification.*  This expansion modifies the case of
>       alphabetic characters in _parameter_.
> 
>       The _pattern_ is expanded to produce a pattern just as in
>       pathname expansion.  The pattern should not attempt to match
>       more than one character.  If _pattern_ is omitted, it is
>       treated like a `?', which matches every character.
> 
>       The `^' expansion examines the first character in the
>       expanded value of _parameter_; if that character matches
>       _pattern_ and is lowercase, it is converted to uppercase.
>       The `^^' expansion works similarly, but it converts every
>       matching lowercase character in the expanded value.
> 
>       The `,' and `,,' expansions work like `^' and `^^',
>       respectively, except that they convert matching uppercase
>       characters to lowercase.
> 
>       [final paragraph left as-is]

I agree that this is an improvement.

I still think the clause "The _pattern_ is expanded to produce a pattern"
is a bit circular.  The "as in pathname expansion" part should probably be
changed to refer to the *Pattern Matching* section, which is the correct
reference.  Perhaps the second paragraph should read something like this:

    After expansion, the _pattern_ applies according to the rules
    described under *Pattern Matching*.  The _pattern_ should not attempt
    to match more than one character.  If _pattern_ is omitted, `?' is
    used.

I think that's about as clear and concise as I can make it.

Reply via email to