maybe set -a 'd help ?
if it can backwards export the vars

On Thu, Nov 14, 2024, 3:01 PM Chet Ramey <chet.ra...@case.edu> wrote:

> On 11/13/24 4:48 PM, Yuri wrote:
>
> > The first 'source' command didn't set variables set or exported in the
> > child.sh script, even though 'source' is executed in the current
> script's
> > context,
>
> The `source' command isn't "executed in the current script's context." It
> is executed in a subshell, which can't affect its parent's variables.
>
> The bash man page says:
>
> "Each command in a multi-command pipeline, where pipes are  created,  is
>   executed  in a subshell, which is a separate process."
>
> POSIX says:
>
> "Changes made to the subshell environment shall not affect the shell
>   environment. Command substitution, commands that are grouped with
>   parentheses, and asynchronous AND-OR lists shall be executed in a
> subshell
>   environment. Additionally, each command of a multi-command pipeline is in
>   a subshell environment;"
>
> Some shells, including bash in some circumstances, will execute the last
> pipeline element in the current shell, but no shell executes the first
> element in the current shell context.
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/
>

Reply via email to