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
alias
one of the commands or create a simbolic link, or should this be universal? If so, you could check for the existence of either program and specify the respective command in anif
loop. – FelixJN Aug 14 '15 at 08:19if
, easier than bashing head over something trivial – gwillie Aug 14 '15 at 08:26