输入密码显示“*”号

#!/bin/bash
while : ;do
    char=`
        stty cbreak -echo
        dd if=/dev/tty bs=1 count=1 2>/dev/null
        stty -cbreak echo
    `
    if [ "$char" =  "" ];then
        break
    fi
    passwd="$passwd$char"
    echo -n "*"
done

  

posted @ 2020-03-05 17:21  kunsile  阅读(348)  评论(0)    收藏  举报