How to write a shell script that starts tmux session, and then runs a ruby script

后端 未结 6 675
暗喜
暗喜 2020-12-08 03:53

I want to write a shell script that does this:

  • First, create a tmux session
  • Second, run a ruby script called \"run.rb\" INSIDE the tmux session
  • <
6条回答
  •  温柔的废话
    2020-12-08 04:37

    You could use teamocil to do this easily. You could just create a YAML file:

    windows:
      - name: rubysession
        root: ~
        layout: tiled
        panes:
          - ruby run.rb; tmux detach
    

    If you named it 'rubysession.yml' then run:

    teamocil rubysession
    

    And that would work perfectly for your purpose and require no hacks. Also teamocil is awesome for loads of other uses!

提交回复
热议问题