stty -a
speed 38400 baud; rows 28; columns 115; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q;
stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
beyes@linux-xh53:~> stty < /dev/pts/0
speed 38400 baud; line = 0;
-brkint -imaxbel
#!/bin/sh
echo "Enter password: "
read PASSWD
echo $PASSWD
beyes@linux-xh53:~> sh stty.sh
Enter password: #输入密码
hello world #这个不好,密码被显示出来了
hello world
stty -echo
#!/bin/sh
OLDCONFIG=`stty -g`
stty -echo
echo "Enter password: "
read PASSWD
echo $PASSWD
stty $OLDCONFIG
#!/bin/sh
read val
echo $val
#!/bin/sh
SAVEDSTTY=`stty -g`
stty -icanon
read val
echo $val
stty $SAVEDSTTY
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |