This is the mail archive of the
mailing list for the Cygwin project.
Re: file globbing
- From: Kaz Kylheku <kaz at ashi dot footprints dot net>
- To: James Lemke <jim at TheLemkes dot ca>
- Cc: cygwin at cygwin dot com
- Date: Thu, 17 Feb 2005 08:41:58 -0800 (PST)
- Subject: Re: file globbing
On Thu, 17 Feb 2005, James Lemke wrote:
> Date: Thu, 17 Feb 2005 10:31:37 -0500
> From: James Lemke <jim@TheLemkes.ca>
> To: firstname.lastname@example.org
> Subject: file globbing
> I've recently noticed a problem with Cygwin ls. I did a quick search of
It's not ls that does the globbing. That is done by the shell before it
> the archives, but didn't get any hits. Has anyone else seen this?
> Try: ls -dl ../tcl[7-9]*
> Result on Linux: ../tcl ../tcl8
> Result on Cygwin: ../tcl8
> That is, on Cygwin tcl[7-9]* does not match tcl. I think it should.
It should not. Shell regular expressions for globbing filenames are not
the same as normal regular expressions. [7-9]* does not mean ``zero or
more occurences of a character in the 7-9 class'' it means ``exactly
one occurence of 7, 8 or 9 followed by zero or more characters''.
Not sure what is going on with the Linux example.
If you are investigating glob behavior, try using echo rather than ls:
If there is any confusion about what is being matched due to leading,
trailing or embedded whitespace, try this:
for x in <pattern>; do echo "<$x>"; done
Then you get each matching name, in angle braces, on a separate line.
> I have upgraded to the latest coreutils and still see the problem.
The only apparent problem is on the Linux side, where a pattern that
calls for a digit in the range 7-8 seems to be matching a name that
contains no such thing.
It does look like the shell you are using on Linux is interpreting the
pattern as a full regular expression.
Meta-CVS: the working replacement for CVS that has been stable since
2002. It versions the directory structure, symbolic links and execute
permissions. It figures out renaming on import. Plus it babysits the kids
and does light housekeeping! http://freshmeat.net/projects/mcvs
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html