Firing tmux over ssh

Firing tmux when logging in via ssh

A couple of months ago I have come across this interisting tmux setup by Massimo Santini that fires up a tmux shell when logging in to a server via ssh.

The setup gives you the freedom to launch long-running commands and before you say «Darn! I should have launched that with screen!» you realize that you are in a tmux session, then you can fire a new window and detach.

As simple as it may seem, this is a nice feature for reckless people as I am, and I adpoted it immediately. I was so happy with it that I decided I wanted it also on my laptop (just in case I need to ssh into it), but the script was not working with my favourite shell zsh.

So, I dug a little into the reference pages for conditional expressions in zsh and bash and I have modified the script ao rhat it runs also with zsh shells.

Furthermore, you can put the script in a file, say tmux.sh and source it from your .bashrc (for bash shells) or .zshrc.

(I have also found this very nice bash shell script checker)