From 7b9e1cc7fb5284ddc852bf5b7f9f79eb69e68961 Mon Sep 17 00:00:00 2001 From: amikelov Date: Mon, 16 Sep 2019 16:00:22 +0300 Subject: [PATCH] fixed bash wrapper error with Java version (as in MIXCR & mitools) --- vdjtools | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/vdjtools b/vdjtools index 1a8262db..8fca4064 100755 --- a/vdjtools +++ b/vdjtools @@ -2,11 +2,24 @@ java="java" -sedString="s/.*1\.\(.*\)\..*/\1/" -jVersion=$($java -version 2>&1 | grep version | awk '{ print $3 }' | sed $sedString) -if [[ $jVersion -lt 7 ]]; -then - echo "Wrong java version. Please use Java 7 or higher." +sedString1="s/\s*\([^.]*\)\..*/\1/" +sedString2="s/.*1\.\(.*\)\..*/\1/" +jVersion=$($java -version 2>&1 | grep version | awk '{ print $3 }' | sed 's:"::g') +jVersion1=$(echo "$jVersion" | sed $sedString1) +if [[ jVersion1 -eq 1 ]]; then + jVersion2=$(echo "$jVersion" | sed $sedString2) + if [[ $jVersion2 -lt 7 ]]; + then + echo "Wrong version of java. Please use Java 7 or higher." + exit 1 + fi + + if [[ $jVersion2 -lt 8 ]]; + then + echo "WARNING: Several issues have been detected while using Java 7. Please consider updateing to Java 8 or higher." + fi +elif [[ jVersion1 -lt 9 ]]; then + echo "Wrong version of java. Please use Java 7 or higher." exit 1 fi