]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/dialog/samples/killall
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / dialog / samples / killall
1 #! /bin/sh
2 # $Id: killall,v 1.3 2012/06/29 09:39:19 tom Exp $
3 # Linux has a program that does this correctly.
4
5 . ./setup-vars
6
7 for prog in $*
8 do
9         pid=`ps -a |fgrep $prog |fgrep -v fgrep|sed -e 's/^[ ]*//' -e 's/ .*//' `
10         if test -n "$pid" ; then
11                 echo killing pid=$pid, $prog
12                 kill -$SIG_HUP $pid || \
13                 kill -$SIG_TERM $pid || \
14                 kill -$SIG_KILL $pid
15         fi
16 done