Shell/bash 中的模式和正则表达式
Patterns and Regular Expressions in Shell/bash
命令 ls @(*xx|*AK) bash
@ 符号的目的是什么? | 是什么意思?做?
来自 man bash
,在 "Pathname Expansion" 下:
@(pattern-list)
Matches one of the given patterns
a pattern-list is a list of one or more patterns separated by a |.
这不是正则表达式。它是 Bash 的 扩展 glob 模式 。有关详细信息,请参阅 Bash 手册中的 Pattern Matching。
默认情况下,扩展 glob 模式 支持未启用。要启用它,运行 shopt -s extglob
。有关 shopt
命令的更多详细信息,请参阅 The shopt Builtin。
命令 ls @(*xx|*AK) bash @ 符号的目的是什么? | 是什么意思?做?
来自 man bash
,在 "Pathname Expansion" 下:
@(pattern-list)
Matches one of the given patterns
a pattern-list is a list of one or more patterns separated by a |.
这不是正则表达式。它是 Bash 的 扩展 glob 模式 。有关详细信息,请参阅 Bash 手册中的 Pattern Matching。
默认情况下,扩展 glob 模式 支持未启用。要启用它,运行 shopt -s extglob
。有关 shopt
命令的更多详细信息,请参阅 The shopt Builtin。