I am connecting to a set of machines, each on a separate tmux pane.
I have a set of commands that I would like to send concurrently, such that each command would be executed on a different tmux pane.
Is there any way to do it?
e.g. The commands:
cmdA
cmdB
cmdC
cmdD
Send concurrently to different tmux panes
shell1> cmdA
______________________________________
shell2> cmdB
______________________________________
shell3> cmdC
______________________________________
shell4> cmdD
______________________________________
From a shell script run commands like
tmux send-keys -t 1 'cmdA' enter
tmux send-keys -t 2 'cmdB' enter
tmux send-keys -t 3 'cmdC' enter
tmux send-keys -t 4 'cmdD' enter
where enter
will send the newline character. You need to know the pane numbers, but typically they will be as above.
EDIT: note that tmux send-keys -t 0 'cmd' enter
sends a command to the active pane