Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 13:01:47 -0500 (EST) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: Randall R Schulz cc: cygwin AT cygwin DOT com Subject: Re: problem with bash In-Reply-To: <5.1.0.14.2.20021114093629.029925f8@pop3.cris.com> Message-ID: Importance: Normal MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Hi, Randy, Umm, no, we're not going for convolutedness here, we're trying to figure out how to do an equivalent of globbing without actually expanding the whole thing on the command line... You're right about the "./" being prepended to the output of find, and so I agree with the "sed" suggestion (except that I'd modify it to "sed 's@\./@@'" to avoid an extra backslash). I'll have to disagree with the -d, however, since the original command ("ls *") *will* list the contents of each subdirectory (as opposed to the plain "ls", which won't). Igor P.S. Geez, 25 years? You beat me by 2.5x... :-) On Thu, 14 Nov 2002, Randall R Schulz wrote: > 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 -- 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/