shell if用法
- 用法1
if [ 1 -eq 1 ]
then
echo "1"
fi
- 用法2
if 条件
then
命令
else
命令
fi
- 用法3
if 条件1
then
命令
elif 条件2
then
命令
else
命令
fi
if [ 1 -eq 1 ]
then
echo "1"
fi
if 条件
then
命令
else
命令
fi
if 条件1
then
命令
elif 条件2
then
命令
else
命令
fi