Find is able to execute one or more commands for each file it has found with the -exec option. Unfortunately, one cannot simply enter the command. You need to remember two syntactic tricks:
- The command that you want to execute need to contain a special macro argument {}, which will be replaced by the matched filename on each invocation of -exec predicate.
- You need to specify \; (or ';' ) at the end of the command. (If the \ is left out, the shell will interpret the ; as the end of the find command.) . For example, the following two commands are equivalent:
find . -name "*rc.conf" -exec chmod o+r {} \;
find . -name "*rc.conf" -exec chmod o+r '{} ;'
-----------------------------------------------------
Silence, the way to avoid many problems;
Smile, the way to solve many problems;