I want to set all debugging output to a log file. So I checked command line - bash: set -x logs to file | Ask Ubuntu and followed the instructions.
test-script:
#!/bin/bash
exec 5 >/var/log/test.log
export BASH_XTRACEFD=5
main(){
set -x
echo hello
set +x
}
main
run:
./test-script
returns:
exec: 5: not found
The manual shows you can do this as well, so why is the above not working?