help-bash
[Top][All Lists]
Advanced

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

Re: Special PATH variable for sourcing scripts?


From: Chet Ramey
Subject: Re: Special PATH variable for sourcing scripts?
Date: Mon, 22 Apr 2024 17:08:43 -0400
User-agent: Mozilla Thunderbird

On 4/21/24 2:42 PM, Matheus Afonso Martins Moreira wrote:

However, the manual[1] reveals that bash uses
the PATH variable for resolving names when
sourcing scripts that way.

This isn't going away. POSIX requires it.

The BASH_LIBRARY_PATH variable would be similar.
If it is defined, it disables the normal PATH
lookup behavior of the dot operator, making it
so that bash searches only the directories in
that list instead. Existing environments will
not contain that variable, compatibility is
therefore maintained.

Naming aside, this would have to work differently in POSIX mode, since
POSIX requires the shell to use PATH. Maybe POSIX mode would consult
this variable if present, but fall back to PATH.

Do you think this would be a good addition
to bash? Would a patch be accepted?

Sure, it seems like a reasonable feature. PATH overloading is kind of
historical baggage. I'll add it to the list for a future version.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

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