if condition
then
command1
command3
command2
fi
if condition
then
command1
...
else
commad1
...
fi
if condition
then
command1
commadn2
...
elif condition
then
commadm
..
else
...
fi
for varname in item1 item2 ... itemN
do
command1
command2
...
commandN
done
while condition
do
command
done
until condition
do
command
done
case value in
p1)
command1
command2
;;
p2)
command1
command2
;;
esac
echo '输入 1 到 4 之间的数字:'
echo '你输入的数字为:'
read aNum
case $aNum in
1) echo '你选择了 1'
;;
2) echo '你选择了 2'
;;
3) echo '你选择了 3'
;;
4) echo '你选择了 4'
;;
*) echo '你没有输入 1 到 4 之间的数字'
;;
esac