mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-11 04:30:44 +02:00
commit bash-20191115 snapshot
This commit is contained in:
@@ -6,9 +6,9 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\"
|
||||
.\" Last Change: Sun Oct 8 11:43:43 EDT 2017
|
||||
.\" Last Change: Fri Nov 15 09:39:27 EST 2019
|
||||
.\"
|
||||
.TH HISTORY 3 "2017 October 8" "GNU History 6.3"
|
||||
.TH HISTORY 3 "2019 November 15" "GNU History 8.0"
|
||||
.\"
|
||||
.\" File Name macro. This used to be `.PN', for Path Name,
|
||||
.\" but Sun doesn't seem to like that very much.
|
||||
@@ -118,6 +118,8 @@ containing
|
||||
The trailing \fB?\fP may be omitted if
|
||||
.I string
|
||||
is followed immediately by a newline.
|
||||
If \fIstring\fP is missing, the string from the most recent search is used;
|
||||
it is an error if there is no previous search string.
|
||||
.TP
|
||||
.B \d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u
|
||||
Quick substitution. Repeat the last command, replacing
|
||||
@@ -125,7 +127,7 @@ Quick substitution. Repeat the last command, replacing
|
||||
with
|
||||
.IR string2 .
|
||||
Equivalent to
|
||||
``!!:s/\fIstring1\fP/\fIstring2\fP/''
|
||||
``!!:s\d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u''
|
||||
(see \fBModifiers\fP below).
|
||||
.TP
|
||||
.B !#
|
||||
@@ -165,7 +167,8 @@ The last word. This is usually the last argument, but will expand to the
|
||||
zeroth word if there is only one word in the line.
|
||||
.TP
|
||||
.B %
|
||||
The word matched by the most recent `?\fIstring\fR?' search.
|
||||
The first word matched by the most recent `?\fIstring\fR?' search,
|
||||
if the search string begins with a character that is part of a word.
|
||||
.TP
|
||||
.I x\fB\-\fPy
|
||||
A range of words; `\-\fIy\fR' abbreviates `0\-\fIy\fR'.
|
||||
@@ -182,6 +185,7 @@ Abbreviates \fIx\-$\fP.
|
||||
.TP
|
||||
.B x\-
|
||||
Abbreviates \fIx\-$\fP like \fBx*\fP, but omits the last word.
|
||||
If \fBx\fP is missing, it defaults to 0.
|
||||
.PD
|
||||
.PP
|
||||
If a word designator is supplied without an event specification, the
|
||||
@@ -219,15 +223,19 @@ Quote the substituted words as with
|
||||
but break into words at
|
||||
.B blanks
|
||||
and newlines.
|
||||
The \fBq\fP and \fBx\fP modifiers are mutually exclusive; the last one
|
||||
supplied is used.
|
||||
.TP
|
||||
.B s/\fIold\fP/\fInew\fP/
|
||||
Substitute
|
||||
.I new
|
||||
for the first occurrence of
|
||||
.I old
|
||||
in the event line. Any delimiter can be used in place of /. The
|
||||
final delimiter is optional if it is the last character of the
|
||||
event line. The delimiter may be quoted in
|
||||
in the event line.
|
||||
Any character may be used as the delimiter in place of /.
|
||||
The final delimiter is optional if it is the last character of the
|
||||
event line.
|
||||
The delimiter may be quoted in
|
||||
.I old
|
||||
and
|
||||
.I new
|
||||
@@ -235,7 +243,8 @@ with a single backslash. If & appears in
|
||||
.IR new ,
|
||||
it is replaced by
|
||||
.IR old .
|
||||
A single backslash will quote the &. If
|
||||
A single backslash will quote the &.
|
||||
If
|
||||
.I old
|
||||
is null, it is set to the last
|
||||
.I old
|
||||
@@ -259,7 +268,8 @@ if it is the last character of the event line.
|
||||
An \fBa\fP may be used as a synonym for \fBg\fP.
|
||||
.TP
|
||||
.B G
|
||||
Apply the following `\fBs\fP' modifier once to each word in the event line.
|
||||
Apply the following `\fBs\fP' or `\fB&\fP' modifier once to each word
|
||||
in the event line.
|
||||
.PD
|
||||
.SH "PROGRAMMING WITH HISTORY FUNCTIONS"
|
||||
This section describes how to use the History library in other programs.
|
||||
|
||||
@@ -370,11 +370,13 @@ containing @var{string}.
|
||||
The trailing
|
||||
@samp{?} may be omitted if the @var{string} is followed immediately by
|
||||
a newline.
|
||||
If @var{string} is missing, the string from the most recent search is used;
|
||||
it is an error if there is no previous search string.
|
||||
|
||||
@item @code{^@var{string1}^@var{string2}^}
|
||||
Quick Substitution. Repeat the last command, replacing @var{string1}
|
||||
with @var{string2}. Equivalent to
|
||||
@code{!!:s/@var{string1}/@var{string2}/}.
|
||||
@code{!!:s^@var{string1}^@var{string2}^}.
|
||||
|
||||
@item @code{!#}
|
||||
The entire command line typed so far.
|
||||
@@ -426,7 +428,8 @@ The first argument; that is, word 1.
|
||||
The last argument.
|
||||
|
||||
@item %
|
||||
The word matched by the most recent @samp{?@var{string}?} search.
|
||||
The first word matched by the most recent @samp{?@var{string}?} search,
|
||||
if the search string begins with a character that is part of a word.
|
||||
|
||||
@item @var{x}-@var{y}
|
||||
A range of words; @samp{-@var{y}} abbreviates @samp{0-@var{y}}.
|
||||
@@ -441,6 +444,7 @@ Abbreviates @samp{@var{x}-$}
|
||||
|
||||
@item @var{x}-
|
||||
Abbreviates @samp{@var{x}-$} like @samp{@var{x}*}, but omits the last word.
|
||||
If @samp{x} is missing, it defaults to 0.
|
||||
|
||||
@end table
|
||||
|
||||
@@ -478,15 +482,24 @@ Quote the substituted words, escaping further substitutions.
|
||||
@item x
|
||||
Quote the substituted words as with @samp{q},
|
||||
but break into words at spaces, tabs, and newlines.
|
||||
The @samp{q} and @samp{x} modifiers are mutually exclusive; the last one
|
||||
supplied is used.
|
||||
@end ifset
|
||||
|
||||
@item s/@var{old}/@var{new}/
|
||||
Substitute @var{new} for the first occurrence of @var{old} in the
|
||||
event line. Any delimiter may be used in place of @samp{/}.
|
||||
event line.
|
||||
Any character may be used as the delimiter in place of @samp{/}.
|
||||
The delimiter may be quoted in @var{old} and @var{new}
|
||||
with a single backslash. If @samp{&} appears in @var{new},
|
||||
it is replaced by @var{old}. A single backslash will quote
|
||||
the @samp{&}. The final delimiter is optional if it is the last
|
||||
the @samp{&}.
|
||||
If @var{old} is null, it is set to the last @var{old}
|
||||
substituted, or, if no previous history substitutions took place,
|
||||
the last @var{string}
|
||||
in a !?@var{string}@code[?]}
|
||||
search.
|
||||
The final delimiter is optional if it is the last
|
||||
character on the input line.
|
||||
|
||||
@item &
|
||||
@@ -499,6 +512,7 @@ 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.
|
||||
Apply the following @samp{s} or @samp{&} modifier once to each word
|
||||
in the event.
|
||||
|
||||
@end table
|
||||
|
||||
@@ -4,7 +4,7 @@ Copyright (C) 1988-2019 Free Software Foundation, Inc.
|
||||
|
||||
@set EDITION 8.0
|
||||
@set VERSION 8.0
|
||||
@set UPDATED 6 March 2019
|
||||
@set UPDATED-MONTH March 2019
|
||||
@set UPDATED 15 November 2019
|
||||
@set UPDATED-MONTH November 2019
|
||||
|
||||
@set LASTCHANGE Wed Mar 6 09:51:02 EST 2019
|
||||
@set LASTCHANGE Fri Nov 15 09:34:19 EST 2019
|
||||
|
||||
@@ -180,7 +180,7 @@ get_history_event (const char *string, int *caller_index, int delimiting_quote)
|
||||
}
|
||||
|
||||
/* Hack case of numeric line specification. */
|
||||
if (string[i] == '-')
|
||||
if (string[i] == '-' && _rl_digit_p (string[i+1]))
|
||||
{
|
||||
sign = -1;
|
||||
i++;
|
||||
@@ -230,10 +230,12 @@ get_history_event (const char *string, int *caller_index, int delimiting_quote)
|
||||
}
|
||||
|
||||
#endif /* HANDLE_MULTIBYTE */
|
||||
if ((!substring_okay && (whitespace (c) || c == ':' ||
|
||||
(history_event_delimiter_chars && member (c, history_event_delimiter_chars)) ||
|
||||
(history_search_delimiter_chars && member (c, history_search_delimiter_chars)) ||
|
||||
string[i] == delimiting_quote)) ||
|
||||
if ((!substring_okay &&
|
||||
(whitespace (c) || c == ':' ||
|
||||
(i > local_index && history_event_delimiter_chars && c == '-') ||
|
||||
(c != '-' && history_event_delimiter_chars && member (c, history_event_delimiter_chars)) ||
|
||||
(history_search_delimiter_chars && member (c, history_search_delimiter_chars)) ||
|
||||
string[i] == delimiting_quote)) ||
|
||||
string[i] == '\n' ||
|
||||
(substring_okay && string[i] == '?'))
|
||||
break;
|
||||
@@ -409,7 +411,10 @@ hist_error(char *s, int start, int current, int errtype)
|
||||
}
|
||||
|
||||
temp = (char *)xmalloc (ll + elen + 3);
|
||||
strncpy (temp, s + start, ll);
|
||||
if (s[start])
|
||||
strncpy (temp, s + start, ll);
|
||||
else
|
||||
ll = 0;
|
||||
temp[ll] = ':';
|
||||
temp[ll + 1] = ' ';
|
||||
strcpy (temp + ll + 2, emsg);
|
||||
@@ -624,7 +629,7 @@ history_expand_internal (char *string, int start, int qc, int *end_index_ptr, ch
|
||||
return an error state after adding this line to the
|
||||
history. */
|
||||
case 'p':
|
||||
print_only++;
|
||||
print_only = 1;
|
||||
break;
|
||||
|
||||
/* :t discards all but the last part of the pathname. */
|
||||
@@ -1356,6 +1361,11 @@ get_history_word_specifier (char *spec, char *from, int *caller_index)
|
||||
i++;
|
||||
last = '$';
|
||||
}
|
||||
else if (spec[i] == '^')
|
||||
{
|
||||
i++;
|
||||
last = 1;
|
||||
}
|
||||
#if 0
|
||||
else if (!spec[i] || spec[i] == ':')
|
||||
/* check against `:' because there could be a modifier separator */
|
||||
|
||||
Reference in New Issue
Block a user