> sent: 25. August 2021 02:14 > from: "Lawrence Velázquez" > Cc: bug-bash@gnu.org > 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. …
I didn't say that quotes were handled "as part of the usual shell expansions" (on the contrary, in my original message I wrote "this expansion series ["Shell Expansions" performed on the command line] is not performed on the case command's _word_ and patterns"), so I'm sorry I don't get why you are emphasizing this. > … 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 This example nicely shows that I was wrong suggesting that _pattern_ undergoes quote removal before matching is attempted - thank you for that! It also tells me that single and double quotes are handled analogously to an escaping backslash ("discarded when matching"); although one could call this self-evident, I was misguided by this being explicitly documented for backslash, but not for quotes. -- Best regards!