The problem you are observing is a result that is caused by a hack from the early days of UNIX
in the early 1970s. In order to reduce the code size, a directory has been given real .
and ..
entries that ave been implemented as directory hard links to the current directory and the directory one level above. Modern filesystems have a different internal structure...
A nice way to deal with this problem is to select a shell that does not include .
and ..
in the list of matching files for the expression .*
.
bosh
and mksh
are such shells. If you like to test a shell, I recommend to call:
mkdir /tmp/t
cd /tmp/t
echo .*
If the result is:
. ..
Your shell includes those paterns in the matching results, if you get:
.*
your shell excludes .
and ..
from the results. But be careful, since this result may also be caused by a filesystem does may not have .
and ..
entries, so also check whether:
ls -Fa
lists these files.
POSIX
has been changed a while ago and now permits this behavior. Future POSIX
versions may disallow to include .
and ..
in the matching results, since a filesystem is not even required to physically support these directories. The only requirement from POSIX
is to implement the expected behavior when such a path is accessed.
.:..
.-a
instead of-A
.