Help with string and substring also I/O

#!/bin/sh

PRINTF=/usr/bin/printf
PASSWD=/etc/passwd

$PRINTF "Enter a UserID\n"
read USERID

if [ -z "`grep "^$USERID:" $PASSWD`" ]; then
        $PRINTF "$USERID does not exist, please contact IT service\n"
        exit 1
fi

USERHOME=`grep "^$USERID:" $PASSWD | awk -F : '{print $6}'`
USERSHELL=`grep "^$USERID:" $PASSWD | awk -F : '{print $7}'`

$PRINTF "User $USERID has a home directory of $USERHOME\n"
$PRINTF "the default shell for this user is $USERSHELL\n" 

Hi all, Ive got some troubles when Im working on my work.
1.how to fix the code to make it successfully deals with USERIDs that are substrings of other userids ?
2.How to trap any error messages generated by programs call by the script using either I/O redirection or pre-validation of program arguments?

This two are part of my assignment, as a new in unix I have done lots of researches but still cannot solve them, can someone help and tell me why(this is important to me, finishing assignment is just beginning)?

Thanks a lot!!!

Is this the same assignment as this one?
http://www.unix.com/shell-programming-scripting/133696-bourne-shell-asking-stuff-bin-sh-urgent.html