3

I often see xargs -I {} or xargs -I % (less). Is there any reason why those two are commonly used? Why is {}, as longer and more likely to be bad-interpreted, preferred?

3

{} is also seen in find, and python. % has a long historical tradition in printf-family commands in most programming languages, but mostly as a prefix to sequences like %s or %d, so it's not the first thought to use it alone.

There is also a simpler reason. The -i switch that is now deprecated, implied {} if you didn't specify a different one. It appears that the original developers used this form (quite possibly inspired by find), and shipped a default setting and a rich series of example uses in tutorials that use {}. The rest of the users simply propagated this choice.

0

This answers the question why (kind of):

"{}" is common because xargs stems from the same family as find, and find uses "{}" for exec and exedir.

Why find uses "{}" I don't know, though. :)

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.