summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xt27
1 files changed, 27 insertions, 0 deletions
diff --git a/t b/t
new file mode 100755
index 0000000..73ad51d
--- /dev/null
+++ b/t
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+unset SPAWN
+
+while getopts "t:r:a:" o; do case "${o}" in
+ t)
+ if pgrep -Uzachir -x "$OPTARG" >/dev/null 2>&1; then
+ pkill -Uzachir -x "$OPTARG"
+ exit
+ else
+ SPAWN="$OPTARG"
+ fi
+ ;;
+ r)
+ if pgrep -Uzachir -x "$OPTARG" >/dev/null 2>&1; then
+ pkill -Uzachir -x "$OPTARG"
+ fi
+ SPAWN="$OPTARG"
+ ;;
+ a)
+ ARGS="$ARGS$OPTARG "
+ ;;
+esac done
+
+sleep 0.1
+[ -n "$SPAWN" ] && exec "$SPAWN" $ARGS &
+