#!/bin/csh
#SCRIPT FEITO POR CYRUZ
echo "Terminais do Utilizador $1"
if ( "$1" == "" ) then
        echo "Usage: $0 <nome do utilizador>"
else
        who > who.txt
        grep $1 who.txt | cut -c10-16 > who_terminal.txt
        set lig=`grep $1 who.txt | wc -l`
        set ter=`cat who_terminal.txt`
        echo "$1 esta ligado: $lig vezes"
        echo "$1 esta ligado nos terminais: $ter"
        rm who.txt
        rm who_terminal.txt
endif
echo "cYruZ SCRIPT"
