在 find 命令中,“{} +” 的作用是什么?最后是什么意思?
find -L / -samefile /path/to/file -exec ls -ld {} +
What does the {} +
mean?
Example from CommandLineFu
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是 find 命令语法的一部分。当为
find
指定在每次匹配时执行的子命令时,必须将{}
插入到参数列表中,以指示find
应将路径名放置在何处当前文件的。子命令以分号(加引号以避免被 shell 解析)或加号终止,后者指示find
应将{}
替换为尽可能多的内容尽可能一次指定路径名,而不是;
一次只指定一个路径名。That's part of the syntax of the
find
command. When givingfind
a subcommand to execute on each match, a{}
must be inserted into the argument list to indicate wherefind
should place the pathname of the current file. The subcommand is terminated by either a semicolon (quoted to avoid parsing by the shell) or by a plus sign, the latter indicating thatfind
should replace the{}
with as many pathnames at once as possible, in contrast to just one at a time for;
.这是
find
的-exec
选项的一部分;{}
扩展为当前文件名,+
(不可移植;应为\;
或';'
或类似)表示命令参数的结束。That's part of the
-exec
option tofind
;{}
expands to the current file name, and+
(nonportably; should be\;
or';'
or similar) indicates the end of the command arguments.