linux shell编程指南第二十一章------创建屏幕输出
来源:互联网 发布:oracle导出数据库脚本 编辑:程序博客网 时间:2024/05/29 15:50
要一个彩色监视器和t p u t命令。
本章内容有:
• tput命令。
• 使用转义序列和产生控制码。
• 使用颜色。
作者写这本书时,遇到了t p u t命令的三种不同变形。至今为止最好的是GNU tput,如果没
有这个版本,首先下载它并安装在你的系统里。t p u t使用文件/ e t c / t e r m i n f o或/ e t c / t e r m c a p,这
样就可以在脚本中使用终端支持的大部分命令了。
虽然t p u t不识别颜色设置,但是可以使用控制字符实现这一点。
在使用t p u t前,需要在脚本或命令行中使用t p u t命令初始化终端。
$ tput init
t p u t产生三种不同的输出:字符型、数字型和布尔型(真/假)。以下分别介绍其使用功能。
设置tput命令
可以取得所有t p u t名字输出,将其保存为更有意义的变量名。格式如下:
variable_name='tput name'
[root@localhost huangcd]# cat tput1
#!/bin/bash
STATUS_LINE=`tput hs`
if $STATUS_LINE
then
echo "your terminal has a status line"
else
echo "your terminal has NO status line"
fi
BELL=`tput bel`
CLEAR=`tput cols`
echo $BELL
echo $CLEAR
[root@localhost huangcd]# sh tput1
your terminal has a status line
80
[root@localhost huangcd]# tput bold
[root@localhost huangcd]# tput bel
[root@localhost huangcd]# tput civis
[root@localhost huangcd]# tput cnorm
[root@localhost huangcd]# tput smul
[root@localhost huangcd]# tput rmul
[root@localhost huangcd]# tput rc
[root@localhost huangcd]# tput rev
[root@localhost huangcd]# tput sgr0
[root@localhost huangcd]# tput cols
80
[root@localhost huangcd]# tput it
8
[root@localhost huangcd]# tput lines
24
- linux shell编程指南第二十一章------创建屏幕输出
- linux shell编程指南第二十二章------创建屏幕输入
- linux shell编程指南第五章------shell输入与输出
- linux shell编程指南第五章------shell输入与输出1
- 《Linux命令行与shell脚本编程大全》 第二十一章 学习笔记
- 《LINUX与UNIX_Shell编程指南》读书笔记第5章shell输入与输出
- linux shell编程指南第十五章------引号
- LINUX与UNIX SHELL编程指南--(5)shell输入与输出 管道
- linux shell编程指南第十四章------环境和shell变量
- linux shell编程指南第十六章------shell脚本介绍
- linux shell编程指南第十九章------shell 函数
- linux shell编程指南第十九章------shell 函数1
- linux shell编程指南第二十四章------shell嵌入命令
- linux shell编程指南第二十六章------shell 工具
- linux shell编程指南第二十六章------shell 工具1
- linux shell编程指南第二章------使用find和xargs
- linux shell编程指南第二章------使用find和xargs1
- linux shell编程指南第三章------后台执行命令
- 绑定变量窥探和直方图
- 淘宝2012笔试
- C# 的Brush 及相关颜色的操作
- 黑马程序员:面向对象设计练习
- string深刻认识
- linux shell编程指南第二十一章------创建屏幕输出
- 设计模式 ( 十六 ) 观察者模式Observer(对象行为型)
- 严格模式与混杂模式-如何触发这两种模式,区分它们有何意义
- FreeMarker教程
- qtp 设置等待时间
- oracle rac管理基本命令
- Unity3d ios/android 截屏到默认目录
- Mac Jython 安装
- ios7UITableView中的cell