Limit_Condition() { let count++ if [[ ${count} == 3 ]];then echo "超过3次机会,自动关停脚本" exit 1 fi Comfirm() { count=0 while true;do read -t 30 -p "${1}" ENTER case "${ENTER}" in y|Y) break ;; n|N) echo "${2}" ${3} ;; "") echo "输入超时,请重新输入..." Limit_Condition : ;; *) echo "输入错误,请重新输入..." Limit_Condition : ;; esac done }
时间: 2024-12-10 11:51:26