aboutsummaryrefslogtreecommitdiff
path: root/samples/killall
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2021-02-26 09:05:35 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2021-02-26 09:05:35 +0000
commit01b7bcd408fd9e9dc9088b1df5761fcc0971d7e1 (patch)
tree593f2e62b1846058a020ffcecb0ef93eb7ac2153 /samples/killall
parent4dccdce4191d6e2bc3ba9f782b0fe1aa46b743e3 (diff)
Diffstat (limited to 'samples/killall')
-rwxr-xr-xsamples/killall14
1 files changed, 7 insertions, 7 deletions
diff --git a/samples/killall b/samples/killall
index 7030fe22bf29..f8d573babdb6 100755
--- a/samples/killall
+++ b/samples/killall
@@ -1,16 +1,16 @@
#! /bin/sh
-# $Id: killall,v 1.3 2012/06/29 09:39:19 tom Exp $
+# $Id: killall,v 1.4 2019/12/10 23:48:58 tom Exp $
# Linux has a program that does this correctly.
. ./setup-vars
-for prog in $*
+for prog in "$@"
do
- pid=`ps -a |fgrep $prog |fgrep -v fgrep|sed -e 's/^[ ]*//' -e 's/ .*//' `
+ pid=`ps -a |fgrep "$prog" |fgrep -v fgrep|sed -e 's/^[ ]*//' -e 's/ .*//' `
if test -n "$pid" ; then
- echo killing pid=$pid, $prog
- kill -$SIG_HUP $pid || \
- kill -$SIG_TERM $pid || \
- kill -$SIG_KILL $pid
+ echo "killing pid=$pid, $prog"
+ kill "-$SIG_HUP" "$pid" || \
+ kill "-$SIG_TERM" "$pid" || \
+ kill "-$SIG_KILL" "$pid"
fi
done