Use wc to count number of characters returned, and if it is 0 - the string is empty:
count=$(grep "nouser" /etc/passwd | wc -c) if [ $count -eq 0 ]; then echo "No match found" fi