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?

Chris Down
  • 125,559
  • 25
  • 270
  • 266
Forethinker
  • 1,399

1 Answers1

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.

Chris Down
  • 125,559
  • 25
  • 270
  • 266