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 -X
expects a Screen command. The stuff
command sends input, and if you want to run that program from a shell prompt, you'll have to pass a newline as well.
screen -S demo -X stuff '/home/aa/scripts/outputs.sh
'
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
screen -S demo -p 1 -X stuff '/home/aa/scripts/outputs.sh
'
where 1 is the window number (you can use its title instead).
To start a new window in that session, use the screen
command instead. (That's the screen
Screen command, not the screen
shell command.)
screen -S demo -p 1 -X screen '/home/aa/scripts/outputs.sh'
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…