Skip to content

Instantly share code, notes, and snippets.

@jhsu
Created November 23, 2009 18:48
Show Gist options
  • Select an option

  • Save jhsu/241271 to your computer and use it in GitHub Desktop.

Select an option

Save jhsu/241271 to your computer and use it in GitHub Desktop.
auto reattach screen
function _resumescreen()
{
test ${TERM/\.*/} = "screen" && return 1 #do nothing if inside screen.
test ${TERM/\.*/} = "dumb" && return 1 #do nothing if inside screen.
test ${TERM/\.*/} = "su" && return 1 #do nothing if inside screen.
screen -q -ls #check if we have any screen sessions running
test $? -ge 10 && screen -xR #and auto login if we do.
}
_resumescreen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment