I am trying to perform a OR operation between two sub AND conditions like as follows.
elif [[ $RBIT >= 7000.00 && $RBIT <= 15000.00 ]] || [[ $TBIT >= 7000.00 && $TBIT <= 15000.00 ]]; then
echo #statements;
exit 0;
fi
/script: line 20: syntax error in conditional expression
/script: line 20: syntax error near `7000.00'
/script: line 20: `elif [[ $RBIT >= 7000.00 && $RBIT <= 15000.00 ]] || [[ $TBIT >= 7000.00 && $TBIT <= 15000.00 ]]; then'
Bash supports only integer math. So, you could rewrite your condition as:
elif ((RBIT >= 7000 && RBIT <= 15000)) || ((TBIT >= 7000 && TBIT <= 15000)); then
While dealing with integers, ((...))
is a better construct to use. And $
is optional for variable expansion inside ((...))
expression.
You may want to see this related posts: