On Sun, Sep 5, 2021, at 11:11 PM, Dale R. Worley wrote: > L A Walsh <b...@tlinx.org> writes: > > 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)? > > My understanding is that it has been convention to use the "readlink" > program for a very long time, so there's never been much demand to add > it to bash. Of course, looking at the options to readlink shows that > there are several different meanings of "where a symlink points".
The distribution ships with a "realpath" loadable builtin, FWIW. bash-5.1$ enable -f /opt/local/lib/bash/realpath realpath bash-5.1$ type realpath realpath is a shell builtin bash-5.1$ readlink /usr/bin/cc clang bash-5.1$ realpath /usr/bin/cc /usr/bin/clang -- vq