最佳答案
我怎么能让xargs执行命令准确地为每一行输入给定? 它的默认行为是将行分块并执行一次命令,将多行传递给每个实例。< / p >
从http://en.wikipedia.org/wiki/Xargs:
查找/path -type f -print0 | xargs -0 rm
在本例中,find为xargs的输入提供一长串文件名。然后Xargs将这个列表拆分为子列表,并对每个子列表调用rm一次。这比功能等效的版本更有效:
查找/path -type f -exec rm '{}' \;
我知道那个发现有"执行"的标志。我只是从另一种资源中引用了一个说明性的例子。