According to Tom Hawtin
To check the exit code of a Java program, in a Bash script:
#!/bin/bash javac *.java java -ea HelloWorld > HelloWorld.txt exitValue=$? if [ $exitValue != 0 ] then exit $exitValue fi mv HelloWorld.txt ./HelloWorldDir
Melissa
source share