The find command seems to differ from other Unix commands.
Why is there the empty curly brackets and a backward flash at the end of the following command?
find * -perm 777 -exec chmod 770 {} \;
I found one reason for the curly brackets but not for the backward flash.
The curly brackets are apparently for the path
Same as -exec, except that ``{}'' is replaced with as many pathnames as possible for each invocation of utility
The (escaped) semicolon is needed so that "find" can tell where the arguments to the exec'd program end (if there are any) and additional arguments to "find" begin.
I'd recommend that you instead do that as
"xargs" says to take the results of the find and feed it 20 at a time to the following command.
The string
{}
infind
is replaced by the pathname of the current file.The semicolon is used for terminating the shell command invoked by
find
utility.It needs to be escaped, or quoted, so it won't be interpreted by the shell, because
;
is one of the special characters used by shell (list operators).See also: Why are the backslash and semicolon required with the find command's -exec option?
The -exec command may be followed by any number of arguments that make up the command that is to be executed for each file found. There needs to be some way to identify the last argument. This is what \; does. Note that other things may follow after the -exec switch:
(This finds all c-files and python files in the euler directory.)
The reason that exec does not require the full command to be inside quotes, is that this would require escaping a lot of quotes inside the command, in most circumstances.