簡體   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