#! /bin/sh # Linux has a program that does this correctly. for prog in $* do pid=`ps -a |fgrep $prog |fgrep -v fgrep|cut -f 1 -d ' ' ` if test -n "$pid" ; then echo killing pid=$pid, $prog kill -1 $pid || \ kill -15 $pid || \ kill -9 $pid fi done