Skip to content

Instantly share code, notes, and snippets.

@denibertovic
Created September 15, 2021 16:16
Show Gist options
  • Save denibertovic/08d90cd72a3ae1c65d4433337512c4a4 to your computer and use it in GitHub Desktop.
Save denibertovic/08d90cd72a3ae1c65d4433337512c4a4 to your computer and use it in GitHub Desktop.
Automatically start screen from .bashrc
# Auto-screen invocation. see: http://taint.org/wk/RemoteLoginAutoScreen
# if we're coming from a remote SSH connection, in an interactive session
# then automatically put us into a screen(1) session. Only try once
# -- if $STARTED_SCREEN is set, don't try it again, to avoid looping
# if screen fails for some reason.
if [ "$PS1" != "" -a "${STARTED_SCREEN:-x}" = x -a "${SSH_TTY:-x}" != x ]
then
STARTED_SCREEN=1 ; export STARTED_SCREEN
screen -RR -S main || echo "Screen failed! continuing with normal bash startup"
fi
# [end of auto-screen snippet]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment