Testing targets of link files > ln -s

Hi all

Ive been given the task to write a script that tests that certain link files work, i.e. the physical directory the link points too, is actually there.

Now, before I go down the route of ls -l | awk ...... or using test or find, is there a far more simpler command that I can use ?

Or, has anyone got a script that might help me out.

Great site by the way, often spent the odd hour or so going through messages as a guest, so decided to join :slight_smile:

Cheers

SBK - Sussex - UK

ls will show what the file is at the end of the symbolic link if you do:
$ ls -L ${FILENAME}

You could then capture the return code and respond accordingly:
RESULT=$?
if [ ${RESULT} -ne 0 ]; then
echo "We have a problem Houston, with ${FILENAME}."
fi

HTH

Tony Fuller

Cheers Tony,

Your a star. That really helped. :slight_smile:

SBK