How to use logical operators in multiple if statement

Hi
I want to send a status mail if daily or weekly or monthly batch completed or aborted. Here is the code.

if [ "$BatchFrequency" = "Daily" ] && [ "$ModuleBusinessName" = "XYZ" ] && 
[ "$Status" = "COMPLETED SUCESSFULLY" ]  || [ "$Status" = "ABORTED" ]  
 
Else if  [ "$BatchFrequency" = "Weekly" ] && [ "$ModuleBusinessName" = "ABC" ] 
&& [ "$Status" = "COMP LETED SUCESSFULLY" ]  || [ "$Status" = "ABORTED" ]  
 
Else if  [ "$BatchFrequency" = "Monthly" ] && [ "$ModuleBusinessN ame" = "PQR" ] 
&& [ $Status" = "COMPLETED SUCESSFULLY" ] || [ "$Status" = "ABORTED" ] 
then
mailx �s �Status Report� sumone@sumthing.com 
else 
print  �try again�

Plz suggest the changes.

for AND (&&) use --> "-a" option
for OR (||) use --> "-o" option
eg.,
if [ "$BatchFrequency" = "Daily" -a "$ModuleBusinessName" = "XYZ" -a "$Status" = "COMPLETED SUCESSFULLY" -o "$Status" = "ABORTED" ] 

i think, this might help you.

The logical AND and OR conditions will remain same. Use "elif" in place of "[FONT=Arial]Else if" and after the final else with the associated statement end the if block with "fi" .

Eg:

if [ $int1 = $int2 ]
then
       echo "int1 is equal to int2"
elif [ $int1 > $int2 ]
then
       echo "int1 is greater than int2"
else
     echo "int1 is smaller than int2"
fi

Alternative Way:

is equal to: eq
is not equal to: ne
is greater than: gt
is less than: lt
is greater than or equal to: ge
is less than or equal to: le

-a is same as using &&
-o is same as using ||

Note: Padding of space is mandatory before using '[' and ']'

Thank you.

Place the mail part script in a function and try for checking the conditions..
And if your using double square brackets then use && or || , for single square bracket you can use -a or -o

 #!/bin/ksh
func_mail()
{
 mailx -s �Status Report� sumone@sumthing.com 
}
 
if [[ "$BatchFrequency" = "Daily" && "$ModuleBusinessName" = "XYZ" && "$Status" = "COMPLETED SUCESSFULLY" || "$Status" = "ABORTED"  ]]
then
        func_mail
elsif [[ "$BatchFrequency" = "Weekly" && "$ModuleBusinessName" = "ABC" && "$Status" = "COMPLETED SUCESSFULLY" ||"$Status" = "ABORTED" ]]
then
       func_mail
elsif [[ "$BatchFrequency" = "Monthly" && "$ModuleBusinessName" = "YUI" && "$Status" = "COMPLETED SUCESSFULLY" ||"$Status" = "ABORTED" ]]
then
       func_mail
else
       echo "Try again"
fi