e
ex(1) | ex(1) |
Set encryption mode. You are prompted for a key to initiate the creation or editing of an | |
| encrypted ®le (see the crypt command in Command Descriptions below). |
Encryption option. Same as the | |
| been encrypted. |
(XPG4 only.) | |
+command | (Obsolescent) Begin editing by executing the speci®ed ex search or positioning command. |
file | Specify the ®le or ®les to be edited. If more than one ®le is speci®ed, they are processed in |
| the order given. If the |
(XPG4 only.) If both the
De®nitions
Current ®le. The name of the ®le being edited by ex is called the current ®le. Text from the current ®le is read into a work area, and all editing changes are performed on this work area. Changes do not affect the original ®le until the work area is explicitly written back to the ®le. If the % character is used as a ®le name, it is replaced by the current ®le name.
Alternate ®le. The alternate ®le is the name of the last ®le mentioned in an editor command, or the previous current ®le name if the last ®le mentioned becomes the current ®le. If the # character is used as a ®le name, it is replaced by the alternate ®le name.
Buffers.
Readonly ¯ag. The readonly ¯ag can be cleared from within the editor by setting the noreadonly editor option (see Editor Options below). Writing to a different ®le is allowed even when the readonly ¯ag is set. Also, a write can be forced to a readonly ®le by using ! after the write command (see the write command in Command Descriptions below).
Interrupt. If an interrupt signal is received, and commands are being supplied from a keyboard, ex returns to command mode. If editor commands are coming from a ®le, an interrupt signal causes ex to abort.
System crash. If the system crashes or ex aborts due to an internal error or unexpected signal, ex attempts to preserve the work area if any unwritten changes were made. Use the
Command mode/input mode. ex starts up in command mode, as indicated by the colon (:) prompt. ex switches to input mode whenever an append, change, or insert command is encountered. To terminate input mode and return to command mode, type a period (.) alone at the beginning of a line.
Comments. Command lines beginning with a quotation mark (") are ignored (this is useful for placing comments in an editor script).
Multiple commands can be combined on a single line by separating them with a vertical bar character (). However, global commands, comments, and the shell escape command must be the last command on a line because they cannot be terminated by a character.
Addressing
(XPG4 only.) Addressing in ex relates to the current line. In general, the current line shall be the last line affected by the command; the exact effect on the current line is discussed under the description of each command. When the buffer contains no lines, the current line shall be set to zero.
ex recognizes the following line address forms:
. Dot or period (.) refers to the current line. There is always a current line whose position can be the result of an explicit movement command or the result of a command that affects multiple lines (in which case it is usually the last line affected).
nThe nth line in the work area. Lines are numbered sequentially, starting at line 1.
$ | The last line in the work area. |
% | Abbreviation for 1,$, meaning the entire work area. |
Section 1−242 | − 2 − |