Re: xargs verses exec

From: Radoulov, Dimitre <>
Date: Tue, 24 Jul 2012 21:33:22 +0200
Message-ID: <>

Just to add that you're seeing the output of ls because ls with no arguments defaults to the current directory, rm with no arguments is not a valid syntax and your command won't remove anything:

zsh-4.3.14[t]% find -name x | xargs ls
zsh-4.3.14[t]% find -name x | xargs rm
rm: missing operand
Try `rm --help' for more information.


On 24/07/2012 21:24, Radoulov, Dimitre wrote:
> Hi Joel,
> On 24/07/2012 20:50, wrote:
>> It has come time to switch to xargs instead of exec. I have found
>> two issues with xargs, but I'll only ask one now.
>> Say I change to ORACLE BASE and do a find on 'all the subdirectories'
>> piping through xargs, but... there are no files that meet the
>> criteria -- say the extension is ".abc".
>> cd ${ORACLE_BASE}
>> find */cdump -name "*.abc" -type f -mtime +40 -print | xargs ls -ltr
>> Then, the find command comes back with the contents of the
>> ${ORACLE_BASE} directory.
> GNU xargs has the -r/--no-run-if-empty option for this :).
> That said, _most_ find implementations support the {} + syntax for
> xargs emulation:
> [...[

Received on Tue Jul 24 2012 - 14:33:22 CDT

Original text of this message