I have a GNU screen named demo, I want to send commands to it. How do I do this?
screen -S demo -X /home/aa/scripts/outputs.sh
yeilds No screen session found.
and doing screen -ls shows that it isn’t running.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If the Screen session isn’t running, you won’t be able to send things to it. Start it first.
Once you’ve got a session, you need to distinguish between Screen commands and keyboard input.
screen -Xexpects a Screen command. Thestuffcommand sends input, and if you want to run that program from a shell prompt, you’ll have to pass a newline as well.Note that this may be the wrong approach. Are you sure you want to type into whatever is active in that session? To direct the input at a particular window, use
where 1 is the window number (you can use its title instead).
To start a new window in that session, use the
screencommand instead. (That’s thescreenScreen command, not thescreenshell command.)