I know how -h can detect a symlink, but I was wondering, is
there a way for bash to know where the symlink points (without
using an external program)?

Like if I'm running a script and check if something
is a symlink to a dir that isn't there, is there a way
to read the value of a symlink like a "read -h":

chk_val_bin_bash_lnk () {
 if ! [[ -f /bin/bash ]]; then
   if [[ -h /bin/bash ]]; then
     read -h target /bin/bash
     if [[ $target == /usr/bin/bash ]]; then
       /bin/mount /usr
       return 0
     fi
   fi
 fi
 return 1
}



Reply via email to