Skip to content

Instantly share code, notes, and snippets.

@fheinle
Created March 28, 2014 12:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fheinle/9831939 to your computer and use it in GitHub Desktop.
Save fheinle/9831939 to your computer and use it in GitHub Desktop.
automatisch Screen starten für SSH-Verbindungen
if [ ! "$TERM" == "screen" ] && [ "$SSH_TTY" != '' ]; then
screen -x -S sshscreen || screen -S sshscreen
fi
@JForst
Copy link

JForst commented Mar 31, 2014

Gute Idee,
hier noch die Version für tmux:

# start tmux session when logged in via ssh
if ! [[ $TERM =~ 'screen' ]] && [ "$SSH_TTY" != '' ]; then
    tmux attach -t sshtmux || tmux new -s sshtmux
fi

Ich habe beim TERM noch ein pattern match eingebaut ( ab bash 3.) weil mein terminal z.b. screen-256color heisst.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment