`
zcjl
  • 浏览: 41700 次
  • 性别: Icon_minigender_1
  • 来自: 70码之城
社区版块
存档分类
最新评论

[ZT]读取密码的shell实例

阅读更多
#!/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
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics