1 --for循环,语法:如果do放在for循环语句在同一行,使用;分隔开
for xx in xx
do
执行的命令
done
# /bin/sh
for each in liming nana zhangsan
do
echo "this is $each"
done
2 --while循环,语法和for一样
#! /bin/sh
echo "please enter your name"
read NAME
while [ "$NAME" != "mayun" ]; do
echo "your name is wrong, please try again"
read NAME
done