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
.. 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
.. in the list of matching files for the expression
mksh are such shells. If you like to test a shell, I recommend to call:
If the result is:
Your shell includes those paterns in the matching results, if you get:
your shell excludes
.. from the results. But be careful, since this result may also be caused by a filesystem does may not have
.. entries, so also check whether:
lists these files.
POSIX has been changed a while ago and now permits this behavior. Future
POSIX versions may disallow to include
.. 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.