diff --git a/CHANGES b/CHANGES index 5f51c429..ed856182 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,78 @@ +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. diff --git a/CHANGES-5.2 b/CHANGES-5.2 index 752552af..e14f3b0f 100644 --- a/CHANGES-5.2 +++ b/CHANGES-5.2 @@ -1,3 +1,78 @@ +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. diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 5372efdc..66d3cd6b 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -3407,34 +3407,45 @@ lib/readline/search.c ---- subst.c - parameter_brace_expand_word: if we have double-quoted ${*} or ${@}, - make sure we are setting W_HASQUOTEDNULL in the flags we return to the - caller if we are returning QUOTED_NULL(word) - - parameter_brace_expand_word: if we have a double-quoted associative array - reference using `*' or `@', make sure we are setting W_HASQUOTEDNULL in the flags - we return to the caller if we are returning QUOTED_NULL(word) - - parameter_brace_expand: if we're using the `[:]+' word expansion operator, - we need to note a quoted null string and pass the W_QUOTEDNULL flag - back to the caller - - expand_word_internal: make sure to return a QUOTED_NULL (word[0] == CTLNUL) - back to the caller if HAD_QUOTED_NULL is set, regardless of whether or - not we see a quoted dollar at. Fix for bug reported by - Andreas Luik + make sure we are setting W_HASQUOTEDNULL in the flags we return to + the caller if we are returning QUOTED_NULL(word) + - parameter_brace_expand_word: if we have a double-quoted associative + array reference using `*' or `@', make sure we are setting + W_HASQUOTEDNULL in the flags we return to the caller if we are + returning QUOTED_NULL(word) + - parameter_brace_expand: if we're using the `[:]+' word expansion + operator, we need to note a quoted null string and pass the + W_QUOTEDNULL flag back to the caller + - expand_word_internal: make sure to return a QUOTED_NULL + (word[0] == CTLNUL) back to the caller if HAD_QUOTED_NULL is set, + regardless of whether or not we see a quoted dollar at. Fix for bug + reported by Andreas Luik arrayfunc.c - - array_value_internal: fix typo and set estatep->type to ARRAY_INDEXED for - indexed arrays + - array_value_internal: fix typo and set estatep->type to ARRAY_INDEXED + for indexed arrays 3/31 ---- lib/readline/{history.c,histlib.h} - - _hs_at_end_of_history: convenience function to tell whether or not the - current history position is at the end of the history list + - _hs_at_end_of_history: convenience function to tell whether or not + the current history position is at the end of the history list 4/1 --- lib/readline/search.c - make_history_line_current: don't free rl_undo_list if it is equal to - _rl_saved_line_for_history->data, since we will need to restore it later - if we got it from a history entry. Fixes issue dating back to 7/2021 and - changes to _rl_free_saved_line_for_history, current issue reported by - Andreas Schwab + _rl_saved_line_for_history->data, since we will need to restore it + later if we got it from a history entry. Fixes issue dating back to + 7/2021 and changes to _rl_free_saved_line_for_history, current issue + reported by Andreas Schwab + + 4/5 + --- +lib/readline/{complete,histfile,histsearch,isearch,terminal}.c + - xfree: use instead of free + + 4/7 + --- +configure.ac + - bumped version to bash-5.2-beta diff --git a/NEWS b/NEWS index 94ec9734..d742247b 100644 --- a/NEWS +++ b/NEWS @@ -97,6 +97,9 @@ 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'. + 2. New Features in Readline a. There is now an HS_HISTORY_VERSION containing the version number of the @@ -133,6 +136,19 @@ 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. + ------------------------------------------------------------------------------- This is a terse description of the new features added to bash-5.1 since the release of bash-5.0. As always, the manual page (doc/bash.1) is diff --git a/NEWS-5.2 b/NEWS-5.2 index 38223687..9c72b571 100644 --- a/NEWS-5.2 +++ b/NEWS-5.2 @@ -97,6 +97,9 @@ 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'. + 2. New Features in Readline a. There is now an HS_HISTORY_VERSION containing the version number of the @@ -132,3 +135,16 @@ h. rl_completer_word_break_characters is now `const char *' like 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. diff --git a/configure b/configure index 2cdf0596..0835ffa4 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac for Bash 5.2, version 5.039. # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for bash 5.2-alpha. +# Generated by GNU Autoconf 2.71 for bash 5.2-beta. # # Report bugs to . # @@ -612,8 +612,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='bash' PACKAGE_TARNAME='bash' -PACKAGE_VERSION='5.2-alpha' -PACKAGE_STRING='bash 5.2-alpha' +PACKAGE_VERSION='5.2-beta' +PACKAGE_STRING='bash 5.2-beta' 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-alpha to adapt to many kinds of systems. +\`configure' configures bash 5.2-beta 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-alpha:";; + short | recursive ) echo "Configuration of bash 5.2-beta:";; 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-alpha +bash configure 5.2-beta 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-alpha, which was +It was created by bash $as_me 5.2-beta, 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=alpha +RELSTATUS=beta case "$RELSTATUS" in alp*|bet*|dev*|rc*|releng*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;; @@ -22332,7 +22332,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-alpha, which was +This file was extended by bash $as_me 5.2-beta, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -22400,7 +22400,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-alpha +bash config.status 5.2-beta configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index ee44f446..2cae05e3 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ dnl Process this file with autoconf to produce a configure script. AC_REVISION([for Bash 5.2, version 5.039])dnl define(bashvers, 5.2) -define(relstatus, alpha) +define(relstatus, beta) AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org]) diff --git a/doc/bash.0 b/doc/bash.0 index b7368e6d..d39ecf87 100644 --- a/doc/bash.0 +++ b/doc/bash.0 @@ -1494,126 +1494,129 @@ PPAARRAAMMEETTEERRSS count back from the end of the array, and an index of -1 references the last element. - Any element of an array may be referenced using ${_n_a_m_e[_s_u_b_s_c_r_i_p_t]}. + The += operator will append to an array variable when assigning using + the compound assignment syntax; see PPAARRAAMMEETTEERRSS above. + + Any element of an array may be referenced using ${_n_a_m_e[_s_u_b_s_c_r_i_p_t]}. The braces are required to avoid conflicts with pathname expansion. If - _s_u_b_s_c_r_i_p_t is @@ or **, the word expands to all members of _n_a_m_e. These - subscripts differ only when the word appears within double quotes. If + _s_u_b_s_c_r_i_p_t is @@ or **, the word expands to all members of _n_a_m_e. These + subscripts differ only when the word appears within double quotes. If the word is double-quoted, ${_n_a_m_e[*]} expands to a single word with the - value of each array member separated by the first character of the IIFFSS + value of each array member separated by the first character of the IIFFSS special variable, and ${_n_a_m_e[@]} expands each element of _n_a_m_e to a sep- - arate word. When there are no array members, ${_n_a_m_e[@]} expands to - nothing. If the double-quoted expansion occurs within a word, the ex- + arate word. When there are no array members, ${_n_a_m_e[@]} expands to + nothing. If the double-quoted expansion occurs within a word, the ex- pansion of the first parameter is joined with the beginning part of the - original word, and the expansion of the last parameter is joined with + original word, and the expansion of the last parameter is joined with the last part of the original word. This is analogous to the expansion - of the special parameters ** and @@ (see SSppeecciiaall PPaarraammeetteerrss above). - ${#_n_a_m_e[_s_u_b_s_c_r_i_p_t]} expands to the length of ${_n_a_m_e[_s_u_b_s_c_r_i_p_t]}. If + of the special parameters ** and @@ (see SSppeecciiaall PPaarraammeetteerrss above). + ${#_n_a_m_e[_s_u_b_s_c_r_i_p_t]} expands to the length of ${_n_a_m_e[_s_u_b_s_c_r_i_p_t]}. If _s_u_b_s_c_r_i_p_t is ** or @@, the expansion is the number of elements in the ar- ray. If the _s_u_b_s_c_r_i_p_t used to reference an element of an indexed array - evaluates to a number less than zero, it is interpreted as relative to - one greater than the maximum index of the array, so negative indices + evaluates to a number less than zero, it is interpreted as relative to + one greater than the maximum index of the array, so negative indices count back from the end of the array, and an index of -1 references the last element. Referencing an array variable without a subscript is equivalent to ref- - erencing the array with a subscript of 0. Any reference to a variable + erencing the array with a subscript of 0. Any reference to a variable using a valid subscript is legal, and bbaasshh will create an array if nec- essary. - An array variable is considered set if a subscript has been assigned a + An array variable is considered set if a subscript has been assigned a value. The null string is a valid value. - It is possible to obtain the keys (indices) of an array as well as the - values. ${!!_n_a_m_e[_@]} and ${!!_n_a_m_e[_*]} expand to the indices assigned in + It is possible to obtain the keys (indices) of an array as well as the + values. ${!!_n_a_m_e[_@]} and ${!!_n_a_m_e[_*]} expand to the indices assigned in array variable _n_a_m_e. The treatment when in double quotes is similar to the expansion of the special parameters _@ and _* within double quotes. The uunnsseett builtin is used to destroy arrays. uunnsseett _n_a_m_e[_s_u_b_s_c_r_i_p_t] de- stroys the array element at index _s_u_b_s_c_r_i_p_t, for both indexed and asso- - ciative arrays. Negative subscripts to indexed arrays are interpreted - as described above. Unsetting the last element of an array variable - does not unset the variable. uunnsseett _n_a_m_e, where _n_a_m_e is an array, re- + ciative arrays. Negative subscripts to indexed arrays are interpreted + as described above. Unsetting the last element of an array variable + does not unset the variable. uunnsseett _n_a_m_e, where _n_a_m_e is an array, re- moves the entire array. uunnsseett _n_a_m_e[_s_u_b_s_c_r_i_p_t], where _s_u_b_s_c_r_i_p_t is ** or @@, behaves differently depending on whether _n_a_m_e is an indexed or asso- - ciative array. If _n_a_m_e is an associative array, this unsets the ele- + ciative array. If _n_a_m_e is an associative array, this unsets the ele- ment with subscript ** or @@. If _n_a_m_e is an indexed array, unset removes all of the elements but does not remove the array itself. - When using a variable name with a subscript as an argument to a com- - mand, such as with uunnsseett, without using the word expansion syntax de- + When using a variable name with a subscript as an argument to a com- + mand, such as with uunnsseett, without using the word expansion syntax de- scribed above, the argument is subject to pathname expansion. If path- name expansion is not desired, the argument should be quoted. - The ddeeccllaarree, llooccaall, and rreeaaddoonnllyy builtins each accept a --aa option to - specify an indexed array and a --AA option to specify an associative ar- - ray. If both options are supplied, --AA takes precedence. The rreeaadd - builtin accepts a --aa option to assign a list of words read from the + The ddeeccllaarree, llooccaall, and rreeaaddoonnllyy builtins each accept a --aa option to + specify an indexed array and a --AA option to specify an associative ar- + ray. If both options are supplied, --AA takes precedence. The rreeaadd + builtin accepts a --aa option to assign a list of words read from the standard input to an array. The sseett and ddeeccllaarree builtins display array values in a way that allows them to be reused as assignments. EEXXPPAANNSSIIOONN Expansion is performed on the command line after it has been split into - words. There are seven kinds of expansion performed: _b_r_a_c_e _e_x_p_a_n_s_i_o_n, - _t_i_l_d_e _e_x_p_a_n_s_i_o_n, _p_a_r_a_m_e_t_e_r _a_n_d _v_a_r_i_a_b_l_e _e_x_p_a_n_s_i_o_n, _c_o_m_m_a_n_d _s_u_b_s_t_i_t_u_- + words. There are seven kinds of expansion performed: _b_r_a_c_e _e_x_p_a_n_s_i_o_n, + _t_i_l_d_e _e_x_p_a_n_s_i_o_n, _p_a_r_a_m_e_t_e_r _a_n_d _v_a_r_i_a_b_l_e _e_x_p_a_n_s_i_o_n, _c_o_m_m_a_n_d _s_u_b_s_t_i_t_u_- _t_i_o_n, _a_r_i_t_h_m_e_t_i_c _e_x_p_a_n_s_i_o_n, _w_o_r_d _s_p_l_i_t_t_i_n_g, and _p_a_t_h_n_a_m_e _e_x_p_a_n_s_i_o_n. The order of expansions is: brace expansion; tilde expansion, parameter - and variable expansion, arithmetic expansion, and command substitution - (done in a left-to-right fashion); word splitting; and pathname expan- + and variable expansion, arithmetic expansion, and command substitution + (done in a left-to-right fashion); word splitting; and pathname expan- sion. On systems that can support it, there is an additional expansion avail- - able: _p_r_o_c_e_s_s _s_u_b_s_t_i_t_u_t_i_o_n. This is performed at the same time as - tilde, parameter, variable, and arithmetic expansion and command sub- + able: _p_r_o_c_e_s_s _s_u_b_s_t_i_t_u_t_i_o_n. This is performed at the same time as + tilde, parameter, variable, and arithmetic expansion and command sub- stitution. - After these expansions are performed, quote characters present in the - original word are removed unless they have been quoted themselves + After these expansions are performed, quote characters present in the + original word are removed unless they have been quoted themselves (_q_u_o_t_e _r_e_m_o_v_a_l). - Only brace expansion, word splitting, and pathname expansion can in- - crease the number of words of the expansion; other expansions expand a - single word to a single word. The only exceptions to this are the ex- + Only brace expansion, word splitting, and pathname expansion can in- + crease the number of words of the expansion; other expansions expand a + single word to a single word. The only exceptions to this are the ex- pansions of "$$@@" and "$${{_n_a_m_e[[@@]]}}", and, in most cases, $$** and $${{_n_a_m_e[[**]]}} as explained above (see PPAARRAAMMEETTEERRSS). BBrraaccee EExxppaannssiioonn _B_r_a_c_e _e_x_p_a_n_s_i_o_n is a mechanism by which arbitrary strings may be gener- - ated. This mechanism is similar to _p_a_t_h_n_a_m_e _e_x_p_a_n_s_i_o_n, but the file- + ated. This mechanism is similar to _p_a_t_h_n_a_m_e _e_x_p_a_n_s_i_o_n, but the file- names generated need not exist. Patterns to be brace expanded take the form of an optional _p_r_e_a_m_b_l_e, followed by either a series of comma-sep- - arated strings or a sequence expression between a pair of braces, fol- - lowed by an optional _p_o_s_t_s_c_r_i_p_t. The preamble is prefixed to each + arated strings or a sequence expression between a pair of braces, fol- + lowed by an optional _p_o_s_t_s_c_r_i_p_t. The preamble is prefixed to each string contained within the braces, and the postscript is then appended to each resulting string, expanding left to right. - Brace expansions may be nested. The results of each expanded string - are not sorted; left to right order is preserved. For example, + Brace expansions may be nested. The results of each expanded string + are not sorted; left to right order is preserved. For example, a{{d,c,b}}e expands into `ade ace abe'. - A sequence expression takes the form {{_x...._y[[...._i_n_c_r]]}}, where _x and _y are - either integers or single letters, and _i_n_c_r, an optional increment, is + A sequence expression takes the form {{_x...._y[[...._i_n_c_r]]}}, where _x and _y are + either integers or single letters, and _i_n_c_r, an optional increment, is an integer. When integers are supplied, the expression expands to each - number between _x and _y, inclusive. Supplied integers may be prefixed - with _0 to force each term to have the same width. When either _x or _y - begins with a zero, the shell attempts to force all generated terms to - contain the same number of digits, zero-padding where necessary. When - letters are supplied, the expression expands to each character lexico- - graphically between _x and _y, inclusive, using the default C locale. - Note that both _x and _y must be of the same type (integer or letter). - When the increment is supplied, it is used as the difference between + number between _x and _y, inclusive. Supplied integers may be prefixed + with _0 to force each term to have the same width. When either _x or _y + begins with a zero, the shell attempts to force all generated terms to + contain the same number of digits, zero-padding where necessary. When + letters are supplied, the expression expands to each character lexico- + graphically between _x and _y, inclusive, using the default C locale. + Note that both _x and _y must be of the same type (integer or letter). + When the increment is supplied, it is used as the difference between each term. The default increment is 1 or -1 as appropriate. Brace expansion is performed before any other expansions, and any char- - acters special to other expansions are preserved in the result. It is - strictly textual. BBaasshh does not apply any syntactic interpretation to + acters special to other expansions are preserved in the result. It is + strictly textual. BBaasshh does not apply any syntactic interpretation to the context of the expansion or the text between the braces. - A correctly-formed brace expansion must contain unquoted opening and + A correctly-formed brace expansion must contain unquoted opening and closing braces, and at least one unquoted comma or a valid sequence ex- pression. Any incorrectly formed brace expansion is left unchanged. A - {{ or ,, may be quoted with a backslash to prevent its being considered - part of a brace expression. To avoid conflicts with parameter expan- + {{ or ,, may be quoted with a backslash to prevent its being considered + part of a brace expression. To avoid conflicts with parameter expan- sion, the string $${{ is not considered eligible for brace expansion, and inhibits brace expansion until the closing }}. @@ -1624,36 +1627,36 @@ EEXXPPAANNSSIIOONN or chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}} - Brace expansion introduces a slight incompatibility with historical - versions of sshh. sshh does not treat opening or closing braces specially - when they appear as part of a word, and preserves them in the output. - BBaasshh removes braces from words as a consequence of brace expansion. - For example, a word entered to sshh as _f_i_l_e_{_1_,_2_} appears identically in - the output. The same word is output as _f_i_l_e_1 _f_i_l_e_2 after expansion by - bbaasshh. If strict compatibility with sshh is desired, start bbaasshh with the + Brace expansion introduces a slight incompatibility with historical + versions of sshh. sshh does not treat opening or closing braces specially + when they appear as part of a word, and preserves them in the output. + BBaasshh removes braces from words as a consequence of brace expansion. + For example, a word entered to sshh as _f_i_l_e_{_1_,_2_} appears identically in + the output. The same word is output as _f_i_l_e_1 _f_i_l_e_2 after expansion by + bbaasshh. If strict compatibility with sshh is desired, start bbaasshh with the ++BB option or disable brace expansion with the ++BB option to the sseett com- mand (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). TTiillddee EExxppaannssiioonn - If a word begins with an unquoted tilde character (`~~'), all of the - characters preceding the first unquoted slash (or all characters, if - there is no unquoted slash) are considered a _t_i_l_d_e_-_p_r_e_f_i_x. If none of - the characters in the tilde-prefix are quoted, the characters in the - tilde-prefix following the tilde are treated as a possible _l_o_g_i_n _n_a_m_e. - If this login name is the null string, the tilde is replaced with the - value of the shell parameter HHOOMMEE. If HHOOMMEE is unset, the home direc- - tory of the user executing the shell is substituted instead. Other- - wise, the tilde-prefix is replaced with the home directory associated + If a word begins with an unquoted tilde character (`~~'), all of the + characters preceding the first unquoted slash (or all characters, if + there is no unquoted slash) are considered a _t_i_l_d_e_-_p_r_e_f_i_x. If none of + the characters in the tilde-prefix are quoted, the characters in the + tilde-prefix following the tilde are treated as a possible _l_o_g_i_n _n_a_m_e. + If this login name is the null string, the tilde is replaced with the + value of the shell parameter HHOOMMEE. If HHOOMMEE is unset, the home direc- + tory of the user executing the shell is substituted instead. Other- + wise, the tilde-prefix is replaced with the home directory associated with the specified login name. - If the tilde-prefix is a `~+', the value of the shell variable PPWWDD re- - places the tilde-prefix. If the tilde-prefix is a `~-', the value of - the shell variable OOLLDDPPWWDD, if it is set, is substituted. If the char- - acters following the tilde in the tilde-prefix consist of a number _N, - optionally prefixed by a `+' or a `-', the tilde-prefix is replaced + If the tilde-prefix is a `~+', the value of the shell variable PPWWDD re- + places the tilde-prefix. If the tilde-prefix is a `~-', the value of + the shell variable OOLLDDPPWWDD, if it is set, is substituted. If the char- + acters following the tilde in the tilde-prefix consist of a number _N, + optionally prefixed by a `+' or a `-', the tilde-prefix is replaced with the corresponding element from the directory stack, as it would be displayed by the ddiirrss builtin invoked with the tilde-prefix as an argu- - ment. If the characters following the tilde in the tilde-prefix con- + ment. If the characters following the tilde in the tilde-prefix con- sist of a number without a leading `+' or `-', `+' is assumed. If the login name is invalid, or the tilde expansion fails, the word is @@ -1662,99 +1665,100 @@ EEXXPPAANNSSIIOONN Each variable assignment is checked for unquoted tilde-prefixes immedi- ately following a :: or the first ==. In these cases, tilde expansion is also performed. Consequently, one may use filenames with tildes in as- - signments to PPAATTHH, MMAAIILLPPAATTHH, and CCDDPPAATTHH, and the shell assigns the ex- + signments to PPAATTHH, MMAAIILLPPAATTHH, and CCDDPPAATTHH, and the shell assigns the ex- panded value. - Bash also performs tilde expansion on words satisfying the conditions + Bash also performs tilde expansion on words satisfying the conditions of variable assignments (as described above under PPAARRAAMMEETTEERRSS) when they - appear as arguments to simple commands. Bash does not do this, except + appear as arguments to simple commands. Bash does not do this, except for the _d_e_c_l_a_r_a_t_i_o_n commands listed above, when in _p_o_s_i_x _m_o_d_e. PPaarraammeetteerr EExxppaannssiioonn The `$$' character introduces parameter expansion, command substitution, - or arithmetic expansion. The parameter name or symbol to be expanded - may be enclosed in braces, which are optional but serve to protect the - variable to be expanded from characters immediately following it which + or arithmetic expansion. The parameter name or symbol to be expanded + may be enclosed in braces, which are optional but serve to protect the + variable to be expanded from characters immediately following it which could be interpreted as part of the name. - When braces are used, the matching ending brace is the first `}}' not + When braces are used, the matching ending brace is the first `}}' not escaped by a backslash or within a quoted string, and not within an em- - bedded arithmetic expansion, command substitution, or parameter expan- + bedded arithmetic expansion, command substitution, or parameter expan- sion. ${_p_a_r_a_m_e_t_e_r} - The value of _p_a_r_a_m_e_t_e_r is substituted. The braces are required - when _p_a_r_a_m_e_t_e_r is a positional parameter with more than one + The value of _p_a_r_a_m_e_t_e_r is substituted. The braces are required + when _p_a_r_a_m_e_t_e_r is a positional parameter with more than one digit, or when _p_a_r_a_m_e_t_e_r is followed by a character which is not to be interpreted as part of its name. The _p_a_r_a_m_e_t_e_r is a shell - parameter as described above PPAARRAAMMEETTEERRSS) or an array reference + parameter as described above PPAARRAAMMEETTEERRSS) or an array reference (AArrrraayyss). - If the first character of _p_a_r_a_m_e_t_e_r is an exclamation point (!!), and + If the first character of _p_a_r_a_m_e_t_e_r is an exclamation point (!!), and _p_a_r_a_m_e_t_e_r is not a _n_a_m_e_r_e_f, it introduces a level of indirection. BBaasshh uses the value formed by expanding the rest of _p_a_r_a_m_e_t_e_r as the new _p_a_- - _r_a_m_e_t_e_r; this is then expanded and that value is used in the rest of - the expansion, rather than the expansion of the original _p_a_r_a_m_e_t_e_r. + _r_a_m_e_t_e_r; this is then expanded and that value is used in the rest of + the expansion, rather than the expansion of the original _p_a_r_a_m_e_t_e_r. This is known as _i_n_d_i_r_e_c_t _e_x_p_a_n_s_i_o_n. The value is subject to tilde ex- - pansion, parameter expansion, command substitution, and arithmetic ex- - pansion. If _p_a_r_a_m_e_t_e_r is a nameref, this expands to the name of the - parameter referenced by _p_a_r_a_m_e_t_e_r instead of performing the complete - indirect expansion. The exceptions to this are the expansions of - ${!!_p_r_e_f_i_x**} and ${!!_n_a_m_e[_@]} described below. The exclamation point - must immediately follow the left brace in order to introduce indirec- + pansion, parameter expansion, command substitution, and arithmetic ex- + pansion. If _p_a_r_a_m_e_t_e_r is a nameref, this expands to the name of the + parameter referenced by _p_a_r_a_m_e_t_e_r instead of performing the complete + indirect expansion. The exceptions to this are the expansions of + ${!!_p_r_e_f_i_x**} and ${!!_n_a_m_e[_@]} described below. The exclamation point + must immediately follow the left brace in order to introduce indirec- tion. In each of the cases below, _w_o_r_d is subject to tilde expansion, parame- ter expansion, command substitution, and arithmetic expansion. When not performing substring expansion, using the forms documented be- - low (e.g., ::--), bbaasshh tests for a parameter that is unset or null. - Omitting the colon results in a test only for a parameter that is un- + low (e.g., ::--), bbaasshh tests for a parameter that is unset or null. + Omitting the colon results in a test only for a parameter that is un- set. ${_p_a_r_a_m_e_t_e_r::--_w_o_r_d} - UUssee DDeeffaauulltt VVaalluueess. If _p_a_r_a_m_e_t_e_r is unset or null, the expan- - sion of _w_o_r_d is substituted. Otherwise, the value of _p_a_r_a_m_e_t_e_r + UUssee DDeeffaauulltt VVaalluueess. If _p_a_r_a_m_e_t_e_r is unset or null, the expan- + sion of _w_o_r_d is substituted. Otherwise, the value of _p_a_r_a_m_e_t_e_r is substituted. ${_p_a_r_a_m_e_t_e_r::==_w_o_r_d} - AAssssiiggnn DDeeffaauulltt VVaalluueess. If _p_a_r_a_m_e_t_e_r is unset or null, the ex- - pansion of _w_o_r_d is assigned to _p_a_r_a_m_e_t_e_r. The value of _p_a_r_a_m_e_- - _t_e_r is then substituted. Positional parameters and special pa- + AAssssiiggnn DDeeffaauulltt VVaalluueess. If _p_a_r_a_m_e_t_e_r is unset or null, the ex- + pansion of _w_o_r_d is assigned to _p_a_r_a_m_e_t_e_r. The value of _p_a_r_a_m_e_- + _t_e_r is then substituted. Positional parameters and special pa- rameters may not be assigned to in this way. ${_p_a_r_a_m_e_t_e_r::??_w_o_r_d} - DDiissppllaayy EErrrroorr iiff NNuullll oorr UUnnsseett. If _p_a_r_a_m_e_t_e_r is null or unset, - the expansion of _w_o_r_d (or a message to that effect if _w_o_r_d is - not present) is written to the standard error and the shell, if + DDiissppllaayy EErrrroorr iiff NNuullll oorr UUnnsseett. If _p_a_r_a_m_e_t_e_r is null or unset, + the expansion of _w_o_r_d (or a message to that effect if _w_o_r_d is + not present) is written to the standard error and the shell, if it is not interactive, exits. Otherwise, the value of _p_a_r_a_m_e_t_e_r is substituted. ${_p_a_r_a_m_e_t_e_r::++_w_o_r_d} - UUssee AAlltteerrnnaattee VVaalluuee. If _p_a_r_a_m_e_t_e_r is null or unset, nothing is + UUssee AAlltteerrnnaattee VVaalluuee. If _p_a_r_a_m_e_t_e_r is null or unset, nothing is substituted, otherwise the expansion of _w_o_r_d is substituted. ${_p_a_r_a_m_e_t_e_r::_o_f_f_s_e_t} ${_p_a_r_a_m_e_t_e_r::_o_f_f_s_e_t::_l_e_n_g_t_h} - SSuubbssttrriinngg EExxppaannssiioonn. Expands to up to _l_e_n_g_t_h characters of the - value of _p_a_r_a_m_e_t_e_r starting at the character specified by _o_f_f_- - _s_e_t. If _p_a_r_a_m_e_t_e_r is @@, an indexed array subscripted by @@ or **, - or an associative array name, the results differ as described - below. If _l_e_n_g_t_h is omitted, expands to the substring of the - value of _p_a_r_a_m_e_t_e_r starting at the character specified by _o_f_f_s_e_t - and extending to the end of the value. _l_e_n_g_t_h and _o_f_f_s_e_t are - arithmetic expressions (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN below). + SSuubbssttrriinngg EExxppaannssiioonn. Expands to up to _l_e_n_g_t_h characters of the + value of _p_a_r_a_m_e_t_e_r starting at the character specified by _o_f_f_- + _s_e_t. If _p_a_r_a_m_e_t_e_r is @@ or **, an indexed array subscripted by @@ + or **, or an associative array name, the results differ as de- + scribed below. If _l_e_n_g_t_h is omitted, expands to the substring + of the value of _p_a_r_a_m_e_t_e_r starting at the character specified by + _o_f_f_s_e_t and extending to the end of the value. _l_e_n_g_t_h and _o_f_f_s_e_t + are arithmetic expressions (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN below). - If _o_f_f_s_e_t evaluates to a number less than zero, the value is + If _o_f_f_s_e_t evaluates to a number less than zero, the value is used as an offset in characters from the end of the value of _p_a_- - _r_a_m_e_t_e_r. If _l_e_n_g_t_h evaluates to a number less than zero, it is + _r_a_m_e_t_e_r. If _l_e_n_g_t_h evaluates to a number less than zero, it is interpreted as an offset in characters from the end of the value - of _p_a_r_a_m_e_t_e_r rather than a number of characters, and the expan- - sion is the characters between _o_f_f_s_e_t and that result. Note - that a negative offset must be separated from the colon by at + of _p_a_r_a_m_e_t_e_r rather than a number of characters, and the expan- + sion is the characters between _o_f_f_s_e_t and that result. Note + that a negative offset must be separated from the colon by at least one space to avoid being confused with the ::-- expansion. - If _p_a_r_a_m_e_t_e_r is @@, the result is _l_e_n_g_t_h positional parameters - beginning at _o_f_f_s_e_t. A negative _o_f_f_s_e_t is taken relative to one - greater than the greatest positional parameter, so an offset of - -1 evaluates to the last positional parameter. It is an expan- - sion error if _l_e_n_g_t_h evaluates to a number less than zero. + If _p_a_r_a_m_e_t_e_r is @@ or **, the result is _l_e_n_g_t_h positional parame- + ters beginning at _o_f_f_s_e_t. A negative _o_f_f_s_e_t is taken relative + to one greater than the greatest positional parameter, so an + offset of -1 evaluates to the last positional parameter. It is + an expansion error if _l_e_n_g_t_h evaluates to a number less than + zero. If _p_a_r_a_m_e_t_e_r is an indexed array name subscripted by @ or *, the result is the _l_e_n_g_t_h members of the array beginning with ${_p_a_- @@ -2470,15 +2474,23 @@ FFUUNNCCTTIIOONNSS option has been enabled. Variables local to the function may be declared with the llooccaall builtin - command. Ordinarily, variables and their values are shared between the - function and its caller. If a variable is declared llooccaall, the vari- - able's visible scope is restricted to that function and its children - (including the functions it calls). Local variables "shadow" variables - with the same name declared at previous scopes. For instance, a local - variable declared in a function hides a global variable of the same - name: references and assignments refer to the local variable, leaving - the global variable unmodified. When the function returns, the global - variable is once again visible. + command (_l_o_c_a_l _v_a_r_i_a_b_l_e_s). Ordinarily, variables and their values are + shared between the function and its caller. If a variable is declared + llooccaall, the variable's visible scope is restricted to that function and + its children (including the functions it calls). + + In the following description, the _c_u_r_r_e_n_t _s_c_o_p_e is a currently- execut- + ing function. Previous scopes consist of that function's caller and so + on, back to the "global" scope, where the shell is not executing any + shell function. Consequently, a local variable at the current scope is + a variable declared using the llooccaall or ddeeccllaarree builtins in the function + that is currently executing. + + Local variables "shadow" variables with the same name declared at pre- + vious scopes. For instance, a local variable declared in a function + hides a global variable of the same name: references and assignments + refer to the local variable, leaving the global variable unmodified. + When the function returns, the global variable is once again visible. The shell uses _d_y_n_a_m_i_c _s_c_o_p_i_n_g to control a variable's visibility within functions. With dynamic scoping, visible variables and their @@ -2498,44 +2510,45 @@ FFUUNNCCTTIIOONNSS is local to the current scope, uunnsseett will unset it; otherwise the unset will refer to the variable found in any calling scope as described above. If a variable at the current local scope is unset, it will re- - main so until it is reset in that scope or until the function returns. - Once the function returns, any instance of the variable at a previous - scope will become visible. If the unset acts on a variable at a previ- - ous scope, any instance of a variable with that name that had been - shadowed will become visible. + main so (appearing as unset) until it is reset in that scope or until + the function returns. Once the function returns, any instance of the + variable at a previous scope will become visible. If the unset acts on + a variable at a previous scope, any instance of a variable with that + name that had been shadowed will become visible (see below how the lloo-- + ccaallvvaarr__uunnsseett shell option changes this behavior). - The FFUUNNCCNNEESSTT variable, if set to a numeric value greater than 0, de- - fines a maximum function nesting level. Function invocations that ex- + The FFUUNNCCNNEESSTT variable, if set to a numeric value greater than 0, de- + fines a maximum function nesting level. Function invocations that ex- ceed the limit cause the entire command to abort. - If the builtin command rreettuurrnn is executed in a function, the function - completes and execution resumes with the next command after the func- + If the builtin command rreettuurrnn is executed in a function, the function + completes and execution resumes with the next command after the func- tion call. Any command associated with the RREETTUURRNN trap is executed be- - fore execution resumes. When a function completes, the values of the - positional parameters and the special parameter ## are restored to the + fore execution resumes. When a function completes, the values of the + positional parameters and the special parameter ## are restored to the values they had prior to the function's execution. - Function names and definitions may be listed with the --ff option to the + Function names and definitions may be listed with the --ff option to the ddeeccllaarree or ttyyppeesseett builtin commands. The --FF option to ddeeccllaarree or ttyyppee-- - sseett will list the function names only (and optionally the source file - and line number, if the eexxttddeebbuugg shell option is enabled). Functions - may be exported so that child shell processes (those created when exe- - cuting a separate shell invocation) automatically have them defined + sseett will list the function names only (and optionally the source file + and line number, if the eexxttddeebbuugg shell option is enabled). Functions + may be exported so that child shell processes (those created when exe- + cuting a separate shell invocation) automatically have them defined with the --ff option to the eexxppoorrtt builtin. A function definition may be deleted using the --ff option to the uunnsseett builtin. Functions may be recursive. The FFUUNNCCNNEESSTT variable may be used to limit - the depth of the function call stack and restrict the number of func- + the depth of the function call stack and restrict the number of func- tion invocations. By default, no limit is imposed on the number of re- cursive calls. AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN - The shell allows arithmetic expressions to be evaluated, under certain - circumstances (see the lleett and ddeeccllaarree builtin commands, the (((( com- + The shell allows arithmetic expressions to be evaluated, under certain + circumstances (see the lleett and ddeeccllaarree builtin commands, the (((( com- pound command, and AArriitthhmmeettiicc EExxppaannssiioonn). Evaluation is done in fixed- - width integers with no check for overflow, though division by 0 is - trapped and flagged as an error. The operators and their precedence, - associativity, and values are the same as in the C language. The fol- + width integers with no check for overflow, though division by 0 is + trapped and flagged as an error. The operators and their precedence, + associativity, and values are the same as in the C language. The fol- lowing list of operators is grouped into levels of equal-precedence op- erators. The levels are listed in order of decreasing precedence. @@ -2564,55 +2577,55 @@ AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN _e_x_p_r_1 ,, _e_x_p_r_2 comma - Shell variables are allowed as operands; parameter expansion is per- + Shell variables are allowed as operands; parameter expansion is per- formed before the expression is evaluated. Within an expression, shell - variables may also be referenced by name without using the parameter - expansion syntax. A shell variable that is null or unset evaluates to + variables may also be referenced by name without using the parameter + expansion syntax. A shell variable that is null or unset evaluates to 0 when referenced by name without using the parameter expansion syntax. - The value of a variable is evaluated as an arithmetic expression when - it is referenced, or when a variable which has been given the _i_n_t_e_g_e_r + The value of a variable is evaluated as an arithmetic expression when + it is referenced, or when a variable which has been given the _i_n_t_e_g_e_r attribute using ddeeccllaarree --ii is assigned a value. A null value evaluates - to 0. A shell variable need not have its _i_n_t_e_g_e_r attribute turned on + to 0. A shell variable need not have its _i_n_t_e_g_e_r attribute turned on to be used in an expression. Integer constants follow the C language definition, without suffixes or character constants. Constants with a leading 0 are interpreted as oc- - tal numbers. A leading 0x or 0X denotes hexadecimal. Otherwise, num- - bers take the form [_b_a_s_e_#]n, where the optional _b_a_s_e is a decimal num- - ber between 2 and 64 representing the arithmetic base, and _n is a num- - ber in that base. If _b_a_s_e_# is omitted, then base 10 is used. When + tal numbers. A leading 0x or 0X denotes hexadecimal. Otherwise, num- + bers take the form [_b_a_s_e_#]n, where the optional _b_a_s_e is a decimal num- + ber between 2 and 64 representing the arithmetic base, and _n is a num- + ber in that base. If _b_a_s_e_# is omitted, then base 10 is used. When specifying _n, if a non-digit is required, the digits greater than 9 are - represented by the lowercase letters, the uppercase letters, @, and _, - in that order. If _b_a_s_e is less than or equal to 36, lowercase and up- - percase letters may be used interchangeably to represent numbers be- + represented by the lowercase letters, the uppercase letters, @, and _, + in that order. If _b_a_s_e is less than or equal to 36, lowercase and up- + percase letters may be used interchangeably to represent numbers be- tween 10 and 35. - Operators are evaluated in order of precedence. Sub-expressions in - parentheses are evaluated first and may override the precedence rules + Operators are evaluated in order of precedence. Sub-expressions in + parentheses are evaluated first and may override the precedence rules above. CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS - Conditional expressions are used by the [[[[ compound command and the - tteesstt and [[ builtin commands to test file attributes and perform string - and arithmetic comparisons. The tteesstt and [[ commands determine their - behavior based on the number of arguments; see the descriptions of + Conditional expressions are used by the [[[[ compound command and the + tteesstt and [[ builtin commands to test file attributes and perform string + and arithmetic comparisons. The tteesstt and [[ commands determine their + behavior based on the number of arguments; see the descriptions of those commands for any other command-specific actions. - Expressions are formed from the following unary or binary primaries. - BBaasshh handles several filenames specially when they are used in expres- + Expressions are formed from the following unary or binary primaries. + BBaasshh handles several filenames specially when they are used in expres- sions. If the operating system on which bbaasshh is running provides these - special files, bash will use them; otherwise it will emulate them in- - ternally with this behavior: If any _f_i_l_e argument to one of the pri- + special files, bash will use them; otherwise it will emulate them in- + ternally with this behavior: If any _f_i_l_e argument to one of the pri- maries is of the form _/_d_e_v_/_f_d_/_n, then file descriptor _n is checked. If - the _f_i_l_e argument to one of the primaries is one of _/_d_e_v_/_s_t_d_i_n, - _/_d_e_v_/_s_t_d_o_u_t, or _/_d_e_v_/_s_t_d_e_r_r, file descriptor 0, 1, or 2, respectively, + the _f_i_l_e argument to one of the primaries is one of _/_d_e_v_/_s_t_d_i_n, + _/_d_e_v_/_s_t_d_o_u_t, or _/_d_e_v_/_s_t_d_e_r_r, file descriptor 0, 1, or 2, respectively, is checked. Unless otherwise specified, primaries that operate on files follow sym- bolic links and operate on the target of the link, rather than the link itself. - When used with [[[[, the << and >> operators sort lexicographically using + When used with [[[[, the << and >> operators sort lexicographically using the current locale. The tteesstt command sorts using ASCII ordering. --aa _f_i_l_e @@ -2651,30 +2664,30 @@ CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS --LL _f_i_l_e True if _f_i_l_e exists and is a symbolic link. --NN _f_i_l_e - True if _f_i_l_e exists and has been modified since it was last + True if _f_i_l_e exists and has been modified since it was last read. --OO _f_i_l_e True if _f_i_l_e exists and is owned by the effective user id. --SS _f_i_l_e True if _f_i_l_e exists and is a socket. _f_i_l_e_1 --eeff _f_i_l_e_2 - True if _f_i_l_e_1 and _f_i_l_e_2 refer to the same device and inode num- + True if _f_i_l_e_1 and _f_i_l_e_2 refer to the same device and inode num- bers. _f_i_l_e_1 -nntt _f_i_l_e_2 - True if _f_i_l_e_1 is newer (according to modification date) than + True if _f_i_l_e_1 is newer (according to modification date) than _f_i_l_e_2, or if _f_i_l_e_1 exists and _f_i_l_e_2 does not. _f_i_l_e_1 -oott _f_i_l_e_2 - True if _f_i_l_e_1 is older than _f_i_l_e_2, or if _f_i_l_e_2 exists and _f_i_l_e_1 + True if _f_i_l_e_1 is older than _f_i_l_e_2, or if _f_i_l_e_2 exists and _f_i_l_e_1 does not. --oo _o_p_t_n_a_m_e - True if the shell option _o_p_t_n_a_m_e is enabled. See the list of - options under the description of the --oo option to the sseett + True if the shell option _o_p_t_n_a_m_e is enabled. See the list of + options under the description of the --oo option to the sseett builtin below. --vv _v_a_r_n_a_m_e - True if the shell variable _v_a_r_n_a_m_e is set (has been assigned a + True if the shell variable _v_a_r_n_a_m_e is set (has been assigned a value). --RR _v_a_r_n_a_m_e - True if the shell variable _v_a_r_n_a_m_e is set and is a name refer- + True if the shell variable _v_a_r_n_a_m_e is set and is a name refer- ence. --zz _s_t_r_i_n_g True if the length of _s_t_r_i_n_g is zero. @@ -2684,8 +2697,8 @@ CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS _s_t_r_i_n_g_1 ==== _s_t_r_i_n_g_2 _s_t_r_i_n_g_1 == _s_t_r_i_n_g_2 - True if the strings are equal. == should be used with the tteesstt - command for POSIX conformance. When used with the [[[[ command, + True if the strings are equal. == should be used with the tteesstt + command for POSIX conformance. When used with the [[[[ command, this performs pattern matching as described above (CCoommppoouunndd CCoomm-- mmaannddss). @@ -2699,113 +2712,113 @@ CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS True if _s_t_r_i_n_g_1 sorts after _s_t_r_i_n_g_2 lexicographically. _a_r_g_1 OOPP _a_r_g_2 - OOPP is one of --eeqq, --nnee, --lltt, --llee, --ggtt, or --ggee. These arithmetic - binary operators return true if _a_r_g_1 is equal to, not equal to, - less than, less than or equal to, greater than, or greater than - or equal to _a_r_g_2, respectively. _A_r_g_1 and _a_r_g_2 may be positive - or negative integers. When used with the [[[[ command, _A_r_g_1 and - _A_r_g_2 are evaluated as arithmetic expressions (see AARRIITTHHMMEETTIICC + OOPP is one of --eeqq, --nnee, --lltt, --llee, --ggtt, or --ggee. These arithmetic + binary operators return true if _a_r_g_1 is equal to, not equal to, + less than, less than or equal to, greater than, or greater than + or equal to _a_r_g_2, respectively. _A_r_g_1 and _a_r_g_2 may be positive + or negative integers. When used with the [[[[ command, _A_r_g_1 and + _A_r_g_2 are evaluated as arithmetic expressions (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN above). SSIIMMPPLLEE CCOOMMMMAANNDD EEXXPPAANNSSIIOONN When a simple command is executed, the shell performs the following ex- - pansions, assignments, and redirections, from left to right, in the + pansions, assignments, and redirections, from left to right, in the following order. - 1. The words that the parser has marked as variable assignments - (those preceding the command name) and redirections are saved + 1. The words that the parser has marked as variable assignments + (those preceding the command name) and redirections are saved for later processing. - 2. The words that are not variable assignments or redirections are - expanded. If any words remain after expansion, the first word - is taken to be the name of the command and the remaining words + 2. The words that are not variable assignments or redirections are + expanded. If any words remain after expansion, the first word + is taken to be the name of the command and the remaining words are the arguments. 3. Redirections are performed as described above under RREEDDIIRREECCTTIIOONN. 4. The text after the == in each variable assignment undergoes tilde expansion, parameter expansion, command substitution, arithmetic - expansion, and quote removal before being assigned to the vari- + expansion, and quote removal before being assigned to the vari- able. If no command name results, the variable assignments affect the current - shell environment. In the case of such a command (one that consists - only of assignment statements and redirections), assignment statements - are performed before redirections. Otherwise, the variables are added - to the environment of the executed command and do not affect the cur- + shell environment. In the case of such a command (one that consists + only of assignment statements and redirections), assignment statements + are performed before redirections. Otherwise, the variables are added + to the environment of the executed command and do not affect the cur- rent shell environment. If any of the assignments attempts to assign a - value to a readonly variable, an error occurs, and the command exits + value to a readonly variable, an error occurs, and the command exits with a non-zero status. - If no command name results, redirections are performed, but do not af- - fect the current shell environment. A redirection error causes the + If no command name results, redirections are performed, but do not af- + fect the current shell environment. A redirection error causes the command to exit with a non-zero status. - If there is a command name left after expansion, execution proceeds as - described below. Otherwise, the command exits. If one of the expan- - sions contained a command substitution, the exit status of the command - is the exit status of the last command substitution performed. If + If there is a command name left after expansion, execution proceeds as + described below. Otherwise, the command exits. If one of the expan- + sions contained a command substitution, the exit status of the command + is the exit status of the last command substitution performed. If there were no command substitutions, the command exits with a status of zero. CCOOMMMMAANNDD EEXXEECCUUTTIIOONN - After a command has been split into words, if it results in a simple - command and an optional list of arguments, the following actions are + After a command has been split into words, if it results in a simple + command and an optional list of arguments, the following actions are taken. - If the command name contains no slashes, the shell attempts to locate - it. If there exists a shell function by that name, that function is - invoked as described above in FFUUNNCCTTIIOONNSS. If the name does not match a - function, the shell searches for it in the list of shell builtins. If + If the command name contains no slashes, the shell attempts to locate + it. If there exists a shell function by that name, that function is + invoked as described above in FFUUNNCCTTIIOONNSS. If the name does not match a + function, the shell searches for it in the list of shell builtins. If a match is found, that builtin is invoked. - If the name is neither a shell function nor a builtin, and contains no - slashes, bbaasshh searches each element of the PPAATTHH for a directory con- + If the name is neither a shell function nor a builtin, and contains no + slashes, bbaasshh searches each element of the PPAATTHH for a directory con- taining an executable file by that name. BBaasshh uses a hash table to re- - member the full pathnames of executable files (see hhaasshh under SSHHEELLLL - BBUUIILLTTIINN CCOOMMMMAANNDDSS below). A full search of the directories in PPAATTHH is - performed only if the command is not found in the hash table. If the + member the full pathnames of executable files (see hhaasshh under SSHHEELLLL + BBUUIILLTTIINN CCOOMMMMAANNDDSS below). A full search of the directories in PPAATTHH is + performed only if the command is not found in the hash table. If the search is unsuccessful, the shell searches for a defined shell function named ccoommmmaanndd__nnoott__ffoouunndd__hhaannddllee. If that function exists, it is invoked - in a separate execution environment with the original command and the - original command's arguments as its arguments, and the function's exit - status becomes the exit status of that subshell. If that function is + in a separate execution environment with the original command and the + original command's arguments as its arguments, and the function's exit + status becomes the exit status of that subshell. If that function is not defined, the shell prints an error message and returns an exit sta- tus of 127. - If the search is successful, or if the command name contains one or + If the search is successful, or if the command name contains one or more slashes, the shell executes the named program in a separate execu- tion environment. Argument 0 is set to the name given, and the remain- ing arguments to the command are set to the arguments given, if any. - If this execution fails because the file is not in executable format, - and the file is not a directory, it is assumed to be a _s_h_e_l_l _s_c_r_i_p_t, a + If this execution fails because the file is not in executable format, + and the file is not a directory, it is assumed to be a _s_h_e_l_l _s_c_r_i_p_t, a file containing shell commands, and the shell creates a new instance of - itself to execute it. This subshell reinitializes itself, so that the + itself to execute it. This subshell reinitializes itself, so that the effect is as if a new shell had been invoked to handle the script, with - the exception that the locations of commands remembered by the parent - (see hhaasshh below under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS) are retained by the + the exception that the locations of commands remembered by the parent + (see hhaasshh below under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS) are retained by the child. - If the program is a file beginning with ##!!, the remainder of the first - line specifies an interpreter for the program. The shell executes the + If the program is a file beginning with ##!!, the remainder of the first + line specifies an interpreter for the program. The shell executes the specified interpreter on operating systems that do not handle this exe- cutable format themselves. The arguments to the interpreter consist of - a single optional argument following the interpreter name on the first - line of the program, followed by the name of the program, followed by + a single optional argument following the interpreter name on the first + line of the program, followed by the name of the program, followed by the command arguments, if any. CCOOMMMMAANNDD EEXXEECCUUTTIIOONN EENNVVIIRROONNMMEENNTT - The shell has an _e_x_e_c_u_t_i_o_n _e_n_v_i_r_o_n_m_e_n_t, which consists of the follow- + The shell has an _e_x_e_c_u_t_i_o_n _e_n_v_i_r_o_n_m_e_n_t, which consists of the follow- ing: - +o open files inherited by the shell at invocation, as modified by + +o open files inherited by the shell at invocation, as modified by redirections supplied to the eexxeecc builtin - +o the current working directory as set by ccdd, ppuusshhdd, or ppooppdd, or + +o the current working directory as set by ccdd, ppuusshhdd, or ppooppdd, or inherited by the shell at invocation - +o the file creation mode mask as set by uummaasskk or inherited from + +o the file creation mode mask as set by uummaasskk or inherited from the shell's parent +o current traps set by ttrraapp @@ -2813,282 +2826,282 @@ CCOOMMMMAANNDD EEXXEECCUUTTIIOONN EENNVVIIRROONNMMEENN +o shell parameters that are set by variable assignment or with sseett or inherited from the shell's parent in the environment - +o shell functions defined during execution or inherited from the + +o shell functions defined during execution or inherited from the shell's parent in the environment - +o options enabled at invocation (either by default or with com- + +o options enabled at invocation (either by default or with com- mand-line arguments) or by sseett +o options enabled by sshhoopptt +o shell aliases defined with aalliiaass - +o various process IDs, including those of background jobs, the + +o various process IDs, including those of background jobs, the value of $$$$, and the value of PPPPIIDD - When a simple command other than a builtin or shell function is to be - executed, it is invoked in a separate execution environment that con- - sists of the following. Unless otherwise noted, the values are inher- + When a simple command other than a builtin or shell function is to be + executed, it is invoked in a separate execution environment that con- + sists of the following. Unless otherwise noted, the values are inher- ited from the shell. - +o the shell's open files, plus any modifications and additions + +o the shell's open files, plus any modifications and additions specified by redirections to the command +o the current working directory +o the file creation mode mask - +o shell variables and functions marked for export, along with + +o shell variables and functions marked for export, along with variables exported for the command, passed in the environment +o traps caught by the shell are reset to the values inherited from the shell's parent, and traps ignored by the shell are ignored - A command invoked in this separate environment cannot affect the + A command invoked in this separate environment cannot affect the shell's execution environment. A _s_u_b_s_h_e_l_l is a copy of the shell process. - Command substitution, commands grouped with parentheses, and asynchro- + Command substitution, commands grouped with parentheses, and asynchro- nous commands are invoked in a subshell environment that is a duplicate of the shell environment, except that traps caught by the shell are re- - set to the values that the shell inherited from its parent at invoca- + set to the values that the shell inherited from its parent at invoca- tion. Builtin commands that are invoked as part of a pipeline are also executed in a subshell environment. Changes made to the subshell envi- ronment cannot affect the shell's execution environment. Subshells spawned to execute command substitutions inherit the value of - the --ee option from the parent shell. When not in _p_o_s_i_x _m_o_d_e, bbaasshh + the --ee option from the parent shell. When not in _p_o_s_i_x _m_o_d_e, bbaasshh clears the --ee option in such subshells. - If a command is followed by a && and job control is not active, the de- + If a command is followed by a && and job control is not active, the de- fault standard input for the command is the empty file _/_d_e_v_/_n_u_l_l. Oth- - erwise, the invoked command inherits the file descriptors of the call- + erwise, the invoked command inherits the file descriptors of the call- ing shell as modified by redirections. EENNVVIIRROONNMMEENNTT - When a program is invoked it is given an array of strings called the + When a program is invoked it is given an array of strings called the _e_n_v_i_r_o_n_m_e_n_t. This is a list of _n_a_m_e-_v_a_l_u_e pairs, of the form _n_a_m_e=_v_a_l_u_e. - The shell provides several ways to manipulate the environment. On in- - vocation, the shell scans its own environment and creates a parameter - for each name found, automatically marking it for _e_x_p_o_r_t to child pro- + The shell provides several ways to manipulate the environment. On in- + vocation, the shell scans its own environment and creates a parameter + for each name found, automatically marking it for _e_x_p_o_r_t to child pro- cesses. Executed commands inherit the environment. The eexxppoorrtt and ddee-- - ccllaarree --xx commands allow parameters and functions to be added to and + ccllaarree --xx commands allow parameters and functions to be added to and deleted from the environment. If the value of a parameter in the envi- ronment is modified, the new value becomes part of the environment, re- - placing the old. The environment inherited by any executed command - consists of the shell's initial environment, whose values may be modi- - fied in the shell, less any pairs removed by the uunnsseett command, plus + placing the old. The environment inherited by any executed command + consists of the shell's initial environment, whose values may be modi- + fied in the shell, less any pairs removed by the uunnsseett command, plus any additions via the eexxppoorrtt and ddeeccllaarree --xx commands. - The environment for any _s_i_m_p_l_e _c_o_m_m_a_n_d or function may be augmented - temporarily by prefixing it with parameter assignments, as described + The environment for any _s_i_m_p_l_e _c_o_m_m_a_n_d or function may be augmented + temporarily by prefixing it with parameter assignments, as described above in PPAARRAAMMEETTEERRSS. These assignment statements affect only the envi- ronment seen by that command. - If the --kk option is set (see the sseett builtin command below), then _a_l_l - parameter assignments are placed in the environment for a command, not + If the --kk option is set (see the sseett builtin command below), then _a_l_l + parameter assignments are placed in the environment for a command, not just those that precede the command name. - When bbaasshh invokes an external command, the variable __ is set to the + When bbaasshh invokes an external command, the variable __ is set to the full filename of the command and passed to that command in its environ- ment. EEXXIITT SSTTAATTUUSS - The exit status of an executed command is the value returned by the + The exit status of an executed command is the value returned by the _w_a_i_t_p_i_d system call or equivalent function. Exit statuses fall between - 0 and 255, though, as explained below, the shell may use values above + 0 and 255, though, as explained below, the shell may use values above 125 specially. Exit statuses from shell builtins and compound commands are also limited to this range. Under certain circumstances, the shell will use special values to indicate specific failure modes. For the shell's purposes, a command which exits with a zero exit status - has succeeded. An exit status of zero indicates success. A non-zero - exit status indicates failure. When a command terminates on a fatal + has succeeded. An exit status of zero indicates success. A non-zero + exit status indicates failure. When a command terminates on a fatal signal _N, bbaasshh uses the value of 128+_N as the exit status. - If a command is not found, the child process created to execute it re- - turns a status of 127. If a command is found but is not executable, + If a command is not found, the child process created to execute it re- + turns a status of 127. If a command is found but is not executable, the return status is 126. If a command fails because of an error during expansion or redirection, the exit status is greater than zero. - Shell builtin commands return a status of 0 (_t_r_u_e) if successful, and - non-zero (_f_a_l_s_e) if an error occurs while they execute. All builtins - return an exit status of 2 to indicate incorrect usage, generally in- + Shell builtin commands return a status of 0 (_t_r_u_e) if successful, and + non-zero (_f_a_l_s_e) if an error occurs while they execute. All builtins + return an exit status of 2 to indicate incorrect usage, generally in- valid options or missing arguments. The exit status of the last command is available in the special parame- ter $?. - BBaasshh itself returns the exit status of the last command executed, un- - less a syntax error occurs, in which case it exits with a non-zero + BBaasshh itself returns the exit status of the last command executed, un- + less a syntax error occurs, in which case it exits with a non-zero value. See also the eexxiitt builtin command below. SSIIGGNNAALLSS - When bbaasshh is interactive, in the absence of any traps, it ignores + When bbaasshh is interactive, in the absence of any traps, it ignores SSIIGGTTEERRMM (so that kkiillll 00 does not kill an interactive shell), and SSIIGGIINNTT - is caught and handled (so that the wwaaiitt builtin is interruptible). In + is caught and handled (so that the wwaaiitt builtin is interruptible). In all cases, bbaasshh ignores SSIIGGQQUUIITT. If job control is in effect, bbaasshh ig- nores SSIIGGTTTTIINN, SSIIGGTTTTOOUU, and SSIIGGTTSSTTPP. Non-builtin commands run by bbaasshh have signal handlers set to the values inherited by the shell from its parent. When job control is not in ef- - fect, asynchronous commands ignore SSIIGGIINNTT and SSIIGGQQUUIITT in addition to - these inherited handlers. Commands run as a result of command substi- + fect, asynchronous commands ignore SSIIGGIINNTT and SSIIGGQQUUIITT in addition to + these inherited handlers. Commands run as a result of command substi- tution ignore the keyboard-generated job control signals SSIIGGTTTTIINN, SSIIGGTT-- TTOOUU, and SSIIGGTTSSTTPP. - The shell exits by default upon receipt of a SSIIGGHHUUPP. Before exiting, - an interactive shell resends the SSIIGGHHUUPP to all jobs, running or + The shell exits by default upon receipt of a SSIIGGHHUUPP. Before exiting, + an interactive shell resends the SSIIGGHHUUPP to all jobs, running or stopped. Stopped jobs are sent SSIIGGCCOONNTT to ensure that they receive the - SSIIGGHHUUPP. To prevent the shell from sending the signal to a particular - job, it should be removed from the jobs table with the ddiissoowwnn builtin - (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) or marked to not receive SSIIGGHHUUPP us- + SSIIGGHHUUPP. To prevent the shell from sending the signal to a particular + job, it should be removed from the jobs table with the ddiissoowwnn builtin + (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) or marked to not receive SSIIGGHHUUPP us- ing ddiissoowwnn --hh. - If the hhuuppoonneexxiitt shell option has been set with sshhoopptt, bbaasshh sends a + If the hhuuppoonneexxiitt shell option has been set with sshhoopptt, bbaasshh sends a SSIIGGHHUUPP to all jobs when an interactive login shell exits. - If bbaasshh is waiting for a command to complete and receives a signal for + If bbaasshh is waiting for a command to complete and receives a signal for which a trap has been set, the trap will not be executed until the com- - mand completes. When bbaasshh is waiting for an asynchronous command via - the wwaaiitt builtin, the reception of a signal for which a trap has been + mand completes. When bbaasshh is waiting for an asynchronous command via + the wwaaiitt builtin, the reception of a signal for which a trap has been set will cause the wwaaiitt builtin to return immediately with an exit sta- tus greater than 128, immediately after which the trap is executed. - When job control is not enabled, and bbaasshh is waiting for a foreground + When job control is not enabled, and bbaasshh is waiting for a foreground command to complete, the shell receives keyboard-generated signals such - as SSIIGGIINNTT (usually generated by ^^CC) that users commonly intend to send + as SSIIGGIINNTT (usually generated by ^^CC) that users commonly intend to send to that command. This happens because the shell and the command are in the same process group as the terminal, and ^^CC sends SSIIGGIINNTT to all pro- cesses in that process group. - When bbaasshh is running without job control enabled and receives SSIIGGIINNTT - while waiting for a foreground command, it waits until that foreground + When bbaasshh is running without job control enabled and receives SSIIGGIINNTT + while waiting for a foreground command, it waits until that foreground command terminates and then decides what to do about the SSIIGGIINNTT: 1. If the command terminates due to the SSIIGGIINNTT, bbaasshh concludes that - the user meant to end the entire script, and acts on the SSIIGGIINNTT + the user meant to end the entire script, and acts on the SSIIGGIINNTT (e.g., by running a SSIIGGIINNTT trap or exiting itself); - 2. If the command does not terminate due to SSIIGGIINNTT, the program - handled the SSIIGGIINNTT itself and did not treat it as a fatal sig- - nal. In that case, bbaasshh does not treat SSIIGGIINNTT as a fatal sig- - nal, either, instead assuming that the SSIIGGIINNTT was used as part - of the program's normal operation (e.g., emacs uses it to abort + 2. If the command does not terminate due to SSIIGGIINNTT, the program + handled the SSIIGGIINNTT itself and did not treat it as a fatal sig- + nal. In that case, bbaasshh does not treat SSIIGGIINNTT as a fatal sig- + nal, either, instead assuming that the SSIIGGIINNTT was used as part + of the program's normal operation (e.g., emacs uses it to abort editing commands) or deliberately discarded. However, bbaasshh will - run any trap set on SSIIGGIINNTT, as it does with any other trapped - signal it receives while it is waiting for the foreground com- + run any trap set on SSIIGGIINNTT, as it does with any other trapped + signal it receives while it is waiting for the foreground com- mand to complete, for compatibility. JJOOBB CCOONNTTRROOLL _J_o_b _c_o_n_t_r_o_l refers to the ability to selectively stop (_s_u_s_p_e_n_d) the ex- - ecution of processes and continue (_r_e_s_u_m_e) their execution at a later - point. A user typically employs this facility via an interactive in- - terface supplied jointly by the operating system kernel's terminal + ecution of processes and continue (_r_e_s_u_m_e) their execution at a later + point. A user typically employs this facility via an interactive in- + terface supplied jointly by the operating system kernel's terminal driver and bbaasshh. - The shell associates a _j_o_b with each pipeline. It keeps a table of - currently executing jobs, which may be listed with the jjoobbss command. - When bbaasshh starts a job asynchronously (in the _b_a_c_k_g_r_o_u_n_d), it prints a + The shell associates a _j_o_b with each pipeline. It keeps a table of + currently executing jobs, which may be listed with the jjoobbss command. + When bbaasshh starts a job asynchronously (in the _b_a_c_k_g_r_o_u_n_d), it prints a line that looks like: [1] 25647 indicating that this job is job number 1 and that the process ID of the last process in the pipeline associated with this job is 25647. All of - the processes in a single pipeline are members of the same job. BBaasshh + the processes in a single pipeline are members of the same job. BBaasshh uses the _j_o_b abstraction as the basis for job control. - To facilitate the implementation of the user interface to job control, + To facilitate the implementation of the user interface to job control, the operating system maintains the notion of a _c_u_r_r_e_n_t _t_e_r_m_i_n_a_l _p_r_o_c_e_s_s _g_r_o_u_p _I_D. Members of this process group (processes whose process group ID is equal to the current terminal process group ID) receive keyboard- - generated signals such as SSIIGGIINNTT. These processes are said to be in - the _f_o_r_e_g_r_o_u_n_d. _B_a_c_k_g_r_o_u_n_d processes are those whose process group ID + generated signals such as SSIIGGIINNTT. These processes are said to be in + the _f_o_r_e_g_r_o_u_n_d. _B_a_c_k_g_r_o_u_n_d processes are those whose process group ID differs from the terminal's; such processes are immune to keyboard-gen- erated signals. Only foreground processes are allowed to read from or, - if the user so specifies with stty tostop, write to the terminal. - Background processes which attempt to read from (write to when stty - tostop is in effect) the terminal are sent a SSIIGGTTTTIINN ((SSIIGGTTTTOOUU)) signal - by the kernel's terminal driver, which, unless caught, suspends the + if the user so specifies with stty tostop, write to the terminal. + Background processes which attempt to read from (write to when stty + tostop is in effect) the terminal are sent a SSIIGGTTTTIINN ((SSIIGGTTTTOOUU)) signal + by the kernel's terminal driver, which, unless caught, suspends the process. - If the operating system on which bbaasshh is running supports job control, + If the operating system on which bbaasshh is running supports job control, bbaasshh contains facilities to use it. Typing the _s_u_s_p_e_n_d character (typ- ically ^^ZZ, Control-Z) while a process is running causes that process to - be stopped and returns control to bbaasshh. Typing the _d_e_l_a_y_e_d _s_u_s_p_e_n_d - character (typically ^^YY, Control-Y) causes the process to be stopped + be stopped and returns control to bbaasshh. Typing the _d_e_l_a_y_e_d _s_u_s_p_e_n_d + character (typically ^^YY, Control-Y) causes the process to be stopped when it attempts to read input from the terminal, and control to be re- - turned to bbaasshh. The user may then manipulate the state of this job, - using the bbgg command to continue it in the background, the ffgg command + turned to bbaasshh. The user may then manipulate the state of this job, + using the bbgg command to continue it in the background, the ffgg command to continue it in the foreground, or the kkiillll command to kill it. A ^^ZZ takes effect immediately, and has the additional side effect of causing pending output and typeahead to be discarded. There are a number of ways to refer to a job in the shell. The charac- - ter %% introduces a job specification (_j_o_b_s_p_e_c). Job number _n may be + ter %% introduces a job specification (_j_o_b_s_p_e_c). Job number _n may be referred to as %%nn. A job may also be referred to using a prefix of the name used to start it, or using a substring that appears in its command - line. For example, %%ccee refers to a stopped job whose command name be- - gins with ccee. If a prefix matches more than one job, bbaasshh reports an + line. For example, %%ccee refers to a stopped job whose command name be- + gins with ccee. If a prefix matches more than one job, bbaasshh reports an error. Using %%??ccee, on the other hand, refers to any job containing the - string ccee in its command line. If the substring matches more than one + string ccee in its command line. If the substring matches more than one job, bbaasshh reports an error. The symbols %%%% and %%++ refer to the shell's - notion of the _c_u_r_r_e_n_t _j_o_b, which is the last job stopped while it was - in the foreground or started in the background. The _p_r_e_v_i_o_u_s _j_o_b may - be referenced using %%--. If there is only a single job, %%++ and %%-- can + notion of the _c_u_r_r_e_n_t _j_o_b, which is the last job stopped while it was + in the foreground or started in the background. The _p_r_e_v_i_o_u_s _j_o_b may + be referenced using %%--. If there is only a single job, %%++ and %%-- can both be used to refer to that job. In output pertaining to jobs (e.g., the output of the jjoobbss command), the current job is always flagged with - a ++, and the previous job with a --. A single % (with no accompanying + a ++, and the previous job with a --. A single % (with no accompanying job specification) also refers to the current job. - Simply naming a job can be used to bring it into the foreground: %%11 is - a synonym for ````ffgg %%11'''', bringing job 1 from the background into the - foreground. Similarly, ````%%11 &&'''' resumes job 1 in the background, + Simply naming a job can be used to bring it into the foreground: %%11 is + a synonym for ````ffgg %%11'''', bringing job 1 from the background into the + foreground. Similarly, ````%%11 &&'''' resumes job 1 in the background, equivalent to ````bbgg %%11''''. - The shell learns immediately whenever a job changes state. Normally, + The shell learns immediately whenever a job changes state. Normally, bbaasshh waits until it is about to print a prompt before reporting changes - in a job's status so as to not interrupt any other output. If the --bb + in a job's status so as to not interrupt any other output. If the --bb option to the sseett builtin command is enabled, bbaasshh reports such changes - immediately. Any trap on SSIIGGCCHHLLDD is executed for each child that ex- + immediately. Any trap on SSIIGGCCHHLLDD is executed for each child that ex- its. - If an attempt to exit bbaasshh is made while jobs are stopped (or, if the - cchheecckkjjoobbss shell option has been enabled using the sshhoopptt builtin, run- + If an attempt to exit bbaasshh is made while jobs are stopped (or, if the + cchheecckkjjoobbss shell option has been enabled using the sshhoopptt builtin, run- ning), the shell prints a warning message, and, if the cchheecckkjjoobbss option - is enabled, lists the jobs and their statuses. The jjoobbss command may - then be used to inspect their status. If a second attempt to exit is - made without an intervening command, the shell does not print another + is enabled, lists the jobs and their statuses. The jjoobbss command may + then be used to inspect their status. If a second attempt to exit is + made without an intervening command, the shell does not print another warning, and any stopped jobs are terminated. - When the shell is waiting for a job or process using the wwaaiitt builtin, - and job control is enabled, wwaaiitt will return when the job changes - state. The --ff option causes wwaaiitt to wait until the job or process ter- + When the shell is waiting for a job or process using the wwaaiitt builtin, + and job control is enabled, wwaaiitt will return when the job changes + state. The --ff option causes wwaaiitt to wait until the job or process ter- minates before returning. PPRROOMMPPTTIINNGG When executing interactively, bbaasshh displays the primary prompt PPSS11 when - it is ready to read a command, and the secondary prompt PPSS22 when it - needs more input to complete a command. BBaasshh displays PPSS00 after it - reads a command but before executing it. BBaasshh displays PPSS44 as de- - scribed above before tracing each command when the --xx option is en- - abled. BBaasshh allows these prompt strings to be customized by inserting - a number of backslash-escaped special characters that are decoded as + it is ready to read a command, and the secondary prompt PPSS22 when it + needs more input to complete a command. BBaasshh displays PPSS00 after it + reads a command but before executing it. BBaasshh displays PPSS44 as de- + scribed above before tracing each command when the --xx option is en- + abled. BBaasshh allows these prompt strings to be customized by inserting + a number of backslash-escaped special characters that are decoded as follows: \\aa an ASCII bell character (07) - \\dd the date in "Weekday Month Date" format (e.g., "Tue May + \\dd the date in "Weekday Month Date" format (e.g., "Tue May 26") \\DD{{_f_o_r_m_a_t}} the _f_o_r_m_a_t is passed to _s_t_r_f_t_i_m_e(3) and the result is in- serted into the prompt string; an empty _f_o_r_m_a_t results in - a locale-specific time representation. The braces are + a locale-specific time representation. The braces are required \\ee an ASCII escape character (033) \\hh the hostname up to the first `.' @@ -3097,7 +3110,7 @@ PPRROOMMPPTTIINNGG \\ll the basename of the shell's terminal device name \\nn newline \\rr carriage return - \\ss the name of the shell, the basename of $$00 (the portion + \\ss the name of the shell, the basename of $$00 (the portion following the final slash) \\tt the current time in 24-hour HH:MM:SS format \\TT the current time in 12-hour HH:MM:SS format @@ -3106,8 +3119,8 @@ PPRROOMMPPTTIINNGG \\uu the username of the current user \\vv the version of bbaasshh (e.g., 2.00) \\VV the release of bbaasshh, version + patch level (e.g., 2.00.0) - \\ww the value of the PPWWDD shell variable ($$PPWWDD), with $$HHOOMMEE - abbreviated with a tilde (uses the value of the + \\ww the value of the PPWWDD shell variable ($$PPWWDD), with $$HHOOMMEE + abbreviated with a tilde (uses the value of the PPRROOMMPPTT__DDIIRRTTRRIIMM variable) \\WW the basename of $$PPWWDD, with $$HHOOMMEE abbreviated with a tilde \\!! the history number of this command @@ -3115,70 +3128,70 @@ PPRROOMMPPTTIINNGG \\$$ if the effective UID is 0, a ##, otherwise a $$ \\_n_n_n the character corresponding to the octal number _n_n_n \\\\ a backslash - \\[[ begin a sequence of non-printing characters, which could - be used to embed a terminal control sequence into the + \\[[ begin a sequence of non-printing characters, which could + be used to embed a terminal control sequence into the prompt \\]] end a sequence of non-printing characters - The command number and the history number are usually different: the - history number of a command is its position in the history list, which - may include commands restored from the history file (see HHIISSTTOORRYY be- - low), while the command number is the position in the sequence of com- - mands executed during the current shell session. After the string is - decoded, it is expanded via parameter expansion, command substitution, - arithmetic expansion, and quote removal, subject to the value of the + The command number and the history number are usually different: the + history number of a command is its position in the history list, which + may include commands restored from the history file (see HHIISSTTOORRYY be- + low), while the command number is the position in the sequence of com- + mands executed during the current shell session. After the string is + decoded, it is expanded via parameter expansion, command substitution, + arithmetic expansion, and quote removal, subject to the value of the pprroommppttvvaarrss shell option (see the description of the sshhoopptt command under - SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). This can have unwanted side effects if - escaped portions of the string appear within command substitution or + SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). This can have unwanted side effects if + escaped portions of the string appear within command substitution or contain characters special to word expansion. RREEAADDLLIINNEE - This is the library that handles reading input when using an interac- + This is the library that handles reading input when using an interac- tive shell, unless the ----nnooeeddiittiinngg option is given at shell invocation. Line editing is also used when using the --ee option to the rreeaadd builtin. By default, the line editing commands are similar to those of Emacs. A vi-style line editing interface is also available. Line editing can be - enabled at any time using the --oo eemmaaccss or --oo vvii options to the sseett - builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). To turn off line editing - after the shell is running, use the ++oo eemmaaccss or ++oo vvii options to the + enabled at any time using the --oo eemmaaccss or --oo vvii options to the sseett + builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). To turn off line editing + after the shell is running, use the ++oo eemmaaccss or ++oo vvii options to the sseett builtin. RReeaaddlliinnee NNoottaattiioonn In this section, the Emacs-style notation is used to denote keystrokes. - Control keys are denoted by C-_k_e_y, e.g., C-n means Control-N. Simi- - larly, _m_e_t_a keys are denoted by M-_k_e_y, so M-x means Meta-X. (On key- - boards without a _m_e_t_a key, M-_x means ESC _x, i.e., press the Escape key + Control keys are denoted by C-_k_e_y, e.g., C-n means Control-N. Simi- + larly, _m_e_t_a keys are denoted by M-_k_e_y, so M-x means Meta-X. (On key- + boards without a _m_e_t_a key, M-_x means ESC _x, i.e., press the Escape key then the _x key. This makes ESC the _m_e_t_a _p_r_e_f_i_x. The combination M-C-_x - means ESC-Control-_x, or press the Escape key then hold the Control key + means ESC-Control-_x, or press the Escape key then hold the Control key while pressing the _x key.) Readline commands may be given numeric _a_r_g_u_m_e_n_t_s, which normally act as - a repeat count. Sometimes, however, it is the sign of the argument - that is significant. Passing a negative argument to a command that - acts in the forward direction (e.g., kkiillll--lliinnee) causes that command to - act in a backward direction. Commands whose behavior with arguments + a repeat count. Sometimes, however, it is the sign of the argument + that is significant. Passing a negative argument to a command that + acts in the forward direction (e.g., kkiillll--lliinnee) causes that command to + act in a backward direction. Commands whose behavior with arguments deviates from this are noted below. - When a command is described as _k_i_l_l_i_n_g text, the text deleted is saved + When a command is described as _k_i_l_l_i_n_g text, the text deleted is saved for possible future retrieval (_y_a_n_k_i_n_g). The killed text is saved in a _k_i_l_l _r_i_n_g. Consecutive kills cause the text to be accumulated into one unit, which can be yanked all at once. Commands which do not kill text separate the chunks of text on the kill ring. RReeaaddlliinnee IInniittiiaalliizzaattiioonn - Readline is customized by putting commands in an initialization file - (the _i_n_p_u_t_r_c file). The name of this file is taken from the value of + Readline is customized by putting commands in an initialization file + (the _i_n_p_u_t_r_c file). The name of this file is taken from the value of the IINNPPUUTTRRCC variable. If that variable is unset, the default is _~_/_._i_n_- - _p_u_t_r_c. If that file does not exist or cannot be read, the ultimate - default is _/_e_t_c_/_i_n_p_u_t_r_c. When a program which uses the readline li- - brary starts up, the initialization file is read, and the key bindings - and variables are set. There are only a few basic constructs allowed - in the readline initialization file. Blank lines are ignored. Lines - beginning with a ## are comments. Lines beginning with a $$ indicate - conditional constructs. Other lines denote key bindings and variable + _p_u_t_r_c. If that file does not exist or cannot be read, the ultimate + default is _/_e_t_c_/_i_n_p_u_t_r_c. When a program which uses the readline li- + brary starts up, the initialization file is read, and the key bindings + and variables are set. There are only a few basic constructs allowed + in the readline initialization file. Blank lines are ignored. Lines + beginning with a ## are comments. Lines beginning with a $$ indicate + conditional constructs. Other lines denote key bindings and variable settings. - The default key-bindings may be changed with an _i_n_p_u_t_r_c file. Other + The default key-bindings may be changed with an _i_n_p_u_t_r_c file. Other programs that use this library may add their own commands and bindings. For example, placing @@ -3186,18 +3199,18 @@ RREEAADDLLIINNEE M-Control-u: universal-argument or C-Meta-u: universal-argument - into the _i_n_p_u_t_r_c would make M-C-u execute the readline command _u_n_i_v_e_r_- + into the _i_n_p_u_t_r_c would make M-C-u execute the readline command _u_n_i_v_e_r_- _s_a_l_-_a_r_g_u_m_e_n_t. - The following symbolic character names are recognized: _R_U_B_O_U_T, _D_E_L, + The following symbolic character names are recognized: _R_U_B_O_U_T, _D_E_L, _E_S_C, _L_F_D, _N_E_W_L_I_N_E, _R_E_T, _R_E_T_U_R_N, _S_P_C, _S_P_A_C_E, and _T_A_B. - In addition to command names, readline allows keys to be bound to a + In addition to command names, readline allows keys to be bound to a string that is inserted when the key is pressed (a _m_a_c_r_o). RReeaaddlliinnee KKeeyy BBiinnddiinnggss - The syntax for controlling key bindings in the _i_n_p_u_t_r_c file is simple. - All that is required is the name of the command or the text of a macro + The syntax for controlling key bindings in the _i_n_p_u_t_r_c file is simple. + All that is required is the name of the command or the text of a macro and a key sequence to which it should be bound. The name may be speci- fied in one of two ways: as a symbolic key name, possibly with _M_e_t_a_- or _C_o_n_t_r_o_l_- prefixes, or as a key sequence. @@ -3209,15 +3222,15 @@ RREEAADDLLIINNEE Meta-Rubout: backward-kill-word Control-o: "> output" - In the above example, _C_-_u is bound to the function uunniivveerrssaall--aarrgguummeenntt, - _M_-_D_E_L is bound to the function bbaacckkwwaarrdd--kkiillll--wwoorrdd, and _C_-_o is bound to - run the macro expressed on the right hand side (that is, to insert the + In the above example, _C_-_u is bound to the function uunniivveerrssaall--aarrgguummeenntt, + _M_-_D_E_L is bound to the function bbaacckkwwaarrdd--kkiillll--wwoorrdd, and _C_-_o is bound to + run the macro expressed on the right hand side (that is, to insert the text ``> output'' into the line). - In the second form, ""kkeeyysseeqq"":_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, kkeeyysseeqq differs - from kkeeyynnaammee above in that strings denoting an entire key sequence may - be specified by placing the sequence within double quotes. Some GNU - Emacs style key escapes can be used, as in the following example, but + In the second form, ""kkeeyysseeqq"":_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, kkeeyysseeqq differs + from kkeeyynnaammee above in that strings denoting an entire key sequence may + be specified by placing the sequence within double quotes. Some GNU + Emacs style key escapes can be used, as in the following example, but the symbolic character names are not recognized. "\C-u": universal-argument @@ -3225,7 +3238,7 @@ RREEAADDLLIINNEE "\e[11~": "Function Key 1" In this example, _C_-_u is again bound to the function uunniivveerrssaall--aarrgguummeenntt. - _C_-_x _C_-_r is bound to the function rree--rreeaadd--iinniitt--ffiillee, and _E_S_C _[ _1 _1 _~ is + _C_-_x _C_-_r is bound to the function rree--rreeaadd--iinniitt--ffiillee, and _E_S_C _[ _1 _1 _~ is bound to insert the text ``Function Key 1''. The full set of GNU Emacs style escape sequences is @@ -3236,7 +3249,7 @@ RREEAADDLLIINNEE \\"" literal " \\'' literal ' - In addition to the GNU Emacs style escape sequences, a second set of + In addition to the GNU Emacs style escape sequences, a second set of backslash escapes is available: \\aa alert (bell) \\bb backspace @@ -3246,20 +3259,20 @@ RREEAADDLLIINNEE \\rr carriage return \\tt horizontal tab \\vv vertical tab - \\_n_n_n the eight-bit character whose value is the octal value + \\_n_n_n the eight-bit character whose value is the octal value _n_n_n (one to three digits) - \\xx_H_H the eight-bit character whose value is the hexadecimal + \\xx_H_H the eight-bit character whose value is the hexadecimal value _H_H (one or two hex digits) When entering the text of a macro, single or double quotes must be used to indicate a macro definition. Unquoted text is assumed to be a func- - tion name. In the macro body, the backslash escapes described above - are expanded. Backslash will quote any other character in the macro + tion name. In the macro body, the backslash escapes described above + are expanded. Backslash will quote any other character in the macro text, including " and '. - BBaasshh allows the current readline key bindings to be displayed or modi- - fied with the bbiinndd builtin command. The editing mode may be switched - during interactive use by using the --oo option to the sseett builtin com- + BBaasshh allows the current readline key bindings to be displayed or modi- + fied with the bbiinndd builtin command. The editing mode may be switched + during interactive use by using the --oo option to the sseett builtin com- mand (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). RReeaaddlliinnee VVaarriiaabblleess @@ -3270,104 +3283,104 @@ RREEAADDLLIINNEE sseett _v_a_r_i_a_b_l_e_-_n_a_m_e _v_a_l_u_e or using the bbiinndd builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). - Except where noted, readline variables can take the values OOnn or OOffff - (without regard to case). Unrecognized variable names are ignored. - When a variable value is read, empty or null values, "on" (case-insen- + Except where noted, readline variables can take the values OOnn or OOffff + (without regard to case). Unrecognized variable names are ignored. + When a variable value is read, empty or null values, "on" (case-insen- sitive), and "1" are equivalent to OOnn. All other values are equivalent to OOffff. The variables and their default values are: aaccttiivvee--rreeggiioonn--ssttaarrtt--ccoolloorr - A string variable that controls the text color and background - when displaying the text in the active region (see the descrip- - tion of eennaabbllee--aaccttiivvee--rreeggiioonn below). This string must not take + A string variable that controls the text color and background + when displaying the text in the active region (see the descrip- + tion of eennaabbllee--aaccttiivvee--rreeggiioonn below). This string must not take up any physical character positions on the display, so it should - consist only of terminal escape sequences. It is output to the - terminal before displaying the text in the active region. This - variable is reset to the default value whenever the terminal - type changes. The default value is the string that puts the - terminal in standout mode, as obtained from the terminal's ter- + consist only of terminal escape sequences. It is output to the + terminal before displaying the text in the active region. This + variable is reset to the default value whenever the terminal + type changes. The default value is the string that puts the + terminal in standout mode, as obtained from the terminal's ter- minfo description. A sample value might be "\e[01;33m". aaccttiivvee--rreeggiioonn--eenndd--ccoolloorr - A string variable that "undoes" the effects of aaccttiivvee--rree-- - ggiioonn--ssttaarrtt--ccoolloorr and restores "normal" terminal display appear- - ance after displaying text in the active region. This string - must not take up any physical character positions on the dis- - play, so it should consist only of terminal escape sequences. - It is output to the terminal after displaying the text in the - active region. This variable is reset to the default value - whenever the terminal type changes. The default value is the - string that restores the terminal from standout mode, as ob- + A string variable that "undoes" the effects of aaccttiivvee--rree-- + ggiioonn--ssttaarrtt--ccoolloorr and restores "normal" terminal display appear- + ance after displaying text in the active region. This string + must not take up any physical character positions on the dis- + play, so it should consist only of terminal escape sequences. + It is output to the terminal after displaying the text in the + active region. This variable is reset to the default value + whenever the terminal type changes. The default value is the + string that restores the terminal from standout mode, as ob- tained from the terminal's terminfo description. A sample value might be "\e[0m". bbeellll--ssttyyllee ((aauuddiibbllee)) - Controls what happens when readline wants to ring the terminal + Controls what happens when readline wants to ring the terminal bell. If set to nnoonnee, readline never rings the bell. If set to - vviissiibbllee, readline uses a visible bell if one is available. If + vviissiibbllee, readline uses a visible bell if one is available. If set to aauuddiibbllee, readline attempts to ring the terminal's bell. bbiinndd--ttttyy--ssppeecciiaall--cchhaarrss ((OOnn)) - If set to OOnn, readline attempts to bind the control characters + If set to OOnn, readline attempts to bind the control characters treated specially by the kernel's terminal driver to their read- line equivalents. bblliinnkk--mmaattcchhiinngg--ppaarreenn ((OOffff)) If set to OOnn, readline attempts to briefly move the cursor to an opening parenthesis when a closing parenthesis is inserted. ccoolloorreedd--ccoommpplleettiioonn--pprreeffiixx ((OOffff)) - If set to OOnn, when listing completions, readline displays the + If set to OOnn, when listing completions, readline displays the common prefix of the set of possible completions using a differ- - ent color. The color definitions are taken from the value of + ent color. The color definitions are taken from the value of the LLSS__CCOOLLOORRSS environment variable. If there is a color defini- - tion in $$LLSS__CCOOLLOORRSS for the custom suffix "readline-colored-com- - pletion-prefix", readline uses this color for the common prefix + tion in $$LLSS__CCOOLLOORRSS for the custom suffix "readline-colored-com- + pletion-prefix", readline uses this color for the common prefix instead of its default. ccoolloorreedd--ssttaattss ((OOffff)) - If set to OOnn, readline displays possible completions using dif- - ferent colors to indicate their file type. The color defini- - tions are taken from the value of the LLSS__CCOOLLOORRSS environment + If set to OOnn, readline displays possible completions using dif- + ferent colors to indicate their file type. The color defini- + tions are taken from the value of the LLSS__CCOOLLOORRSS environment variable. ccoommmmeenntt--bbeeggiinn ((````##'''')) - The string that is inserted when the readline iinnsseerrtt--ccoommmmeenntt + The string that is inserted when the readline iinnsseerrtt--ccoommmmeenntt command is executed. This command is bound to MM--## in emacs mode and to ## in vi command mode. ccoommpplleettiioonn--ddiissppllaayy--wwiiddtthh ((--11)) - The number of screen columns used to display possible matches - when performing completion. The value is ignored if it is less - than 0 or greater than the terminal screen width. A value of 0 - will cause matches to be displayed one per line. The default + The number of screen columns used to display possible matches + when performing completion. The value is ignored if it is less + than 0 or greater than the terminal screen width. A value of 0 + will cause matches to be displayed one per line. The default value is -1. ccoommpplleettiioonn--iiggnnoorree--ccaassee ((OOffff)) If set to OOnn, readline performs filename matching and completion in a case-insensitive fashion. ccoommpplleettiioonn--mmaapp--ccaassee ((OOffff)) - If set to OOnn, and ccoommpplleettiioonn--iiggnnoorree--ccaassee is enabled, readline - treats hyphens (_-) and underscores (__) as equivalent when per- + If set to OOnn, and ccoommpplleettiioonn--iiggnnoorree--ccaassee is enabled, readline + treats hyphens (_-) and underscores (__) as equivalent when per- forming case-insensitive filename matching and completion. ccoommpplleettiioonn--pprreeffiixx--ddiissppllaayy--lleennggtthh ((00)) - The length in characters of the common prefix of a list of pos- - sible completions that is displayed without modification. When - set to a value greater than zero, common prefixes longer than - this value are replaced with an ellipsis when displaying possi- + The length in characters of the common prefix of a list of pos- + sible completions that is displayed without modification. When + set to a value greater than zero, common prefixes longer than + this value are replaced with an ellipsis when displaying possi- ble completions. ccoommpplleettiioonn--qquueerryy--iitteemmss ((110000)) - This determines when the user is queried about viewing the num- - ber of possible completions generated by the ppoossssiibbllee--ccoommppllee-- - ttiioonnss command. It may be set to any integer value greater than - or equal to zero. If the number of possible completions is - greater than or equal to the value of this variable, readline - will ask whether or not the user wishes to view them; otherwise - they are simply listed on the terminal. A zero value means + This determines when the user is queried about viewing the num- + ber of possible completions generated by the ppoossssiibbllee--ccoommppllee-- + ttiioonnss command. It may be set to any integer value greater than + or equal to zero. If the number of possible completions is + greater than or equal to the value of this variable, readline + will ask whether or not the user wishes to view them; otherwise + they are simply listed on the terminal. A zero value means readline should never ask; negative values are treated as zero. ccoonnvveerrtt--mmeettaa ((OOnn)) - If set to OOnn, readline will convert characters with the eighth + If set to OOnn, readline will convert characters with the eighth bit set to an ASCII key sequence by stripping the eighth bit and - prefixing an escape character (in effect, using escape as the - _m_e_t_a _p_r_e_f_i_x). The default is _O_n, but readline will set it to + prefixing an escape character (in effect, using escape as the + _m_e_t_a _p_r_e_f_i_x). The default is _O_n, but readline will set it to _O_f_f if the locale contains eight-bit characters. ddiissaabbllee--ccoommpplleettiioonn ((OOffff)) If set to OOnn, readline will inhibit word completion. Completion - characters will be inserted into the line as if they had been + characters will be inserted into the line as if they had been mapped to sseellff--iinnsseerrtt. eecchhoo--ccoonnttrrooll--cchhaarraacctteerrss ((OOnn)) - When set to OOnn, on operating systems that indicate they support + When set to OOnn, on operating systems that indicate they support it, readline echoes a character corresponding to a signal gener- ated from the keyboard. eeddiittiinngg--mmooddee ((eemmaaccss)) @@ -3375,32 +3388,31 @@ RREEAADDLLIINNEE ilar to _E_m_a_c_s or _v_i. eeddiittiinngg--mmooddee can be set to either eemmaaccss or vvii. eemmaaccss--mmooddee--ssttrriinngg ((@@)) - If the _s_h_o_w_-_m_o_d_e_-_i_n_-_p_r_o_m_p_t variable is enabled, this string is + If the _s_h_o_w_-_m_o_d_e_-_i_n_-_p_r_o_m_p_t variable is enabled, this string is displayed immediately before the last line of the primary prompt when emacs editing mode is active. The value is expanded like a - key binding, so the standard set of meta- and control prefixes - and backslash escape sequences is available. Use the \1 and \2 - escapes to begin and end sequences of non-printing characters, - which can be used to embed a terminal control sequence into the + key binding, so the standard set of meta- and control prefixes + and backslash escape sequences is available. Use the \1 and \2 + escapes to begin and end sequences of non-printing characters, + which can be used to embed a terminal control sequence into the mode string. eennaabbllee--aaccttiivvee--rreeggiioonn ((OOnn)) - The _p_o_i_n_t is the current cursor position, and _m_a_r_k refers to a - saved cursor position. The text between the point and mark is - referred to as the _r_e_g_i_o_n. When this variable is set to _O_n, - readline allows certain commands to designate the region as _a_c_- - _t_i_v_e. When the region is active, readline highlights the text - in the region using the value of the aaccttiivvee--rreeggiioonn--ssttaarrtt--ccoolloorr, - which defaults to the string that enables the terminal's stand- - out mode. The active region shows the text inserted by brack- - eted-paste and any matching text found by incremental and non- + The _p_o_i_n_t is the current cursor position, and _m_a_r_k refers to a + saved cursor position. The text between the point and mark is + referred to as the _r_e_g_i_o_n. When this variable is set to _O_n, + readline allows certain commands to designate the region as _a_c_- + _t_i_v_e. When the region is active, readline highlights the text + in the region using the value of the aaccttiivvee--rreeggiioonn--ssttaarrtt--ccoolloorr, + which defaults to the string that enables the terminal's stand- + out mode. The active region shows the text inserted by brack- + eted-paste and any matching text found by incremental and non- incremental history searches. eennaabbllee--bbrraacckkeetteedd--ppaassttee ((OOnn)) - When set to OOnn, readline will configure the terminal in a way - that will enable it to insert each paste into the editing buffer - as a single string of characters, instead of treating each char- - acter as if it had been read from the keyboard. This can pre- - vent pasted characters from being interpreted as editing com- - mands. + When set to OOnn, readline configures the terminal to insert each + paste into the editing buffer as a single string of characters, + instead of treating each character as if it had been read from + the keyboard. This prevents readline from executing any editing + commands bound to key sequences appearing in the pasted text. eennaabbllee--kkeeyyppaadd ((OOffff)) When set to OOnn, readline will try to enable the application key- pad when it is called. Some systems need this to enable the ar- @@ -6631,4 +6643,4 @@ BBUUGGSS -GNU Bash 5.2 2022 February 10 BASH(1) +GNU Bash 5.2 2022 March 11 BASH(1) diff --git a/doc/bash.1 b/doc/bash.1 index 8804fd80..1026fac7 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -3176,7 +3176,7 @@ ${\fIparameter\fP\fB:\fP\fIoffset\fP\fB:\fP\fIlength\fP} \fBSubstring Expansion\fP. Expands to up to \fIlength\fP characters of the value of \fIparameter\fP starting at the character specified by \fIoffset\fP. -If \fIparameter\fP is \fB@\fP, an indexed array subscripted by +If \fIparameter\fP is \fB@\fP or \fB*\fP, an indexed array subscripted by \fB@\fP or \fB*\fP, or an associative array name, the results differ as described below. If \fIlength\fP is omitted, expands to the substring of the value of @@ -3199,8 +3199,8 @@ a number of characters, and the expansion is the characters between Note that a negative offset must be separated from the colon by at least one space to avoid being confused with the \fB:-\fP expansion. .sp 1 -If \fIparameter\fP is \fB@\fP, the result is \fIlength\fP positional -parameters beginning at \fIoffset\fP. +If \fIparameter\fP is \fB@\fP or \fB*\fP, the result is \fIlength\fP +positional parameters beginning at \fIoffset\fP. A negative \fIoffset\fP is taken relative to one greater than the greatest positional parameter, so an offset of \-1 evaluates to the last positional parameter. diff --git a/doc/bashref.info b/doc/bashref.info index eecc0874..4cbaf021 100644 --- a/doc/bashref.info +++ b/doc/bashref.info @@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 6.8 from bashref.texi. This text is a brief description of the features that are present in the -Bash shell (version 5.2, 5 February 2022). +Bash shell (version 5.2, 24 February 2022). - This is Edition 5.2, last updated 5 February 2022, of 'The GNU Bash + This is Edition 5.2, last updated 24 February 2022, of 'The GNU Bash Reference Manual', for 'Bash', Version 5.2. Copyright (C) 1988-2022 Free Software Foundation, Inc. @@ -27,10 +27,10 @@ Bash Features ************* This text is a brief description of the features that are present in the -Bash shell (version 5.2, 5 February 2022). The Bash home page is +Bash shell (version 5.2, 24 February 2022). The Bash home page is . - This is Edition 5.2, last updated 5 February 2022, of 'The GNU Bash + This is Edition 5.2, last updated 24 February 2022, of 'The GNU Bash Reference Manual', for 'Bash', Version 5.2. Bash contains features that appear in other popular shells, and some @@ -1368,9 +1368,17 @@ status; otherwise the function's return status is the exit status of the last command executed before the 'return'. Variables local to the function may be declared with the 'local' -builtin. These variables are visible only to the function and the -commands it invokes. This is particularly important when a shell -function calls other functions. +builtin ("local variables"). Ordinarily, variables and their values are +shared between a function and its caller. These variables are visible +only to the function and the commands it invokes. This is particularly +important when a shell function calls other functions. + + In the following description, the "current scope" is a currently- +executing function. Previous scopes consist of that function's caller +and so on, back to the "global" scope, where the shell is not executing +any shell function. Consequently, a local variable at the current local +scope is a variable declared using the 'local' or 'declare' builtins in +the function that is currently executing. Local variables "shadow" variables with the same name declared at previous scopes. For instance, a local variable declared in a function @@ -1415,11 +1423,12 @@ script displays variable is local to the current scope, 'unset' will unset it; otherwise the unset will refer to the variable found in any calling scope as described above. If a variable at the current local scope is unset, it -will remain so until it is reset in that scope or until the function -returns. Once the function returns, any instance of the variable at a -previous scope will become visible. If the unset acts on a variable at -a previous scope, any instance of a variable with that name that had -been shadowed will become visible. +will remain so (appearing as unset) until it is reset in that scope or +until the function returns. Once the function returns, any instance of +the variable at a previous scope will become visible. If the unset acts +on a variable at a previous scope, any instance of a variable with that +name that had been shadowed will become visible (see below how +'localvar_unset'shell option changes this behavior). Function names and definitions may be listed with the '-f' option to the 'declare' ('typeset') builtin command (*note Bash Builtins::). The @@ -1868,11 +1877,11 @@ omitted, the operator tests only for existence. '${PARAMETER:OFFSET:LENGTH}' This is referred to as Substring Expansion. It expands to up to LENGTH characters of the value of PARAMETER starting at the - character specified by OFFSET. If PARAMETER is '@', an indexed - array subscripted by '@' or '*', or an associative array name, the - results differ as described below. If LENGTH is omitted, it - expands to the substring of the value of PARAMETER starting at the - character specified by OFFSET and extending to the end of the + character specified by OFFSET. If PARAMETER is '@' or '*', an + indexed array subscripted by '@' or '*', or an associative array + name, the results differ as described below. If LENGTH is omitted, + it expands to the substring of the value of PARAMETER starting at + the character specified by OFFSET and extending to the end of the value. LENGTH and OFFSET are arithmetic expressions (*note Shell Arithmetic::). @@ -1940,11 +1949,11 @@ omitted, the operator tests only for existence. $ echo ${array[0]: -7:-2} bcdef - If PARAMETER is '@', the result is LENGTH positional parameters - beginning at OFFSET. A negative OFFSET is taken relative to one - greater than the greatest positional parameter, so an offset of -1 - evaluates to the last positional parameter. It is an expansion - error if LENGTH evaluates to a number less than zero. + If PARAMETER is '@' or '*', the result is LENGTH positional + parameters beginning at OFFSET. A negative OFFSET is taken + relative to one greater than the greatest positional parameter, so + an offset of -1 evaluates to the last positional parameter. It is + an expansion error if LENGTH evaluates to a number less than zero. The following examples illustrate substring expansion using positional parameters: @@ -6661,6 +6670,10 @@ negative number, that number is interpreted as relative to one greater than the maximum index of NAME, so negative indices count back from the end of the array, and an index of -1 references the last element. + The '+=' operator will append to an array variable when assigning +using the compound assignment syntax; see *note Shell Parameters:: +above. + Any element of an array may be referenced using '${NAME[SUBSCRIPT]}'. The braces are required to avoid conflicts with the shell's filename expansion operators. If the SUBSCRIPT is '@' or '*', the word expands @@ -8157,12 +8170,13 @@ Variable Settings non-incremental history searches. The default is 'On'. 'enable-bracketed-paste' - When set to 'On', Readline will configure the terminal in a - way that will enable it to insert each paste into the editing - buffer as a single string of characters, instead of treating - each character as if it had been read from the keyboard. This - can prevent pasted characters from being interpreted as - editing commands. The default is 'On'. + When set to 'On', Readline configures the terminal to insert + each paste into the editing buffer as a single string of + characters, instead of treating each character as if it had + been read from the keyboard. This is called putting the + terminal into "bracketed paste mode"; it prevents Readline + from executing any editing commands bound to key sequences + appearing in the pasted text. The default is 'On'. 'enable-keypad' When set to 'on', Readline will try to enable the application @@ -11968,14 +11982,14 @@ D.3 Parameter and Variable Index * enable-bracketed-paste: Readline Init File Syntax. (line 185) * enable-keypad: Readline Init File Syntax. - (line 193) + (line 194) * ENV: Bash Variables. (line 279) * EPOCHREALTIME: Bash Variables. (line 284) * EPOCHSECONDS: Bash Variables. (line 292) * EUID: Bash Variables. (line 299) * EXECIGNORE: Bash Variables. (line 303) * expand-tilde: Readline Init File Syntax. - (line 204) + (line 205) * FCEDIT: Bash Variables. (line 316) * FIGNORE: Bash Variables. (line 320) * FUNCNAME: Bash Variables. (line 326) @@ -11989,15 +12003,15 @@ D.3 Parameter and Variable Index * HISTFILESIZE: Bash Variables. (line 402) * HISTIGNORE: Bash Variables. (line 413) * history-preserve-point: Readline Init File Syntax. - (line 208) + (line 209) * history-size: Readline Init File Syntax. - (line 214) + (line 215) * HISTSIZE: Bash Variables. (line 433) * HISTTIMEFORMAT: Bash Variables. (line 440) * HOME: Bourne Shell Variables. (line 13) * horizontal-scroll-mode: Readline Init File Syntax. - (line 223) + (line 224) * HOSTFILE: Bash Variables. (line 448) * HOSTNAME: Bash Variables. (line 459) * HOSTTYPE: Bash Variables. (line 462) @@ -12005,13 +12019,13 @@ D.3 Parameter and Variable Index (line 18) * IGNOREEOF: Bash Variables. (line 465) * input-meta: Readline Init File Syntax. - (line 232) + (line 233) * INPUTRC: Bash Variables. (line 475) * INSIDE_EMACS: Bash Variables. (line 479) * isearch-terminators: Readline Init File Syntax. - (line 240) + (line 241) * keymap: Readline Init File Syntax. - (line 247) + (line 248) * LANG: Creating Internationalized Scripts. (line 51) * LANG <1>: Bash Variables. (line 485) @@ -12033,15 +12047,15 @@ D.3 Parameter and Variable Index (line 27) * MAPFILE: Bash Variables. (line 540) * mark-modified-lines: Readline Init File Syntax. - (line 277) + (line 278) * mark-symlinked-directories: Readline Init File Syntax. - (line 282) + (line 283) * match-hidden-files: Readline Init File Syntax. - (line 287) + (line 288) * menu-complete-display-prefix: Readline Init File Syntax. - (line 294) + (line 295) * meta-flag: Readline Init File Syntax. - (line 232) + (line 233) * OLDPWD: Bash Variables. (line 544) * OPTARG: Bourne Shell Variables. (line 34) @@ -12050,9 +12064,9 @@ D.3 Parameter and Variable Index (line 38) * OSTYPE: Bash Variables. (line 551) * output-meta: Readline Init File Syntax. - (line 299) + (line 300) * page-completions: Readline Init File Syntax. - (line 305) + (line 306) * PATH: Bourne Shell Variables. (line 42) * PIPESTATUS: Bash Variables. (line 554) @@ -12075,19 +12089,19 @@ D.3 Parameter and Variable Index * READLINE_POINT: Bash Variables. (line 626) * REPLY: Bash Variables. (line 630) * revert-all-at-newline: Readline Init File Syntax. - (line 315) + (line 316) * SECONDS: Bash Variables. (line 633) * SHELL: Bash Variables. (line 642) * SHELLOPTS: Bash Variables. (line 647) * SHLVL: Bash Variables. (line 656) * show-all-if-ambiguous: Readline Init File Syntax. - (line 321) + (line 322) * show-all-if-unmodified: Readline Init File Syntax. - (line 327) + (line 328) * show-mode-in-prompt: Readline Init File Syntax. - (line 336) + (line 337) * skip-completed-text: Readline Init File Syntax. - (line 342) + (line 343) * SRANDOM: Bash Variables. (line 661) * TEXTDOMAIN: Creating Internationalized Scripts. (line 51) @@ -12098,11 +12112,11 @@ D.3 Parameter and Variable Index * TMPDIR: Bash Variables. (line 720) * UID: Bash Variables. (line 724) * vi-cmd-mode-string: Readline Init File Syntax. - (line 355) + (line 356) * vi-ins-mode-string: Readline Init File Syntax. - (line 366) + (line 367) * visible-stats: Readline Init File Syntax. - (line 377) + (line 378)  File: bashref.info, Node: Function Index, Next: Concept Index, Prev: Variable Index, Up: Indexes @@ -12481,138 +12495,138 @@ D.5 Concept Index  Tag Table: -Node: Top895 -Node: Introduction2813 -Node: What is Bash?3029 -Node: What is a shell?4143 -Node: Definitions6681 -Node: Basic Shell Features9632 -Node: Shell Syntax10851 -Node: Shell Operation11877 -Node: Quoting13170 -Node: Escape Character14474 -Node: Single Quotes14959 -Node: Double Quotes15307 -Node: ANSI-C Quoting16585 -Node: Locale Translation17895 -Node: Creating Internationalized Scripts19206 -Node: Comments23323 -Node: Shell Commands23941 -Node: Reserved Words24879 -Node: Simple Commands25635 -Node: Pipelines26289 -Node: Lists29248 -Node: Compound Commands31043 -Node: Looping Constructs32055 -Node: Conditional Constructs34550 -Node: Command Grouping48894 -Node: Coprocesses50372 -Node: GNU Parallel53035 -Node: Shell Functions53952 -Node: Shell Parameters61243 -Node: Positional Parameters65631 -Node: Special Parameters66533 -Node: Shell Expansions69747 -Node: Brace Expansion71874 -Node: Tilde Expansion74608 -Node: Shell Parameter Expansion77229 -Node: Command Substitution95566 -Node: Arithmetic Expansion96921 -Node: Process Substitution97889 -Node: Word Splitting99009 -Node: Filename Expansion100953 -Node: Pattern Matching103702 -Node: Quote Removal108310 -Node: Redirections108605 -Node: Executing Commands118265 -Node: Simple Command Expansion118935 -Node: Command Search and Execution121045 -Node: Command Execution Environment123423 -Node: Environment126458 -Node: Exit Status128121 -Node: Signals129905 -Node: Shell Scripts133354 -Node: Shell Builtin Commands136381 -Node: Bourne Shell Builtins138419 -Node: Bash Builtins159880 -Node: Modifying Shell Behavior190736 -Node: The Set Builtin191081 -Node: The Shopt Builtin201682 -Node: Special Builtins217594 -Node: Shell Variables218573 -Node: Bourne Shell Variables219010 -Node: Bash Variables221114 -Node: Bash Features253930 -Node: Invoking Bash254943 -Node: Bash Startup Files260956 -Node: Interactive Shells266059 -Node: What is an Interactive Shell?266469 -Node: Is this Shell Interactive?267118 -Node: Interactive Shell Behavior267933 -Node: Bash Conditional Expressions271562 -Node: Shell Arithmetic276204 -Node: Aliases279148 -Node: Arrays281761 -Node: The Directory Stack288008 -Node: Directory Stack Builtins288792 -Node: Controlling the Prompt293052 -Node: The Restricted Shell296017 -Node: Bash POSIX Mode298627 -Node: Shell Compatibility Mode310277 -Node: Job Control318306 -Node: Job Control Basics318766 -Node: Job Control Builtins323768 -Node: Job Control Variables329168 -Node: Command Line Editing330324 -Node: Introduction and Notation331995 -Node: Readline Interaction333618 -Node: Readline Bare Essentials334809 -Node: Readline Movement Commands336592 -Node: Readline Killing Commands337552 -Node: Readline Arguments339470 -Node: Searching340514 -Node: Readline Init File342700 -Node: Readline Init File Syntax343961 -Node: Conditional Init Constructs367087 -Node: Sample Init File371283 -Node: Bindable Readline Commands374407 -Node: Commands For Moving375611 -Node: Commands For History377662 -Node: Commands For Text382656 -Node: Commands For Killing386305 -Node: Numeric Arguments389338 -Node: Commands For Completion390477 -Node: Keyboard Macros394668 -Node: Miscellaneous Commands395355 -Node: Readline vi Mode401294 -Node: Programmable Completion402201 -Node: Programmable Completion Builtins409981 -Node: A Programmable Completion Example420676 -Node: Using History Interactively425923 -Node: Bash History Facilities426607 -Node: Bash History Builtins429612 -Node: History Interaction434620 -Node: Event Designators438240 -Node: Word Designators439594 -Node: Modifiers441354 -Node: Installing Bash443165 -Node: Basic Installation444302 -Node: Compilers and Options448024 -Node: Compiling For Multiple Architectures448765 -Node: Installation Names450458 -Node: Specifying the System Type452567 -Node: Sharing Defaults453283 -Node: Operation Controls453956 -Node: Optional Features454914 -Node: Reporting Bugs466132 -Node: Major Differences From The Bourne Shell467407 -Node: GNU Free Documentation License484257 -Node: Indexes509434 -Node: Builtin Index509888 -Node: Reserved Word Index516715 -Node: Variable Index519163 -Node: Function Index535937 -Node: Concept Index549721 +Node: Top897 +Node: Introduction2817 +Node: What is Bash?3033 +Node: What is a shell?4147 +Node: Definitions6685 +Node: Basic Shell Features9636 +Node: Shell Syntax10855 +Node: Shell Operation11881 +Node: Quoting13174 +Node: Escape Character14478 +Node: Single Quotes14963 +Node: Double Quotes15311 +Node: ANSI-C Quoting16589 +Node: Locale Translation17899 +Node: Creating Internationalized Scripts19210 +Node: Comments23327 +Node: Shell Commands23945 +Node: Reserved Words24883 +Node: Simple Commands25639 +Node: Pipelines26293 +Node: Lists29252 +Node: Compound Commands31047 +Node: Looping Constructs32059 +Node: Conditional Constructs34554 +Node: Command Grouping48898 +Node: Coprocesses50376 +Node: GNU Parallel53039 +Node: Shell Functions53956 +Node: Shell Parameters61841 +Node: Positional Parameters66229 +Node: Special Parameters67131 +Node: Shell Expansions70345 +Node: Brace Expansion72472 +Node: Tilde Expansion75206 +Node: Shell Parameter Expansion77827 +Node: Command Substitution96178 +Node: Arithmetic Expansion97533 +Node: Process Substitution98501 +Node: Word Splitting99621 +Node: Filename Expansion101565 +Node: Pattern Matching104314 +Node: Quote Removal108922 +Node: Redirections109217 +Node: Executing Commands118877 +Node: Simple Command Expansion119547 +Node: Command Search and Execution121657 +Node: Command Execution Environment124035 +Node: Environment127070 +Node: Exit Status128733 +Node: Signals130517 +Node: Shell Scripts133966 +Node: Shell Builtin Commands136993 +Node: Bourne Shell Builtins139031 +Node: Bash Builtins160492 +Node: Modifying Shell Behavior191348 +Node: The Set Builtin191693 +Node: The Shopt Builtin202294 +Node: Special Builtins218206 +Node: Shell Variables219185 +Node: Bourne Shell Variables219622 +Node: Bash Variables221726 +Node: Bash Features254542 +Node: Invoking Bash255555 +Node: Bash Startup Files261568 +Node: Interactive Shells266671 +Node: What is an Interactive Shell?267081 +Node: Is this Shell Interactive?267730 +Node: Interactive Shell Behavior268545 +Node: Bash Conditional Expressions272174 +Node: Shell Arithmetic276816 +Node: Aliases279760 +Node: Arrays282373 +Node: The Directory Stack288764 +Node: Directory Stack Builtins289548 +Node: Controlling the Prompt293808 +Node: The Restricted Shell296773 +Node: Bash POSIX Mode299383 +Node: Shell Compatibility Mode311033 +Node: Job Control319062 +Node: Job Control Basics319522 +Node: Job Control Builtins324524 +Node: Job Control Variables329924 +Node: Command Line Editing331080 +Node: Introduction and Notation332751 +Node: Readline Interaction334374 +Node: Readline Bare Essentials335565 +Node: Readline Movement Commands337348 +Node: Readline Killing Commands338308 +Node: Readline Arguments340226 +Node: Searching341270 +Node: Readline Init File343456 +Node: Readline Init File Syntax344717 +Node: Conditional Init Constructs367916 +Node: Sample Init File372112 +Node: Bindable Readline Commands375236 +Node: Commands For Moving376440 +Node: Commands For History378491 +Node: Commands For Text383485 +Node: Commands For Killing387134 +Node: Numeric Arguments390167 +Node: Commands For Completion391306 +Node: Keyboard Macros395497 +Node: Miscellaneous Commands396184 +Node: Readline vi Mode402123 +Node: Programmable Completion403030 +Node: Programmable Completion Builtins410810 +Node: A Programmable Completion Example421505 +Node: Using History Interactively426752 +Node: Bash History Facilities427436 +Node: Bash History Builtins430441 +Node: History Interaction435449 +Node: Event Designators439069 +Node: Word Designators440423 +Node: Modifiers442183 +Node: Installing Bash443994 +Node: Basic Installation445131 +Node: Compilers and Options448853 +Node: Compiling For Multiple Architectures449594 +Node: Installation Names451287 +Node: Specifying the System Type453396 +Node: Sharing Defaults454112 +Node: Operation Controls454785 +Node: Optional Features455743 +Node: Reporting Bugs466961 +Node: Major Differences From The Bourne Shell468236 +Node: GNU Free Documentation License485086 +Node: Indexes510263 +Node: Builtin Index510717 +Node: Reserved Word Index517544 +Node: Variable Index519992 +Node: Function Index536766 +Node: Concept Index550550  End Tag Table diff --git a/doc/bashref.texi b/doc/bashref.texi index 7e84f072..c5e7e2b5 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -2221,7 +2221,7 @@ var is set and not null This is referred to as Substring Expansion. It expands to up to @var{length} characters of the value of @var{parameter} starting at the character specified by @var{offset}. -If @var{parameter} is @samp{@@}, an indexed array subscripted by +If @var{parameter} is @samp{@@} or @samp{*}, an indexed array subscripted by @samp{@@} or @samp{*}, or an associative array name, the results differ as described below. If @var{length} is omitted, it expands to the substring of the value of @@ -2298,8 +2298,8 @@ $ echo ${array[0]: -7:-2} bcdef @end verbatim -If @var{parameter} is @samp{@@}, the result is @var{length} positional -parameters beginning at @var{offset}. +If @var{parameter} is @samp{@@} or @samp{*}, the result is @var{length} +positional parameters beginning at @var{offset}. A negative @var{offset} is taken relative to one greater than the greatest positional parameter, so an offset of -1 evaluates to the last positional parameter. diff --git a/lib/readline/complete.c b/lib/readline/complete.c index 1e4dfa3b..e5d224ed 100644 --- a/lib/readline/complete.c +++ b/lib/readline/complete.c @@ -1981,7 +1981,7 @@ compare_match (char *text, const char *match) { temp = (*rl_filename_dequoting_function) (text, rl_completion_quote_character); r = strcmp (temp, match); - free (temp); + xfree (temp); return r; } return (strcmp (text, match)); diff --git a/lib/readline/display.c b/lib/readline/display.c index 3ac09c7c..c1135ec5 100644 --- a/lib/readline/display.c +++ b/lib/readline/display.c @@ -536,7 +536,7 @@ expand_prompt (char *pmt, int flags, int *lp, int *lip, int *niflp, int *vlp) *vlp = physchars; if (nprompt != pmt) - free (nprompt); + xfree (nprompt); return ret; } diff --git a/lib/readline/histfile.c b/lib/readline/histfile.c index edc903ef..3bfec550 100644 --- a/lib/readline/histfile.c +++ b/lib/readline/histfile.c @@ -310,7 +310,7 @@ read_history_range (const char *filename, int from, int to) if (file_size == 0) { - free (input); + xfree (input); close (file); return 0; /* don't waste time if we don't have to */ } diff --git a/lib/readline/histsearch.c b/lib/readline/histsearch.c index 9711b152..b62c06b7 100644 --- a/lib/readline/histsearch.c +++ b/lib/readline/histsearch.c @@ -248,7 +248,7 @@ _hs_history_patsearch (const char *string, int direction, int flags) ret = history_search_internal (pat, direction, flags|PATTERN_SEARCH); if (pat != string) - free (pat); + xfree (pat); return ret; } diff --git a/lib/readline/isearch.c b/lib/readline/isearch.c index df23f15a..3e398a6c 100644 --- a/lib/readline/isearch.c +++ b/lib/readline/isearch.c @@ -679,7 +679,7 @@ opcode_dispatch: paste = _rl_bracketed_text (&pastelen); if (paste == 0 || *paste == 0) { - free (paste); + xfree (paste); break; } if (_rl_enable_active_region) @@ -692,7 +692,7 @@ opcode_dispatch: memcpy (cxt->search_string + cxt->search_string_index, paste, pastelen); cxt->search_string_index += pastelen; cxt->search_string[cxt->search_string_index] = '\0'; - free (paste); + xfree (paste); break; /* Add character to search string and continue search. */ diff --git a/lib/readline/misc.c b/lib/readline/misc.c index 2a75847d..4bca9c58 100644 --- a/lib/readline/misc.c +++ b/lib/readline/misc.c @@ -388,23 +388,12 @@ _rl_free_saved_history_line (void) { if (rl_undo_list && rl_undo_list == (UNDO_LIST *)_rl_saved_line_for_history->data) rl_undo_list = 0; - /* Have to free this separately because _rl_free_history entry can't: it doesn't know whether or not this has application data. Only the callers that know this is _rl_saved_line_for_history can know that it's an undo list. */ -#if defined (HISTORY_SEARCH_SETS_HISTPOS) - if (_rl_saved_line_for_history->data) - { - orig = rl_undo_list; - rl_undo_list = (UNDO_LIST *)_rl_saved_line_for_history->data; - rl_free_undo_list (); - rl_undo_list = orig; - } -#else if (_rl_saved_line_for_history->data) _rl_free_undo_list ((UNDO_LIST *)_rl_saved_line_for_history->data); -#endif _rl_free_history_entry (_rl_saved_line_for_history); _rl_saved_line_for_history = (HIST_ENTRY *)NULL; } diff --git a/lib/readline/readline.c b/lib/readline/readline.c index 8fad893c..999a23d4 100644 --- a/lib/readline/readline.c +++ b/lib/readline/readline.c @@ -492,12 +492,8 @@ readline_internal_teardown (int eof) /* We don't want to do this if we executed functions that call history_set_pos to set the history offset to the line containing the non-incremental search string. */ -#if defined (HISTORY_SEARCH_SETS_HISTPOS) - if (entry && rl_undo_list && _rl_history_search_pos != where_history ()) -#else if (entry && rl_undo_list) -#endif - { + { temp = savestring (the_line); rl_revert_line (1, 0); entry = replace_history_entry (where_history (), the_line, (histdata_t)NULL); diff --git a/lib/readline/search.c b/lib/readline/search.c index ce278fd9..eea23011 100644 --- a/lib/readline/search.c +++ b/lib/readline/search.c @@ -84,14 +84,12 @@ static int _rl_nsearch_dispatch (_rl_search_cxt *, int); static void make_history_line_current (HIST_ENTRY *entry) { -#if !defined (HISTORY_SEARCH_SETS_HISTPOS) UNDO_LIST *xlist; xlist = _rl_saved_line_for_history ? (UNDO_LIST *)_rl_saved_line_for_history->data : 0; /* At this point, rl_undo_list points to a private search string list. */ if (rl_undo_list && rl_undo_list != (UNDO_LIST *)entry->data && rl_undo_list != xlist) rl_free_undo_list (); -#endif /* Now we create a new undo list with a single insert for this text. WE DON'T CHANGE THE ORIGINAL HISTORY ENTRY UNDO LIST */ @@ -106,7 +104,6 @@ make_history_line_current (HIST_ENTRY *entry) rl_free_undo_list (); #endif -#if !defined (HISTORY_SEARCH_SETS_HISTPOS) /* This will need to free the saved undo list associated with the original (pre-search) line buffer. XXX - look at _rl_free_saved_history_line and consider calling it if @@ -115,7 +112,6 @@ make_history_line_current (HIST_ENTRY *entry) if (_rl_saved_line_for_history) _rl_free_history_entry (_rl_saved_line_for_history); _rl_saved_line_for_history = (HIST_ENTRY *)NULL; -#endif } /* Search the history list for STRING starting at absolute history position @@ -204,10 +200,6 @@ noninc_dosearch (char *string, int dir, int flags) history_set_pos (oldpos); make_history_line_current (entry); -#if !defined (HISTORY_SEARCH_SETS_HISTPOS) - /* make_history_line_current used to do this. */ - _rl_free_saved_history_line (); -#endif if (_rl_enable_active_region && ((flags & SF_PATTERN) == 0) && ind > 0 && ind < rl_end) { @@ -538,20 +530,11 @@ rl_history_search_internal (int count, int dir) { HIST_ENTRY *temp; int ret, oldpos, newcol; - UNDO_LIST *origlist; - int had_saved_line, origpos; + int had_saved_line; char *t; -#if defined (HISTORY_SEARCH_SETS_HISTPOS) - origpos = where_history (); had_saved_line = _rl_saved_line_for_history != 0; rl_maybe_save_line (); - /* This will either be restored from the saved line or set from the - found history line. */ - rl_undo_list = 0; -#else - rl_maybe_save_line (); -#endif temp = (HIST_ENTRY *)NULL; /* Search COUNT times through the history for a line matching @@ -606,28 +589,6 @@ rl_history_search_internal (int count, int dir) /* Copy the line we found into the current line buffer. */ make_history_line_current (temp); - /* XXX - can't make this work the way I want it to yet. Too much assumes - that rl_undo_list corresponds to the current history entry's undo list, - especially the stuff in maybe_save_line and especially maybe_replace_line. - Leaving it commented out for now. */ - -#if defined (HISTORY_SEARCH_SETS_HISTPOS) - /* Free the saved history line corresponding to the search string */ - if (had_saved_line == 0) - _rl_free_saved_history_line (); - - /* Make sure we set the current history position to the last line found so - we can do things like operate-and-get-next from here. This is similar to - how incremental search behaves. */ - origlist = rl_undo_list; - rl_undo_list = 0; /* XXX - was (UNDO_LIST *)temp->data */ - if (_rl_history_search_pos < origpos) - rl_get_previous_history (origpos - _rl_history_search_pos, 0); - else - rl_get_next_history (_rl_history_search_pos - origpos, 0); - rl_undo_list = origlist; -#endif - /* decide where to put rl_point -- need to change this for pattern search */ if (_rl_history_search_flags & ANCHORED_SEARCH) rl_point = _rl_history_search_len; /* easy case */ diff --git a/lib/readline/terminal.c b/lib/readline/terminal.c index bddf1ed4..9997161f 100644 --- a/lib/readline/terminal.c +++ b/lib/readline/terminal.c @@ -824,7 +824,7 @@ _rl_reset_region_color (int which, const char *value) if (which == 0) { - free (_rl_active_region_start_color); + xfree (_rl_active_region_start_color); if (value && *value) { _rl_active_region_start_color = (char *)xmalloc (2 * strlen (value) + 1); @@ -836,7 +836,7 @@ _rl_reset_region_color (int which, const char *value) } else { - free (_rl_active_region_end_color); + xfree (_rl_active_region_end_color); if (value && *value) { _rl_active_region_end_color = (char *)xmalloc (2 * strlen (value) + 1);