Skip to content

Instantly share code, notes, and snippets.

@intarstudents
Created November 29, 2011 22:58
Show Gist options
  • Save intarstudents/1407009 to your computer and use it in GitHub Desktop.
Save intarstudents/1407009 to your computer and use it in GitHub Desktop.
screentab
#!/bin/sh
error() { echo "$@" 1>&2; exit 1; }
[ $# -gt 1 ] ||
error "must provide screen session name and command"
session="${1}"
shift;
found=$(screen -ls | awk '-F\t' '$2 ~ m {print $2}' "m=[0-9]+[.]$session$")
if [ -z "$found" ];
then
screen -dmS $session $@
exit 0;
else
error "screen already running"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment