Mail Archives: cygwin/2002/11/14/12:49:46
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 -