When a script accepts a limited set of words, a case statement can reject everything else.

Program

Play the script to choose an environment name and see whether it is allowed.

enum_validation.sh
#!/usr/bin/env bash

environment=
case "$environment" in
    dev|test|prod) status="allowed" ;;
    *) status="unknown" ;;
esac
echo "$environment:$status"
#!/usr/bin/env bash

environment=
case "$environment" in
    dev|test|prod) status="allowed" ;;
    *) status="unknown" ;;
esac
echo "$environment:$status"
enum An enum is a small fixed set of accepted values.
case patterns `dev|test|prod` groups accepted words in one branch.
default branch `*)` catches unknown values so they do not silently pass.