Check status code (e.g. - System.exit(1) ) in Unix

Do you have any idea how to check the Java status code returned from System.exit(int status) in Unix?

In DOS I was able to write this:

java -jar FilePreparation.jar
if not %errorlevel% == 0 goto file_prep_err
...

But I can't find anything equivalent for Unix?
jjungmanAsked:
Who is Participating?
 
wide_awakeConnect With a Mentor Commented:
for example, put this into "test.sh"
-----
#!/bin/bash
java -jar FilePreparation.jar
echo $?
-----
0
 
wide_awakeCommented:
in bash you can use $? to get the exit status of the previous command.

0
All Courses

From novice to tech pro — start learning today.