Dan*_*rra 5 command-line bash wildcards
我正在学习通过 WSL 在 Ubuntu 上使用终端。现在我正在练习通配符,但是?
通配符对我不起作用。
正如您所看到的,*
通配符有效,但这个无效:
$ ls file*
file.html file.js file.txt
$ ls dot*
dot.txt dot1902.html dot2.txt
$ ls *.html
archivoPruebaClase.html dot1902.html file.html
$ ls dot?
ls: cannot access 'dot?': No such file or directory
$ ls index?
ls: cannot access 'index?': No such file or directory
Run Code Online (Sandbox Code Playgroud)
Wil*_*ill 14
我认为它工作得很好:
\nA*
将被替换为命令行上任意数量的字符。
A?
将被恰好替换为一个字符。
因此,例如ls dot?.txt
将显示dot1.txt
、dot2.txt
等,但它不会\xe2\x80\x99t 例如显示dot10.txt
。
尝试ls -a
列出该文件夹中的所有文件/文件夹,然后您可以计算出应使用通配符列出的内容。