原文:http://bash.cyberciti.biz/misc-shell/shel-to-accept-password/
PASS="ABC123"定义密码 以下是该shell脚本的源代码:
#!/bin/bash
# Script accept password using read commnad
# Not *very secure*, this script is for learning purpose only
# -------------------------------------------------------------------------
PASS="abc123"
read -s -p "Password: " mypassword
echo ""
[ "$mypassword" == "$PASS" ] && echo "密码正确" || echo "密码输入错误"
|