
0:root@SERVER:/tmp # find /tmp/foo* -mtime +74 -ls | wc -l
1330
0:root@SERVER:/tmp # find /tmp/foo* -ls -mtime +74 | wc -l
1750
0:root@SERVER:/tmp # oslevel -s
6100-09-04-1441
0:root@SERVER:/tmp # uname
AIX
0:root@SERVER:/tmp #
質問:findが同じ出力を提供しないのはなぜですか?
答え1
-ls
オペランドを使ったのでfind
すぐに true を返し、現在のパス名を印刷するので、デフォルトは cancelled-print
で、それ以降は操作がなく、-mtime +74
効果もありません。
-ls Always evaluates to the value True. Causes the current path name
to be printed together with its associated statistics
これにより:
find . -ls -mtime +74 -print
その後、両方のオペランドの結果から集計を取得できます。