I don't think this is what the OP is asking for.
Under *nix, if I do ln foo.txt bar.txt, then I have two directory entries pointing to the same physical file. The inode for this file is identical. Two different directory entries, one physical file.
Your example checks to see if the ending of the files passes through the same part of the directory tree. One physical file, one directory entry (at least for the final part of the path).
Now, if realpath would identify that foo.txt and bar.txt point to the same inode, then it would be identical. As it stands, it is not.
Still a useful solution, however, to a different problem.
--MidLifeXis
In reply to Re^2: Testing if two paths point to the same file.
by MidLifeXis
in thread Testing if two paths point to the same file.
by JavaFan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |