bug-bash
[Top][All Lists]
Advanced

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

Re: [PATCH 0/4] Add import builtin


From: Lawrence Velázquez
Subject: Re: [PATCH 0/4] Add import builtin
Date: Thu, 02 May 2024 22:35:02 -0400
User-agent: Cyrus-JMAP/3.11.0-alpha0-417-gddc99d37d-fm-hotfix-20240424.001-g2c179674

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



reply via email to

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