#!/bin/bash while echo -n \"Player\'s name?\" read name [ $name != \'ZZZ\' ] do searchresult=$(grep [$name] playername) if [ $searchresult = 0 ] the
grep returns multiple words so shell interprets the if statement as having so many tokens. If you just want to check if there was a match, do this:
if grep "$name" playername &> /dev/null; then # ....