unixgnu-screen

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


Currently I am using a script to spawn a daemon:

screen -r user -X stuff "spawn daemon"
screen -r user -X eval "stuff \015"

Is there an easier way to send the enter key ("\015"), or in fact a better way of doing this? (I have to use screen.)

I assume that because I'm not attaching the screen, I won't be able to get the outcome/output of the "spawn daemon" command. Is that correct?


Solution

  • 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.