109 lines
2.6 KiB
Groff
109 lines
2.6 KiB
Groff
.TH termput "" "" "/rdb Command"
|
|
.PC "Get terminal capability from /etc/termcap file"
|
|
\fBtermput \fIcapability\fR
|
|
.PP
|
|
.II termcap
|
|
.II "terminal^get capability"
|
|
The command
|
|
.B termput
|
|
reads and returns the current capabilities for your terminal, as set in file
|
|
.BR /etc/termcap .
|
|
A two-letter capability code is followed by a string of characters
|
|
that, when sent to the terminal screen, turn on or off that capability.
|
|
This assumes, of course, that your terminal is properly described in
|
|
.BR /etc/termcap .
|
|
.SH Capabilities
|
|
The capabilities are two-letter codes recognized by
|
|
.BR termcap .
|
|
Here are some examples:
|
|
.DS
|
|
\fBcl\fR Clear the terminal screen
|
|
\fBcm\fR Cursor movement
|
|
\fBso\fR Start standout mode (e.g., reverse video)
|
|
\fBse\fR End standout mode
|
|
.DE
|
|
.PP
|
|
Using most of these codes is straightforward:
|
|
just echo the appropriate code to the terminal to get the effect you want.
|
|
Cursor movement, however, is more complicated;
|
|
the cursor-movement code that
|
|
.B termput
|
|
returns must be edited to hold
|
|
the row and column to which you wish to move the cursor.
|
|
For details,
|
|
see the manual page for the command
|
|
.BR cursor .
|
|
.SH Example
|
|
You can embed
|
|
.B termput
|
|
in a shell script to
|
|
help invoke reverse video, blinking, and any other
|
|
your terminal has defined in
|
|
.BR /etc/termcap .
|
|
.PP
|
|
The first example clears the screen:
|
|
.DM
|
|
termput cl
|
|
.DE
|
|
.PP
|
|
The next example puts the screen into reverse video:
|
|
.DM
|
|
termput se
|
|
.DE
|
|
.PP
|
|
and the following turns off reverse video:
|
|
.DM
|
|
termput so
|
|
.DE
|
|
.PP
|
|
You can use
|
|
.B termput
|
|
to initialize environmental variables, which you can then invoke
|
|
in a shell script.
|
|
This is much faster than making repeated calls to
|
|
.BR termput .
|
|
To set up these shell variables, insert the following commands
|
|
your file
|
|
.BR $HOME/.profile :
|
|
.DM
|
|
.ta 2.5i
|
|
export AE=`termput ae` # end alternate character set - graphics
|
|
export AS=`termput as` # start alternate character set - graphics
|
|
.DE
|
|
.DM
|
|
.ta 2.5i
|
|
export CLEAR=`termput cl` # clear the screen
|
|
export CURSOR=`termput cm` # cursor movement - for the cursor command
|
|
export MB=`termput mb` # start blinking mode
|
|
export ME=`termput me` # turn off all attributes
|
|
export SE=`termput se` # end stand out mode
|
|
export SO=`termput so` # start stand out mode
|
|
export UE=`termput ue` # end underline mode
|
|
export US=`termput us` # start underline mode
|
|
.DE
|
|
.PP
|
|
Once this is set up, you can use these environmental variables in your
|
|
shell program.
|
|
For example, if you want a message to stand out, bracket it with
|
|
.B $SO
|
|
and
|
|
.BR $SE :
|
|
.DM
|
|
echo "${SO} LOGOFF NOW ${SE}"
|
|
.DE
|
|
.SH "See Also"
|
|
.B
|
|
clear,
|
|
cursor,
|
|
screen
|
|
.R
|
|
.br
|
|
COHERENT Lexicon:
|
|
.B
|
|
console,
|
|
stty,
|
|
termcap,
|
|
terminal-independent operations
|
|
.R
|
|
.SO termput
|