linux的find和作用,linux – find中的-prune选项有什么作用?

尝试

find * -maxdepth 0 -name "efence*" -prune -o -print

如果没有指定其他选项,则prune选项会打印匹配文件(但是仍然会阻止find递归到匹配的目录中).

编辑添加说明:

查找表达式区分测试和操作.从男人发现:

The expression is made up of options (which affect overall operation

rather than the processing of a specific file, and always return true),

tests (which return a true or false value), and actions (which have

side effects and return a true or false value), all separated by operators. -and is assumed where the operator is omitted.

If the expression contains no actions other than -prune, -print is performed on all files for which the expression is true. [my emphasis]

所以-prune是一个具有副作用的动作,它不会递归到与前面测试相匹配的子目录(在你的例子中,-maxdepth 0 -name“efence *”).但就表达式的真值而言,它只相当于拥有

find * -maxdepth 0 -name "efence*" -true

并且由于您没有指定任何其他操作,因此假定-print(此假设始终存在,因为它允许您键入例如find.-name“* .java”而不是find.-name“* .java”-print ).

希望有道理.在the other thread接受的答案谈到了同样的事情.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值