Im trying to run 2 scripts in 2 different TMUX panes from a bash file. The problem is that they are all blocking, so once I execute a process from one pane, I can't move to the other pane to execute the other job.

How can I overcome this issue ?

I'll post the code sample.

#! /bin/bash
tmux split-window -v
tmux select-pane -t 0
tmux select-pane -t 1 #doesnt happen
./blocking-script_2  #doesnt happen



  • Do you need to interact with the scripts once started? Ie, could you launch them background with &? – Paul Jul 27 '17 at 0:06
  • @Paul yes i do. – Liam F-A Jul 27 '17 at 0:29

This should do what you want.

tmux split-window -v
tmux send-keys -t 0 ./blocking_script_1 C-m

Instead of switching panes and then running blocking_script_1, it just sends the keystrokes required to execute it, followed by a carriage-return (Ctrl-M. aka Enter, or C-m). Then it runs blocking_script_2 in the current pane (which hasn't changed, still pane -t1)

If you need to provide any arguments to blocking_script_1, wrap the entire command and all its args in double-quotes, or use \ to escape the spaces. e.g.

tmux send-keys -t 0 "./blocking_script_1 arg1 arg2 arg3..." C-m


tmux send-keys -t 0 ./blocking_script_1\ arg1\ arg2\ arg3... C-m

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.