Readline 5.1 import for HEAD.
[deliverable/binutils-gdb.git] / readline / doc / inc-hist.texinfo
index 06774b74916534eda0c493053346d2b52c2d5e36..b5ed3cb483014f2499a9274008a813c20cd83fb8 100644 (file)
@@ -1,7 +1,7 @@
 @ignore
 This file documents the user interface to the GNU History library.
 
-Copyright (C) 1988, 1991, 1996 Free Software Foundation, Inc.
+Copyright (C) 1988-2002 Free Software Foundation, Inc.
 Authored by Brian Fox and Chet Ramey.
 
 Permission is granted to make and distribute verbatim copies of this manual
@@ -26,18 +26,22 @@ into another language, under the above conditions for modified versions.
 @node Using History Interactively
 @chapter Using History Interactively
 
+@c @ifclear BashFeatures
+@c @defcodeindex bt
+@c @end ifclear
+
 @ifset BashFeatures
-This chapter describes how to use the GNU History Library interactively,
-from a user's standpoint.  It should be considered a user's guide.  For
-information on using the GNU History Library in other programs,
-see the GNU Readline Library Manual.
+This chapter describes how to use the @sc{gnu} History Library
+interactively, from a user's standpoint.
+It should be considered a user's guide.
+For information on using the @sc{gnu} History Library in other programs,
+see the @sc{gnu} Readline Library Manual.
 @end ifset
 @ifclear BashFeatures
-This chapter describes how to use the GNU History Library interactively,
-from a user's standpoint.  It should be considered a user's guide.  
-@c For
-@c information on using the GNU History Library in your own programs,
-@c @pxref{Programming with GNU History}.
+This chapter describes how to use the @sc{gnu} History Library interactively,
+from a user's standpoint.  It should be considered a user's guide.
+For information on using the @sc{gnu} History Library in other programs,
+see the @sc{gnu} Readline Library Manual.
 @end ifclear
 
 @ifset BashFeatures
@@ -61,42 +65,50 @@ from a user's standpoint.  It should be considered a user's guide.
 @cindex command history
 @cindex history list
 
-When the @samp{-o history} option to the @code{set} builtin
+When the @option{-o history} option to the @code{set} builtin
 is enabled (@pxref{The Set Builtin}),
-the shell provides access to the @var{command history},
-the list of commands previously typed.  The text of the last
-@code{HISTSIZE}
-commands (default 500) is saved in a history list.  The shell
-stores each command in the history list prior to parameter and
-variable expansion
+the shell provides access to the @dfn{command history},
+the list of commands previously typed.
+The value of the @env{HISTSIZE} shell variable is used as the
+number of commands to save in a history list.
+The text of the last @env{$HISTSIZE}
+commands (default 500) is saved.
+The shell stores each command in the history list prior to
+parameter and variable expansion
 but after history expansion is performed, subject to the
 values of the shell variables
-@code{HISTIGNORE} and @code{HISTCONTROL}.
+@env{HISTIGNORE} and @env{HISTCONTROL}.
+
 When the shell starts up, the history is initialized from the
-file named by the @code{HISTFILE} variable (default @file{~/.bash_history}).
-@code{HISTFILE} is truncated, if necessary, to contain no more than
-the number of lines specified by the value of the @code{HISTFILESIZE}
-variable.  When an interactive shell exits, the last
-@code{HISTSIZE} lines are copied from the history list to @code{HISTFILE}.
+file named by the @env{HISTFILE} variable (default @file{~/.bash_history}).
+The file named by the value of @env{HISTFILE} is truncated, if
+necessary, to contain no more than the number of lines specified by
+the value of the @env{HISTFILESIZE} variable.
+When an interactive shell exits, the last
+@env{$HISTSIZE} lines are copied from the history list to the file
+named by @env{$HISTFILE}.
 If the @code{histappend} shell option is set (@pxref{Bash Builtins}),
 the lines are appended to the history file,
 otherwise the history file is overwritten.
-If @code{HISTFILE}
+If @env{HISTFILE}
 is unset, or if the history file is unwritable, the history is
 not saved.  After saving the history, the history file is truncated
-to contain no more than @code{$HISTFILESIZE}
-lines.  If @code{HISTFILESIZE} is not set, no truncation is performed.
+to contain no more than @env{$HISTFILESIZE}
+lines.  If @env{HISTFILESIZE} is not set, no truncation is performed.
+
+If the @env{HISTTIMEFORMAT} is set, the time stamp information
+associated with each history entry is written to the history file.
 
 The builtin command @code{fc} may be used to list or edit and re-execute
 a portion of the history list.
-The @code{history} builtin can be used to display or modify the history
+The @code{history} builtin may be used to display or modify the history
 list and manipulate the history file.
-When using the command-line editing, search commands
+When using command-line editing, search commands
 are available in each editing mode that provide access to the
-history list.
+history list (@pxref{Commands For History}).
 
 The shell allows control over which commands are saved on the history
-list.  The @code{HISTCONTROL} and @code{HISTIGNORE}
+list.  The @env{HISTCONTROL} and @env{HISTIGNORE}
 variables may be set to cause the shell to save only a subset of the
 commands entered.
 The @code{cmdhist}
@@ -106,19 +118,20 @@ semicolons where necessary to preserve syntactic correctness.
 The @code{lithist}
 shell option causes the shell to save the command with embedded newlines
 instead of semicolons.
+The @code{shopt} builtin is used to set these options.
 @xref{Bash Builtins}, for a description of @code{shopt}.
 
 @node Bash History Builtins
 @section Bash History Builtins
 @cindex history builtins
 
-Bash provides two builtin commands that allow you to manipulate the
+Bash provides two builtin commands which manipulate the
 history list and history file.
 
 @table @code
 
 @item fc
-@btindex fc
+@btindex fc
 @example
 @code{fc [-e @var{ename}] [-nlr] [@var{first}] [@var{last}]}
 @code{fc -s [@var{pat}=@var{rep}] [@var{command}]}
@@ -131,15 +144,15 @@ command beginning with that string) or as a number (an index into the
 history list, where a negative number is used as an offset from the
 current command number).  If @var{last} is not specified it is set to
 @var{first}.  If @var{first} is not specified it is set to the previous
-command for editing and @minus{}16 for listing.  If the @samp{-l} flag is
-given, the commands are listed on standard output.  The @samp{-n} flag
-suppresses the command numbers when listing.  The @samp{-r} flag
+command for editing and @minus{}16 for listing.  If the @option{-l} flag is
+given, the commands are listed on standard output.  The @option{-n} flag
+suppresses the command numbers when listing.  The @option{-r} flag
 reverses the order of the listing.  Otherwise, the editor given by
 @var{ename} is invoked on a file containing those commands.  If
 @var{ename} is not given, the value of the following variable expansion
 is used: @code{$@{FCEDIT:-$@{EDITOR:-vi@}@}}.  This says to use the
-value of the @code{FCEDIT} variable if set, or the value of the
-@code{EDITOR} variable if that is set, or @code{vi} if neither is set.
+value of the @env{FCEDIT} variable if set, or the value of the
+@env{EDITOR} variable if that is set, or @code{vi} if neither is set.
 When editing is complete, the edited commands are echoed and executed.
 
 In the second form, @var{command} is re-executed after each instance
@@ -150,25 +163,35 @@ that typing @samp{r cc} runs the last command beginning with @code{cc}
 and typing @samp{r} re-executes the last command (@pxref{Aliases}).
 
 @item history
-@btindex history
+@btindex history
 @example
-history [-c] [@var{n}]
+history [@var{n}]
+history -c
+history -d @var{offset}
 history [-anrw] [@var{filename}]
 history -ps @var{arg}
 @end example
 
-Display the history list with line numbers.  Lines prefixed with
-with a @samp{*} have been modified.  An argument of @var{n} says
-to list only the last @var{n} lines.  Options, if supplied, have
-the following meanings:
+With no options, display the history list with line numbers.
+Lines prefixed with a @samp{*} have been modified.
+An argument of @var{n} lists only the last @var{n} lines.
+If the shell variable @env{HISTTIMEFORMAT} is set and not null,
+it is used as a format string for @var{strftime} to display
+the time stamp associated with each displayed history entry.
+No intervening blank is printed between the formatted time stamp
+and the history line.
+
+Options, if supplied, have the following meanings:
 
 @table @code
-@item -w
-Write out the current history to the history file.
+@item -c
+Clear the history list.  This may be combined
+with the other options to replace the history list completely.
 
-@item -r
-Read the current history file and append its contents to
-the history list.
+@item -d @var{offset}
+Delete the history entry at position @var{offset}.
+@var{offset} should be specified as it appears when the history is
+displayed.
 
 @item -a
 Append the new
@@ -180,23 +203,27 @@ Append the history lines not already read from the history file
 to the current history list.  These are lines appended to the history
 file since the beginning of the current Bash session.
 
-@item -c
-Clear the history list.  This may be combined
-with the other options to replace the history list completely.
+@item -r
+Read the current history file and append its contents to
+the history list.
 
-@item -s
-The @var{arg}s are added to the end of
-the history list as a single entry.
+@item -w
+Write out the current history to the history file.
 
 @item -p
 Perform history substitution on the @var{arg}s and display the result
 on the standard output, without storing the results in the history list.
+
+@item -s
+The @var{arg}s are added to the end of
+the history list as a single entry.
+
 @end table
 
-When the @samp{-w}, @samp{-r}, @samp{-a}, or @samp{-n} option is
+When any of the @option{-w}, @option{-r}, @option{-a}, or @option{-n} options is
 used, if @var{filename}
 is given, then it is used as the history file.  If not, then
-the value of the @code{HISTFILE} variable is used.
+the value of the @env{HISTFILE} variable is used.
 
 @end table
 @end ifset
@@ -242,9 +269,9 @@ editing buffer for further modification.
 If Readline is being used, and the @code{histreedit}
 shell option is enabled, a failed history expansion will be
 reloaded into the Readline editing buffer for correction.
-The @samp{-p} option to the @code{history} builtin command
+The @option{-p} option to the @code{history} builtin command
 may be used to see what a history expansion will do before using it.
-The @samp{-s} option to the @code{history} builtin may be used to
+The @option{-s} option to the @code{history} builtin may be used to
 add commands to the end of the history list without actually executing
 them, so that they are available for subsequent recall.
 This is most useful in conjunction with Readline.
@@ -270,8 +297,15 @@ history list.
 @table @asis
 
 @item @code{!}
+@ifset BashFeatures
+Start a history substitution, except when followed by a space, tab,
+the end of the line, @samp{=} or @samp{(} (when the
+@code{extglob} shell option is enabled using the @code{shopt} builtin).
+@end ifset
+@ifclear BashFeatures
 Start a history substitution, except when followed by a space, tab,
-the end of the line, @samp{=} or @samp{(}.
+the end of the line, or @samp{=}.
+@end ifclear
 
 @item @code{!@var{n}}
 Refer to command line @var{n}.
@@ -310,6 +344,26 @@ may be omitted if the word designator begins with a @samp{^}, @samp{$},
 of the line, with the first word being denoted by 0 (zero).  Words are
 inserted into the current line separated by single spaces.
 
+@need 0.75
+For example,
+
+@table @code
+@item !!
+designates the preceding command.  When you type this, the preceding
+command is repeated in toto.
+
+@item !!:$
+designates the last argument of the preceding command.  This may be
+shortened to @code{!$}.
+
+@item !fi:2
+designates the second argument of the most recent command starting with
+the letters @code{fi}.
+@end table
+
+@need 0.75
+Here are the word designators:
 @table @code
 
 @item 0 (zero)
@@ -392,8 +446,12 @@ character on the input line.
 Repeat the previous substitution.
 
 @item g
+@itemx a
 Cause changes to be applied over the entire event line.  Used in
 conjunction with @samp{s}, as in @code{gs/@var{old}/@var{new}/},
 or with @samp{&}.
 
+@item G
+Apply the following @samp{s} modifier once to each word in the event.
+
 @end table
This page took 0.027639 seconds and 4 git commands to generate.