Unix find command, what are the {} and \; for?

后端 未结 5 979
慢半拍i
慢半拍i 2020-11-28 15:22

With this set of commands, what are the {} and \\; characters for?

find . -name \'*.clj\' -exec grep -r resources {} \\;
         


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-28 15:39

    The string {} in find 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?

提交回复
热议问题