1#! /bin/sh 2# $Id: killall,v 1.2 2004/09/17 19:56:18 tom Exp $ 3# Linux has a program that does this correctly. 4for prog in $* 5do 6 pid=`ps -a |fgrep $prog |fgrep -v fgrep|sed -e 's/^[ ]*//' -e 's/ .*//' ` 7 if test -n "$pid" ; then 8 echo killing pid=$pid, $prog 9 kill -1 $pid || \ 10 kill -15 $pid || \ 11 kill -9 $pid 12 fi 13done 14