I want to glob every hidden file and directory, but not the current (.) and parent directory (..).
I am using bash.
Observe current behaviour:
$ ls -a
. .. ...a ...aa ..a ..aa .a .aa .aaa a
$ echo *
a
$ echo .*
. .. ...a ...aa ..a ..aa .a .aa .aaa
I would like .* to behave like this
$ echo .*
...a ...aa ..a ..aa .a .aa .aaa
There is the shell option dotglob
$ shopt -s dotglob
that works in a way; now I can use * to glob everything (hidden or not) but not . and ..
$ echo *
...a ...aa ..a ..aa .a .aa .aaa a
but now I can't differentiate between hidden or not. Also, .* still globs . and ..
$ echo .*
. .. ...a ...aa ..a ..aa .a .aa .aaa
Is there a way to make .* not expand to . and ..?