294
Chapter 29. Command Line Editing
29.2.5. Searching for Commands in the History
Readline provides commands for searching through the command history for lines containing a spec-
ified string. There are two search modes:
incremental
and
non-incremental
.
Incremental searches begin before the user has finished typing the search string. As each character of
the search string is typed, Readline displays the next entry from the history matching the string typed
so far. An incremental search requires only as many characters as needed to find the desired history
entry. To search backward in the history for a particular string, type
C-r
. Typing
C-s
searches for-
ward through the history. The characters present in the value of the
isearch-terminators
variable
are used to terminate an incremental search. If that variable has not been assigned a value, the [ESC]
and
C-J
characters will terminate an incremental search.
C-g
will abort an incremental search and
restore the original line. When the search is terminated, the history entry containing the search string
becomes the current line.
To find other matching entries in the history list, type
C-r
or
C-s
as appropriate. This will search
backward or forward in the history for the next entry matching the search string typed so far. Any other
key sequence bound to a Readline command will terminate the search and execute that command. For
instance, a [RET] will terminate the search and accept the line, thereby executing the command from
the history list. A movement command will terminate the search, make the last line found the current
line, and begin editing.
Readline remembers the last incremental search string. If two
C-r
s are typed without any intervening
characters defining a new search string, any remembered search string is used.
Non-incremental searches read the entire search string before starting to search for matching history
lines. The search string may be typed by the user or be part of the contents of the current line.
29.3. Readline Init File
Although the Readline library comes with a set of Emacs-like keybindings installed by default, it is
possible to use a different set of keybindings. Any user can customize programs that use Readline
by putting commands in an
inputrc
file, conventionally in his home directory. The name of this file
is taken from the value of the environment variable
INPUTRC
. If that variable is unset, the default is
~/.inputrc
.
When a program which uses the Readline library starts up, the init file is read, and the key bindings
are set.
In addition, the
C-x C-r
command re-reads this init file, thus incorporating any changes that you
might have made to it.
29.3.1. Readline Init File Syntax
There are only a few basic constructs allowed in the Readline init file. Blank lines are ignored. Lines
beginning with a
#
are comments. Lines beginning with a
$
indicate conditional constructs (refer to
Section 29.3.2
Conditional Init Constructs
). Other lines denote variable settings and key bindings.
Variable Settings
You can modify the run-time behavior of Readline by altering the values of variables in Readline
using the
set
command within the init file. The syntax is simple:
set
variable value
Here, for example, is how to change from the default Emacs-like key binding to use
vi
line
editing commands:
set editing-mode vi
Summary of Contents for ENTERPRISE LINUX 3 - SECURITY GUIDE
Page 1: ...Red Hat Enterprise Linux 3 Debugging with gdb ...
Page 12: ...2 Chapter 1 Debugging with gdb ...
Page 28: ...18 Chapter 4 Getting In and Out of gdb ...
Page 34: ...24 Chapter 5 gdb Commands ...
Page 44: ...34 Chapter 6 Running Programs Under gdb ...
Page 68: ...58 Chapter 8 Examining the Stack ...
Page 98: ...88 Chapter 10 Examining Data ...
Page 112: ...102 Chapter 12 Tracepoints ...
Page 118: ...108 Chapter 13 Debugging Programs That Use Overlays ...
Page 138: ...128 Chapter 14 Using gdb with Different Languages ...
Page 144: ...134 Chapter 15 Examining the Symbol Table ...
Page 170: ...160 Chapter 19 Debugging remote programs ...
Page 198: ...188 Chapter 21 Controlling gdb ...
Page 204: ...194 Chapter 22 Canned Sequences of Commands ...
Page 206: ...196 Chapter 23 Command Interpreters ...
Page 216: ...206 Chapter 25 Using gdb under gnu Emacs ...
Page 296: ...286 Chapter 27 gdb Annotations ...
Page 300: ...290 Chapter 28 Reporting Bugs in gdb ...
Page 322: ...312 Chapter 30 Using History Interactively ...
Page 362: ...352 Appendix D gdb Remote Serial Protocol ...
Page 380: ...370 Appendix F GNU GENERAL PUBLIC LICENSE ...
Page 386: ...376 Appendix G GNU Free Documentation License ...
Page 410: ......