Bash script - check if a variable is located between 2 others variables?

In a Bash script I want to check if var1 is located between var2 and var3. But I can't find how to do it.

Something like this.

var1=15
var2=10
var3=20

if [ "$var1" is located beetween "$var2" and "$var3" ]
then
    echo "ok"
else
    echo "not ok"
fi

Can you help me please ?

Thank you.


Assuming that the values are always numeric and by "var1 located between var2 and var3" you mean that var2 < var1 < var3, you can use this:

if (( $var2 < $var1 )) && (( $var1 < $var3 )); then
    echo "ok"
else
    echo "not ok"
fi