find查找也会有遗漏吗

不吃天鹅肉 2020-09-15 05:36:32
如题,,搞不懂,求大佬指教
...全文
35646 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
ღSugar 2020-11-03
  • 打赏
  • 举报
回复
引用 4 楼 weixin_45621200的回复:
[quote=引用 1 楼 ღSugar的回复:]正则表达式精准匹配最好加个‘’。即 ‘*.sh’
感谢,后来才知道[/quote] 我也是渣渣。这后面的大神贴的英文我都看不懂
不吃天鹅肉 2020-10-30
  • 打赏
  • 举报
回复
引用 1 楼 ღSugar的回复:
正则表达式精准匹配最好加个‘’。即 ‘*.sh’
感谢,后来才知道
不吃天鹅肉 2020-10-30
  • 打赏
  • 举报
回复
引用 2 楼 alittlenewbiek的回复:
看最后一行。
引用
-name pattern
Base of file name (the path with the leading directories removed) matches shell pattern pattern. Because the leading
directories are removed, the file names considered for a match with -name will never include a slash, so `-name a/b'
will never match anything (you probably need to use -path instead). A warning is issued if you try to do this, unless
the environment variable POSIXLY_CORRECT is set. The metacharacters (`*', `?', and `[]') match a `.' at the start of
the base name (this is a change in findutils-4.2.2; see section STANDARDS CONFORMANCE below). To ignore a directory
and the files under it, use -prune; see an example in the description of -path. Braces are not recognised as being
special, despite the fact that some shells including Bash imbue braces with a special meaning in shell patterns. The
filename matching is performed with the use of the fnmatch(3) library function. Don't forget to enclose the pattern
in quotes in order to protect it from expansion by the shell.

确实是要加引号,单双都可。-name并非正则,只是wildcard pattern。
感谢,后来才知道,,
alittlenewbiek 2020-09-17
  • 打赏
  • 举报
回复
看最后一行。
引用
-name pattern
Base of file name (the path with the leading directories removed) matches shell pattern pattern. Because the leading
directories are removed, the file names considered for a match with -name will never include a slash, so `-name a/b'
will never match anything (you probably need to use -path instead). A warning is issued if you try to do this, unless
the environment variable POSIXLY_CORRECT is set. The metacharacters (`*', `?', and `[]') match a `.' at the start of
the base name (this is a change in findutils-4.2.2; see section STANDARDS CONFORMANCE below). To ignore a directory
and the files under it, use -prune; see an example in the description of -path. Braces are not recognised as being
special, despite the fact that some shells including Bash imbue braces with a special meaning in shell patterns. The
filename matching is performed with the use of the fnmatch(3) library function. Don't forget to enclose the pattern
in quotes in order to protect it from expansion by the shell.

确实是要加引号,单双都可。-name并非正则,只是wildcard pattern。
ღSugar 2020-09-16
  • 打赏
  • 举报
回复
正则表达式精准匹配最好加个‘’。即 ‘*.sh’

18,825

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 专题技术讨论区
社区管理员
  • 专题技术讨论区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧