Skip to content

Instantly share code, notes, and snippets.

@josteink
Created April 28, 2017 09:41
Show Gist options
  • Save josteink/f63909659bf76231969291410c74b108 to your computer and use it in GitHub Desktop.
Save josteink/f63909659bf76231969291410c74b108 to your computer and use it in GitHub Desktop.
Screen glue
#!/usr/bin/env bash
~/bin/screen-create-or-attach ever-session weechat
#!/usr/bin/env bash
SESSION_NAME=$1
shift
ARGS=$*
SESSION_COUNT=`screen -ls $SESSION_NAME | grep $SESSION_NAME | wc -l`
if [ $SESSION_COUNT -eq 0 ] ; then
echo -n "No session found. Starting one..."
screen -dmS $SESSION_NAME $ARGS
echo " Done!"
fi
echo -n "Attaching to session..."
screen -Adr $SESSION_NAME
echo " Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment