find默认动作和-print找出的文件数不一致?

sh/bash/dash/ksh/zsh等Shell脚本
回复
头像
justinux
帖子: 80
注册时间: 2008-10-10 21:32

find默认动作和-print找出的文件数不一致?

#1

帖子 justinux » 2009-05-22 20:51

在我的music目录里找文件,前后两个find就差一个-print,计数结果却不同。显然,有-print的find少找到了很多文件。
find的默认动作不就是-print吗?
为什么,为什么,为什么? :em20

代码: 全选

$ find . -type f -name "*.mp3" -o -name "*.ape" -o -name "*.cue" -print | wc -l
$ 45

代码: 全选

$ find . -type f -name "*.mp3" -o -name "*.ape" -o -name "*.cue" | wc -l
$ 643
CPU: AMD Barton 2600+
主板: EPOX 8RDA3+
内存: Kingstone DDR400 512MB x 2
显卡: R9550(128MB)
硬盘: Seagate 250GB
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ubuntu 10.04
Opera 10
头像
bones7456
帖子: 8495
注册时间: 2006-04-12 20:05
来自: 杭州
联系:

Re: find默认动作和-print找出的文件数不一致?

#2

帖子 bones7456 » 2009-05-22 21:31

试试

代码: 全选

find . -type f \( -name "*.mp3" -o -name "*.ape" -o -name "*.cue" \) -print
关注我的blog: ε==3
头像
justinux
帖子: 80
注册时间: 2008-10-10 21:32

Re: find默认动作和-print找出的文件数不一致?

#3

帖子 justinux » 2009-05-23 13:12

原来如此。多谢!
:em03
上次由 justinux 在 2009-05-23 13:13,总共编辑 1 次。
CPU: AMD Barton 2600+
主板: EPOX 8RDA3+
内存: Kingstone DDR400 512MB x 2
显卡: R9550(128MB)
硬盘: Seagate 250GB
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ubuntu 10.04
Opera 10
回复