如在
find -L /etc/ssl/certs/ -type l -exec rm {} +
所以它find了所有破坏的符号链接并删除它们。 但是,我怎么解释{} +部分?
{}位是exec命令的占位符。 无论通过查找find的文件都插入到括号的位置。 +意味着build立一长串find的文件,并一次调用所有的exec,而不是一次一个,就像更传统的-exec {} \; 变种。
从man find :
-exec command {} + This variant of the -exec option runs the specified command on the selected files, but the command line is built by appending each selected file name at the end; the total number of invoca- tions of the command will be much less than the number of matched files. The command line is built in much the same way that xargs builds its command lines. Only one instance of '{}' is allowed within the command. The command is executed in the starting directory.
所以它会调用这个命令:
rm [filename1] [filename2] [...] [lastfilename]
如果有更多的文件可以放在参数列表中, rm将会被调用多次。 (这是xargs所做的)
如果没有{} + ,那么只会在没有参数的情况下调用rm 。