#!/bin/bash
invalid_user=yes
invalid_passwd=yes
saved_stty=`stty -g`
echo "You are logging into a sensitive area."
echo -n "Please enter your username:"
read USER
#ssty -echo
echo -n "Please enter your password:"
read PSWORD
#ssty $saved_stty
if [ $USER = "huangqs" ];then
invalid_user=no
fi
if [ $PSWORD = "123456" ];then
invalid_passwd=no
fi
if [ "$invalid_user" = "yes" -o "$invalid_passwd" = "yes" ];then
echo "Usage:`basename $0`:Wrong username or password!"
exit 1
fi
echo "Good!"
特别说明:本文是学习David Tansley 《 Linux and UNIX Shell Programming》实体书之后整理的,因本站必需填写url,文章类型写成了原创。在此分享,以供大家一起学习。如有不良影响,请联系本人删除。