3

I found examples of different quoting for curly braces for find, but I could not find an explanation. The possible choices are:
1. {}
2. '{}'
3. "{}"
And they all seem to work fine. Is there a difference between them?

  • A duplicate as noted, but this page is nice and simple. – Merlin Jul 30 at 18:15
4

The quoting would only be required if {} was interpreted by the shell. No modern shell (that I am aware of) interprets {} any way other than literally. In bash and ksh93, {} indicates a brace expansion, but since {} is an empty brace expansion, it isn't interpreted. In POSIX shell, it has no meaning, and so is also literal. I am not aware of it having any special meaning in the original Bourne shell, either.

Most likely this quoting is just people being cautious, and assuming { or } (or the two combined) may be interpreted as metacharacters by certain shells. In practise, I can't think of any shells that assign special meaning to it.

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