On Wednesday, June 19, 2024, Will Allan <billyz...@yahoo.com> wrote: > I think this is exactly why this feature is necessary. Unless I am > misunderstanding, simply prepending `${BASH_SOURCE%/*}' to a sourced path > will not work in all cases. For example, when executing the main script > directly inside the script directory (e.g. `bash main.sh`) you would end up > with an invalid path (e.g. main.sh/../lib/foo.sh). >
What I'm saying there is name it main and execute like `./main'. I'm not against having a variable that's automatically populated with the parent directory of the source script, I just don't need it and it wasn't what we were discussing. -- Oğuz