在 Linux 中执行 ls 命令

Execution of ls command in Linux

不明白??*一起使用时的执行。

以下文件在当前工作目录中:

abc.txt
abcd.txt
bcd.txt
amm.doc
ammc.txt

执行命令ls a??.*后return的结果是什么

问号会翻译成任何一个字符,但 * 会翻译成多个字符。您的示例只会生成 abc.txt 和 amm.doc。如果您想了解更多信息,请查找 Shell Globbing。

 * Matches any string, including the null string (empty string)
 ? Matches any single character

举个例子

 Pattern a??.* matches abc.txt  

- (a,a)
- (?,b)
- (?,c)
- (.,.)
- (*,txt)

 Pattern a??.* don't matches abcd.txt

- (a,a)
- (?,b)
- (?,c)
- 但 。不要与 d

匹配
Pattern a??.* don't matches bcd.txt because a don't matches with b.