Skip to content

Instantly share code, notes, and snippets.

@nex3
Created October 26, 2008 22:25
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 nex3/19960 to your computer and use it in GitHub Desktop.
Save nex3/19960 to your computer and use it in GitHub Desktop.
# Thanks to Bill Clementson for parts of this snippet
# http://bc.tech.coop/
function start_or_join_screen {
if [ "$TERM" != dumb -a "$PS1" != "" -a "${STARTED_SCREEN:-x}" = x -a "${SSH_TTY:-x}" ]
then
STARTED_SCREEN=1 ; export STARTED_SCREEN
sleep 1
if screen -RR
then
test -e /tmp/$USER_screen_abnormal_exit || exit 0
rm /tmp/$USER_screen_abnormal_exit
else
echo "Screen failed! continuing with normal bash startup"
fi
fi
}
function descreen {
touch /tmp/$USER_screen_abnormal_exit
screen -X quit
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment