if判断:
if [$? -eq 0];then
echo "xxxxxxxxxxx"
else
echo "xxxxxxxxxxxxx"
fi
case判断:
case $name in
xxx)
echo "xxxxxxx"
xxx)
echo "xxxxxx"
esac
for循环:
for i in $(seq 1-3)
do
echo "xxxx"
done
while循环:
i=1
while((i<=10))
do
echo $i
let i++
done
while [1] 永久循环
do
echo"ssssss"
sleep 3
done
while [1]
do
read -p "xxxxx":key
test $key = x -o $key = X
if [$? -eq 0]
then
echo "xxxxxxxxxx"
continue 继续下一个循环
echo "xxxxxxxx" 这里不会被输出
else
echo $key
fi
done