'find'(命令)找不到-wholename [英] 'find' (command) finds nothing with -wholename
本文介绍了'find'(命令)找不到-wholename的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此命令为什么起作用:
/home/user1/tmp $ find ./../.. -wholename '.*/tmp/file.c' -exec echo '{}' \;
./../../user2/tmp/file.c
/home/user1/tmp $
此命令不起作用? (什么也没找到)
And this command does not work? (finds nothing)
/home/user1/tmp $ find /home -wholename '.*/tmp/file.c' -exec echo '{}' \;
/home/user1/tmp $
推荐答案
第一个命令生成以 ./../ ..
开头的文件名。因此,全名模式将匹配,因为它们以开头。
。
The first command generates file names starting with ./../..
. Thus the wholename pattern will match because they start with .
.
第二条命令生成以<$ c开头的文件名$ c> / home 。但是,全名模式仍在寻找以开头的路径。
在这种情况下将不匹配任何文件。
The second command generates filenames starting with /home
. However, the wholename pattern is still looking for paths starting with .
which will not match any file in this case.
请注意,模式不是不是正则表达式。如果您期望它们,请改用 -regex
选项。
Note that patterns are not regular expressions. If you were expecting them, look at the -regex
option instead.
这篇关于'find'(命令)找不到-wholename的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文