简体   繁体   English

GNU 查找 -exec 命令 {}; vs -exec 命令 {} +

[英]GNU find -exec command {} ; vs -exec command {} +

Can anyone please explain the difference between the following two GNU find options for the -exec argument:谁能解释一下-exec参数的以下两个 GNU find选项之间的区别:

  1. find -exec command {} ;查找 -exec命令{} ;
  2. find -exec command {} +查找 -exec命令{} +

The man page does a good example of explaining that "one might prefer the -exec... + or better the -execdir... + syntax for performance and security reasons" but I can't seem to wrap my head around the basic premise of ;手册页做了一个很好的例子来解释“出于性能和安全原因,人们可能更喜欢-exec... +或更好的-execdir... +语法”,但我似乎无法理解基本的的前提 vs ++

Any help is welcome and appreciated!欢迎和赞赏任何帮助!

The ; ; syntax executes the command for each single match.语法为每个匹配项执行命令。 The + command runs the command with a long list of matches as arguments to the command. +命令运行带有一长串匹配项的命令,如 arguments 到命令。

For example:例如:

$ find
.
./a.txt
./b.png

$ find . -exec echo {} \;
.
./a.txt
./b.png

$ find . -exec echo {} +
. ./a.txt ./b.png

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM