Dragonshadow
Dragonshadow

Reputation: 61

Sending commands to the active program in a screen session?

I've got a server running inside a screen session, and I want to send this program a command. I thought screen -X was my answer, but all that gives me access to is screen commands (title, exec, etc).

I need to be able to send the command as if I was typing it into the program. Any ideas?

Upvotes: 2

Views: 1152

Answers (1)

Borealid
Borealid

Reputation: 98469

You may use screen's -p and -X options in conjunction with the exec command.

Try screen -X exec ".\!\!" echo foo, for example, to send "foo" to the currently-running program in the screen.

You might also want to try screen -X exec ".!" echo foo if the first command is not working.

Upvotes: 2

Related Questions