checking for script errors

ok, i have a script which i use to search my process' for specific keywords and kill any process containing them. there is a prompt to enter a keyword for searching and another prompt for which user you want to search the process' of. i want the script to have something that if you entered a search term that is not found or a nonpresent user to return a "incorrect search terms, re-enter a keyword or user that can be found" and the prompt would pop back up. this would be instead of a bunch of "no such pid" or other kinds of error messages. that may be a little confusing but is there any way to do what im trying?

thanks, blip

Look up "man grep" and check out the section on using the "$?" combo as a way to see if the grep was successful or not... those same symbols return a code on whether or not a lot of commands were successful.