bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

?maybe? RFE?... read -h <symlink>?


From: L A Walsh
Subject: ?maybe? RFE?... read -h <symlink>?
Date: Sat, 04 Sep 2021 16:18:09 -0700
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)

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

[Prev in Thread] Current Thread [Next in Thread]