Mail Archives: cygwin/2005/02/17/11:42:11
On Thu, 17 Feb 2005, James Lemke wrote:
> Date: Thu, 17 Feb 2005 10:31:37 -0500
> From: James Lemke <jim AT TheLemkes DOT ca>
> To: cygwin AT cygwin DOT com
> 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
runs ls.
> 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:
echo ../tcl[7-9]*
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.
> Comments?
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
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -