On Thu, Nov 06, 2003 at 07:43:46PM +0000, Magosányi Árpád wrote:
[...]
> +       find . -name config.{log,status,cache} |xargs rm -f
[...]

Two things:
Does -name config.{log,status,cache} actually work for you? It doesn't
do for me:
------------------
[EMAIL PROTECTED]:/tmp/test> touch config.log
[EMAIL PROTECTED]:/tmp/test> find . -name 'config.{log,status,cache}'
[EMAIL PROTECTED]:/tmp/test> find . -name config.{log,status,cache}
find: paths must precede expression
Usage: find [path...] [expression]
------------------

Never ever use "|xargs rm -f".
------------------
[EMAIL PROTECTED]:/tmp/test> mkdir -p 'evil /etc/passwd /'
[EMAIL PROTECTED]:/tmp/test> touch 'evil /etc/passwd /config.sub'
[EMAIL PROTECTED]:/tmp/test> find . -name config.sub | xargs rm -v
rm: cannot remove `./evil': No such file or directory
removing `/etc/passwd'
rm: cannot unlink `/etc/passwd': Permission denied
rm: cannot remove `/config.sub': No such file or directory
------------------

If you combine find with anything that modifies the results (mv, rm,
cp, ...) _always_ use either
find ... -exec rm '{}' \;
or [1]
find ... -print0 | xargs -0r rm -f

             cu andreas

[1] This is a lot faster, but won't work with every find. It is safe
to use on Debian though because we use GNU findutils.
-- 
"See, I told you they'd listen to Reason," [SPOILER] Svfurlr fnlf,
fuhggvat qbja gur juveyvat tha.
Neal Stephenson in "Snow Crash"

Attachment: pgpYIcOIs3HD1.pgp
Description: PGP signature

Reply via email to