[英]I don't understand the meaning of ls [aDt]*t?t
Probably a quick and easy one for you guys but I can't actually find an answer anywhere.对你们来说可能是一个快速而简单的问题,但我实际上无法在任何地方找到答案。
What does this mean?这是什么意思? Break it down for me, please?请给我分解一下好吗?
The naswer is simple:纳斯维尔很简单:
[aDt]
: the character a
or D
or t
. [aDt]
:字符a
或D
或t
。*
: zero or more (any) characters. *
:零个或多个(任何)字符。.
: the dot. : 点。t
: the t
character. t
: t
字符。?
: any (single) character. :任何(单个)字符。t
: the t
character. t
: t
字符。"[aDt]*.t?t" is an expression of the "shell expansion" (there are several types, this one is "pattern matching"). “[aDt]*.t?t”是“shell扩展”的一种表达方式(有几种,这一种是“模式匹配”)。
This expansions use wildcard-type items to match not only a single name, but multiple.此扩展使用通配符类型的项目不仅匹配单个名称,而且匹配多个。
In the case of ls command (your question, but the same applies to any command), it will list all the files having a matching name, but not other files.对于 ls 命令(您的问题,但同样适用于任何命令),它将列出具有匹配名称的所有文件,但不列出其他文件。
[aDt] matches any of the character "a", "D", "t"
* matches any number (even zero) of any character
? matches any single character
This expression can match, for example这个表达式可以匹配,例如
D-data.txt
a-what.tNt
t.tst
but not但不是
mega.txt (first letter is not a, D or t)
ciao.TXT (the uppercase T of TXT do not match)
ciaotxt (does not contain a dot)
This is only a partial reply, things are much more complicated.这只是部分回复,事情要复杂得多。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.