ex Command

Purpose

Editor for text files.

Syntax

ex[ -c Subcommand] [ -l] [ -R] [ -s] [ -tTag] [ -V ] [ -wNumber] [ -v| -] [ +[Subcommand]] [ -r[File]] [File...]

Description

The ex command starts the ex editor. The ex editor is part of a family of editors that includes the edit editor, which is a simpler version of the ex editor for novice or casual use, and the vi editor, which is a full-screen display editor. Calling the vi editor directly sets environment variables for screen editing. The ex editor is more powerful than a simple line editor because it is a subset of the vi editor and can access the screen editing capabilities of the vi editor.

The File parameter specifies the file or files to be edited. If you supply more than one file name, the ex editor edits each file in the specified order.

Notes:
  1. o determine how your workstation can perform more efficiently, the ex editor uses the workstation capability database terminfo and the type of the workstation you are using from the TERM environment variable.
  2. The ex command affects the current line unless you specify otherwise. In order to work with different parts of the file, you need to know how to address lines in a file.
  3. If the standard input is not a terminal device, it shall be as if you have specified the -s flag.

Flags

Item Description
-c Subcommand Carries out the ex editor subcommand before editing begins. When a null operand is typed, as in -c '' , the editor places the current line at the bottom of the file. (Usually, the ex editor sets the current line at the start of the file or at some specified tag or pattern.)
-l Indents appropriately for LISP code and accepts the ( ) (open or close parenthesis), { } (left or right brace), and the [[ ]] (double left or double right bracket) characters as text rather than interpreting them as vi subcommands. This flag is active in visual and open modes.
-R Sets the readonly option, preventing you from altering the file.
-s Suppresses all interactive-user feedback. If you use this flag, file input and output errors do not generate a helpful error message. Using this flag is the same as using the - flag. 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.
-t Tag Loads the file that contains the tag indicated by the parameter Tag and positions the editor at that tag. To use this flag, you must first create a database of function names and their locations using the ctags command.
-wNumber Sets the default window size to Number.
-v Invokes the vi editor.
Note: When the -v flag is selected, an enlarged set of subcommands are available, including screen editing and cursor movement features. See the vi command.
-V Invokes the editor in verbose mode.
- Suppresses all interactive-user feedback. If you use this flag, file input/output errors do not generate a helpful error message. Using this flag is the same as using the -s flag.
+[Subcommand] Begins an edit at the specified editor search or subcommand. When no parameter is typed, the +Subcommand places the current line at the bottom of the file. Usually, the ex editor sets the current line to the start of the file, or to some specified tag or pattern.
-r [File] Recovers a file after an editor or system crash. If you do not specify the File parameter, a list of all saved files is displayed.

Exit Status

The following exit values are returned:

Item Description
0 Successful completion.
>0 An error occurred.

Files

Item Description
/usr/lbin/exrecover Recover subcommand
/usr/lbin/expreserve Preserve subcommand
$HOME/.exrc Editor startup file
./.exrc Editor startup file
/var/tmp/Exnnnnn Editor temporary
/var/tmp/Rxnnnnn Names buffer temporary
/var/preserve Preservation directory