I understand that the wildcard *
(by itself) will expand in such a way that it means "all non-hidden files in the current folder" with hidden files being those prefixed by a period.
There are two use cases that I would think are useful, but I don't know how to properly do:
How can you glob for... "All files in the current folder, including hidden files, but not including .
or ..
"?
How can you glob for... "All hidden files (and only hidden files) in the current folder, but not including .
or ..
"?
To expand on paviums answer and answer the second part of your question, all files except .
and ..
could be specified like this:
{.[!.]*,*}
Depending on your exact use case it might be better to set the dotglob
shell option, so that bash includes dotfiles in expansions of *
by default:
$ shopt -s dotglob
$ echo *
.tst
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