There are some files which names start with '-', such as '-1.png', '-2.png'. I can't operate them with wildcard, because those names are regarded as options:
bash-3.2$ ls *.png
ls: illegal option -- .
usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]
bash-3.2$ rm *.png
rm: illegal option -- 1
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
How to solve this problem?
Either use
ls -- *.png
or
ls ./*.png
The double dash is a common option in GNU tools to signify the end of options: any subsequent words starting with dash is a plain argument.
rm
works the same way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With