Chapter 30.
Using History Interactively
This chapter describes how to use the GNU History Library interactively, from a user’s standpoint. It
should be considered a user’s guide.
30.1. History Expansion
The History library provides a history expansion feature that is similar to the history expansion pro-
vided by
csh
. This section describes the syntax used to manipulate the history information.
History expansions introduce words from the history list into the input stream, making it easy to
repeat commands, insert the arguments to a previous command into the current input line, or fix errors
in previous commands quickly.
History expansion takes place in two parts. The first is to determine which line from the history list
should be used during substitution. The second is to select portions of that line for inclusion into the
current one. The line selected from the history is called the
event
, and the portions of that line that are
acted upon are called
words
. Various
modifiers
are available to manipulate the selected words. The
line is broken into words in the same fashion that Bash does, so that several words surrounded by
quotes are considered one word. History expansions are introduced by the appearance of the history
expansion character, which is
!
by default.
30.1.1. Event Designators
An event designator is a reference to a command line entry in the history list.
!
Start a history substitution, except when followed by a space, tab, the end of the line,
=
or
(
.
!
n
Refer to command line
n
.
!-
n
Refer to the command
n
lines back.
!!
Refer to the previous command. This is a synonym for
!-1
.
!
string
Refer to the most recent command starting with
string
.
!?
string
[?]
Refer to the most recent command containing
string
. The trailing
?
may be omitted if the
string
is followed immediately by a newline.
^
string1
^
string2
^
Quick Substitution. Repeat the last command, replacing
string1
with
string2
. Equivalent to
!!:s/
string1
/
string2
/
.
Summary of Contents for ENTERPRISE LINUX 4 - DEVELOPER TOOLS GUIDE
Page 1: ...Red Hat Enterprise Linux 4 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: ......