delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/02/17/11:42:11

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Thu, 17 Feb 2005 08:41:58 -0800 (PST)
From: Kaz Kylheku <kaz AT ashi DOT footprints DOT net>
To: James Lemke <jim AT TheLemkes DOT ca>
cc: cygwin AT cygwin DOT com
Subject: Re: file globbing
In-Reply-To: <1108654296.7246.680.camel@keel.thelemkes.ca>
Message-ID: <Pine.LNX.4.44.0502170825070.21158-100000@ashi.FootPrints.net>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019