shell实现输入密码显示星号

来源:互联网 发布:ubuntu 卸载adb命令 编辑:程序博客网 时间:2024/05/16 17:05
read -p "请输入使用者都名称:" USER       echo -e "请输入使用者密码: \c"        while : ;do                char=` #这里是反引号,tab键上面那个                        stty cbreak -echo                        dd if=/dev/tty bs=1 count=1 2>/dev/null                        stty -cbreak echo                ` #这里是反引号,tab键上面那个                if [ "$char" =  "" ];then                        echo  #这里的echo只是为换行                        break                fi                PASS="$PASS$char"                echo -n "*"        done
0 0
原创粉丝点击