github.com/milvus-io/milvus-sdk-go/v2@v2.4.1/scripts/check_protoc_version.sh (about)

     1  #!/bin/bash
     2  
     3  currentVersion="$(protoc --version)"
     4  parts=($currentVersion)
     5  
     6  if [ "${parts[0]}" != "libprotoc" ]; then
     7      echo "no libprotoc found"
     8      exit 1
     9  fi
    10  currentVersion=${parts[1]}
    11  requiredVersion="3.0.0"
    12  
    13  if [ "$(printf '%s\n%s' "$currentVersion" "$requiredVersion" | sort -V| head -n1)" = "$requiredVersion" ]; then
    14      echo "protoc version $currentVersion, ok"
    15      exit 0
    16  else
    17      echo "protoc version needs to be greater than $requiredVersion, but $currentVersion found"
    18      exit 1
    19  fi
    20  
    21