[Python-Dev] Re: [Python-checkins] python/dist/src/Lib warnings.py,1.19,1.20

Fred L. Drake, Jr. fdrake@acm.org
Thu, 15 May 2003 00:43:57 -0400


Charles G Waldman writes:
 > I'm afraid I must be missing something terribly obvious here, but why
 > would you need to escape a dot on a command line?  None of the shells
 > I'm familiar with treat dot as a metacharacter.  Isn't `?' the
 > standard shell metacharacter for "any character"?  Filename patterns
 > on the shell command line are "glob patterns", not RE's.

It's not the shell that treats it as a metacharacter, but the RE
syntax.  Preventing "." from being treated as an RE metacharacter
would be done by inserting a "\" character, which is a shell
metacharacter, and would need another "\" to escape that, so that one
of the "\" would end up in the RE.

Of course, my favorite way of dealing with this is to use single
quotes around the argument rather than backslashes; that works fine in
sh-syntax shells, and doesn't require doubling-up backslashes.



  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation