7

I'm curious as to why find uses {} as the syntax for variable substitution (e.g., as in find . -name "*~" -exec rm {} \;). It's a rather unusual syntax, and I don't know any other programs or languages that use {} as a placeholder.

2
  • xargs also uses it, but that might be a more recent addition. What other programs use placeholders?
    – jordanm
    Oct 25 '13 at 19:09
  • @jordanm as far as I know, xargs does not use it, it is just the standard value for the xargs -I option but that is just convention, the man page does not indicate that {} is reserved, it just uses it as an example.
    – terdon
    Oct 26 '13 at 20:38
10

I think the answer is in your question. Other commands don't use {} as a placeholder. That way you can still use find's -exec option without having to worry about a bunch of nonsense to escape or work around the fact that a command uses {} just like find does.

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.