just how to glob every surprise documents other than existing and also parent directory site

I intend to glob every surprise documents and also directory site, yet not the existing (.) and also moms and dad directory site (..).

I am making use of bash.

Observe existing practices:

$ ls -a
.  ..  ...a  ...aa  ..a  ..aa  .a  .aa  .aaa  a
$ echo *
a
$ echo .*
. .. ...a ...aa ..a ..aa .a .aa .aaa

I would certainly such as .* to act similar to this

$ echo .*
...a ...aa ..a ..aa .a .aa .aaa

There is the shell alternative dotglob

$ shopt -s dotglob

that operates in a means; currently I can make use of * to glob every little thing (concealed or otherwise) yet not . and also ..

$ echo *
...a ...aa ..a ..aa .a .aa .aaa a

today I can not set apart in between surprise or otherwise. Additionally, .* still globs . and also ..

$ echo .*
. .. ...a ...aa ..a ..aa .a .aa .aaa

Exists a means to make .* not expand to . and also ..?

0
2019-05-05 21:31:19
Source Share
Answers: 3
ls -1a|egrep -v '^(\.|\.\.)$'
.
0
2019-05-08 11:06:23
Source

You can make use of the GLOBIGNORE variable to hide the . and also .. directory sites. This does instantly additionally set the dotglob alternative, so * currently matches both concealed and also non - surprise documents. You can once more by hand unset dotglob, however, this after that offers the actions you desire.

See this instance :

$ ls -a
.  ..  a  .a  ..a
$ GLOBIGNORE=".:.."
$ shopt -u dotglob
$ echo * # all (only non-hidden)
a
$ echo .* # all (only hidden)
.a ..a
0
2019-05-08 09:01:51
Source

Are you simply seeking documents? Are you in a placement to make use of find?

Something like (thinking GNU find) :

find . -mindepth 1 -maxdepth 1 -name ".*" -printf "%P\n"
0
2019-05-08 08:52:10
Source