#!/bin/csh
# The missing command between "w" and "who"
# One arg: Gives info on specific username

alias 'who' 'who | grep -v "dtremote"'
alias 'wh' 'echo "Local:";who|sort|grep -v "(";echo "";echo "Remote:";who|sort|grep "("'

if ( $#argv == 0 ) then
 wh
else
 set k = ( `(wh) | grep "^$1 "` )

 if ( $#k < 2 ) then
  echo "User $1 is not logged in."
  exit 1
 endif

 @ r = `echo $k[$#k]|grep -c "^("`

 echo -n "User $1 has been logged in "

 if ( $r == "1" ) then
  echo -n "from $k[$#k] "
 endif

 echo "since $k[5] ($k[3] $k[4]) on $k[2]."

endif

