tmux script to launch several commands

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
13
down vote

favorite
2












How can I write the following in a bash script?



tmux # Start tmux session.
compass watch /path/to/project1/compass/ # Run the first process.
Ctrl + B, " # Split the pane.
compass watch /path/to/project2/compass/ # Run the second process.
Ctrl + B, D # Exit the session.









share|improve this question



























    up vote
    13
    down vote

    favorite
    2












    How can I write the following in a bash script?



    tmux # Start tmux session.
    compass watch /path/to/project1/compass/ # Run the first process.
    Ctrl + B, " # Split the pane.
    compass watch /path/to/project2/compass/ # Run the second process.
    Ctrl + B, D # Exit the session.









    share|improve this question

























      up vote
      13
      down vote

      favorite
      2









      up vote
      13
      down vote

      favorite
      2






      2





      How can I write the following in a bash script?



      tmux # Start tmux session.
      compass watch /path/to/project1/compass/ # Run the first process.
      Ctrl + B, " # Split the pane.
      compass watch /path/to/project2/compass/ # Run the second process.
      Ctrl + B, D # Exit the session.









      share|improve this question















      How can I write the following in a bash script?



      tmux # Start tmux session.
      compass watch /path/to/project1/compass/ # Run the first process.
      Ctrl + B, " # Split the pane.
      compass watch /path/to/project2/compass/ # Run the second process.
      Ctrl + B, D # Exit the session.






      scripting tmux






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 26 '16 at 12:29









      Gilles

      515k12210231552




      515k12210231552










      asked Jun 26 '16 at 0:05









      GTS Joe

      18015




      18015




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          15
          down vote













          tmux 
          new-session 'compass watch /path/to/project1/compass/' ;
          split-window 'compass watch /path/to/project2/compass/' ;
          detach-client


          The new-session command (which creates a new tmux session) and the split-window command (which splits the current window into two panes) in tmux takes optional shell commands to run. The detach-client does the obvious at the end.



          When sending multiple tmux commands to tmux you need to separate them by ;. The ; needs to be protected from the shell by quoting/escaping it (';', ";" or ;), to stop the shell from interpreting it as the end of the tmux command.



          I've split the whole thing into separate lines for readability. If you do this in a script (which I recommend), make sure there's nothing after the final on each line.



          Reattach to the session with tmux a, tmux attach, or tmux attach-session (these are all equivalent).



          The tmux session will end once both commands have finished executing.






          share|improve this answer






















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f292137%2ftmux-script-to-launch-several-commands%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            15
            down vote













            tmux 
            new-session 'compass watch /path/to/project1/compass/' ;
            split-window 'compass watch /path/to/project2/compass/' ;
            detach-client


            The new-session command (which creates a new tmux session) and the split-window command (which splits the current window into two panes) in tmux takes optional shell commands to run. The detach-client does the obvious at the end.



            When sending multiple tmux commands to tmux you need to separate them by ;. The ; needs to be protected from the shell by quoting/escaping it (';', ";" or ;), to stop the shell from interpreting it as the end of the tmux command.



            I've split the whole thing into separate lines for readability. If you do this in a script (which I recommend), make sure there's nothing after the final on each line.



            Reattach to the session with tmux a, tmux attach, or tmux attach-session (these are all equivalent).



            The tmux session will end once both commands have finished executing.






            share|improve this answer


























              up vote
              15
              down vote













              tmux 
              new-session 'compass watch /path/to/project1/compass/' ;
              split-window 'compass watch /path/to/project2/compass/' ;
              detach-client


              The new-session command (which creates a new tmux session) and the split-window command (which splits the current window into two panes) in tmux takes optional shell commands to run. The detach-client does the obvious at the end.



              When sending multiple tmux commands to tmux you need to separate them by ;. The ; needs to be protected from the shell by quoting/escaping it (';', ";" or ;), to stop the shell from interpreting it as the end of the tmux command.



              I've split the whole thing into separate lines for readability. If you do this in a script (which I recommend), make sure there's nothing after the final on each line.



              Reattach to the session with tmux a, tmux attach, or tmux attach-session (these are all equivalent).



              The tmux session will end once both commands have finished executing.






              share|improve this answer
























                up vote
                15
                down vote










                up vote
                15
                down vote









                tmux 
                new-session 'compass watch /path/to/project1/compass/' ;
                split-window 'compass watch /path/to/project2/compass/' ;
                detach-client


                The new-session command (which creates a new tmux session) and the split-window command (which splits the current window into two panes) in tmux takes optional shell commands to run. The detach-client does the obvious at the end.



                When sending multiple tmux commands to tmux you need to separate them by ;. The ; needs to be protected from the shell by quoting/escaping it (';', ";" or ;), to stop the shell from interpreting it as the end of the tmux command.



                I've split the whole thing into separate lines for readability. If you do this in a script (which I recommend), make sure there's nothing after the final on each line.



                Reattach to the session with tmux a, tmux attach, or tmux attach-session (these are all equivalent).



                The tmux session will end once both commands have finished executing.






                share|improve this answer














                tmux 
                new-session 'compass watch /path/to/project1/compass/' ;
                split-window 'compass watch /path/to/project2/compass/' ;
                detach-client


                The new-session command (which creates a new tmux session) and the split-window command (which splits the current window into two panes) in tmux takes optional shell commands to run. The detach-client does the obvious at the end.



                When sending multiple tmux commands to tmux you need to separate them by ;. The ; needs to be protected from the shell by quoting/escaping it (';', ";" or ;), to stop the shell from interpreting it as the end of the tmux command.



                I've split the whole thing into separate lines for readability. If you do this in a script (which I recommend), make sure there's nothing after the final on each line.



                Reattach to the session with tmux a, tmux attach, or tmux attach-session (these are all equivalent).



                The tmux session will end once both commands have finished executing.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 10 mins ago

























                answered Jun 26 '16 at 6:16









                Kusalananda

                110k15214339




                110k15214339



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f292137%2ftmux-script-to-launch-several-commands%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?