|
From: | Yuri |
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 14:51:54 -0800 |
User-agent: | Mozilla Thunderbird |
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
[Prev in Thread] | Current Thread | [Next in Thread] |