diff --git a/Donnagurai b/Donnagurai index 9f0fa8c..cf9e0fc 100755 --- a/Donnagurai +++ b/Donnagurai @@ -37,6 +37,18 @@ flags() if [[ $1 =~ ^[0-9].*$ ]]; then PIDS+=("$1") export PIDS + elif [[ $1 =~ ^[a-z].*$ ]]; then + procs=$(ps aux | grep $1 | grep -v grep | grep -v "$(pwdx $$ | awk '{print $NF}')") +# exclude the path of the current script PID ^ + if [[ -n "$procs" ]]; then + for proc in "$procs"; do + proc_pid=$(echo "$proc" | awk '{print $2}' | grep -v "$(pwdx $$)") + if [[ -n $(ps aux | grep "$proc_pid") ]]; then + PIDS+=("$proc_pid") + export PIDS + fi + done + fi elif [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then help else