📄 stty.html
字号:
<p class="tent">t, T</p></td><td align="left"><p class="tent"><DC4></p></td><td align="left"><p class="tent">_</p></td><td align="left"><p class="tent"><US></p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td></tr><tr valign="top"><td align="left"><p class="tent">j, J</p></td><td align="left"><p class="tent"><LF></p></td><td align="left"><p class="tent">u, U</p></td><td align="left"><p class="tent"><NAK></p></td><td align="left"><p class="tent">?</p></td><td align="left"><p class="tent"><DEL></p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td></tr><tr valign="top"><td align="left"><p class="tent">k, K</p></td><td align="left"><p class="tent"><VT></p></td><td align="left"><p class="tent">v, V</p></td><td align="left"><p class="tent"><SYN></p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td><td align="left"><p class="tent"> </p></td></tr></table></center></dd><dt><b>min </b> <i>number</i></dt><dd>Set the value of MIN to <i>number</i>. MIN is used in non-canonical mode input processing ( <b>icanon</b>).</dd><dt><b>time </b> <i>number</i></dt><dd>Set the value of TIME to <i>number</i>. TIME is used in non-canonical mode input processing ( <b>icanon</b>).</dd></dl><h5><a name="tag_04_135_05_06"></a>Combination Modes</h5><dl compact><dt><i>saved settings</i></dt><dd>Set the current terminal characteristics to the saved settings produced by the <b>-g</b> option.</dd><dt><b>evenp</b> or <b>parity</b></dt><dd>Enable <b>parenb</b> and <b>cs7</b>; disable <b>parodd</b>.</dd><dt><b>oddp</b></dt><dd>Enable <b>parenb</b>, <b>cs7</b>, and <b>parodd</b>.</dd><dt><b>-parity</b>, <b>-evenp</b>, or <b>-oddp</b></dt><dd>Disable <b>parenb</b>, and set <b>cs8</b>.</dd><dt><b>raw </b> (<b>-raw</b> or <b>cooked</b>)</dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"><br>Enable (disable) raw input and output. Raw mode shall be equivalent to setting: <pre><tt>stty cs8 erase ^- kill ^- intr ^- \ quit ^- eof ^- eol ^- -post -inpck <img src="../images/opt-end.gif" border="0"></tt></pre></dd><dt><b>nl </b> (<b>-nl</b>)</dt><dd>Disable (enable) <b>icrnl</b>. In addition, <b>-nl</b> unsets <b>inlcr</b> and <b>igncr</b>.</dd><dt><b>ek</b></dt><dd>Reset ERASE and KILL characters back to system defaults.</dd><dt><b>sane</b></dt><dd>Reset all modes to some reasonable, unspecified, values.</dd></dl></blockquote><h4><a name="tag_04_135_06"></a>STDIN</h4><blockquote><p>Although no input is read from standard input, standard input shall be used to get the current terminal I/O characteristics andto set new terminal I/O characteristics.</p></blockquote><h4><a name="tag_04_135_07"></a>INPUT FILES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_135_08"></a>ENVIRONMENT VARIABLES</h4><blockquote><p>The following environment variables shall affect the execution of <i>stty</i>:</p><dl compact><dt><i>LANG</i></dt><dd>Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume ofIEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap08.html#tag_08_02">Section 8.2, Internationalization Variables</a> forthe precedence of internationalization variables used to determine the values of locale categories.)</dd><dt><i>LC_ALL</i></dt><dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd><dt><i>LC_CTYPE</i></dt><dd>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 <b>print</b>.</dd><dt><i>LC_MESSAGES</i></dt><dd>Determine the locale that should be used to affect the format and contents of diagnostic messages written to standarderror.</dd><dt><i>NLSPATH</i></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Determine the location of message catalogs for the processing of <i>LC_MESSAGES .</i> <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd></dl></blockquote><h4><a name="tag_04_135_09"></a>ASYNCHRONOUS EVENTS</h4><blockquote><p>Default.</p></blockquote><h4><a name="tag_04_135_10"></a>STDOUT</h4><blockquote><p>If operands are specified, no output shall be produced.</p><p>If the <b>-g</b> option is specified, <i>stty</i> shall write to standard output the current settings in a form that can be usedas arguments to another instance of <i>stty</i> on the same system.</p><p>If the <b>-a</b> option is specified, all of the information as described in the OPERANDS section shall be written to standardoutput. Unless otherwise specified, this information shall be written as <space>-separated tokens in an unspecified format,on one or more lines, with an unspecified number of tokens per line. Additional information may be written.</p><p>If no options or operands are specified, an unspecified subset of the information written for the <b>-a</b> option shall bewritten.</p><p>If speed information is written as part of the default output, or if the <b>-a</b> option is specified and if the terminal inputspeed and output speed are the same, the speed information shall be written as follows:</p><pre><tt>"speed %d baud;", <</tt><i>speed</i><tt>></tt></pre><p>Otherwise, speeds shall be written as:</p><pre><tt>"ispeed %d baud; ospeed %d baud;", <</tt><i>ispeed</i><tt>>, <</tt><i>ospeed</i><tt>></tt></pre><p>In locales other than the POSIX locale, the word <b>baud</b> may be changed to something more appropriate in those locales.</p><p>If control characters are written as part of the default output, or if the <b>-a</b> option is specified, control charactersshall be written as:</p><pre><tt>"%s = %s;", <</tt><i>control-character name</i><tt>>, <</tt><i>value</i><tt>></tt></pre><p>where <<i>value</i>> is either the character, or some visual representation of the character if it is non-printable, orthe string <i>undef</i> if the character is disabled.</p></blockquote><h4><a name="tag_04_135_11"></a>STDERR</h4><blockquote><p>The standard error shall be used only for diagnostic messages.</p></blockquote><h4><a name="tag_04_135_12"></a>OUTPUT FILES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_135_13"></a>EXTENDED DESCRIPTION</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_135_14"></a>EXIT STATUS</h4><blockquote><p>The following exit values shall be returned:</p><dl compact><dt> 0</dt><dd>The terminal options were read or set successfully.</dd><dt>>0</dt><dd>An error occurred.</dd></dl></blockquote><h4><a name="tag_04_135_15"></a>CONSEQUENCES OF ERRORS</h4><blockquote><p>Default.</p></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_04_135_16"></a>APPLICATION USAGE</h4><blockquote><p>The <b>-g</b> flag is designed to facilitate the saving and restoring of terminal state from the shell level. For example, aprogram may:</p><pre><tt>saveterm="$(stty -g)" # save terminal statestty</tt> <i>(new settings)</i> <tt> # set new state... # ...stty $saveterm # restore terminal state</tt></pre><p>Since the format is unspecified, the saved value is not portable across systems.</p><p>Since the <b>-a</b> format is so loosely specified, scripts that save and restore terminal settings should use the <b>-g</b>option.</p></blockquote><h4><a name="tag_04_135_17"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_135_18"></a>RATIONALE</h4><blockquote><p>The original <i>stty</i> description was taken directly from System V and reflected the System V terminal driver <b>termio</b>.It has been modified to correspond to the terminal driver <b>termios</b>.</p><p>Output modes are specified only for XSI-conformant systems. All implementations are expected to provide <i>stty</i> operandscorresponding to all of the output modes they support.</p><p>The <i>stty</i> utility is primarily used to tailor the user interface of the terminal, such as selecting the preferred ERASEand KILL characters. As an application programming utility, <i>stty</i> can be used within shell scripts to alter the terminalsettings for the duration of the script.</p><p>The <b>termios</b> 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 <tt>"^-"</tt>, and BSD uses<i>undef</i>. Both are accepted by <i>stty</i> in this volume of IEEE Std 1003.1-2001. The other BSD convention of usingthe letter <tt>'u'</tt> was rejected because it conflicts with the actual letter <tt>'u'</tt>, which is an acceptable value for acontrol character.</p><p>Early proposals did not specify the mapping of <tt>"^c"</tt> to control characters because the control characters were notspecified in the POSIX locale character set description file requirements. The control character set is now specified in the BaseDefinitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap03.html">Chapter 3, Definitions</a> so thehistorical mapping is specified. Note that although the mapping corresponds to control-character key assignments on many terminalsthat use the ISO/IEC 646:1991 standard (or ASCII) character encodings, the mapping specified here is to the controlcharacters, not their keyboard encodings.</p><p>Since <b>termios</b> supports separate speeds for input and output, two new options were added to specify each distinctly.</p><p>Some historical implementations use standard input to get and set terminal characteristics; others use standard output. Sinceinput from a login TTY is usually restricted to the owner while output to a TTY is frequently open to anyone, using standard inputprovides fewer chances of accidentally (or maliciously) altering the terminal settings of other users. Using standard input alsoallows <i>stty</i> <b>-a</b> and <i>stty</i> <b>-g</b> output to be redirected for later use. Therefore, usage of standard input isrequired by this volume of IEEE Std 1003.1-2001.</p></blockquote><h4><a name="tag_04_135_19"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_135_20"></a>SEE ALSO</h4><blockquote><p><a href="xcu_chap02.html#tag_02"><i>Shell Command Language</i></a>, the Base Definitions volume ofIEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>, <a href="../basedefs/termios.h.html"><i><termios.h></i></a></p></blockquote><h4><a name="tag_04_135_21"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 2.</p></blockquote><h4><a name="tag_04_135_22"></a>Issue 5</h4><blockquote><p>The description of <b>tabs</b> is clarified.</p><p>The FUTURE DIRECTIONS section is added.</p></blockquote><h4><a name="tag_04_135_23"></a>Issue 6</h4><blockquote><p>The legacy items <b>iuclc</b>(- <b>iuclc</b>), <b>xcase</b>, <b>olcuc</b>(- <b>olcuc</b>), <b>lcase</b>(- <b>lcase</b>), and<b>LCASE</b>(- <b>LCASE</b>) are removed.</p><p>IEEE Std 1003.1-2001/Cor 1-2002, item XCU/TC1/D6/37 is applied, applying IEEE PASC Interpretation 1003.2 #133, fixingan error in the OPERANDS section for the Combination Modes <b>nl</b>( <b>-nl</b>).</p></blockquote><div class="box"><em>End of informative text.</em></div><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX ® is a registered Trademark of The Open Group.<br>POSIX ® is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -