ThePretender73 ThePretender73 - 7 months ago 14
Bash Question

Arithmetic statements in bash if clause

Just a quick question about the above stated topic:

I'm currently trying to use a value i am given through read in my if statement:

if [ $value1 -lt $value2 -a $value1 is -ge $value2/2 ]

How is it possible to compare one value to half of another without having to make an equation beforehand?


Use Bash arithmetic:

if (( value1<value2 && value1>=value2/2 )); then