Jeffrey W.
Jeffrey W.

Reputation: 3

How to make a program receive the "standard" input from a file if it is launched by the linux command screen?

I used the command screen to issue a program MyProgram as the following:

screen -dmL MyProgram

However, MyProgram is supposed to get some inputs from the standard input if it is launched directly without screen. So with screen, can I let MyProgram obtain the input from a file (as the standard input)? Or is there any other way of bypassing this problem?

Upvotes: 0

Views: 40

Answers (1)

Thomas Dickey
Thomas Dickey

Reputation: 54583

You can use "any" command when invoking screen. For example

screen -dmL sh -c "MyProgram <myFile"

will pass the complete command

MyProgram <myFile

to screen.

Upvotes: 1

Related Questions