Shell循环输入符合条件为止

时间:2023-03-08 17:20:10

提供用户输入,直到输入d/D/r/R为止。

#!/bin/bash

while [  ]; 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