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: Wed, 13 Nov 2024 23:48:28 +0100

eg in ur puroose u dont need source
and in ur code when u understood | othercmd is in another subshell , u see
it doesnt well
if u pipe to tee , .. well the scope of needed

1st source cmd , no extra cmds
2. { . foo ; code ; code ; } | tee
3rd tee < <( . foo ; cmds )

On Wed, Nov 13, 2024, 11:45 PM #!microsuxx <fxmbsw7@gmail.com> wrote:

> depending on actual purpose instead bs demo code , there are serval
> approaches to code running code
>
> On Wed, Nov 13, 2024, 11:13 PM Yuri <yuri@rawbw.com> wrote:
>
>> On 11/13/24 14:02, Greg Wooledge wrote:
>> > The commands within a pipeline are executed in subshells (child
>> > processes), so all variable changes are discarded when the subshell
>> exits.
>>
>>
>> This sounds like an implementation detail that should be invisible that
>> affects how the 'source' feature works.
>> This makes it a very confusing from the user's perspective.
>>
>>
>>
>>
>> Yuri
>>
>>
>>
>>


reply via email to

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