繁体   English   中英

linux用exec命令查找永无止境

[英]linux find with exec command never ends

这是我正在调用的命令:

find / -name zad1.sh -size -50M -mtime -1 -exec grep "do" {} \;

然后它回显了正确的两行:

do
done

但是,它继续做某事,并且永不停止。 我必须通过Ctrl + C手动终止该进程。 谁能告诉我这里发生了什么? PS Im是类Unix系统的新功能。(我在Cygwin上工作)

您必须添加-quit选项; 从联机帮助页:

-quit  Exit immediately.  No child processes will be left running,  but
          no  more  paths specified on the command line will be processed.
          For example, find /tmp/foo /tmp/bar -print -quit will print only
          /tmp/foo.   Any  command  lines  which  have  been built up with
          -execdir ... {} + will be invoked before find exits.   The  exit
          status may or may not be zero, depending on whether an error has
          already occurred.

附言 用“ do”更改“ do”; 双引号将字符串插入其中,而do是bash的关键字。

暂无
暂无

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

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