I am using bash shell and expr command.Below is my scripts:
v=`java -version`
echo 'check java platform...'
echo `expr match "$v" 'java'`
Can’t match java substring, just got 0.
But if I use this : v=’java version “1.6.0_34″‘
I got the correct result:4
Why? How to fix it?
try this: