HP-UX Reference (11i v3 07/02) - 1 User Commands N-Z (vol 2)
s
sh-posix(1) sh-posix(1)
command is printed and reexecuted upon leaving the editor. The editor name
- is used to skip the editing
phase and to reexecute the command. In this case, a substitution parameter of the form old
=new can be
used to modify the command before execution. For example, if
r is aliased to fc -e -, typing r
bad=good c
reexecutes the most recent command that starts with the letter
c and replaces the first
occurrence of the string
bad with the string
good.
The history file will be trimmed when all of the following conditions occurs:
Its size is greater than four kilobytes.
The number of commands in it is more than
HISTSIZE.
The file has not been modified in the last ten minutes.
The user has write permission for the directory in which the history file resides.
If any one of the above conditions does not occur, the history file will not be trimmed. When the history file
is trimmed, the latest
HISTSIZE commands will be available in the history file.
Command Line Editing
Normally, each command line typed at a terminal device is followed by a newline or return. If one of the
emacs, gmacs, vi,orviraw, options is set, you can edit the command line. An editing option is
automatically selected each time the
VISUAL or EDITOR variable is assigned a value ending in one of
these option names.
The editing features require that the user’s terminal accept return without line feed and that a space (" ")
must overwrite the current character on the screen. ADM terminal users should set the "space − advance"
switch to "space". Hewlett-Packard terminal users should set the straps to "bcGHxZ etX".
The editing modes enable the user to look through a window at the current line. The default window width
is 80, unless the value of
COLUMNS is defined. If the line is longer than the window width minus two, a
mark displayed at the end of the window notifies the user. The mark is one of:
> The line extends to the right.
< The line extends to the left.
* The line extends to both sides of the window.
As the cursor moves and reaches the window boundaries, the window is centered about the cursor.
The search commands in each edit mode provide access to the history file. Only strings are matched, not
patterns, although a leading ˆ in the string restricts the match to begin at the first character in the line.
Changing the LC_TYPE environment variable can affect the editors. See the Parameter Substitution sub-
section.
emacs/gmacs Editing Mode
This mode is invoked by either the
emacs or gmacs option. The sole difference is how they handle
Control-T.
To edit, the user moves the cursor to the point needing correction and inserts or deletes characters or
words. All editing commands are control characters or escape sequences. The notation for control charac-
ters is caret (ˆ) followed by a character. For example, ˆF is the notation for Control-F. This is entered by
holding down the Ctrl (control) key and pressing
f. The shift key is not pressed. The notation ˆ? indicates
the delete (DEL) key.
The notation for escape sequences is M- followed by a character. For example, M-f (pronounced meta f)is
entered by pressing the escape key (Esc) followed by pressing f. M-F is the notation for escape followed by
shift (capital) F.
All edit commands operate from any place on the line (not only at the beginning). Neither the return (ˆM)
nor the newline (ˆJ) key is entered after edit commands, except when noted.
^F Move cursor forward (right) one character.
M-f Move cursor forward one word. (The editor’s idea of a word is a string of characters
consisting of only letters, digits and underscores.)
^B Move cursor backward (left) one character.
M-b Move cursor backward one word.
HP-UX 11i Version 3: February 2007 − 21 − Hewlett-Packard Company 263