Reputation: 8982
I have written a startup script to create a new tmux session with three windows, with one of these windows being split vertically and horizontally:
#!/bin/bash
sV=awesome
tmux new -s "$sV" -n etc -d
tmux new-window -t "$sV":1 -n 'Email' "thunderbird"
tmux new-window -t "$sV":2 -n 'Firefox' "firefox"
tmux new-window -t "$sV":3 -n 'coding' "cd some-path"
tmux split-window -v
tmux split-window
tmux select-window -t "$sV":3
tmux -2 attach-session -t "$sV"
My Problem is that only two windows get created (Firefox and the split window) and the split window is only split once horizontally. The commands get executed correctly, except for the cd
command, which - I guess - is due to the fact that the named window is not there.
I am pretty new to tmux, so I guess I made some really obvious beginner mistakes. Would be thankful for any help.
Upvotes: 0
Views: 263
Reputation:
tmux new-window -t "$sV":3 -n 'coding' "cd some-path"
cd
is a shell builtin and it does not stay around, when the shell exits the pane will close.
You can just use -c
instead:
tmux neww -t "$sV":3 -n 'coding' -c some-path
Upvotes: 1