history builtin has a -H option to display history entries as they would be written to the history file; history builtin now takes a START-END range specifier for listing; fix stray semicolon when printing shell functions containing a case command; changes to stdin redirection detection in preparation for POSIX interp 1913

This commit is contained in:
Chet Ramey
2026-01-05 11:57:18 -05:00
parent 4b27601dfd
commit a43e08df2d
27 changed files with 1507 additions and 1063 deletions
+35
View File
@@ -12447,3 +12447,38 @@ builtins/evalstring.c
execute_cmd.c
- execute_command_internal: set currently_executing_command to NULL
in places where we return from this function
12/26
-----
builtins/history.def
- -H: new option, means to display history entries as they would be
written to the history file, with timestamp information and without
line numbers or `*'
- listing now takes a START-END range argument, so you can list a
subset of the history list from START to END, with the format
subject to the -H option. If START > END, list in reverse order.
This moves history and fc functionality closer to convergence
- parse_range: new function, encapsulates parsing START-END history
range specifiction; used by deletion and listing
doc/bash.1,doc/bashref.texi
- history: update with a description of ranges, add description of -H;
listing and deletion now reference range description
12/30
-----
print_cmd.c
- print_case_clauses: reset was_heredoc to 0 after printing each case
clause, since any here-document must have been associated with the
command list following the pattern list and `)'
Report from "Stan Marsh" <gazelle@xmission.com> back in May, 2025
12/31
-----
doc/Makefile.in
- dvi: remove from default targets as per latest GNU coding standards
redir.c
- stdin_redirection: now take the entire REDIRECT * as its argument,
so we can do additional posix-mandated checking on redirections
like 0<&0, to satisfy interp 1913
+1 -1
View File
@@ -697,7 +697,6 @@ doc/article.ps f
doc/rose94.ps f
#doc/bash.ps f
#doc/bashref.ps f
doc/bashref.dvi f
doc/bash.0 f
doc/bashbug.0 f
doc/builtins.0 f
@@ -1301,6 +1300,7 @@ tests/history7.sub f
tests/history8.sub f
tests/history9.sub f
tests/history10.sub f
tests/history11.sub f
tests/ifs.tests f
tests/ifs.right f
tests/ifs1.sub f
+133 -66
View File
@@ -23,18 +23,32 @@ $PRODUCES history.c
$BUILTIN history
$FUNCTION history_builtin
$DEPENDS_ON HISTORY
$SHORT_DOC history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]
$SHORT_DOC history [-c] [-H] [-d range] [range] or history -anrw [filename] or history -ps arg [arg...]
Display or manipulate the history list.
Display the history list with line numbers, prefixing each modified
entry with a `*'. An argument of N lists only the last N entries.
Without options, or if -H is supplied, display the portion of the
history list specified by RANGE, as described below. If -H is not
supplied, the list displays line numbers, prefixing each modified
entry with a `*'.
When listing or deleting history entries, RANGE is an argument of
the form of a number OFFSET or a range START-END. If OFFSET is supplied,
it references the history entry at position OFFSET; when listing, this
displays the last OFFSET entries. A negative OFFSET is interpreted
relative to one greater than the last history position, so negative
OFFSETs count back from the end of the history list. START and END, if
supplied, reference the portion of the history list beginning at position
START through position END. Negative START and END count back from the
end of the history list. When listing, if START is greater than END,
the history entries are displayed in reverse order from START to END.
Options:
-c clear the history list by deleting all of the entries
-d offset delete the history entry at position OFFSET. Negative
offsets count back from the end of the history list
-d start-end delete the history entries beginning at position START
through position END.
-d range delete the history entries specified by RANGE. RANGE is
described above.
-H display the selected history entries in the format that would
be written to the history file, including any timestamp,
without prefixing any line number or `*'.
-a append history lines from this session to the history file
-n read all history lines not already read from the history file
@@ -93,7 +107,8 @@ extern int errno;
#endif
static char *histtime (HIST_ENTRY *, const char *);
static int display_history (WORD_LIST *);
static int parse_range (char *, char *, int *, int *);
static int display_history (WORD_LIST *, int);
static void push_history (WORD_LIST *);
static int expand_and_print_history (WORD_LIST *);
@@ -105,6 +120,7 @@ static int expand_and_print_history (WORD_LIST *);
#define PFLAG 0x20
#define CFLAG 0x40
#define DFLAG 0x80
#define HFLAG 0x100
#ifndef TIMELEN_MAX
# define TIMELEN_MAX 128
@@ -119,7 +135,7 @@ history_builtin (WORD_LIST *list)
flags = 0;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "acd:npsrw")) != -1)
while ((opt = internal_getopt (list, "acd:npsrwH")) != -1)
{
switch (opt)
{
@@ -150,6 +166,9 @@ history_builtin (WORD_LIST *list)
flags |= PFLAG;
#endif
break;
case 'H':
flags |= HFLAG;
break;
CASE_HELPOPT;
default:
builtin_usage ();
@@ -189,37 +208,11 @@ history_builtin (WORD_LIST *list)
#endif
else if ((flags & DFLAG) && (range = strchr ((delete_arg[0] == '-') ? delete_arg + 1 : delete_arg, '-')))
{
intmax_t delete_start, delete_end;
*range++ = '\0';
if (valid_number (delete_arg, &delete_start) == 0 || valid_number (range, &delete_end) == 0)
{
range[-1] = '-';
sh_erange (delete_arg, _("history position"));
return (EXECUTION_FAILURE);
}
if (delete_arg[0] == '-' && delete_start < 0)
/* the_history[history_length] == 0x0, so this is correct */
delete_start += history_length;
/* numbers as displayed by display_history are offset by history_base */
else if (delete_start > 0)
delete_start -= history_base;
int delete_start, delete_end;
if (delete_start < 0 || delete_start >= history_length)
{
sh_erange (delete_arg, _("history position"));
return (EXECUTION_FAILURE);
}
if (parse_range (delete_arg, range, &delete_start, &delete_end) != 0)
return (EXECUTION_FAILURE);
if (range[0] == '-' && delete_end < 0)
delete_end += history_length;
else if (delete_end > 0)
delete_end -= history_base;
if (delete_end < 0 || delete_end >= history_length)
{
sh_erange (range, _("history position"));
return (EXECUTION_FAILURE);
}
/* XXX - print error if end < start? */
result = bash_delete_history_range (delete_start, delete_end);
if (where_history () > history_length)
@@ -266,7 +259,7 @@ history_builtin (WORD_LIST *list)
}
else if ((flags & (AFLAG|RFLAG|NFLAG|WFLAG|CFLAG)) == 0)
{
result = display_history (list);
result = display_history (list, flags);
return (sh_chkwrite (result));
}
@@ -366,49 +359,123 @@ histtime (HIST_ENTRY *hlist, const char *histtimefmt)
return timestr;
}
/* Parse a range START-END into two offsets into the history list (offset by
history_base), return in *STARTP and *ENDP. Return 0 on success, non-zero
on failure. Negative START and END are offsets from history_length. */
static int
display_history (WORD_LIST *list)
parse_range (char *arg, char *range, int *startp, int *endp)
{
register int i;
intmax_t ls, le;
*range++ = '\0';
if (valid_number (arg, &ls) == 0 || valid_number (range, &le) == 0)
{
range[-1] = '-'; /* must point into ARG */
sh_erange (arg, _("history position"));
return (EXECUTION_FAILURE);
}
if (arg[0] == '-' && ls < 0)
ls += history_length;
else if (ls > 0)
ls -= history_base;
if (ls < 0 || ls >= history_length)
{
sh_erange (arg, _("history position"));
range[-1] = '-'; /* must point into ARG */
return (EXECUTION_FAILURE);
}
if (range[0] == '-' && le < 0)
le += history_length;
else if (le > 0)
le -= history_base;
if (le < 0 || le >= history_length)
{
sh_erange (range, _("history position"));
range[-1] = '-'; /* must point into ARG */
return (EXECUTION_FAILURE);
}
range[-1] = '-';
*startp = ls;
*endp = le;
return EXECUTION_SUCCESS;
}
static int
display_history (WORD_LIST *list, int flags)
{
int i, start, end, reverse;
intmax_t limit;
HIST_ENTRY **hlist;
char *histtimefmt, *timestr;
char *histtimefmt, *timestr, *range, *list_arg;
if (list)
reverse = 0;
if (list && list->word)
{
if (get_numeric_arg (list, 0, &limit) == 0)
return (EX_USAGE);
list_arg = list->word->word;
range = strchr ((list_arg[0] == '-') ? list_arg + 1 : list_arg, '-');
if (range)
{
if (parse_range (list_arg, range, &start, &end) != 0)
return (EXECUTION_FAILURE);
if (end < start) /* end < start means to print in reverse order */
{
int t;
t = end;
end = start;
start = t;
reverse = 1;
}
}
else
{
if (get_numeric_arg (list, 0, &limit) == 0)
return (EX_USAGE);
if (limit < 0)
limit = -limit;
if (limit < 0)
limit = -limit;
start = (0 <= limit && limit < history_length) ? history_length - limit : 0;
end = history_length - 1;
}
}
else
limit = -1;
{
start = 0;
end = history_length - 1;
}
hlist = history_list ();
if (hlist == 0)
return (EXECUTION_SUCCESS);
if (hlist)
histtimefmt = get_string_value ("HISTTIMEFORMAT");
for (i = reverse ? end : start; reverse ? i >= start : i <= end; reverse ? i-- : i++)
{
for (i = 0; hlist[i]; i++)
;
QUIT;
if (0 <= limit && limit < i)
i -= limit;
else
i = 0;
histtimefmt = get_string_value ("HISTTIMEFORMAT");
while (hlist[i])
if (flags & HFLAG)
{
if (history_write_timestamps && hlist[i]->timestamp && hlist[i]->timestamp[0])
printf ("%s\n", hlist[i]->timestamp);
if (printf ("%s\n", histline (i)) < 0)
{
sh_wrerror ();
break;
}
}
else
{
QUIT;
timestr = (histtimefmt && *histtimefmt) ? histtime (hlist[i], histtimefmt) : (char *)NULL;
printf ("%5d%c %s%s\n", i + history_base,
histdata(i) ? '*' : ' ',
((timestr && *timestr) ? timestr : ""),
histline(i));
i++;
if (printf ("%5d%c %s%s\n", i + history_base,
histdata (i) ? '*' : ' ',
((timestr && *timestr) ? timestr : ""),
histline (i)) < 0)
{
sh_wrerror ();
break;
}
}
}
+3 -2
View File
@@ -154,8 +154,9 @@ BASHREF_FILES = $(srcdir)/bashref.texi $(srcdir)/fdl.texi $(srcdir)/version.texi
# $(RM) $@
# -${TEXI2PDF} $<
all: info dvi text html pdf # $(MAN2HTML)
nodvi: ps info text html
all: info text html pdf # $(MAN2HTML)
withdvi: pdf info text html dvi
everything: all ps
CREATED_PS = bash.ps bashref.ps
+37 -24
View File
@@ -5841,8 +5841,8 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
ing is complete, ffcc reads the file containing the edited com-
mands and echoes and executes them. The --DD option, if supplied,
causes ffcc to remove the selected commands from the history list
before executing the file of edited commands. --DD is only active
when ffcc is invoked in this way.
before executing the file of edited commands. --DD is only effec-
tive when ffcc is invoked in this way.
In the second form, ffcc re-executes _c_o_m_m_a_n_d after replacing each
instance of _p_a_t with _r_e_p. _C_o_m_m_a_n_d is interpreted the same as
@@ -5973,21 +5973,36 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
The return status is 0 unless no command matches _p_a_t_t_e_r_n.
hhiissttoorryy [[_n]]
hhiissttoorryy [[--HH]] [[_r_a_n_g_e]]
hhiissttoorryy --cc
hhiissttoorryy --dd _o_f_f_s_e_t
hhiissttoorryy --dd _s_t_a_r_t-_e_n_d
hhiissttoorryy --dd _r_a_n_g_e
hhiissttoorryy --aannrrww [_f_i_l_e_n_a_m_e]
hhiissttoorryy --pp _a_r_g [_a_r_g ...]
hhiissttoorryy --ss _a_r_g [_a_r_g ...]
With no options, display the command history list with numbers.
Entries prefixed with a ** have been modified. An argument of _n
lists only the last _n entries. If the shell variable HHIISSTTTTIIMMEE--
FFOORRMMAATT is set and not null, it is used as a format string for
_s_t_r_f_t_i_m_e(3) to display the time stamp associated with each dis-
played history entry. If hhiissttoorryy uses HHIISSTTTTIIMMEEFFOORRMMAATT, it does
not print an intervening space between the formatted time stamp
and the history entry.
With no options, or with the --HH option, display the portion of
the command history list specified by _r_a_n_g_e, as described below.
If _r_a_n_g_e is not specified, display the entire history list.
Without --HH, display the list with command numbers, prefixing en-
tries that have been modified with a "*".
A _r_a_n_g_e argument is specified in the form of a number _o_f_f_s_e_t or
a range _s_t_a_r_t-_e_n_d. If _o_f_f_s_e_t is supplied, it references the
history entry at position _o_f_f_s_e_t in the history list; when list-
ing this displays the last _o_f_f_s_e_t entries. A negative _o_f_f_s_e_t
counts back from the end of the history list, relative to one
greater than the last history position. When listing, negative
and positive _o_f_f_s_e_t_s have identical results. _s_t_a_r_t and _e_n_d, if
supplied, reference the portion of the history list beginning at
position _s_t_a_r_t through position _e_n_d. If _s_t_a_r_t or _e_n_d are nega-
tive, they count back from the end of the history list. When
listing, if _s_t_a_r_t is greater than _e_n_d, the history entries are
displayed in reverse order from _e_n_d to _s_t_a_r_t.
If the shell variable HHIISSTTTTIIMMEEFFOORRMMAATT is set and not null, it is
used as a format string for _s_t_r_f_t_i_m_e(3) to display the time
stamp associated with each displayed history entry. If hhiissttoorryy
uses HHIISSTTTTIIMMEEFFOORRMMAATT, it does not print an intervening space be-
tween the formatted time stamp and the history entry.
If _f_i_l_e_n_a_m_e is supplied, hhiissttoorryy uses it as the name of the his-
tory file; if not, it uses the value of HHIISSTTFFIILLEE. If _f_i_l_e_n_a_m_e
@@ -5998,16 +6013,14 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
--cc Clear the history list by deleting all the entries. This
can be used with the other options to replace the history
list.
--dd _o_f_f_s_e_t
Delete the history entry at position _o_f_f_s_e_t. If _o_f_f_s_e_t
is negative, it is interpreted as relative to one greater
than the last history position, so negative indices count
back from the end of the history, and an index of -1
refers to the current hhiissttoorryy --dd command.
--dd _s_t_a_r_t-_e_n_d
Delete the range of history entries between positions
_s_t_a_r_t and _e_n_d, inclusive. Positive and negative values
for _s_t_a_r_t and _e_n_d are interpreted as described above.
--dd _r_a_n_g_e
Delete the history entries specified by _r_a_n_g_e, as de-
scribed above. An index of -1 refers to the current hhiiss--
ttoorryy --dd command.
--HH Display the selected history entries in the format that
would be written to the history file, including any time
stamp information as described below, without prefixing
the entry with any line number or "*".
--aa Append the "new" history lines to the history file.
These are history lines entered since the beginning of
the current bbaasshh session, but not already appended to the
@@ -7577,4 +7590,4 @@ BBUUGGSS
Array variables may not (yet) be exported.
GNU Bash 5.3 2025 December 18 _B_A_S_H(1)
GNU Bash 5.3 2025 December 26 _B_A_S_H(1)
+41 -27
View File
@@ -5,7 +5,7 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Thu Dec 18 17:18:21 EST 2025
.\" Last Change: Fri Dec 26 18:21:22 EST 2025
.\"
.\" For bash_builtins, strip all but "SHELL BUILTIN COMMANDS" section
.\" For rbash, strip all but "RESTRICTED SHELL" section
@@ -22,7 +22,7 @@
.ds zX \" empty
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2025 December 18" "GNU Bash 5.3"
.TH BASH 1 "2025 December 26" "GNU Bash 5.3"
.\"
.ie \n(.g \{\
.ds ' \(aq
@@ -10413,7 +10413,7 @@ option, if supplied,
causes \fBfc\fP to remove the selected commands from the history
list before executing the file of edited commands.
.B \-D
is only active when \fBfc\fP is invoked in this way.
is only effective when \fBfc\fP is invoked in this way.
.IP
In the second form, \fBfc\fP re-executes \fIcommand\fP
after replacing each instance of \fIpat\fP with \fIrep\fP.
@@ -10660,14 +10660,12 @@ prints the descriptions of all matching help topics.
The return status is 0 unless no command matches
.IR pattern .
.TP
\fBhistory [\fIn\fP]
\fBhistory [\fB\-H\fP] [\fIrange\fP]
.PD 0
.TP
\fBhistory\fP \fB\-c\fP
.TP
\fBhistory \-d\fP \fIoffset\fP
.TP
\fBhistory \-d\fP \fIstart\fP-\fIend\fP
\fBhistory \-d\fP \fIrange\fP
.TP
\fBhistory\fP \fB\-anrw\fP [\fIfilename\fP]
.TP
@@ -10675,15 +10673,33 @@ The return status is 0 unless no command matches
.TP
\fBhistory\fP \fB\-s\fP \fIarg\fP [\fIarg\fP .\|.\|.]
.PD
With no options, display the command history list with numbers.
Entries prefixed with a
.B *
have been modified.
An argument of
.I n
lists only the last
.I n
entries.
With no options,
or with the \fB\-H\fP option,
display the portion of the command history list
specified by \fIrange\fP, as described below.
If \fIrange\fP is not specified, display the entire history list.
Without \fB\-H\fP, display the list with command numbers, prefixing
entries that have been modified with a
.Q "*" .
.IP
A
.I range
argument is specified in the form of a number \fIoffset\fP or
a range \fIstart\fP\-\fIend\fP.
If \fIoffset\fP is supplied, it references the history entry at
position \fIoffset\fP in the history list;
when listing this displays the last \fIoffset\fP entries.
A negative \fIoffset\fP counts back from the end of the history list,
relative to one greater than the last history position.
When listing, negative and positive \fIoffsets\fP have identical results.
\fIstart\fP and \fIend\fP, if supplied, reference the portion of
the history list beginning at position \fIstart\fP through position
\fIend\fP.
If \fIstart\fP or \fIend\fP are negative, they count back from the
end of the history list.
When listing, if \fIstart\fP is greater than \fIend\fP, the history
entries are displayed in reverse order from \fIend\fP to \fIstart\fP.
.IP
If the shell variable
.SM
.B HISTTIMEFORMAT
@@ -10717,18 +10733,16 @@ Options, if supplied, have the following meanings:
Clear the history list by deleting all the entries.
This can be used with the other options to replace the history list.
.TP
\fB\-d\fP \fIoffset\fP
Delete the history entry at position \fIoffset\fP.
If \fIoffset\fP is negative, it is interpreted as relative to one greater
than the last history position, so negative indices count back from the
end of the history, and an index of \-1 refers to the current
\fBhistory \-d\fP command.
\fB\-d\fP \fIrange\fP
Delete the history entries specified by \fIrange\fP, as described above.
An index of \-1 refers to the current \fBhistory \-d\fP command.
.TP
\fB\-d\fP \fIstart\fP\-\fIend\fP
Delete the range of history entries between positions \fIstart\fP and
\fIend\fP, inclusive.
Positive and negative values for \fIstart\fP and \fIend\fP
are interpreted as described above.
\fB\-H\fP
Display the selected history entries in the format that would be written
to the history file,
including any time stamp information as described below,
without prefixing the entry with any line number or
.Q "*" .
.TP
.B \-a
Append the
+60 -31
View File
@@ -1,5 +1,5 @@
<!-- Creator : groff version 1.23.0 -->
<!-- CreationDate: Tue Dec 2 16:55:58 2025 -->
<!-- CreationDate: Wed Dec 31 13:23:39 2025 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
@@ -12232,8 +12232,8 @@ with a <i>name</i> that is not a function.</p>
</table>
<p style="margin-left:9%;"><b>fc</b> [<b>&minus;e</b>
<i>ename</i>] [<b>&minus;lnr</b>] [<i>first</i>]
[<i>last</i>] <b><br>
<i>ename</i>] [<b>&minus;D</b>] [<b>&minus;lnr</b>]
[<i>first</i>] [<i>last</i>] <b><br>
fc &minus;s</b> [<i>pat</i>=<i>rep</i>] [<i>cmd</i>]</p>
<p style="margin-left:18%;">The first form selects a range
@@ -12271,7 +12271,11 @@ variable, and the value of <b><small>EDITOR</small></b> if
<b><small>FCEDIT</small></b> is not set. If neither variable
is set, <b>fc</b> uses <i>vi.</i> When editing is complete,
<b>fc</b> reads the file containing the edited commands and
echoes and executes them.</p>
echoes and executes them. The <b>&minus;D</b> option, if
supplied, causes <b>fc</b> to remove the selected commands
from the history list before executing the file of edited
commands. <b>&minus;D</b> is only effective when <b>fc</b>
is invoked in this way.</p>
<p style="margin-left:18%; margin-top: 1em">In the second
form, <b>fc</b> re-executes <i>command</i> after replacing
@@ -12486,23 +12490,44 @@ prints the descriptions of all matching help topics.</p>
<p style="margin-left:18%; margin-top: 1em">The return
status is 0 unless no command matches <i>pattern</i>.</p>
<p style="margin-left:9%;"><b>history [</b><i>n</i><b>]
<br>
<p style="margin-left:9%;"><b>history [&minus;H]
[</b><i>range</i><b>] <br>
history &minus;c <br>
history &minus;d</b> <i>offset</i> <b><br>
history &minus;d</b> <i>start</i>-<i>end</i> <b><br>
history &minus;d</b> <i>range</i> <b><br>
history &minus;anrw</b> [<i>filename</i>] <b><br>
history &minus;p</b> <i>arg</i> [<i>arg</i> ...] <b><br>
history &minus;s</b> <i>arg</i> [<i>arg</i> ...]</p>
<p style="margin-left:18%;">With no options, display the
command history list with numbers. Entries prefixed with a
<b>*</b> have been modified. An argument of <i>n</i> lists
only the last <i>n</i> entries. If the shell variable
<b><small>HISTTIMEFORMAT</small></b> is set and not null, it
is used as a format string for <i>strftime</i>(3) to display
the time stamp associated with each displayed history entry.
If <b>history</b> uses
<p style="margin-left:18%;">With no options, or with the
<b>&minus;H</b> option, display the portion of the command
history list specified by <i>range</i>, as described below.
If <i>range</i> is not specified, display the entire history
list. Without <b>&minus;H</b>, display the list with command
numbers, prefixing entries that have been modified with a
&ldquo;*&rdquo;.</p>
<p style="margin-left:18%; margin-top: 1em">A <i>range</i>
argument is specified in the form of a number <i>offset</i>
or a range <i>start</i>&minus;<i>end</i>. If <i>offset</i>
is supplied, it references the history entry at position
<i>offset</i> in the history list; when listing this
displays the last <i>offset</i> entries. A negative
<i>offset</i> counts back from the end of the history list,
relative to one greater than the last history position. When
listing, negative and positive <i>offsets</i> have identical
results. <i>start</i> and <i>end</i>, if supplied, reference
the portion of the history list beginning at position
<i>start</i> through position <i>end</i>. If <i>start</i> or
<i>end</i> are negative, they count back from the end of the
history list. When listing, if <i>start</i> is greater than
<i>end</i>, the history entries are displayed in reverse
order from <i>end</i> to <i>start</i>.</p>
<p style="margin-left:18%; margin-top: 1em">If the shell
variable <b><small>HISTTIMEFORMAT</small></b> is set and not
null, it is used as a format string for <i>strftime</i>(3)
to display the time stamp associated with each displayed
history entry. If <b>history</b> uses
<b><small>HISTTIMEFORMAT</small></b><small>,</small> it does
not print an intervening space between the formatted time
stamp and the history entry.</p>
@@ -12537,22 +12562,12 @@ list.</p> </td></tr>
</table>
<p style="margin-left:18%;"><b>&minus;d</b>
<i>offset</i></p>
<i>range</i></p>
<p style="margin-left:27%;">Delete the history entry at
position <i>offset</i>. If <i>offset</i> is negative, it is
interpreted as relative to one greater than the last history
position, so negative indices count back from the end of the
history, and an index of &minus;1 refers to the current
<b>history &minus;d</b> command.</p>
<p style="margin-left:18%;"><b>&minus;d</b>
<i>start</i>&minus;<i>end</i></p>
<p style="margin-left:27%;">Delete the range of history
entries between positions <i>start</i> and <i>end</i>,
inclusive. Positive and negative values for <i>start</i> and
<i>end</i> are interpreted as described above.</p>
<p style="margin-left:27%;">Delete the history entries
specified by <i>range</i>, as described above. An index of
&minus;1 refers to the current <b>history &minus;d</b>
command.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
@@ -12561,6 +12576,20 @@ inclusive. Positive and negative values for <i>start</i> and
<td width="3%">
<p><b>&minus;H</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Display the selected history entries in the format that
would be written to the history file, including any time
stamp information as described below, without prefixing the
entry with any line number or &ldquo;*&rdquo;.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;a</b></p></td>
<td width="6%"></td>
<td width="73%">
+63 -51
View File
@@ -1,9 +1,9 @@
This is bash.info, produced by makeinfo version 7.2 from bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 18 December 2025).
Bash shell (version 5.3, 26 December 2025).
This is Edition 5.3, last updated 18 December 2025, of The GNU Bash
This is Edition 5.3, last updated 26 December 2025, of The GNU Bash
Reference Manual, for Bash, Version 5.3.
Copyright © 1988-2025 Free Software Foundation, Inc.
@@ -26,10 +26,10 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 18 December 2025). The Bash home page is
Bash shell (version 5.3, 26 December 2025). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.3, last updated 18 December 2025, of The GNU Bash
This is Edition 5.3, last updated 26 December 2025, of The GNU Bash
Reference Manual, for Bash, Version 5.3.
Bash contains features that appear in other popular shells, and some
@@ -10993,7 +10993,7 @@ history file.
fc reads the file of edited commands and echoes and executes
them. The -D option, if supplied, causes fc to remove the
selected commands from the history list before executing the file
of edited commands. -D is only active when fc is invoked in
of edited commands. -D is only effective when fc is invoked in
this way. It could be used if you make a typo in a command and
want to fix it using an editor while removing the erroneous command
from the history to avoid clutter.
@@ -11016,21 +11016,36 @@ history file.
history entry, in which case fc returns a non-zero status.
history
history [N]
history [-H] [RANGE]
history -c
history -d OFFSET
history -d START-END
history -d RANGE
history [-anrw] [FILENAME]
history -ps ARG
history -ps ARG [ARG...]
With no options, display the history list with numbers. Entries
prefixed with a * have been modified. An argument of N lists
only the last N entries. If the shell variable HISTTIMEFORMAT is
set and not null, it is used as a format string for strftime(3)
to display the time stamp associated with each displayed history
entry. If history uses HISTTIMEFORMAT, it does not print an
intervening space between the formatted time stamp and the history
entry.
With no options, or with the -H option, display the portion of
the command history list specified by RANGE, as described below.
If RANGE is not specified, display the entire history list.
Without -H, display the list with command numbers, prefixing
entries that have been modified with a *.
A RANGE argument is specified in the form of a number OFFSET or a
range START-END. If OFFSET is supplied, it references the history
entry at position OFFSET in the history list; when listing this
displays the last OFFSET entries. A negative OFFSET counts back
from the end of the history list, relative to one greater than the
last history position. When listing, negative and positive OFFSETs
have identical results. START and END, if supplied, reference the
portion of the history list beginning at position START through
position END. If START or END are negative, they count back from
the end of the history list. When listing, if START is greater
than END, the history entries are displayed in reverse order from
END to START.
If the shell variable HISTTIMEFORMAT is set and not null, it is
used as a format string for strftime(3) to display the time stamp
associated with each displayed history entry. If history uses
HISTTIMEFORMAT, it does not print an intervening space between
the formatted time stamp and the history entry.
Options, if supplied, have the following meanings:
@@ -11038,19 +11053,16 @@ history file.
Clear the history list. This may be combined with the other
options to replace the history list.
-d OFFSET
Delete the history entry at position OFFSET. If OFFSET is
positive, it should be specified as it appears when the
history is displayed. If OFFSET is negative, it is
interpreted as relative to one greater than the last history
position, so negative indices count back from the end of the
history, and an index of -1 refers to the current history
-d command.
-d RANGE
Delete the history entries specified by RANGE, as described
above. An offset of -1 refers to the current history -d
command.
-d START-END
Delete the range of history entries between positions START
and END, inclusive. Positive and negative values for START
and END are interpreted as described above.
-H
Display the selected history entries in the format that would
be written to the history file, including any time stamp
information as described below, without prefixing the entry
with any line number or *.
-a
Append the "new" history lines to the history file. These are
@@ -13791,28 +13803,28 @@ Node: A Programmable Completion Example485732
Node: Using History Interactively491077
Node: Bash History Facilities491758
Node: Bash History Builtins495493
Node: History Interaction502365
Node: Event Designators507315
Node: Word Designators508893
Node: Modifiers511285
Node: Installing Bash513222
Node: Basic Installation514338
Node: Compilers and Options518214
Node: Compiling For Multiple Architectures518964
Node: Installation Names520717
Node: Specifying the System Type522951
Node: Sharing Defaults523697
Node: Operation Controls524411
Node: Optional Features525430
Node: Reporting Bugs538153
Node: Major Differences From The Bourne Shell539510
Node: GNU Free Documentation License560937
Node: Indexes586114
Node: Builtin Index586565
Node: Reserved Word Index593663
Node: Variable Index596108
Node: Function Index613521
Node: Concept Index627516
Node: History Interaction503088
Node: Event Designators508038
Node: Word Designators509616
Node: Modifiers512008
Node: Installing Bash513945
Node: Basic Installation515061
Node: Compilers and Options518937
Node: Compiling For Multiple Architectures519687
Node: Installation Names521440
Node: Specifying the System Type523674
Node: Sharing Defaults524420
Node: Operation Controls525134
Node: Optional Features526153
Node: Reporting Bugs538876
Node: Major Differences From The Bourne Shell540233
Node: GNU Free Documentation License561660
Node: Indexes586837
Node: Builtin Index587288
Node: Reserved Word Index594386
Node: Variable Index596831
Node: Function Index614244
Node: Concept Index628239

End Tag Table
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -330,9 +330,9 @@
@xrdef{Event Designators-pg}{172}
@xrdef{Word Designators-title}{Word Designators}
@xrdef{Word Designators-snt}{Section@tie 9.3.2}
@xrdef{Word Designators-pg}{173}
@xrdef{Modifiers-title}{Modifiers}
@xrdef{Modifiers-snt}{Section@tie 9.3.3}
@xrdef{Word Designators-pg}{173}
@xrdef{Modifiers-pg}{174}
@xrdef{Installing Bash-title}{Installing Bash}
@xrdef{Installing Bash-snt}{Chapter@tie 10}
+1 -1
View File
@@ -58,4 +58,4 @@
\entry{complete}{161}{\code {complete}}
\entry{compopt}{165}{\code {compopt}}
\entry{fc}{169}{\code {fc}}
\entry{history}{169}{\code {history}}
\entry{history}{170}{\code {history}}
+1 -1
View File
@@ -39,7 +39,7 @@
\initial {H}
\entry{\code {hash}}{56}
\entry{\code {help}}{67}
\entry{\code {history}}{169}
\entry{\code {history}}{170}
\initial {J}
\entry{\code {jobs}}{127}
\initial {K}
+52 -26
View File
@@ -4,9 +4,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This text is a brief description of the features that are present in
the Bash shell (version 5.3, 2 December 2025).
the Bash shell (version 5.3, 26 December 2025).
This is Edition 5.3, last updated 2 December 2025,
This is Edition 5.3, last updated 26 December 2025,
of The GNU Bash Reference Manual,
for Bash, Version 5.3.
@@ -69,6 +69,7 @@ ul.toc-numbered-mark {list-style: none}
<div class="top-level-extent" id="Top">
<div class="nav-panel">
<p>
@@ -77,10 +78,10 @@ Next: <a href="#Introduction" accesskey="n" rel="next">Introduction</a>, Previou
<h1 class="top" id="Bash-Features-1"><span>Bash Features<a class="copiable-link" href="#Bash-Features-1"> &para;</a></span></h1>
<p>This text is a brief description of the features that are present in
the Bash shell (version 5.3, 2 December 2025).
the Bash shell (version 5.3, 26 December 2025).
The Bash home page is <a class="url" href="http://www.gnu.org/software/bash/">http://www.gnu.org/software/bash/</a>.
</p>
<p>This is Edition 5.3, last updated 2 December 2025,
<p>This is Edition 5.3, last updated 26 December 2025,
of <cite class="cite">The GNU Bash Reference Manual</cite>,
for <code class="code">Bash</code>, Version 5.3.
</p>
@@ -14437,7 +14438,7 @@ history list and history file.
<dl class="table">
<dt><a id="index-fc"></a><span><code class="code">fc</code><a class="copiable-link" href="#index-fc"> &para;</a></span></dt>
<dd><div class="example">
<pre class="example-preformatted"><code class="code">fc [-e <var class="var">ename</var>] [-lnr] [<var class="var">first</var>] [<var class="var">last</var>]</code>
<pre class="example-preformatted"><code class="code">fc [-e <var class="var">ename</var>] [-D] [-lnr] [<var class="var">first</var>] [<var class="var">last</var>]</code>
<code class="code">fc -s [<var class="var">pat</var>=<var class="var">rep</var>] [<var class="var">command</var>]</code>
</pre></div>
@@ -14474,6 +14475,13 @@ value of the <code class="env">FCEDIT</code> variable if set, or the value of th
<code class="env">EDITOR</code> variable if that is set, or <code class="code">vi</code> if neither is set.
When editing is complete, <code class="code">fc</code> reads the file of edited commands
and echoes and executes them.
The <samp class="option">-D</samp> option, if supplied,
causes <code class="code">fc</code> to remove the selected commands from the history
list before executing the file of edited commands.
<samp class="option">-D</samp> is only effective when <code class="code">fc</code> is invoked in this way.
It could be used if you make a typo in a command and want to fix it using
an editor while removing the erroneous command from the history to
avoid clutter.
</p>
<p>In the second form, <code class="code">fc</code> re-executes <var class="var">command</var> after
replacing each instance of <var class="var">pat</var> in the selected command with <var class="var">rep</var>.
@@ -14497,18 +14505,40 @@ is that of the re-executed command, unless
</dd>
<dt><a id="index-history"></a><span><code class="code">history</code><a class="copiable-link" href="#index-history"> &para;</a></span></dt>
<dd><div class="example">
<pre class="example-preformatted">history [<var class="var">n</var>]
<pre class="example-preformatted">history [-H] [<var class="var">range</var>]
history -c
history -d <var class="var">offset</var>
history -d <var class="var">start</var>-<var class="var">end</var>
history -d <var class="var">range</var>
history [-anrw] [<var class="var">filename</var>]
history -ps <var class="var">arg</var>
history -ps <var class="var">arg</var> [<var class="var">arg</var>...]
</pre></div>
<p>With no options, display the history list with numbers.
Entries prefixed with a &lsquo;<samp class="samp">*</samp>&rsquo; have been modified.
An argument of <var class="var">n</var> lists only the last <var class="var">n</var> entries.
If the shell variable <code class="env">HISTTIMEFORMAT</code> is set and not null,
<p>With no options,
or with the <samp class="option">-H</samp> option,
display the portion of the command history list
specified by <var class="var">range</var>, as described below.
If <var class="var">range</var> is not specified, display the entire history list.
Without <samp class="option">-H</samp>, display the list with command numbers, prefixing
entries that have been modified with a &lsquo;<samp class="samp">*</samp>&rsquo;.
</p>
<p>A
<var class="var">range</var>
argument is specified in the form of a number <var class="var">offset</var> or
a range <var class="var">start</var>-<var class="var">end</var>.
If <var class="var">offset</var> is supplied, it references the history entry at
position <var class="var">offset</var> in the history list;
when listing this displays the last <var class="var">offset</var> entries.
A negative <var class="var">offset</var> counts back from the end of the history list,
relative to one greater than the last history position.
When listing, negative and positive <var class="var">offset</var>s have identical results.
<var class="var">start</var> and <var class="var">end</var>, if supplied, reference the portion of
the history list beginning at position <var class="var">start</var> through position
<var class="var">end</var>.
If <var class="var">start</var> or <var class="var">end</var> are negative, they count back from the
end of the history list.
When listing, if <var class="var">start</var> is greater than <var class="var">end</var>, the history
entries are displayed in reverse order from <var class="var">end</var> to <var class="var">start</var>.
</p>
<p>If the shell variable <code class="env">HISTTIMEFORMAT</code> is set and not null,
it is used as a format string for <code class="code">strftime</code>(3) to display
the time stamp associated with each displayed history entry.
If <code class="code">history</code> uses <code class="env">HISTTIMEFORMAT</code>, it does not print an
@@ -14522,21 +14552,17 @@ intervening space between the formatted time stamp and the history entry.
This may be combined with the other options to replace the history list.
</p>
</dd>
<dt><code class="code">-d <var class="var">offset</var></code></dt>
<dd><p>Delete the history entry at position <var class="var">offset</var>.
If <var class="var">offset</var> is positive, it should be specified as it appears when
the history is displayed.
If <var class="var">offset</var> is negative, it is interpreted as relative to one greater
than the last history position, so negative indices count back from the
end of the history, and an index of &lsquo;<samp class="samp">-1</samp>&rsquo; refers to the current
<code class="code">history -d</code> command.
<dt><code class="code">-d <var class="var">range</var></code></dt>
<dd><p>Delete the history entries specified by <var class="var">range</var>, as described above.
An offset of &lsquo;<samp class="samp">-1</samp>&rsquo; refers to the current <code class="code">history -d</code> command.
</p>
</dd>
<dt><code class="code">-d <var class="var">start</var>-<var class="var">end</var></code></dt>
<dd><p>Delete the range of history entries between positions <var class="var">start</var> and
<var class="var">end</var>, inclusive.
Positive and negative values for <var class="var">start</var> and <var class="var">end</var>
are interpreted as described above.
<dt><code class="code">-H</code></dt>
<dd><p>Display the selected history entries in the format that would be written
to the history file,
including any time stamp information as described below,
without prefixing the entry with any line number or
&lsquo;<samp class="samp">*</samp>&rsquo;.
</p>
</dd>
<dt><code class="code">-a</code></dt>
+63 -51
View File
@@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 7.2 from
bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 18 December 2025).
Bash shell (version 5.3, 26 December 2025).
This is Edition 5.3, last updated 18 December 2025, of The GNU Bash
This is Edition 5.3, last updated 26 December 2025, of The GNU Bash
Reference Manual, for Bash, Version 5.3.
Copyright © 1988-2025 Free Software Foundation, Inc.
@@ -27,10 +27,10 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 18 December 2025). The Bash home page is
Bash shell (version 5.3, 26 December 2025). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.3, last updated 18 December 2025, of The GNU Bash
This is Edition 5.3, last updated 26 December 2025, of The GNU Bash
Reference Manual, for Bash, Version 5.3.
Bash contains features that appear in other popular shells, and some
@@ -10994,7 +10994,7 @@ history file.
fc reads the file of edited commands and echoes and executes
them. The -D option, if supplied, causes fc to remove the
selected commands from the history list before executing the file
of edited commands. -D is only active when fc is invoked in
of edited commands. -D is only effective when fc is invoked in
this way. It could be used if you make a typo in a command and
want to fix it using an editor while removing the erroneous command
from the history to avoid clutter.
@@ -11017,21 +11017,36 @@ history file.
history entry, in which case fc returns a non-zero status.
history
history [N]
history [-H] [RANGE]
history -c
history -d OFFSET
history -d START-END
history -d RANGE
history [-anrw] [FILENAME]
history -ps ARG
history -ps ARG [ARG...]
With no options, display the history list with numbers. Entries
prefixed with a * have been modified. An argument of N lists
only the last N entries. If the shell variable HISTTIMEFORMAT is
set and not null, it is used as a format string for strftime(3)
to display the time stamp associated with each displayed history
entry. If history uses HISTTIMEFORMAT, it does not print an
intervening space between the formatted time stamp and the history
entry.
With no options, or with the -H option, display the portion of
the command history list specified by RANGE, as described below.
If RANGE is not specified, display the entire history list.
Without -H, display the list with command numbers, prefixing
entries that have been modified with a *.
A RANGE argument is specified in the form of a number OFFSET or a
range START-END. If OFFSET is supplied, it references the history
entry at position OFFSET in the history list; when listing this
displays the last OFFSET entries. A negative OFFSET counts back
from the end of the history list, relative to one greater than the
last history position. When listing, negative and positive OFFSETs
have identical results. START and END, if supplied, reference the
portion of the history list beginning at position START through
position END. If START or END are negative, they count back from
the end of the history list. When listing, if START is greater
than END, the history entries are displayed in reverse order from
END to START.
If the shell variable HISTTIMEFORMAT is set and not null, it is
used as a format string for strftime(3) to display the time stamp
associated with each displayed history entry. If history uses
HISTTIMEFORMAT, it does not print an intervening space between
the formatted time stamp and the history entry.
Options, if supplied, have the following meanings:
@@ -11039,19 +11054,16 @@ history file.
Clear the history list. This may be combined with the other
options to replace the history list.
-d OFFSET
Delete the history entry at position OFFSET. If OFFSET is
positive, it should be specified as it appears when the
history is displayed. If OFFSET is negative, it is
interpreted as relative to one greater than the last history
position, so negative indices count back from the end of the
history, and an index of -1 refers to the current history
-d command.
-d RANGE
Delete the history entries specified by RANGE, as described
above. An offset of -1 refers to the current history -d
command.
-d START-END
Delete the range of history entries between positions START
and END, inclusive. Positive and negative values for START
and END are interpreted as described above.
-H
Display the selected history entries in the format that would
be written to the history file, including any time stamp
information as described below, without prefixing the entry
with any line number or *.
-a
Append the "new" history lines to the history file. These are
@@ -13792,28 +13804,28 @@ Node: A Programmable Completion Example486053
Node: Using History Interactively491401
Node: Bash History Facilities492085
Node: Bash History Builtins495823
Node: History Interaction502698
Node: Event Designators507651
Node: Word Designators509232
Node: Modifiers511627
Node: Installing Bash513567
Node: Basic Installation514686
Node: Compilers and Options518565
Node: Compiling For Multiple Architectures519318
Node: Installation Names521074
Node: Specifying the System Type523311
Node: Sharing Defaults524060
Node: Operation Controls524777
Node: Optional Features525799
Node: Reporting Bugs538525
Node: Major Differences From The Bourne Shell539885
Node: GNU Free Documentation License561315
Node: Indexes586495
Node: Builtin Index586949
Node: Reserved Word Index594050
Node: Variable Index596498
Node: Function Index613914
Node: Concept Index627912
Node: History Interaction503421
Node: Event Designators508374
Node: Word Designators509955
Node: Modifiers512350
Node: Installing Bash514290
Node: Basic Installation515409
Node: Compilers and Options519288
Node: Compiling For Multiple Architectures520041
Node: Installation Names521797
Node: Specifying the System Type524034
Node: Sharing Defaults524783
Node: Operation Controls525500
Node: Optional Features526522
Node: Reporting Bugs539248
Node: Major Differences From The Bourne Shell540608
Node: GNU Free Documentation License562038
Node: Indexes587218
Node: Builtin Index587672
Node: Reserved Word Index594773
Node: Variable Index597221
Node: Function Index614637
Node: Concept Index628635

End Tag Table
+16 -15
View File
@@ -1,11 +1,12 @@
This is pdfTeX, Version 3.141592653-2.6-1.40.27 (TeX Live 2025/MacPorts 2025.74524_1) (preloaded format=pdfetex 2025.9.16) 2 DEC 2025 16:55
This is pdfTeX, Version 3.141592653-2.6-1.40.27 (TeX Live 2025/MacPorts 2025.74524_1) (preloaded format=pdfetex 2025.9.16) 31 DEC 2025 13:23
entering extended mode
restricted \write18 enabled.
file:line:error style messages enabled.
%&-line parsing enabled.
**\input /usr/local/src/bash/bash-20251201/doc/bashref.texi
(/usr/local/src/bash/bash-20251201/doc/bashref.texi
(/usr/local/src/bash/bash-20251201/doc/texinfo.tex
**\input /usr/local/src/bash/bash-20251226/doc/bashref.texi \input /usr/local/s
rc/bash/bash-20251226/doc/bashref.texi
(/usr/local/src/bash/bash-20251226/doc/bashref.texi
(/usr/local/src/bash/bash-20251226/doc/texinfo.tex
Loading texinfo [version 2015-11-22.14]:
\outerhsize=\dimen16
\outervsize=\dimen17
@@ -161,15 +162,15 @@ This is `epsf.tex' v2.7.4 <14 February 2011>
texinfo.tex: doing @include of version.texi
(/usr/local/src/bash/bash-20251201/doc/version.texi) [1{/opt/local/var/db/texmf
(/usr/local/src/bash/bash-20251226/doc/version.texi) [1{/opt/local/var/db/texmf
/fonts/map/pdftex/updmap/pdftex.map}] [2]
(/usr/local/build/bash/bash-20251201/doc/bashref.toc [-1] [-2] [-3]) [-4]
(/usr/local/build/bash/bash-20251201/doc/bashref.toc)
(/usr/local/build/bash/bash-20251201/doc/bashref.toc) Chapter 1
(/usr/local/build/bash/bash-20251226/doc/bashref.toc [-1] [-2] [-3]) [-4]
(/usr/local/build/bash/bash-20251226/doc/bashref.toc)
(/usr/local/build/bash/bash-20251226/doc/bashref.toc) Chapter 1
\openout0 = `bashref.toc'.
(/usr/local/build/bash/bash-20251201/doc/bashref.aux)
(/usr/local/build/bash/bash-20251226/doc/bashref.aux)
\openout1 = `bashref.aux'.
[1] Chapter 2 [2]
@@ -264,7 +265,7 @@ Chapter 7 [124] [125] [126] [127] [128]
texinfo.tex: doing @include of rluser.texi
(/usr/local/src/bash/bash-20251201/lib/readline/doc/rluser.texi Chapter 8
(/usr/local/src/bash/bash-20251226/lib/readline/doc/rluser.texi Chapter 8
[129] [130] [131] [132] [133] [134] [135] [136] [137] [138] [139] [140]
Underfull \hbox (badness 7540) in paragraph at lines 969--975
[]@textrm In the ex-am-ple above, @textttsl C-u[] @textrm is bound to the func
@@ -313,7 +314,7 @@ gnored[]
texinfo.tex: doing @include of hsuser.texi
(/usr/local/src/bash/bash-20251201/lib/readline/doc/hsuser.texi Chapter 9
(/usr/local/src/bash/bash-20251226/lib/readline/doc/hsuser.texi Chapter 9
[167] [168] [169] [170] [171] [172] [173]) Chapter 10 [174] [175] [176]
[177] [178]
Underfull \hbox (badness 10000) in paragraph at lines 10767--10776
@@ -346,17 +347,17 @@ extrm '[], `@texttt strict-posix-default[]@textrm '[], and
texinfo.tex: doing @include of fdl.texi
(/usr/local/src/bash/bash-20251201/doc/fdl.texi [192] [193] [194] [195]
(/usr/local/src/bash/bash-20251226/doc/fdl.texi [192] [193] [194] [195]
[196] [197] [198]) Appendix D [199] [200] [201] [202] [203] [204] [205]
[206] [207] [208] )
Here is how much of TeX's memory you used:
4116 strings out of 495820
47662 string characters out of 6170887
145125 words of memory out of 5000000
145127 words of memory out of 5000000
5053 multiletter control sequences out of 15000+600000
34315 words of font info for 116 fonts, out of 8000000 for 9000
701 hyphenation exceptions out of 8191
16i,6n,16p,331b,983s stack positions out of 10000i,1000n,20000p,200000b,200000s
16i,6n,16p,389b,983s stack positions out of 10000i,1000n,20000p,200000b,200000s
</opt/local/share/texmf-texlive/fonts/type1/public/amsfonts/
cm/cmbx12.pfb></opt/local/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cm
csc10.pfb></opt/local/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmmi10
@@ -373,7 +374,7 @@ fonts/type1/public/amsfonts/cm/cmti10.pfb></opt/local/share/texmf-texlive/fonts
lic/amsfonts/cm/cmtt9.pfb></opt/local/share/texmf-texlive/fonts/type1/public/cm
-super/sfrm1095.pfb></opt/local/share/texmf-texlive/fonts/type1/public/cm-super
/sfrm1440.pfb>
Output written on bashref.pdf (214 pages, 810750 bytes).
Output written on bashref.pdf (214 pages, 811602 bytes).
PDF statistics:
2947 PDF objects out of 2984 (max. 8388607)
2685 compressed objects within 27 object streams
BIN
View File
Binary file not shown.
+749 -733
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+3 -2
View File
@@ -2,10 +2,11 @@
Copyright (C) 1988-2025 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Thu Dec 18 17:25:09 EST 2025
@set LASTCHANGE Fri Dec 26 18:21:22 EST 2025
@set EDITION 5.3
@set VERSION 5.3
@set UPDATED 18 December 2025
@set UPDATED 26 December 2025
@set UPDATED-MONTH December 2025
+3 -1
View File
@@ -846,10 +846,12 @@ execute_command_internal (COMMAND *command, int asynchronous, int pipe_in, int p
}
#endif /* COMMAND_TIMING */
/* Is this a compound command with a redirection from stdin? POSIX interp
1913 makes it matter. */
if (shell_control_structure (command->type) && command->redirects)
{
stdin_redirected = stdin_redirects (command->redirects);
/*itrace("execute_command_internal: compound command with redirects: stdin_redirected = %d", stdin_redirected); */
/*itrace("execute_command_internal: compound command with redirects: stdin_redirected = %d", stdin_redirected);*/
}
#if defined (PROCESS_SUBSTITUTION)
+39 -21
View File
@@ -194,7 +194,7 @@ and echoes and executes them.
The @option{-D} option, if supplied,
causes @code{fc} to remove the selected commands from the history
list before executing the file of edited commands.
@option{-D} is only active when @code{fc} is invoked in this way.
@option{-D} is only effective when @code{fc} is invoked in this way.
It could be used if you make a typo in a command and want to fix it using
an editor while removing the erroneous command from the history to
avoid clutter.
@@ -221,17 +221,39 @@ is that of the re-executed command, unless
@item history
@btindex history
@example
history [@var{n}]
history [-H] [@var{range}]
history -c
history -d @var{offset}
history -d @var{start}-@var{end}
history -d @var{range}
history [-anrw] [@var{filename}]
history -ps @var{arg}
history -ps @var{arg} [@var{arg}@dots{}]
@end example
With no options, display the history list with numbers.
Entries prefixed with a @samp{*} have been modified.
An argument of @var{n} lists only the last @var{n} entries.
With no options,
or with the @option{-H} option,
display the portion of the command history list
specified by @var{range}, as described below.
If @var{range} is not specified, display the entire history list.
Without @option{-H}, display the list with command numbers, prefixing
entries that have been modified with a @samp{*}.
A
@var{range}
argument is specified in the form of a number @var{offset} or
a range @var{start}-@var{end}.
If @var{offset} is supplied, it references the history entry at
position @var{offset} in the history list;
when listing this displays the last @var{offset} entries.
A negative @var{offset} counts back from the end of the history list,
relative to one greater than the last history position.
When listing, negative and positive @var{offset}s have identical results.
@var{start} and @var{end}, if supplied, reference the portion of
the history list beginning at position @var{start} through position
@var{end}.
If @var{start} or @var{end} are negative, they count back from the
end of the history list.
When listing, if @var{start} is greater than @var{end}, the history
entries are displayed in reverse order from @var{end} to @var{start}.
If the shell variable @env{HISTTIMEFORMAT} is set and not null,
it is used as a format string for @code{strftime}(3) to display
the time stamp associated with each displayed history entry.
@@ -245,20 +267,16 @@ Options, if supplied, have the following meanings:
Clear the history list.
This may be combined with the other options to replace the history list.
@item -d @var{offset}
Delete the history entry at position @var{offset}.
If @var{offset} is positive, it should be specified as it appears when
the history is displayed.
If @var{offset} is negative, it is interpreted as relative to one greater
than the last history position, so negative indices count back from the
end of the history, and an index of @samp{-1} refers to the current
@code{history -d} command.
@item -d @var{range}
Delete the history entries specified by @var{range}, as described above.
An offset of @samp{-1} refers to the current @code{history -d} command.
@item -d @var{start}-@var{end}
Delete the range of history entries between positions @var{start} and
@var{end}, inclusive.
Positive and negative values for @var{start} and @var{end}
are interpreted as described above.
@item -H
Display the selected history entries in the format that would be written
to the history file,
including any time stamp information as described below,
without prefixing the entry with any line number or
@samp{*}.
@item -a
Append the "new" history lines to the history file.
+1
View File
@@ -791,6 +791,7 @@ print_case_clauses (PATTERN_LIST *clauses)
newline (";;&");
else
newline (";;");
was_heredoc = 0;
clauses = clauses->next;
}
indentation -= indentation_amount;
+9 -6
View File
@@ -97,7 +97,7 @@ static int add_undo_redirect (int, enum r_instruction, int);
static int add_undo_close_redirect (int);
static int add_undo_fd_redirect (int, int);
static int expandable_redirection_filename (REDIRECT *);
static int stdin_redirection (enum r_instruction, int);
static int stdin_redirection (REDIRECT *);
static int undoablefd (int);
static int do_redirection_internal (REDIRECT *, int, char **);
@@ -1388,9 +1388,9 @@ add_exec_redirect (REDIRECT *dummy_redirect)
/* Return 1 if the redirection specified by RI and REDIRECTOR alters the
standard input. */
static int
stdin_redirection (enum r_instruction ri, int redirector)
stdin_redirection (REDIRECT *rp)
{
switch (ri)
switch (rp->instruction)
{
case r_input_direction:
case r_inputa_direction:
@@ -1402,7 +1402,7 @@ stdin_redirection (enum r_instruction ri, int redirector)
case r_duplicating_input:
case r_duplicating_input_word:
case r_close_this:
return (redirector == 0);
return (rp->redirector.dest == 0);
case r_output_direction:
case r_appending_to:
case r_duplicating_output:
@@ -1420,7 +1420,10 @@ stdin_redirection (enum r_instruction ri, int redirector)
}
/* Return non-zero if any of the redirections in REDIRS alter the standard
input. */
input. The way we call this, to determine whether asynchronous commands
contain a redirection to standard input to inhibit the implicit redirection
from /dev/null, is subject to POSIX interp 1913, which carves out an
exception for things like 0<&0. */
int
stdin_redirects (REDIRECT *redirs)
{
@@ -1429,7 +1432,7 @@ stdin_redirects (REDIRECT *redirs)
for (n = 0, rp = redirs; rp; rp = rp->next)
if ((rp->rflags & REDIR_VARASSIGN) == 0)
n += stdin_redirection (rp->instruction, rp->redirector.dest);
n += stdin_redirection (rp);
return n;
}
/* bind_var_to_int handles array references */
+2 -2
View File
@@ -363,7 +363,7 @@ Use `man -k' or `info' to find out more about commands not in this list.
A star (*) next to a name means that the command is disabled.
! PIPELINE history [-c] [-d offset] [n] or hist>
! PIPELINE history [-c] [-H] [-d range] [range]>
job_spec [&] if COMMANDS; then COMMANDS; [ elif C>
(( expression )) jobs [-lnprs] [jobspec ...] or jobs >
. [-p path] filename [arguments] kill [-s sigspec | -n signum | -sigs>
@@ -456,7 +456,7 @@ Use `man -k' or `info' to find out more about commands not in this list.
A star (*) next to a name means that the command is disabled.
! PIPELINE history [-c] [-d offset] [n] or hist>
! PIPELINE history [-c] [-H] [-d range] [range]>
job_spec [&] if COMMANDS; then COMMANDS; [ elif C>
(( expression )) jobs [-lnprs] [jobspec ...] or jobs >
. [-p path] filename [arguments] kill [-s sigspec | -n signum | -sigs>
+118 -1
View File
@@ -1,5 +1,5 @@
./history.tests: line 19: history: -x: invalid option
history: usage: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]
history: usage: history [-c] [-H] [-d range] [range] or history -anrw [filename] or history -ps arg [arg...]
./history.tests: line 21: history: cannot use more than one of -anrw
./history.tests: line 24: fc: -v: invalid option
fc: usage: fc [-e ename] [-D] [-lnr] [first] [last] or fc -s [pat=rep] [command]
@@ -439,3 +439,120 @@ edit append
8 echo three append
9 # simulate readline edit_and_execute_command
10 echo edit append
history11.sub
one
two
three
four
five
six
seven
eight
nine
ten
1 echo one
2 echo two
3 echo three
4 echo four
5 echo five
6 echo six
7 echo seven
8 echo eight
9 echo nine
10 echo ten
2 echo two
3 echo three
4 echo four
1 echo one
2 echo two
3 echo three
4 echo four
5 echo five
6 echo six
7 echo seven
8 echo eight
9 echo nine
10 echo ten
a
b
c
d
e
1 echo one
2 echo two
3 echo three
4 echo four
5 echo five
6 echo six
7 echo seven
8 echo eight
9 echo nine
10 echo ten
11 echo a
12 echo b
13 echo c
14 echo d
15 echo e
6 echo six
7 echo seven
8 echo eight
9 echo nine
10 echo ten
11 echo a
12 echo b
13 echo c
14 echo d
15 echo e
15 echo e
./history11.sub: line 49: history: 18: history position out of range
./history11.sub: line 50: history: 18: history position out of range
1 echo one
2 echo two
3 echo three
4 echo four
5 echo five
6 echo six
7 echo seven
8 echo eight
9 echo nine
10 echo ten
11 echo a
12 echo b
13 echo c
14 echo d
15 echo e
./history11.sub: line 54: history: 22: history position out of range
./history11.sub: line 55: history: 22: history position out of range
./history11.sub: line 57: history: 16: history position out of range
./history11.sub: line 58: history: 200: history position out of range
./history11.sub: line 59: history: -20: history position out of range
./history11.sub: line 60: history: -50: history position out of range
./history11.sub: line 61: history: 5-0xaf: history position out of range
./history11.sub: line 63: history: @42: numeric argument required
./history11.sub: line 64: history: -0xaf: numeric argument required
./history11.sub: line 68: history: -200: history position out of range
1 echo one
2 echo two
3 echo three
4 echo four
5 echo five
6 echo six
7 echo seven
8 echo eight
9 echo nine
10 echo ten
11 echo a
12 echo b
13 echo c
14 echo d
./history11.sub: line 71: history: 20: history position out of range
./history11.sub: line 72: history: -30: history position out of range
+1
View File
@@ -138,3 +138,4 @@ test_runsub ./history7.sub
test_runsub ./history8.sub
test_runsub ./history9.sub
test_runsub ./history10.sub
test_runsub ./history11.sub
+75
View File
@@ -0,0 +1,75 @@
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
: ${TMPDIR:=/tmp}
set -o history
HISTFILE=$TMPDIR/history-$$
history -c
echo one
echo two
echo three
echo four
echo five
echo six
echo seven
echo eight
echo nine
echo ten
history ; echo
history 2-4 ; echo
history
echo a
echo b
echo c
echo d
echo e
history
history 6--1; echo
history -- -1 ; echo
history 18-14
history 14-18 ; echo
history ; echo
history -- -1-22
history -- 22--2 ; echo
history 16-40
history 1-200
history -- -20-50
history 1--50
history 5-0xaf
history @42
history -- -0xaf
# out of range arguments are clamped at 0 and history_length, respectively
history -d -2--1 # remove comment and this command
history -- -200--1 ; echo
history 567 ; echo
history -- -1-20
history -- 1--30
unset HISTFILE
exit 0