]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/dialog/samples/killall
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / dialog / samples / killall
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.
4 for prog in $*
5 do
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
13 done