On 11/8/19 4:50 PM, Oğuz wrote:
v=foo
echo ${v#[[:"lower":]]}

should print oo, but it prints foo instead. This is reproducible on bash
4.4

Plus

case foo in (*[![:"lower":]]*) echo bar; esac

prints bar, while

The idea is that at this point in command processing, quote removal hasn't
been performed. According to the abstract model the shell uses for word
expansions, that means the double quotes are still present in the word, and
`"lower"' is not the same as `lower'.

There was a recent extensive discussion of this and other points on the
posix mailing list, and, as kre said, the committee has decided to make
this a special case. I changed this about a month ago, and the chage is
in the devel branch.

case foo in (*[![":lower":]]*) echo bar; esac

doesn't print anything. And this is only reproducible on bash >5.0

This is an invalid character class, since a class has to begin with the
two-character sequence `[:'. The intervening double quote causes that test
to fail (this case is not so special, it seems). The first `]' then
terminates the bracket expression, so th string has to contain at least
a `]' to have a possibility of matching.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to