+-

mount | awk'{print $3}’ – >装载点列表
find "list of mount points" -name "aaa" -print
如何将上一行的结果重定向到find命令作为搜索目录?
我想在一行中完成它:
mount |awk '{print $3}' | find "converting pipe result to a variable as directory" -name "aaa" -print
可以这样工作吗?
最佳答案
Possible to make it work this way?
是的,使用xargs:
mount |awk '{print $3}' | xargs -I {} find {} -name "aaa" -print
如果在xargs之后添加-P n以获得最多n个并发进程(这是GNU扩展),您甚至可以使它并行搜索您的硬盘驱动器.
点击查看更多相关文章
转载注明原文:linux – 在find命令中使用变量 - 乐贴网