I made a script in bash to load a custom tmux session.
I noticed that because the windows has a name, I can't use again the script, because the windows name already exists. Instead of using some random number as name for the windows, or don't give it a name at all, I thought it'd easier to kill the process.
#!/bin/sh
pkill -f tmux
tmux new-session -s "Tab 1"\; \
split-window -v \; \
split-window -h \; \
split-window -v \;
So, when I use the script it kills the tmux process before creating the tmux session. I noticed that if the tmux session is open, it closes it but another does not open. It throws me this message instead.
server exited unexpectedly
So I have to use the command twice to make it works.
Is there any way of executing the script one single time killing the current session and opening a new one? Thanks!