使用bash通配符定位行为 [英] locate behavior with bash wildcards

查看:44
本文介绍了使用bash通配符定位行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有

$ ls -l re*trict
ls: cannot access re*trict: No such file or directory

为什么会给出0个匹配项?

Why does this give 0 matches?

$ locate -c 're*trict'
0
$ locate -c re*trict
0
$ locate -c re?trict
0

尽管可以,但可以进行8351次匹配:

This works though and gives 8351 matches:

$ locate -c restrict
8351

推荐答案

locate 与完整路径名匹配.要找到 re * trict 作为子字符串,您必须在其前后添加 * :

locate matches against the full path name. To find re*trict as a substring, you have to add * before and after it:

locate '*re*trict*'

这篇关于使用bash通配符定位行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆