Relative Content

Tag Archive for linuxbashshellsh

How to evaluate 2 variables using bash arithematic in if statement with AND operator in bash shell

I have an alphanumeric string, say something like “XXXX24Y2” from which i have extracted only the numbers and assigned them to 2 variables, say num1 and num2, say num1=24 and num2=2
Now i want to check (if num1 <=24 and num2 <2); then do something. I have tried all kinds of brackets double, single, square, with quotes around the variable, without etc. I dont get any errors. Its just that bash wont read that if statement.