Update stop command

This commit is contained in:
Rico Tiongson 2020-04-20 04:01:57 +08:00
parent 0e6c509781
commit e2ab722e71

View File

@ -14,7 +14,19 @@ function start {
# stop running comfortable-swipe commands (except self) # stop running comfortable-swipe commands (except self)
function stop { 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
} }