Skip to content

Instantly share code, notes, and snippets.

@fapestniegd
Created August 19, 2009 18:11
Show Gist options
  • Save fapestniegd/170535 to your computer and use it in GitHub Desktop.
Save fapestniegd/170535 to your computer and use it in GitHub Desktop.
#!/bin/sh
screencreate(){
if [ -f ~/.screenrc.${UNIQUE} ]; then
screen -S ${UNIQUE} -c ~/.screenrc.${UNIQUE}
else
screen
fi
exit 0;
}
screenattach(){
screen -x `basename ${CONTROL}`
exit 0;
}
## MAIN main ##
SCREENS='/var/run/screen'
[ $# -ne 1 ] && {
echo "USAGE: $0 <uniquename>"
exit 1;
}
UNIQUE=$1; shift 1;
CONTROL=`ls ${SCREENS}/S-${USER}/[0-9]*.$UNIQUE 2>/dev/null`
if [ "${CONTROL}" = "" ]; then
echo create; screencreate ${UNIQUE};
else
echo attach; screenattach ${UNIQUE}
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment