Question:
I am calling a java program from a Unix script and passing three
parameters. Once the Java program is done, I want to return two values
back to the Unix program from the Java program.
How do I return data back
from a Java program to a Unix script?
Answer:
The simplest, and perhaps best, way to do this is to print the values to
standard output and parse them in the script. It is normal for shell
scripts to use the printed output of other programs in one way or
another.
Another alternative is to write the values to a file. Other
forms of interprocess communication can be used, but provide overly
complicated solutions for the simple case of returning values to a
script.