Skip to content

Instantly share code, notes, and snippets.

@thetristan
Created May 15, 2012 20:36

Revisions

  1. Tristan Blease created this gist May 15, 2012.
    9 changes: 9 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    # Taken from http://william.shallum.net/random-notes/automatically-start-tmux-on-ssh-login

    if [ "$PS1" != "" -a "${STARTED_TMUX:-x}" = x -a "${SSH_TTY:-x}" != x ]
    then
    STARTED_TMUX=1; export STARTED_TMUX
    sleep 1
    ( (tmux has-session -t remote && tmux attach-session -t remote) || (tmux new-session -s remote) ) && exit 0
    echo "tmux failed to start"
    fi