]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/dialog/samples/killall
Dtrace: enablings on defunct providers prevent providers from unregistering
[FreeBSD/FreeBSD.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