Skip to content

Instantly share code, notes, and snippets.

@VxJasonxV
Created June 28, 2009 07:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VxJasonxV/137214 to your computer and use it in GitHub Desktop.
Save VxJasonxV/137214 to your computer and use it in GitHub Desktop.
# I need to add this into my dotfiles repo. But for now, this is a cool way of getting you into your existing screen session, and get out when you detach.
# Put this at the bottom of your ~/.bash_profile and:
# 1) Upon login... it should be obvious what happens.
# 2) When you detach the screen session, you log out of the server.
# I'm a `screen` junkie when it comes to remote linux servers I rarely work outside of screen. If I need to, you can always ^C as soon as you ssh in and see "Reattaching [...]".
if [ -z $STY ]
then
echo "Reattaching screen in 3 seconds..."
sleep 3
exec screen -d -RR
fi
# Thanks to sadrul on Freenode for the [ -z $STY ] tip.
# Thanks to JB for the idea of doing this instead of just a blind `screen -d -RR`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment