Is there any way to make a bash
script enter a certain keystroke? What I'm trying to accomplish here is a script that will run Ctrl+B to exit tmux
.
EDIT: I see that several people are saying that it's better to use a program – specific command. What if I wanted to edit a text file (in this case the bash_aliases file) using a bash script?
Best Answer
If you want to interact with
tmux
in a script, that's where you want to usetmux ... tmux-command
. Like:To exit the current session.
To exit the server (kills all sessions).
to detach a client (exit, but you can reattach later).