Shell循环输入符合条件为止

提供用户输入,直到输入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

 

posted @ 2016-07-29 00:46  pcwen.top  阅读(993)  评论(0编辑  收藏  举报
pcwen.top