We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 185660d commit 4e95b58Copy full SHA for 4e95b58
docs/expansion.md
@@ -601,13 +601,19 @@ $ shopt extglob
601
extglob on
602
```
603
604
+如果`extglob`参数是关闭的,可以用下面的命令打开。
605
+
606
+```bash
607
+$ shopt -s extglob
608
+```
609
610
量词语法有下面几个。
611
612
- `?(pattern-list)`:匹配零个或一个模式。
613
- `*(pattern-list)`:匹配零个或多个模式。
614
- `+(pattern-list)`:匹配一个或多个模式。
615
- `@(pattern-list)`:只匹配一个模式。
-- `!(pattern-list)`:匹配零个或一个以上的模式,但不匹配单独一个的模式。
616
+- `!(pattern-list)`:匹配给定模式以外的任何内容。
617
618
```bash
619
$ ls abc?(.)txt
@@ -637,6 +643,13 @@ abc.txt abc.txt.txt
637
643
638
644
上面例子中,`+(.txt)`匹配文件有一个或多个`.txt`后缀名。
639
645
646
647
+$ ls a?(b).txt
648
+a.txt abb.txt ac.txt
649
650
651
+上面例子中,`?(b)`表示匹配单个字母`b`以外的任意内容。
652
640
653
量词语法也属于文件名扩展,如果不存在可匹配的文件,就会原样输出。
641
654
642
655
0 commit comments