#! /bin/sh

case $1 in
    -*) signal=$1; shift;;
esac
if [ $# = 0 ]; then
    echo "Usage: $0 [-<signal>] <process>"
    echo 'Kills the process "kdeinit: <process> with signal <signal>"'
	echo "if <signal> is not specified, it defaults to SIGTERM,"
	echo "see kill -l for a list of possible signals"
else
    list=$(ps auwx | grep $USER | awk "/[k]deinit: $1/ {print \$2}")
    if test -n "$list"; then 
        kill $signal $list
    else
        echo 'No process killed'
        exit 1
    fi
fi
