.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved .TH "STTY" 1P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual" .\" stty .SH PROLOG This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. .SH NAME stty \- set the options for a terminal .SH SYNOPSIS .LP \fBstty\fP \fB[\fP \fB-a| -g\fP\fB]\fP\fB .br .sp stty\fP \fIoperands\fP\fB .br \fP .SH DESCRIPTION .LP The \fIstty\fP utility shall set or report on terminal I/O characteristics for the device that is its standard input. Without options or operands specified, it shall report the settings of certain characteristics, usually those that differ from implementation-defined defaults. Otherwise, it shall modify the terminal state according to the specified operands. Detailed information about the modes listed in the first five groups below are described in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. Operands in the Combination Modes group (see Combination Modes ) are implemented using operands in the previous groups. Some combinations of operands are mutually-exclusive on some terminal types; the results of using such combinations are unspecified. .LP Typical implementations of this utility require a communications line configured to use the \fBtermios\fP interface defined in the System Interfaces volume of IEEE\ Std\ 1003.1-2001. On systems where none of these lines are available, and on lines not currently configured to support the \fBtermios\fP interface, some of the operands need not affect terminal characteristics. .SH OPTIONS .LP The \fIstty\fP utility shall conform to the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Section 12.2, Utility Syntax Guidelines. .LP The following options shall be supported: .TP 7 \fB-a\fP Write to standard output all the current settings for the terminal. .TP 7 \fB-g\fP Write to standard output all the current settings in an unspecified form that can be used as arguments to another invocation of the \fIstty\fP utility on the same system. The form used shall not contain any characters that would require quoting to avoid word expansion by the shell; see \fIWord Expansions\fP . .sp .SH OPERANDS .LP The following operands shall be supported to set the terminal characteristics. .SS Control Modes .TP 7 \fBparenb\ \fP (\fB-parenb\fP) Enable (disable) parity generation and detection. This shall have the effect of setting (not setting) PARENB in the \fBtermios\fP \fIc_cflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBparodd\ \fP (\fB-parodd\fP) .sp Select odd (even) parity. This shall have the effect of setting (not setting) PARODD in the \fBtermios\fP \fIc_cflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBcs5\ cs6\ cs7\ cs8\fP Select character size, if possible. This shall have the effect of setting CS5, CS6, CS7, and CS8, respectively, in the \fBtermios\fP \fIc_cflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fInumber\fP Set terminal baud rate to the number given, if possible. If the baud rate is set to zero, the modem control lines shall no longer be asserted. This shall have the effect of setting the input and output \fBtermios\fP baud rate values as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBispeed\ \fP \fInumber\fP Set terminal input baud rate to the number given, if possible. If the input baud rate is set to zero, the input baud rate shall be specified by the value of the output baud rate. This shall have the effect of setting the input \fBtermios\fP baud rate values as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBospeed\ \fP \fInumber\fP Set terminal output baud rate to the number given, if possible. If the output baud rate is set to zero, the modem control lines shall no longer be asserted. This shall have the effect of setting the output \fBtermios\fP baud rate values as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBhupcl\ \fP (\fB-hupcl\fP) Stop asserting modem control lines (do not stop asserting modem control lines) on last close. This shall have the effect of setting (not setting) HUPCL in the \fBtermios\fP \fIc_cflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBhup\ \fP (\fB-hup\fP) Equivalent to \fBhupcl\fP( \fB-hupcl\fP). .TP 7 \fBcstopb\ \fP (\fB-cstopb\fP) Use two (one) stop bits per character. This shall have the effect of setting (not setting) CSTOPB in the \fBtermios\fP \fIc_cflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBcread\ \fP (\fB-cread\fP) Enable (disable) the receiver. This shall have the effect of setting (not setting) CREAD in the \fBtermios\fP \fIc_cflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBclocal\ \fP (\fB-clocal\fP) Assume a line without (with) modem control. This shall have the effect of setting (not setting) CLOCAL in the \fBtermios\fP \fIc_cflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .sp .LP It is unspecified whether \fIstty\fP shall report an error if an attempt to set a Control Mode fails. .SS Input Modes .TP 7 \fBignbrk\ \fP (\fB-ignbrk\fP) Ignore (do not ignore) break on input. This shall have the effect of setting (not setting) IGNBRK in the \fBtermios\fP \fIc_iflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBbrkint\ \fP (\fB-brkint\fP) Signal (do not signal) INTR on break. This shall have the effect of setting (not setting) BRKINT in the \fBtermios\fP \fIc_iflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBignpar\ \fP (\fB-ignpar\fP) Ignore (do not ignore) bytes with parity errors. This shall have the effect of setting (not setting) IGNPAR in the \fBtermios\fP \fIc_iflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBparmrk\ \fP (\fB-parmrk\fP) .sp Mark (do not mark) parity errors. This shall have the effect of setting (not setting) PARMRK in the \fBtermios\fP \fIc_iflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBinpck\ \fP (\fB-inpck\fP) Enable (disable) input parity checking. This shall have the effect of setting (not setting) INPCK in the \fBtermios\fP \fIc_iflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBistrip\ \fP (\fB-istrip\fP) Strip (do not strip) input characters to seven bits. This shall have the effect of setting (not setting) ISTRIP in the \fBtermios\fP \fIc_iflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBinlcr\ \fP (\fB-inlcr\fP) Map (do not map) NL to CR on input. This shall have the effect of setting (not setting) INLCR in the \fBtermios\fP \fIc_iflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBigncr\ (-igncr)\fP Ignore (do not ignore) CR on input. This shall have the effect of setting (not setting) IGNCR in the \fBtermios\fP \fIc_iflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBicrnl\ \fP (\fB-icrnl\fP) Map (do not map) CR to NL on input. This shall have the effect of setting (not setting) ICRNL in the \fBtermios\fP \fIc_iflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBixon\ \fP (\fB-ixon\fP) Enable (disable) START/STOP output control. Output from the system is stopped when the system receives STOP and started when the system receives START. This shall have the effect of setting (not setting) IXON in the \fBtermios\fP \fIc_iflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBixany\ \fP (\fB-ixany\fP) Allow any character to restart output. This shall have the effect of setting (not setting) IXANY in the \fBtermios\fP \fIc_iflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBixoff\ \fP (\fB-ixoff\fP) Request that the system send (not send) STOP characters when the input queue is nearly full and START characters to resume data transmission. This shall have the effect of setting (not setting) IXOFF in the \fBtermios\fP \fIc_iflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .sp .SS Output Modes .TP 7 \fBopost\ \fP (\fB-opost\fP) Post-process output (do not post-process output; ignore all other output modes). This shall have the effect of setting (not setting) OPOST in the \fBtermios\fP \fIc_oflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBocrnl\ \fP (\fB-ocrnl\fP) Map (do not map) CR to NL on output This shall have the effect of setting (not setting) OCRNL in the \fBtermios\fP \fIc_oflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBonocr\ \fP (\fB-onocr\fP) Do not (do) output CR at column zero. This shall have the effect of setting (not setting) ONOCR in the \fBtermios\fP \fIc_oflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBonlret\ \fP (\fB-onlret\fP) The terminal newline key performs (does not perform) the CR function. This shall have the effect of setting (not setting) ONLRET in the \fBtermios\fP \fIc_oflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBofill\ \fP (\fB-ofill\fP) Use fill characters (use timing) for delays. This shall have the effect of setting (not setting) OFILL in the \fBtermios\fP \fIc_oflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBofdel\ \fP (\fB-ofdel\fP) Fill characters are DELs (NULs). This shall have the effect of setting (not setting) OFDEL in the \fBtermios\fP \fIc_oflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBcr0\ cr1\ cr2\ cr3\fP Select the style of delay for CRs. This shall have the effect of setting CRDLY to CR0, CR1, CR2, or CR3, respectively, in the \fBtermios\fP \fIc_oflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBnl0\ nl1\fP Select the style of delay for NL. This shall have the effect of setting NLDLY to NL0 or NL1, respectively, in the \fBtermios\fP \fIc_oflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBtab0\ tab1\ tab2\ tab3\fP .sp Select the style of delay for horizontal tabs. This shall have the effect of setting TABDLY to TAB0, TAB1, TAB2, or TAB3, respectively, in the \fBtermios\fP \fIc_oflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. Note that TAB3 has the effect of expanding s to s. .TP 7 \fBtabs\ \fP (\fB-tabs\fP) Synonym for \fBtab0\fP ( \fBtab3\fP). .TP 7 \fBbs0\ bs1\fP Select the style of delay for backspaces. This shall have the effect of setting BSDLY to BS0 or BS1, respectively, in the \fBtermios\fP \fIc_oflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBff0\ ff1\fP Select the style of delay for form-feeds. This shall have the effect of setting FFDLY to FF0 or FF1, respectively, in the \fBtermios\fP \fIc_oflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBvt0\ vt1\fP Select the style of delay for vertical-tabs. This shall have the effect of setting VTDLY to VT0 or VT1, respectively, in the \fBtermios\fP \fIc_oflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .sp .SS Local Modes .TP 7 \fBisig\ \fP (\fB-isig\fP) Enable (disable) the checking of characters against the special control characters INTR, QUIT, and SUSP. This shall have the effect of setting (not setting) ISIG in the \fBtermios\fP \fIc_lflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBicanon\ \fP (\fB-icanon\fP) Enable (disable) canonical input (ERASE and KILL processing). This shall have the effect of setting (not setting) ICANON in the \fBtermios\fP \fIc_lflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBiexten\ \fP (\fB-iexten\fP) Enable (disable) any implementation-defined special control characters not currently controlled by \fBicanon\fP, \fBisig\fP, \fBixon\fP, or \fBixoff\fP. This shall have the effect of setting (not setting) IEXTEN in the \fBtermios\fP \fIc_lflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBecho\ \fP (\fB-echo\fP) Echo back (do not echo back) every character typed. This shall have the effect of setting (not setting) ECHO in the \fBtermios\fP \fIc_lflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBechoe\ \fP (\fB-echoe\fP) The ERASE character visually erases (does not erase) the last character in the current line from the display, if possible. This shall have the effect of setting (not setting) ECHOE in the \fBtermios\fP \fIc_lflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBechok\ \fP (\fB-echok\fP) Echo (do not echo) NL after KILL character. This shall have the effect of setting (not setting) ECHOK in the \fBtermios\fP \fIc_lflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBechonl\ \fP (\fB-echonl\fP) Echo (do not echo) NL, even if \fBecho\fP is disabled. This shall have the effect of setting (not setting) ECHONL in the \fBtermios\fP \fIc_lflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBnoflsh\ \fP (\fB-noflsh\fP) Disable (enable) flush after INTR, QUIT, SUSP. This shall have the effect of setting (not setting) NOFLSH in the \fBtermios\fP \fIc_lflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .TP 7 \fBtostop\ \fP (\fB-tostop\fP) Send SIGTTOU for background output. This shall have the effect of setting (not setting) TOSTOP in the \fBtermios\fP \fIc_lflag\fP field, as defined in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface. .sp .SS Special Control Character Assignments .TP 7 <\fIcontrol\fP>-\fIcharacter\ string\fP .sp Set <\fIcontrol\fP>-\fIcharacter\fP to \fIstring\fP. If <\fIcontrol\fP>-\fIcharacter\fP is one of the character sequences in the first column of the following table, the corresponding Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface control character from the second column shall be recognized. This has the effect of setting the corresponding element of the \fBtermios\fP \fIc_cc\fP array (see the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 13, Headers, \fI\fP). .br .sp .ce 1 \fBTable: Control Character Names in \fIstty\fP\fP .TS C center; l2 l2 l. \fBControl Character\fP \fBc_cc Subscript\fP \fBDescription\fP \fBeof\fP VEOF EOF character \fBeol\fP VEOL EOL character \fBerase\fP VERASE ERASE character \fBintr\fP VINTR INTR character \fBkill\fP VKILL KILL character \fBquit\fP VQUIT QUIT character \fBsusp\fP VSUSP SUSP character \fBstart\fP VSTART START character \fBstop\fP VSTOP STOP character .TE .LP If \fIstring\fP is a single character, the control character shall be set to that character. If \fIstring\fP is the two-character sequence \fB"^-"\fP or the string \fIundef\fP, the control character shall be set to _POSIX_VDISABLE, if it is in effect for the device; if _POSIX_VDISABLE is not in effect for the device, it shall be treated as an error. In the POSIX locale, if \fIstring\fP is a two-character sequence beginning with circumflex ( \fB'^'\fP ), and the second character is one of those listed in the \fB"^c"\fP column of the following table, the control character shall be set to the corresponding character value in the Value column of the table. .sp .ce 1 \fBTable: Circumflex Control Characters in \fIstty\fP\fP .TS C center; l l l l l l. \fB^c\fP \fBValue\fP \fB^c\fP \fBValue\fP \fB^c\fP \fBValue\fP a, A l, L w, W b, B m, M x, X c, C n, N y, Y d, D o, O z, Z e, E p, P [ f, F q, Q \\ g, G r, R ] h, H s, S ^ i, I t, T _ j, J u, U ? k, K v, V .TE .TP 7 \fBmin\ \fP \fInumber\fP .sp Set the value of MIN to \fInumber\fP. MIN is used in non-canonical mode input processing ( \fBicanon\fP). .TP 7 \fBtime\ \fP \fInumber\fP .sp Set the value of TIME to \fInumber\fP. TIME is used in non-canonical mode input processing ( \fBicanon\fP). .sp .SS Combination Modes .TP 7 \fIsaved\ settings\fP .sp Set the current terminal characteristics to the saved settings produced by the \fB-g\fP option. .TP 7 \fBevenp\fP\ or\ \fBparity\fP .sp Enable \fBparenb\fP and \fBcs7\fP; disable \fBparodd\fP. .TP 7 \fBoddp\fP .sp Enable \fBparenb\fP, \fBcs7\fP, and \fBparodd\fP. .TP 7 \fB-parity\fP, \fB-evenp\fP, or \fB-oddp\fP .sp Disable \fBparenb\fP, and set \fBcs8\fP. .TP 7 \fBraw\ \fP (\fB-raw\fP\ or\ \fBcooked\fP) .sp Enable (disable) raw input and output. Raw mode shall be equivalent to setting: .sp .RS .nf \fBstty cs8 erase ^- kill ^- intr ^- \\ quit ^- eof ^- eol ^- -post -inpck \fP .fi .RE .TP 7 \fBnl\ \fP (\fB-nl\fP) .sp Disable (enable) \fBicrnl\fP. In addition, \fB-nl\fP unsets \fBinlcr\fP and \fBigncr\fP. .TP 7 \fBek\fP Reset ERASE and KILL characters back to system defaults. .TP 7 \fBsane\fP .sp Reset all modes to some reasonable, unspecified, values. .sp .SH STDIN .LP Although no input is read from standard input, standard input shall be used to get the current terminal I/O characteristics and to set new terminal I/O characteristics. .SH INPUT FILES .LP None. .SH ENVIRONMENT VARIABLES .LP The following environment variables shall affect the execution of \fIstty\fP: .TP 7 \fILANG\fP Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) .TP 7 \fILC_ALL\fP If set to a non-empty string value, override the values of all the other internationalization variables. .TP 7 \fILC_CTYPE\fP This variable determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments) and which characters are in the class \fBprint\fP. .TP 7 \fILC_MESSAGES\fP Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. .TP 7 \fINLSPATH\fP Determine the location of message catalogs for the processing of \fILC_MESSAGES \&.\fP .sp .SH ASYNCHRONOUS EVENTS .LP Default. .SH STDOUT .LP If operands are specified, no output shall be produced. .LP If the \fB-g\fP option is specified, \fIstty\fP shall write to standard output the current settings in a form that can be used as arguments to another instance of \fIstty\fP on the same system. .LP If the \fB-a\fP option is specified, all of the information as described in the OPERANDS section shall be written to standard output. Unless otherwise specified, this information shall be written as -separated tokens in an unspecified format, on one or more lines, with an unspecified number of tokens per line. Additional information may be written. .LP If no options or operands are specified, an unspecified subset of the information written for the \fB-a\fP option shall be written. .LP If speed information is written as part of the default output, or if the \fB-a\fP option is specified and if the terminal input speed and output speed are the same, the speed information shall be written as follows: .sp .RS .nf \fB"speed %d baud;", <\fP\fIspeed\fP\fB> \fP .fi .RE .LP Otherwise, speeds shall be written as: .sp .RS .nf \fB"ispeed %d baud; ospeed %d baud;", <\fP\fIispeed\fP\fB>, <\fP\fIospeed\fP\fB> \fP .fi .RE .LP In locales other than the POSIX locale, the word \fBbaud\fP may be changed to something more appropriate in those locales. .LP If control characters are written as part of the default output, or if the \fB-a\fP option is specified, control characters shall be written as: .sp .RS .nf \fB"%s = %s;", <\fP\fIcontrol-character name\fP\fB>, <\fP\fIvalue\fP\fB> \fP .fi .RE .LP where <\fIvalue\fP> is either the character, or some visual representation of the character if it is non-printable, or the string \fIundef\fP if the character is disabled. .SH STDERR .LP The standard error shall be used only for diagnostic messages. .SH OUTPUT FILES .LP None. .SH EXTENDED DESCRIPTION .LP None. .SH EXIT STATUS .LP The following exit values shall be returned: .TP 7 \ 0 The terminal options were read or set successfully. .TP 7 >0 An error occurred. .sp .SH CONSEQUENCES OF ERRORS .LP Default. .LP \fIThe following sections are informative.\fP .SH APPLICATION USAGE .LP The \fB-g\fP flag is designed to facilitate the saving and restoring of terminal state from the shell level. For example, a program may: .sp .RS .nf \fBsaveterm="$(stty -g)" # save terminal state stty\fP \fI(new settings)\fP \fB # set new state \&... # ... stty $saveterm # restore terminal state \fP .fi .RE .LP Since the format is unspecified, the saved value is not portable across systems. .LP Since the \fB-a\fP format is so loosely specified, scripts that save and restore terminal settings should use the \fB-g\fP option. .SH EXAMPLES .LP None. .SH RATIONALE .LP The original \fIstty\fP description was taken directly from System V and reflected the System V terminal driver \fBtermio\fP. It has been modified to correspond to the terminal driver \fBtermios\fP. .LP Output modes are specified only for XSI-conformant systems. All implementations are expected to provide \fIstty\fP operands corresponding to all of the output modes they support. .LP The \fIstty\fP utility is primarily used to tailor the user interface of the terminal, such as selecting the preferred ERASE and KILL characters. As an application programming utility, \fIstty\fP can be used within shell scripts to alter the terminal settings for the duration of the script. .LP The \fBtermios\fP section states that individual disabling of control characters is possible through the option _POSIX_VDISABLE. If enabled, two conventions currently exist for specifying this: System V uses \fB"^-"\fP, and BSD uses \fIundef\fP. Both are accepted by \fIstty\fP in this volume of IEEE\ Std\ 1003.1-2001. The other BSD convention of using the letter \fB'u'\fP was rejected because it conflicts with the actual letter \fB'u'\fP, which is an acceptable value for a control character. .LP Early proposals did not specify the mapping of \fB"^c"\fP to control characters because the control characters were not specified in the POSIX locale character set description file requirements. The control character set is now specified in the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 3, Definitions so the historical mapping is specified. Note that although the mapping corresponds to control-character key assignments on many terminals that use the ISO/IEC\ 646:1991 standard (or ASCII) character encodings, the mapping specified here is to the control characters, not their keyboard encodings. .LP Since \fBtermios\fP supports separate speeds for input and output, two new options were added to specify each distinctly. .LP Some historical implementations use standard input to get and set terminal characteristics; others use standard output. Since input from a login TTY is usually restricted to the owner while output to a TTY is frequently open to anyone, using standard input provides fewer chances of accidentally (or maliciously) altering the terminal settings of other users. Using standard input also allows \fIstty\fP \fB-a\fP and \fIstty\fP \fB-g\fP output to be redirected for later use. Therefore, usage of standard input is required by this volume of IEEE\ Std\ 1003.1-2001. .SH FUTURE DIRECTIONS .LP None. .SH SEE ALSO .LP \fIShell Command Language\fP, the Base Definitions volume of IEEE\ Std\ 1003.1-2001, Chapter 11, General Terminal Interface, \fI\fP .SH COPYRIGHT Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .