I'm writing a shell script that creates / attaches or switches to a given session, depending on whether one is inside tmux and the session exists.
I've got everything working great except for the case requiring the creation of a new tmux session from within a tmux session.
When my script executes tmux new-session -s name
, I get the following output:
sessions should be nested with care, unset $TMUX to force
I don't actually want to nest sessions, my goal is to create another separate session and switch to it from within a tmux session.
Is this possible?
The quickest way (assuming you use ctrl-b
as your command prefix) is:
ctrl-b :new
To create a new session, then
ctrl-b s
to interactively select and attach to the session.