I would like to start screen detached session, but I want to evaluate some bash. It seems screen only supports an executable and binary. I want do do some magic like:
screen -d -m script.sh 2>&1 | tee logfile.log
but this apparently does not work. Quoting does not help here. The only idea I have is to create a wrapper script that will do this redirection and then to call it directly, like:
screen -d -m wrapper_script.sh
Any other ideas? Thanks.
You could have screen run a bash shell, which in turn runs your script.
I just tested this:
which gave me this:
So this should work too:
Have you tried specifying the
-L
screen option to write to a log?You can also specify the name of the log using the file
~/.screenrc
- here is the contents of mine as an example: