www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/08/25/12:36:24

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>,
<http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <37C41932.5EC121E0@geekspace.com>
Date: Wed, 25 Aug 1999 12:26:26 -0400
From: Joshua Rosen <rozzin AT geekspace DOT com>
Organization: GEEKS
X-Mailer: Mozilla 4.61 [en] (WinNT; U)
X-Accept-Language: en,ja,no
MIME-Version: 1.0
To: cygwin AT sourceware DOT cygnus DOT com
Subject: Re: How do I list subdirectories?
References: <PDGENBLLHCGCCAAA AT my-deja DOT com>

Clark Sims wrote:
> 
> Nice try but
> ls -F | egrep .*\/
> doesn't work.
> I agree that it ought to. I don't understand why it
> doesn't.

Because the asterisk is neither quoted nor escaped, so it's being
expanded by the shell before it's fed to grep.

Use any of:
	'.*/'
	".*/"
	.\*/

Note that the forward slash doesn't need to be escaped--it's not a
special regexp character.

> However Kim Poulsen found a command that does work:
> ls -F | egrep \/

And this works (with less typing;)), because (e|f|)grep finds an
equivilant substring -anywhere- in the string that you grep from. You
only need the ".*" if you use it like "^.*" ;)

> 
> It seems that this is a question on pattern matching.
> It seems to me that a directory which is mached by:
> \/
> should also be matched by
> *\/
... if we're using shell patterns (which the grep command isn't).
In the regexps that grep is using, it'd be appropriate for you to be
told that your regexp is invalid, because there aren't any characters
before the Kleen star.
Remember, too, that the "*/" isn't being fed to grep, too--all of the
file-names, ending in '/', joined together by spaces, are, and that's
not going to match.

look at the string output by:
	echo */

I am wondering why using a backslash anyware in a shell expression
escapes all of the asterisks, right now..., but that appears to be
something about bash, not Cygwin.

Oh--a fairly good description of standard regexps (and all sorts of
other things) can be found in the Free Online Dictionary of Computing:
http://foldoc.doc.ic.ac.uk/

		-Rozzin.
-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GFA/CS/L/M/P/MU/O d(-) s:-- a? C++++$>$ UL P L+ E W+++ N-(!) o? K(--)
w(--)(---) O+++ M-- V? PS+++ PE Y+ PGP-(+++) t 5 X+ R* tv(+) b+ DI+
D---- G+++ e- h! r%--- y+
------END GEEK CODE BLOCK------
rozzin AT geekspace DOT com -- http://i.am/rozzin

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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