HP-UX Reference (11i v2 04/09) - 1 User Commands A-M (vol 1)

e
ex(1) ex(1)
for overhead. Thus a line length up to 4092 characters should cause no problem. An error message may
be written if the limit is exceeded during editing.
The
alternate pathname is the name of the last file mentioned in an editor command, or the previous
current pathname if the last file mentioned became the current file. When the
% appears in a pathname
entered as part of a command argument, it shall be replaced by the altername pathname. Any character,
including
% and # shall retain its literal value when preceded by a backslash.
When an error occurs,
ex shall alert ther terminal and write a message.
If the system crashes,
ex shall attempt to preserve the buffer if any unwritten changes were made. The
command-line option -r can be used to retrieve the saved changes.
During initialization (before the first file is read or any user commands from the terminal are processed),
if the environment variable
EXINIT is set, the editor shall execute
ex commands contained in that vari-
able. If the variable is not set,
ex
shall attempt to read commands from the $HOME/.exrc. If and only
if
EXINIT or $HOME/.exrc sets the editor option exrc, ex finally shall attempt to read commands from
afile .exrc in the current directory. In the event that
EXINIT is not set and the current directory is
the home directory of the user, any
.exrc
file shall only be processed once. No .exrc shall be read
unless it is owned by the same user ID as the effective user ID of the process. After any
.exrc files are
processed, any commands specified by the
-c option shall be processed.
By default,
ex shall start in the command mode, which shall be indicated by the ":" prompt. The input
mode can be entered by append, insert,orchange commands. There is one other mode, visual
mode, in which full screen editing is available. This is described more fully under the visual command.
The command line can consist of multiple ex commands separated by vertical-line characters (
|). The
use of commands that enter input or visual modes in this manner, unless they are the final command on
the line, produces undefined results.
Command lines beginning with the double-quote character (
") shall be ignored. This can be used for com-
ments in an editor script.
WARNINGS
The
undo command causes all marks to be lost on lines that are changed and then restored.
The
z command prints a number of logical rather than physical lines. More than a screenful of output
can result if long lines are present.
Null characters are discarded in input files and cannot appear in resultant files.
On some systems, the recovery of an edit file with the
-r option is possible only if certain system-
dependent actions are taken when the system is restarted.
Edit preserve files can only be recovered on systems running the same HP-UX release in which they were
preserved. Preserve files are not recoverable across different releases.
On HP terminals, the attribute field of any function key specified by a
map #n ... command should be set
to
normal rather than to the default of transmit.
Do not use the
-C option to edit unencrypted files. The -C option is meant to be used only on files that
are already encrypted. If the -C option is used on files which are not yet encrypted, a write in the edit
session is likely to corrupt the file.
For information about line length limits, file size limits, etc., see the WARNINGS section of vi(1).
RETURN VALUE (XPG4 Only)
The ex utility shall exit with one of the following values:
0 Successful completion.
>0 An error occurred.
AUTHOR
ex was developed by the University of California, Berkeley. The 16-bit extensions to ex are based in
part on software of the Toshiba Corporation.
FILES
$HOME/.exrc Primary editor initialization file
./.exrc Secondary editor initialization file
Section 1−−284 Hewlett-Packard Company − 18 − HP-UX 11i Version 2: September 2004