if
if [ ! -d /root ]
then
echo "这不是目录,请重新输入"
continue
else
echo "这是目录"
break
fi
for
for循环用法
for i in 1 3 5 7
do
echo $i
echo ok
done
while
while read -p "大哥来点啥?" a
do
"这个卖没了"
done
break 结束循环 脚本继续执行
continue 跳出本次循环
select挑选
echo '大哥来点啥?'
select a in "西瓜" "苹果" "橘子" "结账"
do
case $a in
"西瓜")
echo "大哥西瓜200块一斤"
;;
"苹果")
echo "苹果便宜点 500一斤"
;;
esac
done