单分支结构---------------一次判断使用,条件成功时执行then中内容,不成功则退出判断
if 条件判断表达式;
then
条件判断表达式成立时执行的操作
.......
fi


双分支结构---------------一次判断使用,条件成功执行then中内容,条件不成功执行else中内容
if 条件判断表达式;
then
条件判断表达式成立时执行的操作
else
条件表达式不成立执行的操作
fi


---------多分支结构-------多次判断时使用,条件成功时执行then中内容,只要有一个条件不满足则输出else内容
if 条件判断表达式;
then
条件判断表达式成立时执行的操作
elif 条件判断表达式;
then
条件判断表达式成立时执行的操作
else
条件表达式不成立执行的操作
fi




----------------if嵌套使用-------------

一个if只能使用一个else但是then中或者else中可以嵌套if使用
if 条件判断表达式;
then 条件判断表达式成立时执行的操作
else
   if 条件判断表达式;
   then echo "ok"
   else  echo "no"
fi

if [ 2 == 1 ]
then
echo "yes 111"
else
        if [ 3 == 2 ]
        then
        echo "yes  2"
        else
        echo "no 2"
        fi
fi