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

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
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Thu, 14 Nov 2002 12:29:40 -0500 (EST)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: wayne <wayne AT reliant DOT immure DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: problem with bash
In-Reply-To: <20021114103412.A36130@reliant.immure.com>
Message-ID: <Pine.GSO.4.44.0211141221480.4275-100000@slinky.cs.nyu.edu>
Importance: Normal
MIME-Version: 1.0

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

On Thu, 14 Nov 2002, wayne wrote:

> Here is an example..
>
> find . -type f |xargs ls
>
> I came in late and this might not be a solution to your exact
> problem but it might at least help get you on the right path.
>
>
> On Thu, Nov 14, 2002 at 08:29:27AM -0800, Randall R Schulz wrote:
> > Claudio,
> >
> > No, that's not a bug. It's just a (system-dependent) limit shared by all
> > POSIX-compliant systems. The actual limit happens to be on the low side
> > under Cygwin.
> >
> > Familiarize yourself with the "xargs" command. It's there just to handle
> > these cases.
> >
> > Also, in many cases the programs themselves process directories and don't
> > need to have each file within the directory passed to them as an argument.
> > Ls certainly does this (hence your "ls *" example has an equivalent without
> > limits: plain old "ls") and the grep family has a -R (recursive) option
> > that's related.
> >
> > The reason you don't see the problem from a DOS command prompt is that
> > argument handling (in particular, wild-card processing) is different when
> > Cygwin programs are invoked from a DOS CMD.exe or Command.exe shell and
> > that difference effectively side-steps the limit you experience when
> > running under a Cygwin shell (BASH, zsh, tcsh, ash, etc.).
> >
> > Good luck.
> >
> > Randall Schulz
> > Mountain View, CA USA
> >
> >
> > At 01:59 2002-11-14, Claudio Tamietto wrote:
> > >I have installed cigwin on my W2K PC and all is very well functioning .
> > >However if i try some commands like ls * or grep -i -l some_text * from a
> > >directory whit a lot of files (7-8 thousand) i obtain this error
> > >
> > >bash: /usr/bin/ls: Invalid argument
> > >
> > >Is it a bug ?
> > >
> > >If i try the same commands from a dos shell the error is not reported and
> > >all is functioning .

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Water molecules expand as they grow warmer" (C) Popular Science, Oct'02, p.51


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