This is the mail archive of the cygwin 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: Question about coreutils common option "-"


--- Brian Dessent <brian@dessent.net> wrote:
<Snipped> 
> I've never heard of using '-' to ls this way.  The
> coreutils info page does list it as a common flag,
> but my interpretation of the language
> there is that it's only referring to programs that
> act as input/output filters, not as a general-
> purpose way of passing filename arguments. 
> That's why xargs exists.

How to use xargs is a definite hole in my knowledge. 
I have read the xargs info a few times, but I don't
think I have understood it yet.  I will go back to it
and try to get it this time.

> You can get ls-like output from find without any
> other programs:
> 
> find a -daystart -type f -mtime 7 -ls
> 
> If you must use an external program, the usual way
> to take the output from find and send it as
> arguments is with xargs:
> 
> find a -daystart -type f -mtime 7 | xargs ls -l

Yes, I saw that in the info for the find "-ls" option,
but in this case I am going to eventually substitute
another external program for "ls" to process the
filenames in another way.  xargs would seem to be the
correct answer for that, as you noted.

> Note that both this and your '-printf " %p"' method
> will not work for filenames that contain spaces or
> special characters.  Therefore the superior way of
> doing this is:
> 
> find a -daystart -type f -mtime 7 -print0 | xargs -0
> ls -l

Not a problem in this case, the filenames to be
processed are space-less and without any special
characters because of the program that creates them. 
Thanks anyway for the info, I will remember it.

<Snipped> 
> It doesn't work under linux either.  (It's the same
> coreutils code in either case.)

Understood.  Many thanks for reducing my level of
ignorance.

Peter

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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]