您的位置:首页 > 运维架构 > Shell

Shell循环输入符合条件为止

2016-07-29 00:46 316 查看
提供用户输入,直到输入d/D/r/R为止。

#!/bin/bash

while [ 1 ]; do

echo -n "(D)ebug or (R)elease?"
read select_build_type

if [[ $select_build_type = "D" || $select_build_type = "d" ]]; then
echo "======================"
echo "Build In Debug Type !"
echo "======================"
break
fi

if [[ $select_build_type = "R" || $select_build_type = "r" ]]; then
echo "======================"
echo "Build In Release Type !"
echo "======================"
break
fi

done
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: