5.12 Initializing the Terminal with tputThe tput program used with terminfo is somewhat equivalent to tset ( 5.3 , 5.11 ) , but does not have the ability that tset has to determine the terminal type. On the other hand, it allows you to pick out particular terminal capabilities and print out their values or store them into shell variables. [The tcap ( 41.10 ) program does the same kind of thing for termcap . -JP ] This allows shell programs to make use of terminal capabilities ( 41.10 ) such as inverse video or underlining. By default, tput assumes that you are using the terminal type specified by the TERM ( 5.10 ) variable. If you want to override the value of TERM , you can specify another terminal type with the -T option. For example:
$ In System V Release 3, tput has a keyword option that allows you to reset the terminal by outputting the initialization strings (there are several) from a terminfo description:
$ The command:
$ issues the reset strings from the terminfo entry. If no reset strings are defined, the initialization strings are issued instead, and the command acts exactly like tput init . In earlier releases of System V, these keywords are not supported, and you must issue multiple tput commands to output each of the initialization or reset strings by name. The following shell program, contributed by Tony Hansen of AT&T, will do the trick:
See your system manuals, or O'Reilly & Associates' termcap & terminfo , for a description of the various initialization capabilities used in this script. - from O'Reilly & Associates' termcap & terminfo , Chapter 4 |
|