Sorry, I know I'm dumb in most things (and slow also, :D), but I
wouldn't go that far as to call someone a dumb/donkey person. Besides,
my portrait is indeed not ideal, but it's the best I have for now. :)

So, regarding the incident: Perhaps I know what happened... Although I'm
not sure how your .bashrc got into the mess...

The issue is that, when xargs receives the path names, the spaces are,
by default, field separators. E.g.:

find -name "*copyright.markdown"

... would find the following paths, starting from my home directory:

./Público/Vídeos/Direito autoral e copyright.markdown
./Público/Documentos/Direito autoral e copyright.markdown

Since xargs understands spaces as field separators, and since find
doesn't put quotes every time it prints a path, then if we would pass it
to xargs, it would understand the following:

"./Público/Vídeos/Direito" "autoral" "e" "copyright.markdown"
"./Público/Documentos/Direito" "autoral" "e" "copyright.markdown"

What we could have done is:

while read -r each_path; do
  rm -rf "$each_path"
done <<PATH_LIST
$(find -name "*copyright.markdown")
PATH_LIST

Or, we could do (less secure):

find -name "*copyright.markdown" -execdir rm -rf {} +

Or (even less secure):

find -name "*copyright.markdown" -exec rm -rf {} +

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to