From e2ab722e71ad2d1bf104894feefcdeb0ee37c06d Mon Sep 17 00:00:00 2001 From: Rico Tiongson Date: Mon, 20 Apr 2020 04:01:57 +0800 Subject: [PATCH] Update stop command --- comfortable-swipe | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/comfortable-swipe b/comfortable-swipe index 4d7d8ca..222881d 100755 --- a/comfortable-swipe +++ b/comfortable-swipe @@ -14,7 +14,19 @@ function start { # stop running comfortable-swipe commands (except self) function stop { - kill -- -$(pgrep -f comfortable-swipe | fgrep -v $$) + local pids="$(pgrep -f comfortable-swipe | fgrep -v $$)" + local stopped="" + for pid in "$pids"; do + # stop process tree + if kill -- -$pid 2> /dev/null; then + stopped=" $(echo $pid)" + fi + done + if [[ ! -z "$stopped" ]]; then + echo "comfortable-swipe stopped" + else + echo "comfortable-swipe is not running" + fi }