Метод 1. Использование операторов if, elif и else:
if [ condition1 ]; then
# Code to execute if condition1 is true
elif [ condition2 ]; then
# Code to execute if condition1 is false and condition2 is true
else
# Code to execute if both condition1 and condition2 are false
fi
Метод 2. Использование операторов case:
case "$variable" in
pattern1)
# Code to execute if variable matches pattern1
;;
pattern2)
# Code to execute if variable matches pattern2
;;
*)
# Code to execute if variable doesn't match any patterns
;;
esac
Метод 3. Использование вложенных операторов if:
if [ condition1 ]; then
# Code to execute if condition1 is true
if [ condition2 ]; then
# Code to execute if both condition1 and condition2 are true
else
# Code to execute if condition1 is true and condition2 is false
fi
else
# Code to execute if condition1 is false
fi