On 8/4/2010 10:07 PM, Chet Ramey wrote: > On 8/4/10 8:31 AM, Greg Wooledge wrote: > >> In fact, putting the ERE-pattern you want to match against into a variable >> and then using =~ $variable *is* the recommended practice, if you need to >> use =~ at all. It is the only way to get consistent results among all >> the different releases of bash that have =~, since the behavior changed >> multiple times during the 3.x series. > > All this is true (as is the text I removed), except that the behavior > changed only once: to make quoted text remove any special meaning of > the quoted characters to the regular expression matcher. > > Backwards compatibility, of course, means never having to say you're sorry, > but it also means that you never get to fix anything. The behavior change > fixed a problem, as I saw it, with the initial implementation. Without > this change, there is no clean way to match a literal character that has a > special meaning as a regexp operator. > > Chet Couldn't you have limited to single quotes -- reserving to them the function of literalizing what is between them.
Otherwise, could you think other characters you'd prefer to use to group words separated by white-space, together to be matched in a pattern? Or, why should double quotes be functionally the same as single quotes in that situation?