On Sun, Sep 05, 2021 at 11:54:05PM -0400, Lawrence Velázquez wrote: > On Sun, Sep 5, 2021, at 11:11 PM, Dale R. Worley wrote:
> > > ... I was wondering, is there a way for bash to know where the > > > symlink points (without using an external program)? > > The distribution ships with a "realpath" loadable builtin, FWIW. > bash-5.1$ enable -f /opt/local/lib/bash/realpath realpath > bash-5.1$ realpath /usr/bin/cc > /usr/bin/clang I think this answer the need, but using this to populate a variable implie anyway a fork. realPathArray=$(realpath /bin/sh /usr/bin/X) It would be nice if builtins intended to produce *answer* use more or less common switch like `printf -v` behaviour. usage: realpath [-a array] [-csv] pathname [pathname...] options: -a NAME assign the output to shell array NAME rather than display it on the standard output -c check whether or not each resolved path exists -s no output, exit status determines whether path is valid -v produce verbose output -- Félix Hauri - <fe...@f-hauri.ch> - http://www.f-hauri.ch