sh# find . -type f \( -path ./docbook \) -prune -o -print | grep 'docbook'这里没有起到需要的效果,即排除 ./docbook 目录及其所有子文件。但如果使用:
./blfs-book-6.1-html/pst/docbook-utils.html
./blfs-book-6.1-html/pst/docbook-dsssl.html
./blfs-book-6.1-html/pst/docbook-xsl.html
./docbook
./docbook/index.xml
sh# find . \( -path ./docbook \) -prune -o -print -type f | grep 'docbook'则可以。这其实应该也是和 -o(OR) -a(AND) 运算的顺序一致的(-print -type f 相当于 -print -a -type f)。
./blfs-book-6.1-html/pst/docbook-utils.html
./blfs-book-6.1-html/pst/docbook-dsssl.html
./blfs-book-6.1-html/pst/docbook-xsl.html
再看对时间戳的操作:
sh# ls ts -l可以看到 -cnewer ts 的位置会有影响,如果放在最后就完全没有效果!
-rw-r--r-- 1 root root 0 2007-01-01 00:00 ts
sh# ls blfs-book-6.1-html/pst/docbook-* -l
-rw-r--r-- 1 roc roc 11619 2005-08-21 05:14 blfs-book-6.1-html/pst/docbook-dsssl.html
-rw-r--r-- 1 roc roc 13821 2005-08-21 05:14 blfs-book-6.1-html/pst/docbook-utils.html
-rw-r--r-- 1 roc roc 11979 2005-08-21 05:14 blfs-book-6.1-html/pst/docbook-xsl.html
sh# find . \( -path ./docbook \) -prune -o -type f -print | grep 'docbook'
./blfs-book-6.1-html/pst/docbook-utils.html
./blfs-book-6.1-html/pst/docbook-dsssl.html
./blfs-book-6.1-html/pst/docbook-xsl.html
sh# find . \( -path ./docbook \) -prune -o -type f -print -cnewer ts | grep 'docbook'
./blfs-book-6.1-html/pst/docbook-utils.html
./blfs-book-6.1-html/pst/docbook-dsssl.html
./blfs-book-6.1-html/pst/docbook-xsl.html
sh# find . \( -path ./docbook \) -prune -o -cnewer ts -type f -print | grep 'docbook'
没有评论:
发表评论