If I run the command
export BW_SESSION="$(bw unlock --raw)"
and provide an incorrect password, then BW_SESSION gets set to “Invalid master password.” and the error message does not get printed to the terminal.
In this situation, it would be much more useful if the message was printed to stderr and nothing to be printed to stdout. This way, users would get error messages in the terminal and the env var would pass the test
[ -z $BW_SESSION ] afterwards.