通配符 说白了就是shell中用于匹配文件名。
1、星号(*) 匹配任意长度的字符串
root@ubuntu:~/test$ ls *.c
1.c 2.c 3.c guo_1.c guo_2.c guo_3.c guo_a.c guo_b.c guo_c.c
2、问号(?) 匹配一个长度的字符串
root@ubuntu:~/test$ ls guo_?.c
guo_1.c guo_2.c guo_3.c guo_a.c guo_b.c guo_c.c
root@ubuntu:~/test$ ls ?.c
1.c 2.c 3.c
3、方括号([...]) 匹配其中指定的一个字符
root@ubuntu:~/test$ ls guo_[123].c
guo_1.c guo_2.c guo_3.c
root@ubuntu:~/test$ ls guo_[12].c
guo_1.c guo_2.c
root@ubuntu:~/test$ ls guo_[1].c
guo_1.c
4、方括号([-]) 匹配指定的一个字符范围
root@ubuntu:~/test$ ls guo_[1-3].c
guo_1.c guo_2.c guo_3.c
root@ubuntu:~/test$ ls guo_[a-c].c
guo_a.c guo_b.c guo_c.c
5、方括号([^..]) 除了其中指定的字符,均可匹配
root@ubuntu:~/test$ ls guo_[^12].c
guo_3.c guo_a.c guo_b.c guo_c.c
root@ubuntu:~/test$ ls guo_[^a-c].c
guo_1.c guo_2.c guo_3.c