知乎专栏 |
显示终端屏幕的尺寸
$ resize COLUMNS=151; LINES=46; export COLUMNS LINES;
设置终端屏幕的尺寸
eval `resize`
tset -e ^? 设置Backspace删除前面一个字符 tset -k ^C 设置删除一行
建议使用stty替代tset
$ stty speed 38400 baud; line = 0; eol = M-^?; eol2 = M-^?; swtch = M-^?; ixany iutf8 $ stty -a speed 115200 baud; rows 46; columns 151; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = M-^?; 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
OLDCONFIG=`stty -g` # save configuration stty -echo # do not display password echo "Enter password: \c" read PASSWD # get the password stty $OLDCONFIG # restore configuration