【1.1】shell基本实践——密码输入三次错误则结束
function checkPwd() { pwdCount=1 read -s -p "Please input the password: " thePwd clear while true; do if [ "${pwdCount}" -ge 3 ]; then echo "bye" exit 1 fi if [ "$thePwd" = "123456" ]; then break else echo "Error: The password is error." echo read -s -p "Please input the password: " thePwd clear fi pwdCount=`expr ${pwdCount} + 1` done }