bug-bash
[Top][All Lists]
Advanced

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

Re: The 'source x' command doesn't keep variables set by x when source o


From: #!microsuxx
Subject: Re: The 'source x' command doesn't keep variables set by x when source output is piped into other command
Date: Thu, 14 Nov 2024 00:09:20 +0100

source is not tty dependand , so try ..

 tee -a log < <(
exec 2>&1
set -x
. user.bash
 )

On Wed, Nov 13, 2024, 11:52 PM Yuri <yuri@rawbw.com> wrote:

> On 11/13/24 14:45, #!microsuxx wrote:
> > depending on actual purpose instead bs demo code , there are serval
> > approaches to code running code
>
>
> The original code in my project runs 'source x.sh > log' where x.sh is
> some user-provided script.
>
> I wanted to trace the code using 'set -x' in order to report errors
> locations in scripts to the user.
> However, the trace also goes to log instead of stdout.
> When I changed that to 'source x.sh | tee log' - environment variables
> that the user script x.sh also sets disappeared due to the problem in
> SUBJECT.
>
>
> This problem makes it very inconvenient to implement features around
> scripts using 'source'.
>
>
>
> Yuri
>
>
>
>


reply via email to

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