Skip to content

Commit 4e95b58

Browse files
committed
docs(expasion): edit ?(pattern-list)
1 parent 185660d commit 4e95b58

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

docs/expansion.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,13 +601,19 @@ $ shopt extglob
601601
extglob on
602602
```
603603
604+
如果`extglob`参数是关闭的,可以用下面的命令打开。
605+
606+
```bash
607+
$ shopt -s extglob
608+
```
609+
604610
量词语法有下面几个。
605611
606612
- `?(pattern-list)`:匹配零个或一个模式。
607613
- `*(pattern-list)`:匹配零个或多个模式。
608614
- `+(pattern-list)`:匹配一个或多个模式。
609615
- `@(pattern-list)`:只匹配一个模式。
610-
- `!(pattern-list)`匹配零个或一个以上的模式,但不匹配单独一个的模式
616+
- `!(pattern-list)`匹配给定模式以外的任何内容
611617
612618
```bash
613619
$ ls abc?(.)txt
@@ -637,6 +643,13 @@ abc.txt abc.txt.txt
637643
638644
上面例子中,`+(.txt)`匹配文件有一个或多个`.txt`后缀名。
639645
646+
```bash
647+
$ ls a?(b).txt
648+
a.txt abb.txt ac.txt
649+
```
650+
651+
上面例子中,`?(b)`表示匹配单个字母`b`以外的任意内容。
652+
640653
量词语法也属于文件名扩展,如果不存在可匹配的文件,就会原样输出。
641654
642655
```bash

0 commit comments

Comments
 (0)