without using finger command ,This command will display the login name, full name, home directory, and default shell for each of the names given on the command line. If one of the names is not found it should display an error message. If its is entered without any arguments, then the above information should be displayed for all the users logged in to the system at that time. But i don't know how to check if the name is on the system or not !
here's my script so far for (user name) :
read command
if [ "$command" = " myfinger " ]
echo myfinger name
read name
x=$( cat /etc/passwd | grep $userId | cut -d: -f1 )
y=$( cat /etc/passwd | grep $userId | cut -d: -f5 | cut -d_ -f1 )
z=$( cat /etc/passwd | grep $userId | cut -d: -f6 )
w=$( cat /etc/passwd | grep $userId | cut -d: -f7 )
echo login name : $x
echo full name : $y
echo home dir : $z
echo shell : $w
if ( "$name" != " cat /etc/passwd | grep $userId | cut -d: -f5 | cut -d_ -f1 " )
then
echo error : not found
fi
if ( "$name" = null )
cat /etc/passwd | cut -d: -f5 | cut -d_ -f1
fi
fi