This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problem with bash


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@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]