On Thu, May 2, 2024, at 9:40 PM, Dale R. Worley wrote:
> It seems like you could get much the same effect with this device:
>
> ----------------------------------------------------------------------
> t1 contains:
>
> # Where I am doing this testing.
> BASH_IMPORT_PATH=$HOME/temp/import/t2
>
> echo "Note PATH does not contain '.'"
> echo "PATH=$PATH"
> echo "BASH_IMPORT_PATH=$BASH_IMPORT_PATH"
>
> function import () {
> local PATH="$BASH_IMPORT_PATH"
> source "$1"
> }
You probably want something like
local PATH=$BASH_IMPORT_PATH:$PATH
otherwise the sourced file will not be able to find the usual
external utilities. Even then, the additional function scope
will interfere with top-level "declare" commands.
--
vq