Check whether a user account exists in Bash
The following conditional will determine if the value of $ACCT is a valid user.
if ! getent passwd $ACCT > /dev/null 2>&1; then
  echo "Invalid Account"
  exit
fi
The following conditional will determine if the value of $ACCT is a valid user.
if ! getent passwd $ACCT > /dev/null 2>&1; then
  echo "Invalid Account"
  exit
fi