- #!/bin/bash
- #tput 和 stty 是两款终端处理工具
- # 获取列数和行数
- tput cols
- tput lines
- # 打印当前终端名
- tput longname
- # 移动光标 移动光标到 100 100
- tput cup 100 100
- # 设置终端背景色 0-7
- tput setb 0
- # 设置终端前景色 0-7
- tput setf 7
- tput bold #设置粗体
- # 设置下划线的起止:
- tput smul
- tput rmul
- # 删除从当前光标位置到行尾的所有内容:
- tput ed
- tput sc# 保存光标的位置
- tput rc# 恢复光标到上一次保存的位置
- #stty 实现不显示输入内容
- echo -e "输入密码:"
- stty -echo
- read password
- stty echo
- echo
- echo password read.
- # 选项 - echo 禁止将输出发送到终端, 而选项 echo 则允许发送输出
来源: http://www.bubuko.com/infodetail-2855254.html