diff options
-rwxr-xr-x | t | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -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 & + |