Skip to content

Instantly share code, notes, and snippets.

@wolph
Created June 19, 2012 16:41
Show Gist options
  • Save wolph/2955187 to your computer and use it in GitHub Desktop.
Save wolph/2955187 to your computer and use it in GitHub Desktop.

Revisions

  1. wolph revised this gist Jun 19, 2012. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions screen.sh
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,15 @@
    # 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
  2. wolph created this gist Jun 19, 2012.
    11 changes: 11 additions & 0 deletions screen.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    # If we're not in screen, resume the existing session
    if [[ "$TERM" != screen* ]]; then
    screen -wipe > /dev/null
    screen -q -ls
    if [[ "$?" -ge "10" ]]; then
    exec screen -x
    else
    exec screen
    fi
    fi