tput - initialize a terminal or query terminfo database
tput [-T type] capname [parm]...
tput -S <<
The tput utility uses the terminfo database to make the values of terminal-dependent capabilities and information available to the shell (see sh(1)); to clear, initialize or reset the terminal; or to return the long name of the requested terminal type. tput outputs a string if the capability attribute (capname) is of type string, or an integer if the attribute is of type integer. If the attribute is of type boolean, tput simply sets the exit status (0 for TRUE if the terminal has the capability, 1 for FALSE if it does not), and produces no output. Before using a value returned on standard output, the user should test the exit status ($?, see sh(1)) to be sure it is 0. See the EXIT STATUS section.
The following options are supported:
-Ttype
-S
The following operands are supported:
capname
The following strings will be supported as operands by the implementation in the "C" locale:
clear
init
reset
longname
parm
Example 1 Initializing the terminal according to TERM
This example initializes the terminal according to the type of terminal in the environment variable TERM. This command should be included in everyone's .profile after the environment variable TERM has been exported, as illustrated on the profile(4) manual page.
example% tput init
Example 2 Resetting a terminal
This example resets an AT&T 5620 terminal, overriding the type of terminal in the environment variable TERM:
example% tput -T5620 reset
Example 3 Moving the cursor
The following example sends the sequence to move the cursor to row 0, column 0 (the upper left corner of the screen, usually known as the "home" cursor position).
example% tput cup 0 0
This next example sends the sequence to move the cursor to row 23, column 4.
example% tput cup 23 4
Example 4 Echoing the clear-screen sequence
This example echos the clear-screen sequence for the current terminal.
example% tput clear
Example 5 Printing the number of columns
This command prints the number of columns for the current terminal.
example% tput cols
The following command prints the number of columns for the 450 terminal.
example% tput -T450 cols
Example 6 Setting shell variables
This example sets the shell variables bold, to begin stand-out mode sequence, and offbold, to end standout mode sequence, for the current terminal. This might be followed by a prompt:
echo "${bold}Please type in your name: ${offbold}\c" example% bold='tput smso' example% offbold='tput rmso'
Example 7 Setting the exit status
This example sets the exit status to indicate if the current terminal is a hardcopy terminal.
example% tput hc
Example 8 Printing the long name from terminfo
This command prints the long name from the terminfo database for the type of terminal specified in the environment variable TERM.
example% tput longname
Example 9 Processing several capabilities with one invocation
This example shows tput processing several capabilities in one invocation. This example clears the screen, moves the cursor to position 10, 10 and turns on bold (extra bright) mode. The list is terminated by an exclamation mark (!) on a line by itself.
example% tput -S <<! > clear > cup 10 10 > bold > !
See environ(5) for descriptions of the following environment variables that affect the execution of tput: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
TERM
The following exit values are returned:
0
1
2
3
4
>4
-1
/usr/include/curses.h
/usr/include/term.h
/usr/lib/tabset/*
/usr/share/lib/terminfo/?/*
See attributes(5) for descriptions of the following attributes:
|
clear(1), sh(1), stty(1), tabs(1), curses(3CURSES), profile(4), terminfo(4), attributes(5), environ(5), standards(5), term(5)
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |