How to Use Multiple if Conditions in Shell script

if [[ "$val" -ge "36000" -a "$val" -le "42000" ] -o [ "$val" -ge "60000" -a "$val" -le "66000" ]]
then
echo "Expected valid value"

The above multiple if condition is NOT working in my script.
I am getting the error as '-a' not expected. Can anyone help with the syntax for this?

depending on your shell, you may need to write like this...

if [[ ( "$val" -ge "36000" ) && ( "$val" -le "42000" ) ]] || [[ ( "$val" -ge "60000" ) && ( "$val" -le "66000" ) ]]

if it does not work, let me know your shell.

Thank you sir..It is working..
Can you please tell me what was the problem with my script? is it depends on the shell?

Yes. it depends on shell. In bash you use -a -o not in ksh.
and I have formatted your if command to make it more readable.

Thanks for the quick reply

No need for the use of '[[ ]]" twice within the if statement. It can be done with a single test.

if [[ ( "$val" -ge "36000"  &&  "$val" -le "42000" ) || ( "$val" -ge "60000"  &&  "$val" -le "66000" ) ]]

It can also be done more easily and cleanly using (( )) which works for both ksh and bash

if (( ( val > 36000  &&  val < 42000 ) || ( val > 60000  &&  val < 66000 ) ))