仅查找以 .whl 结尾的文件

yae*_*ael 0 ls bash wildcards

我正在尝试.whl按以下方式捕获所有文件

ls -l  /python/*.{whl,}
ls: cannot access /python/*.: No such file or directory
-rw-r--r-- 1 root root   23000 Jun 14 11:02 /python/argparse-1.4.0-py2.py3-none-any.whl
-rw-r--r-- 1 root root  154423 Jun 14 11:02 /python/certifi-2019.9.11-py2.py3-none-any.whl
-rw-r--r-- 1 root root  387834 Jun 14 11:02 /python/cffi-1.14.0-cp27-cp27mu-manylinux1_x86_64.whl
-rw-r--r-- 1 root root  133356 Jun 14 11:02 /python/chardet-3.0.4-py2.py3-none-any.whl
-rw-r--r-- 1 root root 2728298 Jun 14 11:02 /python/cryptography-2.9.2-cp27-cp27mu-manylinux1_x86_64.whl
-rw-r--r-- 1 root root   11223 Jun 14 11:02 /python/enum34-1.1.10-py2-none-any.whl
-rw-r--r-- 1 root root   58594 Jun 14 11:02 /python/idna-2.8-py2.py3-none-any.whl
-rw-r--r-- 1 root root   18159 Jun 14 11:02 /python/ipaddress-1.0.23-py2.py3-none-any.whl
-rw-r--r-- 1 root root  125774 Jun 14 11:02 /python/Jinja2-2.11.2-py2.py3-none-any.whl
Run Code Online (Sandbox Code Playgroud)

但正如你所看到的,我们也得到了—— ls: cannot access /python/*.: No such file or directory

如何解决这个问题,以便只找到以 .whl

Ste*_*itt 10

如果您只对带有whl扩展名的文件感兴趣,

ls -l /python/*.whl
Run Code Online (Sandbox Code Playgroud)

是你所追求的。

您当前的命令,

ls -l  /python/*.{whl,}
Run Code Online (Sandbox Code Playgroud)

相当于

ls -l /python/*.whl /python/*.
Run Code Online (Sandbox Code Playgroud)

(感谢大括号扩展)并失败,因为后一种模式与/python.