Hi
i am trying to make a script through which i can get the total number of User and their PID after that kill all Users except the one by which i am currently logged in. (i m using SCO UNIX 5.06)
# id of current usre < total number of current user
USR=`who -u |wc -l`
# id of current user
IAM=`who -u -m |cut -b 43-49 |cut -d " " -f1,2,3,4,5`
# name of current user
IM=`who am i | cut -d" " -f1`
# Process ids of all users
PUID=who -u |grep $IM$ |cut -b 43-49 |cut -d " " -f1,2,3,4,5
# Icremental variable
KILPID=0
# This loop will run until the KLPID VAR not equal to the number of user.
while test ${KILPID} -le $USR
do
if [ $IAM != $PUID]
then
kill -9 $PUID
fi
KILPID=`expr ${KILPID} + 1`
done