Problem with globbing and single backslash in expanded variable

Kevin Butler kbutler@campuspipeline.com
Thu Mar 28 20:05:00 GMT 2002


I've searched the FAQ & list archives, but didn't find anything that matches this.

There's a strange interaction between globbing and expanding a path with a 
drive-letter-colon-backslash.

For the example, I set up three variables pointing to the cygwin/sbin 
directory, with 0, 1, or 2 backslashes:

PYTHON:d:/cygwin$ D0=d:/cygwin/sbin
PYTHON:d:/cygwin$ D1=d:\\cygwin/sbin
PYTHON:d:/cygwin$ D2=d:\\cygwin\\sbin

Zero works fine:

PYTHON:d:/cygwin$ ls ${D0}/*exe
d:/cygwin/sbin/rmt.exe

One removes the backslash:
PYTHON:d:/cygwin$ ls ${D1}/*exe
d:cygwin/sbin/rmt.exe

Two gets no matches:
PYTHON:d:/cygwin$ ls ${D2}/*exe
ls: d:\cygwin\sbin/*exe: No such file or directory

I would call it just a regex matching issue, except it only acts strange when 
the single backslash is in an expanded variable and globbing is required:

PYTHON:d:/cygwin$ ls d:\\cygwin/sbin/*exe
d:\cygwin/sbin/rmt.exe
PYTHON:d:/cygwin$ ls ${D1}/rmt.exe
d:\cygwin/sbin/rmt.exe

I've verified this with a brand-new cygwin installation on NT 4.0 SP6a.

Is this a bug, or do I need to grok globbing a little deeper?

Thanks!

kb


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list