I've used this:
#!/bin/ksh
# This line gets the process number for the value passed in the
# command (java, for WebSphere) and writes the PID only to
# a text file.
PID=`ps -e | grep $1 | awk '{ print $1 }' > /home/utility/bin/pid.txt`
# This line cats the file created in the line above and says while
# catting the file, read each line.
cat /home/utility/bin/pid.txt | while read LINE
# This line tells the system to do a kill -9 on each PID that is
# listed in the pid.txt file. There will alwasy be an error message
# because the grep for the process is also listed but by the time
# the kill command is executed, the grep has already died.
do kill -9 $LINE
# This line closes up the do line.
done
The command syntax is:
scriptname.sh process_name
Check to make sure what your output is for ps -e and test!