Is there an easier way to send ENTER key in GNU Screen? Is there an easier way to send ENTER key in GNU Screen? unix unix

Is there an easier way to send ENTER key in GNU Screen?


I always do it like this:

screen -r user -X stuff "spawn daemon^M"

where I get the ^M by hitting ctrl-v, then Enter, on the command line. In bash and vim, ctrl-v can be used to escape characters like Enter that would otherwise have a special effect.


As for the second question, you can enable logging, and read from the log file.


This solution is working in my case:

screen -r user -X stuff "spawn daemon$(printf \\r)"