Another option is:
[[ $MONGOLAB && $APP_PORT && $ENV ]] || exit 1
If you happen to run a long sanity check with multiple variables, and the code becomes ugly, I suggest to use @anubhava's solution, which is far more elegant.
I usually use a die function instead of exit 1 to be more descriptive to the user in terms of human readable description and exit status code:
## # die (optional status version): Print a message to # stderr and exit with either the given status or # that of the most recent command. # Usage: some_command || die [status code] "message" ["arguments"...] # die() { local st="$?" if [[ "$1" != *[^0-9]* ]]; then st="$1" shift fi warn "$@" exit "$st" }
This function is taken from Common utility functions (warn, die) which I encourage you to read further, and maybe use a different version which suites your needs best. Notice that die uses a function named warn which you can find in the same link above.
P.S.
Please note that by convention, environment variables (PATH, EDITOR, SHELL, ...) and internal shell variables (BASH_VERSION, RANDOM, ...) are fully capitalized. All other variable names should be lowercase. Since variable names are case-sensitive, this convention avoids accidentally overriding environmental and internal variables.