I need to add to a BASH script if ${USER} is not in a list of users (smitha, brownd, adamsp) then do something... what is the best shortest way to accomplish an if statement with a list like this? Also the list of users should be in the script, not an external file.
$? gives you the exit status of the latest command executed. In this case if this
echo 'smitha, lucyb, johnk' | grep -q ${USER}
is successfully done, then $? will be 0, else it will be 1 (or any other value between 1 and 255). Then you use that value to check if the users was found or not.