This question already has an answer here:
-x for debug info while executing the shell script.
How can I redirect debug info only to a file?
#!/bin/bash echo OK echo NO
i will get the below result when i run in debug mode
+ echo OK OK + echo NO NO
I would like to redirect only the debug info to a file.
+ echo OK + echo NO
And runtime output should print on the screen.