Gmt modern mode when specifying non existing output format (ps to stdout)

When specifying an output format that does not exist (in this case due to a typo), pscoast goes renegade (i.e. classic mode), and outputs postscript to stdout. E.g.

$ gmt begin test PDf; gmt pscoast -W -JX10c -RNO; gmt end

Suggestion: If possible, gmt begin […] should check if the specified output format is valid. If not, stop the script. Not sure how this would be implemented.

For those interested;

set -e stops the script on errors. Prevents the problem described. Works on bash, may work in other shells as well.