[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: proposed BASH_SOURCE_PATH
From: |
Chet Ramey |
Subject: |
Re: proposed BASH_SOURCE_PATH |
Date: |
Wed, 15 May 2024 11:03:12 -0400 |
User-agent: |
Mozilla Thunderbird |
On 5/14/24 2:08 AM, Martin D Kealey wrote:
I wholeheartedly support the introduction of BASH_SOURCE_PATH, but I would
like to suggest three tweaks to its semantics.
A common pattern is to unpack a script with its associated library & config
files into a new directory, which then leaves a problem locating the
library files whose paths are only known relative to $0 (or
${BASH_SOURCE[0]}).
That assumes a flat directory structure for the script and its associated
files, correct? How common is that really? Or is it more common to have
something like the script in somewhere/bin, files to be sourced in
somewhere/lib, and so on?
1. I therefore propose that where a relative path appears in
BASH_SOURCE_PATH, it should be taken as relative to the directory
containing $0 (after resolving symlinks), rather than relative to $PWD.
Is this pattern really common enough to break with existing behavior
like you propose?
--
``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/
- Re: proposed BASH_SOURCE_PATH, (continued)
- Re: proposed BASH_SOURCE_PATH, Léa Gris, 2024/05/14
- Re: proposed BASH_SOURCE_PATH, Chet Ramey, 2024/05/15
- Re: proposed BASH_SOURCE_PATH, Koichi Murase, 2024/05/15
- Re: proposed BASH_SOURCE_PATH,
Chet Ramey <=
- Re: proposed BASH_SOURCE_PATH, Chet Ramey, 2024/05/16
Re: proposed BASH_SOURCE_PATH, Robert Elz, 2024/05/15