📄 ex.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2003 The Open Group, All Rights Reserved --><title>ex</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="ex"></a> <a name="tag_04_45"></a><!-- ex --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright © 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_04_45_01"></a>NAME</h4><blockquote>ex - text editor</blockquote><h4><a name="tag_04_45_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><div class="box"><code><tt><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> ex</tt> <b>[</b><tt>-rR</tt><b>][</b><tt>-s | -v</tt><b>][</b><tt>-c</tt><i>command</i><b>][</b><tt>-t</tt> <i>tagstring</i><b>][</b><tt>-w</tt> <i>size</i><b>][</b><i>file</i><tt>...</tt><b>]</b><tt><img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div></blockquote><h4><a name="tag_04_45_03"></a>DESCRIPTION</h4><blockquote><p>The <i>ex</i> utility is a line-oriented text editor. There are two other modes of the editor-open and visual-in whichscreen-oriented editing is available. This is described more fully by the <i>ex</i> <b>open</b> and <b>visual</b> commands and in<a href="vi.html"><i>vi</i></a> .</p><p>This section uses the term <i>edit buffer</i> to describe the current working text. No specific implementation is implied bythis term. All editing changes are performed on the edit buffer, and no changes to it shall affect any file until an editor commandwrites the file.</p><p>Certain terminals do not have all the capabilities necessary to support the complete <i>ex</i> definition, such as thefull-screen editing commands ( <i>visual mode</i> or <i>open mode</i>). When these commands cannot be supported on such terminals,this condition shall not produce an error message such as "not an editor command" or report a syntax error. The implementationmay either accept the commands and produce results on the screen that are the result of an unsuccessful attempt to meet therequirements of this volume of IEEE Std 1003.1-2001 or report an error describing the terminal-related deficiency.</p></blockquote><h4><a name="tag_04_45_04"></a>OPTIONS</h4><blockquote><p>The <i>ex</i> utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a>.</p><p>The following options shall be supported:</p><dl compact><dt><b>-c </b> <i>command</i></dt><dd>Specify an initial command to be executed in the first edit buffer loaded from an existing file (see the EXTENDED DESCRIPTIONsection). Implementations may support more than a single <b>-c</b> option. In such implementations, the specified commands shall beexecuted in the order specified on the command line.</dd><dt><b>-r</b></dt><dd>Recover the named files (see the EXTENDED DESCRIPTION section). Recovery information for a file shall be saved during an editoror system crash (for example, when the editor is terminated by a signal which the editor can catch), or after the use of an<i>ex</i> <b>preserve</b> command. <p>A <i>crash</i> in this context is an unexpected failure of the system or utility that requires restarting the failed system orutility. A system crash implies that any utilities running at the time also crash. In the case of an editor or system crash, thenumber of changes to the edit buffer (since the most recent <b>preserve</b> command) that will be recovered is unspecified.</p><p>If no <i>file</i> operands are given and the <b>-t</b> option is not specified, all other options, the <i>EXINIT</i> variable,and any <b>.exrc</b> files shall be ignored; a list of all recoverable files available to the invoking user shall be written, andthe editor shall exit normally without further action.</p></dd><dt><b>-R</b></dt><dd>Set <b>readonly</b> edit option.</dd><dt><b>-s</b></dt><dd>Prepare <i>ex</i> for batch use by taking the following actions: <ul><li><p>Suppress writing prompts and informational (but not diagnostic) messages.</p></li><li><p>Ignore the value of <i>TERM</i> and any implementation default terminal type and assume the terminal is a type incapable ofsupporting open or visual modes; see the <b>visual</b> command and the description of <a href="vi.html"><i>vi</i></a> .</p></li><li><p>Suppress the use of the <i>EXINIT</i> environment variable and the reading of any <b>.exrc</b> file; see the EXTENDEDDESCRIPTION section.</p></li><li><p>Suppress autoindentation, ignoring the value of the <b>autoindent</b> edit option.</p></li></ul></dd><dt><b>-t </b> <i>tagstring</i></dt><dd>Edit the file containing the specified <i>tagstring</i>; see <a href="ctags.html"><i>ctags</i></a> . The tags featurerepresented by <b>-t</b> <i>tagstring</i> and the <b>tag</b> command is optional. It shall be provided on any system that alsoprovides a conforming implementation of <a href="../utilities/ctags.html"><i>ctags</i></a>; otherwise, the use of <b>-t</b>produces undefined results. On any system, it shall be an error to specify more than a single <b>-t</b> option.</dd><dt><b>-v</b></dt><dd>Begin in visual mode (see <a href="vi.html"><i>vi</i></a> ).</dd><dt><b>-w </b> <i>size</i></dt><dd>Set the value of the <i>window</i> editor option to <i>size</i>.</dd></dl></blockquote><h4><a name="tag_04_45_05"></a>OPERANDS</h4><blockquote><p>The following operand shall be supported:</p><dl compact><dt><i>file</i></dt><dd>A pathname of a file to be edited.</dd></dl></blockquote><h4><a name="tag_04_45_06"></a>STDIN</h4><blockquote><p>The standard input consists of a series of commands and input text, as described in the EXTENDED DESCRIPTION section. Theimplementation may limit each line of standard input to a length of {LINE_MAX}.</p><p>If the standard input is not a terminal device, it shall be as if the <b>-s</b> option had been specified.</p><p>If a read from the standard input returns an error, or if the editor detects an end-of-file condition from the standard input,it shall be equivalent to a SIGHUP asynchronous event.</p></blockquote><h4><a name="tag_04_45_07"></a>INPUT FILES</h4><blockquote><p>Input files shall be text files or files that would be text files except for an incomplete last line that is not longer than{LINE_MAX}-1 bytes in length and contains no NUL characters. By default, any incomplete last line shall be treated as if it had atrailing <newline>. The editing of other forms of files may optionally be allowed by <i>ex</i> implementations.</p><p>The <b>.exrc</b> files and source files shall be text files consisting of <i>ex</i> commands; see the EXTENDED DESCRIPTIONsection.</p><p>By default, the editor shall read lines from the files to be edited without interpreting any of those lines as any form ofeditor command.</p></blockquote><h4><a name="tag_04_45_08"></a>ENVIRONMENT VARIABLES</h4><blockquote><p>The following environment variables shall affect the execution of <i>ex</i>:</p><dl compact><dt><i>COLUMNS</i></dt><dd>Override the system-selected horizontal screen size. See the Base Definitions volume of IEEE Std 1003.1-2001, <ahref="../basedefs/xbd_chap08.html">Chapter 8, Environment Variables</a> for valid values and results when it is unset or null.</dd><dt><i>EXINIT</i></dt><dd>Determine a list of <i>ex</i> commands that are executed on editor start-up. See the EXTENDED DESCRIPTION section for moredetails of the initialization phase.</dd><dt><i>HOME</i></dt><dd>Determine a pathname of a directory that shall be searched for an editor start-up file named <b>.exrc</b>; see the EXTENDEDDESCRIPTION section.</dd><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_COLLATE</i></dt><dd><br>Determine the locale for the behavior of ranges, equivalence classes, and multi-character collating elements within regularexpressions.</dd><dt><i>LC_CTYPE</i></dt><dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte asopposed to multi-byte characters in arguments and input files), the behavior of character classes within regular expressions, theclassification of characters as uppercase or lowercase letters, the case conversion of letters, and the detection of wordboundaries.</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>LINES</i></dt><dd>Override the system-selected vertical screen size, used as the number of lines in a screenful and the vertical screen size invisual mode. See the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap08.html">Chapter 8,Environment Variables</a> for valid values and results when it is unset or null.</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><dt><i>PATH</i></dt><dd>Determine the search path for the shell command specified in the <i>ex</i> editor commands <b>!</b>, <b>shell</b>, <b>read</b>,and <b>write</b>, and the open and visual mode command <b>!</b>; see the description of command search and execution in <a href="xcu_chap02.html#tag_02_09_01_01"><i>Command Search and Execution</i></a> .</dd><dt><i>SHELL</i></dt><dd>Determine the preferred command line interpreter for use as the default value of the <b>shell</b> edit option.</dd><dt><i>TERM</i></dt><dd>Determine the name of the terminal type. If this variable is unset or null, an unspecified default terminal type shall beused.</dd></dl></blockquote><h4><a name="tag_04_45_09"></a>ASYNCHRONOUS EVENTS</h4><blockquote><p>The following term is used in this and following sections to specify command and asynchronous event actions:</p><dl compact><dt><i>complete write</i></dt><dd><br>A complete write is a write of the entire contents of the edit buffer to a file of a type other than a terminal device, or thesaving of the edit buffer caused by the user executing the <i>ex</i> <b>preserve</b> command. Writing the contents of the editbuffer to a temporary file that will be removed when the editor exits shall not be considered a complete write.</dd></dl><p>The following actions shall be taken upon receipt of signals:</p><dl compact><dt>SIGINT</dt><dd>If the standard input is not a terminal device, <i>ex</i> shall not write the file or return to command or text input mode, andshall exit with a non-zero exit status. <p>Otherwise, if executing an open or visual text input mode command, <i>ex</i> in receipt of SIGINT shall behave identically toits receipt of the <ESC> character.</p><p>Otherwise:</p><ol><li><p>If executing an <i>ex</i> text input mode command, all input lines that have been completely entered shall be resolved into theedit buffer, and any partially entered line shall be discarded.</p></li><li><p>If there is a currently executing command, it shall be aborted and a message displayed. Unless otherwise specified by the<i>ex</i> or <a href="../utilities/vi.html"><i>vi</i></a> command descriptions, it is unspecified whether any lines modified by theexecuting command appear modified, or as they were before being modified by the executing command, in the buffer.</p><p>If the currently executing command was a motion command, its associated command shall be discarded.</p></li><li><p>If in open or visual command mode, the terminal shall be alerted.</p></li><li><p>The editor shall then return to command mode.</p></li></ol></dd><dt>SIGCONT</dt><dd>The screen shall be refreshed if in open or visual mode.</dd><dt>SIGHUP</dt><dd>If the edit buffer has been modified since the last complete write, <i>ex</i> shall attempt to save the edit buffer so that itcan be recovered later using the <b>-r</b> option or the <i>ex</i> <b>recover</b> command. The editor shall not write the file or
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -