How do you start Unix screen command with a command?

后端 未结 6 1259
情歌与酒
情歌与酒 2020-12-13 03:20

According to the docs for the Unix \"screen\" command, you can configure it in .screenrc to start with a bunch of default screens, each running a command that you specify.

6条回答
  •  爱一瞬间的悲伤
    2020-12-13 03:44

    You can also "stuff" characters into the screen as if you had typed them.

    Here's how you can do that with your example:

    
    screen -t "shell_0"  1
    
    # create the following screen in the desired dir, instead of cd-ing afterwards :)
    chdir ~/project/contactdb
    screen -t "autotest" 2
    
    # (without this sometimes screens fail to start correctly for me)
    sleep 5
    
    # paste some text into screen number 2:
    select 2
    stuff "autotest\012"
    

提交回复
热议问题