I have a script that basically checks the Java version on the box it's running on and does whatever based on the version number.
My problem is that I want to use the same command on both SunOs and Linux boxes.
The closest I have come to this is...
SunOs:
java -version 2>&1 | nawk -F '"' '/version/ {print $2}'
This gives the expected output of 1.7.0_09
and...
Linux:
java -version 2>&1 | awk -F '"' '/version/ {print $2}'
This gives the expected output of 1.8.0_05
I want to know if I can get the same result, with the same command on the different OS's