#testlogin.sh
username=""
password=""
Prompt
read username
while[$username !="Q"]
do
if [$username!=""]
echo -n "password for $username:"
stty -echo
read password
stty echo
case $username in
root)
echo "hello, root. your password is \"$password\",be careful not to let out your password

;;
*)
echo "hello. $username. your password is \"$password\"."
;;
esac
echo "welcome to the system"
fi
Prompt
read username
done
Prompt()
{
echo "login emulation (Type 'Q' to quit)"
echo -n "login:"
}
——————————————————————————————————————————————————
pangyang@pangyang-desktop:~$ ./testlogin.sh
./testlogin.sh: line 4: Prompt:找不到命令
./testlogin.sh: line 6: while[ !=Q]:找不到命令
./testlogin.sh: line 7: 在未预料的“do”附近出现语法错误
./testlogin.sh: line 7: ` do '