title: Exit code of Java not coming in Bash
body: <p>I have a bash file: </p>
  
  <pre><code>REPOS="$1"
  TXN="$2"
  
  SVNLOOK=/usr/bin/svnlook
  LOGMSG=$($SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]")
  
  echo "\n$LOGMSG" &gt;&gt; /dev/tty
  
  javac ~/Desktop/SomeClass.java
  java ~/Desktop/SomeClass $LOGMSG
  
  STATUS=$? 
  echo "\n" &gt;&gt; /dev/tty
  echo $STATUS &gt;&gt; /dev/tty
  
  exit 0
  </code></pre>
  
  <p>which calls this java file:</p>
  
  <pre><code>public class SomeClass {
  
      public static void main(String[] args) {
          String result = "";
          for (String s: args) {
              result = result + " " + s;
  
          }
  
         String regex = ".*\\bHello\\b.*";
  
         if(result.matches(regex)) {
             System.out.println("It matches");
             System.exit(0);
         } else {
             System.out.println("It does not match");
             System.exit(42);
         }
      }
  }
  </code></pre>
  
  <p>I have never in the Java file have exited with the exit code of <code>1</code>. However when I echo the status in the bash file, it always shows me '1' What can be the reason behind this?  </p>