On Wed, Feb 09, 2011 at 12:25:09AM -0700, Clint Pachl wrote:
> In the caveats section it states the following:
>
>
> Passing the output of find to other programs requires some care:
>
> $ find . -name \*.jpg | xargs rm
> or
> $ rm `find . -name \*.jpg`
>
> would, given files ``important .jpg'' and ``important'', remove
> ``important''. Use the -print0 or -exec primaries instead.
>
>
> Is this an error? The language indicates that ``important'' will be
> removed (and possibly ``important.jpg''; it's not clear) when
> executing both above commands. Is this correct?
>
> If it is correct, then I don't get what the caveat is. For example:
>
> $ touch important important.jpg
> $ find . -name \*.jpg | xargs rm
> $ ls
> important
>
> What does -print0 or -exec have to do with it?
You should read more carefully. There's a space in one of the filenames.
-0tto