mercredi 11 février 2015

Bash check java version - not comparing strings properly

Can anyone see what I have done wrong here?



local VERSION=$(java -version 2>&1 | grep "java version")
if [[ ! "$VERSION" =~ *"1.8.0_33"* ]]; then
ERROR (not code, just place holder)
else
NO ERROR (not code, just place holder)
fi


Thanks for the quick help!


* UPDATE *


Here is what else I have tried:



local VERSION=$(java -version 2>&1 | grep "java version")
if [[ "$VERSION" != *"1.8.0_33"* ]]; then
Error blah blah not using 1.8.0_33
else
Good to go
fi


This is in a function all by itself. No other nested anything.


GNU bash, version 4.2.37(1)-release (arm-unknown-linux-gnueabihf)


Aucun commentaire:

Enregistrer un commentaire