During the automation process, it is helpful to know how a program exited. When that program is called from a command (cmd) or shell (bash) prompt, you can print out the return code using the following commands directly after the command was run and exited:
Windows
echo %ERRORLEVEL%
Linux
echo $?