linux shell之tput和stty

来源:互联网 发布:事业单位会计软件 编辑:程序博客网 时间:2024/06/08 18:35

tput和stty两种终端处理工具

输出终端的行数,终端最大可以有多少个字符
tput cols
输出终端列数,当前光标所在的列离起始有多少字符
tput lines

输出终端的名字
tput longname
将光标移动到(x,y)坐标
tput cup 100,20
设置终端背景颜色(0-7)
tput setb 1
设置终端字体颜色(0-7)
tput setf 6
设置终端的起止
tput smul
tput rmul

stty常用的命令是如果输入密码时,终端显示为空
stty -echo:不输出到终端,与echo命令相反

#!/bin/bashecho "please input your name"read userechoecho "please input your password"stty -echoread passwordstty echoechoecho "name:${user}"echo "password:${password}"
原创粉丝点击