#!/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,文章類型寫成了原創。在此分享,以供大家一起學習。如有不良影響,請聯繫本人刪除。