You can use `printenv <key>` which will return with a non-zero exit code if the key isn't found.