There is a very useful feature in Bash where you can redirect the trace
enabled by `set -x` to a file descriptor *different* than 2. This comes
in particularly handy when validating the error output of commands, say,
in Git's test suite, while tracing at the same time.
It is such a useful feature,
On Fri, Aug 4, 2017 at 6:58 PM, Johannes Schindelin
wrote:
> There is a very useful feature in Bash where you can redirect the trace
> enabled by `set -x` to a file descriptor *different* than 2. This comes
> in particularly handy when validating the error output of commands, say,
> in Git's test
Applied in this form:
preverrout_fd = 2;
+ if (BASH_XTRACEFD && xflag) {
+ /* NB: bash closes fd == $BASH_XTRACEFD when it is changed.
+* we do not emulate this. We only use its value.
+*/
+ const char *xtracefd = lookupvar(