#! /bin/sh

PATH=/usr/ucb:$PATH

login=$1

# this gives us the PIDs for each process
procs=`ps auxww | awk '$1 == login { print $2 }' login=$login`

# This takes care of the problem when a login doesn't have any processes
# running
if test "$procs"
then
  # Since the value of procs is a list of PIDS, we use -w.
  # Use sed to get rid of odd spacing (for prettier output).
  num=`echo $procs | wc -w | sed -e 's/ //g'`
  echo "$login $num"
else
  echo "$login 0"
fi

