shell编程 - 终端设置
1. 获取终端信息
# 获取终端的列数
tput cols
# 获取终端的行数
tput lines
# 获取终端名称
tput longname
2. 移动光标
# 移动光标到(10,80)处
tput cup 10 80
3. 设置终端
# 设置背景色
tputsetb n # n为0-7的数字
# 设置文本前景色
tputsetf n # n为0-7的数字
# 设置文本样式为粗体
tput bold
4. 设置下划线
# 设置下划线开始
tput smul
# 设置下划线结束
tput rmul
5. 删除内容
# 删除从当前光标位置到行尾的所有内容
tputed
6. stty 禁止输出到终端
echo -e "Enter password: "
# 禁止将输出发送到终端
stty -echo
read password
# 允许将输出发送到终端
stty echo
echo
echo "the password is $password"