How to use logical OR and logical AND in a bash script
The operators used in bash scripting for logical OR and logical AND are “||” and “&&” respectively.
The following snippet shows example usage of logical OR operator.
if [ "$a" -eq 30 ] || [ "$b" -eq 40 ]; then
echo The logical OR condition met
else
echo The logical OR condition not met
fi
The following snippet shows example usage of logical AND operator.
if [ "$a" -eq 24 ] && [ "$b" -eq 47 ]; then
echo The logical AND condition met
else
echo The logical AND condition not met
fi

