I've got a script to recursively create symlinks in my home directory to my settings directory, to keep the files under version control. I would like it to skip files which are already symlinked via a parent directory. That is, if I have these files/directories:
~/foo/ -> ~/settings/foo/ ~/settings/foo/ ~/settings/foo/bar
, how do I check that ~/foo/bar and ~/settings/foo/bar are the same file?
Edit: D'oh, another few minutes of searching revealed the answer:
readlink -f $path