Created
June 19, 2012 16:41
-
-
Save wolph/2955187 to your computer and use it in GitHub Desktop.
Screen reattach script for bash/zsh/etc..
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
# If we're not in screen, resume the existing session | |
if [[ "$TERM" != screen* ]]; then | |
# Clean up old sessions | |
screen -wipe > /dev/null | |
# See if there are sessions available | |
screen -q -ls | |
if [[ "$?" -ge "10" ]]; then | |
# Reconnect if there are | |
exec screen -x | |
else | |
# Create a new session if not | |
exec screen | |
fi | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment