Herculano de Lima Einloft Neto wrote:

You can use:

find [whatever] -exec rm -rf '{}' \;

or

find [whatever] | xargs rm -rf

Usually, the answer to your question would be: use xargs or put the second command between apostrophes. Something like:

vi `which mozilla`

I think if you use rm -rf `find [whatever]` it might work..

DON'T use these lines unless you're absolutely sure your find will return exactly what you want.. rm -rf is the most destructive Unix command, so if you don't know what you're doing, maybe you should wait a couple of months until you do. :)

Amen ;-)


Seriously, the best thing you can do is just run the 'file listing' or 'data portion' of any command you're going to pipe together (or use -exec, xargs, redirection) by ITSELF, to make sure you're getting the expected results, sanity check the results, and THEN using command history, bring up the same command and wrap it in backticks or add the -exec or | xargs clause to it.

Consider the following, and what would happen if BOTH were executed blindly:
find /tmp -name "jre*" -exec rm {} \;
OK, life's happy, remove all jre* files in the /tmp heirarchy.

find / tmp -iname "jre.*" -exec rm {} \;
Oops, accidently put a space between / and tmp. Hope you didn't actually WANT a working Java/jre on your system!


Sane way:
find /tmp -name "jre*"
check results
If OK, then use the SAME EXACT COMMAND via shell command line editing, and just wrap or add to it:
find /tmp -name "jre*" -exec rm -f {} \;


Scott

Read the man pages for rm, find and xargs so you can understand this.

Best,
--
Herculano de Lima Einloft Neto <[EMAIL PROTECTED]>

_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"




_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to