File indexing completed on 2024-12-22 05:21:24

0001 #! /bin/sh
0002 
0003 case $1 in
0004     -*) signal=$1; shift;;
0005 esac
0006 if [ $# = 0 ]; then
0007     echo "Usage: $0 [-<signal>] <process>"
0008     echo 'Kills the process "kdeinit4: <process> with signal <signal>"'
0009         echo "if <signal> is not specified, it defaults to SIGTERM,"
0010         echo "see kill -l for a list of possible signals"
0011 else
0012     list=$(ps auwx | grep $USER | awk "/[k]deinit[4|]: $1/ {print \$2}")
0013     if test -z "$list"; then
0014         # on newer Linux kernels (>= 2.6.10) KDE is able to use 
0015         # prctl(PR_SET_NAME) to change the process name...
0016         list=$(ps auwx | grep $USER | awk "/\[kdeinit[4|]\] $1/ {print \$2}")
0017     fi
0018     if test -z "$list"; then
0019         # with KDE 3.4 we changed the view again...
0020         list=$(ps auwx | grep $USER | awk "/$1 \[kdeinit[4|]\]/ {print \$2}")
0021     fi
0022     if test -n "$list"; then 
0023         kill $signal $list
0024     else
0025         echo 'No process killed'
0026         exit 1
0027     fi
0028 fi