On 07/23/2012 09:59 AM, Enda wrote:
> Thanks Pádraig, Eric, Andreas and Jim,
> 
> 
> This almost gives the output that I want:
> 
> find * -mtime 0 -exec ls -rt {} +
> 
> Is there a way to list files not on a separate line, but one after the
> other with a space in between them (and a newline at the end)?, like
> '-m' except without the commas and the newline being only at end.

Sure, except that then you are giving yourself a security hole the
moment you find a file with a space in the name.

find * -mtime 0 -exec ls -rt {} + | tr '\n' ' '

> This gives the kind of output that I want except in the wrong order:
> 
> find -mtime 0 -printf "%f\n"

Which has the same security hole.  Basically, any time the separator
between file names can also occur in a file name, you are setting
yourself up for failure, so you are better off thinking about the
problem up front and reconsidering whether a space-separated list of
file names is what you really want.

-- 
Eric Blake   [email protected]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to