The tput Command The tset, tput, and stty Commands

Erase is control−H Kill is control−X or whatever else these characters are set to. This message can be skipped with the −Q option. The real effect of the initialization string that is sent to a terminal now depends only on the terminal itself. If everything is defined properly, a terminal should be initialized reset and ready for use. The tset command originates from the BSD platform, but exists today in both versions of UNIX, BSD, and System V, albeit with slightly different executions.

11.2.2 The tput Command

The tput command is the System V counterpart to tset and is used with the terminfo capability database, but it does not have tset s ability to determine the terminal type. By default, tput assumes that a user is using the terminal type specified by the TERM variable. To override the value of TERM, another terminal type can be specified with the −T option, for example: tput −Tvt100 However, the tput command can also manage terminals: tput init tput reset The command issues the initialization string, or the reset string, as they are defined in the corresponding terminfo entries. If no reset entry is defined, tput issues the initialization string instead, and the command acts exactly like tput init. The tput command enables easy control of displayed data, and it can be used within scripts to facilitate flexible and powerful data presentation. For example: tput clear To clear the terminal screen tput cup 0 0 To move the cursor to the home position tput cup 23 4 To move the cursor to row 23, column 4 The tput command echoes sends the specified screen−control sequence compatible with the already specified terminal. The same can be done from the shell script. Highlighting displayed text is the most popular use of the tput command. The so−called stand−out mode of the screen enables highlighting of the subsequent text in the current line on the screen, as long as the mode is on. By turning the stand−out screen mode on and off, a specified line of the text or character strings can be emphasized highlighted from the other text. The tput command: tput smso Set stand−out mode on tput rmso Reset stand−out mode set stand−out mode off The following script illustrates this capability in greater detail: cat tmpmso_example.ksh 266 echo This is an {HI}example{LO} of how to highlight a specified {HI}part of the text{LO} echo \n Upon execution, the script will display letters printed in bold are highlighted: tmpmso_example.ksh This line is highlighted This is an example of how to highlight a specified part of the text = The system prompt appears at the end of the scripts execution.

11.2.3 The stty Command