[英]linux find with exec command never ends
This is the command i am invoking: 这是我正在调用的命令:
find / -name zad1.sh -size -50M -mtime -1 -exec grep "do" {} \;
Then it echo's two lines which are correct: 然后它回显了正确的两行:
do
done
But then, it continues doing something and never stops. 但是,它继续做某事,并且永不停止。 I have to kill the process manually doing Ctrl+C. 我必须通过Ctrl + C手动终止该进程。 Can anyone explain to me what happenned here? 谁能告诉我这里发生了什么? PS Im new to Unix-like systems.(im working on Cygwin) PS Im是类Unix系统的新功能。(我在Cygwin上工作)
You have to add -quit option; 您必须添加-quit选项; from the manpage: 从联机帮助页:
-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.
Ps. 附言 change the "do" with 'do' ; 用“ do”更改“ do”; double quotes interpolates the string within and do is a keyword for bash. 双引号将字符串插入其中,而do是bash的关键字。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.