I have a screen instance running (a lot more actually, but only one that matters), and I would need to execute some code inside the screen, and get the result out to my script.
The first part is quite easy, I just screen -S session_name -X eval 'stuff "$cmd"\015'.
(I'm no screen expert, I just modified a line I found in a script, but I understand it... Not sure there's no better way to do it, though)
The second part, getting out the output, is trickier. For my current need, I only need the last line, but it'd be better if I can get the whole output, whatever it's size (for future uses).
screen -X stuff …; a question similar to yours. – Gilles May 4 '11 at 20:43stuff, which was what I had trouble understanding. – 1ace May 5 '11 at 13:44