I have a script which needs to run in screen so I included
#!/usr/bin/screen /bin/bash
as the hash bang and it works great. The only problem is that when the script crashes I don't know what happened, the output is lost and all I know is that screen terminated.
My script is interactive so I need to see stdout and stderr in the terminal and I also want stdout and stderr logged in case it crashed.
I tried to run the script like
./test-screen-in-bash.sh 2>&1|tee test1.log
which results in an empty test1.log file
Can somebody please explain what am I doing wrong.