mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-02 09:50:50 +02:00
commit bash-20200520 snapshot
This commit is contained in:
+211
-60
@@ -5,12 +5,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\"
|
||||
.\" Last Change: Tue May 5 16:20:48 EDT 2020
|
||||
.\" Last Change: Sat May 23 12:45:10 EDT 2020
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2020 May 5" "GNU Bash 5.0"
|
||||
.TH BASH 1 "2020 May 23" "GNU Bash 5.1"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -2034,9 +2034,9 @@ below.
|
||||
.TP
|
||||
.B BASH_COMPAT
|
||||
The value is used to set the shell's compatibility level.
|
||||
See the description of the \fBshopt\fP builtin below under
|
||||
\fBSHELL BUILTIN COMMANDS\fP
|
||||
for a description of the various compatibility
|
||||
See
|
||||
\fBSHELL COMPATIBILITY MODE\fP
|
||||
below for a description of the various compatibility
|
||||
levels and their effects.
|
||||
The value may be a decimal number (e.g., 4.2) or an integer (e.g., 42)
|
||||
corresponding to the desired compatibility level.
|
||||
@@ -2045,9 +2045,12 @@ level is set to the default for the current version.
|
||||
If \fBBASH_COMPAT\fP is set to a value that is not one of the valid
|
||||
compatibility levels, the shell prints an error message and sets the
|
||||
compatibility level to the default for the current version.
|
||||
The valid compatibility levels correspond to the compatibility options
|
||||
accepted by the \fBshopt\fP builtin described below (for example,
|
||||
\fBcompat42\fP means that 4.2 and 42 are valid values).
|
||||
The valid values correspond to the compatibility levels
|
||||
described below under
|
||||
\fBSHELL COMPATIBILITY MODE\fP.
|
||||
For example, 4.2 and 42 are valid values that correspond
|
||||
to the \fBcompat42\fP \fBshopt\fP option
|
||||
and set the compatibility level to 42.
|
||||
The current version is also a valid value.
|
||||
.TP
|
||||
.B BASH_ENV
|
||||
@@ -9934,72 +9937,27 @@ This option is enabled by default, but only has an effect if command
|
||||
history is enabled, as described above under
|
||||
.SM
|
||||
.BR HISTORY .
|
||||
.PD 0
|
||||
.TP 8
|
||||
.B compat31
|
||||
If set,
|
||||
.B bash
|
||||
changes its behavior to that of version 3.1 with respect to quoted
|
||||
arguments to the \fB[[\fP conditional command's \fB=~\fP operator
|
||||
and locale-specific string comparison when using the \fB[[\fP
|
||||
conditional command's \fB<\fP and \fB>\fP operators.
|
||||
Bash versions prior to bash-4.1 use ASCII collation and
|
||||
.IR strcmp (3);
|
||||
bash-4.1 and later use the current locale's collation sequence and
|
||||
.IR strcoll (3).
|
||||
.TP 8
|
||||
.B compat32
|
||||
If set,
|
||||
.B bash
|
||||
changes its behavior to that of version 3.2 with respect to
|
||||
locale-specific string comparison when using the \fB[[\fP
|
||||
conditional command's \fB<\fP and \fB>\fP operators (see previous item)
|
||||
and the effect of interrupting a command list.
|
||||
Bash versions 3.2 and earlier continue with the next command in the list
|
||||
after one terminates due to an interrupt.
|
||||
.TP 8
|
||||
.B compat40
|
||||
If set,
|
||||
.B bash
|
||||
changes its behavior to that of version 4.0 with respect to locale-specific
|
||||
string comparison when using the \fB[[\fP
|
||||
conditional command's \fB<\fP and \fB>\fP operators (see description of
|
||||
\fBcompat31\fP)
|
||||
and the effect of interrupting a command list.
|
||||
Bash versions 4.0 and later interrupt the list as if the shell received the
|
||||
interrupt; previous versions continue with the next command in the list.
|
||||
.TP 8
|
||||
.B compat41
|
||||
If set,
|
||||
.BR bash ,
|
||||
when in \fIposix mode\fP, treats a single quote in a double-quoted
|
||||
parameter expansion as a special character. The single quotes must match
|
||||
(an even number) and the characters between the single quotes are considered
|
||||
quoted. This is the behavior of <posix mode through version 4.1.
|
||||
The default bash behavior remains as in previous versions.
|
||||
.TP 8
|
||||
.B compat42
|
||||
If set,
|
||||
.B bash
|
||||
does not process the replacement string in the pattern substitution word
|
||||
expansion using quote removal.
|
||||
.TP 8
|
||||
.B compat43
|
||||
If set,
|
||||
.B bash
|
||||
does not print a warning message if an attempt is made to use a quoted compound
|
||||
array assignment as an argument to \fBdeclare\fP,
|
||||
makes word expansion errors
|
||||
non-fatal errors that cause the current command to fail (the default behavior is
|
||||
to make them fatal errors that cause the shell to exit),
|
||||
and does not reset the
|
||||
loop state when a shell function is executed (this allows \fBbreak\fP or
|
||||
\fBcontinue\fP in a shell function to affect loops in the caller's context).
|
||||
.TP 8
|
||||
.B compat44
|
||||
If set,
|
||||
.B bash
|
||||
saves the positional parameters to BASH_ARGV and BASH_ARGC before they are
|
||||
used, regardless of whether or not extended debugging mode is enabled.
|
||||
.PD
|
||||
These control aspects of the shell's compatibility mode
|
||||
(see
|
||||
.SM
|
||||
.B "SHELL COMPATIBILITY MODE"
|
||||
below).
|
||||
.TP 8
|
||||
.B complete_fullquote
|
||||
If set,
|
||||
@@ -10906,6 +10864,199 @@ If
|
||||
specifies a non-existent process or job, the return status is
|
||||
127. Otherwise, the return status is the exit status of the last
|
||||
process or job waited for.
|
||||
.SH "SHELL COMPATIBILITY MODE"
|
||||
Bash-4.0 introduced the concept of a `shell compatibility level', specified
|
||||
as a set of options to the shopt builtin
|
||||
.BR compat31 ,
|
||||
.BR compat32 ,
|
||||
.BR compat40 ,
|
||||
.BR compat41 ,
|
||||
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 solution.
|
||||
.PP
|
||||
This section does not mention behavior that is standard for a particular
|
||||
version (e.g., setting \fBcompat32\fP 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 above).
|
||||
.PP
|
||||
If a user enables, say, \fBcompat32\fP, 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 \fBbash\fP,
|
||||
but that behavior may have been present in earlier versions.
|
||||
For instance, the change to use locale-based comparisons with the \fB[[\fP
|
||||
command came in bash-4.1, and earlier versions used ASCII-based comparisons,
|
||||
so enabling \fBcompat32\fP will enable ASCII-based comparisons as well.
|
||||
That granularity may not be sufficient 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.
|
||||
.PP
|
||||
Bash-4.3 introduced a new shell variable:
|
||||
.SM
|
||||
.BR BASH_COMPAT .
|
||||
The value assigned
|
||||
to this variable (a decimal version number like 4.2, or an integer
|
||||
corresponding to the \fBcompat\fP\fINN\fP option, like 42) determines the
|
||||
compatibility level.
|
||||
.PP
|
||||
Starting with bash-4.4, Bash has begun deprecating older compatibility
|
||||
levels.
|
||||
Eventually, the options will be removed in favor of
|
||||
.SM
|
||||
.BR BASH_COMPAT .
|
||||
.PP
|
||||
Bash-5.0 is the final version for which there will be an individual shopt
|
||||
option for the previous version. Users should use
|
||||
.SM
|
||||
.B BASH_COMPAT
|
||||
on bash-5.0 and later versions.
|
||||
.PP
|
||||
The following table describes the behavior changes controlled by each
|
||||
compatibility level setting.
|
||||
The \fBcompat\fP\fINN\fP tag is used as shorthand for setting the
|
||||
compatibility level
|
||||
to \fINN\fP using one of the following mechanisms.
|
||||
For versions prior to bash-5.0, the compatibility level may be set using
|
||||
the corresponding \fBcompat\fP\fINN\fP shopt option.
|
||||
For bash-4.3 and later versions, the
|
||||
.SM
|
||||
.B BASH_COMPAT
|
||||
variable is preferred,
|
||||
and it is required for bash-5.1 and later versions.
|
||||
.TP
|
||||
\fBcompat31\fP
|
||||
.PD 0
|
||||
.RS
|
||||
.IP \(bu
|
||||
quoting the rhs of the \fB[[\fP command's regexp matching operator (=~)
|
||||
has no special effect
|
||||
.RE
|
||||
.PD
|
||||
.TP
|
||||
\fBcompat32\fP
|
||||
.PD 0
|
||||
.RS
|
||||
.IP \(bu
|
||||
interrupting a command list such as "a ; b ; c" causes the execution
|
||||
of the next command in the list (in bash-4.0 and later versions,
|
||||
the shell acts as if it received the interrupt, so
|
||||
interrupting one command in a list aborts the execution of the
|
||||
entire list)
|
||||
.RE
|
||||
.PD
|
||||
.TP
|
||||
\fBcompat40\fP
|
||||
.PD 0
|
||||
.RS
|
||||
.IP \(bu
|
||||
the \fB<\fP and \fB>\fP operators to the \fB[[\fP command do not
|
||||
consider the current locale when comparing strings; they use ASCII
|
||||
ordering.
|
||||
Bash versions prior to bash-4.1 use ASCII collation and
|
||||
.IR strcmp (3);
|
||||
bash-4.1 and later use the current locale's collation sequence and
|
||||
.IR strcoll (3).
|
||||
.RE
|
||||
.PD
|
||||
.TP
|
||||
\fBcompat41\fP
|
||||
.PD 0
|
||||
.RS
|
||||
.IP \(bu
|
||||
in \fIposix\fP mode, \fBtime\fP may be followed by options and still be
|
||||
recognized as a reserved word (this is POSIX interpretation 267)
|
||||
.IP \(bu
|
||||
in \fIposix\fP mode, the parser requires that an even number of single
|
||||
quotes occur in the \fIword\fP 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)
|
||||
.RE
|
||||
.PD
|
||||
.TP
|
||||
\fBcompat42\fP
|
||||
.PD 0
|
||||
.RS
|
||||
.IP \(bu
|
||||
the replacement string in double-quoted pattern substitution does not
|
||||
undergo quote removal, as it does in versions after bash-4.2
|
||||
.IP \(bu
|
||||
in posix mode, single quotes are considered special when expanding
|
||||
the \fIword\fP 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 interpretation 221);
|
||||
in later versions, single quotes
|
||||
are not special within double-quoted word expansions
|
||||
.RE
|
||||
.PD
|
||||
.TP
|
||||
\fBcompat43\fP
|
||||
.PD 0
|
||||
.RS
|
||||
.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
|
||||
(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
|
||||
current command to fail, even in posix mode
|
||||
(the default behavior is to make them fatal errors that cause the shell
|
||||
to exit)
|
||||
.IP \(bu
|
||||
when executing a shell function, the loop state (while/until/etc.)
|
||||
is not reset, so \fBbreak\fP or \fBcontinue\fP in that function will break
|
||||
or continue loops in the calling context. Bash-4.4 and later reset
|
||||
the loop state to prevent this
|
||||
.RE
|
||||
.PD
|
||||
.TP
|
||||
\fBcompat44\fP
|
||||
.PD 0
|
||||
.RS
|
||||
.IP \(bu
|
||||
the shell sets up the values used by
|
||||
.SM
|
||||
.B BASH_ARGV
|
||||
and
|
||||
.SM
|
||||
.B BASH_ARGC
|
||||
so they can expand to the shell's positional parameters even if extended
|
||||
debugging mode is not enabled
|
||||
.IP \(bu
|
||||
a subshell inherits loops from its parent context, so \fBbreak\fP
|
||||
or \fBcontinue\fP will cause the subshell to exit.
|
||||
Bash-5.0 and later reset the loop state to prevent the exit
|
||||
.IP \(bu
|
||||
variable assignments preceding builtins like \fBexport\fP and \fBreadonly\fP
|
||||
that set attributes continue to affect variables with the same
|
||||
name in the calling environment even if the shell is not in posix
|
||||
mode
|
||||
.RE
|
||||
.PD
|
||||
.TP
|
||||
\fBcompat50\fP
|
||||
.PD 0
|
||||
.RS
|
||||
.IP \(bu
|
||||
Bash-5.1 changed the way
|
||||
.SM
|
||||
.B $RANDOM
|
||||
is generated to introduce 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 random number generator by assigning a value to
|
||||
.SM
|
||||
.B RANDOM
|
||||
will produce the same sequence as in bash-5.0
|
||||
.RE
|
||||
.PD
|
||||
.\" bash_builtins
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.SH "RESTRICTED SHELL"
|
||||
|
||||
Reference in New Issue
Block a user