wangdoc/bash-tutorial

Bash 的模式扩展 --> 4 * 字符扩展 --> 匹配隐藏文件

liyongjun123 opened this issue · 1 comments

我执行命令的时候,发现 * 可以匹配隐藏文件,如下

ubuntu server 18.04,bash 4.4.20

liyongjun@box:~/tmp$ la
a  .a  abc
liyongjun@box:~/tmp$ echo .*
. .. .a

centos 7,bash 4.2.46

[centli@VM_0_14_centos tmp]$ la
.a  a.txt
[centli@VM_0_14_centos tmp]$ echo .*
. .. .a

示例代码中有注释说了 .*是可以匹配隐藏文件的(虽然准确地说是.开头的)

# 显示所有隐藏文件
$ echo .*

单纯的*是不能匹配隐藏文件的,教程说得没毛病。