Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 8 down vote accepted

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

share|improve this answer
    
Ah that makes sense and could i add another argument after that? –  chrisjlee Feb 1 '12 at 16:27
4  
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 1 '12 at 16:35
    
Good comment by Peter.O :). See also related answer to Question on find -exec –  Tatjana Heuser Feb 1 '12 at 18:04
    
Thanks @Peter.O For confirming that. –  chrisjlee Feb 9 '12 at 6:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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