performance improvements for large history lists; fix problem with not unwind-protecting current command and name while executing

This commit is contained in:
Chet Ramey
2024-02-14 09:43:03 -05:00
parent fbc7d97de6
commit 6bd75b8d63
19 changed files with 4596 additions and 4277 deletions
+36
View File
@@ -8571,3 +8571,39 @@ jobs.c
way that we don't mark background jobs that exit cleanly as notified
Inspired by a discussion with Robert Elz <kre@munnari.oz.au> and
https://lists.gnu.org/archive/html/bug-bash/2024-01/msg00189.html
2/9
---
lib/readline/history.c
- DEFAULT_HISTORY_GROW_SIZE: bump up to 256
- real_history, real_history_size: the true history array and its
allocated size. the_history begins a user-visible window into this
list, extending for history_size entries
- history_list_grow_size: compute how much to extend the history list;
increase by roughly sqrt(history_size), don't extend by less than
(new) DEFAULT_HISTORY_GROW_SIZE
- history_list_resize: possibly resize/realloc real_history and reset
the_history to real_history and history_size to real_history_size
- advance_history: make the `window' that the_history provides into
real_history advance to simulate dropping an initial entry; don't
need to memmove all the entries any more
- add_history: call advance_history as necessary to move the_history
window
- add_history: call history_list_resize as necessary
Report and initial patch from Casey Johnson <strykre@hotmail.com>
2/12
----
bashline.c,lib/readline/bind.c,lib/readline/display.c
- replace some sprintf calls with snprintf to appease clang
execute_cmd.c
- execute_simple_command: unwind-protect this_command_name, since we
assign it to something we will free if unwind-protects are run
- execute_function: unwind-protect currently_executing_command, since
execute_command_internal will change it to something will will free
if unwind-protects are run
Report from Grisha Levit <grishalevit@gmail.com>
- execute_function: if we didn't compile with debugger support, restore
currently_executing_command after run_debug_trap, like in other
cases
+5 -2
View File
@@ -949,8 +949,11 @@ edit_and_execute_command (int count, int c, int editing_mode, const char *edit_c
if (rl_explicit_arg)
{
command = (char *)xmalloc (strlen (edit_command) + 8);
sprintf (command, "%s %d", edit_command, count);
size_t clen;
/* 32 exceeds strlen (itos (INTMAX_MAX)) (19) */
clen = strlen (edit_command) + 32;
command = (char *)xmalloc (clen);
snprintf (command, clen, "%s %d", edit_command, count);
}
else
{
+109 -96
View File
@@ -39,6 +39,19 @@
.\" .}f
.\" ..
.\"
.ie \n(.g \{\
.ds ' \(aq
.ds " \(dq
.ds ^ \(ha
.ds ~ \(ti
.\}
.el \{\
.ds ' '
.ds " ""\" two adjacent quotes and no space before this comment
.ds ^ ^
.ds ~ ~
.\}
.
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
.\" \% at the beginning of the string protects the filename from hyphenation.
@@ -212,7 +225,7 @@ Display a usage message on standard output and exit successfully.
Execute commands from
.I file
instead of the standard personal initialization file
.I \(ti/.bashrc
.I \*~/.bashrc
if the shell is interactive (see
.SM
.B INVOCATION
@@ -230,10 +243,10 @@ library to read command lines when the shell is interactive.
Do not read either the system-wide startup file
.FN /etc/profile
or any of the personal initialization files
.IR \(ti/.bash_profile ,
.IR \(ti/.bash_login ,
.IR \*~/.bash_profile ,
.IR \*~/.bash_login ,
or
.IR \(ti/.profile .
.IR \*~/.profile .
By default,
.B bash
reads these files when it is invoked as a login shell (see
@@ -243,7 +256,7 @@ below).
.TP
.B \-\-norc
Do not read and execute the personal initialization file
.I \(ti/.bashrc
.I \*~/.bashrc
if the shell is interactive.
This option is on by default if the shell is invoked as
.BR sh .
@@ -342,8 +355,8 @@ is invoked as an interactive login shell, or as a non-interactive shell
with the \fB\-\-login\fP option, it first reads and
executes commands from the file \fI/etc/profile\fP, if that
file exists.
After reading that file, it looks for \fI\(ti/.bash_profile\fP,
\fI\(ti/.bash_login\fP, and \fI\(ti/.profile\fP, in that order, and reads
After reading that file, it looks for \fI\*~/.bash_profile\fP,
\fI\*~/.bash_login\fP, and \fI\*~/.profile\fP, in that order, and reads
and executes commands from the first one that exists and is readable.
The
.B \-\-noprofile
@@ -352,18 +365,18 @@ option may be used when the shell is started to inhibit this behavior.
When an interactive login shell exits,
or a non-interactive login shell executes the \fBexit\fP builtin command,
.B bash
reads and executes commands from the file \fI\(ti/.bash_logout\fP, if it
reads and executes commands from the file \fI\*~/.bash_logout\fP, if it
exists.
.PP
When an interactive shell that is not a login shell is started,
.B bash
reads and executes commands from \fI\(ti/.bashrc\fP, if that file exists.
reads and executes commands from \fI\*~/.bashrc\fP, if that file exists.
This may be inhibited by using the
.B \-\-norc
option.
The \fB\-\-rcfile\fP \fIfile\fP option will force
.B bash
to read and execute commands from \fIfile\fP instead of \fI\(ti/.bashrc\fP.
to read and execute commands from \fIfile\fP instead of \fI\*~/.bashrc\fP.
.PP
When
.B bash
@@ -378,7 +391,7 @@ behaves as if the following command were executed:
.PP
.RS
.EX
if [ \-n \(dq$BASH_ENV\(dq ]; then . \(dq$BASH_ENV\(dq; fi
if [ \-n \*"$BASH_ENV\*" ]; then . \*"$BASH_ENV\*"; fi
.EE
.RE
.PP
@@ -400,7 +413,7 @@ shell with the \fB\-\-login\fP option, it first attempts to
read and execute commands from
.I /etc/profile
and
.IR \(ti/.profile ,
.IR \*~/.profile ,
in that order.
The
.B \-\-noprofile
@@ -451,7 +464,7 @@ or the secure shell daemon \fIsshd\fP.
If
.B bash
determines it is being run non-interactively in this fashion,
it reads and executes commands from \fI\(ti/.bashrc\fP,
it reads and executes commands from \fI\*~/.bashrc\fP,
if that file exists and is readable.
It will not do this if invoked as \fBsh\fP.
The
@@ -770,7 +783,7 @@ The return value is 0 if the string matches (\fB==\fP) or does not match
Any part of the pattern may be quoted to force the quoted portion
to be matched as a string.
.IP
An additional binary operator, \fB=\(ti\fP, is available, with the same
An additional binary operator, \fB=\*~\fP, is available, with the same
precedence as \fB==\fP and \fB!=\fP.
When it is used, the string to the right of the operator is considered
a POSIX extended regular expression and matched accordingly
@@ -795,7 +808,7 @@ since normal quoting and pattern characters lose their meanings
between brackets.
.IP
The pattern will match if it matches any part of the string.
Anchor the pattern using the \fB\(ha\fP and \fB$\fP regular expression
Anchor the pattern using the \fB\*^\fP and \fB$\fP regular expression
operators to force it to match the entire string.
The array variable
.SM
@@ -1157,7 +1170,7 @@ retains its special meaning only when followed by one of the following
characters:
.BR $ ,
.BR \` ,
\^\fB\(dq\fP\^,
\^\fB\*"\fP\^,
.BR \e ,
or
.BR <newline> .
@@ -1180,7 +1193,7 @@ quotes (see
.B PARAMETERS
below).
.PP
Character sequences of the form \fB$\fP\(aq\fIstring\fP\(aq are treated
Character sequences of the form \fB$\fP\*'\fIstring\fP\*' are treated
as a special variant of single quotes.
The sequence expands to \fIstring\fP, with backslash-escaped characters
in \fIstring\fP replaced as specified by the ANSI C standard.
@@ -1217,10 +1230,10 @@ vertical tab
.B \e\e
backslash
.TP
.B \e\(aq
.B \e\*'
single quote
.TP
.B \e\(dq
.B \e\*"
double quote
.TP
.B \e?
@@ -1250,7 +1263,7 @@ a control-\fIx\fP character
The expanded result is single-quoted, as if the dollar sign had
not been present.
.PP
A double-quoted string preceded by a dollar sign (\fB$\fP\(dq\fIstring\fP\(dq)
A double-quoted string preceded by a dollar sign (\fB$\fP\*"\fIstring\fP\*")
will cause the string to be translated according to the current locale.
The \fIgettext\fP infrastructure performs the lookup and
translation, using the \fBLC_MESSAGES\fP, \fBTEXTDOMAINDIR\fP,
@@ -1430,9 +1443,9 @@ with the value of each parameter separated by the first character of the
.B IFS
special variable.
That is,
.B \(dq$*\(dq
.B \*"$*\*"
is equivalent to
.BR \(dq$1\fIc\fP$2\fIc\fP.\|.\|.\(dq ,
.BR \*"$1\fIc\fP$2\fIc\fP.\|.\|.\*" ,
where
.I c
is the first character of the value of the
@@ -1458,15 +1471,15 @@ with each positional parameter separated by a space.
When the expansion occurs within double quotes,
each parameter expands to a separate word.
That is,
.B \&\(dq$@\(dq
.B \&\*"$@\*"
is equivalent to
.B \&\(dq\&$1\&\(dq\ \(dq$2\(dq\ .\|.\|.
.B \&\*"\&$1\&\*"\ \*"$2\*"\ .\|.\|.
If the double-quoted expansion occurs within a word, the expansion of
the first parameter is joined with the beginning part of the original
word, and the expansion of the last parameter is joined with the last
part of the original word.
When there are no positional parameters,
.B \&\(dq$@\(dq
.B \&\*"$@\*"
and
.B $@
expand to nothing (i.e., they are removed).
@@ -1696,7 +1709,7 @@ dynamically loadable builtins specified by the
command.
.TP
.B BASH_REMATCH
An array variable whose members are assigned by the \fB=\(ti\fP binary
An array variable whose members are assigned by the \fB=\*~\fP binary
operator to the \fB[[\fP conditional command.
The element with index 0 is the portion of the string
matching the entire regular expression.
@@ -2187,7 +2200,7 @@ The current version is also a valid value.
If this parameter is set when \fBbash\fP is executing a shell script,
its value is interpreted as a filename containing commands to
initialize the shell, as in
.IR \(ti/.bashrc .
.IR \*~/.bashrc .
The value of
.SM
.B BASH_ENV
@@ -2227,7 +2240,7 @@ for destination directories specified by the
.B cd
command.
A sample value is
.Q .:\(ti:/usr .
.Q .:\*~:/usr .
.TP
.B CHILD_MAX
Set the number of exited child status values for the shell to remember.
@@ -2296,7 +2309,7 @@ A filename whose suffix matches one of the entries in
.B FIGNORE
is excluded from the list of matched filenames.
A sample value is
.Q .o:\(ti .
.Q .o:\*~ .
.TP
.B FUNCNEST
If set to a numeric value greater than 0, defines a maximum function
@@ -2377,7 +2390,7 @@ The name of the file in which command history is saved (see
.SM
.B HISTORY
below).
\fBBash\fP assigns a default value of \fI\(ti/.bash_history\fP.
\fBBash\fP assigns a default value of \fI\*~/.bash_history\fP.
If \fBHISTFILE\fP is unset or null,
the command history is not saved when a shell exits.
.TP
@@ -2498,7 +2511,7 @@ signifies the end of input to the shell.
The filename for the
.B readline
startup file, overriding the default of
.FN \(ti/.inputrc
.FN \*~/.inputrc
(see
.SM
.B READLINE
@@ -2580,7 +2593,7 @@ Example:
.RS
.PP
.EX
\fBMAILPATH\fP=\(aq/var/mail/bfox?\(dqYou have mail\(dq:\(ti/shell\-mail?\(dq$_ has mail!\(dq\(aq
\fBMAILPATH\fP=\*'/var/mail/bfox?\*"You have mail\*":\*~/shell\-mail?\*"$_ has mail!\*"\*'
.EE
.PP
.B Bash
@@ -2744,7 +2757,7 @@ The value of \fIp\fP determines whether or not the fraction is
included.
.IP
If this variable is not set, \fBbash\fP acts as if it had the
value \fB$\(aq\enreal\et%3lR\enuser\et%3lU\ensys\et%3lS\(aq\fP.
value \fB$\*'\enreal\et%3lR\enuser\et%3lU\ensys\et%3lS\*'\fP.
If the value is null, \fBbash\fP does not display any timing information.
A trailing newline is added when the format string is displayed.
.PD 0
@@ -2812,7 +2825,7 @@ character, which is used as shorthand for re-running the previous
command entered, substituting one string for another in the command,
when it appears as the first character on the line.
The default is
.Q \fB\(ha\fP .
.Q \fB\*^\fP .
The optional third character is the character which indicates that
the remainder of the line is a comment when found as the first character
of a word, normally
@@ -3037,9 +3050,9 @@ Only brace expansion, word splitting, and pathname expansion
can increase the number of words of the expansion; other expansions
expand a single word to a single word.
The only exceptions to this are the expansions of
.B \&\(dq$@\(dq
.B \&\*"$@\*"
and
.B \&\(dq${\fIname\fP[@]}\(dq\c \" keep leading \& for AT&T troff
.B \&\*"${\fIname\fP[@]}\*"\c \" keep leading \& for AT&T troff
.BR \& , \" .BR + \& + \*" doesn't work with AT&T troff
and, in most cases, \fB$*\fP and \fB${\fP\fIname\fP\fB[*]}\fP
as explained above (see
@@ -3146,7 +3159,7 @@ command (see
below).
.SS Tilde Expansion
If a word begins with an unquoted tilde character (\c
.Q \fB\(ti\fP ),
.Q \fB\*~\fP ),
all of
the characters preceding the first unquoted slash (or all characters,
if there is no unquoted slash) are considered a \fItilde-prefix\fP.
@@ -3166,13 +3179,13 @@ Otherwise, the tilde-prefix is replaced with the home directory
associated with the specified login name.
.PP
If the tilde-prefix is a
.Q \(ti+ ,
.Q \*~+ ,
the value of the shell variable
.SM
.B PWD
replaces the tilde-prefix.
If the tilde-prefix is a
.Q \(ti\- ,
.Q \*~\- ,
the value of the shell variable
.SM
.BR OLDPWD ,
@@ -3580,10 +3593,10 @@ or
the substitution operation is applied to each member of the
array in turn, and the expansion is the resultant list.
.TP
${\fIparameter\fP\fB\(ha\fP\fIpattern\fP}
${\fIparameter\fP\fB\*^\fP\fIpattern\fP}
.PD 0
.TP
${\fIparameter\fP\fB\(ha\(ha\fP\fIpattern\fP}
${\fIparameter\fP\fB\*^\*^\fP\fIpattern\fP}
.TP
${\fIparameter\fP\fB,\fP\fIpattern\fP}
.TP
@@ -3596,11 +3609,11 @@ pathname expansion.
Each character in the expanded value of \fIparameter\fP is tested against
\fIpattern\fP, and, if it matches the pattern, its case is converted.
The pattern should not attempt to match more than one character.
The \fB\(ha\fP operator converts lowercase letters matching \fIpattern\fP
The \fB\*^\fP operator converts lowercase letters matching \fIpattern\fP
to uppercase; the \fB,\fP operator converts matching uppercase letters
to lowercase.
The \fB\(ha\(ha\fP and \fB,,\fP expansions convert each matched character in the
expanded value; the \fB\(ha\fP and \fB,\fP expansions match and convert only
The \fB\*^\*^\fP and \fB,,\fP expansions convert each matched character in the
expanded value; the \fB\*^\fP and \fB,\fP expansions match and convert only
the first character in the expanded value.
If \fIpattern\fP is omitted, it is treated like a \fB?\fP, which matches
every character.
@@ -3648,7 +3661,7 @@ format that can be reused as input.
.TP
.B E
The expansion is a string that is the value of \fIparameter\fP with backslash
escape sequences expanded as with the \fB$\(aq\fP.\|.\|.\%\fB\(aq\fP
escape sequences expanded as with the \fB$\*'\fP.\|.\|.\%\fB\*'\fP
quoting mechanism.
.TP
.B P
@@ -3900,8 +3913,8 @@ is unset, word splitting behaves as if it contained the default value
of
.BR <space><tab><newline> .
.PP
Explicit null arguments (\^\f3\(dq\^\(dq\fP or
\^\f3\(aq\^\(aq\fP\^) are retained
Explicit null arguments (\^\f3\*"\^\*"\fP or
\^\f3\*'\^\*'\fP\^) are retained
and passed to commands as empty strings.
Unquoted implicit null arguments, resulting from the expansion of
parameters that have no values, are removed.
@@ -3911,7 +3924,7 @@ and passed to a command as an empty string.
When a quoted null argument appears as part of a word whose expansion is
non-null, the null argument is removed.
That is, the word
.Q "\-d\(aq\^\(aq"
.Q "\-d\*'\^\*'"
becomes
.Q \-d
after word splitting and null argument removal.
@@ -4095,7 +4108,7 @@ is matched. If the first character following the
is a
.B !
or a
.B \(ha
.B \*^
then any character not enclosed is matched.
The sorting order of characters in range expressions,
and the characters included in the range,
@@ -4225,8 +4238,8 @@ strings instead of a single long string, may be faster.
After the preceding expansions, all unquoted occurrences of the
characters
.BR \e ,
.BR \(aq ,
and \^\f3\(dq\fP\^ that did not result from one of the above
.BR \*' ,
and \^\f3\*"\fP\^ that did not result from one of the above
expansions are removed.
.SH REDIRECTION
Before a command is executed, its input and output
@@ -4873,7 +4886,7 @@ unary minus and plus
.B ++\fIid\fP \-\-\fIid\fP
variable pre-increment and pre-decrement
.TP
.B ! \(ti
.B ! \*~
logical and bitwise negation
.TP
.B **
@@ -4897,7 +4910,7 @@ equality and inequality
.B &
bitwise AND
.TP
.B \(ha
.B \*^
bitwise exclusive OR
.TP
.B |
@@ -4912,7 +4925,7 @@ logical OR
.B \fIexpr\fP?\fIexpr\fP:\fIexpr\fP
conditional operator
.TP
.B "= *= /= %= += \-= <<= >>= &= \(ha= |="
.B "= *= /= %= += \-= <<= >>= &= \*^= |="
assignment
.TP
.B \fIexpr1\fP , \fIexpr2\fP
@@ -5525,10 +5538,10 @@ command to complete, the shell receives keyboard-generated signals
such as
.SM
.B SIGINT
(usually generated by \fB\(haC\fP) that users commonly intend to send
(usually generated by \fB\*^C\fP) that users commonly intend to send
to that command.
This happens because the shell and the command are in the
same process group as the terminal, and \fB\(haC\fP sends
same process group as the terminal, and \fB\*^C\fP sends
.SM
.B SIGINT
to all processes in that process group.
@@ -5641,14 +5654,14 @@ contains facilities to use it.
Typing the
.I suspend
character (typically
.BR \(haZ ,
.BR \*^Z ,
Control-Z) while a process is running
causes that process to be stopped and returns control to
.BR bash .
Typing the
.I "delayed suspend"
character (typically
.BR \(haY ,
.BR \*^Y ,
Control-Y) causes the process to be stopped when it
attempts to read input from the terminal, and control to
be returned to
@@ -5660,7 +5673,7 @@ command to continue it in the background, the
command to continue it in the foreground, or
the
.B kill
command to kill it. A \fB\(haZ\fP takes effect immediately,
command to kill it. A \fB\*^Z\fP takes effect immediately,
and has the additional side effect of causing pending output
and typeahead to be discarded.
.PP
@@ -5980,7 +5993,7 @@ The name of this file is taken from the value of the
.SM
.B INPUTRC
variable. If that variable is unset, the default is
.IR \(ti/.inputrc .
.IR \*~/.inputrc .
If that file does not exist or cannot be read, the ultimate default is
.IR /etc/inputrc .
When a program which uses the readline library starts up, the
@@ -6047,7 +6060,7 @@ is the name of a key spelled out in English. For example:
.nf
Control-u: universal\-argument
Meta-Rubout: backward-kill-word
Control-o: \(dq> output\(dq
Control-o: \*"> output\*"
.fi
.EE
.RE
@@ -6067,7 +6080,7 @@ expressed on the right hand side (that is, to insert the text
into the line).
.PP
In the second form,
\fB\(dqkeyseq\(dq\fP:\^\fIfunction\-name\fP or \fImacro\fP,
\fB\*"keyseq\*"\fP:\^\fIfunction\-name\fP or \fImacro\fP,
.B keyseq
differs from
.B keyname
@@ -6080,9 +6093,9 @@ are not recognized.
.RS
.EX
.nf
\(dq\eC\-u\(dq: universal\-argument
\(dq\eC\-x\eC\-r\(dq: re\-read\-init\-file
\(dq\ee[11\(ti\(dq: \(dqFunction Key 1\(dq
\*"\eC\-u\*": universal\-argument
\*"\eC\-x\eC\-r\*": re\-read\-init\-file
\*"\ee[11\*~\*": \*"Function Key 1\*"
.fi
.EE
.RE
@@ -6095,7 +6108,7 @@ is again bound to the function
is bound to the function
.BR re\-read\-init\-file ,
and
.I "ESC [ 1 1 \(ti"
.I "ESC [ 1 1 \*~"
is bound to insert the text
.Q "Function Key 1" .
.PP
@@ -6115,11 +6128,11 @@ an escape character
.B \e\e
backslash
.TP
.B \e\(dq
literal \(dq
.B \e\*"
literal \*"
.TP
.B \e\(aq
literal \(aq
.B \e\*'
literal \*'
.RE
.PD
.PP
@@ -6167,7 +6180,7 @@ be used to indicate a macro definition.
Unquoted text is assumed to be a function name.
In the macro body, the backslash escapes described above are expanded.
Backslash will quote any other character in the macro text,
including \(dq and \(aq.
including \*" and \*'.
.PP
.B Bash
allows the current readline key bindings to be displayed or modified
@@ -6650,7 +6663,7 @@ key sequence that quotes the current or previous word in \fBbash\fP:
.nf
\fB$if\fP Bash
# Quote the current or previous word
\(dq\eC-xq\(dq: \(dq\eeb\e\(dq\eef\e\(dq\(dq
\*"\eC-xq\*": \*"\eeb\e\*"\eef\e\*"\*"
\fB$endif\fP
.fi
.EE
@@ -6907,7 +6920,7 @@ history expansion had been specified.
.B shell\-expand\-line (M\-C\-e)
Expand the line by performing shell word expansions.
This performs alias and history expansion,
\fB$\fP\(aq\fIstring\fP\(aq and \fB$\fP\(dq\fIstring\fP\(dq quoting,
\fB$\fP\*'\fIstring\fP\*' and \fB$\fP\*"\fIstring\fP\*" quoting,
tilde expansion, parameter and variable expansion, arithmetic expansion,
command and process substitution,
word splitting, and quote removal.
@@ -6917,7 +6930,7 @@ See
.B HISTORY EXPANSION
below for a description of history expansion.
.TP
.B history\-expand\-line (M\-\(ha)
.B history\-expand\-line (M\-\*^)
Perform history expansion on the current line.
See
.SM
@@ -7126,7 +7139,7 @@ Attempt to perform completion on the text before point.
.B Bash
attempts completion treating the text as a variable (if the
text begins with \fB$\fP), username (if the text begins with
\fB\(ti\fP), hostname (if the text begins with \fB@\fP), or
\fB\*~\fP), hostname (if the text begins with \fB@\fP), or
command (including aliases and functions) in turn. If none
of these produces a match, filename completion is attempted.
.TP
@@ -7171,11 +7184,11 @@ Attempt filename completion on the text before point.
List the possible completions of the text before point,
treating it as a filename.
.TP
.B complete\-username (M\-\(ti)
.B complete\-username (M\-\*~)
Attempt completion on the text before point, treating
it as a username.
.TP
.B possible\-username\-completions (C\-x \(ti)
.B possible\-username\-completions (C\-x \*~)
List the possible completions of the text before point,
treating it as a username.
.TP
@@ -7547,7 +7560,7 @@ completion function would load completions dynamically:
.nf
_completion_loader()
{
. \(dq/etc/bash_completion.d/$1.sh\(dq \c
. \*"/etc/bash_completion.d/$1.sh\*" \c
.if \n(LL<80n \{\
\e
.br
@@ -7598,7 +7611,7 @@ On startup, the history is initialized from the file named by
the variable
.SM
.B HISTFILE
(default \fI\(ti/.bash_history\fP).
(default \fI\*~/.bash_history\fP).
The file named by the value of
.SM
.B HISTFILE
@@ -7847,13 +7860,13 @@ 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\(ha\s-2\u\fIstring1\fP\d\s+2\(ha\s-2\u\fIstring2\fP\d\s+2\(ha\s-2\u
.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 previous command, replacing
.I string1
with
.IR string2 .
Equivalent to
.Q !!:s\d\s+2\(ha\s-2\u\fIstring1\fP\d\s+2\(ha\s-2\u\fIstring2\fP\d\s+2\(ha\s-2\u
.Q !!: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 !#
@@ -7865,7 +7878,7 @@ A
.B :
separates the event specification from the word designator.
It may be omitted if the word designator begins with a
.BR \(ha ,
.BR \*^ ,
.BR $ ,
.BR * ,
.BR \- ,
@@ -7884,7 +7897,7 @@ word.
.I n
The \fIn\fRth word.
.TP
.B \(ha
.B \*^
The first argument. That is, word 1.
.TP
.B $
@@ -8150,7 +8163,7 @@ Each non-option argument is a command as it would appear in a
initialization file such as
.IR .inputrc ,
but each binding or command must be passed as a separate argument;
e.g., \(aq\(dq\eC\-x\eC\-r\(dq: re\-read\-init\-file\(aq.
e.g., \*'\*"\eC\-x\eC\-r\*": re\-read\-init\-file\*'.
In the following descriptions, output available to be re-read is formatted
as commands that would appear in a
.B readline
@@ -9250,7 +9263,7 @@ In the second form, \fIcommand\fP is re-executed after each instance
of \fIpat\fP is replaced by \fIrep\fP.
\fICommand\fP is interpreted the same as \fIfirst\fP above.
A useful alias to use with this is
.Q "r=\(dqfc \-s\(dq" ,
.Q "r=\*"fc \-s\*"" ,
so that typing
.Q "r cc"
runs the last command beginning with
@@ -9885,7 +9898,7 @@ in the same way as \fBecho \-e\fP.
.B %q
causes \fBprintf\fP to output the corresponding
\fIargument\fP in a format that can be reused as shell input.
\fB%q\fP and \fB%Q\fP use the \fB$\(aq\(aq\fP quoting style if any characters
\fB%q\fP and \fB%Q\fP use the \fB$\*'\*'\fP quoting style if any characters
in the argument string require it, and backslash quoting otherwise.
If the format string uses the \fIprintf\fP alternate form, these two
formats quote the argument string using single quotes.
@@ -10939,7 +10952,7 @@ under
\fBPathname Expansion\fP are enabled.
.TP 8
.B extquote
If set, \fB$\fP\(aq\fIstring\fP\(aq and \fB$\fP\(dq\fIstring\fP\(dq quoting is
If set, \fB$\fP\*'\fIstring\fP\*' and \fB$\fP\*"\fIstring\fP\*" quoting is
performed within \fB${\fP\fIparameter\fP\fB}\fP expansions
enclosed in double quotes. This option is enabled by default.
.TP 8
@@ -11121,7 +11134,7 @@ or when filtering possible completions as part of programmable completion.
If set,
.B bash
encloses the translated results of
.BR $\(dq .\|.\|.\& \(dq
.BR $\*" .\|.\|.\& \*"
quoting in single quotes instead of double quotes.
If the string is not translated, this has no effect.
.TP 8
@@ -11913,7 +11926,7 @@ and it is required for bash-5.1 and later versions.
.PD 0
.RS
.IP \(bu
quoting the rhs of the \fB[[\fP command's regexp matching operator (=\(ti)
quoting the rhs of the \fB[[\fP command's regexp matching operator (=\*~)
has no special effect
.RE
.PD
@@ -11979,7 +11992,7 @@ are not special within double-quoted word expansions
.IP \(bu
the shell does not print a warning message if an attempt is made to
use a quoted compound assignment as an argument to declare
(e.g., declare \-a foo=\(aq(1 2)\(aq). Later versions warn that this usage is
(e.g., declare \-a foo=\*'(1 2)\*'). Later versions warn that this usage is
deprecated
.IP \(bu
word expansion errors are considered non-fatal errors that cause the
@@ -12200,7 +12213,7 @@ script.
\fIPortable Operating System Interface (POSIX) Part 2: Shell and Utilities\fP, IEEE \(em
http://pubs.opengroup.org/onlinepubs/9699919799/
.TP
http://tiswww.case.edu/\(tichet/bash/POSIX \(em a description of posix mode
http://tiswww.case.edu/\*~chet/bash/POSIX \(em a description of posix mode
.TP
\fIsh\fP(1), \fIksh\fP(1), \fIcsh\fP(1)
.TP
@@ -12217,20 +12230,20 @@ The \fBbash\fP executable
.FN /etc/profile
The systemwide initialization file, executed for login shells
.TP
.FN \(ti/.bash_profile
.FN \*~/.bash_profile
The personal initialization file, executed for login shells
.TP
.FN \(ti/.bashrc
.FN \*~/.bashrc
The individual per-interactive-shell startup file
.TP
.FN \(ti/.bash_logout
.FN \*~/.bash_logout
The individual login shell cleanup file, executed when a login shell exits
.TP
.FN \(ti/.bash_history
.FN \*~/.bash_history
The default value of \fBHISTFILE\fP, the file in which bash saves the
command history
.TP
.FN \(ti/.inputrc
.FN \*~/.inputrc
Individual \fIreadline\fP initialization file
.PD
.SH AUTHORS
+140 -89
View File
@@ -37,6 +37,15 @@
@@ -247,7 +256,7 @@ Execute commands from
<I>file</I>
instead of the standard personal initialization file
<I>ti/.bashrc</I>
<A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
if the shell is interactive (see
<FONT SIZE=-1><B>INVOCATION</B>
@@ -273,12 +282,12 @@ Do not read either the system-wide startup file
<A HREF="file:/etc/profile"><I>/etc/profile</I></A>
or any of the personal initialization files
<I>ti/.bash_profile</I>,
<A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>,
<I>ti/.bash_login</I>,
<A HREF="file:~/.bash_login"><I>~/.bash_login</I></A>,
or
<I>ti/.profile</I>.
<A HREF="file:~/.profile"><I>~/.profile</I></A>.
By default,
<B>bash</B>
@@ -292,7 +301,7 @@ below).
<DD>
Do not read and execute the personal initialization file
<I>ti/.bashrc</I>
<A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
if the shell is interactive.
This option is on by default if the shell is invoked as
@@ -428,8 +437,8 @@ is invoked as an interactive login shell, or as a non-interactive shell
with the <B>--login</B> option, it first reads and
executes commands from the file <A HREF="file:/etc/profile"><I>/etc/profile</I></A>, if that
file exists.
After reading that file, it looks for <I>ti/.bash_profile</I>,
<I>ti/.bash_login</I>, and <I>ti/.profile</I>, in that order, and reads
After reading that file, it looks for <A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>,
<A HREF="file:~/.bash_login"><I>~/.bash_login</I></A>, and <A HREF="file:~/.profile"><I>~/.profile</I></A>, in that order, and reads
and executes commands from the first one that exists and is readable.
The
<B>--noprofile</B>
@@ -441,14 +450,14 @@ When an interactive login shell exits,
or a non-interactive login shell executes the <B>exit</B> builtin command,
<B>bash</B>
reads and executes commands from the file <I>ti/.bash_logout</I>, if it
reads and executes commands from the file <A HREF="file:~/.bash_logout"><I>~/.bash_logout</I></A>, if it
exists.
<P>
When an interactive shell that is not a login shell is started,
<B>bash</B>
reads and executes commands from <I>ti/.bashrc</I>, if that file exists.
reads and executes commands from <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>, if that file exists.
This may be inhibited by using the
<B>--norc</B>
@@ -456,7 +465,7 @@ option.
The <B>--rcfile</B> <I>file</I> option will force
<B>bash</B>
to read and execute commands from <I>file</I> instead of <I>ti/.bashrc</I>.
to read and execute commands from <I>file</I> instead of <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>.
<P>
When
@@ -476,7 +485,11 @@ behaves as if the following command were executed:
<DL COMPACT><DT><DD>
if [ -n dq$BASH_ENVdq ]; then . dq$BASH_ENVdq; fi
if [ -n &quot;
$BASH_ENV&quot;
]; then . &quot;
$BASH_ENV&quot;
; fi
</DL>
@@ -506,7 +519,7 @@ read and execute commands from
<A HREF="file:/etc/profile"><I>/etc/profile</I></A>
and
<I>ti/.profile</I>,
<A HREF="file:~/.profile"><I>~/.profile</I></A>,
in that order.
The
@@ -576,7 +589,7 @@ If
<B>bash</B>
determines it is being run non-interactively in this fashion,
it reads and executes commands from <I>ti/.bashrc</I>,
it reads and executes commands from <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>,
if that file exists and is readable.
It will not do this if invoked as <B>sh</B>.
The
@@ -985,7 +998,7 @@ The return value is 0 if the string matches (<B>==</B>) or does not match
Any part of the pattern may be quoted to force the quoted portion
to be matched as a string.
<DT><DD>
An additional binary operator, <B>=ti</B>, is available, with the same
An additional binary operator, <B>=~</B>, is available, with the same
precedence as <B>==</B> and <B>!=</B>.
When it is used, the string to the right of the operator is considered
a POSIX extended regular expression and matched accordingly
@@ -1012,7 +1025,7 @@ since normal quoting and pattern characters lose their meanings
between brackets.
<DT><DD>
The pattern will match if it matches any part of the string.
Anchor the pattern using the <B>ha</B> and <B>$</B> regular expression
Anchor the pattern using the <B>^</B> and <B>$</B> regular expression
operators to force it to match the entire string.
The array variable
<FONT SIZE=-1><B>BASH_REMATCH</B>
@@ -1448,7 +1461,8 @@ characters:
<B>`</B>,
<B>dq</B>,
<B>&quot;
</B>,
<B>\</B>,
or
@@ -1480,7 +1494,7 @@ quotes (see
below).
<P>
Character sequences of the form <B>$</B>aq<I>string</I>aq are treated
Character sequences of the form <B>$</B>'<I>string</I>' are treated
as a special variant of single quotes.
The sequence expands to <I>string</I>, with backslash-escaped characters
in <I>string</I> replaced as specified by the ANSI C standard.
@@ -1527,11 +1541,11 @@ vertical tab
<DD>
backslash
<DT><B>\aq</B>
<DT><B>\'</B>
<DD>
single quote
<DT><B>\dq</B>
<DT><B>\</B>
<DD>
double quote
@@ -1572,7 +1586,9 @@ The expanded result is single-quoted, as if the dollar sign had
not been present.
<P>
A double-quoted string preceded by a dollar sign (<B>$</B>dq<I>string</I>dq)
A double-quoted string preceded by a dollar sign (<B>$</B>&quot;
<I>string</I>&quot;
)
will cause the string to be translated according to the current locale.
The <I>gettext</I> infrastructure performs the lookup and
translation, using the <B>LC_MESSAGES</B>, <B>TEXTDOMAINDIR</B>,
@@ -1803,10 +1819,10 @@ with the value of each parameter separated by the first character of the
</FONT>
special variable.
That is,
<B>dq$*dq</B>
<B>$*</B>
is equivalent to
<B>dq$1</B><I>c</I>$2<I>c</I>...dq,
<B>$1</B><I>c</I>$2<I>c</I>...,
where
<I>c</I>
@@ -1838,17 +1854,17 @@ with each positional parameter separated by a space.
When the expansion occurs within double quotes,
each parameter expands to a separate word.
That is,
<B>dq$@dq</B>
<B>$@</B>
is equivalent to
<B>dq$1dq&nbsp;dq$2dq&nbsp;...</B>
<B>$1&nbsp;$2&nbsp;...</B>
If the double-quoted expansion occurs within a word, the expansion of
the first parameter is joined with the beginning part of the original
word, and the expansion of the last parameter is joined with the last
part of the original word.
When there are no positional parameters,
<B>dq$@dq</B>
<B>$@</B>
and
<B>$@</B>
@@ -2143,7 +2159,7 @@ command.
<DT><B>BASH_REMATCH</B>
<DD>
An array variable whose members are assigned by the <B>=ti</B> binary
An array variable whose members are assigned by the <B>=~</B> binary
operator to the <B>[[</B> conditional command.
The element with index 0 is the portion of the string
matching the entire regular expression.
@@ -2759,7 +2775,7 @@ The current version is also a valid value.
If this parameter is set when <B>bash</B> is executing a shell script,
its value is interpreted as a filename containing commands to
initialize the shell, as in
<I>ti/.bashrc</I>.
<A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>.
The value of
<FONT SIZE=-1><B>BASH_ENV</B>
@@ -2994,7 +3010,7 @@ The name of the file in which command history is saved (see
</FONT>
below).
<B>Bash</B> assigns a default value of <I>ti/.bash_history</I>.
<B>Bash</B> assigns a default value of <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>.
If <B>HISTFILE</B> is unset or null,
the command history is not saved when a shell exits.
<DT><B>HISTFILESIZE</B>
@@ -3143,7 +3159,7 @@ The filename for the
startup file, overriding the default of
<I>ti/.inputrc</I>
<A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>
(see
<FONT SIZE=-1><B>READLINE</B>
@@ -3246,7 +3262,11 @@ Example:
<P>
<B>MAILPATH</B>=aq/var/mail/bfox?dqYou have maildq:ti/shell-mail?dq$_ has mail!dqaq
<B>MAILPATH</B>='/var/mail/bfox?&quot;
You have mail&quot;
:~/shell-mail?&quot;
$_ has mail!&quot;
'
<P>
@@ -3454,7 +3474,7 @@ The value of <I>p</I> determines whether or not the fraction is
included.
<DT><DD>
If this variable is not set, <B>bash</B> acts as if it had the
value <B>$aq\nreal\t%3lR\nuser\t%3lU\nsys\t%3lSaq</B>.
value <B>$'\nreal\t%3lR\nuser\t%3lU\nsys\t%3lS'</B>.
If the value is null, <B>bash</B> does not display any timing information.
A trailing newline is added when the format string is displayed.
@@ -3820,10 +3840,10 @@ Only brace expansion, word splitting, and pathname expansion
can increase the number of words of the expansion; other expansions
expand a single word to a single word.
The only exceptions to this are the expansions of
<B>dq$@dq</B>
<B>$@</B>
and
<B>dq${</B><I>name</I>[@]}dq <B></B>,
<B>${</B><I>name</I>[@]} <B></B>,
@@ -4451,9 +4471,9 @@ or
the substitution operation is applied to each member of the
array in turn, and the expansion is the resultant list.
<DT>${<I>parameter</I><B>ha</B><I>pattern</I>}<DD>
<DT>${<I>parameter</I><B>^</B><I>pattern</I>}<DD>
<DT>${<I>parameter</I><B>haha</B><I>pattern</I>}<DD>
<DT>${<I>parameter</I><B>^^</B><I>pattern</I>}<DD>
<DT>${<I>parameter</I><B>,</B><I>pattern</I>}<DD>
<DT>${<I>parameter</I><B>,,</B><I>pattern</I>}<DD>
@@ -4464,11 +4484,11 @@ pathname expansion.
Each character in the expanded value of <I>parameter</I> is tested against
<I>pattern</I>, and, if it matches the pattern, its case is converted.
The pattern should not attempt to match more than one character.
The <B>ha</B> operator converts lowercase letters matching <I>pattern</I>
The <B>^</B> operator converts lowercase letters matching <I>pattern</I>
to uppercase; the <B>,</B> operator converts matching uppercase letters
to lowercase.
The <B>haha</B> and <B>,,</B> expansions convert each matched character in the
expanded value; the <B>ha</B> and <B>,</B> expansions match and convert only
The <B>^^</B> and <B>,,</B> expansions convert each matched character in the
expanded value; the <B>^</B> and <B>,</B> expansions match and convert only
the first character in the expanded value.
If <I>pattern</I> is omitted, it is treated like a <B>?</B>, which matches
every character.
@@ -4529,7 +4549,7 @@ format that can be reused as input.
<DD>
The expansion is a string that is the value of <I>parameter</I> with backslash
escape sequences expanded as with the <B>$aq</B>...<B>aq</B>
escape sequences expanded as with the <B>$'</B>...<B>'</B>
quoting mechanism.
<DT><B>P</B>
@@ -4857,8 +4877,10 @@ of
<P>
Explicit null arguments (<B>dqdq</B> or
<B>aqaq</B>) are retained
Explicit null arguments (<B>&quot;
&quot;
</B> or
<B>''</B>) are retained
and passed to commands as empty strings.
Unquoted implicit null arguments, resulting from the expansion of
parameters that have no values, are removed.
@@ -5101,7 +5123,7 @@ is a
<B>!</B>
or a
<B>ha</B>
<B>^</B>
then any character not enclosed is matched.
The sorting order of characters in range expressions,
@@ -5253,9 +5275,10 @@ After the preceding expansions, all unquoted occurrences of the
characters
<B>\</B>,
<B>aq</B>,
<B>'</B>,
and <B>dq</B> that did not result from one of the above
and <B>&quot;
</B> that did not result from one of the above
expansions are removed.
<A NAME="lbBI">&nbsp;</A>
<H3>REDIRECTION</H3>
@@ -6118,7 +6141,7 @@ unary minus and plus
<DD>
variable pre-increment and pre-decrement
<DT><B>! ti</B>
<DT><B>! ~</B>
<DD>
logical and bitwise negation
@@ -6150,7 +6173,7 @@ equality and inequality
<DD>
bitwise AND
<DT><B>ha</B>
<DT><B>^</B>
<DD>
bitwise exclusive OR
@@ -6170,7 +6193,7 @@ logical OR
<DD>
conditional operator
<DT><B>= *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ha= |=</B>
<DT><B>= *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=</B>
<DD>
assignment
@@ -6932,10 +6955,10 @@ such as
<FONT SIZE=-1><B>SIGINT</B>
</FONT>
(usually generated by <B>haC</B>) that users commonly intend to send
(usually generated by <B>^C</B>) that users commonly intend to send
to that command.
This happens because the shell and the command are in the
same process group as the terminal, and <B>haC</B> sends
same process group as the terminal, and <B>^C</B> sends
<FONT SIZE=-1><B>SIGINT</B>
</FONT>
@@ -7085,7 +7108,7 @@ Typing the
<I>suspend</I>
character (typically
<B>haZ</B>,
<B>^Z</B>,
Control-Z) while a process is running
causes that process to be stopped and returns control to
@@ -7095,7 +7118,7 @@ Typing the
<I>delayed suspend</I>
character (typically
<B>haY</B>,
<B>^Y</B>,
Control-Y) causes the process to be stopped when it
attempts to read input from the terminal, and control to
@@ -7112,7 +7135,7 @@ command to continue it in the foreground, or
the
<B>kill</B>
command to kill it. A <B>haZ</B> takes effect immediately,
command to kill it. A <B>^Z</B> takes effect immediately,
and has the additional side effect of causing pending output
and typeahead to be discarded.
<P>
@@ -7535,7 +7558,7 @@ The name of this file is taken from the value of the
</FONT>
variable. If that variable is unset, the default is
<I>ti/.inputrc</I>.
<A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>.
If that file does not exist or cannot be read, the ultimate default is
<A HREF="file:/etc/inputrc"><I>/etc/inputrc</I></A>.
@@ -7631,7 +7654,9 @@ is the name of a key spelled out in English. For example:
<PRE>
Control-u: universal-argument
Meta-Rubout: backward-kill-word
Control-o: dq&gt; outputdq
Control-o: &quot;
&gt; output&quot;
</PRE>
@@ -7660,7 +7685,9 @@ into the line).
<P>
In the second form,
<B>dqkeyseqdq</B>:<I>function-name</I> or <I>macro</I>,
<B>&quot;
keyseq&quot;
</B>:<I>function-name</I> or <I>macro</I>,
<B>keyseq</B>
differs from
@@ -7676,9 +7703,17 @@ are not recognized.
<DL COMPACT><DT><DD>
<PRE>
dq\C-udq: universal-argument
dq\C-x\C-rdq: re-read-init-file
dq\e[11tidq: dqFunction Key 1dq
&quot;
\C-u&quot;
: universal-argument
&quot;
\C-x\C-r&quot;
: re-read-init-file
&quot;
\e[11~&quot;
: &quot;
Function Key 1&quot;
</PRE>
@@ -7698,7 +7733,7 @@ is bound to the function
<B>re-read-init-file</B>,
and
<I>ESC [ 1 1 ti</I>
<I>ESC [ 1 1 ~</I>
is bound to insert the text
@@ -7724,14 +7759,15 @@ an escape character
<DD>
backslash
<DT><B>\dq</B>
<DT><B>\</B>
<DD>
literal dq
<DT><B>\aq</B>
literal &quot;
<DT><B>\'</B>
<DD>
literal aq
literal '
</DL></DL>
@@ -7794,7 +7830,8 @@ be used to indicate a macro definition.
Unquoted text is assumed to be a function name.
In the macro body, the backslash escapes described above are expanded.
Backslash will quote any other character in the macro text,
including dq and aq.
including &quot;
and '.
<P>
<B>Bash</B>
@@ -8377,7 +8414,13 @@ key sequence that quotes the current or previous word in <B>bash</B>:
<PRE>
<B>$if</B> Bash
# Quote the current or previous word
dq\C-xqdq: dq\eb\dq\ef\dqdq
&quot;
\C-xq&quot;
: &quot;
\eb\&quot;
\ef\&quot;
&quot;
<B>$endif</B>
</PRE>
@@ -8695,7 +8738,9 @@ history expansion had been specified.
<DD>
Expand the line by performing shell word expansions.
This performs alias and history expansion,
<B>$</B>aq<I>string</I>aq and <B>$</B>dq<I>string</I>dq quoting,
<B>$</B>'<I>string</I>' and <B>$</B>&quot;
<I>string</I>&quot;
quoting,
tilde expansion, parameter and variable expansion, arithmetic expansion,
command and process substitution,
word splitting, and quote removal.
@@ -8705,7 +8750,7 @@ See
</FONT>
below for a description of history expansion.
<DT><B>history-expand-line (M-ha)</B>
<DT><B>history-expand-line (M-^)</B>
<DD>
Perform history expansion on the current line.
@@ -8981,7 +9026,7 @@ Attempt to perform completion on the text before point.
attempts completion treating the text as a variable (if the
text begins with <B>$</B>), username (if the text begins with
<B>ti</B>), hostname (if the text begins with <B>@</B>), or
<B>~</B>), hostname (if the text begins with <B>@</B>), or
command (including aliases and functions) in turn. If none
of these produces a match, filename completion is attempted.
<DT><B>possible-completions (M-?)</B>
@@ -9032,12 +9077,12 @@ Attempt filename completion on the text before point.
<DD>
List the possible completions of the text before point,
treating it as a filename.
<DT><B>complete-username (M-ti)</B>
<DT><B>complete-username (M-~)</B>
<DD>
Attempt completion on the text before point, treating
it as a username.
<DT><B>possible-username-completions (C-x ti)</B>
<DT><B>possible-username-completions (C-x ~)</B>
<DD>
List the possible completions of the text before point,
@@ -9497,7 +9542,9 @@ completion function would load completions dynamically:
<PRE>
_completion_loader()
{
. dq/etc/bash_completion.d/$1.shdq
. &quot;
/etc/bash_completion.d/$1.sh&quot;
\
<BR>
@@ -9561,7 +9608,7 @@ the variable
<FONT SIZE=-1><B>HISTFILE</B>
</FONT>
(default <I>ti/.bash_history</I>).
(default <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>).
The file named by the value of
<FONT SIZE=-1><B>HISTFILE</B>
@@ -9877,7 +9924,7 @@ The trailing <B>?</B> may be omitted if
is followed immediately by a newline.
If <I>string</I> is missing, the string from the most recent search is used;
it is an error if there is no previous search string.
<DT><B></B><FONT SIZE=+2><B>ha</B></FONT><B></B><I>string1</I><FONT SIZE=+2>ha</FONT><I>string2</I><FONT SIZE=+2>ha</FONT>
<DT><B></B><FONT SIZE=+2><B>^</B></FONT><B></B><I>string1</I><FONT SIZE=+2>^</FONT><I>string2</I><FONT SIZE=+2>^</FONT>
<DD>
Quick substitution. Repeat the previous command, replacing
@@ -9904,7 +9951,7 @@ A
separates the event specification from the word designator.
It may be omitted if the word designator begins with a
<B>ha</B>,
<B>^</B>,
<B>$</B>,
@@ -9931,7 +9978,7 @@ word.
<DD>
The <I>n</I>th word.
<DT><B>ha</B>
<DT><B>^</B>
<DD>
The first argument. That is, word 1.
@@ -10255,7 +10302,9 @@ initialization file such as
<I>.inputrc</I>,
but each binding or command must be passed as a separate argument;
e.g., aqdq\C-x\C-rdq: re-read-init-fileaq.
e.g., '&quot;
\C-x\C-r&quot;
: re-read-init-file'.
In the following descriptions, output available to be re-read is formatted
as commands that would appear in a
<B>readline</B>
@@ -12383,7 +12432,7 @@ in the same way as <B>echo -e</B>.
<DD>
causes <B>printf</B> to output the corresponding
<I>argument</I> in a format that can be reused as shell input.
<B>%q</B> and <B>%Q</B> use the <B>$aqaq</B> quoting style if any characters
<B>%q</B> and <B>%Q</B> use the <B>$''</B> quoting style if any characters
in the argument string require it, and backslash quoting otherwise.
If the format string uses the <I>printf</I> alternate form, these two
formats quote the argument string using single quotes.
@@ -13702,7 +13751,9 @@ under
<DT><B>extquote</B>
<DD>
If set, <B>$</B>aq<I>string</I>aq and <B>$</B>dq<I>string</I>dq quoting is
If set, <B>$</B>'<I>string</I>' and <B>$</B>&quot;
<I>string</I>&quot;
quoting is
performed within <B>${</B><I>parameter</I><B>}</B> expansions
enclosed in double quotes. This option is enabled by default.
<DT><B>failglob</B>
@@ -13930,7 +13981,7 @@ If set,
<B>bash</B>
encloses the translated results of
<B>$dq</B>...<B>dq</B>
<B>$ ... </B>
quoting in single quotes instead of double quotes.
If the string is not translated, this has no effect.
@@ -14909,7 +14960,7 @@ and it is required for bash-5.1 and later versions.
<DL COMPACT><DT><DD>
<DL COMPACT>
<DT>*<DD>
quoting the rhs of the <B>[[</B> command's regexp matching operator (=ti)
quoting the rhs of the <B>[[</B> command's regexp matching operator (=~)
has no special effect
</DL></DL>
@@ -14982,7 +15033,7 @@ are not special within double-quoted word expansions
<DT>*<DD>
the shell does not print a warning message if an attempt is made to
use a quoted compound assignment as an argument to declare
(e.g., declare -a foo=aq(1 2)aq). Later versions warn that this usage is
(e.g., declare -a foo='(1 2)'). Later versions warn that this usage is
deprecated
<DT>*<DD>
word expansion errors are considered non-fatal errors that cause the
@@ -15246,7 +15297,7 @@ script.
<DT><I>The Gnu History Library</I>, Brian Fox and Chet Ramey<DD>
<DT><I>Portable Operating System Interface (POSIX) Part 2: Shell and Utilities</I>, IEEE -<DD>
<A HREF="http://pubs.opengroup.org/onlinepubs/9699919799/">http://pubs.opengroup.org/onlinepubs/9699919799/</A>
<DT><A HREF="http://tiswww.case.edu/tichet/bash/POSIX">http://tiswww.case.edu/tichet/bash/POSIX</A> - a description of posix mode<DD>
<DT><A HREF="http://tiswww.case.edu/~chet/bash/POSIX">http://tiswww.case.edu/~chet/bash/POSIX</A> - a description of posix mode<DD>
<DT><I>sh</I>(1), <I>ksh</I>(1), <I>csh</I>(1)<DD>
<DT><I>emacs</I>(1), <I>vi</I>(1)<DD>
<DT><I>readline</I>(3)<DD>
@@ -15268,28 +15319,28 @@ The <B>bash</B> executable
<DD>
The systemwide initialization file, executed for login shells
<DT>
<I>ti/.bash_profile</I>
<A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>
<DD>
The personal initialization file, executed for login shells
<DT>
<I>ti/.bashrc</I>
<A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
<DD>
The individual per-interactive-shell startup file
<DT>
<I>ti/.bash_logout</I>
<A HREF="file:~/.bash_logout"><I>~/.bash_logout</I></A>
<DD>
The individual login shell cleanup file, executed when a login shell exits
<DT>
<I>ti/.bash_history</I>
<A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>
<DD>
The default value of <B>HISTFILE</B>, the file in which bash saves the
command history
<DT>
<I>ti/.inputrc</I>
<A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>
<DD>
Individual <I>readline</I> initialization file
@@ -15515,7 +15566,7 @@ There may be only one active coprocess at a time.
<DT><A HREF="#lbDI">BUGS</A><DD>
</DL>
<HR>
This document was created by man2html from /usr/local/src/bash/bash-20240205/doc/bash.1.<BR>
Time: 07 February 2024 09:26:02 EST
This document was created by man2html from /usr/local/src/bash/bash-20240209/doc/bash.1.<BR>
Time: 13 February 2024 10:19:05 EST
</BODY>
</HTML>
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+27 -52
View File
@@ -1,12 +1,12 @@
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/MacPorts 2023.66589_3) (preloaded format=pdfetex 2024.1.2) 7 FEB 2024 09:25
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/MacPorts 2023.66589_3) (preloaded format=etex 2024.1.2) 9 FEB 2024 10:34
entering extended mode
restricted \write18 enabled.
file:line:error style messages enabled.
%&-line parsing enabled.
**\input /usr/local/src/bash/bash-20240205/doc/bashref.texi \input /usr/local/s
rc/bash/bash-20240205/doc/bashref.texi
(/usr/local/src/bash/bash-20240205/doc/bashref.texi
(/usr/local/src/bash/bash-20240205/doc/texinfo.tex
**\nonstopmode \input /usr/local/src/bash/bash-20240209/doc/bashref.texi \input
/usr/local/src/bash/bash-20240209/doc/bashref.texi
(/usr/local/src/bash/bash-20240209/doc/bashref.texi
(/usr/local/src/bash/bash-20240209/doc/texinfo.tex
Loading texinfo [version 2015-11-22.14]:
\outerhsize=\dimen16
\outervsize=\dimen17
@@ -162,23 +162,20 @@ This is `epsf.tex' v2.7.4 <14 February 2011>
texinfo.tex: doing @include of version.texi
(/usr/local/src/bash/bash-20240205/doc/version.texi) [1{/opt/local/var/db/texmf
/fonts/map/pdftex/updmap/pdftex.map}] [2]
(/usr/local/build/bash/bash-20240205/doc/bashref.toc [-1] [-2] [-3]) [-4]
(/usr/local/build/bash/bash-20240205/doc/bashref.toc)
(/usr/local/build/bash/bash-20240205/doc/bashref.toc) Chapter 1
(/usr/local/src/bash/bash-20240209/doc/version.texi) [1] [2]
(/usr/local/build/bash/bash-20240209/doc/bashref.toc [-1] [-2] [-3]) [-4]
Chapter 1
\openout0 = `bashref.toc'.
(/usr/local/build/bash/bash-20240205/doc/bashref.aux)
(/usr/local/build/bash/bash-20240209/doc/bashref.aux)
\openout1 = `bashref.aux'.
Chapter 2 [1] [2]
Chapter 2
[1] [2]
@cpindfile=@write2
\openout2 = `bashref.cp'.
[3] Chapter 3 [4] [5] [6] [7]
[3] Chapter 3 [4] [5] [6] [7]
@vrindfile=@write3
\openout3 = `bashref.vr'.
@@ -221,16 +218,15 @@ Overfull \hbox (5.95723pt too wide) in paragraph at lines 724--725
@rwindfile=@write4
\openout4 = `bashref.rw'.
[9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19{/opt/local/share/texmf-tex
live/fonts/enc/dvips/cm-super/cm-super-t1.enc}] [20] [21] [22] [23] [24]
[25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39]
[40] [41] [42] [43] [44] [45] [46] [47] Chapter 4 [48]
[9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23]
[24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38]
[39] [40] [41] [42] [43] [44] [45] [46] [47] Chapter 4 [48]
@btindfile=@write5
\openout5 = `bashref.bt'.
[49] [50] [51] [52]
[53] [54] [55] [56] [57] [58] [59] [60] [61] [62] [63] [64] [65] [66] [67]
[68]
[49] [50] [51]
[52] [53] [54] [55] [56] [57] [58] [59] [60] [61] [62] [63] [64] [65] [66]
[67] [68]
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5435--5435
[]@texttt set [-abefhkmnptuvxBCEHPT] [-o @textttsl option-name@texttt ] [--] [
-] [@textttsl ar-gu-ment []@texttt ][]
@@ -263,7 +259,7 @@ Overfull \hbox (38.26585pt too wide) in paragraph at lines 5436--5436
[119] [120]
texinfo.tex: doing @include of rluser.texi
(/usr/local/src/bash/bash-20240205/lib/readline/doc/rluser.texi
(/usr/local/src/bash/bash-20240209/lib/readline/doc/rluser.texi
Chapter 8 [121] [122] [123] [124] [125] [126] [127] [128] [129] [130] [131]
[132]
Underfull \hbox (badness 7540) in paragraph at lines 882--888
@@ -313,7 +309,7 @@ gnored[]
texinfo.tex: doing @include of hsuser.texi
(/usr/local/src/bash/bash-20240205/lib/readline/doc/hsuser.texi Chapter 9
(/usr/local/src/bash/bash-20240209/lib/readline/doc/hsuser.texi Chapter 9
[158] [159] [160] [161] [162] [163]) Chapter 10 [164] [165] [166] [167]
[168]
Underfull \hbox (badness 10000) in paragraph at lines 9801--9810
@@ -345,37 +341,16 @@ extrm '[], `@texttt strict-posix-default[]@textrm '[], and
[178] [179] Appendix C [180]
texinfo.tex: doing @include of fdl.texi
(/usr/local/src/bash/bash-20240205/doc/fdl.texi
(/usr/local/src/bash/bash-20240209/doc/fdl.texi
[181] [182] [183] [184] [185] [186] [187]) Appendix D [188] [189] [190]
[191] [192] [193] [194] [195] [196] [197] )
Here is how much of TeX's memory you used:
4105 strings out of 495840
47629 string characters out of 6171739
143202 words of memory out of 5000000
5048 multiletter control sequences out of 15000+600000
3531 strings out of 495850
40273 string characters out of 6172145
89057 words of memory out of 5000000
4879 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,389b,983s stack positions out of 10000i,1000n,20000p,200000b,200000s
</opt/local/share/texmf-texlive/font
s/type1/public/amsfonts/cm/cmbx12.pfb></opt/local/share/texmf-texlive/fonts/typ
e1/public/amsfonts/cm/cmcsc10.pfb></opt/local/share/texmf-texlive/fonts/type1/p
ublic/amsfonts/cm/cmmi10.pfb></opt/local/share/texmf-texlive/fonts/type1/public
/amsfonts/cm/cmmi12.pfb></opt/local/share/texmf-texlive/fonts/type1/public/amsf
onts/cm/cmmi9.pfb></opt/local/share/texmf-texlive/fonts/type1/public/amsfonts/c
m/cmr10.pfb></opt/local/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmr9
.pfb></opt/local/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmsl10.pfb>
</opt/local/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmsltt10.pfb></o
pt/local/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmsy10.pfb></opt/lo
cal/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmti10.pfb></opt/local/s
hare/texmf-texlive/fonts/type1/public/amsfonts/cm/cmtt10.pfb></opt/local/share/
texmf-texlive/fonts/type1/public/amsfonts/cm/cmtt12.pfb></opt/local/share/texmf
-texlive/fonts/type1/public/amsfonts/cm/cmtt9.pfb></opt/local/share/texmf-texli
ve/fonts/type1/public/cm-super/sfrm1095.pfb></opt/local/share/texmf-texlive/fon
ts/type1/public/cm-super/sfrm1440.pfb>
Output written on bashref.pdf (203 pages, 816864 bytes).
PDF statistics:
2830 PDF objects out of 2984 (max. 8388607)
2580 compressed objects within 26 object streams
331 named destinations out of 1000 (max. 500000)
1157 words of extra memory for PDF output out of 10000 (max. 10000000)
16i,6n,16p,402b,942s stack positions out of 10000i,1000n,20000p,200000b,200000s
Output written on bashref.dvi (203 pages, 851140 bytes).
+3760 -3678
View File
File diff suppressed because it is too large Load Diff
+290 -290
View File
@@ -78,11 +78,11 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
variable. Each non-option argument is a command as it would ap-
pear in a rreeaaddlliinnee initialization file such as _._i_n_p_u_t_r_c, but
each binding or command must be passed as a separate argument;
e.g., '"\C-x\C-r": re-read-init-file'. In the following de-
scriptions, output available to be re-read is formatted as com-
mands that would appear in a rreeaaddlliinnee initialization file or
that would be supplied as individual arguments to a bbiinndd com-
mand. Options, if supplied, have the following meanings:
e.g., \C-x\C-r: re-read-init-file. In the following descrip-
tions, output available to be re-read is formatted as commands
that would appear in a rreeaaddlliinnee initialization file or that
would be supplied as individual arguments to a bbiinndd command.
Options, if supplied, have the following meanings:
--mm _k_e_y_m_a_p
Use _k_e_y_m_a_p as the keymap to be affected by the subsequent
bindings. Acceptable _k_e_y_m_a_p names are _e_m_a_c_s_, _e_m_a_c_s_-_s_t_a_n_-
@@ -960,7 +960,7 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
corresponding _a_r_g_u_m_e_n_t in the same way as eecchhoo --ee.
%%qq causes pprriinnttff to output the corresponding _a_r_g_u_m_e_n_t in a
format that can be reused as shell input. %%qq and %%QQ use
the $$'''' quoting style if any characters in the argument
the $$ quoting style if any characters in the argument
string require it, and backslash quoting otherwise. If
the format string uses the _p_r_i_n_t_f alternate form, these
two formats quote the argument string using single
@@ -1536,40 +1536,40 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
in _b_a_s_h(1) under PPaatthhnnaammee EExxppaannssiioonn are enabled.
eexxttqquuoottee
If set, $$'_s_t_r_i_n_g' and $$"_s_t_r_i_n_g" quoting is performed
within $${{_p_a_r_a_m_e_t_e_r}} expansions enclosed in double
quotes. This option is enabled by default.
If set, $$_s_t_r_i_n_g and $$_s_t_r_i_n_g quoting is performed within
$${{_p_a_r_a_m_e_t_e_r}} expansions enclosed in double quotes. This
option is enabled by default.
ffaaiillgglloobb
If set, patterns which fail to match filenames during
If set, patterns which fail to match filenames during
pathname expansion result in an expansion error.
ffoorrccee__ffiiggnnoorree
If set, the suffixes specified by the FFIIGGNNOORREE shell
variable cause words to be ignored when performing word
If set, the suffixes specified by the FFIIGGNNOORREE shell
variable cause words to be ignored when performing word
completion even if the ignored words are the only possi-
ble completions. See SSHHEELLLL VVAARRIIAABBLLEESS in _b_a_s_h(1) for a
description of FFIIGGNNOORREE. This option is enabled by de-
ble completions. See SSHHEELLLL VVAARRIIAABBLLEESS in _b_a_s_h(1) for a
description of FFIIGGNNOORREE. This option is enabled by de-
fault.
gglloobbaasscciiiirraannggeess
If set, range expressions used in pattern matching
bracket expressions (see PPaatttteerrnn MMaattcchhiinngg in _b_a_s_h(1))
If set, range expressions used in pattern matching
bracket expressions (see PPaatttteerrnn MMaattcchhiinngg in _b_a_s_h(1))
behave as if in the traditional C locale when performing
comparisons. That is, the current locale's collating
sequence is not taken into account, so bb will not col-
late between AA and BB, and upper-case and lower-case
comparisons. That is, the current locale's collating
sequence is not taken into account, so bb will not col-
late between AA and BB, and upper-case and lower-case
ASCII characters will collate together.
gglloobbsskkiippddoottss
If set, pathname expansion will never match the file-
names and even if the pattern begins with a This option
If set, pathname expansion will never match the file-
names and even if the pattern begins with a This option
is enabled by default.
gglloobbssttaarr
If set, the pattern **** used in a pathname expansion con-
text will match all files and zero or more directories
and subdirectories. If the pattern is followed by a //,
text will match all files and zero or more directories
and subdirectories. If the pattern is followed by a //,
only directories and subdirectories match.
ggnnuu__eerrrrffmmtt
@@ -1577,25 +1577,25 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
GNU error message format.
hhiissttaappppeenndd
If set, the history list is appended to the file named
If set, the history list is appended to the file named
by the value of the HHIISSTTFFIILLEE variable when the shell ex-
its, rather than overwriting the file.
hhiissttrreeeeddiitt
If set, and rreeaaddlliinnee is being used, a user is given the
If set, and rreeaaddlliinnee is being used, a user is given the
opportunity to re-edit a failed history substitution.
hhiissttvveerriiffyy
If set, and rreeaaddlliinnee is being used, the results of his-
tory substitution are not immediately passed to the
shell parser. Instead, the resulting line is loaded
If set, and rreeaaddlliinnee is being used, the results of his-
tory substitution are not immediately passed to the
shell parser. Instead, the resulting line is loaded
into the rreeaaddlliinnee editing buffer, allowing further modi-
fication.
hhoossttccoommpplleettee
If set, and rreeaaddlliinnee is being used, bbaasshh will attempt to
perform hostname completion when a word containing a @@
is being completed (see CCoommpplleettiinngg under RREEAADDLLIINNEE in
perform hostname completion when a word containing a @@
is being completed (see CCoommpplleettiinngg under RREEAADDLLIINNEE in
_b_a_s_h(1)). This is enabled by default.
hhuuppoonneexxiitt
@@ -1603,23 +1603,23 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
active login shell exits.
iinnhheerriitt__eerrrreexxiitt
If set, command substitution inherits the value of the
eerrrreexxiitt option, instead of unsetting it in the subshell
environment. This option is enabled when _p_o_s_i_x _m_o_d_e is
If set, command substitution inherits the value of the
eerrrreexxiitt option, instead of unsetting it in the subshell
environment. This option is enabled when _p_o_s_i_x _m_o_d_e is
enabled.
iinntteerraaccttiivvee__ccoommmmeennttss
If set, allow a word beginning with ## to cause that word
and all remaining characters on that line to be ignored
and all remaining characters on that line to be ignored
in an interactive shell (see CCOOMMMMEENNTTSS in _b_a_s_h(1)). This
option is enabled by default.
llaassttppiippee
If set, and job control is not active, the shell runs
If set, and job control is not active, the shell runs
the last command of a pipeline not executed in the back-
ground in the current shell environment.
lliitthhiisstt If set, and the ccmmddhhiisstt option is enabled, multi-line
lliitthhiisstt If set, and the ccmmddhhiisstt option is enabled, multi-line
commands are saved to the history with embedded newlines
rather than using semicolon separators where possible.
@@ -1630,125 +1630,125 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
tribute is not inherited.
llooccaallvvaarr__uunnsseett
If set, calling uunnsseett on local variables in previous
function scopes marks them so subsequent lookups find
them unset until that function returns. This is identi-
cal to the behavior of unsetting local variables at the
If set, calling uunnsseett on local variables in previous
function scopes marks them so subsequent lookups find
them unset until that function returns. This is identi-
cal to the behavior of unsetting local variables at the
current function scope.
llooggiinn__sshheellll
The shell sets this option if it is started as a login
The shell sets this option if it is started as a login
shell (see IINNVVOOCCAATTIIOONN in _b_a_s_h(1)). The value may not be
changed.
mmaaiillwwaarrnn
If set, and a file that bbaasshh is checking for mail has
been accessed since the last time it was checked, bbaasshh
If set, and a file that bbaasshh is checking for mail has
been accessed since the last time it was checked, bbaasshh
displays the message
nnoo__eemmppttyy__ccmmdd__ccoommpplleettiioonn
If set, and rreeaaddlliinnee is being used, bbaasshh will not at-
tempt to search the PPAATTHH for possible completions when
If set, and rreeaaddlliinnee is being used, bbaasshh will not at-
tempt to search the PPAATTHH for possible completions when
completion is attempted on an empty line.
nnooccaasseegglloobb
If set, bbaasshh matches filenames in a case-insensitive
If set, bbaasshh matches filenames in a case-insensitive
fashion when performing pathname expansion (see PPaatthhnnaammee
EExxppaannssiioonn in _b_a_s_h(1)).
nnooccaasseemmaattcchh
If set, bbaasshh matches patterns in a case-insensitive
If set, bbaasshh matches patterns in a case-insensitive
fashion when performing matching while executing ccaassee or
[[[[ conditional commands, when performing pattern substi-
tution word expansions, or when filtering possible com-
tution word expansions, or when filtering possible com-
pletions as part of programmable completion.
nnooeexxppaanndd__ttrraannssllaattiioonn
If set, bbaasshh encloses the translated results of $$""...""
quoting in single quotes instead of double quotes. If
If set, bbaasshh encloses the translated results of $$...
quoting in single quotes instead of double quotes. If
the string is not translated, this has no effect.
nnuullllgglloobb
If set, pathname expansion patterns which match no files
(see PPaatthhnnaammee EExxppaannssiioonn in _b_a_s_h(1)) expand to nothing
(see PPaatthhnnaammee EExxppaannssiioonn in _b_a_s_h(1)) expand to nothing
and are removed, rather than expanding to themselves.
ppaattssuubb__rreeppllaacceemmeenntt
If set, bbaasshh expands occurrences of && in the replacement
string of pattern substitution to the text matched by
the pattern, as described under PPaarraammeetteerr EExxppaannssiioonn in
string of pattern substitution to the text matched by
the pattern, as described under PPaarraammeetteerr EExxppaannssiioonn in
_b_a_s_h(1). This option is enabled by default.
pprrooggccoommpp
If set, the programmable completion facilities (see PPrroo--
ggrraammmmaabbllee CCoommpplleettiioonn in _b_a_s_h(1)) are enabled. This op-
ggrraammmmaabbllee CCoommpplleettiioonn in _b_a_s_h(1)) are enabled. This op-
tion is enabled by default.
pprrooggccoommpp__aalliiaass
If set, and programmable completion is enabled, bbaasshh
treats a command name that doesn't have any completions
as a possible alias and attempts alias expansion. If it
has an alias, bbaasshh attempts programmable completion us-
If set, and programmable completion is enabled, bbaasshh
treats a command name that doesn't have any completions
as a possible alias and attempts alias expansion. If it
has an alias, bbaasshh attempts programmable completion us-
ing the command word resulting from the expanded alias.
pprroommppttvvaarrss
If set, prompt strings undergo parameter expansion, com-
mand substitution, arithmetic expansion, and quote re-
moval after being expanded as described in PPRROOMMPPTTIINNGG in
mand substitution, arithmetic expansion, and quote re-
moval after being expanded as described in PPRROOMMPPTTIINNGG in
_b_a_s_h(1). This option is enabled by default.
rreessttrriicctteedd__sshheellll
The shell sets this option if it is started in re-
stricted mode (see RREESSTTRRIICCTTEEDD SSHHEELLLL in _b_a_s_h(1)). The
value may not be changed. This is not reset when the
startup files are executed, allowing the startup files
The shell sets this option if it is started in re-
stricted mode (see RREESSTTRRIICCTTEEDD SSHHEELLLL in _b_a_s_h(1)). The
value may not be changed. This is not reset when the
startup files are executed, allowing the startup files
to discover whether or not a shell is restricted.
sshhiifftt__vveerrbboossee
If set, the sshhiifftt builtin prints an error message when
If set, the sshhiifftt builtin prints an error message when
the shift count exceeds the number of positional parame-
ters.
ssoouurrcceeppaatthh
If set, the .. (ssoouurrccee) builtin uses the value of PPAATTHH to
find the directory containing the file supplied as an
find the directory containing the file supplied as an
argument. This option is enabled by default.
vvaarrrreeddiirr__cclloossee
If set, the shell automatically closes file descriptors
assigned using the _{_v_a_r_n_a_m_e_} redirection syntax (see
RREEDDIIRREECCTTIIOONN in _b_a_s_h(1)) instead of leaving them open
If set, the shell automatically closes file descriptors
assigned using the _{_v_a_r_n_a_m_e_} redirection syntax (see
RREEDDIIRREECCTTIIOONN in _b_a_s_h(1)) instead of leaving them open
when the command completes.
xxppgg__eecchhoo
If set, the eecchhoo builtin expands backslash-escape se-
quences by default. If the ppoossiixx shell option is also
If set, the eecchhoo builtin expands backslash-escape se-
quences by default. If the ppoossiixx shell option is also
enabled, eecchhoo does not interpret any options.
ssuussppeenndd [--ff]
Suspend the execution of this shell until it receives a SSIIGGCCOONNTT
signal. A login shell, or a shell without job control enabled,
cannot be suspended; the --ff option can be used to override this
and force the suspension. The return status is 0 unless the
shell is a login shell or job control is not enabled and --ff is
Suspend the execution of this shell until it receives a SSIIGGCCOONNTT
signal. A login shell, or a shell without job control enabled,
cannot be suspended; the --ff option can be used to override this
and force the suspension. The return status is 0 unless the
shell is a login shell or job control is not enabled and --ff is
not supplied.
tteesstt _e_x_p_r
[[ _e_x_p_r ]]
Return a status of 0 (true) or 1 (false) depending on the evalu-
ation of the conditional expression _e_x_p_r. Each operator and
operand must be a separate argument. Expressions are composed
of the primaries described in _b_a_s_h(1) under CCOONNDDIITTIIOONNAALL EEXXPPRREESS--
ation of the conditional expression _e_x_p_r. Each operator and
operand must be a separate argument. Expressions are composed
of the primaries described in _b_a_s_h(1) under CCOONNDDIITTIIOONNAALL EEXXPPRREESS--
SSIIOONNSS. tteesstt does not accept any options, nor does it accept and
ignore an argument of ---- as signifying the end of options.
Expressions may be combined using the following operators,
listed in decreasing order of precedence. The evaluation de-
pends on the number of arguments; see below. Operator prece-
Expressions may be combined using the following operators,
listed in decreasing order of precedence. The evaluation de-
pends on the number of arguments; see below. Operator prece-
dence is used when there are five or more arguments.
!! _e_x_p_r True if _e_x_p_r is false.
(( _e_x_p_r ))
Returns the value of _e_x_p_r. This may be used to override
Returns the value of _e_x_p_r. This may be used to override
the normal precedence of operators.
_e_x_p_r_1 -aa _e_x_p_r_2
True if both _e_x_p_r_1 and _e_x_p_r_2 are true.
@@ -1765,161 +1765,161 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
null.
2 arguments
If the first argument is !!, the expression is true if and
only if the second argument is null. If the first argu-
ment is one of the unary conditional operators listed in
_b_a_s_h(1) under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS, the expression is
only if the second argument is null. If the first argu-
ment is one of the unary conditional operators listed in
_b_a_s_h(1) under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS, the expression is
true if the unary test is true. If the first argument is
not a valid unary conditional operator, the expression is
false.
3 arguments
The following conditions are applied in the order listed.
If the second argument is one of the binary conditional
operators listed in _b_a_s_h(1) under CCOONNDDIITTIIOONNAALL EEXXPPRREESS--
SSIIOONNSS, the result of the expression is the result of the
binary test using the first and third arguments as
operands. The --aa and --oo operators are considered binary
operators when there are three arguments. If the first
If the second argument is one of the binary conditional
operators listed in _b_a_s_h(1) under CCOONNDDIITTIIOONNAALL EEXXPPRREESS--
SSIIOONNSS, the result of the expression is the result of the
binary test using the first and third arguments as
operands. The --aa and --oo operators are considered binary
operators when there are three arguments. If the first
argument is !!, the value is the negation of the two-argu-
ment test using the second and third arguments. If the
ment test using the second and third arguments. If the
first argument is exactly (( and the third argument is ex-
actly )), the result is the one-argument test of the sec-
actly )), the result is the one-argument test of the sec-
ond argument. Otherwise, the expression is false.
4 arguments
The following conditions are applied in the order listed.
If the first argument is !!, the result is the negation of
the three-argument expression composed of the remaining
arguments. the two-argument test using the second and
third arguments. If the first argument is exactly (( and
the fourth argument is exactly )), the result is the two-
argument test of the second and third arguments. Other-
the three-argument expression composed of the remaining
arguments. the two-argument test using the second and
third arguments. If the first argument is exactly (( and
the fourth argument is exactly )), the result is the two-
argument test of the second and third arguments. Other-
wise, the expression is parsed and evaluated according to
precedence using the rules listed above.
5 or more arguments
The expression is parsed and evaluated according to
The expression is parsed and evaluated according to
precedence using the rules listed above.
When the shell is in _p_o_s_i_x _m_o_d_e, or if the expression is part of
the [[[[ command, the << and >> operators sort using the current lo-
cale. If the shell is not in _p_o_s_i_x _m_o_d_e, the tteesstt and [[ com-
cale. If the shell is not in _p_o_s_i_x _m_o_d_e, the tteesstt and [[ com-
mands sort lexicographically using ASCII ordering.
ttiimmeess Print the accumulated user and system times for the shell and
ttiimmeess Print the accumulated user and system times for the shell and
for processes run from the shell. The return status is 0.
ttrraapp [--llpp] [[_a_c_t_i_o_n] _s_i_g_s_p_e_c ...]
The _a_c_t_i_o_n is a command that is read and executed when the shell
receives signal(s) _s_i_g_s_p_e_c. If _a_c_t_i_o_n is absent (and there is a
single _s_i_g_s_p_e_c) or --, each specified signal is reset to its
original disposition (the value it had upon entrance to the
shell). If _a_c_t_i_o_n is the null string the signal specified by
each _s_i_g_s_p_e_c is ignored by the shell and by the commands it in-
single _s_i_g_s_p_e_c) or --, each specified signal is reset to its
original disposition (the value it had upon entrance to the
shell). If _a_c_t_i_o_n is the null string the signal specified by
each _s_i_g_s_p_e_c is ignored by the shell and by the commands it in-
vokes.
If no arguments are supplied, ttrraapp displays the actions associ-
If no arguments are supplied, ttrraapp displays the actions associ-
ated with each trapped signal as a set of ttrraapp commands that can
be reused as shell input to restore the current signal disposi-
tions. If --pp is given, and _a_c_t_i_o_n is not present, then ttrraapp
displays the actions associated with each _s_i_g_s_p_e_c or, if none
be reused as shell input to restore the current signal disposi-
tions. If --pp is given, and _a_c_t_i_o_n is not present, then ttrraapp
displays the actions associated with each _s_i_g_s_p_e_c or, if none
are supplied, for all trapped signals, as a set of ttrraapp commands
that can be reused as shell input to restore the current signal
dispositions. The --PP option behaves similarly, but displays
only the actions associated with each _s_i_g_s_p_e_c argument. --PP re-
quires at least one _s_i_g_s_p_e_c argument. The --PP or --pp options to
ttrraapp may be used in a subshell environment (e.g., command sub-
stitution) and, as long as they are used before ttrraapp is used to
change a signal's handling, will display the state of its par-
that can be reused as shell input to restore the current signal
dispositions. The --PP option behaves similarly, but displays
only the actions associated with each _s_i_g_s_p_e_c argument. --PP re-
quires at least one _s_i_g_s_p_e_c argument. The --PP or --pp options to
ttrraapp may be used in a subshell environment (e.g., command sub-
stitution) and, as long as they are used before ttrraapp is used to
change a signal's handling, will display the state of its par-
ent's traps.
The --ll option causes ttrraapp to print a list of signal names and
their corresponding numbers. Each _s_i_g_s_p_e_c is either a signal
name defined in <_s_i_g_n_a_l_._h>, or a signal number. Signal names
The --ll option causes ttrraapp to print a list of signal names and
their corresponding numbers. Each _s_i_g_s_p_e_c is either a signal
name defined in <_s_i_g_n_a_l_._h>, or a signal number. Signal names
are case insensitive and the SSIIGG prefix is optional.
If a _s_i_g_s_p_e_c is EEXXIITT (0) the command _a_c_t_i_o_n is executed on exit
from the shell. If a _s_i_g_s_p_e_c is DDEEBBUUGG, the command _a_c_t_i_o_n is
If a _s_i_g_s_p_e_c is EEXXIITT (0) the command _a_c_t_i_o_n is executed on exit
from the shell. If a _s_i_g_s_p_e_c is DDEEBBUUGG, the command _a_c_t_i_o_n is
executed before every _s_i_m_p_l_e _c_o_m_m_a_n_d, _f_o_r command, _c_a_s_e command,
_s_e_l_e_c_t command, (( arithmetic command, [[ conditional command,
_s_e_l_e_c_t command, (( arithmetic command, [[ conditional command,
arithmetic _f_o_r command, and before the first command executes in
a shell function (see SSHHEELLLL GGRRAAMMMMAARR in _b_a_s_h(1)). Refer to the
description of the eexxttddeebbuugg option to the sshhoopptt builtin for de-
tails of its effect on the DDEEBBUUGG trap. If a _s_i_g_s_p_e_c is RREETTUURRNN,
the command _a_c_t_i_o_n is executed each time a shell function or a
script executed with the .. or ssoouurrccee builtins finishes execut-
a shell function (see SSHHEELLLL GGRRAAMMMMAARR in _b_a_s_h(1)). Refer to the
description of the eexxttddeebbuugg option to the sshhoopptt builtin for de-
tails of its effect on the DDEEBBUUGG trap. If a _s_i_g_s_p_e_c is RREETTUURRNN,
the command _a_c_t_i_o_n is executed each time a shell function or a
script executed with the .. or ssoouurrccee builtins finishes execut-
ing.
If a _s_i_g_s_p_e_c is EERRRR, the command _a_c_t_i_o_n is executed whenever a
If a _s_i_g_s_p_e_c is EERRRR, the command _a_c_t_i_o_n is executed whenever a
pipeline (which may consist of a single simple command), a list,
or a compound command returns a non-zero exit status, subject to
the following conditions. The EERRRR trap is not executed if the
the following conditions. The EERRRR trap is not executed if the
failed command is part of the command list immediately following
a wwhhiillee or uunnttiill keyword, part of the test in an _i_f statement,
a wwhhiillee or uunnttiill keyword, part of the test in an _i_f statement,
part of a command executed in a &&&& or |||| list except the command
following the final &&&& or ||||, any command in a pipeline but the
last, or if the command's return value is being inverted using
following the final &&&& or ||||, any command in a pipeline but the
last, or if the command's return value is being inverted using
!!. These are the same conditions obeyed by the eerrrreexxiitt (--ee) op-
tion.
When the shell is not interactive, signals ignored upon entry to
the shell cannot be trapped or reset. Interactive shells permit
trapping signals ignored on entry. Trapped signals that are not
being ignored are reset to their original values in a subshell
or subshell environment when one is created. The return status
being ignored are reset to their original values in a subshell
or subshell environment when one is created. The return status
is false if any _s_i_g_s_p_e_c is invalid; otherwise ttrraapp returns true.
ttrruuee Does nothing, returns a 0 status.
ttyyppee [--aaffttppPP] _n_a_m_e [_n_a_m_e ...]
With no options, indicate how each _n_a_m_e would be interpreted if
With no options, indicate how each _n_a_m_e would be interpreted if
used as a command name. If the --tt option is used, ttyyppee prints a
string which is one of _a_l_i_a_s, _k_e_y_w_o_r_d, _f_u_n_c_t_i_o_n, _b_u_i_l_t_i_n, or
_f_i_l_e if _n_a_m_e is an alias, shell reserved word, function,
builtin, or executable disk file, respectively. If the _n_a_m_e is
not found, then nothing is printed, and ttyyppee returns a non-zero
exit status. If the --pp option is used, ttyyppee either returns the
name of the executable file that would be found by searching
$$PPAATTHH if _n_a_m_e were specified as a command name, or nothing if
would not return _f_i_l_e. The --PP option forces a PPAATTHH search for
each _n_a_m_e, even if would not return _f_i_l_e. If a command is
string which is one of _a_l_i_a_s, _k_e_y_w_o_r_d, _f_u_n_c_t_i_o_n, _b_u_i_l_t_i_n, or
_f_i_l_e if _n_a_m_e is an alias, shell reserved word, function,
builtin, or executable disk file, respectively. If the _n_a_m_e is
not found, then nothing is printed, and ttyyppee returns a non-zero
exit status. If the --pp option is used, ttyyppee either returns the
name of the executable file that would be found by searching
$$PPAATTHH if _n_a_m_e were specified as a command name, or nothing if
would not return _f_i_l_e. The --PP option forces a PPAATTHH search for
each _n_a_m_e, even if would not return _f_i_l_e. If a command is
hashed, --pp and --PP print the hashed value, which is not necessar-
ily the file that appears first in PPAATTHH. If the --aa option is
ily the file that appears first in PPAATTHH. If the --aa option is
used, ttyyppee prints all of the places that contain a command named
_n_a_m_e. This includes aliases, reserved words, functions, and
builtins, but the path search options (--pp and --PP) can be sup-
_n_a_m_e. This includes aliases, reserved words, functions, and
builtins, but the path search options (--pp and --PP) can be sup-
plied to restrict the output to executable files. ttyyppee does not
consult the table of hashed commands when using --aa with --pp, and
only performs a PPAATTHH search for _n_a_m_e. The --ff option suppresses
shell function lookup, as with the ccoommmmaanndd builtin. ttyyppee re-
turns true if all of the arguments are found, false if any are
consult the table of hashed commands when using --aa with --pp, and
only performs a PPAATTHH search for _n_a_m_e. The --ff option suppresses
shell function lookup, as with the ccoommmmaanndd builtin. ttyyppee re-
turns true if all of the arguments are found, false if any are
not found.
uulliimmiitt [--HHSS] --aa
uulliimmiitt [--HHSS] [--bbccddeeffiikkllmmnnppqqrrssttuuvvxxPPRRTT [_l_i_m_i_t]]
Provides control over the resources available to the shell and
to processes started by it, on systems that allow such control.
Provides control over the resources available to the shell and
to processes started by it, on systems that allow such control.
The --HH and --SS options specify that the hard or soft limit is set
for the given resource. A hard limit cannot be increased by a
non-root user once it is set; a soft limit may be increased up
to the value of the hard limit. If neither --HH nor --SS is speci-
for the given resource. A hard limit cannot be increased by a
non-root user once it is set; a soft limit may be increased up
to the value of the hard limit. If neither --HH nor --SS is speci-
fied, both the soft and hard limits are set. The value of _l_i_m_i_t
can be a number in the unit specified for the resource or one of
the special values hhaarrdd, ssoofftt, or uunnlliimmiitteedd, which stand for the
current hard limit, the current soft limit, and no limit, re-
spectively. If _l_i_m_i_t is omitted, the current value of the soft
current hard limit, the current soft limit, and no limit, re-
spectively. If _l_i_m_i_t is omitted, the current value of the soft
limit of the resource is printed, unless the --HH option is given.
When more than one resource is specified, the limit name and
unit, if appropriate, are printed before the value. Other op-
When more than one resource is specified, the limit name and
unit, if appropriate, are printed before the value. Other op-
tions are interpreted as follows:
--aa All current limits are reported; no limits are set
--bb The maximum socket buffer size
--cc The maximum size of core files created
--dd The maximum size of a process's data segment
--ee The maximum scheduling priority (
--ff The maximum size of files written by the shell and its
--ff The maximum size of files written by the shell and its
children
--ii The maximum number of pending signals
--kk The maximum number of kqueues that may be allocated
--ll The maximum size that may be locked into memory
--mm The maximum resident set size (many systems do not honor
--mm The maximum resident set size (many systems do not honor
this limit)
--nn The maximum number of open file descriptors (most systems
do not allow this value to be set)
@@ -1928,245 +1928,245 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
--rr The maximum real-time scheduling priority
--ss The maximum stack size
--tt The maximum amount of cpu time in seconds
--uu The maximum number of processes available to a single
--uu The maximum number of processes available to a single
user
--vv The maximum amount of virtual memory available to the
--vv The maximum amount of virtual memory available to the
shell and, on some systems, to its children
--xx The maximum number of file locks
--PP The maximum number of pseudoterminals
--RR The maximum time a real-time process can run before
--RR The maximum time a real-time process can run before
blocking, in microseconds
--TT The maximum number of threads
If _l_i_m_i_t is given, and the --aa option is not used, _l_i_m_i_t is the
new value of the specified resource. If no option is given,
then --ff is assumed. Values are in 1024-byte increments, except
for --tt, which is in seconds; --RR, which is in microseconds; --pp,
which is in units of 512-byte blocks; --PP, --TT, --bb, --kk, --nn, and
--uu, which are unscaled values; and, when in posix mode, --cc and
--ff, which are in 512-byte increments. The return status is 0
unless an invalid option or argument is supplied, or an error
If _l_i_m_i_t is given, and the --aa option is not used, _l_i_m_i_t is the
new value of the specified resource. If no option is given,
then --ff is assumed. Values are in 1024-byte increments, except
for --tt, which is in seconds; --RR, which is in microseconds; --pp,
which is in units of 512-byte blocks; --PP, --TT, --bb, --kk, --nn, and
--uu, which are unscaled values; and, when in posix mode, --cc and
--ff, which are in 512-byte increments. The return status is 0
unless an invalid option or argument is supplied, or an error
occurs while setting a new limit.
uummaasskk [--pp] [--SS] [_m_o_d_e]
The user file-creation mask is set to _m_o_d_e. If _m_o_d_e begins with
a digit, it is interpreted as an octal number; otherwise it is
interpreted as a symbolic mode mask similar to that accepted by
_c_h_m_o_d(1). If _m_o_d_e is omitted, the current value of the mask is
printed. The --SS option causes the mask to be printed in sym-
bolic form; the default output is an octal number. If the --pp
a digit, it is interpreted as an octal number; otherwise it is
interpreted as a symbolic mode mask similar to that accepted by
_c_h_m_o_d(1). If _m_o_d_e is omitted, the current value of the mask is
printed. The --SS option causes the mask to be printed in sym-
bolic form; the default output is an octal number. If the --pp
option is supplied, and _m_o_d_e is omitted, the output is in a form
that may be reused as input. The return status is 0 if the mode
was successfully changed or if no _m_o_d_e argument was supplied,
was successfully changed or if no _m_o_d_e argument was supplied,
and false otherwise.
uunnaalliiaass [-aa] [_n_a_m_e ...]
Remove each _n_a_m_e from the list of defined aliases. If --aa is
supplied, all alias definitions are removed. The return value
Remove each _n_a_m_e from the list of defined aliases. If --aa is
supplied, all alias definitions are removed. The return value
is true unless a supplied _n_a_m_e is not a defined alias.
uunnsseett [-ffvv] [-nn] [_n_a_m_e ...]
For each _n_a_m_e, remove the corresponding variable or function.
For each _n_a_m_e, remove the corresponding variable or function.
If the --vv option is given, each _n_a_m_e refers to a shell variable,
and that variable is removed. Read-only variables may not be
unset. If --ff is specified, each _n_a_m_e refers to a shell func-
tion, and the function definition is removed. If the --nn option
is supplied, and _n_a_m_e is a variable with the _n_a_m_e_r_e_f attribute,
_n_a_m_e will be unset rather than the variable it references. --nn
has no effect if the --ff option is supplied. If no options are
supplied, each _n_a_m_e refers to a variable; if there is no vari-
able by that name, a function with that name, if any, is unset.
Each unset variable or function is removed from the environment
passed to subsequent commands. If any of BBAASSHH__AALLIIAASSEESS,
and that variable is removed. Read-only variables may not be
unset. If --ff is specified, each _n_a_m_e refers to a shell func-
tion, and the function definition is removed. If the --nn option
is supplied, and _n_a_m_e is a variable with the _n_a_m_e_r_e_f attribute,
_n_a_m_e will be unset rather than the variable it references. --nn
has no effect if the --ff option is supplied. If no options are
supplied, each _n_a_m_e refers to a variable; if there is no vari-
able by that name, a function with that name, if any, is unset.
Each unset variable or function is removed from the environment
passed to subsequent commands. If any of BBAASSHH__AALLIIAASSEESS,
BBAASSHH__AARRGGVV00, BBAASSHH__CCMMDDSS, BBAASSHH__CCOOMMMMAANNDD, BBAASSHH__SSUUBBSSHHEELLLL, BBAASSHHPPIIDD,
CCOOMMPP__WWOORRDDBBRREEAAKKSS, DDIIRRSSTTAACCKK, EEPPOOCCHHRREEAALLTTIIMMEE, EEPPOOCCHHSSEECCOONNDDSS, FFUUNNCC--
NNAAMMEE, GGRROOUUPPSS, HHIISSTTCCMMDD, LLIINNEENNOO, RRAANNDDOOMM, SSEECCOONNDDSS, or SSRRAANNDDOOMM are
CCOOMMPP__WWOORRDDBBRREEAAKKSS, DDIIRRSSTTAACCKK, EEPPOOCCHHRREEAALLTTIIMMEE, EEPPOOCCHHSSEECCOONNDDSS, FFUUNNCC--
NNAAMMEE, GGRROOUUPPSS, HHIISSTTCCMMDD, LLIINNEENNOO, RRAANNDDOOMM, SSEECCOONNDDSS, or SSRRAANNDDOOMM are
unset, they lose their special properties, even if they are sub-
sequently reset. The exit status is true unless a _n_a_m_e is read-
only or may not be unset.
wwaaiitt [--ffnn] [--pp _v_a_r_n_a_m_e] [_i_d ...]
Wait for each specified child process and return its termination
status. Each _i_d may be a process ID or a job specification; if
a job spec is given, all processes in that job's pipeline are
waited for. If _i_d is not given, wwaaiitt waits for all running
background jobs and the last-executed process substitution, if
status. Each _i_d may be a process ID or a job specification; if
a job spec is given, all processes in that job's pipeline are
waited for. If _i_d is not given, wwaaiitt waits for all running
background jobs and the last-executed process substitution, if
its process id is the same as $$!!, and the return status is zero.
If the --nn option is supplied, wwaaiitt waits for a single job from
If the --nn option is supplied, wwaaiitt waits for a single job from
the list of _i_ds or, if no _i_ds are supplied, any job, to complete
and returns its exit status. If none of the supplied arguments
and returns its exit status. If none of the supplied arguments
is a child of the shell, or if no arguments are supplied and the
shell has no unwaited-for children, the exit status is 127. If
the --pp option is supplied, the process or job identifier of the
job for which the exit status is returned is assigned to the
variable _v_a_r_n_a_m_e named by the option argument. The variable
will be unset initially, before any assignment. This is useful
only when the --nn option is supplied. Supplying the --ff option,
when job control is enabled, forces wwaaiitt to wait for _i_d to ter-
shell has no unwaited-for children, the exit status is 127. If
the --pp option is supplied, the process or job identifier of the
job for which the exit status is returned is assigned to the
variable _v_a_r_n_a_m_e named by the option argument. The variable
will be unset initially, before any assignment. This is useful
only when the --nn option is supplied. Supplying the --ff option,
when job control is enabled, forces wwaaiitt to wait for _i_d to ter-
minate before returning its status, instead of returning when it
changes status. If _i_d specifies a non-existent process or job,
the return status is 127. If wwaaiitt is interrupted by a signal,
the return status will be greater than 128, as described under
SSIIGGNNAALLSS in _b_a_s_h(1). Otherwise, the return status is the exit
changes status. If _i_d specifies a non-existent process or job,
the return status is 127. If wwaaiitt is interrupted by a signal,
the return status will be greater than 128, as described under
SSIIGGNNAALLSS in _b_a_s_h(1). Otherwise, the return status is the exit
status of the last process or job waited for.
SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE
Bash-4.0 introduced the concept of a _s_h_e_l_l _c_o_m_p_a_t_i_b_i_l_i_t_y _l_e_v_e_l, speci-
Bash-4.0 introduced the concept of a _s_h_e_l_l _c_o_m_p_a_t_i_b_i_l_i_t_y _l_e_v_e_l, speci-
fied as a set of options to the shopt builtin (ccoommppaatt3311, ccoommppaatt3322, ccoomm--
ppaatt4400, ccoommppaatt4411, and so on). There is only one current compatibility
ppaatt4400, ccoommppaatt4411, and so on). There is only one current compatibility
level -- each option is mutually exclusive. The compatibility level is
intended to allow users to select behavior from previous versions that
is incompatible with newer versions while they migrate scripts to use
current features and behavior. It's intended to be a temporary solu-
intended to allow users to select behavior from previous versions that
is incompatible with newer versions while they migrate scripts to use
current features and behavior. It's intended to be a temporary solu-
tion.
This section does not mention behavior that is standard for a particu-
lar version (e.g., setting ccoommppaatt3322 means that quoting the rhs of the
regexp matching operator quotes special regexp characters in the word,
This section does not mention behavior that is standard for a particu-
lar version (e.g., setting ccoommppaatt3322 means that quoting the rhs of the
regexp matching operator quotes special regexp characters in the word,
which is default behavior in bash-3.2 and subsequent versions).
If a user enables, say, ccoommppaatt3322, it may affect the behavior of other
compatibility levels up to and including the current compatibility
level. The idea is that each compatibility level controls behavior
that changed in that version of bbaasshh, but that behavior may have been
present in earlier versions. For instance, the change to use locale-
based comparisons with the [[[[ command came in bash-4.1, and earlier
If a user enables, say, ccoommppaatt3322, it may affect the behavior of other
compatibility levels up to and including the current compatibility
level. The idea is that each compatibility level controls behavior
that changed in that version of bbaasshh, but that behavior may have been
present in earlier versions. For instance, the change to use locale-
based comparisons with the [[[[ command came in bash-4.1, and earlier
versions used ASCII-based comparisons, so enabling ccoommppaatt3322 will enable
ASCII-based comparisons as well. That granularity may not be suffi-
cient for all uses, and as a result users should employ compatibility
levels carefully. Read the documentation for a particular feature to
ASCII-based comparisons as well. That granularity may not be suffi-
cient for all uses, and as a result users should employ compatibility
levels carefully. Read the documentation for a particular feature to
find out the current behavior.
Bash-4.3 introduced a new shell variable: BBAASSHH__CCOOMMPPAATT. The value as-
Bash-4.3 introduced a new shell variable: BBAASSHH__CCOOMMPPAATT. The value as-
signed to this variable (a decimal version number like 4.2, or an inte-
ger corresponding to the ccoommppaatt_N_N option, like 42) determines the com-
ger corresponding to the ccoommppaatt_N_N option, like 42) determines the com-
patibility level.
Starting with bash-4.4, bbaasshh has begun deprecating older compatibility
levels. Eventually, the options will be removed in favor of BBAASSHH__CCOOMM--
Starting with bash-4.4, bbaasshh has begun deprecating older compatibility
levels. Eventually, the options will be removed in favor of BBAASSHH__CCOOMM--
PPAATT.
Bash-5.0 was the final version for which there will be an individual
Bash-5.0 was the final version for which there will be an individual
shopt option for the previous version. Users should control the compat-
ibility level with BBAASSHH__CCOOMMPPAATT.
The following table describes the behavior changes controlled by each
The following table describes the behavior changes controlled by each
compatibility level setting. The ccoommppaatt_N_N tag is used as shorthand for
setting the compatibility level to _N_N using one of the following mecha-
nisms. For versions prior to bash-5.0, the compatibility level may be
set using the corresponding ccoommppaatt_N_N shopt option. For bash-4.3 and
later versions, the BBAASSHH__CCOOMMPPAATT variable is preferred, and it is re-
nisms. For versions prior to bash-5.0, the compatibility level may be
set using the corresponding ccoommppaatt_N_N shopt option. For bash-4.3 and
later versions, the BBAASSHH__CCOOMMPPAATT variable is preferred, and it is re-
quired for bash-5.1 and later versions.
ccoommppaatt3311
+o quoting the rhs of the [[[[ command's regexp matching oper-
ator (=~) has no special effect
ator (=) has no special effect
ccoommppaatt3322
+o the << and >> operators to the [[[[ command do not consider
+o the << and >> operators to the [[[[ command do not consider
the current locale when comparing strings; they use ASCII
ordering.
ccoommppaatt4400
+o the << and >> operators to the [[[[ command do not consider
+o the << and >> operators to the [[[[ command do not consider
the current locale when comparing strings; they use ASCII
ordering. BBaasshh versions prior to bash-4.1 use ASCII col-
lation and _s_t_r_c_m_p(3); bash-4.1 and later use the current
lation and _s_t_r_c_m_p(3); bash-4.1 and later use the current
locale's collation sequence and _s_t_r_c_o_l_l(3).
ccoommppaatt4411
+o in _p_o_s_i_x mode, ttiimmee may be followed by options and still
+o in _p_o_s_i_x mode, ttiimmee may be followed by options and still
be recognized as a reserved word (this is POSIX interpre-
tation 267)
+o in _p_o_s_i_x mode, the parser requires that an even number of
single quotes occur in the _w_o_r_d portion of a double-
quoted parameter expansion and treats them specially, so
that characters within the single quotes are considered
single quotes occur in the _w_o_r_d portion of a double-
quoted parameter expansion and treats them specially, so
that characters within the single quotes are considered
quoted (this is POSIX interpretation 221)
ccoommppaatt4422
+o the replacement string in double-quoted pattern substitu-
tion does not undergo quote removal, as it does in ver-
tion does not undergo quote removal, as it does in ver-
sions after bash-4.2
+o in posix mode, single quotes are considered special when
expanding the _w_o_r_d portion of a double-quoted parameter
expansion and can be used to quote a closing brace or
other special character (this is part of POSIX interpre-
tation 221); in later versions, single quotes are not
+o in posix mode, single quotes are considered special when
expanding the _w_o_r_d portion of a double-quoted parameter
expansion and can be used to quote a closing brace or
other special character (this is part of POSIX interpre-
tation 221); in later versions, single quotes are not
special within double-quoted word expansions
ccoommppaatt4433
+o the shell does not print a warning message if an attempt
is made to use a quoted compound assignment as an argu-
ment to declare (e.g., declare -a foo='(1 2)'). Later
versions warn that this usage is deprecated
+o word expansion errors are considered non-fatal errors
that cause the current command to fail, even in posix
mode (the default behavior is to make them fatal errors
+o the shell does not print a warning message if an attempt
is made to use a quoted compound assignment as an argu-
ment to declare (e.g., declare -a foo=(1 2)). Later ver-
sions warn that this usage is deprecated
+o word expansion errors are considered non-fatal errors
that cause the current command to fail, even in posix
mode (the default behavior is to make them fatal errors
that cause the shell to exit)
+o when executing a shell function, the loop state
+o when executing a shell function, the loop state
(while/until/etc.) is not reset, so bbrreeaakk or ccoonnttiinnuuee in
that function will break or continue loops in the calling
context. Bash-4.4 and later reset the loop state to pre-
context. Bash-4.4 and later reset the loop state to pre-
vent this
ccoommppaatt4444
+o the shell sets up the values used by BBAASSHH__AARRGGVV and
BBAASSHH__AARRGGCC so they can expand to the shell's positional
+o the shell sets up the values used by BBAASSHH__AARRGGVV and
BBAASSHH__AARRGGCC so they can expand to the shell's positional
parameters even if extended debugging mode is not enabled
+o a subshell inherits loops from its parent context, so
bbrreeaakk or ccoonnttiinnuuee will cause the subshell to exit.
Bash-5.0 and later reset the loop state to prevent the
+o a subshell inherits loops from its parent context, so
bbrreeaakk or ccoonnttiinnuuee will cause the subshell to exit.
Bash-5.0 and later reset the loop state to prevent the
exit
+o variable assignments preceding builtins like eexxppoorrtt and
+o variable assignments preceding builtins like eexxppoorrtt and
rreeaaddoonnllyy that set attributes continue to affect variables
with the same name in the calling environment even if the
shell is not in posix mode
ccoommppaatt5500
+o Bash-5.1 changed the way $$RRAANNDDOOMM is generated to intro-
+o Bash-5.1 changed the way $$RRAANNDDOOMM is generated to intro-
duce slightly more randomness. If the shell compatibility
level is set to 50 or lower, it reverts to the method
from bash-5.0 and previous versions, so seeding the ran-
dom number generator by assigning a value to RRAANNDDOOMM will
level is set to 50 or lower, it reverts to the method
from bash-5.0 and previous versions, so seeding the ran-
dom number generator by assigning a value to RRAANNDDOOMM will
produce the same sequence as in bash-5.0
+o If the command hash table is empty, bash versions prior
to bash-5.1 printed an informational message to that ef-
fect, even when producing output that can be reused as
input. Bash-5.1 suppresses that message when the --ll op-
+o If the command hash table is empty, bash versions prior
to bash-5.1 printed an informational message to that ef-
fect, even when producing output that can be reused as
input. Bash-5.1 suppresses that message when the --ll op-
tion is supplied.
ccoommppaatt5511
+o The uunnsseett builtin treats attempts to unset array sub-
scripts @@ and ** differently depending on whether the ar-
ray is indexed or associative, and differently than in
+o The uunnsseett builtin treats attempts to unset array sub-
scripts @@ and ** differently depending on whether the ar-
ray is indexed or associative, and differently than in
previous versions.
+o arithmetic commands ( ((((...)))) ) and the expressions in an
arithmetic for statement can be expanded more than once
+o expressions used as arguments to arithmetic operators in
+o expressions used as arguments to arithmetic operators in
the [[[[ conditional command can be expanded more than once
+o the expressions in substring parameter brace expansion
+o the expressions in substring parameter brace expansion
can be expanded more than once
+o the expressions in the $$((((...)))) word expansion can be ex-
panded more than once
+o arithmetic expressions used as indexed array subscripts
+o arithmetic expressions used as indexed array subscripts
can be expanded more than once
+o tteesstt --vv, when given an argument of AA[[@@]], where AA is an
+o tteesstt --vv, when given an argument of AA[[@@]], where AA is an
existing associative array, will return true if the array
has any set elements. Bash-5.2 will look for and report
has any set elements. Bash-5.2 will look for and report
on a key named @@.
+o the ${_p_a_r_a_m_e_t_e_r[[::]]==_v_a_l_u_e} word expansion will return
_v_a_l_u_e, before any variable-specific transformations have
_v_a_l_u_e, before any variable-specific transformations have
been performed (e.g., converting to lowercase). Bash-5.2
will return the final value assigned to the variable.
+o Parsing command substitutions will behave as if extended
+o Parsing command substitutions will behave as if extended
globbing (see the description of the sshhoopptt builtin above)
is enabled, so that parsing a command substitution con-
is enabled, so that parsing a command substitution con-
taining an extglob pattern (say, as part of a shell func-
tion) will not fail. This assumes the intent is to en-
able extglob before the command is executed and word ex-
pansions are performed. It will fail at word expansion
time if extglob hasn't been enabled by the time the com-
tion) will not fail. This assumes the intent is to en-
able extglob before the command is executed and word ex-
pansions are performed. It will fail at word expansion
time if extglob hasn't been enabled by the time the com-
mand is executed.
SSEEEE AALLSSOO
+13 -17
View File
@@ -1,41 +1,39 @@
RBASH(1) General Commands Manual RBASH(1)
_R_B_A_S_H(1) General Commands Manual _R_B_A_S_H(1)
NNAAMMEE
rbash - restricted bash, see bbaasshh(1)
RREESSTTRRIICCTTEEDD SSHHEELLLL
If bbaasshh is started with the name rrbbaasshh, or the --rr option is supplied at
invocation, the shell becomes restricted. A restricted shell is used
to set up an environment more controlled than the standard shell. It
behaves identically to bbaasshh with the exception that the following are
invocation, the shell becomes restricted. A restricted shell is used
to set up an environment more controlled than the standard shell. It
behaves identically to bbaasshh with the exception that the following are
disallowed or not performed:
+o changing directories with ccdd
+o setting or unsetting the values of SSHHEELLLL, PPAATTHH, HHIISSTTFFIILLEE, EENNVV,
+o setting or unsetting the values of SSHHEELLLL, PPAATTHH, HHIISSTTFFIILLEE, EENNVV,
or BBAASSHH__EENNVV
+o specifying command names containing //
+o specifying a filename containing a // as an argument to the ..
+o specifying a filename containing a // as an argument to the ..
builtin command
+o specifying a filename containing a slash as an argument to the
+o specifying a filename containing a slash as an argument to the
hhiissttoorryy builtin command
+o specifying a filename containing a slash as an argument to the
+o specifying a filename containing a slash as an argument to the
--pp option to the hhaasshh builtin command
+o importing function definitions from the shell environment at
+o importing function definitions from the shell environment at
startup
+o parsing the value of SSHHEELLLLOOPPTTSS from the shell environment at
+o parsing the value of SSHHEELLLLOOPPTTSS from the shell environment at
startup
+o redirecting output using the >, >|, <>, >&, &>, and >> redirect-
ion operators
+o redirecting output using the >, >|, <>, >&, &>, and >> redirec-
tion operators
+o using the eexxeecc builtin command to replace the shell with another
command
@@ -59,6 +57,4 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL
SSEEEE AALLSSOO
bash(1)
Bash-5.2 2021 November 22 RBASH(1)
Bash-5.2 2021 November 22 _R_B_A_S_H(1)
+9
View File
@@ -4706,6 +4706,10 @@ itrace("execute_simple_command: posix mode tempenv assignment error");
}
#endif /* JOB_CONTROL */
/* unwind-protect this since we will call dispose_words on words if we run
the unwind-protects. */
unwind_protect_string (this_command_name);
run_builtin:
/* Remember the name of this command globally. */
this_command_name = words->word->word;
@@ -5286,6 +5290,10 @@ execute_function (SHELL_VAR *var, WORD_LIST *words, int flags, struct fd_bitmap
if (shell_compatibility_level > 43)
loop_level = 0;
/* unwind-protect this because execute_command_internal will overwrite it
with something we will free if unwind-protects are run */
if (subshell == 0)
unwind_protect_pointer (currently_executing_command);
fc = tc;
from_return_trap = 0;
@@ -5324,6 +5332,7 @@ execute_function (SHELL_VAR *var, WORD_LIST *words, int flags, struct fd_bitmap
currently_executing_command = save_current;
}
#else
currently_executing_command = save_current;
result = execute_command_internal (fc, 0, NO_PIPE, NO_PIPE, fds_to_close);
save_current = currently_executing_command;
+22 -2
View File
@@ -2901,7 +2901,7 @@ rl_dump_macros (int count, int key)
static char *
_rl_get_string_variable_value (const char *name)
{
static char numbuf[64];
static char numbuf[64]; /* more than enough for INTMAX_MAX */
char *ret;
if (_rl_stricmp (name, "active-region-start-color") == 0)
@@ -2951,24 +2951,40 @@ _rl_get_string_variable_value (const char *name)
return (_rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT);
else if (_rl_stricmp (name, "completion-display-width") == 0)
{
#if defined (HAVE_VSNPRINTF)
snprintf (numbuf, sizeof (numbuf), "%d", _rl_completion_columns);
#else
sprintf (numbuf, "%d", _rl_completion_columns);
#endif
return (numbuf);
}
else if (_rl_stricmp (name, "completion-prefix-display-length") == 0)
{
#if defined (HAVE_VSNPRINTF)
snprintf (numbuf, sizeof (numbuf), "%d", _rl_completion_prefix_display_length);
#else
sprintf (numbuf, "%d", _rl_completion_prefix_display_length);
#endif
return (numbuf);
}
else if (_rl_stricmp (name, "completion-query-items") == 0)
{
#if defined (HAVE_VSNPRINTF)
snprintf (numbuf, sizeof (numbuf), "%d", rl_completion_query_items);
#else
sprintf (numbuf, "%d", rl_completion_query_items);
#endif
return (numbuf);
}
else if (_rl_stricmp (name, "editing-mode") == 0)
return (rl_get_keymap_name_from_edit_mode ());
else if (_rl_stricmp (name, "history-size") == 0)
{
#if defined (HAVE_VSNPRINTF)
snprintf (numbuf, sizeof (numbuf), "%d", history_is_stifled() ? history_max_entries : -1);
#else
sprintf (numbuf, "%d", history_is_stifled() ? history_max_entries : -1);
#endif
return (numbuf);
}
else if (_rl_stricmp (name, "isearch-terminators") == 0)
@@ -2995,7 +3011,11 @@ _rl_get_string_variable_value (const char *name)
}
else if (_rl_stricmp (name, "keyseq-timeout") == 0)
{
sprintf (numbuf, "%d", _rl_keyseq_timeout);
#if defined (HAVE_VSNPRINTF)
snprintf (numbuf, sizeof (numbuf), "%d", _rl_keyseq_timeout);
#else
sprintf (numbuf, "%d", _rl_keyseq_timeout);
#endif
return (numbuf);
}
else if (_rl_stricmp (name, "emacs-mode-string") == 0)
+4
View File
@@ -1125,7 +1125,11 @@ rl_redisplay (void)
char obuf[5];
int olen;
#if defined (HAVE_VSNPRINTF)
olen = snprintf (obuf, sizeof (obuf), "\\%o", c);
#else
olen = sprintf (obuf, "\\%o", c);
#endif
for (temp = 0; temp < olen; temp++)
{
+28 -15
View File
@@ -10,6 +10,19 @@
.\"
.TH HISTORY 3 "2024 February 5" "GNU History 8.3"
.\"
.ie \n(.g \{\
.ds ' \(aq
.ds " \(dq
.ds ^ \(ha
.ds ~ \(ti
.\}
.el \{\
.ds ' '
.ds " ""\" two adjacent quotes and no space before this comment
.ds ^ ^
.ds ~ ~
.\}
.
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
.\"
@@ -88,7 +101,7 @@ Only backslash (\^\fB\e\fP\^) and single quotes can quote
the history expansion character.
.PP
There is a special abbreviation for substitution, active when the
\fIquick substitution\fP character (default \fB\(ha\fP)
\fIquick substitution\fP character (default \fB\*^\fP)
is the first character on the line.
It selects the previous history list entry, using an event designator
equivalent to \fB!!\fP,
@@ -138,13 +151,13 @@ 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\(ha\s-2\u\fIstring1\fP\d\s+2\(ha\s-2\u\fIstring2\fP\d\s+2\(ha\s-2\u
.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
.I string1
with
.IR string2 .
Equivalent to
.Q !!:s\d\s+2\(ha\s-2\u\fIstring1\fP\d\s+2\(ha\s-2\u\fIstring2\fP\d\s+2\(ha\s-2\u
.Q !!: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 !#
@@ -156,7 +169,7 @@ A
.B :
separates the event specification from the word designator.
It may be omitted if the word designator begins with a
.BR \(ha ,
.BR \*^ ,
.BR $ ,
.BR * ,
.BR \- ,
@@ -175,7 +188,7 @@ word.
.I n
The \fIn\fRth word.
.TP
.B \(ha
.B \*^
The first argument. That is, word 1.
.TP
.B $
@@ -533,7 +546,7 @@ This section documents the functions for managing a history file.
.Fn1 int read_history "const char *filename"
Add the contents of \fIfilename\fP to the history list, a line at a time.
If \fIfilename\fP is \fBNULL\fP, then read from \fI\(ti/.history\fP.
If \fIfilename\fP is \fBNULL\fP, then read from \fI\*~/.history\fP.
Returns 0 if successful, or \fBerrno\fP if not.
.Fn3 int read_history_range "const char *filename" "int from" "int to"
@@ -541,25 +554,25 @@ Read a range of lines from \fIfilename\fP, adding them to the history list.
Start reading at line \fIfrom\fP and end at \fIto\fP.
If \fIfrom\fP is zero, start at the beginning. If \fIto\fP is less than
\fIfrom\fP, then read until the end of the file. If \fIfilename\fP is
\fBNULL\fP, then read from \fI\(ti/.history\fP. Returns 0 if successful,
\fBNULL\fP, then read from \fI\*~/.history\fP. Returns 0 if successful,
or \fBerrno\fP if not.
.Fn1 int write_history "const char *filename"
Write the current history to \fIfilename\fP, overwriting \fIfilename\fP
if necessary.
If \fIfilename\fP is \fBNULL\fP, then write the history list to \fI\(ti/.history\fP.
If \fIfilename\fP is \fBNULL\fP, then write the history list to \fI\*~/.history\fP.
Returns 0 on success, or \fBerrno\fP on a read or write error.
.Fn2 int append_history "int nelements" "const char *filename"
Append the last \fInelements\fP of the history list to \fIfilename\fP.
If \fIfilename\fP is \fBNULL\fP, then append to \fI\(ti/.history\fP.
If \fIfilename\fP is \fBNULL\fP, then append to \fI\*~/.history\fP.
Returns 0 on success, or \fBerrno\fP on a read or write error.
.Fn2 int history_truncate_file "const char *filename" "int nlines"
Truncate the history file \fIfilename\fP, leaving only the last
\fInlines\fP lines.
If \fIfilename\fP is \fBNULL\fP, then \fI\(ti/.history\fP is truncated.
If \fIfilename\fP is \fBNULL\fP, then \fI\*~/.history\fP is truncated.
Returns 0 on success, or \fBerrno\fP on failure.
.SS History Expansion
@@ -640,7 +653,7 @@ Setting this to 0 inhibits history expansion.
.Vb char history_subst_char
The character that invokes word substitution if found at the start of
a line. The default is \fB\(ha\fP.
a line. The default is \fB\*^\fP.
.Vb char history_comment_char
During tokenization, if this character is seen as the first character
@@ -650,7 +663,7 @@ This is disabled by default.
.Vb "char *" history_word_delimiters
The characters that separate tokens for \fBhistory_tokenize()\fP.
The default value is \fB\(dq\ \et\en()<>;&|\(dq\fP.
The default value is \fB\*"\ \et\en()<>;&|\*"\fP.
.Vb "char *" history_no_expand_chars
The list of characters which inhibit history expansion if found immediately
@@ -672,10 +685,10 @@ The default value is 0.
.Vb int history_quoting_state
An application may set this variable to indicate that the current line
being expanded is subject to existing quoting. If set to \fI\(aq\fP, the
being expanded is subject to existing quoting. If set to \fI\*'\fP, the
history expansion function will assume that the line is single-quoted and
inhibit expansion until it reads an unquoted closing single quote; if set
to \fI\(dq\fP, history expansion will assume the line is double quoted until
to \fI\*"\fP, history expansion will assume the line is double quoted until
it reads an unquoted closing double quote. If set to zero, the default,
the history expansion function will assume the line is not quoted and
treat quote characters within the line as described above.
@@ -694,7 +707,7 @@ By default, this variable is set to \fBNULL\fP.
.SH FILES
.PD 0
.TP
.FN \(ti/.history
.FN \*~/.history
Default filename for reading and writing saved history
.PD
.SH "SEE ALSO"
+33 -20
View File
@@ -10,6 +10,19 @@
.\"
.TH READLINE 3 "2024 February 5" "GNU Readline 8.3"
.\"
.ie \n(.g \{\
.ds ' \(aq
.ds " \(dq
.ds ^ \(ha
.ds ~ \(ti
.\}
.el \{\
.ds ' '
.ds " ""\" two adjacent quotes and no space before this comment
.ds ^ ^
.ds ~ ~
.\}
.
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
.\"
@@ -126,7 +139,7 @@ file (the \fIinputrc\fP file).
The name of this file is taken from the value of the
.B INPUTRC
environment variable. If that variable is unset, the default is
.IR \(ti/.inputrc .
.IR \*~/.inputrc .
If that file does not exist or cannot be read, the ultimate default is
.IR /etc/inputrc .
When a program which uses the readline library starts up, the
@@ -192,7 +205,7 @@ is the name of a key spelled out in English. For example:
.nf
Control-u: universal\-argument
Meta-Rubout: backward\-kill\-word
Control-o: \(dq> output\(dq
Control-o: \*"> output\*"
.fi
.EE
.RE
@@ -212,7 +225,7 @@ expressed on the right hand side (that is, to insert the text
into the line).
.PP
In the second form,
\fB\(dqkeyseq\(dq\fP:\^\fIfunction\-name\fP or \fImacro\fP,
\fB\*"keyseq\*"\fP:\^\fIfunction\-name\fP or \fImacro\fP,
.B keyseq
differs from
.B keyname
@@ -225,9 +238,9 @@ are not recognized.
.RS
.EX
.nf
\(dq\eC\-u\(dq: universal\-argument
\(dq\eC\-x\eC\-r\(dq: re\-read\-init\-file
\(dq\ee[11\(ti\(dq: \(dqFunction Key 1\(dq
\*"\eC\-u\*": universal\-argument
\*"\eC\-x\eC\-r\*": re\-read\-init\-file
\*"\ee[11\*~\*": \*"Function Key 1\*"
.fi
.EE
.RE
@@ -240,7 +253,7 @@ is again bound to the function
is bound to the function
.BR re\-read\-init\-file ,
and
.I "ESC [ 1 1 \(ti"
.I "ESC [ 1 1 \*~"
is bound to insert the text
.Q "Function Key 1" .
.PP
@@ -261,11 +274,11 @@ an escape character
.B \e\e
backslash
.TP
.B \e\(dq
literal \(dq, a double quote
.B \e\*"
literal \*", a double quote
.TP
.B \e\(aq
literal \(aq, a single quote
.B \e\*'
literal \*', a single quote
.RE
.PD
.PP
@@ -313,7 +326,7 @@ be used to indicate a macro definition. Unquoted text
is assumed to be a function name.
In the macro body, the backslash escapes described above are expanded.
Backslash will quote any other character in the macro text,
including \(dq and \(aq.
including \*" and \*'.
.PP
.B Bash
allows the current readline key bindings to be displayed or modified
@@ -792,7 +805,7 @@ key sequence that quotes the current or previous word in \fBbash\fP:
.nf
\fB$if\fP Bash
# Quote the current or previous word
\(dq\eC-xq\(dq: \(dq\eeb\e\(dq\eef\e\(dq\(dq
\*"\eC-xq\*": \*"\eeb\e\*"\eef\e\*"\*"
\fB$endif\fP
.fi
.EE
@@ -1206,7 +1219,7 @@ The actual completion performed is application-specific.
.BR Bash ,
for instance, attempts completion treating the text as a variable
(if the text begins with \fB$\fP), username (if the text begins with
\fB\(ti\fP), hostname (if the text begins with \fB@\fP), or
\fB\*~\fP), hostname (if the text begins with \fB@\fP), or
command (including aliases and functions) in turn. If none
of these produces a match, filename completion is attempted.
.BR Gdb ,
@@ -1440,7 +1453,7 @@ Emacs Standard bindings
"C-_" undo
"\^ " to "/" self-insert
"0" to "9" self-insert
":" to "\(ti" self-insert
":" to "\*~" self-insert
"C-?" backward-delete-char
.PP
Emacs Meta bindings
@@ -1487,7 +1500,7 @@ Emacs Meta bindings
"M-U" upcase-word
"M-Y" yank-pop
"M-\e" delete-horizontal-space
"M-\(ti" tilde-expand
"M-\*~" tilde-expand
"M-C-?" backward-kill-word
"M-_" yank-last-arg
.PP
@@ -1525,7 +1538,7 @@ VI Insert Mode functions
"C-Y" yank
"C-[" vi-movement-mode
"C-_" vi-undo
"\^ " to "\(ti" self-insert
"\^ " to "\*~" self-insert
"C-?" backward-delete-char
.PP
VI Command Mode functions
@@ -1583,7 +1596,7 @@ VI Command Mode functions
"X" vi-rubout
"Y" vi-yank-to
"\e" vi-complete
"\(ha" vi-first-print
"\*^" vi-first-print
"_" vi-yank-arg
"`" vi-goto-mark
"a" vi-append-mode
@@ -1608,7 +1621,7 @@ VI Command Mode functions
"x" vi-delete
"y" vi-yank-to
"|" vi-column
"\(ti" vi-change-case
"\*~" vi-change-case
.RE
.SH "SEE ALSO"
.PD 0
@@ -1622,7 +1635,7 @@ VI Command Mode functions
.SH FILES
.PD 0
.TP
.FN \(ti/.inputrc
.FN \*~/.inputrc
Individual \fBreadline\fP initialization file
.PD
.SH AUTHORS
+1
View File
@@ -2357,6 +2357,7 @@ This is @emph{always} zero when completion is attempted, and can only
be changed within an application-specific completion function.
The quoting is effected via a call to the function pointed to
by @code{rl_filename_quoting_function}.
@end deftypevar
@deftypevar int rl_attempted_completion_over
If an application-specific completion function assigned to
+116 -16
View File
@@ -1,6 +1,6 @@
/* history.c -- standalone history library */
/* Copyright (C) 1989-2023 Free Software Foundation, Inc.
/* Copyright (C) 1989-2024 Free Software Foundation, Inc.
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
@@ -61,24 +61,39 @@ extern int errno;
#define MAX_HISTORY_INITIAL_SIZE 8192
/* The number of slots to increase the_history by. */
#define DEFAULT_HISTORY_GROW_SIZE 50
#define DEFAULT_HISTORY_GROW_SIZE 256
static char *hist_inittime (void);
static int history_list_grow_size (void);
static void history_list_resize (int); /* XXX - size_t? */
static void advance_history (void);
/* **************************************************************** */
/* */
/* History Functions */
/* */
/* **************************************************************** */
/* An array of HIST_ENTRY. This is where we store the history. */
/* An array of HIST_ENTRY. This is where we store the history. the_history is
a roving pointer somewhere into this, so the user-visible history list is
a window into real_history starting at the_history and extending
history_length entries. */
static HIST_ENTRY **real_history = (HIST_ENTRY **)NULL;
/* The current number of slots allocated to the input_history. */
static int real_history_size = 0;
/* A pointer to somewhere in real_history, where the user-visible history
starts. */
static HIST_ENTRY **the_history = (HIST_ENTRY **)NULL;
/* Non-zero means that we have enforced a limit on the amount of
history that we save. */
static int history_stifled;
/* The current number of slots allocated to the input_history. */
/* The number of history entries available for user use, starting at the_history.
real_history_size - history_size == the_history - real_history */
static int history_size;
/* If HISTORY_STIFLED is non-zero, then this is the maximum number of
@@ -90,12 +105,59 @@ int max_input_history; /* backwards compatibility */
life easier for outside callers. */
int history_offset;
/* The number of strings currently stored in the history list. */
/* The number of strings currently stored in the history list. This is
always <= real_history_length */
int history_length;
/* The logical `base' of the history array. It defaults to 1. */
int history_base = 1;
/* Compute the number of bits required to store a given nonnegative integer.
NOTE: _bit_length(0) == 0 */
static inline unsigned
_bit_length(unsigned n)
{
/* This implementation is for simplicity, not for performance, but it is
fast enough for our purposes here. */
unsigned count = 0;
while (n)
{
n >>= 1;
count++;
}
return count;
}
/* Compute a grow size that adjusts to the size of the history.
We aim to grow by roughly sqrt(history_size) in order to amortize the cost of
realloc() and memmove(). This reduces the total cost of the memmoves from
O(N^2) to O(N*sqrt(N)). */
static int
history_list_grow_size (void)
{
int width, r;
/* Handle small positive values and guard against history_length accidentally
being negative. */
const int MIN_BITS = 10;
if (history_length < (1 << MIN_BITS))
return DEFAULT_HISTORY_GROW_SIZE;
/* For other values, we just want something easy to compute that grows roughly
as sqrt(N), where N=history_length. We use approximately 2^((k+1)/2),
where k is the bit length of N. This bounds the value between sqrt(2N) and
2*sqrt(N). */
width = MIN_BITS + _bit_length(history_length >> MIN_BITS);
/* If width is odd then this is 2^((width+1)/2). An even width gives a value
of 3*2^((width-2)/2) ~ 1.06*2^((width+1)/2). */
r = (1 << (width / 2)) + (1 << ((width - 1) / 2));
/* Make sure we always expand the list by at least DEFAULT_HISTORY_GROW_SIZE */
return ((r < DEFAULT_HISTORY_GROW_SIZE) ? DEFAULT_HISTORY_GROW_SIZE : r);
}
/* Return the current HISTORY_STATE of the history. */
HISTORY_STATE *
history_get_history_state (void)
@@ -274,6 +336,48 @@ hist_inittime (void)
return ret;
}
/* Ensure space for new history entries by resetting the start pointer
(the_history) and resizing real_history if necessary. */
static void
history_list_resize (int new_size)
{
/* Do nothing there is already enough user space. history_length is always <=
real_history_size */
if (new_size < history_length)
return;
/* If we need to, reset the_history to the start of real_history and
start over. */
if (the_history != real_history)
memmove (real_history, the_history, history_length * sizeof (HIST_ENTRY *));
/* Don't bother if real_history_size is already big enough, since at this
point the_history == real_history and we will set history_size to
real_history_size. We don't shrink the history list. */
if (new_size > real_history_size)
{
real_history = (HIST_ENTRY **) xrealloc (real_history, new_size * sizeof (HIST_ENTRY *));
real_history_size = new_size;
}
the_history = real_history;
history_size = real_history_size;
if (history_size > history_length)
memset (real_history + history_length, 0, (history_size - history_length) * sizeof (HIST_ENTRY *));
}
static void
advance_history (void)
{
/* Advance 'the_history' pointer to simulate dropping the first entry. */
the_history++;
history_size--;
/* If full, move all the entries (and trailing NULL) to the beginning. */
if (history_length == history_size)
history_list_resize (history_length + history_list_grow_size ());
}
/* Place STRING at the end of the history list. The data field
is set to NULL. */
void
@@ -293,9 +397,8 @@ add_history (const char *string)
if (the_history[0])
(void) free_history_entry (the_history[0]);
/* Copy the rest of the entries, moving down one slot. Copy includes
trailing NULL. */
memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
/* Advance the pointer into real_history, resizing if necessary. */
advance_history ();
new_length = history_length;
history_base++;
@@ -304,23 +407,20 @@ add_history (const char *string)
{
if (history_size == 0)
{
int initial_size;
if (history_stifled && history_max_entries > 0)
history_size = (history_max_entries > MAX_HISTORY_INITIAL_SIZE)
initial_size = (history_max_entries > MAX_HISTORY_INITIAL_SIZE)
? MAX_HISTORY_INITIAL_SIZE
: history_max_entries + 2;
else
history_size = DEFAULT_HISTORY_INITIAL_SIZE;
the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
initial_size = DEFAULT_HISTORY_INITIAL_SIZE;
history_list_resize (initial_size);
new_length = 1;
}
else
{
if (history_length == (history_size - 1))
{
history_size += DEFAULT_HISTORY_GROW_SIZE;
the_history = (HIST_ENTRY **)
xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
}
history_list_resize (real_history_size + history_list_grow_size ());
new_length = history_length + 1;
}
}
+2
View File
@@ -8536,6 +8536,7 @@ string_var_assignment (SHELL_VAR *v, char *s)
val = (v && (invisible_p (v) || var_isset (v) == 0)) ? (char *)NULL : sh_quote_reusable (s, 0);
i = var_attribute_string (v, 0, flags);
/* i = strlen (flags) */
if (i == 0 && val == 0)
return (char *)NULL;
@@ -8586,6 +8587,7 @@ array_var_assignment (SHELL_VAR *v, int itype, int quoted, int atype)
return val;
i = var_attribute_string (v, 0, flags);
/* i == strlen (flags) */
ret = (char *)xmalloc (i + STRLEN (val) + strlen (v->name) + 16);
if (val)
sprintf (ret, "declare -%s %s=%s", flags, v->name, val);
+1
View File
@@ -5989,6 +5989,7 @@ sv_winsize (const char *name)
/* Update the value of HOME in the export environment so tilde expansion will
work on cygwin. */
#if defined (__CYGWIN__)
void
sv_home (const char *name)
{
array_needs_making = 1;