File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ VERSION=$1
3
+ VERSION2=$2
4
+ function version_gt() { test " $( echo " $@ " | tr " " " \n" | sort -V | head -n 1) " ! = " $1 " ; }
5
+ function version_le() { test " $( echo " $@ " | tr " " " \n" | sort -V | head -n 1) " == " $1 " ; }
6
+ function version_lt() { test " $( echo " $@ " | tr " " " \n" | sort -rV | head -n 1) " ! = " $1 " ; }
7
+ function version_ge() { test " $( echo " $@ " | tr " " " \n" | sort -rV | head -n 1) " == " $1 " ; }
8
+ if version_gt $VERSION $VERSION2 ; then
9
+ echo " $VERSION is greater than $VERSION2 ."
10
+ fi
11
+ if version_le $VERSION $VERSION2 ; then
12
+ echo " $VERSION is less than or equal to $VERSION2 ."
13
+ fi
14
+ if version_lt $VERSION $VERSION2 ; then
15
+ echo " $VERSION is less than $VERSION2 ."
16
+ fi
17
+ if version_ge $VERSION $VERSION2 ; then
18
+ echo " $VERSION is greater than or equal to $VERSION2 ."
19
+ fi
You can’t perform that action at this time.
0 commit comments