I have processes that I background with screen. I'm trying to write a script that attaches to a terminal, executes a couple commands, then detaches. The problem is that when I attach to a terminal, screen directs control to the user. How do I work around this?
+5
A:
Screen has an option -X which you can use to remote-control a screen session from within a script. See, for example, here.
Mark Probst
2009-03-20 16:52:35
That lets me send screen commands to screen. Is there any way to send arbitrary commands to the terminal running inside screen?
David Berger
2009-03-20 17:46:38
Use the command "stuff" to send keystrokes to a screen.
Mark Probst
2009-03-20 17:50:43