Skip to content

Instantly share code, notes, and snippets.

@prozacgod
Created January 19, 2017 16:44
Show Gist options
  • Save prozacgod/84c45069ef856c96b1013334e6b891c6 to your computer and use it in GitHub Desktop.
Save prozacgod/84c45069ef856c96b1013334e6b891c6 to your computer and use it in GitHub Desktop.
very simple screen unique session for linux admin
#!/bin/bash
SCREEN='/usr/bin/screen'
if [ $# -eq 0 ]; then
echo "goscreen <session filter>"
exit 1
fi
PID=`$SCREEN -ls | grep $1 | cut -d. -f1`
if [ -z "$PID" ]; then
echo "Starting new screen session named $1"
screen -S $1
else
echo "Reattaching to existing named session (in shared mode) $1"
screen -r -x $PID
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment