#!/bin/bash # # find symbolic links in the current directory # (version mostly from previous year's class showing multiple approaches) # for link in `find . -type l` do # target=`readlink $link` # if [ ! -e $target ] # then # echo "broken link $link (target $target)" # fi # target=`readlink -e $link` # if [ $? -ne 0 ] # then # echo "broken link $link (target $target)" # fi target=`readlink -e $link` if [ -z "$target" ] then echo "broken link $link (target `readlink $link`)" fi done