Tuesday, August 3, 2010

find的and和or

給未來的裕翔

這篇不是解答而是疑問

預設來講

find的每個expression是以and連接

需要or的話

可以-or或是-o

(補充, 需要not的話,可以-not或是 !)

今天我遇到一個問題

找出/底下owner非root, bin的檔案

find / -not -user root -not -user  bin -ls 2> /dev/null

一開始我想錯了, 打成

find / -not -user root -or -not -user  bin -ls 2> /dev/null

事後想想, 雖然想錯, 不過這指令應該print出更多結果才對阿!?

居然沒有, 而且結果似乎是錯的? 跟我想的完全不一樣!

有請未來的裕翔開導我^^

No comments:

Post a Comment