- string
- tput writes the string to the standard output. No trailing newline is supplied.
- integer
- tput writes the decimal value to the standard output, with a trailing newline.
- boolean
- tput simply sets the exit code (0 for TRUE if the terminal has the capability, 1 for FALSE if it does not), and writes nothing to the standard output.
Before using a value returned on the standard output, the application should test the exit code (e.g., $?, see sh(1) ) to be sure it is 0. (See the EXIT CODES and DIAGNOSTICS sections.) For a complete list of capabilities and the capname associated with each, see terminfo(5) .
- if present, the terminal’s initialization strings will be output as detailed in the terminfo(5) section on Tabs and Initialization,
- any delays (e.g., newline) specified in the entry will be set in the tty driver,
- tabs expansion will be turned on or off according to the specification in the entry, and
- if tabs are not expanded, standard tabs will be set (every 8 spaces).
If tput is invoked by a link named reset, this has the same effect as tput reset. See tset for comparison, which has similar behavior.
tput -S <<!
> clear
> cup 10 10
> bold
> !
- boolean
- a value of 0 is set for TRUE and 1 for FALSE.
- string
- a value of 0 is set if the capname is defined for this terminal type (the value of capname is returned on standard output); a value of 1 is set if capname is not defined for this terminal type (nothing is written to standard output).
- integer
- a value of 0 is always set, whether or not capname is defined for this terminal type. To determine if capname is defined for this terminal type, the user must test the value written to standard output. A value of -1 means that capname is not defined for this terminal type.
- other
- reset or init may fail to find their respective files. In that case, the exit code is set to 4 + errno.
Any other exit code indicates an error; see the DIAGNOSTICS section.
exit code | error message |
0 | (capname is a numeric variable that is not specified in theterminfo(5) database for this terminal type, e.g. tput -T450 lines and tput -T2621 xmc) |
1 | no error message is printed, see the EXIT CODES section. |
2 | usage error |
3 | unknown terminal type or no terminfo database |
4 | unknown terminfo capability capname |
>4 | error occurred in -S |
The longname and -S options, and the parameter-substitution features used in the cup example, are not supported in BSD curses or in AT&T/USL curses before SVr4.
X/Open documents only the operands for clear, init and reset. In this implementation, clear is part of the capname support. Other implementations of tput on SVr4-based systems such as Solaris, IRIX64 and HPUX as well as others such as AIX and Tru64 provide support for capname operands. A few platforms such as FreeBSD and NetBSD recognize termcap names rather than terminfo capability names in their respective tput commands.
This describes ncurses version 5.9 (patch 20110404).