Is there any way to compare such strings on bash, e.g.: 2.4.5
and 2.8
and 2.4.5.1
?
You can use version CLI to check version's constraints
$ version ">=1.0, <2.0" "1.7"
$ go version | version ">=1.9"
Bash script example:
#!/bin/bash
if `version -b ">=9.0.0" "$(gcc --version)"`; then
echo "gcc version satisfies constraints >=9.0.0"
else
echo "gcc version doesn't satisfies constraints >=9.0.0"
fi