2

I'm using bash on Debian. I have to write

find -iname "*mp3" -exec cp {}  /media/MP3Player/ \;

escaping the final semicolon, or else I get an error.

9

You have to escape the semicolon so that your current shell doesn't see it and use it as a command separator before find gets to see it and use it to terminate the command you're sending to -exec.

Also, the manual does state in relevant part:

-exec utility [argument ...] ;

[...]

The expression must be terminated by a semi- colon (;). If you invoke find from a shell you may need to quote the semicolon if the shell would otherwise treat it as a control operator.

n. b. quickly searching my find manual shows examples of the \; syntax.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.