On Thu, Jun 20, 2024 at 4:05 AM Will Allan <[email protected]> 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