Created
May 15, 2012 20:36
-
-
Save thetristan/2704924 to your computer and use it in GitHub Desktop.
Start tmux on ssh login
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment