fix for programmable completion functions setting traps on signals that readline handles

This commit is contained in:
Chet Ramey
2022-12-06 10:41:41 -05:00
parent 198210c58f
commit 237c32ba16
28 changed files with 3223 additions and 3018 deletions
+212 -203
View File
@@ -683,7 +683,7 @@ QQUUOOTTIINNGG
fault, whether or not it is translated and replaced. If the nnooeexx--
ppaanndd__ttrraannssllaattiioonn option is enabled using the sshhoopptt builtin, translated
strings are single-quoted instead of double-quoted. See the descrip-
tion of sshhoopptt below under SSHHEELLLLBUILTINCCOOMMMMAANNDDSS.
tion of sshhoopptt below under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS.
PPAARRAAMMEETTEERRSS
A _p_a_r_a_m_e_t_e_r is an entity that stores values. It can be a _n_a_m_e, a num-
@@ -2154,7 +2154,7 @@ EEXXPPAANNSSIIOONN
!!((_p_a_t_t_e_r_n_-_l_i_s_t))
Matches anything except one of the given patterns
Theeexxttgglloobb option changes the behavior of the parser, since the paren-
The eexxttgglloobb option changes the behavior of the parser, since the paren-
theses are normally treated as operators with syntactic meaning. To
ensure that extended matching patterns are parsed correctly, make sure
that eexxttgglloobb is enabled before parsing constructs containing the pat-
@@ -6204,34 +6204,42 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
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_r_g] _s_i_g_s_p_e_c ...]
The command _a_r_g is to be read and executed when the shell re-
ceives signal(s) _s_i_g_s_p_e_c. If _a_r_g is absent (and there is a sin-
gle _s_i_g_s_p_e_c) or --, each specified signal is reset to its origi-
nal disposition (the value it had upon entrance to the shell).
If _a_r_g 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 invokes. If _a_r_g
is not present and --pp has been supplied, then the trap commands
associated with each _s_i_g_s_p_e_c are displayed. If no arguments are
supplied or if only --pp is given, ttrraapp prints the list of com-
mands associated with each signal. The --ll option causes the
shell 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.
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-
vokes.
If a _s_i_g_s_p_e_c is EEXXIITT (0) the command _a_r_g is executed on exit
from the shell. If a _s_i_g_s_p_e_c is DDEEBBUUGG, the command _a_r_g is exe-
cuted 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, every arithmetic _f_o_r command, and before the
first command executes in a shell function (see SSHHEELLLL GGRRAAMMMMAARR
above). Refer to the description of the eexxttddeebbuugg option to the
sshhoopptt builtin for details of its effect on the DDEEBBUUGG trap. If a
_s_i_g_s_p_e_c is RREETTUURRNN, the command _a_r_g is executed each time a shell
function or a script executed with the .. or ssoouurrccee builtins fin-
ishes executing.
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
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.
If a _s_i_g_s_p_e_c is EERRRR, the command _a_r_g is executed whenever a
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
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,
arithmetic _f_o_r command, and before the first command executes in
a shell function (see SSHHEELLLL GGRRAAMMMMAARR above). Refer to the de-
scription 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
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
@@ -6243,61 +6251,62 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
!!. These are the same conditions obeyed by the eerrrreexxiitt (--ee) op-
tion.
Signals ignored upon entry to the shell cannot be trapped or re-
set. 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 is false if any _s_i_g_s_p_e_c is
invalid; otherwise ttrraapp returns true.
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
is false if any _s_i_g_s_p_e_c is invalid; otherwise ttrraapp returns true.
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 disk file, respectively. If the _n_a_m_e is not found,
then nothing is printed, and an exit status of false is re-
turned. If the --pp option is used, ttyyppee either returns the name
of the disk file that would be executed if _n_a_m_e were specified
as a command name, or nothing if ``type -t name'' would not re-
turn _f_i_l_e. The --PP option forces a PPAATTHH search for each _n_a_m_e,
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 disk file, respectively. If the _n_a_m_e is not found,
then nothing is printed, and an exit status of false is re-
turned. If the --pp option is used, ttyyppee either returns the name
of the disk file that would be executed if _n_a_m_e were specified
as a command name, or nothing if ``type -t name'' would not re-
turn _f_i_l_e. The --PP option forces a PPAATTHH search for each _n_a_m_e,
even if ``type -t name'' 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
used, ttyyppee prints all of the places that contain an executable
ily the file that appears first in PPAATTHH. If the --aa option is
used, ttyyppee prints all of the places that contain an executable
named _n_a_m_e. This includes aliases and functions, if and only if
the --pp option is not also used. The table of hashed commands is
not consulted when using --aa. The --ff option suppresses shell
not consulted when using --aa. The --ff option suppresses shell
function lookup, as with the ccoommmmaanndd builtin. ttyyppee returns 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 ("nice")
--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)
@@ -6306,134 +6315,134 @@ SSHHEELLLL 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 above. Otherwise, the return status is the exit status
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 above. 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-
fied as a set of options to the shopt builtin ( ccoommppaatt3311, ccoommppaatt3322,
ccoommppaatt4400, ccoommppaatt4411, and so on). There is only one current compatibil-
ity level -- each option is mutually exclusive. The compatibility
level is intended to allow users to select behavior from previous ver-
sions that is incompatible with newer versions while they migrate
scripts to use current features and behavior. It's intended to be a
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,
ccoommppaatt4400, ccoommppaatt4411, and so on). There is only one current compatibil-
ity level -- each option is mutually exclusive. The compatibility
level is intended to allow users to select behavior from previous ver-
sions that is incompatible with newer versions while they migrate
scripts to use current features and behavior. It's intended to be a
temporary solution.
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, Bash has begun deprecating older compatibility
levels. Eventually, the options will be removed in favor of BBAASSHH__CCOOMM--
Starting with bash-4.4, Bash has begun deprecating older compatibility
levels. Eventually, the options will be removed in favor of BBAASSHH__CCOOMM--
PPAATT.
Bash-5.0 is the final version for which there will be an individual
shopt option for the previous version. Users should use BBAASSHH__CCOOMMPPAATT on
Bash-5.0 is the final version for which there will be an individual
shopt option for the previous version. Users should use BBAASSHH__CCOOMMPPAATT on
bash-5.0 and later versions.
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
@@ -6441,114 +6450,114 @@ SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE
ator (=~) has no special effect
ccoommppaatt3322
+o 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 re-
ceived the interrupt, so interrupting one command in a
+o 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 re-
ceived the interrupt, so interrupting one command in a
list aborts the execution of the entire list)
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. Bash 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
+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 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.
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-
@@ -6557,28 +6566,28 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL
+o using the eexxeecc builtin command to replace the shell with another
command
+o adding or deleting builtin commands with the --ff and --dd options
+o adding or deleting builtin commands with the --ff and --dd options
to the eennaabbllee builtin command
+o using the eennaabbllee builtin command to enable disabled shell
+o using the eennaabbllee builtin command to enable disabled shell
builtins
+o specifying the --pp option to the ccoommmmaanndd builtin command
+o turning off restricted mode with sseett ++rr or sshhoopptt --uu rree--
+o turning off restricted mode with sseett ++rr or sshhoopptt --uu rree--
ssttrriicctteedd__sshheellll.
These restrictions are enforced after any startup files are read.
When a command that is found to be a shell script is executed (see CCOOMM--
MMAANNDD EEXXEECCUUTTIIOONN above), rrbbaasshh turns off any restrictions in the shell
MMAANNDD EEXXEECCUUTTIIOONN above), rrbbaasshh turns off any restrictions in the shell
spawned to execute the script.
SSEEEE AALLSSOO
_B_a_s_h _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l, Brian Fox and Chet Ramey
_T_h_e _G_n_u _R_e_a_d_l_i_n_e _L_i_b_r_a_r_y, Brian Fox and Chet Ramey
_T_h_e _G_n_u _H_i_s_t_o_r_y _L_i_b_r_a_r_y, Brian Fox and Chet Ramey
_P_o_r_t_a_b_l_e _O_p_e_r_a_t_i_n_g _S_y_s_t_e_m _I_n_t_e_r_f_a_c_e _(_P_O_S_I_X_) _P_a_r_t _2_: _S_h_e_l_l _a_n_d _U_t_i_l_i_-
_P_o_r_t_a_b_l_e _O_p_e_r_a_t_i_n_g _S_y_s_t_e_m _I_n_t_e_r_f_a_c_e _(_P_O_S_I_X_) _P_a_r_t _2_: _S_h_e_l_l _a_n_d _U_t_i_l_i_-
_t_i_e_s, IEEE --
http://pubs.opengroup.org/onlinepubs/9699919799/
http://tiswww.case.edu/~chet/bash/POSIX -- a description of posix mode
@@ -6596,10 +6605,10 @@ FFIILLEESS
_~_/_._b_a_s_h_r_c
The individual per-interactive-shell startup file
_~_/_._b_a_s_h___l_o_g_o_u_t
The individual login shell cleanup file, executed when a login
The individual login shell cleanup file, executed when a login
shell exits
_~_/_._b_a_s_h___h_i_s_t_o_r_y
The default value of HHIISSTTFFIILLEE, the file in which bash saves the
The default value of HHIISSTTFFIILLEE, the file in which bash saves the
command history
_~_/_._i_n_p_u_t_r_c
Individual _r_e_a_d_l_i_n_e initialization file
@@ -6613,15 +6622,15 @@ AAUUTTHHOORRSS
BBUUGG RREEPPOORRTTSS
If you find a bug in bbaasshh,, you should report it. But first, you should
make sure that it really is a bug, and that it appears in the latest
version of bbaasshh. The latest version is always available from
make sure that it really is a bug, and that it appears in the latest
version of bbaasshh. The latest version is always available from
_f_t_p_:_/_/_f_t_p_._g_n_u_._o_r_g_/_p_u_b_/_g_n_u_/_b_a_s_h_/ and _h_t_t_p_:_/_/_g_i_t_._s_a_v_a_n_-
_n_a_h_._g_n_u_._o_r_g_/_c_g_i_t_/_b_a_s_h_._g_i_t_/_s_n_a_p_s_h_o_t_/_b_a_s_h_-_m_a_s_t_e_r_._t_a_r_._g_z.
Once you have determined that a bug actually exists, use the _b_a_s_h_b_u_g
command to submit a bug report. If you have a fix, you are encouraged
to mail that as well! Suggestions and `philosophical' bug reports may
be mailed to _b_u_g_-_b_a_s_h_@_g_n_u_._o_r_g or posted to the Usenet newsgroup
Once you have determined that a bug actually exists, use the _b_a_s_h_b_u_g
command to submit a bug report. If you have a fix, you are encouraged
to mail that as well! Suggestions and `philosophical' bug reports may
be mailed to _b_u_g_-_b_a_s_h_@_g_n_u_._o_r_g or posted to the Usenet newsgroup
ggnnuu..bbaasshh..bbuugg.
ALL bug reports should include:
@@ -6632,7 +6641,7 @@ BBUUGG RREEPPOORRTTSS
A description of the bug behaviour
A short script or `recipe' which exercises the bug
_b_a_s_h_b_u_g inserts the first three items automatically into the template
_b_a_s_h_b_u_g inserts the first three items automatically into the template
it provides for filing a bug report.
Comments and bug reports concerning this manual page should be directed
@@ -6649,10 +6658,10 @@ BBUUGGSS
Shell builtin commands and functions are not stoppable/restartable.
Compound commands and command sequences of the form `a ; b ; c' are not
handled gracefully when process suspension is attempted. When a
process is stopped, the shell immediately executes the next command in
the sequence. It suffices to place the sequence of commands between
parentheses to force it into a subshell, which may be stopped as a
handled gracefully when process suspension is attempted. When a
process is stopped, the shell immediately executes the next command in
the sequence. It suffices to place the sequence of commands between
parentheses to force it into a subshell, which may be stopped as a
unit.
Array variables may not (yet) be exported.
@@ -6661,4 +6670,4 @@ BBUUGGSS
GNU Bash 5.2 2022 September 19 BASH(1)
GNU Bash 5.2 2022 December 2 BASH(1)