模拟登录
#!/bin/bash
tname="admin"
tpasswd="123"
name=''
passwd=''
function login(){
echo "请输入用户名:"
read name
echo "请输入密码:"
read passwd
}
function check(){
if [ ${tname} == ${name} -a ${tpasswd} == ${passwd} ]; then
echo "登录成功"
exit 0
fi
main
}
function main(){
login
check
}
main