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:36:46 +0100

what u need to do with the vars
include all code in tee
or try

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

what i firstly meant :

#!/bin/bash
 tee -a log < <(
all code here
set -x ; . code ; other code that needs the vars set
maybe needs a 2> smth
 )

try

 (
set -x
. mybash
vars_code
 ) |& tee -a log


On Thu, Nov 14, 2024, 12:19 AM Yuri <yuri@rawbw.com> wrote:

> On 11/13/24 14:48, #!microsuxx wrote:
> > 1st source cmd , no extra cmds 2. { . foo ; code ; code ; } | tee 3rd
> > tee < <( . foo ; cmds )
>
>
> I need to (1) source the user script, (2) save this script's output to a
> dedicated file, (3) keep the same output in stdout, and (4) keep
> environment variables that the user script sets for later commands.
> It doesn't look like any of the above 3 lines do all these 4 requirements.
>
>
> Yuri
>
>
>
>


reply via email to

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