Created
November 29, 2011 22:58
-
-
Save intarstudents/1407009 to your computer and use it in GitHub Desktop.
screentab
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/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