Escape keywords with tmux send

Clash 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"?
tmux arguments escape-characters terminal-multiplexer
add a comment |Â
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"?
tmux arguments escape-characters terminal-multiplexer
add a comment |Â
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"?
tmux arguments escape-characters terminal-multiplexer
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
tmux arguments escape-characters terminal-multiplexer
asked Sep 28 at 7:30
iago-lito
709524
709524
add a comment |Â
add a comment |Â
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
That really is heplful, cheers :) Don't forget to wrap your<text>in quotes becausetmux send-keys -t session -l '' two wordsactually sendstwowords, buttmux send-keys -t session -l '' "up down"does sendup downas expected :)
â iago-lito
Sep 29 at 8:30
add a comment |Â
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
That really is heplful, cheers :) Don't forget to wrap your<text>in quotes becausetmux send-keys -t session -l '' two wordsactually sendstwowords, buttmux send-keys -t session -l '' "up down"does sendup downas expected :)
â iago-lito
Sep 29 at 8:30
add a comment |Â
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
That really is heplful, cheers :) Don't forget to wrap your<text>in quotes becausetmux send-keys -t session -l '' two wordsactually sendstwowords, buttmux send-keys -t session -l '' "up down"does sendup downas expected :)
â iago-lito
Sep 29 at 8:30
add a comment |Â
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
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
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 becausetmux send-keys -t session -l '' two wordsactually sendstwowords, buttmux send-keys -t session -l '' "up down"does sendup downas expected :)
â iago-lito
Sep 29 at 8:30
add a comment |Â
That really is heplful, cheers :) Don't forget to wrap your<text>in quotes becausetmux send-keys -t session -l '' two wordsactually sendstwowords, buttmux send-keys -t session -l '' "up down"does sendup downas 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
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password