On 8/24/21 8:14 PM, Lawrence Velázquez wrote:
> On Tue, Aug 24, 2021, at 4:44 PM, Dietmar P. Schindler wrote:
>> Doesn't the example I gave above show that quotes are removed? If they
>> weren't, how could word aa with pattern a""a constitute a match?
> 
> The quotes are handled by the matching process itself, *not* as
> part of the usual shell expansions.  Otherwise these patterns would
> be equivalent, but they're not.
> 
> % cat /tmp/foo.sh
> case $1 in
>     'a?a') echo one ;;
>     a?a) echo two ;;
> esac
> % bash /tmp/foo.sh 'a?a'
> one
> % bash /tmp/foo.sh aaa
> two

The literal quote characters are removed, and the characters between the
quotes are appropriately quoted for the pattern matcher, so they're forced
to match themselves. This happens AIBM.

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