bug-bash
[Top][All Lists]
Advanced

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

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


From: Lawrence Velázquez
Subject: Re: ?maybe? RFE?... read -h <symlink>?
Date: Sun, 05 Sep 2021 23:54:05 -0400
User-agent: Cyrus-JMAP/3.5.0-alpha0-1126-g6962059b07-fm-20210901.001-g6962059b

On Sun, Sep 5, 2021, at 11:11 PM, Dale R. Worley wrote:
> L A Walsh <bash@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



reply via email to

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