I'm working on a HP-UX system and I want to find if there are any circular symbolic links.
So far I'm using the command:
ls -lrt `find ./ -follow -type l`
But it's only doing ls -lrt on current directory as result.
What command should I use to find all circular symbolic links in a system?
GNU find's manpage says that all POSIX finds are supposed to detect filesystem loops and emit error messages in these cases, and I have tested
on GNU find, which was able to find loops of the form
./a -> ./b
and./b -> ./a
printing the error(this also worked on
a->b->c->a
)Likewise, loops of the form
./foo/x -> ..
and./foo/a -> ./bar
+./bar/b -> ./foo
printed the errorsIf you wanted to do something with the output other than read it, you would need to redirect it from stderr to stdout and pipe it to some script that can parse out the error messages.