removing/finding broken links? 

Newsgroups: comp.unix.shell
> > > Does anyone know if it's possible to do a search for broken sym.links and
> > > a remove of them after that?
> >
> > Try
> >
> > find . -type l ! -exec test -r {} \; -print
>
>Does it really work? I tried it and find that it lists all my links, not
>only the dead links...

It works for me. Leaving out '! -exec test -r {} \;' causes it to print all links.

What it actually tests for is not having read permission to the file that the link points to. So if you have links to non-readable files, they'll be listed as well. You could try using -f instead of -r, but that will cause links to directories to be listed.

Barry Margolin

removing/finding broken links? 

Tapani had said

in some shells you need to escape '!'

have to escape it under bash, no need in sh