Created
January 19, 2017 16:44
-
-
Save prozacgod/84c45069ef856c96b1013334e6b891c6 to your computer and use it in GitHub Desktop.
very simple screen unique session for linux admin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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