xargs verses exec
From: <Joel.Patterson_at_crowley.com>
Date: Tue, 24 Jul 2012 14:50:13 -0400
Message-ID: <C95D75DD2E01DD4D81124D104D317ACA1C72F36354_at_JAXMSG01.crowley.com>
Date: Tue, 24 Jul 2012 14:50:13 -0400
Message-ID: <C95D75DD2E01DD4D81124D104D317ACA1C72F36354_at_JAXMSG01.crowley.com>
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.
If I replace "ls -ltr" with "rm", I can see that this could be dangerous. (Maybe removing something not intended).
I know there are lots of you that use this command. Are there any comments or suggestions?
Joel Patterson
Database Administrator
904 727-2546
-- http://www.freelists.org/webpage/oracle-lReceived on Tue Jul 24 2012 - 13:50:13 CDT