O nás     Inzerce     KontaktSpolehlivé informace o IT již od roku 2011
Hledat
Nepřehlédněte: Nejlepší IT: Pozoruhodné IT produkty pro rok 2024 podruhé
Správa dokumentů
Digitální transformace
Informační systémy
Hlavní rubriky: Informační systémy, Mobilní technologie, Datová centra, Sítě, IT bezpečnost, Software, Hardware, Zkušenosti a názory, Speciály

Pozoruhodné IT produkty 2024 podruhé
E-knihy o IT zdarma
Manuál Linux
[Linux manuál]

ex: textový editor

Originální popis anglicky: ex - text editor

Návod, kniha: POSIX Programmer's Manual

STRUČNĚ

ex [-rR][-s | -v][-c command ][-t tagstring][-w size ][file ...]

POPIS / INSTRUKCE

The ex utility is a line-oriented text editor. There are two other modes of the editor-open and visual-in which screen-oriented editing is available. This is described more fully by the ex open and visual commands and in vi .
This section uses the term edit buffer to describe the current working text. No specific implementation is implied by this term. All editing changes are performed on the edit buffer, and no changes to it shall affect any file until an editor command writes the file.
Certain terminals do not have all the capabilities necessary to support the complete ex definition, such as the full-screen editing commands ( visual mode or open mode). 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 implementation may either accept the commands and produce results on the screen that are the result of an unsuccessful attempt to meet the requirements of this volume of IEEE Std 1003.1-2001 or report an error describing the terminal-related deficiency.

OPTIONS

The ex utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
The following options shall be supported:
-c  command
Specify an initial command to be executed in the first edit buffer loaded from an existing file (see the EXTENDED DESCRIPTION section). Implementations may support more than a single -c option. In such implementations, the specified commands shall be executed in the order specified on the command line.
-r
Recover the named files (see the EXTENDED DESCRIPTION section). Recovery information for a file shall be saved during an editor or system crash (for example, when the editor is terminated by a signal which the editor can catch), or after the use of an ex preserve command.
A crash in this context is an unexpected failure of the system or utility that requires restarting the failed system or utility. A system crash implies that any utilities running at the time also crash. In the case of an editor or system crash, the number of changes to the edit buffer (since the most recent preserve command) that will be recovered is unspecified.
If no file operands are given and the -t option is not specified, all other options, the EXINIT variable, and any .exrc files shall be ignored; a list of all recoverable files available to the invoking user shall be written, and the editor shall exit normally without further action.
-R
Set readonly edit option.
-s
Prepare ex for batch use by taking the following actions:
*
Suppress writing prompts and informational (but not diagnostic) messages.
*
Ignore the value of TERM and any implementation default terminal type and assume the terminal is a type incapable of supporting open or visual modes; see the visual command and the description of vi .
*
Suppress the use of the EXINIT environment variable and the reading of any .exrc file; see the EXTENDED DESCRIPTION section.
*
Suppress autoindentation, ignoring the value of the autoindent edit option.
-t  tagstring
Edit the file containing the specified tagstring; see ctags . The tags feature represented by -t tagstring and the tag command is optional. It shall be provided on any system that also provides a conforming implementation of ctags; otherwise, the use of -t produces undefined results. On any system, it shall be an error to specify more than a single -t option.
-v
Begin in visual mode (see vi ).
-w  size
Set the value of the window editor option to size.
 

OPERANDS

The following operand shall be supported:
file
A pathname of a file to be edited.
 

STDIN

The standard input consists of a series of commands and input text, as described in the EXTENDED DESCRIPTION section. The implementation may limit each line of standard input to a length of {LINE_MAX}.
If the standard input is not a terminal device, it shall be as if the -s option had been specified.
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.

INPUT FILES

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 a trailing <newline>. The editing of other forms of files may optionally be allowed by ex implementations.
The .exrc files and source files shall be text files consisting of ex commands; see the EXTENDED DESCRIPTION section.
By default, the editor shall read lines from the files to be edited without interpreting any of those lines as any form of editor command.

ENVIRONMENT VARIABLES

The following environment variables shall affect the execution of ex:
COLUMNS
Override the system-selected horizontal screen size. See the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 8, Environment Variables for valid values and results when it is unset or null.
EXINIT
Determine a list of ex commands that are executed on editor start-up. See the EXTENDED DESCRIPTION section for more details of the initialization phase.
HOME
Determine a pathname of a directory that shall be searched for an editor start-up file named .exrc; see the EXTENDED DESCRIPTION section.
LANG
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.)
LC_ALL
If set to a non-empty string value, override the values of all the other internationalization variables.
LC_COLLATE
 
Determine the locale for the behavior of ranges, equivalence classes, and multi-character collating elements within regular expressions.
LC_CTYPE
Determine 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 input files), the behavior of character classes within regular expressions, the classification of characters as uppercase or lowercase letters, the case conversion of letters, and the detection of word boundaries.
LC_MESSAGES
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
LINES
Override the system-selected vertical screen size, used as the number of lines in a screenful and the vertical screen size in visual mode. See the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 8, Environment Variables for valid values and results when it is unset or null.
NLSPATH
Determine the location of message catalogs for the processing of LC_MESSAGES .
PATH
Determine the search path for the shell command specified in the ex editor commands !, shell, read, and write, and the open and visual mode command !; see the description of command search and execution in Command Search and Execution .
SHELL
Determine the preferred command line interpreter for use as the default value of the shell edit option.
TERM
Determine the name of the terminal type. If this variable is unset or null, an unspecified default terminal type shall be used.
 

ASYNCHRONOUS EVENTS

The following term is used in this and following sections to specify command and asynchronous event actions:
complete write
 
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 the saving of the edit buffer caused by the user executing the ex preserve command. Writing the contents of the edit buffer to a temporary file that will be removed when the editor exits shall not be considered a complete write.
 
The following actions shall be taken upon receipt of signals:
SIGINT
If the standard input is not a terminal device, ex shall not write the file or return to command or text input mode, and shall exit with a non-zero exit status.
Otherwise, if executing an open or visual text input mode command, ex in receipt of SIGINT shall behave identically to its receipt of the <ESC> character.
Otherwise:
1.
If executing an ex text input mode command, all input lines that have been completely entered shall be resolved into the edit buffer, and any partially entered line shall be discarded.
2.
If there is a currently executing command, it shall be aborted and a message displayed. Unless otherwise specified by the ex or vi command descriptions, it is unspecified whether any lines modified by the executing command appear modified, or as they were before being modified by the executing command, in the buffer.
If the currently executing command was a motion command, its associated command shall be discarded.
3.
If in open or visual command mode, the terminal shall be alerted.
4.
The editor shall then return to command mode.
SIGCONT
The screen shall be refreshed if in open or visual mode.
SIGHUP
If the edit buffer has been modified since the last complete write, ex shall attempt to save the edit buffer so that it can be recovered later using the -r option or the ex recover command. The editor shall not write the file or return to command or text input mode, and shall terminate with a non-zero exit status.
SIGTERM
Refer to SIGHUP.
 
The action taken for all other signals is unspecified.

STDOUT

The standard output shall be used only for writing prompts to the user, for informational messages, and for writing lines from the file.

STDERR

The standard error shall be used only for diagnostic messages.

OUTPUT FILES

The output from ex shall be text files.

EXTENDED DESCRIPTION

Only the ex mode of the editor is described in this section. See vi for additional editing capabilities available in ex.
When an error occurs, ex shall write a message. If the terminal supports a standout mode (such as inverse video), the message shall be written in standout mode. If the terminal does not support a standout mode, and the edit option errorbells is set, an alert action shall precede the error message.
By default, ex shall start in command mode, which shall be indicated by a : prompt; see the prompt command. Text input mode can be entered by the append, insert, or change commands; it can be exited (and command mode re-entered) by typing a period ( '.' ) alone at the beginning of a line.

Initialization in ex and vi

The following symbols are used in this and following sections to specify locations in the edit buffer:
alternate and current pathnames
 
Two pathnames, named current and alternate, are maintained by the editor. Any ex commands that take filenames as arguments shall set them as follows:
1.
If a file argument is specified to the ex edit, ex, or recover commands, or if an ex tag command replaces the contents of the edit buffer.
a.
If the command replaces the contents of the edit buffer, the current pathname shall be set to the file argument or the file indicated by the tag, and the alternate pathname shall be set to the previous value of the current pathname.
b.
Otherwise, the alternate pathname shall be set to the file argument.
2.
If a file argument is specified to the ex next command:
a.
If the command replaces the contents of the edit buffer, the current pathname shall be set to the first file argument, and the alternate pathname shall be set to the previous value of the current pathname.
3.
If a file argument is specified to the ex file command, the current pathname shall be set to the file argument, and the alternate pathname shall be set to the previous value of the current pathname.
4.
If a file argument is specified to the ex read and write commands (that is, when reading or writing a file, and not to the program named by the shell edit option), or a file argument is specified to the ex xit command:
a.
If the current pathname has no value, the current pathname shall be set to the file argument.
b.
Otherwise, the alternate pathname shall be set to the file argument.
If the alternate pathname is set to the previous value of the current pathname when the current pathname had no previous value, then the alternate pathname shall have no value as a result.
current line
 
The line of the edit buffer referenced by the cursor. Each command description specifies the current line after the command has been executed, as the current line value. When the edit buffer contains no lines, the current line shall be zero; see Addressing in ex .
current column
 
The current display line column occupied by the cursor. (The columns shall be numbered beginning at 1.) Each command description specifies the current column after the command has been executed, as the current column value. This column is an ideal column that is remembered over the lifetime of the editor. The actual display line column upon which the cursor rests may be different from the current column; see the cursor positioning discussion in Command Descriptions in vi .
set to non-<blank>
 
A description for a current column value, meaning that the current column shall be set to the last display line column on which is displayed any part of the first non- <blank> of the line. If the line has no non- <blank> non- <newline>s, the current column shall be set to the last display line column on which is displayed any part of the last non- <newline> in the line. If the line is empty, the current column shall be set to column position 1.
 
The length of lines in the edit buffer may be limited to {LINE_MAX} bytes. In open and visual mode, the length of lines in the edit buffer may be limited to the number of characters that will fit in the display. If either limit is exceeded during editing, an error message shall be written. If either limit is exceeded by a line read in from a file, an error message shall be written and the edit session may be terminated.
If the editor stops running due to any reason other than a user command, and the edit buffer has been modified since the last complete write, it shall be equivalent to a SIGHUP asynchronous event. If the system crashes, it shall be equivalent to a SIGHUP asynchronous event.
During initialization (before the first file is copied into the edit buffer or any user commands from the terminal are processed) the following shall occur:
1.
If the environment variable EXINIT is set, the editor shall execute the ex commands contained in that variable.
2.
If the EXINIT variable is not set, and all of the following are true:
a.
The HOME environment variable is not null and not empty.
b.
The file .exrc in the directory referred to by the HOME environment variable:
1.
Exists
2.
Is owned by the same user ID as the real user ID of the process or the process has appropriate privileges
3.
Is not writable by anyone other than the owner
the editor shall execute the ex commands contained in that file.
3.
If and only if all of the following are true:
a.
The current directory is not referred to by the HOME environment variable.
b.
A command in the EXINIT environment variable or a command in the .exrc file in the directory referred to by the HOME environment variable sets the editor option exrc.
c.
The .exrc file in the current directory:
1.
Exists
2.
Is owned by the same user ID as the real user ID of the process, or by one of a set of implementation-defined user IDs
3.
Is not writable by anyone other than the owner
the editor shall attempt to execute the ex commands contained in that file.
Lines in any .exrc file that are blank lines shall be ignored. If any .exrc file exists, but is not read for ownership or permission reasons, it shall be an error.
After the EXINIT variable and any .exrc files are processed, the first file specified by the user shall be edited, as follows:
1.
If the user specified the -t option, the effect shall be as if the ex tag command was entered with the specified argument, with the exception that if tag processing does not result in a file to edit, the effect shall be as described in step 3. below.
2.
Otherwise, if the user specified any command line file arguments, the effect shall be as if the ex edit command was entered with the first of those arguments as its file argument.
3.
Otherwise, the effect shall be as if the ex edit command was entered with a nonexistent filename as its file argument. It is unspecified whether this action shall set the current pathname. In an implementation where this action does not set the current pathname, any editor command using the current pathname shall fail until an editor command sets the current pathname.
If the -r option was specified, the first time a file in the initial argument list or a file specified by the -t option is edited, if recovery information has previously been saved about it, that information shall be recovered and the editor shall behave as if the contents of the edit buffer have already been modified. If there are multiple instances of the file to be recovered, the one most recently saved shall be recovered, and an informational message that there are previous versions of the file that can be recovered shall be written. If no recovery information about a file is available, an informational message to this effect shall be written, and the edit shall proceed as usual.
If the -c option was specified, the first time a file that already exists (including a file that might not exist but for which recovery information is available, when the -r option is specified) replaces or initializes the contents of the edit buffer, the current line shall be set to the last line of the edit buffer, the current column shall be set to non- <blank>, and the ex commands specified with the -c option shall be executed. In this case, the current line and current column shall not be set as described for the command associated with the replacement or initialization of the edit buffer contents. However, if the -t option or a tag command is associated with this action, the -c option commands shall be executed and then the movement to the tag shall be performed.
The current argument list shall initially be set to the filenames specified by the user on the command line. If no filenames are specified by the user, the current argument list shall be empty. If the -t option was specified, it is unspecified whether any filename resulting from tag processing shall be prepended to the current argument list. In the case where the filename is added as a prefix to the current argument list, the current argument list reference shall be set to that filename. In the case where the filename is not added as a prefix to the current argument list, the current argument list reference shall logically be located before the first of the filenames specified on the command line (for example, a subsequent ex next command shall edit the first filename from the command line). If the -t option was not specified, the current argument list reference shall be to the first of the filenames on the command line.

Addressing in ex

Addressing in ex relates to the current line and the current column; the address of a line is its 1-based line number, the address of a column is its 1-based count from the beginning of the line. Generally, the current line is the last line affected by a command. The current line number is the address of the current line. In each command description, the effect of the command on the current line number and the current column is described.
Addresses are constructed as follows:
1.
The character '.' (period) shall address the current line.
2.
The character '$' shall address the last line of the edit buffer.
3.
The positive decimal number n shall address the nth line of the edit buffer.
4.
The address "'x" refers to the line marked with the mark name character 'x' , which shall be a lowercase letter from the portable character set or one of the characters '`' or '" . It shall be an error if the line that was marked is not currently present in the edit buffer or the mark has not been set. Lines can be marked with the ex mark or k commands, or the vi m command.
5.
A regular expression enclosed by slashes ( '/' ) shall address the first line found by searching forwards from the line following the current line toward the end of the edit buffer and stopping at the first line for which the line excluding the terminating <newline> matches the regular expression. As stated in Regular Expressions in ex , an address consisting of a null regular expression delimited by slashes "//" shall address the next line for which the line excluding the terminating <newline> matches the last regular expression encountered. In addition, the second slash can be omitted at the end of a command line. If the wrapscan edit option is set, the search shall wrap around to the beginning of the edit buffer and continue up to and including the current line, so that the entire edit buffer is searched. Within the regular expression, the sequence "\/" shall represent a literal slash instead of the regular expression delimiter.
6.
A regular expression enclosed in question marks ( '?' ) shall address the first line found by searching backwards from the line preceding the current line toward the beginning of the edit buffer and stopping at the first line for which the line excluding the terminating <newline> matches the regular expression. An address consisting of a null regular expression delimited by question marks "??" shall address the previous line for which the line excluding the terminating <newline> matches the last regular expression encountered. In addition, the second question mark can be omitted at the end of a command line. If the wrapscan edit option is set, the search shall wrap around from the beginning of the edit buffer to the end of the edit buffer and continue up to and including the current line, so that the entire edit buffer is searched. Within the regular expression, the sequence "\?" shall represent a literal question mark instead of the RE delimiter.
7.
A plus sign ( '+' ) or a minus sign ( '-' ) followed by a decimal number shall address the current line plus or minus the number. A '+' or '-' not followed by a decimal number shall address the current line plus or minus 1.
Addresses can be followed by zero or more address offsets, optionally <blank>-separated. Address offsets are constructed as follows:
1.
A '+' or '-' immediately followed by a decimal number shall add (subtract) the indicated number of lines to (from) the address. A '+' or '-' not followed by a decimal number shall add (subtract) 1 to (from) the address.
2.
A decimal number shall add the indicated number of lines to the address.
It shall not be an error for an intermediate address value to be less than zero or greater than the last line in the edit buffer. It shall be an error for the final address value to be less than zero or greater than the last line in the edit buffer.
Commands take zero, one, or two addresses; see the descriptions of 1addr and 2addr in Command Descriptions in ex . If more than the required number of addresses are provided to a command that requires zero addresses, it shall be an error. Otherwise, if more than the required number of addresses are provided to a command, the addresses specified first shall be evaluated and then discarded until the maximum number of valid addresses remain.
Addresses shall be separated from each other by a comma ( ',' ) or a semicolon ( ';' ). If no address is specified before or after a comma or semicolon separator, it shall be as if the address of the current line was specified before or after the separator. In the case of a semicolon separator, the current line ( '.' ) shall be set to the first address, and only then will the next address be calculated. This feature can be used to determine the starting line for forwards and backwards searches (see rules 5. and 6.).
A percent sign ( '%' ) shall be equivalent to entering the two addresses "1,$" .
Any delimiting <blank>s between addresses, address separators, or address offsets shall be discarded.

Command Line Parsing in ex

The following symbol is used in this and following sections to describe parsing behavior:
escape
If a character is referred to as "backslash-escaped" or " <control>-V-escaped," it shall mean that the character acquired or lost a special meaning by virtue of being preceded, respectively, by a backslash or <control>-V character. Unless otherwise specified, the escaping character shall be discarded at that time and shall not be further considered for any purpose.
 
Command-line parsing shall be done in the following steps. For each step, characters already evaluated shall be ignored; that is, the phrase "leading character" refers to the next character that has not yet been evaluated.
1.
Leading colon characters shall be skipped.
2.
Leading <blank>s shall be skipped.
3.
If the leading character is a double-quote character, the characters up to and including the next non-backslash-escaped <newline> shall be discarded, and any subsequent characters shall be parsed as a separate command.
4.
Leading characters that can be interpreted as addresses shall be evaluated; see Addressing in ex .
5.
Leading <blank>s shall be skipped.
6.
If the next character is a vertical-line character or a <newline>:
a.
If the next character is a <newline>:
1.
If ex is in open or visual mode, the current line shall be set to the last address specified, if any.
2.
Otherwise, if the last command was terminated by a vertical-line character, no action shall be taken; for example, the command "||<newline>" shall execute two implied commands, not three.
3.
Otherwise, step 6.b. shall apply.
b.
Otherwise, the implied command shall be the print command. The last #, p, and l flags specified to any ex command shall be remembered and shall apply to this implied command. Executing the ex number, print, or list command shall set the remembered flags to #, nothing, and l, respectively, plus any other flags specified for that execution of the number, print, or list command.
If ex is not currently performing a global or v command, and no address or count is specified, the current line shall be incremented by 1 before the command is executed. If incrementing the current line would result in an address past the last line in the edit buffer, the command shall fail, and the increment shall not happen.
c.
The <newline> or vertical-line character shall be discarded and any subsequent characters shall be parsed as a separate command.
7.
The command name shall be comprised of the next character (if the character is not alphabetic), or the next character and any subsequent alphabetic characters (if the character is alphabetic), with the following exceptions:
a.
Commands that consist of any prefix of the characters in the command name delete, followed immediately by any of the characters 'l' , 'p' , '+' , '-' , or '#' shall be interpreted as a delete command, followed by a <blank>, followed by the characters that were not part of the prefix of the delete command. The maximum number of characters shall be matched to the command name delete; for example, "del" shall not be treated as "de" followed by the flag l.
b.
Commands that consist of the character 'k' , followed by a character that can be used as the name of a mark, shall be equivalent to the mark command followed by a <blank>, followed by the character that followed the 'k' .
c.
Commands that consist of the character 's' , followed by characters that could be interpreted as valid options to the s command, shall be the equivalent of the s command, without any pattern or replacement values, followed by a <blank>, followed by the characters after the 's' .
8.
The command name shall be matched against the possible command names, and a command name that contains a prefix matching the characters specified by the user shall be the executed command. In the case of commands where the characters specified by the user could be ambiguous, the executed command shall be as follows:
a append n next t t    
c change p print u undo    
ch change pr print un undo    
e edit r read v v    
m move re read w write    
ma mark s s        
Implementation extensions with names causing similar ambiguities shall not be checked for a match until all possible matches for commands specified by IEEE Std 1003.1-2001 have been checked.
9.
If the command is a ! command, or if the command is a read command followed by zero or more <blank>s and a !, or if the command is a write command followed by one or more <blank>s and a !, the rest of the command shall include all characters up to a non-backslash-escaped <newline>. The <newline> shall be discarded and any subsequent characters shall be parsed as a separate ex command.
10.
Otherwise, if the command is an edit, ex, or next command, or a visual command while in open or visual mode, the next part of the command shall be parsed as follows:
a.
Any '!' character immediately following the command shall be skipped and be part of the command.
b.
Any leading <blank>s shall be skipped and be part of the command.
c.
If the next character is a '+' , characters up to the first non-backslash-escaped <newline> or non-backslash-escaped <blank> shall be skipped and be part of the command.
d.
The rest of the command shall be determined by the steps specified in paragraph 12.
11.
Otherwise, if the command is a global, open, s, or v command, the next part of the command shall be parsed as follows:
a.
Any leading <blank>s shall be skipped and be part of the command.
b.
If the next character is not an alphanumeric, double-quote, <newline>, backslash, or vertical-line character:
1.
The next character shall be used as a command delimiter.
2.
If the command is a global, open, or v command, characters up to the first non-backslash-escaped <newline>, or first non-backslash-escaped delimiter character, shall be skipped and be part of the command.
3.
If the command is an s command, characters up to the first non-backslash-escaped <newline>, or second non-backslash-escaped delimiter character, shall be skipped and be part of the command.
c.
If the command is a global or v command, characters up to the first non-backslash-escaped <newline> shall be skipped and be part of the command.
d.
Otherwise, the rest of the command shall be determined by the steps specified in paragraph 12.
12.
Otherwise:
a.
If the command was a map, unmap, abbreviate, or unabbreviate command, characters up to the first non- <control>-V-escaped <newline>, vertical-line, or double-quote character shall be skipped and be part of the command.
b.
Otherwise, characters up to the first non-backslash-escaped <newline>, vertical-line, or double-quote character shall be skipped and be part of the command.
c.
If the command was an append, change, or insert command, and the step 12.b. ended at a vertical-line character, any subsequent characters, up to the next non-backslash-escaped <newline> shall be used as input text to the command.
d.
If the command was ended by a double-quote character, all subsequent characters, up to the next non-backslash-escaped <newline>, shall be discarded.
e.
The terminating <newline> or vertical-line character shall be discarded and any subsequent characters shall be parsed as a separate ex command.
Command arguments shall be parsed as described by the Synopsis and Description of each individual ex command. This parsing shall not be <blank>-sensitive, except for the ! argument, which must follow the command name without intervening <blank>s, and where it would otherwise be ambiguous. For example, count and flag arguments need not be <blank>-separated because "d22p" is not ambiguous, but file arguments to the ex next command must be separated by one or more <blank>s. Any <blank> in command arguments for the abbreviate, unabbreviate, map, and unmap commands can be <control>-V-escaped, in which case the <blank> shall not be used as an argument delimiter. Any <blank> in the command argument for any other command can be backslash-escaped, in which case that <blank> shall not be used as an argument delimiter.
Within command arguments for the abbreviate, unabbreviate, map, and unmap commands, any character can be <control>-V-escaped. All such escaped characters shall be treated literally and shall have no special meaning. Within command arguments for all other ex commands that are not regular expressions or replacement strings, any character that would otherwise have a special meaning can be backslash-escaped. Escaped characters shall be treated literally, without special meaning as shell expansion characters or '!' , '%' , and '#' expansion characters. See Regular Expressions in ex and Replacement Strings in ex for descriptions of command arguments that are regular expressions or replacement strings.
Non-backslash-escaped '%' characters appearing in file arguments to any ex command shall be replaced by the current pathname; unescaped '#' characters shall be replaced by the alternate pathname. It shall be an error if '%' or '#' characters appear unescaped in an argument and their corresponding values are not set.
Non-backslash-escaped '!' characters in the arguments to either the ex ! command or the open and visual mode ! command, or in the arguments to the ex read command, where the first non- <blank> after the command name is a '!' character, or in the arguments to the ex write command where the command name is followed by one or more <blank>s and the first non- <blank> after the command name is a '!' character, shall be replaced with the arguments to the last of those three commands as they appeared after all unescaped '%' , '#' , and '!' characters were replaced. It shall be an error if '!' characters appear unescaped in one of these commands and there has been no previous execution of one of these commands.
If an error occurs during the parsing or execution of an ex command:
*
An informational message to this effect shall be written. Execution of the ex command shall stop, and the cursor (for example, the current line and column) shall not be further modified.
*
If the ex command resulted from a map expansion, all characters from that map expansion shall be discarded, except as otherwise specified by the map command.
*
Otherwise, if the ex command resulted from the processing of an EXINIT environment variable, a .exrc file, a :source command, a -c option, or a + command specified to an ex edit, ex, next, or visual command, no further commands from the source of the commands shall be executed.
*
Otherwise, if the ex command resulted from the execution of a buffer or a global or v command, no further commands caused by the execution of the buffer or the global or v command shall be executed.
*
Otherwise, if the ex command was not terminated by a <newline>, all characters up to and including the next non-backslash-escaped <newline> shall be discarded.

Input Editing in ex

The following symbol is used in this and the following sections to specify command actions:
word
In the POSIX locale, a word consists of a maximal sequence of letters, digits, and underscores, delimited at both ends by characters other than letters, digits, or underscores, or by the beginning or end of a line or the edit buffer.
 
When accepting input characters from the user, in either ex command mode or ex text input mode, ex shall enable canonical mode input processing, as defined in the System Interfaces volume of IEEE Std 1003.1-2001.
If in ex text input mode:
1.
If the number edit option is set, ex shall prompt for input using the line number that would be assigned to the line if it is entered, in the format specified for the ex number command.
2.
If the autoindent edit option is set, ex shall prompt for input using autoindent characters, as described by the autoindent edit option. autoindent characters shall follow the line number, if any.
If in ex command mode:
1.
If the prompt edit option is set, input shall be prompted for using a single ':' character; otherwise, there shall be no prompt.
The input characters in the following sections shall have the following effects on the input line.

Scroll

Synopsis:
 
eof
 
See the description of the stty eof character in stty .
If in ex command mode: If the eof character is the first character entered on the line, the line shall be evaluated as if it contained two characters: a <control>-D and a <newline>.
Otherwise, the eof character shall have no special meaning.
 
If in ex text input mode: If the cursor follows an autoindent character, the autoindent characters in the line shall be modified so that a part of the next text input character will be displayed on the first column in the line after the previous shiftwidth edit option column boundary, and the user shall be prompted again for input for the same line.
Otherwise, if the cursor follows a '0' , which follows an autoindent character, and the '0' was the previous text input character, the '0' and all autoindent characters in the line shall be discarded, and the user shall be prompted again for input for the same line.
Otherwise, if the cursor follows a '^' , which follows an autoindent character, and the '^' was the previous text input character, the '^' and all autoindent characters in the line shall be discarded, and the user shall be prompted again for input for the same line. In addition, the autoindent level for the next input line shall be derived from the same line from which the autoindent level for the current input line was derived.
Otherwise, if there are no autoindent or text input characters in the line, the eof character shall be discarded.
Otherwise, the eof character shall have no special meaning.

<newline>

Synopsis:
 
<newline>
 
<control>-J
 
If in ex command mode: Cause the command line to be parsed; <control>-J shall be mapped to the <newline> for this purpose.
If in ex text input mode: Terminate the current line. If there are no characters other than autoindent characters on the line, all characters on the line shall be discarded.
Prompt for text input on a new line after the current line. If the autoindent edit option is set, an appropriate number of autoindent characters shall be added as a prefix to the line as described by the ex autoindent edit option.

<backslash>

Synopsis:
 
<backslash>
 
Allow the entry of a subsequent <newline> or <control>-J as a literal character, removing any special meaning that it may have to the editor during text input mode. The backslash character shall be retained and evaluated when the command line is parsed, or retained and included when the input text becomes part of the edit buffer.

<control>-V

Synopsis:
 
<control>-V
 
Allow the entry of any subsequent character as a literal character, removing any special meaning that it may have to the editor during text input mode. The <control>-V character shall be discarded before the command line is parsed or the input text becomes part of the edit buffer.
If the "literal next" functionality is performed by the underlying system, it is implementation-defined whether a character other than <control>-V performs this function.

<control>-W

Synopsis:
 
<control>-W
 
Discard the <control>-W, and the word previous to it in the input line, including any <blank>s following the word and preceding the <control>-W. If the "word erase" functionality is performed by the underlying system, it is implementation-defined whether a character other than <control>-W performs this function.

Command Descriptions in ex

The following symbols are used in this section to represent command modifiers. Some of these modifiers can be omitted, in which case the specified defaults shall be used.
1addr
A single line address, given in any of the forms described in Addressing in ex ; the default shall be the current line ( '.' ), unless otherwise specified.
If the line address is zero, it shall be an error, unless otherwise specified in the following command descriptions.
If the edit buffer is empty, and the address is specified with a command other than =, append, insert, open, put, read, or visual, or the address is not zero, it shall be an error.
2addr
Two addresses specifying an inclusive range of lines. If no addresses are specified, the default for 2addr shall be the current line only ( ".,." ), unless otherwise specified in the following command descriptions. If one address is specified, 2addr shall specify that line only, unless otherwise specified in the following command descriptions.
It shall be an error if the first address is greater than the second address.
If the edit buffer is empty, and the two addresses are specified with a command other than the !, write, wq, or xit commands, or either address is not zero, it shall be an error.
count
A positive decimal number. If count is specified, it shall be equivalent to specifying an additional address to the command, unless otherwise specified by the following command descriptions. The additional address shall be equal to the last address specified to the command (either explicitly or by default) plus count-1.
If this would result in an address greater than the la
©2011-2024 BusinessIT.cz, ISSN 1805-0522 | Názvy použité v textech mohou být ochrannými známkami příslušných vlastníků.
Provozovatel: Bispiral, s.r.o., kontakt: BusinessIT(at)Bispiral.com | Inzerce: Best Online Media, s.r.o., zuzana@online-media.cz
O vydavateli | Pravidla webu BusinessIT.cz a ochrana soukromí | Používáme účetní program Money S3 | pg(8838)