执行语句
for NUM in {1..10}
do
if [ "$NUM" = "3" ]
then
echo THREE -----------如果是3就输出THREE
continue (break/exit) ------相当于把3代替为THREE(截止到THREE就结束但是不影响语句外的命令/直接退出脚本)
fi
echo $NUM -----输出么一个数字
done
======================================
一、
for(为循环执行动作)
格式1:
for WESTOS in $(seq 1 2 10) ------从1开始每隔2个
do
echo $WESTOS
done
格式2:
for WESTOS in westos linux
do
echo $WESTOS
done
格式3:
for ((WESTOS=0;WESTOS<10;WESTOS++))
do
echo $WESTOS
done
===============================
二、
条件语句
1、while(条件为真执行)
while ture
do
done
2、until(条件为假)
until false ----与while逻辑相反
do
done
3、if(作为判定条件)
if
then
elif
then
else
fi
==============================
三、
case
case $1 in
westos|WESTOS)
action1
;;
westos2|WESTOS2)
action1
;;
*)
action3
esac
==========================================
三、运算