I am running a java program from within a Bash script. If the java program throws an unchecked exception, I want to stop the bash script rather than the script continuing execution of the next command.
How to do this? My script looks something like the following:
#!/bin/bash
javac *.java
java -ea HelloWorld > HelloWorld.txt
mv HelloWorld.txt ./HelloWorldDir