Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #34634

Re: how to dereference "which" command to show physical unlinked location?

From Joe Beanfish <joebeanfish@nospam.duh>
Newsgroups comp.os.linux.misc
Subject Re: how to dereference "which" command to show physical unlinked location?
Date 2022-05-19 14:25 +0000
Organization A noiseless patient Spider
Message-ID <t65k0d$vop$3@dont-email.me> (permalink)
References <t65f3d$elo$1@gioia.aioe.org> <t65hgg$92c$1@dont-email.me>

Show all headers | View raw


On Thu, 19 May 2022 13:42:40 +0000, Lew Pitcher wrote:

> On Thu, 19 May 2022 21:01:30 +0800, Arthur Dent wrote:
> 
>> If you do "which javac", it responds with /usr/bin/javac which is a
>> pointer to the /etc/alternatives bollocks which is another link to
>> something like /usr/lib/jvm/java_1702_distro_2022_wankwank
>> 
>> So I want to get the latter, as one cannot strip bin/javac off the first
>> answer to derive $JAVA_HOME "which" command does not have a dereference
>> option to yield the actual landing point.
> 
> This may not work for you, but the realpath(1) utility spits out
> "the resolved absolute file name", and can resolve symbolic links
> to do so.
> 
> Try
>   realpath $(which javac)
> 
> 
> HTH

readlink -f
does the same thing, in case you have one but not the other.

Back to comp.os.linux.misc | Previous | NextPrevious in thread | Find similar


Thread

how to dereference "which" command to show physical unlinked location? Arthur Dent <dent@bbc.co.uk> - 2022-05-19 21:01 +0800
  Re: how to dereference "which" command to show physical unlinked location? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2022-05-19 13:42 +0000
    Re: how to dereference "which" command to show physical unlinked location? Joe Beanfish <joebeanfish@nospam.duh> - 2022-05-19 14:25 +0000

csiph-web