I am running Mathematica from the command line using more or less the method discussed here:
Call a Mathematica program from the command line, with command-line args, stdin, stdout, and stderr
I am just wondering; how do I control the exit code that the command line sees? For example, I am running my Mathematica code many times via a loop in a Bash script, and I want to terminate the loop if an exit(FAIL) is seen, i.e. the return code being greater than 0. That is, I want to terminate the Mathematica code early if something bad happens, and pass this information on to the calling script so I can abort the loop. I assume it must be possible, but I don't see anything about return codes in the documentation for e.g. Exit[].