2 This file documents the user interface to the GNU History library.
4 Copyright (C) 1988, 1991 Free Software Foundation, Inc.
7 Permission is granted to make and distribute verbatim copies of this manual
8 provided the copyright notice and this permission notice are preserved on
11 Permission is granted to process this file through Tex and print the
12 results, provided the printed document carries copying permission notice
13 identical to this one except for the removal of this paragraph (this
14 paragraph not being relevant to the printed manual).
16 Permission is granted to copy and distribute modified versions of this
17 manual under the conditions for verbatim copying, provided also that the
18 GNU Copyright statement is available to the distributee, and provided that
19 the entire resulting derived work is distributed under the terms of a
20 permission notice identical to this one.
22 Permission is granted to copy and distribute translations of this manual
23 into another language, under the above conditions for modified versions.
26 @node Using History Interactively
27 @chapter Using History Interactively
29 This chapter describes how to use the GNU History Library interactively,
30 from a user's standpoint. It should be considered a user's guide. For
31 information on using the GNU History Library in your own programs,
32 @pxref{Programming with GNU History}.
35 * History Interaction:: What it feels like using History as a user.
38 @node History Interaction
39 @section History Interaction
42 The History library provides a history expansion feature that is similar
43 to the history expansion in Csh. The following text describes the sytax
44 that you use to manipulate the history information.
46 History expansion takes place in two parts. The first is to determine
47 which line from the previous history should be used during substitution.
48 The second is to select portions of that line for inclusion into the
49 current one. The line selected from the previous history is called the
50 @dfn{event}, and the portions of that line that are acted upon are
51 called @dfn{words}. The line is broken into words in the same fashion
52 that the Bash shell does, so that several English (or Unix) words
53 surrounded by quotes are considered as one word.
56 * Event Designators:: How to specify which history line to use.
57 * Word Designators:: Specifying which words are of interest.
58 * Modifiers:: Modifying the results of susbstitution.
61 @node Event Designators
62 @subsection Event Designators
63 @cindex event designators
65 An event designator is a reference to a command line entry in the
71 Start a history subsititution, except when followed by a space, tab, or
72 the end of the line... @key{=} or @key{(}.
75 Refer to the previous command. This is a synonym for @code{!-1}.
78 Refer to command line @var{n}.
81 Refer to the command line @var{n} lines back.
84 Refer to the most recent command starting with @var{string}.
86 @item @code{!?string}[@code{?}]
87 Refer to the most recent command containing @var{string}.
91 @node Word Designators
92 @subsection Word Designators
94 A @key{:} separates the event specification from the word designator. It
95 can be omitted if the word designator begins with a @key{^}, @key{$},
96 @key{*} or @key{%}. Words are numbered from the beginning of the line,
97 with the first word being denoted by a 0 (zero).
102 The zero'th word. For many applications, this is the command word.
108 The first argument. that is, word 1.
114 The word matched by the most recent @code{?string?} search.
117 A range of words; @code{-@var{y}} Abbreviates @code{0-@var{y}}.
120 All of the words, excepting the zero'th. This is a synonym for @code{1-$}.
121 It is not an error to use @key{*} if there is just one word in the event.
122 The empty string is returned in that case.
127 @subsection Modifiers
129 After the optional word designator, you can add a sequence of one or more
130 of the following modifiers, each preceded by a @key{:}.
135 The entire command line typed so far. This means the current command,
136 not the previous command, so it really isn't a word designator, and doesn't
137 belong in this section.
140 Remove a trailing pathname component, leaving only the head.
143 Remove a trailing suffix of the form @samp{.}@var{suffix}, leaving the basename.
146 Remove all but the suffix.
149 Remove all leading pathname components, leaving the tail.
152 Print the new command but do not execute it.