#!/bin/bash

if [ -z "$1" ]; then $0 " "; exit 0; fi
until [ -z "$1" ]; do
    process="${1/;/}"
    pid=($(pidof -x "$process"))

    if [ ${#pid[@]} -gt 0 ]; then
	for p in ${pid[@]}; do
	    baum=$(pstree -p $p)
	    baum="${baum//[!0-9]/ }"
	    bid=($baum)
	    for b in ${bid[@]}; do kill $b; done
	done
    else
	text=$"&#10;Process '$process' unknown!&#10;"
	yad --center --title="del" --fixed --window-icon="gtk-delete" --image="dialog-warning" --borders=20 --text="$text" --text-align=center --button 'OK':0
    fi
    shift
done
