法一: vim
[root@Carlton scripts]# vim passwd #/bin/bash read -p "enter passwd:" -s pwd echo echo passwd read,is "$pwd" ~
法二: bash
#!/bin/bash stty -echo read -p "輸入密碼:" pwd stty echo echo echo 輸入完畢。