[sllug-members]: BASH Syntax Question
Knight Walker
kwalker at kobran.org
Tue Jan 5 11:51:34 MST 2010
I've got a BASH syntax question that I am not able to figure out after a
lot of googling and reading online HOWTOs.
I would like to check two numeric values in one if statement. In C and
other languages, this looks like this:
if((value1 < somenumber) || (value1 > someothernumber)) {
some_function();
} else if ((value2 < somenumber) || (value2 > someothernumber)) {
some_other_function;
}
But I can't for the life of me figure out how to do that in Bash. I can
check a single expression but that duplicates a lot of stuff and it
annoys me. Anyone know the magic Bash incantation for something like
this? I've tried parentheses and brackets and they all throw errors
about numeric expressions (These are single-digit floats) or they throw
generic syntax errors.
Thanks.
-KW
More information about the sllug-members
mailing list