fish shell: "shopt -s dotglob" analog
This is intentional. Most of time the users don't want to accidentally match the hidden files that are invisible for ls
(without -a
). Usually, files are hidden for a reason, not just to troll you. Also, if *
would match hidden files, matching non hidden files would be too tricky.
However, unlike bash shopt -s dotglob
is not needed to match hidden files. In bash, shopt -s dotglob
is the only way of matching every file in the directory without accidentally matching .
or ..
. However, fish shell can never match .
or ..
with globs, therefore that's not an issue (if you seriously need to match .
or ..
for some silly reason, just say them explicitly). Besides, fish tries to avoid having options by design, so it doesn't have dotglob
.
To match every single file in the directory, you may want to use bracket expansion to detect files starting with dots, and those which aren't. {.,}
is bracket expansion which matches dot that may or may not exist. The star after it matches everything. Because globs in fish cannot match .
or ..
, the following code matches everything except for those two directories (which bash sadly matches, if you use the code below)
cat {.,}*