Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!watmath!clyde!burl!mgnetp!ihnp4!zehntel!hplabs!sri-unix!gwyn@BRL-VLD.ARPA
From: gwyn@BRL-VLD.ARPA
Newsgroups: net.unix-wizards
Subject: Re:  Style question - how to kill process based on user name / tty?
Message-ID: <12443@sri-arpa.UUCP>
Date: Tue, 14-Aug-84 15:09:34 EDT
Article-I.D.: sri-arpa.12443
Posted: Tue Aug 14 15:09:34 1984
Date-Received: Thu, 16-Aug-84 02:19:35 EDT
Lines: 67

From:      Doug Gwyn (VLD/VMB) 

Let the users kill off their own bloody processes.  UNIX is not
supposed to require operators.  I use the following scripts which are
based on versions from Kernighan & Pike:

#!/bin/sh
#	zap -- kill all processes matching pattern
#	adapted from Kernighan & Pike

#	last edit:	84/05/19	D A Gwyn
#	SCCS ID:	@(#)zap.sh	1.1

PATH=/usr/5bin:/bin:/usr/bin
HEAD=/vld/bin/head
PICK=/vld/bin/pick
IFS='
'

sig=
case $1 in
"")	echo 'Usage: zap [-2] pattern' 1>&2; exit 1;;
-*)	sig=$1; shift;;
esac

ps -ag | $HEAD 1

if pdp11
then	exec kill $sig `$PICK \`ps -ag | egrep "$*" | egrep -v 'zap|egrep'\` | awk '{print $2}'`
else	exec kill $sig `$PICK \`ps -ag | egrep "$*" | egrep -v 'zap|egrep'\` | awk '{print $1}'`
fi

#!/bin/sh
#	head -- print first few lines of file

#	last edit:	84/05/19	D A Gwyn
#	SCCS ID:	@(#)head.sh	1.1

PATH=/usr/5bin:/bin:/usr/bin

if [ $# -eq 0 ]
then	n=10
else	case $1 in
	[0-9]*)	n=$1;	shift;;
	*)	n=10;;
	esac
fi

exec sed -e ${n}q $*

#!/bin/sh
#	pick -- select arguments
#	adapted from Kernighan & Pike; to be replaced some day by C version

#	last edit:	84/05/19	D A Gwyn
#	SCCS ID:	@(#)pick.sh	1.1

PATH=/usr/5bin:/bin:/usr/bin

for i
do	echo "$i? \c" > /dev/tty
	read response
	case $response in
	[yY]*)	echo $i;;
	[qQ]*)	break;;
	esac
done < /dev/tty