How to start a new process in a new window in an existing GNU screen session, from outside the session

后端 未结 1 1469
南旧
南旧 2020-12-18 09:00

I asked a similar question here and got pretty close to what I\'m looking for

How to start a process from another application and then open a terminal to that proces

相关标签:
1条回答
  • 2020-12-18 09:58

    When you aren't in a screen session, you can pass the -X flag to screen to execute a screen command.

    For example, the screen command in screen opens a new window, optionally with a command to execute.

    Assuming you already have screen open somewhere:

    screen -dr -X screen sleep 20
    

    Note that the new window will close once the command (sleep in this case) finishes. If you want to keep it open you could potentially do something like this, which will type 'date\n' in the new window:

    screen -dr -X screen
    screen -dr -X stuff "date
    "
    

    The man pages of course have much more detail.

    0 讨论(0)
提交回复
热议问题