I have the following code in my bash script:
if [[ "$USE_NEW" == "true" ]]; then
echo "Forcing usage of NEW build script"
./android/build/build.new.sh $@
elif [[ $MAJOR > 4 || ($MAJOR = 4 && $MINOR >= 2) ]]; then
echo "Version greater than or equal to 4.2.x.x, running NEW build script"
./android/build/build.new.sh $@
else
echo "Version less than 4.2.x.x, running LEGACY build script"
#./android/build/build.legacy.sh $@
fi
I get an error:
line 149: expected `)'
Line 149 here happens to be the line containing the first elif in my example above. I don't know much about bash scripting and I can't find anything via Google that helps me find out what I'm doing wrong. Can anyone help correct my bash script?
>=is not a valid conditional operator, so it is actually parsed as though it were:$MINOR > = 4. Some operator is needed between the=and the4to make this a valid expression, so bash reports a syntax error.