Bash-5.2-rc2 release

This commit is contained in:
Chet Ramey
2022-07-25 13:33:03 -04:00
parent 6c1407d2a9
commit f36c8c8ecd
77 changed files with 12062 additions and 10024 deletions
+43 -1
View File
@@ -1,3 +1,42 @@
This document details the changes between this version, bash-5.2-rc2, and
the previous version, bash-5.2-rc1.
1. Changes to Bash
a. Fixed a bug that could disable history saving after a compound array
assignment in an interactive shell.
b. Fixed a bug that could cause incorrect error messages when running a DEBUG
trap during a conditional or arithmetic command.
c. Fixed a bug that caused test to print an error message when given ! ! arg
as arguments.
d. Fixed a bug that resulted in incorrect error messages when completing a
backquoted command substitution.
e. Changed command substitution parsing to reproduce the original text more
closely when reconsituting the command string from the parsed command.
f. Fixed a bug that could cause an EXIT trap to use the wrong variable context
when the errexit option is set.
g. Fixed a bug that could cause the parser to incorrectly delimit a token when
an alias expansion ended with a multibyte character.
2. Changes to Readline
3. New Features in Bash
a. Since there is no `declare -' equivalent of `local -', make sure to use
`local -' in the output of `local -p'.
b. Null anchored matches in pattern substitution now process `&' in the
replacement string, like sed.
4. New Features in Readline
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.2-rc1, and
the previous version, bash-5.2-beta.
@@ -321,7 +360,10 @@ b. There is a new internal timer framework used for read builtin timeouts.
c. Rewrote the command substitution parsing code to call the parser recursively
and rebuild the command string from the parsed command. This allows better
syntax checking and catches errors much earlier.
syntax checking and catches errors much earlier. Along with this, if
command substitution parsing completes with here-documents remaining to be
read, the shell prints a warning message and reads the here-document bodies
from the current input stream.
d. The `ulimit' builtin now treats an operand remaining after all of the options
and arguments are parsed as an argument to the last command specified by
+487
View File
@@ -0,0 +1,487 @@
This document details the changes between this version, bash-5.2-rc2, and
the previous version, bash-5.2-rc1.
1. Changes to Bash
a. Fixed a bug that could disable history saving after a compound array
assignment in an interactive shell.
b. Fixed a bug that could cause incorrect error messages when running a DEBUG
trap during a conditional or arithmetic command.
c. Fixed a bug that caused test to print an error message when given ! ! arg
as arguments.
d. Fixed a bug that resulted in incorrect error messages when completing a
backquoted command substitution.
e. Changed command substitution parsing to reproduce the original text more
closely when reconsituting the command string from the parsed command.
f. Fixed a bug that could cause an EXIT trap to use the wrong variable context
when the errexit option is set.
g. Fixed a bug that could cause the parser to incorrectly delimit a token when
an alias expansion ended with a multibyte character.
2. Changes to Readline
3. New Features in Bash
a. Since there is no `declare -' equivalent of `local -', make sure to use
`local -' in the output of `local -p'.
b. Null anchored matches in pattern substitution now process `&' in the
replacement string, like sed.
4. New Features in Readline
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.2-rc1, and
the previous version, bash-5.2-beta.
1. Changes to Bash
a. Changes to `wait -p' and how it sets the variable name in the presence of
valid and invalid PID arguments.
b. Fixed a bug that caused compgen to dump core if the completion engine was
not initialized.
c. Fixed a memory leak in the variable name programmable completion code.
d. Here-documents and here-strings use tempfiles if the shell compatibility
level is 50 or lower.
e. Non-interactive shells exit on a syntax error encountered while parsing a
command substitution.
f. Fixed a bug with inherited parser state while parsing a command substitution.
g. Fixed a bug that caused the shell not to check for terminating signals
after executing the command_string supplied with `-c' and before executing
the exit trap.
h. Changes to avoid a make race condition while generating builtins.c.
i. Make it explicit that BASH_REMATCH is always a global variable, and that
local copies are (currently) ignored.
j. Fixed a bug that caused an ambiguous redirection (>&word) to be printed
incorrectly (>&word) if no file descriptor was supplied.
2. Changes to Readline
a. Fixed a bug that caused rl_eof_found to be set prematurely while reading a
multi-character key sequence in callback mode.
3. New Features in Bash
a. In posix mode, the `printf' builtin checks for the `L' length modifier and
uses long double for floating point conversion specifiers if it's present,
double otherwise.
b. The `globbing' completion code now takes the `globstar' option into account.
c. `suspend -f' now forces the shell to suspend even if job control is not
currently enabled.
4. New Features in Readline
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.2-beta, and
the previous version, bash-5.2-alpha.
1. Changes to Bash
a. Fixed a problem with command-oriented history and multi-line commands that
caused embedded blank lines to be run together.
b. Changed the way `&' is quoted when performing pattern substitution and
`patsub_replacement' is enabled.
c. Fixed some integer overflows when expanding strings or reading the output
of command substitution larger than 2GB.
d. `wait -p' without the `-n' option now does something useful if there are no
jobs.
e. Fixed an issue with read timeouts in posix mode.
f. Changed here-document processing to process $'...' and $"..." only when they
appear in the WORD portion of ${PARAM OP WORD} in the here-document body
and the body is being expanded.
g. Changed alias expansion in command substitution to be posix-conformant
(performed while initially parsing the command substitution) when in posix
mode.
h. Bash optimizes away more forks in subshells.
i. Here-document construction now performs quote removal on the here-document
delimiter only if it's marked as quoted, which prevents quote characters in
command substitutions from being removed.
j. Prompt string expansion now gives invisible characters in the expansion of
the \w, \W, and \s escape sequences a visible representation to avoid
problems with redisplay.
k. Fixed a problem with SIGINT during the execution of a command bound with
`bind -x' affecting the saved terminal settings.
l. Fixed an inconsistency with how $@ expands in a construct like ${@:+set}
or ${array[@]:+set} in the presence of null positional parameters or
array elements.
2. Changes to Readline
a. Prevent some display problems when running a command as the result of a
trap or one bound using `bind -x' and the command generates output.
b. Fixed an issue with multi-line prompt strings that have one or more
invisible characters at the end of a physical line.
c. Fixed an issue that caused a history line's undo list to be cleared when
it should not have been.
3. New Features in Bash
a. There is a new bindable readline command name: `vi-edit-and-execute-command'.
4. New Features in Readline
a. Two new bindable string variables: active-region-start-color and
active-region-end-color. The first sets the color used to display the
active region; the second turns it off. If set, these are used in place
of terminal standout mode.
b. New readline state (RL_STATE_EOF) and application-visible variable
(rl_eof_found) to allow applications to detect when readline reads EOF
before calling the deprep-terminal hook.
c. There is a new configuration option: --with-shared-termcap-library, which
forces linking the shared readline library with the shared termcap (or
curses/ncurses/termlib) library so applications don't have to do it.
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.2-alpha, and
the previous version, bash-5.1-release.
1. Changes to Bash
a. Fixed a bug that assigned a value to the variable name supplied as an
argument to `wait -p' when there were no jobs.
b. Fixed a bug that resulted in performing incorrect word expansion on the
key/value pairs in a compound array assignment.
c. Fixed a bug that could put the child forked to run a command substitution
into the wrong process group.
d. Fixed a problem that could cause the lastpipe option to work incorrectly if
file descriptor 0 was closed.
e. Bash tries to suppress traps if a forked child receives a trapped signal
before it has a chance to reset its signal handlers.
f. Fixed several memory leaks in compound array assignments.
g. Fixed a problem with performing an assignment with `+=' to an array element
that was the value of a nameref.
h. Fixed a bug that could cause a nameref containing an array reference using
`@' or `*' not to expand to multiple words.
i. Fixed a bug where extended glob functions could match `.' or `..' when it
wasn't explicitly specified, even if dotglob was set.
j. Fixed a bug that caused non-interactive posix-mode shells not to exit on a
variable assignment error while assigning into the temporary environment.
k. Fixed a bug that caused parsing errors if an alias contained a compound
array assignment.
l. Fixed a couple of instances where bash checked syntax too aggressively when
trying to determine how to add a partial command to command-oriented
history.
m. Fixed a parser problem that caused it not to allow reserved words to follow
the `((' and `[[' commands.
n. Fixed a bad offset calculation when using negative offsets to `history -d'.
o. Fixed an off-by-one error that caused a read past the end of a buffer when
reading a multibyte character from the output of a command substitution.
p. Fixed a problem with a failed `exec' command not setting $? to the right
value for an exit trap.
q. Fixed a problem that caused bash not to unlink FIFOs created as part of
expanding redirections for an external command.
r. Fixed a bug that could cause aliases not to be expanded in case statements.
s. Fixed a bug that could cause word completion to attempt programmable
completion for the target of a redirection, instead of filename completion.
t. Fixed a bug that could result in errors after rebinding a key sequence with
`bind -x' multiple times.
u. Fixed a problem that could result in not quoting the result when performing
command name completion with a glob pattern in the command name.
v. `mapfile' now uses fully-buffered reads in more cases, which should improve
bulk read performance.
w. Fixed a bug that caused `wait -n' to not reset its internal state when
interrupted by a signal, resulting in subsequent calls failing.
x. Fixed a bug with parsing numeric arguments to readline key sequences
installed with `bind -x'.
y. Bash suppresses forking in several additional cases, including most uses
of $(<file).
z. If there are multiple `!' tokens in a [[ command, toggle the invert state
instead of setting it unconditionally.
aa. Fixed a bug where running `fc' on an empty history list would cause the
shell to crash.
bb. Word completion now checks whether or not a quote character closes a
quoted string begun on a previous line, so readline doesn't interpret the
quote as starting a new quoted string.
cc. Fixed a typo that translated \UNNNNNNNN characters that were not valid in
the current locale encoding as \uNNNNNNNN.
dd. Fixed an issue that could cause bash to print timing statistics for the
wrong command when `set -e' causes a command to fail.
ee. Bash now runs the exit trap in function context if a failed command in
the function causes the shell to exit.
ff. Some fixes to how subshells modify $SHLVL.
gg. Fixed a bug that caused `mapfile -t' not to remove the delimiter when the
delimiter is > 128 in the current encoding.
hh. Fixed a problem that could cause the shell to attempt to free unallocated
memory if an expansion error occurred.
ii. Fixed a bug in the bash malloc implementation of malloc_usable_size. Bash
did not use it, but it could cause problems with library functions that
did.
jj. If the `exec' builtin fails, and the shell does not exit, it restores
trapped signals to their trapped state.
kk. Fixed a bug that could cause variable assignment arguments to `declare' to
expand variables using attributes that the call to declare was turning off.
ll. Fixed a bug with LINENO and arithmetic for commands.
mm. Fixed a posix-mode bug that caused tildes not to be expanded after an
unquoted colon on the right side of an assignment statement.
nn. Fixed a problem with `caller' and line numbers when executing an ERR trap.
oo. Fixed a problem that could make the value returned by ${a:=b} not be the
final value assigned to a (e.g., if `a' has an attribute that modifies
the value on assignment).
pp. Fixed a problem with saving multi-line here-documents to the history list
where the here-document delimiter does not appear on the first line.
qq. Fixed a bug with using += to assign to dynamic variables like RANDOM.
rr. Fixed a bug that caused `set -n' to modify $? if set after execution had
started.
ss. Builtins like printf/read/wait now behave more consistently when assigning
arbitrary keys to associative arrays (like `]'. when appropriately quoted).
tt. Fixed a problem with here-document collection printing the wrong prompt
when parsing a compound list in an interactive shell.
uu. Fixed a problem with quoting shell expansion characters (like `$') when
they appear in a tab-completed word along with characters that do need
quoting (e.g.. $HOME/VirtualBox VMs).
2. Changes to Readline
a. Fixed a problem with cleaning up active marks when using callback mode.
b. Fixed a problem with arithmetic comparison operators checking the version.
c. Fixed a problem that could cause readline not to build on systems without
POSIX signal functions.
d. Fixed a bug that could cause readline to crash if the application removed
the callback line handler before readline read all typeahead.
e. Added additional checks for read errors in the middle of readline commands.
f. Fixed a redisplay problem that occurred when switching from the digit-
argument prompt `(arg: N)' back to the regular prompt and the regular
prompt contained invisible characters.
g. Fixed a problem with restoring the prompt when aborting an incremental
search.
h. Fix a problem with characters > 128 not being displayed correctly in certain
single-byte encodings.
i. Fixed a problem with unix-filename-rubout that caused it to delete too much
when applied to a pathname consisting only of one or more slashes.
j. Fixed a display problem that caused the prompt to be wrapped incorrectly if
the screen changed dimensions during a call to readline() and the prompt
became longer than the screen width.
k. Fixed a problem that caused the \r output by turning off bracketed paste
to overwrite the line if terminal echo was disabled.
l. Fixed a bug that could cause colored-completion-prefix to not display if
completion-prefix-display-length was set.
m. Fixed a problem with line wrapping prompts when a group of invisible
characters runs to the right edge of the screen and the prompt extends
longer then the screen width.
n. Fixed a couple problems that could cause rl_end to be set incorrectly by
transpose-words.
3. New Features in Bash
a. The bash malloc returns memory that is aligned on 16-byte boundaries.
b. There is a new internal timer framework used for read builtin timeouts.
c. Rewrote the command substitution parsing code to call the parser recursively
and rebuild the command string from the parsed command. This allows better
syntax checking and catches errors much earlier. Along with this, if
command substitution parsing completes with here-documents remaining to be
read, the shell prints a warning message and reads the here-document bodies
from the current input stream.
d. The `ulimit' builtin now treats an operand remaining after all of the options
and arguments are parsed as an argument to the last command specified by
an option. This is for POSIX compatibility.
e. Here-document parsing now handles $'...' and $"..." quoting when reading the
here-document body.
f. The `shell-expand-line' and `history-and-alias-expand-line' bindable readline
commands now understand $'...' and $"..." quoting.
g. There is a new `spell-correct-word' bindable readline command to perform
spelling correction on the current word.
h. The `unset' builtin now attempts to treat arguments as array subscripts
without parsing or expanding the subscript, even when `assoc_expand_once'
is not set.
i. There is a default value for $BASH_LOADABLES_PATH in config-top.h.
j. Associative array assignment and certain instances of referencing (e.g.,
`test -v') now allow `@' and `*' to be used as keys.
k. Bash attempts to expand indexed and associative array subscripts only
once when executing shell constructs and word expansions.
l. The `unset' builtin allows a subscript of `@' or `*' to unset a key with
that value for associative arrays instead of unsetting the entire array
(which you can still do with `unset arrayname'). For indexed arrays, it
removes all elements of the array without unsetting it (like `A=()').
m. Additional builtins (printf/test/read/wait) do a better job of not
parsing array subscripts if array_expand_once is set.
n. New READLINE_ARGUMENT variable set to numeric argument for readline commands
defined using `bind -x'.
o. The new `varredir_close' shell option causes bash to automatically close
file descriptors opened with {var}<fn and other styles of varassign
redirection unless they're arguments to the `exec' builtin.
p. The `$0' special parameter is now set to the name of the script when running
any (non-interactive) startup files such as $BASH_ENV.
q. The `enable' builtin tries to load a loadable builtin using the default
search path if `enable name' (without any options) attempts to enable a
non-existent builtin.
r. The `printf' builtin has a new format specifier: %Q. This acts like %q but
applies any specified precision to the original unquoted argument, then
quotes and outputs the result.
s. The new `noexpand_translations' option controls whether or not the translated
output of $"..." is single-quoted.
t. There is a new parameter transformation operator: @k. This is like @K, but
expands the result to separate words after word splitting.
u. There is an alternate array implementation, selectable at `configure' time,
that optimizes access speed over memory use (use the new configure
--enable-alt-array-implementation option).
v. If an [N]<&WORD- or [N]>&WORD- redirection has WORD expand to the empty
string, treat the redirection as [N]<&- or [N]>&- and close file descriptor
N (default 0).
w. Invalid parameter transformation operators are now invalid word expansions,
and so cause fatal errors in non-interactive shells.
x. New shell option: patsub_replacement. When enabled, a `&' in the replacement
string of the pattern substitution expansion is replaced by the portion of
the string that matched the pattern. Backslash will escape the `&' and
insert a literal `&'.
y. `command -p' no longer looks in the hash table for the specified command.
z. The new `--enable-translatable-strings' option to `configure' allows $"..."
support to be compiled in or out.
aa. The new `globskipdots' shell option forces pathname expansion never to
return `.' or `..' unless explicitly matched.
bb. Array references using `@' and `*' that are the value of nameref variables
(declare -n ref='v[@]' ; echo $ref) no longer cause the shell to exit if
set -u is enabled and the array (v) is unset.
4. New Features in Readline
a. There is now an HS_HISTORY_VERSION containing the version number of the
history library for applications to use.
b. History expansion better understands multiple history expansions that may
contain strings that would ordinarily inhibit history expansion (e.g.,
`abc!$!$').
c. There is a new framework for readline timeouts, including new public
functions to set timeouts and query how much time is remaining before a
timeout hits, and a hook function that can trigger when readline times
out. There is a new state value to indicate a timeout.
d. Automatically bind termcap key sequences for page-up and page-down to
history-search-backward and history-search-forward, respectively.
e. There is a new `fetch-history' bindable command that retrieves the history
entry corresponding to its numeric argument. Negative arguments count back
from the end of the history.
f. `vi-undo' is now a bindable command.
g. There is a new option: `enable-active-region'. This separates control of
the active region and bracketed-paste. It has the same default value as
bracketed-paste, and enabling bracketed paste enables the active region.
Users can now turn off the active region while leaving bracketed paste
enabled.
h. rl_completer_word_break_characters is now `const char *' like
rl_basic_word_break_characters.
i. Readline looks in $LS_COLORS for a custom filename extension
(*.readline-colored-completion-prefix) and uses that as the default color
for the common prefix displayed when `colored-completion-prefix' is set.
+135
View File
@@ -3686,3 +3686,138 @@ print_cmd.c
----
configure.ac
- bumped version to bash-5.2-rc1
[bash-5.2-rc1 released]
6/15
----
parse.y
- parse_string_to_word_list: save the parser state before any state-
changing functions like bash_history_disable(). Reported by
Clark Wang <dearvoid@gmail.com>
6/16
----
doc/bash.1
- play tricks with the value of the zZ number register to refer to
`bash(1)' instead of `above' or `below' when creating the builtins
man page
6/17
----
doc/{bash.1,bashref.texi}
- wait: note that wait will return > 128 if interrupted by a signal.
Reported by AA <aathan_github@memeplex.com>
execute_cmd.c
- {execute_cond_node,execute_arith_command,eval_arith_for_expr}: make
sure to reset this_command_name after running any DEBUG trap so the
DEBUG trap doesn't overwrite it.
Reported by Emanuele Torre <torreemanuele6@gmail.com>.
- execute_select_command: set this_command_name to NULL after running
any DEBUG trap like execute_for_command does
6/23
----
test.c
- three_arguments: when given [ ! ! arg ], make sure to advance POS
after calling two_arguments to avoid a `too many arguments' error.
Report from Steffen Nurpmeso <steffen@sdaoden.eu>
6/27
----
subst.c
- expand_word_internal: when expanding backquoted command substitution,
call string_extract with the SX_REQMATCH flag (closing backquote
required) only if the word flags don't contain W_COMPLETE,
indicating that we're doing this for completion, probably to
determine whether or not to append something to the word. Fixes bug
reported by Emanuele Torre <torreemanuele6@gmail.com>.
7/5
---
execute_cmd.c
- execute_connection: treat a connector of '\n' the same as ';'
print_cmd.c
- print_comsub: new function, sets flag noting we are printing a
command substitution and calls make_command_string
- make_command_string_internal: add '\n' to the ';' case; print command
list with newline connector appropriately
parse.y
- parse_comsub: call print_comsub instead of make_command_string
- list1 production (part of compound_list): if a list is separated by
newlines, and the parser is parsing a command substitution, make
the connection command with a '\n' connector. Makes the text
output of parse_comsub closer to the original source text. From a
report from Martijn Dekker <martijn@inlv.org>
7/6
---
doc/bash.1,lib/readline/doc/rluser.texi
- complete: add note about arguments passed to command specified by
`complete -C'; suggested by Mark Chandler <mcp@synq.so>
builtins/setattr.def
- show_local_var_attributes: special-case `local -', since there is
no `declare -' equivalent.
Reported by Emanuele Torre <torreemanuele6@gmail.com>.
- show_all_var_attributes: use `local -' when printing a variable named
`-' at the current non-zero variable context
parse.y
- shell_getc: if we are at the end of an alias, returning a space,
make sure we mark the previous character as single-byte by modifying
shell_input_line_property so the space we return is properly
recognized. This would fail before if the last character of the
alias was a multi-byte character. Reported by
Vangelis Natsios <vnatsios@gmail.com>
7/12
----
lib/readline/isearch.c
- rl_display_search: don't call rl_redisplay_function before returning;
rl_message already calls it. Reported by
Frédéric Moulins <frederic@moulins.org>
configure.ac
- bumped version to bash-5.2-rc2
7/18
----
jobs.c
- set_job_control: don't bother calling tcgetpgrp if shell_tty < 0,
since it will just fail
variables.c
- reset_local_contexts: new function, delete all context tables
associated with shell functions and set variable_context to 0.
Called when we want to stop executing in a shell function without
going through the pop_context chain with its side effects
variables.h
- reset_local_contexts: extern declaration
builtins/evalstring.c
- parse_and_execute: call reset_local_contexts instead of setting
variable_context to 0
eval.c
- reader_loop: call reset_local_contexts in cases where the shell has
longjmped for a fatal error and errexit is enabled (ERREXIT), but
not for other cases, and especially not for the exit builtin,
instead of just setting variable_context to 0. Fixes issue originally
reported by Robert Stoll <robert.stoll@tegonal.com>
subst.c
- pat_subst: implement sed-like behavior when presented with a null
pattern that's anchored at the start or end of the string, or when
presented with a null string: process the replacement string for `&'
and `\&' and substitute in the result as before. Patch from
Koichi Murase <myoga.murase@gmail.com>
7/20
----
[bash-5.2-rc2 frozen]
+2
View File
@@ -890,6 +890,7 @@ tests/alias2.sub f
tests/alias3.sub f
tests/alias4.sub f
tests/alias5.sub f
tests/alias6.sub f
tests/alias.right f
tests/appendop.tests f
tests/appendop1.sub f
@@ -1077,6 +1078,7 @@ tests/errors5.sub f
tests/errors6.sub f
tests/errors7.sub f
tests/errors8.sub f
tests/errors9.sub f
tests/execscript f
tests/exec.right f
tests/exec1.sub f 755
-1
View File
@@ -627,7 +627,6 @@ valgrind:
gcov:
${MAKE} ${MFLAGS} CFLAGS=-g ADDON_CFLAGS='${GCOV_XCFLAGS}' ADDON_LDFLAGS='${GCOV_XLDFLAGS}' .made
# have to make this separate because making tests depend on $(PROGRAM)
asan-tests: asan $(TESTS_SUPPORT)
@-test -d tests || mkdir tests
+7 -1
View File
@@ -10,7 +10,10 @@ b. There is a new internal timer framework used for read builtin timeouts.
c. Rewrote the command substitution parsing code to call the parser recursively
and rebuild the command string from the parsed command. This allows better
syntax checking and catches errors much earlier.
syntax checking and catches errors much earlier. Along with this, if
command substitution parsing completes with here-documents remaining to be
read, the shell prints a warning message and reads the here-document bodies
from the current input stream.
d. The `ulimit' builtin now treats an operand remaining after all of the options
and arguments are parsed as an argument to the last command specified by
@@ -109,6 +112,9 @@ ee. The `globbing' completion code now takes the `globstar' option into account.
ff. `suspend -f' now forces the shell to suspend even if job control is not
currently enabled.
gg. Since there is no `declare -' equivalent of `local -', make sure to use
`local -' in the output of `local -p'.
2. New Features in Readline
a. There is now an HS_HISTORY_VERSION containing the version number of the
+165
View File
@@ -0,0 +1,165 @@
This is a terse description of the new features added to bash-5.2 since
the release of bash-5.1. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.
1. New Features in Bash
a. The bash malloc returns memory that is aligned on 16-byte boundaries.
b. There is a new internal timer framework used for read builtin timeouts.
c. Rewrote the command substitution parsing code to call the parser recursively
and rebuild the command string from the parsed command. This allows better
syntax checking and catches errors much earlier. Along with this, if
command substitution parsing completes with here-documents remaining to be
read, the shell prints a warning message and reads the here-document bodies
from the current input stream.
d. The `ulimit' builtin now treats an operand remaining after all of the options
and arguments are parsed as an argument to the last command specified by
an option. This is for POSIX compatibility.
e. Here-document parsing now handles $'...' and $"..." quoting when reading the
here-document body.
f. The `shell-expand-line' and `history-and-alias-expand-line' bindable readline
commands now understand $'...' and $"..." quoting.
g. There is a new `spell-correct-word' bindable readline command to perform
spelling correction on the current word.
h. The `unset' builtin now attempts to treat arguments as array subscripts
without parsing or expanding the subscript, even when `assoc_expand_once'
is not set.
i. There is a default value for $BASH_LOADABLES_PATH in config-top.h.
j. Associative array assignment and certain instances of referencing (e.g.,
`test -v' now allow `@' and `*' to be used as keys.
k. Bash attempts to expand indexed array subscripts only once when executing
shell constructs and word expansions.
l. The `unset' builtin allows a subscript of `@' or `*' to unset a key with
that value for associative arrays instead of unsetting the entire array
(which you can still do with `unset arrayname'). For indexed arrays, it
removes all elements of the array without unsetting it (like `A=()').
m. Additional builtins (printf/test/read/wait) do a better job of not
parsing array subscripts if array_expand_once is set.
n. New READLINE_ARGUMENT variable set to numeric argument for readline commands
defined using `bind -x'.
o. The new `varredir_close' shell option causes bash to automatically close
file descriptors opened with {var}<fn and other styles of varassign
redirection unless they're arguments to the `exec' builtin.
p. The `$0' special parameter is now set to the name of the script when running
any (non-interactive) startup files such as $BASH_ENV.
q. The `enable' builtin tries to load a loadable builtin using the default
search path if `enable name' (without any options) attempts to enable a
non-existent builtin.
r. The `printf' builtin has a new format specifier: %Q. This acts like %q but
applies any specified precision to the original unquoted argument, then
quotes and outputs the result.
s. The new `noexpand_translations' option controls whether or not the translated
output of $"..." is single-quoted.
t. There is a new parameter transformation operator: @k. This is like @K, but
expands the result to separate words after word splitting.
u. There is an alternate array implementation, selectable at `configure' time,
that optimizes access speed over memory use (use the new configure
--enable-alt-array-implementation option).
v. If an [N]<&WORD- or [N]>&WORD- redirection has WORD expand to the empty
string, treat the redirection as [N]<&- or [N]>&- and close file descriptor
N (default 0).
w. Invalid parameter transformation operators are now invalid word expansions,
and so cause fatal errors in non-interactive shells.
x. New shell option: patsub_replacement. When enabled, a `&' in the replacement
string of the pattern substitution expansion is replaced by the portion of
the string that matched the pattern. Backslash will escape the `&' and
insert a literal `&'.
y. `command -p' no longer looks in the hash table for the specified command.
z. The new `--enable-translatable-strings' option to `configure' allows $"..."
support to be compiled in or out.
aa. The new `globskipdots' shell option forces pathname expansion never to
return `.' or `..' unless explicitly matched.
bb. Array references using `@' and `*' that are the value of nameref variables
(declare -n ref='v[@]' ; echo $ref) no longer cause the shell to exit if
set -u is enabled and the array (v) is unset.
cc. There is a new bindable readline command name:
`vi-edit-and-execute-command'.
dd. In posix mode, the `printf' builtin checks for the `L' length modifier and
uses long double for floating point conversion specifiers if it's present,
double otherwise.
ee. The `globbing' completion code now takes the `globstar' option into account.
ff. `suspend -f' now forces the shell to suspend even if job control is not
currently enabled.
gg. Since there is no `declare -' equivalent of `local -', make sure to use
`local -' in the output of `local -p'.
2. New Features in Readline
a. There is now an HS_HISTORY_VERSION containing the version number of the
history library for applications to use.
b. History expansion better understands multiple history expansions that may
contain strings that would ordinarily inhibit history expansion (e.g.,
`abc!$!$').
c. There is a new framework for readline timeouts, including new public
functions to set timeouts and query how much time is remaining before a
timeout hits, and a hook function that can trigger when readline times
out. There is a new state value to indicate a timeout.
d. Automatically bind termcap key sequences for page-up and page-down to
history-search-backward and history-search-forward, respectively.
e. There is a new `fetch-history' bindable command that retrieves the history
entry corresponding to its numeric argument. Negative arguments count back
from the end of the history.
f. `vi-undo' is now a bindable command.
g. There is a new option: `enable-active-region'. This separates control of
the active region and bracketed-paste. It has the same default value as
bracketed-paste, and enabling bracketed paste enables the active region.
Users can now turn off the active region while leaving bracketed paste
enabled.
h. rl_completer_word_break_characters is now `const char *' like
rl_basic_word_break_characters.
i. Readline looks in $LS_COLORS for a custom filename extension
(*.readline-colored-completion-prefix) and uses that as the default color
for the common prefix displayed when `colored-completion-prefix' is set.
j. Two new bindable string variables: active-region-start-color and
active-region-end-color. The first sets the color used to display the
active region; the second turns it off. If set, these are used in place
of terminal standout mode.
k. New readline state (RL_STATE_EOF) and application-visible variable
(rl_eof_found) to allow applications to detect when readline reads EOF
before calling the deprep-terminal hook.
l. There is a new configuration option: --with-shared-termcap-library, which
forces linking the shared readline library with the shared termcap (or
curses/ncurses/termlib) library so applications don't have to do it.
+3 -1
View File
@@ -363,12 +363,14 @@ parse_and_execute (string, from_file, flags)
these circumstances. Don't bother with cleanup here because
we don't want to run the function execution cleanup stuff
that will cause pop_context and other functions to run.
We call reset_local_contexts() instead, which just frees
context memory.
XXX - change that if we want the function context to be
unwound. */
if (exit_immediately_on_error && variable_context)
{
discard_unwind_frame ("pe_dispose");
variable_context = 0; /* not in a function */
reset_local_contexts (); /* not in a function */
}
should_jump_to_top_level = 1;
goto out;
+6 -4
View File
@@ -250,7 +250,7 @@ printf_builtin (list)
WORD_LIST *list;
{
int ch, fieldwidth, precision;
int have_fieldwidth, have_precision, use_Lmod;
int have_fieldwidth, have_precision, use_Lmod, altform;
char convch, thisch, nextch, *format, *modstart, *precstart, *fmt, *start;
#if defined (HANDLE_MULTIBYTE)
char mbch[25]; /* 25 > MB_LEN_MAX, plus can handle 4-byte UTF-8 and large Unicode characters*/
@@ -341,7 +341,7 @@ printf_builtin (list)
for (fmt = format; *fmt; fmt++)
{
precision = fieldwidth = 0;
have_fieldwidth = have_precision = 0;
have_fieldwidth = have_precision = altform = 0;
precstart = 0;
if (*fmt == '\\')
@@ -379,9 +379,11 @@ printf_builtin (list)
continue;
}
/* found format specification, skip to field width */
/* Found format specification, skip to field width. We check for
alternate form for possible later use. */
for (; *fmt && strchr(SKIP1, *fmt); ++fmt)
;
if (*fmt == '#')
altform++;
/* Skip optional field width. */
if (*fmt == '*')
+10 -2
View File
@@ -363,7 +363,11 @@ show_all_var_attributes (v, nodefs)
for (i = any_failed = 0; var = variable_list[i]; i++)
{
show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
/* There is no equivalent `declare -'. */
if (variable_context && var->context == variable_context && STREQ (var->name, "-"))
printf ("local -\n");
else
show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
if (any_failed = sh_chkwrite (any_failed))
break;
}
@@ -387,7 +391,11 @@ show_local_var_attributes (v, nodefs)
for (i = any_failed = 0; var = variable_list[i]; i++)
{
show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
/* There is no equivalent `declare -'. */
if (STREQ (var->name, "-"))
printf ("local -\n");
else
show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
if (any_failed = sh_chkwrite (any_failed))
break;
}
Vendored
+12 -12
View File
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac for Bash 5.2, version 5.041.
# From configure.ac for Bash 5.2, version 5.043.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for bash 5.2-rc1.
# Generated by GNU Autoconf 2.71 for bash 5.2-rc2.
#
# Report bugs to <bug-bash@gnu.org>.
#
@@ -612,8 +612,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bash'
PACKAGE_TARNAME='bash'
PACKAGE_VERSION='5.2-rc1'
PACKAGE_STRING='bash 5.2-rc1'
PACKAGE_VERSION='5.2-rc2'
PACKAGE_STRING='bash 5.2-rc2'
PACKAGE_BUGREPORT='bug-bash@gnu.org'
PACKAGE_URL=''
@@ -1467,7 +1467,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures bash 5.2-rc1 to adapt to many kinds of systems.
\`configure' configures bash 5.2-rc2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1533,7 +1533,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bash 5.2-rc1:";;
short | recursive ) echo "Configuration of bash 5.2-rc2:";;
esac
cat <<\_ACEOF
@@ -1740,7 +1740,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bash configure 5.2-rc1
bash configure 5.2-rc2
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2397,7 +2397,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by bash $as_me 5.2-rc1, which was
It was created by bash $as_me 5.2-rc2, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
@@ -3176,7 +3176,7 @@ ac_config_headers="$ac_config_headers config.h"
BASHVERS=5.2
RELSTATUS=rc1
RELSTATUS=rc2
case "$RELSTATUS" in
alp*|bet*|dev*|rc*|releng*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
@@ -5317,7 +5317,7 @@ CFLAGS=${CFLAGS-"$AUTO_CFLAGS"}
if test "$opt_profiling" = "yes"; then
PROFILE_FLAGS=-pg
case "$host_os" in
solaris2*|linux*) ;;
solaris2*|linux*|darwin*) ;;
*) opt_static_link=yes ;;
esac
DEBUG= MALLOC_DEBUG=
@@ -22369,7 +22369,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by bash $as_me 5.2-rc1, which was
This file was extended by bash $as_me 5.2-rc2, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -22437,7 +22437,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
bash config.status 5.2-rc1
bash config.status 5.2-rc2
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
+3 -3
View File
@@ -21,10 +21,10 @@ dnl Process this file with autoconf to produce a configure script.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AC_REVISION([for Bash 5.2, version 5.041])dnl
AC_REVISION([for Bash 5.2, version 5.043])dnl
define(bashvers, 5.2)
define(relstatus, rc1)
define(relstatus, rc2)
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
@@ -497,7 +497,7 @@ dnl these must come after the test for cc/gcc
if test "$opt_profiling" = "yes"; then
PROFILE_FLAGS=-pg
case "$host_os" in
solaris2*|linux*) ;;
solaris2*|linux*|darwin*) ;;
*) opt_static_link=yes ;;
esac
DEBUG= MALLOC_DEBUG=
+872 -869
View File
File diff suppressed because it is too large Load Diff
+130 -51
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Fri Jun 3 10:47:26 EDT 2022
.\" Last Change: Thu Jun 16 17:10:54 EDT 2022
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2022 June 3" "GNU Bash 5.2"
.TH BASH 1 "2022 June 16" "GNU Bash 5.2"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -864,21 +864,24 @@ that is executed, or false if any of the expressions is invalid.
.TP
\fBselect\fP \fIname\fP [ \fBin\fP \fIword\fP ] ; \fBdo\fP \fIlist\fP ; \fBdone\fP
The list of words following \fBin\fP is expanded, generating a list
of items. The set of expanded words is printed on the standard
of items, and the set of expanded words is printed on the standard
error, each preceded by a number. If the \fBin\fP
\fIword\fP is omitted, the positional parameters are printed (see
.SM
.B PARAMETERS
below). The
below).
.B select
then displays the
.SM
.B PS3
prompt is then displayed and a line read from the standard input.
prompt and reads a line from the standard input.
If the line consists of a number corresponding to one of
the displayed words, then the value of
.I name
is set to that word. If the line is empty, the words and prompt
are displayed again. If EOF is read, the command completes. Any
other value read causes
is set to that word.
If the line is empty, the words and prompt are displayed again.
If EOF is read, the \fBselect\fP command completes and returns 1.
Any other value read causes
.I name
to be set to null. The line read is saved in the variable
.SM
@@ -8083,7 +8086,9 @@ If any of \fB\-D\fP, \fB\-E\fP, or \fB\-I\fP are supplied, any other
specified by the option.
.sp 1
The process of applying these completion specifications when word completion
is attempted is described above under \fBProgrammable Completion\fP.
is attempted is described
.ie \n(zZ=1 in \fIbash(1)\fP.
.el above under \fBProgrammable Completion\fP.
.sp 1
Other options, if specified, have the following meanings.
The arguments to the \fB\-G\fP, \fB\-W\fP, and \fB\-X\fP options
@@ -8218,6 +8223,7 @@ Names of all shell variables. May also be specified as \fB\-v\fP.
\fB\-C\fP \fIcommand\fP
\fIcommand\fP is executed in a subshell environment, and its output is
used as the possible completions.
Arguments are passed as with the \fB\-F\fP option.
.TP 8
\fB\-F\fP \fIfunction\fP
The shell function \fIfunction\fP is executed in the current shell
@@ -8371,12 +8377,14 @@ to give variables attributes:
.B \-a
Each \fIname\fP is an indexed array variable (see
.B Arrays
above).
.ie \n(zZ=1 in \fIbash(1)\fP).
.el above).
.TP
.B \-A
Each \fIname\fP is an associative array variable (see
.B Arrays
above).
.ie \n(zZ=1 in \fIbash(1)\fP).
.el above).
.TP
.B \-f
Use function names only.
@@ -8385,7 +8393,9 @@ Use function names only.
The variable is treated as an integer; arithmetic evaluation (see
.SM
.B "ARITHMETIC EVALUATION"
above) is performed when the variable is assigned a value.
.ie \n(zZ=1 in \fIbash(1)\fP)
.el above)
is performed when the variable is assigned a value.
.TP
.B \-l
When the variable is assigned a value, all upper-case characters are
@@ -8448,7 +8458,9 @@ an attempt is made to assign a value to a readonly variable,
an attempt is made to assign a value to an array variable without
using the compound assignment syntax (see
.B Arrays
above), one of the \fInames\fP is not a valid shell variable name,
.ie \n(zZ=1 in \fIbash(1)\fP),
.el above),
one of the \fInames\fP is not a valid shell variable name,
an attempt is made to turn off readonly status for a readonly variable,
an attempt is made to turn off array status for an array variable,
or an attempt is made to display a non-existent function with \fB\-f\fP.
@@ -9233,7 +9245,8 @@ Each
is an arithmetic expression to be evaluated (see
.SM
.B "ARITHMETIC EVALUATION"
above).
.ie \n(zZ=1 in \fIbash(1)\fP).
.el above).
If the last
.I arg
evaluates to 0,
@@ -9544,7 +9557,10 @@ invalid option is supplied.
\fBread\fP [\fB\-ers\fP] [\fB\-a\fP \fIaname\fP] [\fB\-d\fP \fIdelim\fP] [\fB\-i\fP \fItext\fP] [\fB\-n\fP \fInchars\fP] [\fB\-N\fP \fInchars\fP] [\fB\-p\fP \fIprompt\fP] [\fB\-t\fP \fItimeout\fP] [\fB\-u\fP \fIfd\fP] [\fIname\fP ...]
One line is read from the standard input, or from the file descriptor
\fIfd\fP supplied as an argument to the \fB\-u\fP option,
split into words as described above under \fBWord Splitting\fP,
split into words as described
.ie \n(zZ=1 in \fIbash(1)\fP
.el above
under \fBWord Splitting\fP,
and the first word
is assigned to the first
.IR name ,
@@ -9560,7 +9576,10 @@ The characters in
.SM
.B IFS
are used to split the line into words using the same rules the shell
uses for expansion (described above under \fBWord Splitting\fP).
uses for expansion (described
.ie \n(zZ=1 in \fIbash(1)\fP
.el above
under \fBWord Splitting\fP).
The backslash character (\fB\e\fP) may be used to remove any special
meaning for the next character read and for line continuation.
Options, if supplied, have the following meanings:
@@ -9589,7 +9608,9 @@ is coming from a terminal,
(see
.SM
.B READLINE
above) is used to obtain the line.
.ie \n(zZ=1 in \fIbash(1)\fP)
.el above)
is used to obtain the line.
Readline uses the current (or default, if line editing was not previously
active) editing settings, but uses Readline's default filename completion.
.TP
@@ -9779,7 +9800,9 @@ or a \fIcompound command\fP
(see
.SM
.B SHELL GRAMMAR
above), exits with a non-zero status.
.ie \n(zZ=1 in \fIbash(1)\fP),
.el above),
exits with a non-zero status.
The shell does not exit if the
command that fails is part of the command list immediately following a
.B while
@@ -9807,7 +9830,9 @@ This option applies to the shell environment and each subshell environment
separately (see
.SM
.B "COMMAND EXECUTION ENVIRONMENT"
above), and may cause
.ie \n(zZ=1 in \fIbash(1)\fP),
.el above),
and may cause
subshells to exit before executing all the commands in the subshell.
.if t .sp 0.5
.if n .sp 1
@@ -9839,7 +9864,8 @@ by default for interactive shells on systems that support
it (see
.SM
.B JOB CONTROL
above).
.ie \n(zZ=1 in \fIbash(1)\fP).
.el above).
All processes run in a separate process group.
When a background job completes, the shell prints a line
containing its exit status.
@@ -9890,7 +9916,10 @@ Same as
.BR \-H .
.TP 8
.B history
Enable command history, as described above under
Enable command history, as described
.ie \n(zZ=1 in \fIbash(1)\fP
.el above
under
.SM
.BR HISTORY .
This option is on by default in interactive shells.
@@ -9902,7 +9931,8 @@ The effect is as if the shell command
had been executed
(see
.B Shell Variables
above).
.ie \n(zZ=1 in \fIbash(1)\fP).
.el above).
.TP 8
.B keyword
Same as
@@ -9957,7 +9987,9 @@ from the POSIX standard to match the standard (\fIposix mode\fP).
See
.SM
.B "SEE ALSO"
below for a reference to a document that details how posix mode affects
.ie \n(zZ=1 in \fIbash(1)\fP
.el below
for a reference to a document that details how posix mode affects
bash's behavior.
.TP 8
.B privileged
@@ -10049,7 +10081,9 @@ or associated word list.
.B \-B
The shell performs brace expansion (see
.B Brace Expansion
above). This is on by default.
.ie \n(zZ=1 in \fIbash(1)\fP).
.el above).
This is on by default.
.TP 8
.B \-C
If set,
@@ -10242,8 +10276,9 @@ the exit to be deferred until a second exit is attempted without an
intervening command (see
.SM
.B "JOB CONTROL"
above). The shell always
postpones exiting if any jobs are stopped.
.ie \n(zZ=1 in \fIbash(1)\fP).
.el above).
The shell always postpones exiting if any jobs are stopped.
.TP 8
.B checkwinsize
If set, \fBbash\fP checks the window size after each external (non-builtin)
@@ -10262,7 +10297,10 @@ attempts to save all lines of a multiple-line
command in the same history entry. This allows
easy re-editing of multi-line commands.
This option is enabled by default, but only has an effect if command
history is enabled, as described above under
history is enabled, as described
.ie \n(zZ=1 in \fIbash(1)\fP
.el above
under
.SM
.BR HISTORY .
.PD 0
@@ -10287,7 +10325,8 @@ These control aspects of the shell's compatibility mode
(see
.SM
.B "SHELL COMPATIBILITY MODE"
below).
.ie \n(zZ=1 in \fIbash(1)\fP).
.el below).
.TP 8
.B complete_fullquote
If set,
@@ -10346,7 +10385,10 @@ builtin command. An interactive shell does not exit if
fails.
.TP 8
.B expand_aliases
If set, aliases are expanded as described above under
If set, aliases are expanded as described
.ie \n(zZ=1 in \fIbash(1)\fP
.el above
under
.SM
.BR ALIASES .
This option is enabled by default for interactive shells.
@@ -10380,7 +10422,9 @@ a call to \fBreturn\fP.
and
.SM
.B BASH_ARGV
are updated as described in their descriptions above.
are updated as described in their descriptions
.ie \n(zZ=1 in \fIbash(1)\fP).
.el above).
.TP
.B 5.
Function tracing is enabled: command substitution, shell functions, and
@@ -10394,7 +10438,10 @@ subshells invoked with \fB(\fP \fIcommand\fP \fB)\fP inherit the
.RE
.TP 8
.B extglob
If set, the extended pattern matching features described above under
If set, the extended pattern matching features described
.ie \n(zZ=1 in \fIbash(1)\fP
.el above
under
\fBPathname Expansion\fP are enabled.
.TP 8
.B extquote
@@ -10416,7 +10463,9 @@ the ignored words are the only possible completions.
See
.SM
\fBSHELL VARIABLES\fP
above for a description of
.ie \n(zZ=1 in \fIbash(1)\fP
.el above
for a description of
.SM
.BR FIGNORE .
This option is enabled by default.
@@ -10425,7 +10474,9 @@ This option is enabled by default.
If set, range expressions used in pattern matching bracket expressions (see
.SM
.B Pattern Matching
above) behave as if in the traditional C locale when performing
.ie \n(zZ=1 in \fIbash(1)\fP)
.el above)
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
.B b
@@ -10483,7 +10534,8 @@ word containing a \fB@\fP is being completed (see
under
.SM
.B READLINE
above).
.ie \n(zZ=1 in \fIbash(1)\fP).
.el above).
This is enabled by default.
.TP 8
.B huponexit
@@ -10504,7 +10556,9 @@ to cause that word and all remaining characters on that
line to be ignored in an interactive shell (see
.SM
.B COMMENTS
above). This option is enabled by default.
.ie \n(zZ=1 in \fIbash(1)\fP).
.el above).
This option is enabled by default.
.TP 8
.B lastpipe
If set, and job control is not active, the shell runs the last command of
@@ -10531,7 +10585,8 @@ at the current function scope.
The shell sets this option if it is started as a login shell (see
.SM
.B "INVOCATION"
above).
.ie \n(zZ=1 in \fIbash(1)\fP).
.el above).
The value may not be changed.
.TP 8
.B mailwarn
@@ -10556,7 +10611,8 @@ If set,
matches filenames in a case\-insensitive fashion when performing pathname
expansion (see
.B Pathname Expansion
above).
.ie \n(zZ=1 in \fIbash(1)\fP).
.el above).
.TP 8
.B nocasematch
If set,
@@ -10579,19 +10635,25 @@ If set,
allows patterns which match no
files (see
.B Pathname Expansion
above)
.ie \n(zZ=1 in \fIbash(1)\fP)
.el above)
to expand to a null string, rather than themselves.
.TP 8
.B patsub_replacement
If set, \fBbash\fP
expands occurrences of \fB&\fP in the replacement string of pattern
substitution to the text matched by the pattern, as described
under \fBParameter Expansion\fP above.
under \fBParameter Expansion\fP
.ie \n(zZ=1 in \fIbash(1)\fP.
.el above.
This option is enabled by default.
.TP 8
.B progcomp
If set, the programmable completion facilities (see
\fBProgrammable Completion\fP above) are enabled.
\fBProgrammable Completion\fP
.ie \n(zZ=1 in \fIbash(1)\fP)
.el above)
are enabled.
This option is enabled by default.
.TP 8
.B progcomp_alias
@@ -10606,14 +10668,17 @@ parameter expansion, command substitution, arithmetic
expansion, and quote removal after being expanded as described in
.SM
.B PROMPTING
above. This option is enabled by default.
.ie \n(zZ=1 in \fIbash(1)\fP.
.el above.
This option is enabled by default.
.TP 8
.B restricted_shell
The shell sets this option if it is started in restricted mode
(see
.SM
.B "RESTRICTED SHELL"
below).
.ie \n(zZ=1 in \fIbash(1)\fP).
.el below).
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.
@@ -10637,7 +10702,9 @@ If set, the shell automatically closes file descriptors assigned using the
\fI{varname}\fP redirection syntax (see
.SM
.B REDIRECTION
above) instead of leaving them open when the command completes.
.ie \n(zZ=1 in \fIbash(1)\fP)
.el above)
instead of leaving them open when the command completes.
.TP 8
.B xpg_echo
If set, the \fBecho\fP builtin expands backslash-escape sequences
@@ -10668,8 +10735,10 @@ Return a status of 0 (true) or 1 (false) depending on
the evaluation of the conditional expression
.IR expr .
Each operator and operand must be a separate argument.
.if \n(zZ=0 Expressions are composed of the primaries described above under
.if \n(zZ=1 Expressions are composed of the primaries described in the \fBbash\fP manual page under
Expressions are composed of the primaries described
.ie \n(zZ=1 in \fIbash(1)\fP
.el above
under
.SM
.BR "CONDITIONAL EXPRESSIONS" .
\fBtest\fP does not accept any options, nor does it accept and ignore
@@ -10722,7 +10791,9 @@ The expression is true if and only if the argument is not null.
2 arguments
If the first argument is \fB!\fP, the expression is true if and
only if the second argument is null.
If the first argument is one of the unary conditional operators listed above
If the first argument is one of the unary conditional operators listed
.ie \n(zZ=1 in \fIbash(1)\fP
.el above
under
.SM
.BR "CONDITIONAL EXPRESSIONS" ,
@@ -10732,7 +10803,9 @@ is false.
.TP
3 arguments
The following conditions are applied in the order listed.
If the second argument is one of the binary conditional operators listed above
If the second argument is one of the binary conditional operators listed
.ie \n(zZ=1 in \fIbash(1)\fP
.el above
under
.SM
.BR "CONDITIONAL EXPRESSIONS" ,
@@ -10837,7 +10910,8 @@ is executed before every \fIsimple command\fP, \fIfor\fP command,
command, and before the first command executes in a shell function (see
.SM
.B SHELL GRAMMAR
above).
.ie \n(zZ=1 in \fIbash(1)\fP).
.el above).
Refer to the description of the \fBextdebug\fP option to the
\fBshopt\fP builtin for details of its effect on the \fBDEBUG\fP trap.
If a
@@ -11236,8 +11310,13 @@ forces \fBwait\fP to wait for \fIid\fP to terminate before returning
its status, instead of returning when it changes status.
If
.I id
specifies a non-existent process or job, the return status is
127. Otherwise, the return status is the exit status of the last
specifies a non-existent process or job, the return status is 127.
If \fBwait\fP is interrupted by a signal, the return status will be greater
than 128, as described under
.B SIGNALS
.ie \n(zZ=1 in \fIbash(1)\fP.
.el above.
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 \fIshell compatibility level\fP,
@@ -11257,7 +11336,7 @@ behavior. It's intended to be a temporary solution.
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).
default behavior in bash-3.2 and subsequent versions).
.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.
+128 -124
View File
@@ -949,16 +949,16 @@ File: bash.info, Node: Conditional Constructs, Next: Command Grouping, Prev:
select NAME [in WORDS ...]; do COMMANDS; done
The list of words following 'in' is expanded, generating a list of
items. The set of expanded words is printed on the standard error
output stream, each preceded by a number. If the 'in WORDS' is
omitted, the positional parameters are printed, as if 'in "$@"' had
been specified. The 'PS3' prompt is then displayed and a line is
read from the standard input. If the line consists of a number
corresponding to one of the displayed words, then the value of NAME
is set to that word. If the line is empty, the words and prompt
are displayed again. If 'EOF' is read, the 'select' command
completes. Any other value read causes NAME to be set to null.
The line read is saved in the variable 'REPLY'.
items, and the set of expanded words is printed on the standard
error output stream, each preceded by a number. If the 'in WORDS'
is omitted, the positional parameters are printed, as if 'in "$@"'
had been specified. 'select' then displays the 'PS3' prompt and
reads a line from the standard input. If the line consists of a
number corresponding to one of the displayed words, then the value
of NAME is set to that word. If the line is empty, the words and
prompt are displayed again. If 'EOF' is read, the 'select' command
completes and returns 1. Any other value read causes NAME to be
set to null. The line read is saved in the variable 'REPLY'.
The COMMANDS are executed after each selection until a 'break'
command is executed, at which point the 'select' command completes.
@@ -7294,7 +7294,7 @@ be a temporary solution.
This section does not mention behavior that is standard for a
particular version (e.g., setting 'compat32' 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).
word, which is default behavior in bash-3.2 and subsequent versions).
If a user enables, say, 'compat32', it may affect the behavior of
other compatibility levels up to and including the current compatibility
@@ -7638,7 +7638,10 @@ File: bash.info, Node: Job Control Builtins, Next: Job Control Variables, Pre
'wait' to wait for each PID or JOBSPEC to terminate before
returning its status, intead of returning when it changes status.
If neither JOBSPEC nor PID specifies an active child process of the
shell, the return status is 127.
shell, the return status is 127. If 'wait' is interrupted by a
signal, the return status will be greater than 128, as described
above (*note Signals::). Otherwise, the return status is the exit
status of the last process or job waited for.
'disown'
disown [-ar] [-h] [JOBSPEC ... | PID ... ]
@@ -9698,7 +9701,8 @@ happening.
'-C COMMAND'
COMMAND is executed in a subshell environment, and its output
is used as the possible completions.
is used as the possible completions. Arguments are passed as
with the '-F' option.
'-F FUNCTION'
The shell function FUNCTION is executed in the current shell
@@ -11774,14 +11778,14 @@ D.1 Index of Shell Builtin Commands
* complete: Programmable Completion Builtins.
(line 30)
* compopt: Programmable Completion Builtins.
(line 237)
(line 238)
* continue: Bourne Shell Builtins.
(line 89)
* declare: Bash Builtins. (line 154)
* dirs: Directory Stack Builtins.
(line 7)
* disown: Job Control Builtins.
(line 101)
(line 104)
* echo: Bash Builtins. (line 257)
* enable: Bash Builtins. (line 306)
* eval: Bourne Shell Builtins.
@@ -11830,7 +11834,7 @@ D.1 Index of Shell Builtin Commands
* shopt: The Shopt Builtin. (line 9)
* source: Bash Builtins. (line 594)
* suspend: Job Control Builtins.
(line 113)
(line 116)
* test: Bourne Shell Builtins.
(line 274)
* times: Bourne Shell Builtins.
@@ -12532,114 +12536,114 @@ Node: Lists29209
Node: Compound Commands31001
Node: Looping Constructs32010
Node: Conditional Constructs34502
Node: Command Grouping48966
Node: Coprocesses50441
Node: GNU Parallel53101
Node: Shell Functions54015
Node: Shell Parameters61897
Node: Positional Parameters66282
Node: Special Parameters67181
Node: Shell Expansions70392
Node: Brace Expansion72516
Node: Tilde Expansion75247
Node: Shell Parameter Expansion77865
Node: Command Substitution96213
Node: Arithmetic Expansion97565
Node: Process Substitution98530
Node: Word Splitting99647
Node: Filename Expansion101588
Node: Pattern Matching104334
Node: Quote Removal108988
Node: Redirections109280
Node: Executing Commands118937
Node: Simple Command Expansion119604
Node: Command Search and Execution121711
Node: Command Execution Environment124086
Node: Environment127118
Node: Exit Status128778
Node: Signals130559
Node: Shell Scripts134005
Node: Shell Builtin Commands137029
Node: Bourne Shell Builtins139064
Node: Bash Builtins160522
Node: Modifying Shell Behavior191375
Node: The Set Builtin191717
Node: The Shopt Builtin202315
Node: Special Builtins218224
Node: Shell Variables219200
Node: Bourne Shell Variables219634
Node: Bash Variables221735
Node: Bash Features254548
Node: Invoking Bash255558
Node: Bash Startup Files261568
Node: Interactive Shells266696
Node: What is an Interactive Shell?267103
Node: Is this Shell Interactive?267749
Node: Interactive Shell Behavior268561
Node: Bash Conditional Expressions272187
Node: Shell Arithmetic276826
Node: Aliases279767
Node: Arrays282377
Node: The Directory Stack288765
Node: Directory Stack Builtins289546
Node: Controlling the Prompt293803
Node: The Restricted Shell296765
Node: Bash POSIX Mode299372
Node: Shell Compatibility Mode311293
Node: Job Control319319
Node: Job Control Basics319776
Node: Job Control Builtins324775
Node: Job Control Variables330342
Node: Command Line Editing331495
Node: Introduction and Notation333163
Node: Readline Interaction334783
Node: Readline Bare Essentials335971
Node: Readline Movement Commands337751
Node: Readline Killing Commands338708
Node: Readline Arguments340623
Node: Searching341664
Node: Readline Init File343847
Node: Readline Init File Syntax345105
Node: Conditional Init Constructs368301
Node: Sample Init File372494
Node: Bindable Readline Commands375615
Node: Commands For Moving376816
Node: Commands For History378864
Node: Commands For Text383855
Node: Commands For Killing387501
Node: Numeric Arguments390531
Node: Commands For Completion391667
Node: Keyboard Macros395855
Node: Miscellaneous Commands396539
Node: Readline vi Mode402475
Node: Programmable Completion403379
Node: Programmable Completion Builtins411156
Node: A Programmable Completion Example421848
Node: Using History Interactively427092
Node: Bash History Facilities427773
Node: Bash History Builtins430775
Node: History Interaction435780
Node: Event Designators439397
Node: Word Designators440748
Node: Modifiers442505
Node: Installing Bash444313
Node: Basic Installation445447
Node: Compilers and Options449166
Node: Compiling For Multiple Architectures449904
Node: Installation Names451594
Node: Specifying the System Type453700
Node: Sharing Defaults454413
Node: Operation Controls455083
Node: Optional Features456038
Node: Reporting Bugs467253
Node: Major Differences From The Bourne Shell468525
Node: GNU Free Documentation License485372
Node: Indexes510546
Node: Builtin Index510997
Node: Reserved Word Index517821
Node: Variable Index520266
Node: Function Index537037
Node: Concept Index550818
Node: Command Grouping48987
Node: Coprocesses50462
Node: GNU Parallel53122
Node: Shell Functions54036
Node: Shell Parameters61918
Node: Positional Parameters66303
Node: Special Parameters67202
Node: Shell Expansions70413
Node: Brace Expansion72537
Node: Tilde Expansion75268
Node: Shell Parameter Expansion77886
Node: Command Substitution96234
Node: Arithmetic Expansion97586
Node: Process Substitution98551
Node: Word Splitting99668
Node: Filename Expansion101609
Node: Pattern Matching104355
Node: Quote Removal109009
Node: Redirections109301
Node: Executing Commands118958
Node: Simple Command Expansion119625
Node: Command Search and Execution121732
Node: Command Execution Environment124107
Node: Environment127139
Node: Exit Status128799
Node: Signals130580
Node: Shell Scripts134026
Node: Shell Builtin Commands137050
Node: Bourne Shell Builtins139085
Node: Bash Builtins160543
Node: Modifying Shell Behavior191396
Node: The Set Builtin191738
Node: The Shopt Builtin202336
Node: Special Builtins218245
Node: Shell Variables219221
Node: Bourne Shell Variables219655
Node: Bash Variables221756
Node: Bash Features254569
Node: Invoking Bash255579
Node: Bash Startup Files261589
Node: Interactive Shells266717
Node: What is an Interactive Shell?267124
Node: Is this Shell Interactive?267770
Node: Interactive Shell Behavior268582
Node: Bash Conditional Expressions272208
Node: Shell Arithmetic276847
Node: Aliases279788
Node: Arrays282398
Node: The Directory Stack288786
Node: Directory Stack Builtins289567
Node: Controlling the Prompt293824
Node: The Restricted Shell296786
Node: Bash POSIX Mode299393
Node: Shell Compatibility Mode311314
Node: Job Control319354
Node: Job Control Basics319811
Node: Job Control Builtins324810
Node: Job Control Variables330601
Node: Command Line Editing331754
Node: Introduction and Notation333422
Node: Readline Interaction335042
Node: Readline Bare Essentials336230
Node: Readline Movement Commands338010
Node: Readline Killing Commands338967
Node: Readline Arguments340882
Node: Searching341923
Node: Readline Init File344106
Node: Readline Init File Syntax345364
Node: Conditional Init Constructs368560
Node: Sample Init File372753
Node: Bindable Readline Commands375874
Node: Commands For Moving377075
Node: Commands For History379123
Node: Commands For Text384114
Node: Commands For Killing387760
Node: Numeric Arguments390790
Node: Commands For Completion391926
Node: Keyboard Macros396114
Node: Miscellaneous Commands396798
Node: Readline vi Mode402734
Node: Programmable Completion403638
Node: Programmable Completion Builtins411415
Node: A Programmable Completion Example422164
Node: Using History Interactively427408
Node: Bash History Facilities428089
Node: Bash History Builtins431091
Node: History Interaction436096
Node: Event Designators439713
Node: Word Designators441064
Node: Modifiers442821
Node: Installing Bash444629
Node: Basic Installation445763
Node: Compilers and Options449482
Node: Compiling For Multiple Architectures450220
Node: Installation Names451910
Node: Specifying the System Type454016
Node: Sharing Defaults454729
Node: Operation Controls455399
Node: Optional Features456354
Node: Reporting Bugs467569
Node: Major Differences From The Bourne Shell468841
Node: GNU Free Documentation License485688
Node: Indexes510862
Node: Builtin Index511313
Node: Reserved Word Index518137
Node: Variable Index520582
Node: Function Index537353
Node: Concept Index551134

End Tag Table
+128 -124
View File
@@ -950,16 +950,16 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre
select NAME [in WORDS ...]; do COMMANDS; done
The list of words following 'in' is expanded, generating a list of
items. The set of expanded words is printed on the standard error
output stream, each preceded by a number. If the 'in WORDS' is
omitted, the positional parameters are printed, as if 'in "$@"' had
been specified. The 'PS3' prompt is then displayed and a line is
read from the standard input. If the line consists of a number
corresponding to one of the displayed words, then the value of NAME
is set to that word. If the line is empty, the words and prompt
are displayed again. If 'EOF' is read, the 'select' command
completes. Any other value read causes NAME to be set to null.
The line read is saved in the variable 'REPLY'.
items, and the set of expanded words is printed on the standard
error output stream, each preceded by a number. If the 'in WORDS'
is omitted, the positional parameters are printed, as if 'in "$@"'
had been specified. 'select' then displays the 'PS3' prompt and
reads a line from the standard input. If the line consists of a
number corresponding to one of the displayed words, then the value
of NAME is set to that word. If the line is empty, the words and
prompt are displayed again. If 'EOF' is read, the 'select' command
completes and returns 1. Any other value read causes NAME to be
set to null. The line read is saved in the variable 'REPLY'.
The COMMANDS are executed after each selection until a 'break'
command is executed, at which point the 'select' command completes.
@@ -7295,7 +7295,7 @@ be a temporary solution.
This section does not mention behavior that is standard for a
particular version (e.g., setting 'compat32' 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).
word, which is default behavior in bash-3.2 and subsequent versions).
If a user enables, say, 'compat32', it may affect the behavior of
other compatibility levels up to and including the current compatibility
@@ -7639,7 +7639,10 @@ File: bashref.info, Node: Job Control Builtins, Next: Job Control Variables,
'wait' to wait for each PID or JOBSPEC to terminate before
returning its status, intead of returning when it changes status.
If neither JOBSPEC nor PID specifies an active child process of the
shell, the return status is 127.
shell, the return status is 127. If 'wait' is interrupted by a
signal, the return status will be greater than 128, as described
above (*note Signals::). Otherwise, the return status is the exit
status of the last process or job waited for.
'disown'
disown [-ar] [-h] [JOBSPEC ... | PID ... ]
@@ -9699,7 +9702,8 @@ happening.
'-C COMMAND'
COMMAND is executed in a subshell environment, and its output
is used as the possible completions.
is used as the possible completions. Arguments are passed as
with the '-F' option.
'-F FUNCTION'
The shell function FUNCTION is executed in the current shell
@@ -11775,14 +11779,14 @@ D.1 Index of Shell Builtin Commands
* complete: Programmable Completion Builtins.
(line 30)
* compopt: Programmable Completion Builtins.
(line 237)
(line 238)
* continue: Bourne Shell Builtins.
(line 89)
* declare: Bash Builtins. (line 154)
* dirs: Directory Stack Builtins.
(line 7)
* disown: Job Control Builtins.
(line 101)
(line 104)
* echo: Bash Builtins. (line 257)
* enable: Bash Builtins. (line 306)
* eval: Bourne Shell Builtins.
@@ -11831,7 +11835,7 @@ D.1 Index of Shell Builtin Commands
* shopt: The Shopt Builtin. (line 9)
* source: Bash Builtins. (line 594)
* suspend: Job Control Builtins.
(line 113)
(line 116)
* test: Bourne Shell Builtins.
(line 274)
* times: Bourne Shell Builtins.
@@ -12533,114 +12537,114 @@ Node: Lists29272
Node: Compound Commands31067
Node: Looping Constructs32079
Node: Conditional Constructs34574
Node: Command Grouping49041
Node: Coprocesses50519
Node: GNU Parallel53182
Node: Shell Functions54099
Node: Shell Parameters61984
Node: Positional Parameters66372
Node: Special Parameters67274
Node: Shell Expansions70488
Node: Brace Expansion72615
Node: Tilde Expansion75349
Node: Shell Parameter Expansion77970
Node: Command Substitution96321
Node: Arithmetic Expansion97676
Node: Process Substitution98644
Node: Word Splitting99764
Node: Filename Expansion101708
Node: Pattern Matching104457
Node: Quote Removal109114
Node: Redirections109409
Node: Executing Commands119069
Node: Simple Command Expansion119739
Node: Command Search and Execution121849
Node: Command Execution Environment124227
Node: Environment127262
Node: Exit Status128925
Node: Signals130709
Node: Shell Scripts134158
Node: Shell Builtin Commands137185
Node: Bourne Shell Builtins139223
Node: Bash Builtins160684
Node: Modifying Shell Behavior191540
Node: The Set Builtin191885
Node: The Shopt Builtin202486
Node: Special Builtins218398
Node: Shell Variables219377
Node: Bourne Shell Variables219814
Node: Bash Variables221918
Node: Bash Features254734
Node: Invoking Bash255747
Node: Bash Startup Files261760
Node: Interactive Shells266891
Node: What is an Interactive Shell?267301
Node: Is this Shell Interactive?267950
Node: Interactive Shell Behavior268765
Node: Bash Conditional Expressions272394
Node: Shell Arithmetic277036
Node: Aliases279980
Node: Arrays282593
Node: The Directory Stack288984
Node: Directory Stack Builtins289768
Node: Controlling the Prompt294028
Node: The Restricted Shell296993
Node: Bash POSIX Mode299603
Node: Shell Compatibility Mode311527
Node: Job Control319556
Node: Job Control Basics320016
Node: Job Control Builtins325018
Node: Job Control Variables330588
Node: Command Line Editing331744
Node: Introduction and Notation333415
Node: Readline Interaction335038
Node: Readline Bare Essentials336229
Node: Readline Movement Commands338012
Node: Readline Killing Commands338972
Node: Readline Arguments340890
Node: Searching341934
Node: Readline Init File344120
Node: Readline Init File Syntax345381
Node: Conditional Init Constructs368580
Node: Sample Init File372776
Node: Bindable Readline Commands375900
Node: Commands For Moving377104
Node: Commands For History379155
Node: Commands For Text384149
Node: Commands For Killing387798
Node: Numeric Arguments390831
Node: Commands For Completion391970
Node: Keyboard Macros396161
Node: Miscellaneous Commands396848
Node: Readline vi Mode402787
Node: Programmable Completion403694
Node: Programmable Completion Builtins411474
Node: A Programmable Completion Example422169
Node: Using History Interactively427416
Node: Bash History Facilities428100
Node: Bash History Builtins431105
Node: History Interaction436113
Node: Event Designators439733
Node: Word Designators441087
Node: Modifiers442847
Node: Installing Bash444658
Node: Basic Installation445795
Node: Compilers and Options449517
Node: Compiling For Multiple Architectures450258
Node: Installation Names451951
Node: Specifying the System Type454060
Node: Sharing Defaults454776
Node: Operation Controls455449
Node: Optional Features456407
Node: Reporting Bugs467625
Node: Major Differences From The Bourne Shell468900
Node: GNU Free Documentation License485750
Node: Indexes510927
Node: Builtin Index511381
Node: Reserved Word Index518208
Node: Variable Index520656
Node: Function Index537430
Node: Concept Index551214
Node: Command Grouping49062
Node: Coprocesses50540
Node: GNU Parallel53203
Node: Shell Functions54120
Node: Shell Parameters62005
Node: Positional Parameters66393
Node: Special Parameters67295
Node: Shell Expansions70509
Node: Brace Expansion72636
Node: Tilde Expansion75370
Node: Shell Parameter Expansion77991
Node: Command Substitution96342
Node: Arithmetic Expansion97697
Node: Process Substitution98665
Node: Word Splitting99785
Node: Filename Expansion101729
Node: Pattern Matching104478
Node: Quote Removal109135
Node: Redirections109430
Node: Executing Commands119090
Node: Simple Command Expansion119760
Node: Command Search and Execution121870
Node: Command Execution Environment124248
Node: Environment127283
Node: Exit Status128946
Node: Signals130730
Node: Shell Scripts134179
Node: Shell Builtin Commands137206
Node: Bourne Shell Builtins139244
Node: Bash Builtins160705
Node: Modifying Shell Behavior191561
Node: The Set Builtin191906
Node: The Shopt Builtin202507
Node: Special Builtins218419
Node: Shell Variables219398
Node: Bourne Shell Variables219835
Node: Bash Variables221939
Node: Bash Features254755
Node: Invoking Bash255768
Node: Bash Startup Files261781
Node: Interactive Shells266912
Node: What is an Interactive Shell?267322
Node: Is this Shell Interactive?267971
Node: Interactive Shell Behavior268786
Node: Bash Conditional Expressions272415
Node: Shell Arithmetic277057
Node: Aliases280001
Node: Arrays282614
Node: The Directory Stack289005
Node: Directory Stack Builtins289789
Node: Controlling the Prompt294049
Node: The Restricted Shell297014
Node: Bash POSIX Mode299624
Node: Shell Compatibility Mode311548
Node: Job Control319591
Node: Job Control Basics320051
Node: Job Control Builtins325053
Node: Job Control Variables330847
Node: Command Line Editing332003
Node: Introduction and Notation333674
Node: Readline Interaction335297
Node: Readline Bare Essentials336488
Node: Readline Movement Commands338271
Node: Readline Killing Commands339231
Node: Readline Arguments341149
Node: Searching342193
Node: Readline Init File344379
Node: Readline Init File Syntax345640
Node: Conditional Init Constructs368839
Node: Sample Init File373035
Node: Bindable Readline Commands376159
Node: Commands For Moving377363
Node: Commands For History379414
Node: Commands For Text384408
Node: Commands For Killing388057
Node: Numeric Arguments391090
Node: Commands For Completion392229
Node: Keyboard Macros396420
Node: Miscellaneous Commands397107
Node: Readline vi Mode403046
Node: Programmable Completion403953
Node: Programmable Completion Builtins411733
Node: A Programmable Completion Example422485
Node: Using History Interactively427732
Node: Bash History Facilities428416
Node: Bash History Builtins431421
Node: History Interaction436429
Node: Event Designators440049
Node: Word Designators441403
Node: Modifiers443163
Node: Installing Bash444974
Node: Basic Installation446111
Node: Compilers and Options449833
Node: Compiling For Multiple Architectures450574
Node: Installation Names452267
Node: Specifying the System Type454376
Node: Sharing Defaults455092
Node: Operation Controls455765
Node: Optional Features456723
Node: Reporting Bugs467941
Node: Major Differences From The Bourne Shell469216
Node: GNU Free Documentation License486066
Node: Indexes511243
Node: Builtin Index511697
Node: Reserved Word Index518524
Node: Variable Index520972
Node: Function Index537746
Node: Concept Index551530

End Tag Table
+9 -5
View File
@@ -1096,16 +1096,16 @@ select @var{name} [in @var{words} @dots{}]; do @var{commands}; done
@end example
The list of words following @code{in} is expanded, generating a list
of items. The set of expanded words is printed on the standard
of items, and the set of expanded words is printed on the standard
error output stream, each preceded by a number. If the
@samp{in @var{words}} is omitted, the positional parameters are printed,
as if @samp{in "$@@"} had been specified.
The @env{PS3} prompt is then displayed and a line is read from the
standard input.
@code{select} then displays the @env{PS3}
prompt and reads a line from the standard input.
If the line consists of a number corresponding to one of the displayed
words, then the value of @var{name} is set to that word.
If the line is empty, the words and prompt are displayed again.
If @code{EOF} is read, the @code{select} command completes.
If @code{EOF} is read, the @code{select} command completes and returns 1.
Any other value read causes @var{name} to be set to null.
The line read is saved in the variable @env{REPLY}.
@@ -8464,7 +8464,7 @@ behavior. It's intended to be a temporary solution.
This section does not mention behavior that is standard for a particular
version (e.g., setting @code{compat32} 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).
default behavior in bash-3.2 and subsequent versions).
If a user enables, say, @code{compat32}, it may affect the behavior of other
compatibility levels up to and including the current compatibility level.
@@ -8896,6 +8896,10 @@ terminate before returning its status, intead of returning when it changes
status.
If neither @var{jobspec} nor @var{pid} specifies an active child process
of the shell, the return status is 127.
If @code{wait} is interrupted by a signal, the return status will be greater
than 128, as described above (@pxref{Signals}).
Otherwise, the return status is the exit status
of the last process or job waited for.
@item disown
@btindex disown
+4 -4
View File
@@ -1,6 +1,6 @@
/* eval.c -- reading and evaluating commands. */
/* Copyright (C) 1996-2021 Free Software Foundation, Inc.
/* Copyright (C) 1996-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -90,13 +90,13 @@ reader_loop ()
switch (code)
{
/* Some kind of throw to top_level has occurred. */
case FORCE_EOF:
case ERREXIT:
if (exit_immediately_on_error)
reset_local_contexts (); /* not in a function */
case FORCE_EOF:
case EXITPROG:
case EXITBLTIN:
current_command = (COMMAND *)NULL;
if (exit_immediately_on_error)
variable_context = 0; /* not in a function */
EOF_Reached = EOF;
goto exec_done;
+7 -2
View File
@@ -2738,6 +2738,7 @@ execute_connection (command, asynchronous, pipe_in, pipe_out, fds_to_close)
/* Just call execute command on both sides. */
case ';':
case '\n': /* special case, happens in command substitutions */
if (ignore_return)
{
if (command->value.Connection->first)
@@ -3055,7 +3056,6 @@ eval_arith_for_expr (l, okp)
{
if (echo_command_at_execute)
xtrace_print_arith_cmd (new);
this_command_name = "(("; /* )) for expression error messages */
command_string_index = 0;
print_arith_command (new);
@@ -3069,6 +3069,7 @@ eval_arith_for_expr (l, okp)
/* In debugging mode, if the DEBUG trap returns a non-zero status, we
skip the command. */
eflag = (shell_compatibility_level > 51) ? 0 : EXP_EXPANDED;
this_command_name = "(("; /* )) for expression error messages */
#if defined (DEBUGGER)
if (debugging_mode == 0 || r == EXECUTION_SUCCESS)
@@ -3423,6 +3424,8 @@ execute_select_command (select_command)
return (EXECUTION_SUCCESS);
#endif
this_command_name = (char *)0;
loop_level++;
identifier = select_command->name->word;
@@ -3819,6 +3822,7 @@ execute_arith_command (arith_command)
}
#endif
this_command_name = "(("; /* )) */
t = (char *)NULL;
new = arith_command->exp;
exp = (new->next) ? (t = string_list (new)) : new->word->word;
@@ -4016,7 +4020,6 @@ execute_cond_command (cond_command)
save_line_number = line_number;
this_command_name = "[[";
SET_LINE_NUMBER (cond_command->line);
/* If we're in a function, update the line number information. */
if (variable_context && interactive_shell && sourcelevel == 0)
@@ -4048,6 +4051,8 @@ execute_cond_command (cond_command)
}
#endif
this_command_name = "[["; /* ]] */
#if 0
debug_print_cond_command (cond_command);
#endif
+24 -7
View File
@@ -139,8 +139,8 @@
#define COMMA ','
/* This should be the function corresponding to the operator with the
highest precedence. */
#define EXP_HIGHEST expcomma
lowest precedence. */
#define EXP_LOWEST expcomma
#ifndef MAX_INT_LEN
# define MAX_INT_LEN 32
@@ -472,8 +472,9 @@ subexpr (expr)
readtok ();
val = EXP_HIGHEST ();
val = EXP_LOWEST ();
/*TAG:bash-5.3 make it clear that these are arithmetic syntax errors */
if (curtok != 0)
evalerror (_("syntax error in expression"));
@@ -639,7 +640,7 @@ expcond ()
if (curtok == 0 || curtok == COL)
evalerror (_("expression expected"));
val1 = EXP_HIGHEST ();
val1 = EXP_LOWEST ();
if (set_noeval)
noeval--;
@@ -1051,7 +1052,7 @@ exp0 ()
{
/* XXX - save curlval here? Or entire expression context? */
readtok ();
val = EXP_HIGHEST ();
val = EXP_LOWEST ();
if (curtok != RPAR) /* ( */
evalerror (_("missing `)'"));
@@ -1446,9 +1447,14 @@ readtok ()
c = POWER;
else if ((c == '-' || c == '+') && c1 == c && curtok == STR)
c = (c == '-') ? POSTDEC : POSTINC;
#if STRICT_ARITH_PARSING
else if ((c == '-' || c == '+') && c1 == c && curtok == NUM)
#else
else if ((c == '-' || c == '+') && c1 == c && curtok == NUM && (lasttok == PREINC || lasttok == PREDEC))
#endif
{
/* This catches something like --FOO++ */
/* TAG:bash-5.3 add gettext calls here or make this a separate function */
if (c == '-')
evalerror ("--: assignment requires lvalue");
else
@@ -1465,7 +1471,7 @@ readtok ()
c = (c == '-') ? PREDEC : PREINC;
else
/* Could force parsing as preinc or predec and throw an error */
#if 0
#if STRICT_ARITH_PARSING
{
/* Posix says unary plus and minus have higher priority than
preinc and predec. */
@@ -1541,7 +1547,7 @@ strlong (num)
register char *s;
register unsigned char c;
int base, foundbase;
intmax_t val;
intmax_t val, pval;
s = num;
@@ -1559,6 +1565,10 @@ strlong (num)
{
base = 16;
s++;
#if STRICT_ARITH_PARSING
if (*s == 0)
evalerror (_("invalid number"));
#endif
}
else
base = 8;
@@ -1602,7 +1612,14 @@ strlong (num)
if (c >= base)
evalerror (_("value too great for base"));
#ifdef CHECK_OVERFLOW
pval = val;
val = (val * base) + c;
if (val < 0 || val < pval) /* overflow */
return INTMAX_MAX;
#else
val = (val * base) + c;
#endif
}
else
break;
+1
View File
@@ -36,6 +36,7 @@ extern intmax_t evalexp PARAMS((char *, int, int *));
#define FUNC_EXTERNAL 0x02
extern char *make_command_string PARAMS((COMMAND *));
extern char *print_comsub PARAMS((COMMAND *));
extern char *named_function_string PARAMS((char *, COMMAND *, int));
extern void print_command PARAMS((COMMAND *));
+1 -1
View File
@@ -4963,7 +4963,7 @@ set_job_control (arg)
old = job_control;
job_control = arg;
if (terminal_pgrp == NO_PID)
if (terminal_pgrp == NO_PID && shell_tty >= 0)
terminal_pgrp = tcgetpgrp (shell_tty);
/* If we're turning on job control we're going to want to know the shell's
+1
View File
@@ -2282,6 +2282,7 @@ Names of all shell variables. May also be specified as @option{-v}.
@item -C @var{command}
@var{command} is executed in a subshell environment, and its output is
used as the possible completions.
Arguments are passed as with the @option{-F} option.
@item -F @var{function}
The shell function @var{function} is executed in the current shell
+3
View File
@@ -194,7 +194,10 @@ rl_display_search (char *search_string, int flags, int where)
rl_message ("%s", message);
xfree (message);
#if 0
/* rl_message calls this */
(*rl_redisplay_function) ();
#endif
}
static _rl_search_cxt *
+47 -24
View File
@@ -114,6 +114,16 @@ typedef void *alias_t;
# define MBTEST(x) ((x))
#endif
#define EXTEND_SHELL_INPUT_LINE_PROPERTY() \
do { \
if (shell_input_line_len + 2 > shell_input_line_propsize) \
{ \
shell_input_line_propsize = shell_input_line_len + 2; \
shell_input_line_property = (char *)xrealloc (shell_input_line_property, \
shell_input_line_propsize); \
} \
} while (0)
#if defined (EXTENDED_GLOB)
extern int extended_glob;
#endif
@@ -1154,7 +1164,12 @@ list1: list1 AND_AND newline_list list1
| list1 ';' newline_list list1
{ $$ = command_connect ($1, $4, ';'); }
| list1 '\n' newline_list list1
{ $$ = command_connect ($1, $4, ';'); }
{
if (parser_state & PST_CMDSUBST)
$$ = command_connect ($1, $4, '\n');
else
$$ = command_connect ($1, $4, ';');
}
| pipeline_command
{ $$ = $1; }
;
@@ -1185,10 +1200,10 @@ simple_list: simple_list1
{
$$ = $1;
if (need_here_doc)
gather_here_documents ();
gather_here_documents (); /* XXX */
if ((parser_state & PST_CMDSUBST) && current_token == shell_eof_token)
{
itrace("LEGACY: parser: command substitution simple_list1 -> simple_list");
INTERNAL_DEBUG (("LEGACY: parser: command substitution simple_list1 -> simple_list"));
global_command = $1;
eof_encountered = 0;
if (bash_input.type == st_string)
@@ -1203,10 +1218,10 @@ itrace("LEGACY: parser: command substitution simple_list1 -> simple_list");
else
$$ = command_connect ($1, (COMMAND *)NULL, '&');
if (need_here_doc)
gather_here_documents ();
gather_here_documents (); /* XXX */
if ((parser_state & PST_CMDSUBST) && current_token == shell_eof_token)
{
itrace("LEGACY: parser: command substitution simple_list1 '&' -> simple_list");
INTERNAL_DEBUG (("LEGACY: parser: command substitution simple_list1 '&' -> simple_list"));
global_command = $1;
eof_encountered = 0;
if (bash_input.type == st_string)
@@ -1218,10 +1233,10 @@ itrace("LEGACY: parser: command substitution simple_list1 '&' -> simple_list");
{
$$ = $1;
if (need_here_doc)
gather_here_documents ();
gather_here_documents (); /* XXX */
if ((parser_state & PST_CMDSUBST) && current_token == shell_eof_token)
{
itrace("LEGACY: parser: command substitution simple_list1 ';' -> simple_list");
INTERNAL_DEBUG (("LEGACY: parser: command substitution simple_list1 ';' -> simple_list"));
global_command = $1;
eof_encountered = 0;
if (bash_input.type == st_string)
@@ -2550,21 +2565,12 @@ shell_getc (remove_quoted_newline)
shell_input_line[shell_input_line_len] = '\n';
shell_input_line[shell_input_line_len + 1] = '\0';
#if 0
set_line_mbstate (); /* XXX - this is wasteful */
#else
# if defined (HANDLE_MULTIBYTE)
#if defined (HANDLE_MULTIBYTE)
/* This is kind of an abstraction violation, but there's no need to
go through the entire shell_input_line again with a call to
set_line_mbstate(). */
if (shell_input_line_len + 2 > shell_input_line_propsize)
{
shell_input_line_propsize = shell_input_line_len + 2;
shell_input_line_property = (char *)xrealloc (shell_input_line_property,
shell_input_line_propsize);
}
EXTEND_SHELL_INPUT_LINE_PROPERTY();
shell_input_line_property[shell_input_line_len] = 1;
# endif
#endif
}
}
@@ -2617,6 +2623,21 @@ next_alias_char:
(current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"'))
{
parser_state |= PST_ENDALIAS;
/* We need to do this to make sure last_shell_getc_is_singlebyte returns
true, since we are returning a single-byte space. */
if (shell_input_line_index == shell_input_line_len && last_shell_getc_is_singlebyte == 0)
{
#if 0
EXTEND_SHELL_INPUT_LINE_PROPERTY();
shell_input_line_property[shell_input_line_len++] = 1;
/* extend shell_input_line to accommodate the shell_ungetc that
read_token_word() will perform, since we're extending the index */
RESIZE_MALLOCED_BUFFER (shell_input_line, shell_input_line_index, 2, shell_input_line_size, 16);
shell_input_line[++shell_input_line_index] = '\0'; /* XXX */
#else
shell_input_line_property[shell_input_line_index - 1] = 1;
#endif
}
return ' '; /* END_ALIAS */
}
#endif
@@ -4095,8 +4116,8 @@ parse_comsub (qc, open, close, lenp, flags)
if (need_here_doc > 0)
{
internal_debug("command substitution: %d unterminated here-document%s", need_here_doc, (need_here_doc == 1) ? "" : "s");
gather_here_documents ();
internal_warning ("command substitution: %d unterminated here-document%s", need_here_doc, (need_here_doc == 1) ? "" : "s");
gather_here_documents (); /* XXX check compatibility level? */
}
parsed_command = global_command;
@@ -4126,7 +4147,7 @@ INTERNAL_DEBUG(("current_token (%d) != shell_eof_token (%c)", current_token, she
restore_parser_state (&ps);
tcmd = make_command_string (parsed_command); /* returns static memory */
tcmd = print_comsub (parsed_command); /* returns static memory */
retlen = strlen (tcmd);
if (tcmd[0] == '(') /* ) need a space to prevent arithmetic expansion */
retlen++;
@@ -4186,6 +4207,7 @@ xparse_dolparen (base, string, indp, flags)
sflags = SEVAL_NONINT|SEVAL_NOHIST|SEVAL_NOFREE;
if (flags & SX_NOLONGJMP)
sflags |= SEVAL_NOLONGJMP;
save_parser_state (&ps);
save_input_line_state (&ls);
@@ -4609,6 +4631,7 @@ cond_term ()
tleft = make_cond_node (COND_TERM, yylval.word, (COND_COM *)NULL, (COND_COM *)NULL);
/* binop */
/* tok = cond_skip_newlines (); ? */
tok = read_token (READ);
if (tok == WORD && test_binop (yylval.word->word))
{
@@ -6302,13 +6325,13 @@ parse_string_to_word_list (s, flags, whom)
sh_parser_state_t ps;
int ea;
orig_line_number = line_number;
save_parser_state (&ps);
#if defined (HISTORY)
bash_history_disable ();
#endif
orig_line_number = line_number;
save_parser_state (&ps);
push_stream (1);
if (ea = expanding_alias ())
parser_save_alias ();
BIN
View File
Binary file not shown.
+440 -419
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+837 -1038
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+442 -417
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+476 -451
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+444 -419
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+433 -412
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+2211 -1117
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+752 -1042
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+451 -424
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+438 -418
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+443 -418
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+443 -421
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+442 -416
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+438 -417
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+464 -438
View File
File diff suppressed because it is too large Load Diff
+46 -18
View File
@@ -129,6 +129,7 @@ static int inside_function_def;
static int skip_this_indent;
static int was_heredoc;
static int printing_connection;
static int printing_comsub;
static REDIRECT *deferred_heredocs;
/* The depth of the group commands that we are currently printing. This
@@ -162,6 +163,21 @@ make_command_string (command)
return (the_printed_command);
}
/* Print a command substitution after parsing it in parse_comsub to turn it
back into an external representation without turning newlines into `;'.
Placeholder for other changes, if any are necessary. */
char *
print_comsub (command)
COMMAND *command;
{
char *ret;
printing_comsub++;
ret = make_command_string (command);
printing_comsub--;
return ret;
}
/* The internal function. This is the real workhorse. */
static void
make_command_string_internal (command)
@@ -278,25 +294,35 @@ make_command_string_internal (command)
break;
case ';':
if (deferred_heredocs == 0)
{
if (was_heredoc == 0)
cprintf (";");
else
was_heredoc = 0;
}
else
print_deferred_heredocs (inside_function_def ? "" : ";");
case '\n': /* special case this */
{
char c = command->value.Connection->connector;
if (inside_function_def)
cprintf ("\n");
else
{
cprintf (" ");
if (command->value.Connection->second)
skip_this_indent++;
}
break;
s[0] = printing_comsub ? c : ';';
s[1] = '\0';
if (deferred_heredocs == 0)
{
if (was_heredoc == 0)
cprintf (s); /* inside_function_def? */
else
was_heredoc = 0;
}
else
/* print_deferred_heredocs special-cases `;' */
print_deferred_heredocs (inside_function_def ? "" : ";");
if (inside_function_def)
cprintf ("\n");
else
{
if (c == ';')
cprintf (" ");
if (command->value.Connection->second)
skip_this_indent++;
}
break;
}
default:
cprintf (_("print_command: bad connector `%d'"),
@@ -1293,6 +1319,7 @@ reset_locals ()
indentation = 0;
printing_connection = 0;
deferred_heredocs = 0;
printing_comsub = 0;
}
static void
@@ -1364,6 +1391,7 @@ named_function_string (name, command, flags)
old_amount = indentation_amount;
command_string_index = was_heredoc = 0;
deferred_heredocs = 0;
printing_comsub = 0;
if (name && *name)
{
+14 -17
View File
@@ -8930,37 +8930,34 @@ pat_subst (string, pat, rep, mflags)
* STRING and return the result.
* 3. A null STRING with a matching pattern means to append REP to
* STRING and return the result.
* These don't understand or process `&' in the replacement string.
*
* These process `&' in the replacement string, like `sed' does when
* presented with a BRE of `^' or `$'.
*/
if ((pat == 0 || *pat == 0) && (mtype == MATCH_BEG || mtype == MATCH_END))
{
replen = STRLEN (rep);
rstr = (mflags & MATCH_EXPREP) ? strcreplace (rep, '&', "", 2) : rep;
rslen = STRLEN (rstr);
l = STRLEN (string);
ret = (char *)xmalloc (replen + l + 2);
if (replen == 0)
ret = (char *)xmalloc (rslen + l + 2);
if (rslen == 0)
strcpy (ret, string);
else if (mtype == MATCH_BEG)
{
strcpy (ret, rep);
strcpy (ret + replen, string);
strcpy (ret, rstr);
strcpy (ret + rslen, string);
}
else
{
strcpy (ret, string);
strcpy (ret + l, rep);
strcpy (ret + l, rstr);
}
if (rstr != rep)
free (rstr);
return (ret);
}
else if (*string == 0 && (match_pattern (string, pat, mtype, &s, &e) != 0))
{
replen = STRLEN (rep);
ret = (char *)xmalloc (replen + 1);
if (replen == 0)
ret[0] = '\0';
else
strcpy (ret, rep);
return (ret);
}
return ((mflags & MATCH_EXPREP) ? strcreplace (rep, '&', "", 2) : savestring (rep));
ret = (char *)xmalloc (rsize = 64);
ret[0] = '\0';
@@ -11258,7 +11255,7 @@ add_string:
{
t_index = sindex++;
temp = string_extract (string, &sindex, "`", SX_REQMATCH);
temp = string_extract (string, &sindex, "`", (word->flags & W_COMPLETE) ? SX_COMPLETE : SX_REQMATCH);
/* The test of sindex against t_index is to allow bare instances of
` to pass through, for backwards compatibility. */
if (temp == &extract_string_error || temp == &extract_string_fatal)
+1
View File
@@ -804,6 +804,7 @@ three_arguments ()
{
advance (1);
value = !two_arguments ();
pos = argc;
}
else if (argv[pos][0] == '(' && argv[pos+2][0] == ')')
{
+2
View File
@@ -41,3 +41,5 @@ baz
foo
bar
baz
<áa>
<aá>
+1
View File
@@ -62,3 +62,4 @@ ${THIS_SH} ./alias2.sub
${THIS_SH} ./alias3.sub
${THIS_SH} ./alias4.sub
${THIS_SH} ./alias5.sub
${THIS_SH} ./alias6.sub
+13
View File
@@ -0,0 +1,13 @@
# make sure aliases that end in multibyte characters don't interfere with the
# space sentinel alias expansion adds; problem through bash-5.1
shopt -s expand_aliases
LC_ALL=en_US.UTF-8
alias a1='printf "<%s>\\n" áa'
a1
alias a2='printf "<%s>\\n" aá'
a2
unalias a1 a2
+2
View File
@@ -19,6 +19,7 @@ argv[1] = <sed> argv[2] = <-e> argv[3] = <s/[^I:]//g>
argv[1] = <foo\^Jbar>
argv[1] = <foobar>
argv[1] = <foo\^Jbar>
nested
#esac
a
ok 1
@@ -62,5 +63,6 @@ ok 4
ok 5
ok 6
ok 7
ok 9
ok 8
ok 8
+7
View File
@@ -69,6 +69,13 @@ comsub_foo_1()
echo $(while true; do case $HOME in /*) echo abs ;; esac; done)
}
echo $(
echo $(
echo $(echo $( echo nested )
)
)
)
${THIS_SH} ./comsub1.sub
${THIS_SH} ./comsub2.sub
${THIS_SH} ./comsub3.sub
+6
View File
@@ -36,6 +36,12 @@ echo "$( nest echo ok 7 ) )"
alias short='echo ok 8 )'
alias DO='{ '
alias DONE='}'
got=$(DO
echo ok 9; DONE)
echo "$got"
echo $( short
echo "$( short "
+15 -8
View File
@@ -53,16 +53,23 @@ unset before after
# date +%s should be portable enough now
# then try gawk, perl, python in that order
now1=$(date +%s 2>/dev/null) D=date
[ -z "$now1" ] && now1=$(gawk 'BEGIN { print systime(); }' 2>/dev/null) D=gawk
[ -z "$now1" ] && now1=$(perl -e 'print time' 2>/dev/null) D=perl
[ -z "$now1" ] && now1=$(python -c 'import time; ts = int(time.time()); print(ts)' 2>/dev/null) D=python
[ -z "$now1" ] &&
{
now1=$(gawk 'BEGIN { print systime(); }' 2>/dev/null) D=gawk
[ -z "$now1" ] && now1=$(perl -e 'print time' 2>/dev/null) D=perl
[ -z "$now1" ] && now1=$(python -c 'import time; ts = int(time.time()); print(ts)' 2>/dev/null) D=python
}
now2=$EPOCHSECONDS
case $now1 in
$now2) echo EPOCHSECONDS ok ;;
'') echo "cannot get current time using date/gawk/perl/python" >&2 ;;
*) echo "current time via $D and EPOCHSECONDS possible mismatch|$now1|$now2" >&2 ;;
esac
# use a window of +-1 second
offset=1
if [[ -z $now1 ]]; then
echo "cannot get current time using date/gawk/perl/python" >&2
elif (( $now1 - $offset <= $now2 && $now2 <= $now1 + $offset )); then
echo EPOCHSECONDS ok
else
echo "current time via $D and EPOCHSECONDS possible mismatch|$now1|$now2|offset=$offset" >&2
fi
unset now1 now2 D
LC_ALL=C # force decimal point to `.'
+7 -1
View File
@@ -196,7 +196,13 @@ ok 4
ok 5
./errors8.sub: line 14: set: notanoption: invalid option name
ok 6
DEBUG
./errors9.sub: line 6: [[: ++: syntax error: operand expected (error token is "+")
DEBUG
./errors9.sub: line 8: ((: -- : syntax error: operand expected (error token is "- ")
DEBUG
./errors9.sub: line 10: ((: -- : syntax error: operand expected (error token is "- ")
bash: line 1: return: can only `return' from a function or sourced script
after return
bash: line 1: return: can only `return' from a function or sourced script
./errors.tests: line 304: `!!': not a valid identifier
./errors.tests: line 305: `!!': not a valid identifier
+1
View File
@@ -292,6 +292,7 @@ ${THIS_SH} ./errors7.sub
${THIS_SH} -o posix ./errors7.sub
${THIS_SH} ./errors8.sub
${THIS_SH} ./errors9.sub
${THIS_SH} -c 'return ; echo after return' bash
${THIS_SH} -o posix -c 'return ; echo after return' bash
+14
View File
@@ -0,0 +1,14 @@
trap 'echo DEBUG' DEBUG
# make sure that the right command name appears in the error messages and
# that the DEBUG trap doesn't overwrite it
[[ ++ -gt 3 ]]
(( -- ))
for (( -- ; ++; -- ))
do
echo bogus
done
+2 -1
View File
@@ -120,11 +120,12 @@ argv[3] = <ve>
5: ${x#$pat}
6: ${y#$'not'}
7: ${y#'not'}
./heredoc7.sub: line 17: warning: command substitution: 1 unterminated here-document
foo bar
./heredoc7.sub: line 21: after: command not found
./heredoc7.sub: line 29: warning: here-document at line 29 delimited by end-of-file (wanted `EOF')
./heredoc7.sub: line 29: foobar: command not found
./heredoc7.sub: line 29: EOF: command not found
./heredoc7.sub: line 30: EOF: command not found
grep: *.c: No such file or directory
comsub here-string
./heredoc.tests: line 156: warning: here-document at line 154 delimited by end-of-file (wanted `EOF')
+8
View File
@@ -780,6 +780,14 @@ let\&ee
let\&ee
let&ee
let&ee
twoone
&twoone
onetwo
one&two
two
&two
otwone
&twone
argv[1] = </>
argv[1] = </>
+17
View File
@@ -101,3 +101,20 @@ echo ${var//$pat/"\&"}
echo ${var//$pat/"$r3"}
echo ${var//$pat/"&"}
echo ${var//$pat/$r3}
# these cases provide the same functionality as sed when given a BRE like
# `^' or `$', or when passed a null input line
one=one
null=
echo ${one/#/&two}
echo ${one/#/\&two}
echo ${one/%/&two}
echo ${one/%/\&two}
echo ${null/#/&two}
echo ${null/#/\&two}
echo ${one/#?/&two}
echo ${one/#?/\&two}
+3 -1
View File
@@ -220,6 +220,8 @@ t ! -z "$z"
0
t ! -n "$z"
1
t ! ! "$z"
0
t "$zero"
1
t ! "$zero"
@@ -272,7 +274,7 @@ b ( 1 = 2
2
./test.tests: line 26: test: too many arguments
2
./test.tests: line 431: [: missing `]'
./test.tests: line 434: [: missing `]'
2
./test.tests: line 26: test: (: unary operator expected
2
+3
View File
@@ -358,6 +358,9 @@ t ! -z "$z"
echo 't ! -n "$z"'
t ! -n "$z"
echo 't ! ! "$z"'
t ! ! "$z"
zero=
echo 't "$zero"'
t "$zero"
+24 -6
View File
@@ -1,6 +1,6 @@
/* variables.c -- Functions for hacking shell variables. */
/* Copyright (C) 1987-2021 Free Software Foundation, Inc.
/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -330,6 +330,8 @@ static void push_func_var PARAMS((PTR_T));
static void push_builtin_var PARAMS((PTR_T));
static void push_exported_var PARAMS((PTR_T));
static void delete_local_contexts PARAMS((VAR_CONTEXT *));
/* This needs to be looked at again. */
static inline void push_posix_tempvar_internal PARAMS((SHELL_VAR *, int));
@@ -5427,10 +5429,8 @@ pop_var_context ()
internal_error (_("pop_var_context: no global_variables context"));
}
/* Delete the HASH_TABLEs for all variable contexts beginning at VCXT, and
all of the VAR_CONTEXTs except GLOBAL_VARIABLES. */
void
delete_all_contexts (vcxt)
static void
delete_local_contexts (vcxt)
VAR_CONTEXT *vcxt;
{
VAR_CONTEXT *v, *t;
@@ -5439,12 +5439,30 @@ delete_all_contexts (vcxt)
{
t = v->down;
dispose_var_context (v);
}
}
}
/* Delete the HASH_TABLEs for all variable contexts beginning at VCXT, and
all of the VAR_CONTEXTs except GLOBAL_VARIABLES. */
void
delete_all_contexts (vcxt)
VAR_CONTEXT *vcxt;
{
delete_local_contexts (vcxt);
delete_all_variables (global_variables->table);
shell_variables = global_variables;
}
/* Reset the context so we are not executing in a shell function. Only call
this if you are getting ready to exit the shell. */
void
reset_local_contexts ()
{
delete_local_contexts (shell_variables);
shell_variables = global_variables;
variable_context = 0;
}
/* **************************************************************** */
/* */
/* Pushing and Popping temporary variable scopes */
+3 -1
View File
@@ -1,6 +1,6 @@
/* variables.h -- data structures for shell variables. */
/* Copyright (C) 1987-2021 Free Software Foundation, Inc.
/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -335,8 +335,10 @@ extern int unbind_function_def PARAMS((const char *));
extern int delete_var PARAMS((const char *, VAR_CONTEXT *));
extern int makunbound PARAMS((const char *, VAR_CONTEXT *));
extern int kill_local_variable PARAMS((const char *));
extern void delete_all_variables PARAMS((HASH_TABLE *));
extern void delete_all_contexts PARAMS((VAR_CONTEXT *));
extern void reset_local_contexts PARAMS((void));
extern VAR_CONTEXT *new_var_context PARAMS((char *, int));
extern void dispose_var_context PARAMS((VAR_CONTEXT *));
+490 -467
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -163,7 +163,7 @@ extern int yydebug;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 328 "/usr/local/src/chet/src/bash/src/parse.y"
#line 338 "/usr/local/src/chet/src/bash/src/parse.y"
WORD_DESC *word; /* the word that we read. */
int number; /* the number that we read. */