判断密码是否正确

#!/bin/bash
str="sc30"
for ((i=1;i<=3;i++));do
read -p "请输入第$i次密码:" sc
if [ $sc ]; then
if [ $sc = $str ];then
echo "密码输入正确"; break
fi
else
echo "密码输入错误,第$i次"
fi
donebash

相关文章
相关标签/搜索