I recently started using
tmux. I found I can attach-or-create a tmux session by using:
tmux new-session -A -s main
I was hoping to put this into
.profile so that I automatically get put into tmux when I connect via SSH. I'd like to skip this when logging on locally.
I found this question which looks promising, however I'm concerned that if I launch tmux from
.profile it'll then launch my shell and create another tmux ad infinitum!
So what's the correct way to avoid launching
.profile if it's already running in tmux?