I am doing the following thing (this is just an example, commads are more complex):
xterm -fa "Inconsolata" -e tmux new-session -s alpha & disown %% tmux new-window -t alpha bash tmux new-window -t alpha zsh
...which works perfectly when I type it in the terminal, giving me an xterm with a tmux session with three windows. BUT if I put the thing in a script, it will stop working with;
no server running on /tmp/tmux-1153/default no server running on /tmp/tmux-1153/default
error, and just one window in the new
After a bit of experiments, I discovered that it will work again if I add a
(or similar) between the
disown and the
tmux new-window command. Clearly,
the xterm has not finished to set-up before this command is run, and so
tmux new-window is run before the session is created unless I put a delay there.
It works, but it's not elegant. Is there a way to tell
tmux to wait until the session
alpha is up?