Is there a way to redirect my debug output to a file and normal STDOUT on screen.
$ cat test1.sh
#!/bin/bash
echo HAI
echo BYE
$ sh -x test1.sh
+ echo HAI
HAI
+ echo BYE
BYE
I want to redirect the debug output to file and normal output on the screen.
$ sh -x test1.sh >file1
+ echo HAI
+ echo BYE
But I can redirect the output to a file and ending the debug output on screen.