Edit: Question ansewered by Gordon Davisson's comment
I was reading the GNU Bash manual, and I noticed that there are basically three types of "Parameter expansion" that do pattern matching:
${parameter#word} ${parameter##word}
${parameter%word} ${parameter%%word}
${parameter/pattern/string} ${parameter//pattern/string} ${parameter/#pattern/string} ${parameter/%pattern/string}
What I found odd is that the first two kinds are described like this:
The word is expanded to produce a pattern and matched according to the rules described below (see Pattern Matching).
But the third kind is described like this:
The pattern is expanded to produce a pattern just as in filename expansion. [...] The match is performed according to the rules described below (see Pattern Matching).
So I'm wondering, is there actually a difference between the expansions? The first two descriptions are not exactly clear about what kind of expansion is made, but, in any case, the "pattern matching" rules are virtually the same as "filename expansion".
So maybe this is an issue of lack of clarity in the documentations, and we can say that they are all the same?
My guess would be that the first two descriptions are more accurate, because I doubt that any sort of actual filesystem check is performed during the third kind.
case
statements, and...). The description of the third points out the similarity, but it's there in all three. BTW, the type of pattern used here is called "wildcard" or "glob" patterns (and it should not be confused with regular expressions).