i think .. BASH_XTRACEFD=3
.. alone may also do .. u try .. On Sat, Nov 2, 2024, 20:55 #!microsuxx <fxmb...@gmail.com> wrote: > exec 3<&2 > BASH_XTRACEFD=3 > set -x > { > echo foo >&2 > } 2>&- > > replace &- with file to out log the echo > > On Sat, Nov 2, 2024, 20:37 <christoph@christophs-macbook-air.local> wrote: > >> Configuration Information [Automatically generated, do not change]: >> Machine: aarch64 >> OS: darwin24.0.0 >> Compiler: clang >> Compilation CFLAGS: -DSSH_SOURCE_BASHRC >> -DDEFAULT_LOADABLE_BUILTINS_PATH='/opt/homebrew/Cellar/bash/5.2.37/lib/bash:/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:.' >> uname output: Darwin Christophs-MacBook-Air.local 24.1.0 Darwin Kernel >> Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; >> root:xnu-11215.41.3~2/RELEASE_ARM64_T8103 arm64 >> Machine Type: aarch64-apple-darwin24.0.0 >> >> Bash Version: 5.2 >> Patch Level: 37 >> Release Status: release >> >> Description: >> Redirecting stderr to file causes output of bash -xv to be writte >> to file as well >> >> Repeat-By: >> >> test_bash.sh: >> " >> test_fun() { >> echo "to stderr" >&2 >> } >> >> test_fun &>out >> " >> bash -xv test_bash.sh: >> " >> test_fun() { >> echo "to stderr" >&2 >> } >> >> test_fun &>out >> + test_fun >> " >> >> out: >> " >> + echo 'to stderr' >> to stderr >> " >> >> Fix: >> >> >>