So, I'm trying to understand the following syntax which seems contradictory to me:
linkchk () {
for element in $1/*; do
[ -h "$element" -a ! -e "$element" ] && echo "$element"
[ -d "$element" ] && linkchk $element
# Of course, '-h' tests for symbolic link, '-d' for directory.
done
Doesn't -a and -e mean the same thing? It seems as though it were saying that $element should and should not exist at the same time.
source:
http://tldp.org/LDP/abs/html/