bug-bash
[Top][All Lists]
Advanced

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

Re: proposed BASH_SOURCE_PATH


From: konsolebox
Subject: Re: proposed BASH_SOURCE_PATH
Date: Thu, 20 Jun 2024 06:12:47 +0800

On Thu, Jun 20, 2024 at 4:05 AM Will Allan <billyzkid@yahoo.com> wrote:
> But, I still don’t like it. I have to start off each script with a slow 
> command substitution (subshell) which introduces a variable that I don’t 
> really want, but it’s too slow to do this repeatedly:

I agree.

> source -- "${BASH_SOURCE_PATH}/../lib/foo.sh"

You misunderstood the use of BASH_SOURCE_PATH though.  It's proposed
to be an alternative to PATH which is only respected by source.  I
suggest another name.  And that is BASH_SOURCE_REAL.

Alternatively, have BASH_SOURCE always produce real physical paths
either by default or through a shopt.

Any additional feature that doesn't allow loading a script relative to
the caller without external help is practically useless.


-- 
konsolebox



reply via email to

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