They probably meant for the check to be:
if ! getent passwd snmp >/dev/null
i.e., check exit status ($?).
They probably meant for the check to be:
if ! getent passwd snmp >/dev/null
i.e., check exit status ($?).