J'essaye d'obtenir un script shell exécuté par un harnais pour utiliser le harnais 'BASH_XTRACEFD. Voici une version réduite de ce que je tente qui montre le problème. Je veux '+ echo foobar' dans/tmp/xtrace et je ne veux pas faire référence à/tmp/xtrace dans/tmp/subject.Export xtrace/BASH_XTRACEFD mais la sortie xtrace va stderr, pas de fichier filedescriptor personnalisé
[bash]$ cat /tmp/harness
#!/bin/bash
exec 6> /tmp/xtrace
export BASH_XTRACEFD=6
set -o xtrace
export SHELLOPTS
/tmp/subject
set +o xtrace
[bash]$ cat /tmp/subject
#!/bin/bash
echo foobar
echo $SHELLOPTS
echo $BASH_XTRACEFD
ls -l /dev/fd/$BASH_XTRACEFD
[bash]$ /tmp/harness
+ echo foobar
foobar
+ echo braceexpand:hashall:interactive-comments:xtrace
braceexpand:hashall:interactive-comments:xtrace
+ echo 6
6
+ ls -l /dev/fd/6
l-wx------ 1 build build 64 Nov 29 12:15 /dev/fd/6 -> /tmp/xtrace
[bash]$ cat /tmp/xtrace
+ export SHELLOPTS
+ /tmp/subject
+ set +o xtrace
[bash]$