#!/bin/bash
ReadPassword(){
#turn off terminal echo to prevent peeping!
echo -n ">>> "$1
stty_orig=`stty -g`
stty -echo
read tempstr
stty $stty_orig
eval "$2=$tempstr"
echo "******"
}
ReadString(){
echo -n ">>> "$1
read tempstr
eval "$2=$tempstr"
}
ReadPassword "Please input your password:" MYPASSWD
echo $MYPASSWD
[ZT]读取密码的shell实例
最新推荐文章于 2024-01-03 15:28:17 发布