run or send a command to a tmux pane in a running tmux session

Posted by cjroebuck on Super User See other posts from Super User or by cjroebuck
Published on 2012-10-24T11:57:01Z Indexed on 2012/10/24 17:05 UTC
Read the original article Hit count: 413

Filed under:
|
|

I want to write a shell script which will attach to a named tmux session, select a window (or pane) in that session and run a command in that selected window (or pane).

How do I do this from a bash script?

I know tmux new-window -n:mywindow 'exec something' allows you to send commands to a freshly created window. But I need something like tmux select-window -t:0 'my command'

I suppose I could use send-keys but seems like their should be something that takes a command or list of commands that get run.

© Super User or respective owner

Related posts about bash

Related posts about shell