How to create a screen executing given command?

前端 未结 7 1573
星月不相逢
星月不相逢 2020-12-07 18:07

i\'m fairly new in *nix. Is there a way to create a screen, which will immediately execute a given command sequence (with their own arguments)? Two hours of googling yields

相关标签:
7条回答
  • 2020-12-07 18:39

    Yes, what you want is the "stuff" command

    for example

    screen -dmS new_screen -X stuff "cd /dir && java -version

    "

    the second quote is on the next line so that it executes when sent

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