亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: AS 4 上的find 命令 [打印本頁]

作者: jils2013    時(shí)間: 2012-09-04 10:07
標(biāo)題: AS 4 上的find 命令
本帖最后由 jils2013 于 2012-09-04 11:58 編輯

昨天在一臺(tái)AS 4上的機(jī)器上跑一個(gè)腳本是報(bào)錯(cuò),具體是find 命令的;

在其他的系統(tǒng)find 可以這么寫一些命令,find xxx -exec xxx {} \+這種寫法,把查詢到的結(jié)果一次全部傳給后面的命令;
  1. find . -name "*.log" -exec grep 09-03 {} \+
復(fù)制代碼
但是在AS 4 上不支持\+的寫法,只支持\;的寫法,這種寫法只是傳遞一個(gè)給命令,后面的就不處理了;

現(xiàn)在手頭沒有AS 4 的系統(tǒng),可恥的伸手了;

AS 4下,如果希望傳所有參數(shù)給后面執(zhí)行的命令(比如tar grep之類的可以跟很多文件)即代替 \+的寫法,怎么寫?
作者: jils2013    時(shí)間: 2012-09-04 10:36
as4 很少嗎?還是我碰到那個(gè)系統(tǒng)有問題?
作者: rwx_hc    時(shí)間: 2012-09-04 11:42
find . -name "*.log" -exec grep 09-03 {} \;

是你的命令輸入有問題, *會(huì)被當(dāng)成文件通配符轉(zhuǎn)義
作者: jils2013    時(shí)間: 2012-09-04 12:00
本帖最后由 jils2013 于 2012-09-04 12:00 編輯

回復(fù) 3# rwx_hc


    寫錯(cuò)了,只是舉例子,帶了引號(hào)了;在AS 4上用\+不行,用\;可以;
    就是想問有沒有替代的寫法
作者: blackold    時(shí)間: 2012-09-04 12:23
回復(fù) 4# jils2013


    find ... | xargs ...
作者: jils2013    時(shí)間: 2012-09-04 13:00
blackold 發(fā)表于 2012-09-04 12:23
回復(fù) 4# jils2013
find x-exec 沒戲嗎?有強(qiáng)迫癥,不喜歡管道來處理,能不用就不用;
作者: rwx_hc    時(shí)間: 2012-09-04 13:12
find . -name "*.log" -exec grep 09-03 {} +
不要加\就OK了

  -exec command {} +
              This variant of the -exec option runs the specified command on the selected files, but the command line is built by  appending  each  selected  file
              name  at  the  end; the total number of invocations of the command will be much less than the number of matched files.  The command line is built in
              much the same way that xargs builds its command lines.  Only one instance of ’{}’ is allowed within the command.  The command  is  executed  in  the
              starting directory.

作者: blackold    時(shí)間: 2012-09-04 13:30
回復(fù) 6# jils2013


    那你就用 \; 或者安裝 gnu find。
作者: jils2013    時(shí)間: 2012-09-04 15:25
回復(fù) 8# blackold
換個(gè)系統(tǒng)就要糾結(jié)一下,唉,多謝了;


   
作者: jils2013    時(shí)間: 2012-09-04 15:26
回復(fù) 7# rwx_hc


    回頭找個(gè)系統(tǒng)試試,多謝了哈;




歡迎光臨 Chinaunix (http://www.72891.cn/) Powered by Discuz! X3.2