Escape keywords with tmux send

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











up vote
2
down vote

favorite












Using tmux to send commands along from one terminal to another, I realize that



$ tmux send -t mySession "text" ENTER


correctly sends text, but



$ tmux send -t mySession "up" ENTER


sends text again, probably because up is interpreted not as text, but as keyworded key up arrow.



Similarly,



$ tmux send -t mySession "3" ENTER


correctly sends 3, but



$ tmux send -t mySession "-3" ENTER
tmux: unknown option -- 3
usage: send-keys [-lRM] [-t target-pane] key


fails with this error message, and this naive try to escape



$ tmux send -t mySession "-3" ENTER


sends 3 again, not the expected -3.



Anyway, I'm pretty sure that I've missed something about the way tmux interprets and understand its argument. What am I missing here?



How do I ensure that mytmuxcommand "<text>" ENTER will always be interpreted as "send actual <text> then send ENTER key"?










share|improve this question

























    up vote
    2
    down vote

    favorite












    Using tmux to send commands along from one terminal to another, I realize that



    $ tmux send -t mySession "text" ENTER


    correctly sends text, but



    $ tmux send -t mySession "up" ENTER


    sends text again, probably because up is interpreted not as text, but as keyworded key up arrow.



    Similarly,



    $ tmux send -t mySession "3" ENTER


    correctly sends 3, but



    $ tmux send -t mySession "-3" ENTER
    tmux: unknown option -- 3
    usage: send-keys [-lRM] [-t target-pane] key


    fails with this error message, and this naive try to escape



    $ tmux send -t mySession "-3" ENTER


    sends 3 again, not the expected -3.



    Anyway, I'm pretty sure that I've missed something about the way tmux interprets and understand its argument. What am I missing here?



    How do I ensure that mytmuxcommand "<text>" ENTER will always be interpreted as "send actual <text> then send ENTER key"?










    share|improve this question























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      Using tmux to send commands along from one terminal to another, I realize that



      $ tmux send -t mySession "text" ENTER


      correctly sends text, but



      $ tmux send -t mySession "up" ENTER


      sends text again, probably because up is interpreted not as text, but as keyworded key up arrow.



      Similarly,



      $ tmux send -t mySession "3" ENTER


      correctly sends 3, but



      $ tmux send -t mySession "-3" ENTER
      tmux: unknown option -- 3
      usage: send-keys [-lRM] [-t target-pane] key


      fails with this error message, and this naive try to escape



      $ tmux send -t mySession "-3" ENTER


      sends 3 again, not the expected -3.



      Anyway, I'm pretty sure that I've missed something about the way tmux interprets and understand its argument. What am I missing here?



      How do I ensure that mytmuxcommand "<text>" ENTER will always be interpreted as "send actual <text> then send ENTER key"?










      share|improve this question













      Using tmux to send commands along from one terminal to another, I realize that



      $ tmux send -t mySession "text" ENTER


      correctly sends text, but



      $ tmux send -t mySession "up" ENTER


      sends text again, probably because up is interpreted not as text, but as keyworded key up arrow.



      Similarly,



      $ tmux send -t mySession "3" ENTER


      correctly sends 3, but



      $ tmux send -t mySession "-3" ENTER
      tmux: unknown option -- 3
      usage: send-keys [-lRM] [-t target-pane] key


      fails with this error message, and this naive try to escape



      $ tmux send -t mySession "-3" ENTER


      sends 3 again, not the expected -3.



      Anyway, I'm pretty sure that I've missed something about the way tmux interprets and understand its argument. What am I missing here?



      How do I ensure that mytmuxcommand "<text>" ENTER will always be interpreted as "send actual <text> then send ENTER key"?







      tmux arguments escape-characters terminal-multiplexer






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Sep 28 at 7:30









      iago-lito

      709524




      709524




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          To send a string literally you can use the -l option to send-keys, but as you might still have more options after the -l you need to use something like '' (an empty string) to no longer be looking for options beginning -.



          You cannot mix and match the literal with keynames like Enter, so finally you need to give two commands, eg:



          tmux send-keys -t session -l '' -3 ; send-keys -t session Enter





          share|improve this answer




















          • That really is heplful, cheers :) Don't forget to wrap your <text> in quotes because tmux send-keys -t session -l '' two words actually sends twowords, but tmux send-keys -t session -l '' "up down" does send up down as expected :)
            – iago-lito
            Sep 29 at 8:30










          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%2f471997%2fescape-keywords-with-tmux-send%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
          1
          down vote



          accepted










          To send a string literally you can use the -l option to send-keys, but as you might still have more options after the -l you need to use something like '' (an empty string) to no longer be looking for options beginning -.



          You cannot mix and match the literal with keynames like Enter, so finally you need to give two commands, eg:



          tmux send-keys -t session -l '' -3 ; send-keys -t session Enter





          share|improve this answer




















          • That really is heplful, cheers :) Don't forget to wrap your <text> in quotes because tmux send-keys -t session -l '' two words actually sends twowords, but tmux send-keys -t session -l '' "up down" does send up down as expected :)
            – iago-lito
            Sep 29 at 8:30














          up vote
          1
          down vote



          accepted










          To send a string literally you can use the -l option to send-keys, but as you might still have more options after the -l you need to use something like '' (an empty string) to no longer be looking for options beginning -.



          You cannot mix and match the literal with keynames like Enter, so finally you need to give two commands, eg:



          tmux send-keys -t session -l '' -3 ; send-keys -t session Enter





          share|improve this answer




















          • That really is heplful, cheers :) Don't forget to wrap your <text> in quotes because tmux send-keys -t session -l '' two words actually sends twowords, but tmux send-keys -t session -l '' "up down" does send up down as expected :)
            – iago-lito
            Sep 29 at 8:30












          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          To send a string literally you can use the -l option to send-keys, but as you might still have more options after the -l you need to use something like '' (an empty string) to no longer be looking for options beginning -.



          You cannot mix and match the literal with keynames like Enter, so finally you need to give two commands, eg:



          tmux send-keys -t session -l '' -3 ; send-keys -t session Enter





          share|improve this answer












          To send a string literally you can use the -l option to send-keys, but as you might still have more options after the -l you need to use something like '' (an empty string) to no longer be looking for options beginning -.



          You cannot mix and match the literal with keynames like Enter, so finally you need to give two commands, eg:



          tmux send-keys -t session -l '' -3 ; send-keys -t session Enter






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 28 at 16:25









          meuh

          30.3k11752




          30.3k11752











          • That really is heplful, cheers :) Don't forget to wrap your <text> in quotes because tmux send-keys -t session -l '' two words actually sends twowords, but tmux send-keys -t session -l '' "up down" does send up down as expected :)
            – iago-lito
            Sep 29 at 8:30
















          • That really is heplful, cheers :) Don't forget to wrap your <text> in quotes because tmux send-keys -t session -l '' two words actually sends twowords, but tmux send-keys -t session -l '' "up down" does send up down as expected :)
            – iago-lito
            Sep 29 at 8:30















          That really is heplful, cheers :) Don't forget to wrap your <text> in quotes because tmux send-keys -t session -l '' two words actually sends twowords, but tmux send-keys -t session -l '' "up down" does send up down as expected :)
          – iago-lito
          Sep 29 at 8:30




          That really is heplful, cheers :) Don't forget to wrap your <text> in quotes because tmux send-keys -t session -l '' two words actually sends twowords, but tmux send-keys -t session -l '' "up down" does send up down as expected :)
          – iago-lito
          Sep 29 at 8:30

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f471997%2fescape-keywords-with-tmux-send%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?