This command is a built-in command in the Korn Shell.
When the emacs option is set, interactive input line
editing is enabled. This mode is slightly different from the emacs
mode in the original Korn shell, and the eighth bit is stripped in
emacs mode. In this mode, various editing commands (typically bound
to one or more control characters) cause immediate actions without
waiting for a newline. Several editing commands are bound to
particular control characters when the shell is invoked. The
bind command can change these bindings.
Without any options, bind(1) lists the current bindings.
The options for bind(1) are as follows:
string=editing-command
The specified editing-command is bound to the given
string, which should consist of a control character (which
can be written using caret notation ^X), optionally preceded by one
of the two prefix characters. Future input of the string will cause
the editing command to be invoked immediately. Although only two
prefix characters (usually ESC and ^X) are supported, some
multicharacter sequences can be supported. The following binds the
arrow keys on an American National Standards Institute (ANSI)
terminal, or xterm (these are in the default bindings). Some escape
sequences, however, will not work quite this well:
Lists the names of the functions to which you can bind
keys.
-mstring=substitute
The specified input string will afterwards be immediately
replaced by the given substitute string, which can contain editing
commands.
Below is a list of available editing commands. Each description
starts with the name of the command, an n if the command can
be prefixed with a count, and any keys the command is bound to by
default (written using caret notation; for example, ASCII ESC
character is written as ^[). A count prefix for a command is
entered using the sequence ^[n, where n is a sequence
of 1 or more digits. Unless otherwise specified, if a count is
omitted, it defaults to 1. Note that editing-command names are used
only with the bind(1) command. Furthermore, many editing
commands are useful only on terminals with a visible cursor. The
default bindings were chosen to resemble corresponding emacs key
bindings. The users' tty characters (such as ERASE) are bound to
reasonable substitutes and override the default bindings.
abort ^G
Useful as a response to a request for a search-history pattern
in order to abort the search.
auto-insertn
Simply causes the character to appear as literal input. Most
ordinary characters are bound to this.
backward-charn^B
Moves the cursor backward n characters.
backward-word n ^[B
Moves the cursor backward to the beginning of a word; words
consist of alphanumerics, underscore (_) and dollar sign ($).
beginning-of-history ^[<
Moves to the beginning of the history.
beginning-of-line ^A
Moves the cursor to the beginning of the edited input
line.
capitalize-wordn^[c, ^[C
Capitalize the first character in the next n words,
leaving the cursor past the end of the last word.
comment ^[#
If the current line does not begin with a comment character,
one is added at the beginning of the line, and the line is entered
(as if return had been pressed); otherwise, the existing comment
characters are removed, and the cursor is placed at the beginning
of the line.
complete ^[^[
Automatically completes as much as is unique of the command
name or the file name containing the cursor. If the entire
remaining command or file name is unique, a space is printed after
its completion unless it is a directory name. In this case /
is appended. If there is no command or file name with the current
partial word as its prefix, a bell character is output (usually
causing a audio beep).
complete-command ^X^[
Automatically completes as much as is unique of the command
name having the partial word up to the cursor as its prefix, as in
the complete command.
complete-file ^[^X
Automatically completes as much as is unique of the file name
having the partial word up to the cursor as its prefix, as in the
complete command.
complete-list ^[=
List the possible completions for the current word.
delete-char-backwardnERASE, ^?, ^H
Deletes n characters before the cursor.
delete-char-forwardn
Deletes n characters after the cursor.
delete-word-backwardn^[ERASE, ^[^?, ^[^H,
^[h
Deletes n words before the cursor.
delete-word-forwardn^[d
Deletes characters after the cursor up to the end of n
words.
down-historyn^N
Scrolls the history buffer forward n lines (later). Each
input line originally starts just after the last entry in the
history buffer, so down-history is not useful until either
search-history or up-history has been performed.
downcase-wordn^[L, ^[l
Lowercases the next n words.
end-of-history ^[>
Moves to the end of the history.
end-of-line ^E
Moves the cursor to the end of the input line.
eot ^_
Acts as an end-of-file. This is useful because edit-mode input
disables normal terminal input canonicalization.
eot-or-deleten^D
Acts as eot if alone on a line; otherwise, acts as
delete-char-forward.
error
Error (ring the bell).
exchange-point-and-mark ^X^X
Places the cursor where the mark is, and sets the mark to where
the cursor was.
expand-file ^[*
Appends an asterisk (*) to the current word and replaces
the word with the result of performing file globbing on the word.
If no files match the pattern, the bell rings.
forward-charn^F
Moves the cursor forward n characters.
forward-wordn^[f
Moves the cursor forward to the end of the word n.
goto-historyn^[g
Goes to history number n.
kill-line KILL
Deletes the entire input line.
kill-region ^W
Deletes the input between the cursor and the mark.
kill-to-eol n ^K
Deletes the input from the cursor to the end of the line if
n is not specified; otherwise, deletes characters between
the cursor and column n.
list ^[?
Prints a sorted, columnated list of command names or file names
(if any) that can complete the partial word containing the cursor.
Directory names have / appended to them.
list-command ^X?
Prints a sorted, columnated list of command names (if any) that
can complete the partial word containing the cursor.
list-file ^X^Y
Prints a sorted, columnated list of file names (if any) that
can complete the partial word containing the cursor. File type
indicators are appended as described under list.
newline ^J, ^M
Causes the current input line to be processed by the shell. The
current cursor position can be anywhere on the line.
newline-and-next ^O
Causes the current input line to be processed by the shell, and
the next line from history becomes the current line. This is only
useful after an up-history or search-history.
no-op QUIT
Does nothing.
prefix-1 ^[
Introduces a two-character command sequence.
prefix-2 ^X
prefix-2 ^[[
Introduces a two-character command sequence.
prev-hist-wordn^[., ^[_
The last word (specified by n) of the previous command
is inserted at the cursor.
quote ^^
The following character is taken literally rather than as an
editing command.
redraw ^L
Reprints the prompt string and the current input line.
search-character-backwardn^[^]
Search backward in the current line for occurrence n of
the next character typed.
search-character-forward n ^]
Search forward in the current line for occurrence n of
the next character typed.
search-history ^R
Enter incremental search mode. The internal history list is
searched backwards for commands matching the input. An initial ^ in
the search string anchors the search. The abort key will leave
search mode. Other commands will be executed after leaving search
mode. Successive search-history commands continue searching
backward to the next previous occurrence of the pattern. The
history buffer retains only a finite number of lines; the oldest
are discarded as necessary.
set-mark-command ^[<space>
Set the mark at the cursor position.
stuff
On systems supporting it, pushes the bound character back onto
the terminal input where it can receive special processing by the
terminal handler. This is useful for the BRL ^T mini-systat
feature, for example.
stuff-reset
Acts like stuff, then aborts input the same as an
interrupt.
transpose-chars ^T
If at the end-of-line, or if the gmacs option is set, this
exchanges the two previous characters; otherwise, it exchanges the
previous and current characters and moves the cursor one character
to the right.
up-historyn^P
Scrolls the history buffer backward n lines
(earlier).
upcase-wordn^[U, ^[u
Capitalizes the next n words.
version ^V
Display the version of ksh(1). The current edit buffer
is restored as soon as any key is pressed (the key is then
processed, unless it is a SPACE).
yank ^Y
Inserts the most recently killed text string at the current
cursor position.
yank-pop ^[y
Immediately after a yank, replaces the inserted text string
with the next previously killed text string.