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: 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 22:32:20 -0800
User-agent: Mozilla Thunderbird

Hi Martin,


On 11/13/24 20:40, Martin D Kealey wrote:
If you need to separate the output of `set -x` from your script's other
output, consider setting BASH_XTRACEFD:

exec 3>> /path/to/xtrace-logfile.txt
BASH_XTRACEFD=3
set -x
source your_file
set +x
exec 3>&-


I didn't know about BASH_XTRACEFD.

In case I'd really need to help users to diagnose their scripts down to the line number I'd use it.


Thank you for this very practical and relevant advise.


Yuri



reply via email to

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