> How can I get it to do an exact match? From the command > line this works: > > grep '\<emma\>' /etc/passwd Try grep "\b$userid\b" /etc/passwd in the loop.