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 <y...@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