tput

tput : 改变终端显示特性,常见用法如下:

tput lines : 显示终端的行数

tput cols : 显示终端的列数

tput cup line_number collum_number : 定位光标到 line_number 行,collum_number 列的位置

tput setb n : 其中 n 为 0-7 的数字,设置终端的背景颜色

tput setf n : 其中 n 为 0-7 的数字,设置终端的前景色,即字体的颜色

tput sc : 保存光标的位置

tput rc : 恢复光标到上一次保存的位置

tput ed : 清空光标所在位置到屏幕结尾的所有内容

tput smul : 设置下划线

tput rmul : 移除下划线

tput bold : 设置文本样式为粗体

tput setb 6 tput setf 4
  • 0:黑色
  • 1:蓝色
  • 2:绿色
  • 3:青色
  • 4:红色
  • 5:洋红色
  • 6:黄色
  • 7:白色

猜你喜欢

转载自www.cnblogs.com/guxuanqing/p/9392524.html