12

I'm curious as to what the {} in the following command is actually for?

Example Command:

find /foo/ -name "*.txt" -exec rm -v {} \;

The Man page provided a small blurb but it confused me a little bit:

The string '{}' is replaced by the current file name being processed everywhere it occurs in the arguments to the command, not just in arguments where it is alone, as in some versions of find.

chrisjlee
  • 8,283
  • 16
  • 49
  • 54

1 Answers1

12

That's the symbol that gets replaced by the file name that find comes up with.

  • Ah that makes sense and could i add another argument after that? – chrisjlee Feb 01 '12 at 16:27
  • 6
    You can add whatever you like: it is just an argument. pretty much like `"$a-single-output-file-name"` when `-exec` ends with `\;` ... but it means `"$multiple"` `"$output"` `"$filenames"` when `-exec` ends with `\+` – Peter.O Feb 01 '12 at 16:35
  • Good comment by Peter.O :). See also related answer to [Question on find -exec](http://unix.stackexchange.com/questions/12902/how-to-run-find-exec) – Tatjana Heuser Feb 01 '12 at 18:04