EX(1) — USER COMMANDS
NAME
ex, edit, e − line editor
SYNOPSIS
ex [ − ] [ −lrRvx ] [ −t tag ] [ −wnnn ] [ +command ] filename...
edit [ options ]
DESCRIPTION
ex, a line editor, is the root of a family of editors that includes edit, ex(1), and vi(1) (the display editor). In most cases vi is preferred for interactive use.
OPTIONS
−
Suppress all interactive feedback to the user (useful for processing ex scripts in shell files).
−l Set up for editing LISP programs.
−r Recover the indicated filenames after a system crash.
−R Read only. Do not overwrite the original file.
−v Start up in display editing state using vi. You can achieve the same effect by simply typing the vi command itself.
−x Prompt for a key to be used in encrypting the file being edited.
−t tag Edit the file containing the tag tag. A tags database must first be created using the ctags(1) command.
−wnnn Set the default window (number of lines on your terminal) to nnn — this is useful if you are dialing into the system over a slow phone line.
+command
Start the editing session by executing command.
ENVIRONMENT
The editor recognizes the environment variable EXINIT as a command (or list of commands separated by | characters) to run when it starts up. If this variable is undefined, the editor checks for startup commands in the file ~/.exrc file, which you must own. However, if there is a .exrc owned by you in the current directory, the editor takes its startup commands from this file — overriding both the file in your home directory and the environment variable.
FILES
/usr/lib/ex?.?strings
error messages
/usr/lib/ex?.?recover
recover command
/usr/lib/ex?.?preserve
preserve command
/etc/termcap describes capabilities of terminals
.exrc editor startup file for current directory
./.exrc user’s editor startup file
~/.exrc user’s editor startup file if ./.exrc is not found
/tmp/Exnnnnn editor temporary file
/tmp/Rxnnnnn file named buffer temporary
/var/preserve preservation directory
SEE ALSO
awk(1), ctags(1), ed(1), vi(1), grep(1V), sed(1V), termcap(5), environ(5V)
Editing Text Files
BUGS
All marks are lost on lines changed and then restored with the undo commmand, if the marked lines were changed. undo never clears the buffer modified condition.
The z command prints a number of logical rather than physical lines. More than a screen full of output may result if long lines are present.
File input/output errors do not print a name if the command line ‘−’ option is used.
There is no easy way to do a single scan ignoring case.
The editor does not warn if text is placed in named buffers and not used before exiting the editor.
Null characters are discarded in input files, and cannot appear in resultant files.
With the modeline option in effect, the editor checks the first five lines of the text file for commands of the form
ex: command:
or
vi: command:
if any are found, the editor executes them. This can result in unexpected behavior, and is not recommended in any case. In earlier releases, modeline was in effect by default. Now it is not, but setting it in the .exrc file or the EXINIT environment variable can still produce untoward effects.
RESTRICTIONS
The encryption facilities of ex are not available on software shipped outside the U.S.
Sun Release 4.0 — Last change: 22 March 1989