I want to set all debugging output to a log file. So I checked https://askubuntu.com/questions/811439/bash-set-x-logs-to-file 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?