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: L A Walsh
Subject: Re: ?maybe? RFE?... read -h <symlink>?
Date: Mon, 06 Sep 2021 15:46:19 -0700
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)



On 2021/09/05 20:54, Lawrence Velázquez wrote:
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.
----
   ???  convention has nearly all of the builtins as local
programs. Since 'read' (or "read -l") isn't a local program, what
are you saying?
 Of course, looking at the options to readlink shows that
there are several different meanings of "where a symlink points".
----
   Irk! I just wanted the raw data! (sigh), like 'ls-l' gives:

# /bin/ls -l named.pid
... named.pid -> named.d/named.pid
# /bin/ls -l named.d
... named.d -> ../lib/named/var/run/named

Sure I could (and usually do when I need to) parse output of
ls -l, but thats tedious and error prone.
The distribution ships with a "realpath" loadable builtin, FWIW.
----
I didn't know that... um, my bash isn't quite there yet:

Ishtar:/> enable -f /opt/local/lib/bash/realpath realpath

-bash: enable: cannot open shared object /opt/local/lib/bash/realpath: /opt/local/lib/bash/realpath: cannot open shared object file: No such file or directory
Ishtar:/> whence realpath
realpath is /usr/bin/realpath





reply via email to

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