delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/11/14/12:49:46

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Message-Id: <5.1.0.14.2.20021114093629.029925f8@pop3.cris.com>
X-Sender: rrschulz AT pop3 DOT cris DOT com
Date: Thu, 14 Nov 2002 09:49:13 -0800
To: cygwin AT cygwin DOT com
From: Randall R Schulz <rrschulz AT cris DOT com>
Subject: Re: problem with bash
In-Reply-To: <Pine.GSO.4.44.0211141221480.4275-100000@slinky.cs.nyu.edu>
References: <20021114103412 DOT A36130 AT reliant DOT immure DOT com>
Mime-Version: 1.0

Hi, Igor,

Well, if we're going to play "what's the most convoluted way you can think 
of to do something with a much simpler equivalent," then I should point out 
that you need to modify your suggestion thusly:

   find . -maxdepth 1 \( -name .\* -o -print \) |sed -e 's/^\.\///' |xargs 
ls -d

First, unless you give the "-d" option to "ls," you'll get a listing of the 
contents of any directories whose names are output by "find." (Or is that 
what the original user wanted? Somehow I don't think so.)

Second, the names "find" prints (and which "ls" will subsequently reproduce 
in its output) will have "./" as a prefix, so the "sed" command is needed 
to remove them. This would also be true if you used the default starting 
directory for "find" (i.e., if you omit the "." argument).

Personally, plain old "ls" works well for me.

God!... Is this all my 25 years of using Unix is worth?

Randall Schulz
Mountain View, CA USA


At 09:29 2002-11-14, Igor Pechtchanski wrote:
>Well, if you really want something equivalent to 'ls *', you'd need to do
>something like
>
>find . -maxdepth 1 \( -name .\* -o -print \) | xargs ls
>
>The "-maxdepth 1" is to not descend recursively into directories, and the
>"-name .\*" is to avoid listing hidden files/directories (which would not
>be matched by the '*' glob).  The "-type f" is actually wrong, as '*' will
>match directories as well.
>
>Also beware that ls may be an alias, and xargs will run the actual
>executable in the path...
>         Igor


--
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/

- Raw text -


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