From: Chet Ramey Date: Fri, 24 Jan 2025 16:21:16 +0000 (-0500) Subject: taking the length of an unset variable subscripted with anything but @ or * is a... X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=25e213a551dc808c7f29360075bad4806fb9fec5;p=thirdparty%2Fbash.git taking the length of an unset variable subscripted with anything but @ or * is a fatal error; quote results of u prompt expansion; posix mode changes for exiting on -e when in a shell function; fix readline redisplay issue when bold prompt spans multiple lines --- diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index dfcc9997..22738d7c 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -10834,3 +10834,39 @@ examples/loadables/fltexpr.c builtins/printf.def - getarg(), advancearg(): cosmetic changes to make it easier to implement %N$ format specifiers in the future + + 1/18 + ---- +subst.c + - array_length_reference: requesting the length of an element of an + unset variable using array syntax is a fatal error when `set -u' + is enabled and the subscript is not `@' or `*'. + Inspired by a report from Ian Kelling + + 1/20 + ---- +parse.y + - decode_prompt_string: since Debian has made the spectaculary bad call + to allow arbitrary characters in usernames, protect the results of + the \u expansion in the same way as \[Ww] and \[Hh] (externally- + controlled data) + From https://savannah.gnu.org/patch/?10496 + + 1/21 + ---- +eval.c + - reader_loop: if we longjmp with ERREXIT, don't reset any local + function contexts in posix mode, since POSIX says to exit as if + executing the `exit builtin with no arguments'. Revision of change + from 7/2022. + From a report by Ivan Shapovalov in 11/2024 + +lib/readline/display.c + - rl_redisplay: after calling update_line, when putting the cursor + where it needs to be and reprinting part of the line with the + prompt that contains invisible characters, make sure we start to + output characters at the portion in the prompt buffer that begins + on the current line and only offset by the number of invisible + characters on the current line, and set _rl_last_c_pos accordingly + in both multibyte and singlebyte locales. + Fixes bug reported by Andreas Schwab diff --git a/Makefile.in b/Makefile.in index 30237239..14af3298 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1182,6 +1182,7 @@ expr.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h expr.o: make_cmd.h subst.h sig.h pathnames.h externs.h flags.h execute_cmd.h expr.o: ${BASHINCDIR}/chartypes.h expr.o: assoc.h ${BASHINCDIR}/ocache.h ${BASHINCDIR}/typemax.h +expr.o: $(DEFSRC)/common.h $(DEFDIR)/builtext.h findcmd.o: config.h bashtypes.h ${BASHINCDIR}/filecntl.h ${BASHINCDIR}/posixstat.h bashansi.h findcmd.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/memalloc.h shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h findcmd.o: ${BASHINCDIR}/stdc.h error.h general.h xmalloc.h variables.h arrayfunc.h conftypes.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h diff --git a/builtins/shopt.def b/builtins/shopt.def index 4994ebc4..fe429c01 100644 --- a/builtins/shopt.def +++ b/builtins/shopt.def @@ -70,7 +70,7 @@ $END #define UNSETOPT 0 #define SETOPT 1 -#define OPTFMT "%-25s %s\n" +#define OPTFMT "%-20s\t%s\n" extern int allow_null_glob_expansion, fail_glob_expansion, glob_dot_filenames; extern int cdable_vars, mail_warning, source_uses_path; diff --git a/doc/bash.0 b/doc/bash.0 index 9cb764df..052c3460 100644 --- a/doc/bash.0 +++ b/doc/bash.0 @@ -892,110 +892,111 @@ PPAARRAAMMEETTEERRSS appearing in BBAASSHHOOPPTTSS are those reported as _o_n by sshhoopptt. If this variable is in the environment when bbaasshh starts up, the shell enables each option in the list before reading any startup - files. This variable is read-only. + files. If this variable is exported, child shells will enable + each option in the list. This variable is read-only. BBAASSHHPPIIDD - Expands to the process ID of the current bbaasshh process. This - differs from $$$$ under certain circumstances, such as subshells - that do not require bbaasshh to be re-initialized. Assignments to - BBAASSHHPPIIDD have no effect. If BBAASSHHPPIIDD is unset, it loses its spe- + Expands to the process ID of the current bbaasshh process. This + differs from $$$$ under certain circumstances, such as subshells + that do not require bbaasshh to be re-initialized. Assignments to + BBAASSHHPPIIDD have no effect. If BBAASSHHPPIIDD is unset, it loses its spe- cial properties, even if it is subsequently reset. BBAASSHH__AALLIIAASSEESS - An associative array variable whose members correspond to the - internal list of aliases as maintained by the aalliiaass builtin. - Elements added to this array appear in the alias list; however, - unsetting array elements currently does not remove aliases from - the alias list. If BBAASSHH__AALLIIAASSEESS is unset, it loses its special + An associative array variable whose members correspond to the + internal list of aliases as maintained by the aalliiaass builtin. + Elements added to this array appear in the alias list; however, + unsetting array elements currently does not remove aliases from + the alias list. If BBAASSHH__AALLIIAASSEESS is unset, it loses its special properties, even if it is subsequently reset. BBAASSHH__AARRGGCC - An array variable whose values are the number of parameters in + An array variable whose values are the number of parameters in each frame of the current bbaasshh execution call stack. The number - of parameters to the current subroutine (shell function or - script executed with .. or ssoouurrccee) is at the top of the stack. - When a subroutine is executed, the number of parameters passed + of parameters to the current subroutine (shell function or + script executed with .. or ssoouurrccee) is at the top of the stack. + When a subroutine is executed, the number of parameters passed is pushed onto BBAASSHH__AARRGGCC. The shell sets BBAASSHH__AARRGGCC only when in extended debugging mode (see the description of the eexxttddeebbuugg op- - tion to the sshhoopptt builtin below). Setting eexxttddeebbuugg after the + tion to the sshhoopptt builtin below). Setting eexxttddeebbuugg after the shell has started to execute a script, or referencing this vari- - able when eexxttddeebbuugg is not set, may result in inconsistent val- + able when eexxttddeebbuugg is not set, may result in inconsistent val- ues. Assignments to BBAASSHH__AARRGGCC have no effect, and it may not be unset. BBAASSHH__AARRGGVV - An array variable containing all of the parameters in the cur- + An array variable containing all of the parameters in the cur- rent bbaasshh execution call stack. The final parameter of the last - subroutine call is at the top of the stack; the first parameter + subroutine call is at the top of the stack; the first parameter of the initial call is at the bottom. When a subroutine is exe- - cuted, the shell pushes the supplied parameters onto BBAASSHH__AARRGGVV. - The shell sets BBAASSHH__AARRGGVV only when in extended debugging mode + cuted, the shell pushes the supplied parameters onto BBAASSHH__AARRGGVV. + The shell sets BBAASSHH__AARRGGVV only when in extended debugging mode (see the description of the eexxttddeebbuugg option to the sshhoopptt builtin below). Setting eexxttddeebbuugg after the shell has started to execute a script, or referencing this variable when eexxttddeebbuugg is not set, - may result in inconsistent values. Assignments to BBAASSHH__AARRGGVV + may result in inconsistent values. Assignments to BBAASSHH__AARRGGVV have no effect, and it may not be unset. BBAASSHH__AARRGGVV00 - When referenced, this variable expands to the name of the shell + When referenced, this variable expands to the name of the shell or shell script (identical to $$00; see the description of special - parameter 0 above). Assigning a value to BBAASSHH__AARRGGVV00 sets $$00 to - the same value. If BBAASSHH__AARRGGVV00 is unset, it loses its special + parameter 0 above). Assigning a value to BBAASSHH__AARRGGVV00 sets $$00 to + the same value. If BBAASSHH__AARRGGVV00 is unset, it loses its special properties, even if it is subsequently reset. BBAASSHH__CCMMDDSS - An associative array variable whose members correspond to the - internal hash table of commands as maintained by the hhaasshh + An associative array variable whose members correspond to the + internal hash table of commands as maintained by the hhaasshh builtin. Adding elements to this array makes them appear in the hash table; however, unsetting array elements currently does not - remove command names from the hash table. If BBAASSHH__CCMMDDSS is un- + remove command names from the hash table. If BBAASSHH__CCMMDDSS is un- set, it loses its special properties, even if it is subsequently reset. BBAASSHH__CCOOMMMMAANNDD - Expands to the command currently being executed or about to be - executed, unless the shell is executing a command as the result + Expands to the command currently being executed or about to be + executed, unless the shell is executing a command as the result of a trap, in which case it is the command executing at the time - of the trap. If BBAASSHH__CCOOMMMMAANNDD is unset, it loses its special + of the trap. If BBAASSHH__CCOOMMMMAANNDD is unset, it loses its special properties, even if it is subsequently reset. BBAASSHH__EEXXEECCUUTTIIOONN__SSTTRRIINNGG The command argument to the --cc invocation option. BBAASSHH__LLIINNEENNOO - An array variable whose members are the line numbers in source - files where each corresponding member of FFUUNNCCNNAAMMEE was invoked. + An array variable whose members are the line numbers in source + files where each corresponding member of FFUUNNCCNNAAMMEE was invoked. $${{BBAASSHH__LLIINNEENNOO[[_$_i]]}} is the line number in the source file ($${{BBAASSHH__SSOOUURRCCEE[[_$_i_+_1]]}}) where $${{FFUUNNCCNNAAMMEE[[_$_i]]}} was called (or - $${{BBAASSHH__LLIINNEENNOO[[_$_i_-_1]]}} if referenced within another shell func- - tion). Use LLIINNEENNOO to obtain the current line number. Assign- + $${{BBAASSHH__LLIINNEENNOO[[_$_i_-_1]]}} if referenced within another shell func- + tion). Use LLIINNEENNOO to obtain the current line number. Assign- ments to BBAASSHH__LLIINNEENNOO have no effect, and it may not be unset. BBAASSHH__LLOOAADDAABBLLEESS__PPAATTHH - A colon-separated list of directories in which the eennaabbllee com- + A colon-separated list of directories in which the eennaabbllee com- mand looks for dynamically loadable builtins. BBAASSHH__MMOONNOOSSEECCOONNDDSS - Each time this variable is referenced, it expands to the value - returned by the system's monotonic clock, if one is available. - If there is no monotonic clock, this is equivalent to EEPPOOCCHHSSEECC-- - OONNDDSS. If BBAASSHH__MMOONNOOSSEECCOONNDDSS is unset, it loses its special prop- + Each time this variable is referenced, it expands to the value + returned by the system's monotonic clock, if one is available. + If there is no monotonic clock, this is equivalent to EEPPOOCCHHSSEECC-- + OONNDDSS. If BBAASSHH__MMOONNOOSSEECCOONNDDSS is unset, it loses its special prop- erties, even if it is subsequently reset. BBAASSHH__RREEMMAATTCCHH - An array variable whose members are assigned by the ==~~ binary - operator to the [[[[ conditional command. The element with index - 0 is the portion of the string matching the entire regular ex- + An array variable whose members are assigned by the ==~~ binary + operator to the [[[[ conditional command. The element with index + 0 is the portion of the string matching the entire regular ex- pression. The element with index _n is the portion of the string matching the _nth parenthesized subexpression. BBAASSHH__SSOOUURRCCEE - An array variable whose members are the source filenames where - the corresponding shell function names in the FFUUNNCCNNAAMMEE array + An array variable whose members are the source filenames where + the corresponding shell function names in the FFUUNNCCNNAAMMEE array variable are defined. The shell function $${{FFUUNNCCNNAAMMEE[[_$_i]]}} is de- - fined in the file $${{BBAASSHH__SSOOUURRCCEE[[_$_i]]}} and called from - $${{BBAASSHH__SSOOUURRCCEE[[_$_i_+_1]]}}. Assignments to BBAASSHH__SSOOUURRCCEE have no ef- + fined in the file $${{BBAASSHH__SSOOUURRCCEE[[_$_i]]}} and called from + $${{BBAASSHH__SSOOUURRCCEE[[_$_i_+_1]]}}. Assignments to BBAASSHH__SSOOUURRCCEE have no ef- fect, and it may not be unset. BBAASSHH__SSUUBBSSHHEELLLL - Incremented by one within each subshell or subshell environment - when the shell begins executing in that environment. The ini- - tial value is 0. If BBAASSHH__SSUUBBSSHHEELLLL is unset, it loses its spe- + Incremented by one within each subshell or subshell environment + when the shell begins executing in that environment. The ini- + tial value is 0. If BBAASSHH__SSUUBBSSHHEELLLL is unset, it loses its spe- cial properties, even if it is subsequently reset. BBAASSHH__TTRRAAPPSSIIGG - Set to the signal number corresponding to the trap action being - executed during its execution. See the description of ttrraapp un- - der SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below for information about signal + Set to the signal number corresponding to the trap action being + executed during its execution. See the description of ttrraapp un- + der SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below for information about signal numbers and trap execution. BBAASSHH__VVEERRSSIINNFFOO A readonly array variable whose members hold version information - for this instance of bbaasshh. The values assigned to the array + for this instance of bbaasshh. The values assigned to the array members are as follows: BBAASSHH__VVEERRSSIINNFFOO[[0]] The major version number (the _r_e_l_e_a_s_e). BBAASSHH__VVEERRSSIINNFFOO[[1]] The minor version number (the _v_e_r_s_i_o_n). @@ -1004,149 +1005,149 @@ PPAARRAAMMEETTEERRSS BBAASSHH__VVEERRSSIINNFFOO[[4]] The release status (e.g., _b_e_t_a). BBAASSHH__VVEERRSSIINNFFOO[[5]] The value of MMAACCHHTTYYPPEE. BBAASSHH__VVEERRSSIIOONN - Expands to a string describing the version of this instance of + Expands to a string describing the version of this instance of bbaasshh (e.g., 5.2.37(3)-release). CCOOMMPP__CCWWOORRDD - An index into $${{CCOOMMPP__WWOORRDDSS}} of the word containing the current + An index into $${{CCOOMMPP__WWOORRDDSS}} of the word containing the current cursor position. This variable is available only in shell func- - tions invoked by the programmable completion facilities (see + tions invoked by the programmable completion facilities (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn below). CCOOMMPP__KKEEYY The key (or final key of a key sequence) used to invoke the cur- - rent completion function. This variable is available only in - shell functions and external commands invoked by the programma- + rent completion function. This variable is available only in + shell functions and external commands invoked by the programma- ble completion facilities (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn below). CCOOMMPP__LLIINNEE - The current command line. This variable is available only in - shell functions and external commands invoked by the programma- + The current command line. This variable is available only in + shell functions and external commands invoked by the programma- ble completion facilities (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn below). CCOOMMPP__PPOOIINNTT - The index of the current cursor position relative to the begin- - ning of the current command. If the current cursor position is + The index of the current cursor position relative to the begin- + ning of the current command. If the current cursor position is at the end of the current command, the value of this variable is - equal to $${{##CCOOMMPP__LLIINNEE}}. This variable is available only in - shell functions and external commands invoked by the programma- + equal to $${{##CCOOMMPP__LLIINNEE}}. This variable is available only in + shell functions and external commands invoked by the programma- ble completion facilities (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn below). CCOOMMPP__TTYYPPEE - Set to an integer value corresponding to the type of attempted - completion that caused a completion function to be called: _T_A_B, - for normal completion, _?, for listing completions after succes- - sive tabs, _!, for listing alternatives on partial word comple- - tion, _@, to list completions if the word is not unmodified, or - _%, for menu completion. This variable is available only in - shell functions and external commands invoked by the programma- + Set to an integer value corresponding to the type of attempted + completion that caused a completion function to be called: _T_A_B, + for normal completion, _?, for listing completions after succes- + sive tabs, _!, for listing alternatives on partial word comple- + tion, _@, to list completions if the word is not unmodified, or + _%, for menu completion. This variable is available only in + shell functions and external commands invoked by the programma- ble completion facilities (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn below). CCOOMMPP__WWOORRDDBBRREEAAKKSS - The set of characters that the rreeaaddlliinnee library treats as word - separators when performing word completion. If CCOOMMPP__WWOORRDDBBRREEAAKKSS - is unset, it loses its special properties, even if it is subse- + The set of characters that the rreeaaddlliinnee library treats as word + separators when performing word completion. If CCOOMMPP__WWOORRDDBBRREEAAKKSS + is unset, it loses its special properties, even if it is subse- quently reset. CCOOMMPP__WWOORRDDSS - An array variable (see AArrrraayyss below) consisting of the individ- - ual words in the current command line. The line is split into - words as rreeaaddlliinnee would split it, using CCOOMMPP__WWOORRDDBBRREEAAKKSS as de- - scribed above. This variable is available only in shell func- - tions invoked by the programmable completion facilities (see + An array variable (see AArrrraayyss below) consisting of the individ- + ual words in the current command line. The line is split into + words as rreeaaddlliinnee would split it, using CCOOMMPP__WWOORRDDBBRREEAAKKSS as de- + scribed above. This variable is available only in shell func- + tions invoked by the programmable completion facilities (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn below). - CCOOPPRROOCC An array variable (see AArrrraayyss below) created to hold the file - descriptors for output from and input to an unnamed coprocess + CCOOPPRROOCC An array variable (see AArrrraayyss below) created to hold the file + descriptors for output from and input to an unnamed coprocess (see CCoopprroocceesssseess above). DDIIRRSSTTAACCKK An array variable (see AArrrraayyss below) containing the current con- - tents of the directory stack. Directories appear in the stack - in the order they are displayed by the ddiirrss builtin. Assigning + tents of the directory stack. Directories appear in the stack + in the order they are displayed by the ddiirrss builtin. Assigning to members of this array variable may be used to modify directo- - ries already in the stack, but the ppuusshhdd and ppooppdd builtins must - be used to add and remove directories. Assigning to this vari- - able does not change the current directory. If DDIIRRSSTTAACCKK is un- + ries already in the stack, but the ppuusshhdd and ppooppdd builtins must + be used to add and remove directories. Assigning to this vari- + able does not change the current directory. If DDIIRRSSTTAACCKK is un- set, it loses its special properties, even if it is subsequently reset. EEPPOOCCHHRREEAALLTTIIMMEE Each time this parameter is referenced, it expands to the number - of seconds since the Unix Epoch (see _t_i_m_e(3)) as a floating- + of seconds since the Unix Epoch (see _t_i_m_e(3)) as a floating- point value with micro-second granularity. Assignments to - EEPPOOCCHHRREEAALLTTIIMMEE are ignored. If EEPPOOCCHHRREEAALLTTIIMMEE is unset, it loses + EEPPOOCCHHRREEAALLTTIIMMEE are ignored. If EEPPOOCCHHRREEAALLTTIIMMEE is unset, it loses its special properties, even if it is subsequently reset. EEPPOOCCHHSSEECCOONNDDSS Each time this parameter is referenced, it expands to the number - of seconds since the Unix Epoch (see _t_i_m_e(3)). Assignments to - EEPPOOCCHHSSEECCOONNDDSS are ignored. If EEPPOOCCHHSSEECCOONNDDSS is unset, it loses + of seconds since the Unix Epoch (see _t_i_m_e(3)). Assignments to + EEPPOOCCHHSSEECCOONNDDSS are ignored. If EEPPOOCCHHSSEECCOONNDDSS is unset, it loses its special properties, even if it is subsequently reset. - EEUUIIDD Expands to the effective user ID of the current user, initial- + EEUUIIDD Expands to the effective user ID of the current user, initial- ized at shell startup. This variable is readonly. FFUUNNCCNNAAMMEE - An array variable containing the names of all shell functions + An array variable containing the names of all shell functions currently in the execution call stack. The element with index 0 is the name of any currently-executing shell function. The bot- - tom-most element (the one with the highest index) is "main". - This variable exists only when a shell function is executing. - Assignments to FFUUNNCCNNAAMMEE have no effect. If FFUUNNCCNNAAMMEE is unset, - it loses its special properties, even if it is subsequently re- + tom-most element (the one with the highest index) is "main". + This variable exists only when a shell function is executing. + Assignments to FFUUNNCCNNAAMMEE have no effect. If FFUUNNCCNNAAMMEE is unset, + it loses its special properties, even if it is subsequently re- set. - This variable can be used with BBAASSHH__LLIINNEENNOO and BBAASSHH__SSOOUURRCCEE. - Each element of FFUUNNCCNNAAMMEE has corresponding elements in + This variable can be used with BBAASSHH__LLIINNEENNOO and BBAASSHH__SSOOUURRCCEE. + Each element of FFUUNNCCNNAAMMEE has corresponding elements in BBAASSHH__LLIINNEENNOO and BBAASSHH__SSOOUURRCCEE to describe the call stack. For in- - stance, $${{FFUUNNCCNNAAMMEE[[_$_i]]}} was called from the file - $${{BBAASSHH__SSOOUURRCCEE[[_$_i_+_1]]}} at line number $${{BBAASSHH__LLIINNEENNOO[[_$_i]]}}. The + stance, $${{FFUUNNCCNNAAMMEE[[_$_i]]}} was called from the file + $${{BBAASSHH__SSOOUURRCCEE[[_$_i_+_1]]}} at line number $${{BBAASSHH__LLIINNEENNOO[[_$_i]]}}. The ccaalllleerr builtin displays the current call stack using this infor- mation. - GGRROOUUPPSS An array variable containing the list of groups of which the + GGRROOUUPPSS An array variable containing the list of groups of which the current user is a member. Assignments to GGRROOUUPPSS have no effect. - If GGRROOUUPPSS is unset, it loses its special properties, even if it + If GGRROOUUPPSS is unset, it loses its special properties, even if it is subsequently reset. HHIISSTTCCMMDD The history number, or index in the history list, of the current - command. Assignments to HHIISSTTCCMMDD have no effect. If HHIISSTTCCMMDD is - unset, it loses its special properties, even if it is subse- + command. Assignments to HHIISSTTCCMMDD have no effect. If HHIISSTTCCMMDD is + unset, it loses its special properties, even if it is subse- quently reset. HHOOSSTTNNAAMMEE Automatically set to the name of the current host. HHOOSSTTTTYYPPEE - Automatically set to a string that uniquely describes the type - of machine on which bbaasshh is executing. The default is system- + Automatically set to a string that uniquely describes the type + of machine on which bbaasshh is executing. The default is system- dependent. - LLIINNEENNOO Each time this parameter is referenced, the shell substitutes a - decimal number representing the current sequential line number - (starting with 1) within a script or function. When not in a - script or function, the value substituted is not guaranteed to + LLIINNEENNOO Each time this parameter is referenced, the shell substitutes a + decimal number representing the current sequential line number + (starting with 1) within a script or function. When not in a + script or function, the value substituted is not guaranteed to be meaningful. If LLIINNEENNOO is unset, it loses its special proper- ties, even if it is subsequently reset. MMAACCHHTTYYPPEE - Automatically set to a string that fully describes the system - type on which bbaasshh is executing, in the standard GNU _c_p_u_-_c_o_m_- + Automatically set to a string that fully describes the system + type on which bbaasshh is executing, in the standard GNU _c_p_u_-_c_o_m_- _p_a_n_y_-_s_y_s_t_e_m format. The default is system-dependent. MMAAPPFFIILLEE - An array variable (see AArrrraayyss below) created to hold the text + An array variable (see AArrrraayyss below) created to hold the text read by the mmaappffiillee builtin when no variable name is supplied. OOLLDDPPWWDD The previous working directory as set by the ccdd command. - OOPPTTAARRGG The value of the last option argument processed by the ggeettooppttss + OOPPTTAARRGG The value of the last option argument processed by the ggeettooppttss builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). - OOPPTTIINNDD The index of the next argument to be processed by the ggeettooppttss + OOPPTTIINNDD The index of the next argument to be processed by the ggeettooppttss builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). - OOSSTTYYPPEE Automatically set to a string that describes the operating sys- - tem on which bbaasshh is executing. The default is system-depen- + OOSSTTYYPPEE Automatically set to a string that describes the operating sys- + tem on which bbaasshh is executing. The default is system-depen- dent. PPIIPPEESSTTAATTUUSS - An array variable (see AArrrraayyss below) containing a list of exit - status values from the commands in the most-recently-executed - foreground pipeline, which may consist of only a simple command + An array variable (see AArrrraayyss below) containing a list of exit + status values from the commands in the most-recently-executed + foreground pipeline, which may consist of only a simple command (see SSHHEELLLL GGRRAAMMMMAARR above). BBaasshh sets PPIIPPEESSTTAATTUUSS after executing - multi-element pipelines, timed and negated pipelines, simple - commands, subshells created with the ( operator, the [[[[ and (((( + multi-element pipelines, timed and negated pipelines, simple + commands, subshells created with the ( operator, the [[[[ and (((( compound commands, and after error conditions that result in the shell aborting command execution. - PPPPIIDD The process ID of the shell's parent. This variable is read- + PPPPIIDD The process ID of the shell's parent. This variable is read- only. PPWWDD The current working directory as set by the ccdd command. - RRAANNDDOOMM Each time this parameter is referenced, it expands to a random - integer between 0 and 32767. Assigning a value to RRAANNDDOOMM ini- - tializes (seeds) the sequence of random numbers. Seeding the - random number generator with the same constant value produces - the same sequence of values. If RRAANNDDOOMM is unset, it loses its + RRAANNDDOOMM Each time this parameter is referenced, it expands to a random + integer between 0 and 32767. Assigning a value to RRAANNDDOOMM ini- + tializes (seeds) the sequence of random numbers. Seeding the + random number generator with the same constant value produces + the same sequence of values. If RRAANNDDOOMM is unset, it loses its special properties, even if it is subsequently reset. RREEAADDLLIINNEE__AARRGGUUMMEENNTT - Any numeric argument given to a rreeaaddlliinnee command that was de- + Any numeric argument given to a rreeaaddlliinnee command that was de- fined using "bind -x" (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) when it was invoked. RREEAADDLLIINNEE__LLIINNEE @@ -1154,370 +1155,370 @@ PPAARRAAMMEETTEERRSS (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). RREEAADDLLIINNEE__MMAARRKK The position of the mark (saved insertion point) in the rreeaaddlliinnee - line buffer, for use with "bind -x" (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS + line buffer, for use with "bind -x" (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). The characters between the insertion point and the mark are often called the _r_e_g_i_o_n. RREEAADDLLIINNEE__PPOOIINNTT The position of the insertion point in the rreeaaddlliinnee line buffer, for use with "bind -x" (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). - RREEPPLLYY Set to the line of input read by the rreeaadd builtin command when + RREEPPLLYY Set to the line of input read by the rreeaadd builtin command when no arguments are supplied. SSEECCOONNDDSS Each time this parameter is referenced, it expands to the number - of seconds since shell invocation. If a value is assigned to - SSEECCOONNDDSS, the value returned upon subsequent references is the - number of seconds since the assignment plus the value assigned. - The number of seconds at shell invocation and the current time + of seconds since shell invocation. If a value is assigned to + SSEECCOONNDDSS, the value returned upon subsequent references is the + number of seconds since the assignment plus the value assigned. + The number of seconds at shell invocation and the current time are always determined by querying the system clock at one-second - resolution. If SSEECCOONNDDSS is unset, it loses its special proper- + resolution. If SSEECCOONNDDSS is unset, it loses its special proper- ties, even if it is subsequently reset. SSHHEELLLLOOPPTTSS - A colon-separated list of enabled shell options. Each word in - the list is a valid argument for the --oo option to the sseett + A colon-separated list of enabled shell options. Each word in + the list is a valid argument for the --oo option to the sseett builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). The options - appearing in SSHHEELLLLOOPPTTSS are those reported as _o_n by sseett --oo. If - this variable is in the environment when bbaasshh starts up, the + appearing in SSHHEELLLLOOPPTTSS are those reported as _o_n by sseett --oo. If + this variable is in the environment when bbaasshh starts up, the shell enables each option in the list before reading any startup - files. If this variable is exported, child shells will enable + files. If this variable is exported, child shells will enable each option in the list. This variable is read-only. SSHHLLVVLL Incremented by one each time an instance of bbaasshh is started. SSRRAANNDDOOMM - Each time it is referenced, this variable expands to a 32-bit + Each time it is referenced, this variable expands to a 32-bit pseudo-random number. The random number generator is not linear - on systems that support _/_d_e_v_/_u_r_a_n_d_o_m or _a_r_c_4_r_a_n_d_o_m(3), so each + on systems that support _/_d_e_v_/_u_r_a_n_d_o_m or _a_r_c_4_r_a_n_d_o_m(3), so each returned number has no relationship to the numbers preceding it. - The random number generator cannot be seeded, so assignments to + The random number generator cannot be seeded, so assignments to this variable have no effect. If SSRRAANNDDOOMM is unset, it loses its special properties, even if it is subsequently reset. UUIIDD Expands to the user ID of the current user, initialized at shell startup. This variable is readonly. - The shell uses the following variables. In some cases, bbaasshh assigns a + The shell uses the following variables. In some cases, bbaasshh assigns a default value to a variable; these cases are noted below. BBAASSHH__CCOOMMPPAATT - The value is used to set the shell's compatibility level. See - SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE below for a description of the various + The value is used to set the shell's compatibility level. See + SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE below for a description of the various compatibility levels and their effects. The value may be a dec- - imal number (e.g., 4.2) or an integer (e.g., 42) corresponding - to the desired compatibility level. If BBAASSHH__CCOOMMPPAATT is unset or - set to the empty string, the compatibility level is set to the - default for the current version. If BBAASSHH__CCOOMMPPAATT is set to a - value that is not one of the valid compatibility levels, the - shell prints an error message and sets the compatibility level - to the default for the current version. A subset of the valid - values correspond to the compatibility levels described below - under SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE. For example, 4.2 and 42 are - valid values that correspond to the ccoommppaatt4422 sshhoopptt option and - set the compatibility level to 42. The current version is also + imal number (e.g., 4.2) or an integer (e.g., 42) corresponding + to the desired compatibility level. If BBAASSHH__CCOOMMPPAATT is unset or + set to the empty string, the compatibility level is set to the + default for the current version. If BBAASSHH__CCOOMMPPAATT is set to a + value that is not one of the valid compatibility levels, the + shell prints an error message and sets the compatibility level + to the default for the current version. A subset of the valid + values correspond to the compatibility levels described below + under SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE. For example, 4.2 and 42 are + valid values that correspond to the ccoommppaatt4422 sshhoopptt option and + set the compatibility level to 42. The current version is also a valid value. BBAASSHH__EENNVV - If this parameter is set when bbaasshh is executing a shell script, - its expanded value is interpreted as a filename containing com- - mands to initialize the shell before it reads and executes com- - mands from the script. The value of BBAASSHH__EENNVV is subjected to + If this parameter is set when bbaasshh is executing a shell script, + its expanded value is interpreted as a filename containing com- + mands to initialize the shell before it reads and executes com- + mands from the script. The value of BBAASSHH__EENNVV is subjected to parameter expansion, command substitution, and arithmetic expan- - sion before being interpreted as a filename. PPAATTHH is not used + sion before being interpreted as a filename. PPAATTHH is not used to search for the resultant filename. BBAASSHH__XXTTRRAACCEEFFDD - If set to an integer corresponding to a valid file descriptor, - bbaasshh writes the trace output generated when "set -x" is enabled - to that file descriptor, instead of the standard error. The - file descriptor is closed when BBAASSHH__XXTTRRAACCEEFFDD is unset or as- + If set to an integer corresponding to a valid file descriptor, + bbaasshh writes the trace output generated when "set -x" is enabled + to that file descriptor, instead of the standard error. The + file descriptor is closed when BBAASSHH__XXTTRRAACCEEFFDD is unset or as- signed a new value. Unsetting BBAASSHH__XXTTRRAACCEEFFDD or assigning it the - empty string causes the trace output to be sent to the standard + empty string causes the trace output to be sent to the standard error. Note that setting BBAASSHH__XXTTRRAACCEEFFDD to 2 (the standard error - file descriptor) and then unsetting it will result in the stan- + file descriptor) and then unsetting it will result in the stan- dard error being closed. - CCDDPPAATTHH The search path for the ccdd command. This is a colon-separated + CCDDPPAATTHH The search path for the ccdd command. This is a colon-separated list of directories where the shell looks for directories speci- - fied as arguments to the ccdd command. A sample value is + fied as arguments to the ccdd command. A sample value is ".:~:/usr". CCHHIILLDD__MMAAXX - Set the number of exited child status values for the shell to - remember. BBaasshh will not allow this value to be decreased below - a POSIX-mandated minimum, and there is a maximum value (cur- - rently 8192) that this may not exceed. The minimum value is + Set the number of exited child status values for the shell to + remember. BBaasshh will not allow this value to be decreased below + a POSIX-mandated minimum, and there is a maximum value (cur- + rently 8192) that this may not exceed. The minimum value is system-dependent. CCOOLLUUMMNNSS - Used by the sseelleecctt compound command to determine the terminal - width when printing selection lists. Automatically set if the - cchheecckkwwiinnssiizzee option is enabled or in an interactive shell upon + Used by the sseelleecctt compound command to determine the terminal + width when printing selection lists. Automatically set if the + cchheecckkwwiinnssiizzee option is enabled or in an interactive shell upon receipt of a SSIIGGWWIINNCCHH. CCOOMMPPRREEPPLLYY An array variable from which bbaasshh reads the possible completions - generated by a shell function invoked by the programmable com- - pletion facility (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn below). Each ar- + generated by a shell function invoked by the programmable com- + pletion facility (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn below). Each ar- ray element contains one possible completion. - EEMMAACCSS If bbaasshh finds this variable in the environment when the shell - starts with value "t", it assumes that the shell is running in + EEMMAACCSS If bbaasshh finds this variable in the environment when the shell + starts with value "t", it assumes that the shell is running in an Emacs shell buffer and disables line editing. - EENNVV Expanded and executed similarly to BBAASSHH__EENNVV (see IINNVVOOCCAATTIIOONN + EENNVV Expanded and executed similarly to BBAASSHH__EENNVV (see IINNVVOOCCAATTIIOONN above) when an interactive shell is invoked in posix mode. EEXXEECCIIGGNNOORREE - A colon-separated list of shell patterns (see PPaatttteerrnn MMaattcchhiinngg) - defining the set of filenames to be ignored by command search - using PPAATTHH. Files whose full pathnames match one of these pat- - terns are not considered executable files for the purposes of + A colon-separated list of shell patterns (see PPaatttteerrnn MMaattcchhiinngg) + defining the set of filenames to be ignored by command search + using PPAATTHH. Files whose full pathnames match one of these pat- + terns are not considered executable files for the purposes of completion and command execution via PPAATTHH lookup. This does not affect the behavior of the [[, tteesstt, and [[[[ commands. Full path- - names in the command hash table are not subject to EEXXEECCIIGGNNOORREE. - Use this variable to ignore shared library files that have the - executable bit set, but are not executable files. The pattern + names in the command hash table are not subject to EEXXEECCIIGGNNOORREE. + Use this variable to ignore shared library files that have the + executable bit set, but are not executable files. The pattern matching honors the setting of the eexxttgglloobb shell option. FFCCEEDDIITT The default editor for the ffcc builtin command. FFIIGGNNOORREE - A colon-separated list of suffixes to ignore when performing + A colon-separated list of suffixes to ignore when performing filename completion (see RREEAADDLLIINNEE below). A filename whose suf- - fix matches one of the entries in FFIIGGNNOORREE is excluded from the + fix matches one of the entries in FFIIGGNNOORREE is excluded from the list of matched filenames. A sample value is ".o:~". FFUUNNCCNNEESSTT - If set to a numeric value greater than 0, defines a maximum - function nesting level. Function invocations that exceed this + If set to a numeric value greater than 0, defines a maximum + function nesting level. Function invocations that exceed this nesting level cause the current command to abort. GGLLOOBBIIGGNNOORREE - A colon-separated list of patterns defining the set of file - names to be ignored by pathname expansion. If a file name - matched by a pathname expansion pattern also matches one of the - patterns in GGLLOOBBIIGGNNOORREE, it is removed from the list of matches. + A colon-separated list of patterns defining the set of file + names to be ignored by pathname expansion. If a file name + matched by a pathname expansion pattern also matches one of the + patterns in GGLLOOBBIIGGNNOORREE, it is removed from the list of matches. The pattern matching honors the setting of the eexxttgglloobb shell op- tion. GGLLOOBBSSOORRTT - Controls how the results of pathname expansion are sorted. The - value of this variable specifies the sort criteria and sort or- - der for the results of pathname expansion. If this variable is - unset or set to the null string, pathname expansion uses the - historical behavior of sorting by name, in ascending lexico- + Controls how the results of pathname expansion are sorted. The + value of this variable specifies the sort criteria and sort or- + der for the results of pathname expansion. If this variable is + unset or set to the null string, pathname expansion uses the + historical behavior of sorting by name, in ascending lexico- graphic order as determined by the LLCC__CCOOLLLLAATTEE shell variable. - If set, a valid value begins with an optional _+, which is ig- + If set, a valid value begins with an optional _+, which is ig- nored, or _-, which reverses the sort order from ascending to de- - scending, followed by a sort specifier. The valid sort speci- - fiers are _n_a_m_e, _n_u_m_e_r_i_c, _s_i_z_e, _m_t_i_m_e, _a_t_i_m_e, _c_t_i_m_e, and _b_l_o_c_k_s, + scending, followed by a sort specifier. The valid sort speci- + fiers are _n_a_m_e, _n_u_m_e_r_i_c, _s_i_z_e, _m_t_i_m_e, _a_t_i_m_e, _c_t_i_m_e, and _b_l_o_c_k_s, which sort the files on name, names in numeric rather than lexi- - cographic order, file size, modification time, access time, in- - ode change time, and number of blocks, respectively. If any of - the non-name keys compare as equal (e.g., if two files are the + cographic order, file size, modification time, access time, in- + ode change time, and number of blocks, respectively. If any of + the non-name keys compare as equal (e.g., if two files are the same size), sorting uses the name as a secondary sort key. - For example, a value of _-_m_t_i_m_e sorts the results in descending + For example, a value of _-_m_t_i_m_e sorts the results in descending order by modification time (newest first). - The _n_u_m_e_r_i_c specifier treats names consisting solely of digits - as numbers and sorts them using their numeric value (so "2" + The _n_u_m_e_r_i_c specifier treats names consisting solely of digits + as numbers and sorts them using their numeric value (so "2" sorts before "10", for example). When using _n_u_m_e_r_i_c, names con- - taining non-digits sort after all the all-digit names and are + taining non-digits sort after all the all-digit names and are sorted by name using the traditional behavior. A sort specifier of _n_o_s_o_r_t disables sorting completely; bbaasshh re- - turns the results in the order they are read from the file sys- + turns the results in the order they are read from the file sys- tem, ignoring any leading _-. - If the sort specifier is missing, it defaults to _n_a_m_e, so a - value of _+ is equivalent to the null string, and a value of _- - sorts by name in descending order. Any invalid value restores + If the sort specifier is missing, it defaults to _n_a_m_e, so a + value of _+ is equivalent to the null string, and a value of _- + sorts by name in descending order. Any invalid value restores the historical sorting behavior. HHIISSTTCCOONNTTRROOLL - A colon-separated list of values controlling how commands are - saved on the history list. If the list of values includes - _i_g_n_o_r_e_s_p_a_c_e, lines which begin with a ssppaaccee character are not - saved in the history list. A value of _i_g_n_o_r_e_d_u_p_s causes lines + A colon-separated list of values controlling how commands are + saved on the history list. If the list of values includes + _i_g_n_o_r_e_s_p_a_c_e, lines which begin with a ssppaaccee character are not + saved in the history list. A value of _i_g_n_o_r_e_d_u_p_s causes lines matching the previous history entry not to be saved. A value of _i_g_n_o_r_e_b_o_t_h is shorthand for _i_g_n_o_r_e_s_p_a_c_e and _i_g_n_o_r_e_d_u_p_s. A value of _e_r_a_s_e_d_u_p_s causes all previous lines matching the current line - to be removed from the history list before that line is saved. - Any value not in the above list is ignored. If HHIISSTTCCOONNTTRROOLL is - unset, or does not include a valid value, bbaasshh saves all lines - read by the shell parser on the history list, subject to the + to be removed from the history list before that line is saved. + Any value not in the above list is ignored. If HHIISSTTCCOONNTTRROOLL is + unset, or does not include a valid value, bbaasshh saves all lines + read by the shell parser on the history list, subject to the value of HHIISSTTIIGGNNOORREE. If the first line of a multi-line compound - command was saved, the second and subsequent lines are not - tested, and are added to the history regardless of the value of - HHIISSTTCCOONNTTRROOLL. If the first line was not saved, the second and + command was saved, the second and subsequent lines are not + tested, and are added to the history regardless of the value of + HHIISSTTCCOONNTTRROOLL. If the first line was not saved, the second and subsequent lines of the command are not saved either. HHIISSTTFFIILLEE The name of the file in which command history is saved (see HHIISS-- - TTOORRYY below). BBaasshh assigns a default value of _~_/_._b_a_s_h___h_i_s_t_o_r_y. - If HHIISSTTFFIILLEE is unset or null, the shell does not save the com- + TTOORRYY below). BBaasshh assigns a default value of _~_/_._b_a_s_h___h_i_s_t_o_r_y. + If HHIISSTTFFIILLEE is unset or null, the shell does not save the com- mand history when it exits. HHIISSTTFFIILLEESSIIZZEE The maximum number of lines contained in the history file. When - this variable is assigned a value, the history file is trun- - cated, if necessary, to contain no more than that number of - lines by removing the oldest entries. The history file is also + this variable is assigned a value, the history file is trun- + cated, if necessary, to contain no more than that number of + lines by removing the oldest entries. The history file is also truncated to this size after writing it when a shell exits or by - the hhiissttoorryy builtin. If the value is 0, the history file is - truncated to zero size. Non-numeric values and numeric values - less than zero inhibit truncation. The shell sets the default + the hhiissttoorryy builtin. If the value is 0, the history file is + truncated to zero size. Non-numeric values and numeric values + less than zero inhibit truncation. The shell sets the default value to the value of HHIISSTTSSIIZZEE after reading any startup files. HHIISSTTIIGGNNOORREE - A colon-separated list of patterns used to decide which command - lines should be saved on the history list. If a command line - matches one of the patterns in the value of HHIISSTTIIGGNNOORREE, it is - not saved on the history list. Each pattern is anchored at the - beginning of the line and must match the complete line (bbaasshh - does not implicitly append a "**"). Each pattern is tested - against the line after the checks specified by HHIISSTTCCOONNTTRROOLL are + A colon-separated list of patterns used to decide which command + lines should be saved on the history list. If a command line + matches one of the patterns in the value of HHIISSTTIIGGNNOORREE, it is + not saved on the history list. Each pattern is anchored at the + beginning of the line and must match the complete line (bbaasshh + does not implicitly append a "**"). Each pattern is tested + against the line after the checks specified by HHIISSTTCCOONNTTRROOLL are applied. In addition to the normal shell pattern matching char- - acters, "&&" matches the previous history line. A backslash es- - capes the "&&"; the backslash is removed before attempting a - match. If the first line of a multi-line compound command was - saved, the second and subsequent lines are not tested, and are - added to the history regardless of the value of HHIISSTTIIGGNNOORREE. If + acters, "&&" matches the previous history line. A backslash es- + capes the "&&"; the backslash is removed before attempting a + match. If the first line of a multi-line compound command was + saved, the second and subsequent lines are not tested, and are + added to the history regardless of the value of HHIISSTTIIGGNNOORREE. If the first line was not saved, the second and subsequent lines of - the command are not saved either. The pattern matching honors + the command are not saved either. The pattern matching honors the setting of the eexxttgglloobb shell option. HHIISSTTIIGGNNOORREE subsumes some of the function of HHIISSTTCCOONNTTRROOLL. A pat- - tern of "&" is identical to "ignoredups", and a pattern of "[ - ]*" is identical to "ignorespace". Combining these two pat- - terns, separating them with a colon, provides the functionality + tern of "&" is identical to "ignoredups", and a pattern of "[ + ]*" is identical to "ignorespace". Combining these two pat- + terns, separating them with a colon, provides the functionality of "ignoreboth". HHIISSTTSSIIZZEE - The number of commands to remember in the command history (see - HHIISSTTOORRYY below). If the value is 0, commands are not saved in + The number of commands to remember in the command history (see + HHIISSTTOORRYY below). If the value is 0, commands are not saved in the history list. Numeric values less than zero result in every - command being saved on the history list (there is no limit). - The shell sets the default value to 500 after reading any + command being saved on the history list (there is no limit). + The shell sets the default value to 500 after reading any startup files. HHIISSTTTTIIMMEEFFOORRMMAATT - If this variable is set and not null, its value is used as a + If this variable is set and not null, its value is used as a format string for _s_t_r_f_t_i_m_e(3) to print the time stamp associated - with each history entry displayed by the hhiissttoorryy builtin. If - this variable is set, the shell writes time stamps to the his- - tory file so they may be preserved across shell sessions. This - uses the history comment character to distinguish timestamps + with each history entry displayed by the hhiissttoorryy builtin. If + this variable is set, the shell writes time stamps to the his- + tory file so they may be preserved across shell sessions. This + uses the history comment character to distinguish timestamps from other history lines. HHOOMMEE The home directory of the current user; the default argument for the ccdd builtin command. The value of this variable is also used when performing tilde expansion. HHOOSSTTFFIILLEE - Contains the name of a file in the same format as _/_e_t_c_/_h_o_s_t_s + Contains the name of a file in the same format as _/_e_t_c_/_h_o_s_t_s that should be read when the shell needs to complete a hostname. - The list of possible hostname completions may be changed while - the shell is running; the next time hostname completion is at- - tempted after the value is changed, bbaasshh adds the contents of - the new file to the existing list. If HHOOSSTTFFIILLEE is set, but has - no value, or does not name a readable file, bbaasshh attempts to - read _/_e_t_c_/_h_o_s_t_s to obtain the list of possible hostname comple- + The list of possible hostname completions may be changed while + the shell is running; the next time hostname completion is at- + tempted after the value is changed, bbaasshh adds the contents of + the new file to the existing list. If HHOOSSTTFFIILLEE is set, but has + no value, or does not name a readable file, bbaasshh attempts to + read _/_e_t_c_/_h_o_s_t_s to obtain the list of possible hostname comple- tions. When HHOOSSTTFFIILLEE is unset, bbaasshh clears the hostname list. IIFFSS The _I_n_t_e_r_n_a_l _F_i_e_l_d _S_e_p_a_r_a_t_o_r that is used for word splitting af- - ter expansion and to split lines into words with the rreeaadd + ter expansion and to split lines into words with the rreeaadd builtin command. Word splitting is described below under EEXXPPAANN-- SSIIOONN. The default value is "". IIGGNNOORREEEEOOFF Controls the action of an interactive shell on receipt of an EEOOFF character as the sole input. If set, the value is the number of - consecutive EEOOFF characters which must be typed as the first - characters on an input line before bbaasshh exits. If the variable - is set but does not have a numeric value, or the value is null, - the default value is 10. If it is unset, EEOOFF signifies the end + consecutive EEOOFF characters which must be typed as the first + characters on an input line before bbaasshh exits. If the variable + is set but does not have a numeric value, or the value is null, + the default value is 10. If it is unset, EEOOFF signifies the end of input to the shell. IINNPPUUTTRRCC - The filename for the rreeaaddlliinnee startup file, overriding the de- + The filename for the rreeaaddlliinnee startup file, overriding the de- fault of _~_/_._i_n_p_u_t_r_c (see RREEAADDLLIINNEE below). IINNSSIIDDEE__EEMMAACCSS - If this variable appears in the environment when the shell - starts, bbaasshh assumes that it is running inside an Emacs shell - buffer and may disable line editing, depending on the value of + If this variable appears in the environment when the shell + starts, bbaasshh assumes that it is running inside an Emacs shell + buffer and may disable line editing, depending on the value of TTEERRMM. - LLAANNGG Used to determine the locale category for any category not + LLAANNGG Used to determine the locale category for any category not specifically selected with a variable starting with LLCC__. - LLCC__AALLLL This variable overrides the value of LLAANNGG and any other LLCC__ + LLCC__AALLLL This variable overrides the value of LLAANNGG and any other LLCC__ variable specifying a locale category. LLCC__CCOOLLLLAATTEE - This variable determines the collation order used when sorting - the results of pathname expansion, and determines the behavior - of range expressions, equivalence classes, and collating se- + This variable determines the collation order used when sorting + the results of pathname expansion, and determines the behavior + of range expressions, equivalence classes, and collating se- quences within pathname expansion and pattern matching. LLCC__CCTTYYPPEE - This variable determines the interpretation of characters and - the behavior of character classes within pathname expansion and + This variable determines the interpretation of characters and + the behavior of character classes within pathname expansion and pattern matching. LLCC__MMEESSSSAAGGEESS - This variable determines the locale used to translate double- + This variable determines the locale used to translate double- quoted strings preceded by a $$. LLCC__NNUUMMEERRIICC - This variable determines the locale category used for number + This variable determines the locale category used for number formatting. LLCC__TTIIMMEE - This variable determines the locale category used for data and + This variable determines the locale category used for data and time formatting. - LLIINNEESS Used by the sseelleecctt compound command to determine the column - length for printing selection lists. Automatically set if the - cchheecckkwwiinnssiizzee option is enabled or in an interactive shell upon + LLIINNEESS Used by the sseelleecctt compound command to determine the column + length for printing selection lists. Automatically set if the + cchheecckkwwiinnssiizzee option is enabled or in an interactive shell upon receipt of a SSIIGGWWIINNCCHH. MMAAIILL If the value is set to a file or directory name and the MMAAIILLPPAATTHH - variable is not set, bbaasshh informs the user of the arrival of + variable is not set, bbaasshh informs the user of the arrival of mail in the specified file or Maildir-format directory. MMAAIILLCCHHEECCKK - Specifies how often (in seconds) bbaasshh checks for mail. The de- - fault is 60 seconds. When it is time to check for mail, the - shell does so before displaying the primary prompt. If this - variable is unset, or set to a value that is not a number + Specifies how often (in seconds) bbaasshh checks for mail. The de- + fault is 60 seconds. When it is time to check for mail, the + shell does so before displaying the primary prompt. If this + variable is unset, or set to a value that is not a number greater than or equal to zero, the shell disables mail checking. MMAAIILLPPAATTHH A colon-separated list of filenames to be checked for mail. The message to be printed when mail arrives in a particular file may - be specified by separating the filename from the message with a - "?". When used in the text of the message, $$__ expands to the + be specified by separating the filename from the message with a + "?". When used in the text of the message, $$__ expands to the name of the current mailfile. For example: MMAAIILLPPAATTHH='/var/mail/bfox?"You have mail":~/shell-mail?"$_ has mail!"' - BBaasshh can be configured to supply a default value for this vari- - able (there is no value by default), but the location of the + BBaasshh can be configured to supply a default value for this vari- + able (there is no value by default), but the location of the user mail files that it uses is system dependent (e.g., /var/mail/$$UUSSEERR). OOPPTTEERRRR If set to the value 1, bbaasshh displays error messages generated by - the ggeettooppttss builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). - OOPPTTEERRRR is initialized to 1 each time the shell is invoked or a + the ggeettooppttss builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). + OOPPTTEERRRR is initialized to 1 each time the shell is invoked or a shell script is executed. - PPAATTHH The search path for commands. It is a colon-separated list of - directories in which the shell looks for commands (see CCOOMMMMAANNDD - EEXXEECCUUTTIIOONN below). A zero-length (null) directory name in the + PPAATTHH The search path for commands. It is a colon-separated list of + directories in which the shell looks for commands (see CCOOMMMMAANNDD + EEXXEECCUUTTIIOONN below). A zero-length (null) directory name in the value of PPAATTHH indicates the current directory. A null directory - name may appear as two adjacent colons, or as an initial or - trailing colon. The default path is system-dependent, and is + name may appear as two adjacent colons, or as an initial or + trailing colon. The default path is system-dependent, and is set by the administrator who installs bbaasshh. A common value is /usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin PPOOSSIIXXLLYY__CCOORRRREECCTT - If this variable is in the environment when bbaasshh starts, the - shell enters posix mode before reading the startup files, as if - the ----ppoossiixx invocation option had been supplied. If it is set - while the shell is running, bbaasshh enables posix mode, as if the + If this variable is in the environment when bbaasshh starts, the + shell enters posix mode before reading the startup files, as if + the ----ppoossiixx invocation option had been supplied. If it is set + while the shell is running, bbaasshh enables posix mode, as if the command "set -o posix" had been executed. When the shell enters posix mode, it sets this variable if it was not already set. PPRROOMMPPTT__CCOOMMMMAANNDD - If this variable is set, and is an array, the value of each set - element is executed as a command prior to issuing each primary - prompt. If this is set but not an array variable, its value is + If this variable is set, and is an array, the value of each set + element is executed as a command prior to issuing each primary + prompt. If this is set but not an array variable, its value is used as a command to execute instead. PPRROOMMPPTT__DDIIRRTTRRIIMM - If set to a number greater than zero, the value is used as the + If set to a number greater than zero, the value is used as the number of trailing directory components to retain when expanding - the \\ww and \\WW prompt string escapes (see PPRROOMMPPTTIINNGG below). + the \\ww and \\WW prompt string escapes (see PPRROOMMPPTTIINNGG below). Characters removed are replaced with an ellipsis. - PPSS00 The value of this parameter is expanded (see PPRROOMMPPTTIINNGG below) - and displayed by interactive shells after reading a command and + PPSS00 The value of this parameter is expanded (see PPRROOMMPPTTIINNGG below) + and displayed by interactive shells after reading a command and before the command is executed. - PPSS11 The value of this parameter is expanded (see PPRROOMMPPTTIINNGG below) - and used as the primary prompt string. The default value is + PPSS11 The value of this parameter is expanded (see PPRROOMMPPTTIINNGG below) + and used as the primary prompt string. The default value is "\s-\v\$ ". - PPSS22 The value of this parameter is expanded as with PPSS11 and used as + PPSS22 The value of this parameter is expanded as with PPSS11 and used as the secondary prompt string. The default is "> ". PPSS33 The value of this parameter is used as the prompt for the sseelleecctt command (see SSHHEELLLL GGRRAAMMMMAARR above). - PPSS44 The value of this parameter is expanded as with PPSS11 and the + PPSS44 The value of this parameter is expanded as with PPSS11 and the value is printed before each command bbaasshh displays during an ex- ecution trace. The first character of the expanded value of PPSS44 is replicated multiple times, as necessary, to indicate multiple levels of indirection. The default is "+ ". - SSHHEELLLL This variable expands to the full pathname to the shell. If it - is not set when the shell starts, bbaasshh assigns to it the full + SSHHEELLLL This variable expands to the full pathname to the shell. If it + is not set when the shell starts, bbaasshh assigns to it the full pathname of the current user's login shell. TTIIMMEEFFOORRMMAATT - The value of this parameter is used as a format string specify- - ing how the timing information for pipelines prefixed with the - ttiimmee reserved word should be displayed. The %% character intro- - duces an escape sequence that is expanded to a time value or - other information. The escape sequences and their meanings are + The value of this parameter is used as a format string specify- + ing how the timing information for pipelines prefixed with the + ttiimmee reserved word should be displayed. The %% character intro- + duces an escape sequence that is expanded to a time value or + other information. The escape sequences and their meanings are as follows; the brackets denote optional portions. %%%% A literal %%. %%[[_p]][[ll]]RR The elapsed time in seconds. @@ -1525,79 +1526,79 @@ PPAARRAAMMEETTEERRSS %%[[_p]][[ll]]SS The number of CPU seconds spent in system mode. %%PP The CPU percentage, computed as (%U + %S) / %R. - The optional _p is a digit specifying the _p_r_e_c_i_s_i_o_n, the number + The optional _p is a digit specifying the _p_r_e_c_i_s_i_o_n, the number of fractional digits after a decimal point. A value of 0 causes - no decimal point or fraction to be output. ttiimmee prints at most - six digits after the decimal point; values of _p greater than 6 + no decimal point or fraction to be output. ttiimmee prints at most + six digits after the decimal point; values of _p greater than 6 are changed to 6. If _p is not specified, ttiimmee prints three dig- its after the decimal point. - The optional ll specifies a longer format, including minutes, of - the form _M_Mm_S_S._F_Fs. The value of _p determines whether or not + The optional ll specifies a longer format, including minutes, of + the form _M_Mm_S_S._F_Fs. The value of _p determines whether or not the fraction is included. - If this variable is not set, bbaasshh acts as if it had the value - $$''\\nnrreeaall\\tt%%33llRR\\nnuusseerr\\tt%%33llUU\\nnssyyss\\tt%%33llSS''. If the value is null, - bbaasshh does not display any timing information. A trailing new- + If this variable is not set, bbaasshh acts as if it had the value + $$''\\nnrreeaall\\tt%%33llRR\\nnuusseerr\\tt%%33llUU\\nnssyyss\\tt%%33llSS''. If the value is null, + bbaasshh does not display any timing information. A trailing new- line is added when the format string is displayed. - TTMMOOUUTT If set to a value greater than zero, the rreeaadd builtin uses the - value as its default timeout. The sseelleecctt command terminates if - input does not arrive after TTMMOOUUTT seconds when input is coming - from a terminal. In an interactive shell, the value is inter- - preted as the number of seconds to wait for a line of input af- - ter issuing the primary prompt. BBaasshh terminates after waiting - for that number of seconds if a complete line of input does not + TTMMOOUUTT If set to a value greater than zero, the rreeaadd builtin uses the + value as its default timeout. The sseelleecctt command terminates if + input does not arrive after TTMMOOUUTT seconds when input is coming + from a terminal. In an interactive shell, the value is inter- + preted as the number of seconds to wait for a line of input af- + ter issuing the primary prompt. BBaasshh terminates after waiting + for that number of seconds if a complete line of input does not arrive. - TTMMPPDDIIRR If set, bbaasshh uses its value as the name of a directory in which + TTMMPPDDIIRR If set, bbaasshh uses its value as the name of a directory in which bbaasshh creates temporary files for the shell's use. aauuttoo__rreessuummee This variable controls how the shell interacts with the user and - job control. If this variable is set, simple commands consist- - ing of only a single word, without redirections, are treated as - candidates for resumption of an existing stopped job. There is - no ambiguity allowed; if there is more than one job beginning - with or containing the word, this selects the most recently ac- - cessed job. The _n_a_m_e of a stopped job, in this context, is the - command line used to start it, as displayed by jjoobbss. If set to - the value _e_x_a_c_t, the word must match the name of a stopped job - exactly; if set to _s_u_b_s_t_r_i_n_g, the word needs to match a sub- - string of the name of a stopped job. The _s_u_b_s_t_r_i_n_g value pro- + job control. If this variable is set, simple commands consist- + ing of only a single word, without redirections, are treated as + candidates for resumption of an existing stopped job. There is + no ambiguity allowed; if there is more than one job beginning + with or containing the word, this selects the most recently ac- + cessed job. The _n_a_m_e of a stopped job, in this context, is the + command line used to start it, as displayed by jjoobbss. If set to + the value _e_x_a_c_t, the word must match the name of a stopped job + exactly; if set to _s_u_b_s_t_r_i_n_g, the word needs to match a sub- + string of the name of a stopped job. The _s_u_b_s_t_r_i_n_g value pro- vides functionality analogous to the %%?? job identifier (see JJOOBB - CCOONNTTRROOLL below). If set to any other value (e.g., _p_r_e_f_i_x), the - word must be a prefix of a stopped job's name; this provides + CCOONNTTRROOLL below). If set to any other value (e.g., _p_r_e_f_i_x), the + word must be a prefix of a stopped job's name; this provides functionality analogous to the %%_s_t_r_i_n_g job identifier. hhiissttcchhaarrss - The two or three characters which control history expansion, - quick substitution, and tokenization (see HHIISSTTOORRYY EEXXPPAANNSSIIOONN be- - low). The first character is the _h_i_s_t_o_r_y _e_x_p_a_n_s_i_o_n character, - the character which begins a history expansion, normally "!!". - The second character is the _q_u_i_c_k _s_u_b_s_t_i_t_u_t_i_o_n character, nor- - mally "^^". When it appears as the first character on the line, + The two or three characters which control history expansion, + quick substitution, and tokenization (see HHIISSTTOORRYY EEXXPPAANNSSIIOONN be- + low). The first character is the _h_i_s_t_o_r_y _e_x_p_a_n_s_i_o_n character, + the character which begins a history expansion, normally "!!". + The second character is the _q_u_i_c_k _s_u_b_s_t_i_t_u_t_i_o_n character, nor- + mally "^^". When it appears as the first character on the line, history substitution repeats the previous command, replacing one - string with another. The optional third character is the _h_i_s_- - _t_o_r_y _c_o_m_m_e_n_t character, normally "##", which indicates that the - remainder of the line is a comment when it appears as the first - character of a word. The history comment character disables - history substitution for the remaining words on the line. It + string with another. The optional third character is the _h_i_s_- + _t_o_r_y _c_o_m_m_e_n_t character, normally "##", which indicates that the + remainder of the line is a comment when it appears as the first + character of a word. The history comment character disables + history substitution for the remaining words on the line. It does not necessarily cause the shell parser to treat the rest of the line as a comment. AArrrraayyss - BBaasshh provides one-dimensional indexed and associative array variables. - Any variable may be used as an indexed array; the ddeeccllaarree builtin ex- - plicitly declares an array. There is no maximum limit on the size of - an array, nor any requirement that members be indexed or assigned con- - tiguously. Indexed arrays are referenced using arithmetic expressions - that must expand to an integer (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN below) and - are zero-based; associative arrays are referenced using arbitrary - strings. Unless otherwise noted, indexed array indices must be non- + BBaasshh provides one-dimensional indexed and associative array variables. + Any variable may be used as an indexed array; the ddeeccllaarree builtin ex- + plicitly declares an array. There is no maximum limit on the size of + an array, nor any requirement that members be indexed or assigned con- + tiguously. Indexed arrays are referenced using arithmetic expressions + that must expand to an integer (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN below) and + are zero-based; associative arrays are referenced using arbitrary + strings. Unless otherwise noted, indexed array indices must be non- negative integers. - An indexed array is created automatically if any variable is assigned + An indexed array is created automatically if any variable is assigned to using the syntax _n_a_m_e[_s_u_b_s_c_r_i_p_t]=_v_a_l_u_e . The _s_u_b_s_c_r_i_p_t is treated as an arithmetic expression that must evaluate - to a number greater than or equal to zero. To explicitly declare an + to a number greater than or equal to zero. To explicitly declare an indexed array, use ddeeccllaarree --aa _n_a_m_e (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). @@ -1612,103 +1613,103 @@ PPAARRAAMMEETTEERRSS rreeaaddoonnllyy builtins. Each attribute applies to all members of an array. Arrays are assigned using compound assignments of the form _n_a_m_e=((value_1 - ... value_n)), where each _v_a_l_u_e may be of the form [_s_u_b_s_c_r_i_p_t]=_s_t_r_i_n_g. - Indexed array assignments do not require anything but _s_t_r_i_n_g. Each - _v_a_l_u_e in the list is expanded using the shell expansions described be- + ... value_n)), where each _v_a_l_u_e may be of the form [_s_u_b_s_c_r_i_p_t]=_s_t_r_i_n_g. + Indexed array assignments do not require anything but _s_t_r_i_n_g. Each + _v_a_l_u_e in the list is expanded using the shell expansions described be- low under EEXXPPAANNSSIIOONN, but _v_a_l_u_es that are valid variable assignments in- - cluding the brackets and subscript do not undergo brace expansion and + cluding the brackets and subscript do not undergo brace expansion and word splitting, as with individual variable assignments. - When assigning to indexed arrays, if the optional brackets and sub- - script are supplied, that index is assigned to; otherwise the index of - the element assigned is the last index assigned to by the statement + When assigning to indexed arrays, if the optional brackets and sub- + script are supplied, that index is assigned to; otherwise the index of + the element assigned is the last index assigned to by the statement plus one. Indexing starts at zero. When assigning to an associative array, the words in a compound assign- - ment may be either assignment statements, for which the subscript is - required, or a list of words that is interpreted as a sequence of al- - ternating keys and values: _n_a_m_e=(( _k_e_y_1 _v_a_l_u_e_1 _k_e_y_2 _v_a_l_u_e_2 ...)). These - are treated identically to _n_a_m_e=(( [_k_e_y_1]=_v_a_l_u_e_1 [_k_e_y_2]=_v_a_l_u_e_2 ...)). - The first word in the list determines how the remaining words are in- - terpreted; all assignments in a list must be of the same type. When - using key/value pairs, the keys may not be missing or empty; a final + ment may be either assignment statements, for which the subscript is + required, or a list of words that is interpreted as a sequence of al- + ternating keys and values: _n_a_m_e=(( _k_e_y_1 _v_a_l_u_e_1 _k_e_y_2 _v_a_l_u_e_2 ...)). These + are treated identically to _n_a_m_e=(( [_k_e_y_1]=_v_a_l_u_e_1 [_k_e_y_2]=_v_a_l_u_e_2 ...)). + The first word in the list determines how the remaining words are in- + terpreted; all assignments in a list must be of the same type. When + using key/value pairs, the keys may not be missing or empty; a final missing value is treated like the empty string. - This syntax is also accepted by the ddeeccllaarree builtin. Individual array - elements may be assigned to using the _n_a_m_e[_s_u_b_s_c_r_i_p_t]=_v_a_l_u_e syntax in- + This syntax is also accepted by the ddeeccllaarree builtin. Individual array + elements may be assigned to using the _n_a_m_e[_s_u_b_s_c_r_i_p_t]=_v_a_l_u_e syntax in- troduced above. - When assigning to an indexed array, if _n_a_m_e is subscripted by a nega- + When assigning to an indexed array, if _n_a_m_e is subscripted by a nega- tive number, that number is interpreted as relative to one greater than - the maximum index of _n_a_m_e, so negative indices count back from the end + the maximum index of _n_a_m_e, so negative indices count back from the end of the array, and an index of -1 references the last element. The "+=" operator appends to an array variable when assigning using the compound assignment syntax; see PPAARRAAMMEETTEERRSS above. - An array element is 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 + An array element is 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, unless noted in the - description of a builtin or word expansion. These subscripts differ - only when the word appears within double quotes. If the word is dou- - ble-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 special vari- - able, and ${_n_a_m_e[@]} expands each element of _n_a_m_e to a separate word. + description of a builtin or word expansion. These subscripts differ + only when the word appears within double quotes. If the word is dou- + ble-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 special vari- + able, and ${_n_a_m_e[@]} expands each element of _n_a_m_e to a separate word. When there are no array members, ${_n_a_m_e[@]} expands to nothing. If the - double-quoted expansion occurs within a word, the expansion of the - first parameter is joined with the beginning part of the expansion of - the original word, and the expansion of the last parameter is joined - with the last part of the expansion of the original word. This is - analogous to the expansion of the special parameters ** and @@ (see SSppee-- + double-quoted expansion occurs within a word, the expansion of the + first parameter is joined with the beginning part of the expansion of + the original word, and the expansion of the last parameter is joined + with the last part of the expansion of the original word. This is + analogous to the expansion of the special parameters ** and @@ (see SSppee-- cciiaall 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 + ${#_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 eval- - uates 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 + uates 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 valid; bbaasshh creates an array if necessary. - 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] un- - sets 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- - moves the entire array. uunnsseett _n_a_m_e[_s_u_b_s_c_r_i_p_t] behaves differently de- - pending on whether _n_a_m_e is an indexed or associative array when _s_u_b_- + sets 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- + moves the entire array. uunnsseett _n_a_m_e[_s_u_b_s_c_r_i_p_t] behaves differently de- + pending on whether _n_a_m_e is an indexed or associative array when _s_u_b_- _s_c_r_i_p_t is ** or @@. If _n_a_m_e is an associative array, this unsets the el- - ement with subscript ** or @@. If _n_a_m_e is an indexed array, unset re- + ement with subscript ** or @@. If _n_a_m_e is an indexed array, unset re- moves 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- - scribed above, (e.g., unset a[4]), the argument is subject to pathname - expansion. Quote the argument if pathname expansion is not desired + 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, (e.g., unset a[4]), the argument is subject to pathname + expansion. Quote the argument if pathname expansion is not desired (e.g., unset 'a[4]'). - 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. Other - builtins accept array name arguments as well (e.g., mmaappffiillee); see the - descriptions of individual builtins below for details. The shell pro- + values in a way that allows them to be reused as assignments. Other + builtins accept array name arguments as well (e.g., mmaappffiillee); see the + descriptions of individual builtins below for details. The shell pro- vides a number of builtin array variables. EEXXPPAANNSSIIOONN @@ -1718,64 +1719,64 @@ EEXXPPAANNSSIIOONN _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, _p_a_t_h_n_a_m_e _e_x_p_a_n_s_i_o_n, and _q_u_o_t_e _r_e_m_o_v_a_l. 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; pathname expansion; + and variable expansion, arithmetic expansion, and command substitution + (done in a left-to-right fashion); word splitting; pathname expansion; and quote removal. 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. - _Q_u_o_t_e _r_e_m_o_v_a_l is always performed last. It removes quote characters - present in the original word, not ones resulting from one of the other + _Q_u_o_t_e _r_e_m_o_v_a_l is always performed last. It removes quote characters + present in the original word, not ones resulting from one of the other expansions, unless they have been quoted themselves. - 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 to generate arbitrary strings sharing a + _B_r_a_c_e _e_x_p_a_n_s_i_o_n is a mechanism to generate arbitrary strings sharing a common prefix and suffix, either of which can be empty. This mechanism - is similar to _p_a_t_h_n_a_m_e _e_x_p_a_n_s_i_o_n, but the filenames generated need not - exist. Patterns to be brace expanded are formed from an optional _p_r_e_- - _a_m_b_l_e, followed by either a series of comma-separated strings or a se- - quence expression between a pair of braces, followed 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 + is similar to _p_a_t_h_n_a_m_e _e_x_p_a_n_s_i_o_n, but the filenames generated need not + exist. Patterns to be brace expanded are formed from an optional _p_r_e_- + _a_m_b_l_e, followed by either a series of comma-separated strings or a se- + quence expression between a pair of braces, followed 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 + Brace expansions may be nested. The results of each expanded string are not sorted; brace expansion preserves left to right order. For ex- ample, 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. If either _x or _y begins with a + number between _x and _y, inclusive. If either _x or _y begins with a zero, each generated term will contain the same number of digits, zero- padding where necessary. When letters are supplied, the expression ex- - pands to each character lexicographically between _x and _y, inclusive, + pands to each character lexicographically 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 + 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 Q , may be quoted with a backslash to prevent its being con- - sidered part of a brace expression. To avoid conflicts with parameter - expansion, the string "${" is not considered eligible for brace expan- + A "{" or Q , may be quoted with a backslash to prevent its being con- + sidered part of a brace expression. To avoid conflicts with parameter + expansion, the string "${" is not considered eligible for brace expan- sion, and inhibits brace expansion until the closing "}". This construct is typically used as shorthand when the common prefix of @@ -1785,67 +1786,67 @@ 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. + 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 "file{1,2}" appears identically in the output. BBaasshh outputs that word as "file1 file2" after brace expan- - sion. Start bbaasshh with the ++BB option or disable brace expansion with + sion. Start bbaasshh with the ++BB option or disable brace expansion with the ++BB option to the sseett command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) for strict sshh compatibility. 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 + 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 tilde expands - to the home directory of the user executing the shell instead. Other- - wise, the tilde-prefix is replaced with the home directory associated + to the home directory of the user executing the shell 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- + 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 shell sub- - stitutes the value of the shell variable OOLLDDPPWWDD, if it is set. If the - characters following the tilde in the tilde-prefix consist of a number - _N, optionally prefixed by a "+" or a "-", the tilde-prefix is replaced + stitutes the value of the shell variable OOLLDDPPWWDD, if it is set. If the + characters 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 characters following the - tilde in the tilde-prefix as an argument. If the characters following + tilde in the tilde-prefix as an argument. If the characters following the tilde in the tilde-prefix consist of a number without a leading "+" or "-", tilde expansion assumes "+". - The results of tilde expansion are treated as if they were quoted, so - the replacement is not subject to word splitting and pathname expan- + The results of tilde expansion are treated as if they were quoted, so + the replacement is not subject to word splitting and pathname expan- sion. - If the login name is invalid, or the tilde expansion fails, the tilde- + If the login name is invalid, or the tilde expansion fails, the tilde- prefix is unchanged. - BBaasshh checks each variable assignment for unquoted tilde-prefixes imme- - diately following a :: or the first ==, and performs tilde expansion in - these cases. Consequently, one may use filenames with tildes in as- - signments to PPAATTHH, MMAAIILLPPAATTHH, and CCDDPPAATTHH, and the shell assigns the ex- + BBaasshh checks each variable assignment for unquoted tilde-prefixes imme- + diately following a :: or the first ==, and performs tilde expansion in + these cases. Consequently, one may use filenames with tildes in as- + signments to PPAATTHH, MMAAIILLPPAATTHH, and CCDDPPAATTHH, and the shell assigns the ex- panded value. - BBaasshh also performs tilde expansion on words satisfying the conditions + BBaasshh 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. BBaasshh does not do this, except + appear as arguments to simple commands. BBaasshh does not do this, except for the _d_e_c_l_a_r_a_t_i_o_n commands listed above, when in posix mode. 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. The basic form of parameter expansion is @@ -1853,124 +1854,124 @@ EEXXPPAANNSSIIOONN ${_p_a_r_a_m_e_t_e_r} which substitutes the value of _p_a_r_a_m_e_t_e_r. 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 + _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 (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 new parameter 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 expansion, parameter expansion, command substitution, and - arithmetic expansion. If _p_a_r_a_m_e_t_e_r is a nameref, this expands to the + _r_a_m_e_t_e_r; this new parameter 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 expansion, parameter expansion, command substitution, and + arithmetic expansion. 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, for compatibility. 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 + exclamation point must immediately follow the left brace in order to introduce indirection. 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. + low (e.g., ::--), bbaasshh tests for a parameter that is unset or null. Omitting the colon tests only for a parameter that is unset. ${_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, and the expansion is + 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, and the expansion is the final value of _p_a_r_a_m_e_t_e_r. Positional parameters and special parameters may not be assigned 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, + DDiissppllaayy EErrrroorr iiff NNuullll oorr UUnnsseett. If _p_a_r_a_m_e_t_e_r is null or unset, the shell writes the expansion of _w_o_r_d (or a message to that ef- fect if _w_o_r_d is not present) to the standard error and, if it is - not interactive, exits with a non-zero status. An interactive + not interactive, exits with a non-zero status. An interactive shell does not exit, but does not execute the command associated - with the expansion. Otherwise, the value of _p_a_r_a_m_e_t_e_r is sub- + with the expansion. Otherwise, the value of _p_a_r_a_m_e_t_e_r is sub- stituted. ${_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 - substituted, otherwise the expansion of _w_o_r_d is substituted. + 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. The value of _p_a_r_a_m_e_t_e_r is not used. ${_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 @@ 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 + 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 @@ 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 + 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 (or 0 if - there are no positional parameters). It is an expansion error + there are no positional parameters). 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_r_a_- - _m_e_t_e_r[_o_f_f_s_e_t]}. A negative _o_f_f_s_e_t is taken relative to one + _m_e_t_e_r[_o_f_f_s_e_t]}. A negative _o_f_f_s_e_t is taken relative to one greater than the maximum index of the specified array. It is an expansion error if _l_e_n_g_t_h evaluates to a number less than zero. Substring expansion applied to an associative array produces un- defined results. - Substring indexing is zero-based unless the positional parame- - ters are used, in which case the indexing starts at 1 by de- - fault. If _o_f_f_s_e_t is 0, and the positional parameters are used, + Substring indexing is zero-based unless the positional parame- + ters are used, in which case the indexing starts at 1 by de- + fault. If _o_f_f_s_e_t is 0, and the positional parameters are used, $$00 is prefixed to the list. ${!!_p_r_e_f_i_x**} ${!!_p_r_e_f_i_x@@} - NNaammeess mmaattcchhiinngg pprreeffiixx. Expands to the names of variables whose + NNaammeess mmaattcchhiinngg pprreeffiixx. Expands to the names of variables whose names begin with _p_r_e_f_i_x, separated by the first character of the - IIFFSS special variable. When _@ is used and the expansion appears - within double quotes, each variable name expands to a separate + IIFFSS special variable. When _@ is used and the expansion appears + within double quotes, each variable name expands to a separate word. ${!!_n_a_m_e[_@]} ${!!_n_a_m_e[_*]} - LLiisstt ooff aarrrraayy kkeeyyss. If _n_a_m_e is an array variable, expands to - the list of array indices (keys) assigned in _n_a_m_e. If _n_a_m_e is - not an array, expands to 0 if _n_a_m_e is set and null otherwise. - When _@ is used and the expansion appears within double quotes, + LLiisstt ooff aarrrraayy kkeeyyss. If _n_a_m_e is an array variable, expands to + the list of array indices (keys) assigned in _n_a_m_e. If _n_a_m_e is + not an array, expands to 0 if _n_a_m_e is set and null otherwise. + When _@ is used and the expansion appears within double quotes, each key expands to a separate word. ${##_p_a_r_a_m_e_t_e_r} - PPaarraammeetteerr lleennggtthh. Substitutes the length in characters of the - expanded value of _p_a_r_a_m_e_t_e_r. If _p_a_r_a_m_e_t_e_r is ** or @@, the value - substituted is the number of positional parameters. If _p_a_r_a_m_e_- - _t_e_r is an array name subscripted by ** or @@, the value substi- - tuted is the number of elements in the array. If _p_a_r_a_m_e_t_e_r is - an indexed array name subscripted by a negative number, that - number is interpreted as relative to one greater than the maxi- - mum index of _p_a_r_a_m_e_t_e_r, so negative indices count back from the - end of the array, and an index of -1 references the last ele- + PPaarraammeetteerr lleennggtthh. Substitutes the length in characters of the + expanded value of _p_a_r_a_m_e_t_e_r. If _p_a_r_a_m_e_t_e_r is ** or @@, the value + substituted is the number of positional parameters. If _p_a_r_a_m_e_- + _t_e_r is an array name subscripted by ** or @@, the value substi- + tuted is the number of elements in the array. If _p_a_r_a_m_e_t_e_r is + an indexed array name subscripted by a negative number, that + number is interpreted as relative to one greater than the maxi- + mum index of _p_a_r_a_m_e_t_e_r, so negative indices count back from the + end of the array, and an index of -1 references the last ele- ment. ${_p_a_r_a_m_e_t_e_r##_w_o_r_d} @@ -1978,15 +1979,15 @@ EEXXPPAANNSSIIOONN RReemmoovvee mmaattcchhiinngg pprreeffiixx ppaatttteerrnn. The _w_o_r_d is expanded to produce a pattern just as in pathname expansion, and matched against the expanded value of _p_a_r_a_m_e_t_e_r using the rules described under PPaatt-- - tteerrnn MMaattcchhiinngg below. If the pattern matches the beginning of - the value of _p_a_r_a_m_e_t_e_r, then the result of the expansion is the - expanded value of _p_a_r_a_m_e_t_e_r with the shortest matching pattern - (the "#" case) or the longest matching pattern (the "##" case) - deleted. If _p_a_r_a_m_e_t_e_r is @@ or **, the pattern removal operation - is applied to each positional parameter in turn, and the expan- - sion is the resultant list. If _p_a_r_a_m_e_t_e_r is an array variable - subscripted with @@ or **, the pattern removal operation is ap- - plied to each member of the array in turn, and the expansion is + tteerrnn MMaattcchhiinngg below. If the pattern matches the beginning of + the value of _p_a_r_a_m_e_t_e_r, then the result of the expansion is the + expanded value of _p_a_r_a_m_e_t_e_r with the shortest matching pattern + (the "#" case) or the longest matching pattern (the "##" case) + deleted. If _p_a_r_a_m_e_t_e_r is @@ or **, the pattern removal operation + is applied to each positional parameter in turn, and the expan- + sion is the resultant list. If _p_a_r_a_m_e_t_e_r is an array variable + subscripted with @@ or **, the pattern removal operation is ap- + plied to each member of the array in turn, and the expansion is the resultant list. ${_p_a_r_a_m_e_t_e_r%%_w_o_r_d} @@ -1994,15 +1995,15 @@ EEXXPPAANNSSIIOONN RReemmoovvee mmaattcchhiinngg ssuuffffiixx ppaatttteerrnn. The _w_o_r_d is expanded to produce a pattern just as in pathname expansion, and matched against the expanded value of _p_a_r_a_m_e_t_e_r using the rules described under PPaatt-- - tteerrnn MMaattcchhiinngg below. If the pattern matches a trailing portion - of the expanded value of _p_a_r_a_m_e_t_e_r, then the result of the ex- - pansion is the expanded value of _p_a_r_a_m_e_t_e_r with the shortest - matching pattern (the "%" case) or the longest matching pattern - (the "%%" case) deleted. If _p_a_r_a_m_e_t_e_r is @@ or **, the pattern - removal operation is applied to each positional parameter in - turn, and the expansion is the resultant list. If _p_a_r_a_m_e_t_e_r is - an array variable subscripted with @@ or **, the pattern removal - operation is applied to each member of the array in turn, and + tteerrnn MMaattcchhiinngg below. If the pattern matches a trailing portion + of the expanded value of _p_a_r_a_m_e_t_e_r, then the result of the ex- + pansion is the expanded value of _p_a_r_a_m_e_t_e_r with the shortest + matching pattern (the "%" case) or the longest matching pattern + (the "%%" case) deleted. If _p_a_r_a_m_e_t_e_r is @@ or **, the pattern + removal operation is applied to each positional parameter in + turn, and the expansion is the resultant list. If _p_a_r_a_m_e_t_e_r is + an array variable subscripted with @@ or **, the pattern removal + operation is applied to each member of the array in turn, and the expansion is the resultant list. ${_p_a_r_a_m_e_t_e_r//_p_a_t_t_e_r_n//_s_t_r_i_n_g} @@ -2010,12 +2011,12 @@ EEXXPPAANNSSIIOONN ${_p_a_r_a_m_e_t_e_r//##_p_a_t_t_e_r_n//_s_t_r_i_n_g} ${_p_a_r_a_m_e_t_e_r//%%_p_a_t_t_e_r_n//_s_t_r_i_n_g} PPaatttteerrnn ssuubbssttiittuuttiioonn. The _p_a_t_t_e_r_n is expanded to produce a pat- - tern just as in pathname expansion and matched against the ex- - panded value of _p_a_r_a_m_e_t_e_r using the rules described under PPaatt-- - tteerrnn MMaattcchhiinngg below. The longest match of _p_a_t_t_e_r_n in the ex- - panded value is replaced with _s_t_r_i_n_g. _s_t_r_i_n_g undergoes tilde - expansion, parameter and variable expansion, arithmetic expan- - sion, command and process substitution, and quote removal. + tern and matched against the expanded value of _p_a_r_a_m_e_t_e_r as de- + scribed under PPaatttteerrnn MMaattcchhiinngg below. The longest match of _p_a_t_- + _t_e_r_n in the expanded value is replaced with _s_t_r_i_n_g. _s_t_r_i_n_g un- + dergoes tilde expansion, parameter and variable expansion, + arithmetic expansion, command and process substitution, and + quote removal. In the first form above, only the first match is replaced. If there are two slashes separating _p_a_r_a_m_e_t_e_r and _p_a_t_t_e_r_n (the sec- @@ -2067,19 +2068,20 @@ EEXXPPAANNSSIIOONN ${_p_a_r_a_m_e_t_e_r,,_p_a_t_t_e_r_n} ${_p_a_r_a_m_e_t_e_r,,,,_p_a_t_t_e_r_n} CCaassee mmooddiiffiiccaattiioonn. This expansion modifies the case of alpha- - betic characters in _p_a_r_a_m_e_t_e_r. The _p_a_t_t_e_r_n is expanded to pro- - duce a pattern just as in pathname expansion. Each character in - the expanded value of _p_a_r_a_m_e_t_e_r is tested against _p_a_t_t_e_r_n, and, - if it matches the pattern, its case is converted. The pattern - should not attempt to match more than one character. - - The ^^ operator converts lowercase letters matching _p_a_t_t_e_r_n to - uppercase; the ,, operator converts matching uppercase letters to - lowercase. The ^^^^ and ,,,, expansions convert each matched char- - acter in the expanded value; the ^^ and ,, expansions match and - convert only the first character in the expanded value. If _p_a_t_- - _t_e_r_n is omitted, it is treated like a ??, which matches every - character. + betic characters in _p_a_r_a_m_e_t_e_r. First, the _p_a_t_t_e_r_n is expanded + to produce a pattern as described below under PPaatttteerrnn MMaattcchhiinngg. + BBaasshh then examines characters in the expanded value of _p_a_r_a_m_e_t_e_r + against _p_a_t_t_e_r_n as described below. If a character matches the + pattern, its case is converted. The pattern should not attempt + to match more than one character. + + Using "^" converts lowercase letters matching _p_a_t_t_e_r_n to upper- + case; "," converts matching uppercase letters to lowercase. The + ^^ and ,, variants examine the first character in the expanded + value and convert its case if it matches _p_a_t_t_e_r_n; the ^^^^ and ,,,, + variants examine all characters in the expanded value and con- + vert each one that matches _p_a_t_t_e_r_n. If _p_a_t_t_e_r_n is omitted, it + is treated like a ??, which matches every character. If _p_a_r_a_m_e_t_e_r is @@ or **, the case modification operation is ap- plied to each positional parameter in turn, and the expansion is @@ -6627,7 +6629,6 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS ccoommppaatt4422 ccoommppaatt4433 ccoommppaatt4444 - ccoommppaatt5500 These control aspects of the shell's compatibility mode (see SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE below). ccoommpplleettee__ffuullllqquuoottee @@ -7359,8 +7360,8 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL +o Importing function definitions from the shell environment at startup. - +o Parsing the value of SSHHEELLLLOOPPTTSS from the shell environment at - startup. + +o Parsing the values of BBAASSHHOOPPTTSS and SSHHEELLLLOOPPTTSS from the shell en- + vironment at startup. +o Redirecting output using the >, >|, <>, >&, &>, and >> redirec- tion operators. diff --git a/doc/bash.1 b/doc/bash.1 index a38d27f7..7061d59b 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -3873,10 +3873,9 @@ ${\fIparameter\fP\fB/#\fP\fIpattern\fP\fB/\fP\fIstring\fP} ${\fIparameter\fP\fB/%\fP\fIpattern\fP\fB/\fP\fIstring\fP} .PD \fBPattern substitution\fP. -The \fIpattern\fP is expanded to produce a pattern just as in -pathname expansion and matched against the expanded value of -\fIparameter\fP -using the rules described under +The \fIpattern\fP is expanded to produce a pattern +and matched against the expanded value of \fIparameter\fP +as described under .B "Pattern Matching" below. The longest match of \fIpattern\fP @@ -3956,18 +3955,29 @@ ${\fIparameter\fP\fB,,\fP\fIpattern\fP} .PD \fBCase modification\fP. This expansion modifies the case of alphabetic characters in \fIparameter\fP. -The \fIpattern\fP is expanded to produce a pattern just as in -pathname expansion. -Each character in the expanded value of \fIparameter\fP is tested against -\fIpattern\fP, and, if it matches the pattern, its case is converted. +First, the \fIpattern\fP is expanded to produce a pattern +as described below under +.SM +.BR "Pattern Matching" . +.B Bash +then examines characters in the expanded value of \fIparameter\fP +against \fIpattern\fP as described below. +If a character matches the pattern, its case is converted. The pattern should not attempt to match more than one character. .IP -The \fB\*^\fP operator converts lowercase letters matching \fIpattern\fP -to uppercase; the \fB,\fP operator converts matching uppercase letters -to lowercase. -The \fB\*^\*^\fP and \fB,,\fP expansions convert each matched character in the -expanded value; the \fB\*^\fP and \fB,\fP expansions match and convert only -the first character in the expanded value. +Using +.Q \*^ +converts lowercase letters matching \fIpattern\fP to uppercase; +.Q , +converts matching uppercase letters to lowercase. +The +\fB\*^\fP and \fB,\fP variants +examine the first character in the expanded value +and convert its case if it matches \fIpattern\fP; +the +\fB\*^\*^\fP and \fB,,\fP variants +examine all characters in the expanded value +and convert each one that matches \fIpattern\fP. If \fIpattern\fP is omitted, it is treated like a \fB?\fP, which matches every character. .IP @@ -4426,7 +4436,7 @@ shell variable controls how the results of pathname expansion are sorted, as described above under .BR "Shell Variables" . .PP -\fBPattern Matching\fP +.B "Pattern Matching" .PP Any character that appears in a pattern, other than the special pattern characters described below, matches itself. @@ -11873,8 +11883,6 @@ under .B compat43 .TP 8 .B compat44 -.TP 8 -.B compat50 .PD These control aspects of the shell's compatibility mode (see diff --git a/doc/bash.info b/doc/bash.info index 11bcc903..0d43c0f6 100644 --- a/doc/bash.info +++ b/doc/bash.info @@ -2142,13 +2142,12 @@ omitted, the operator tests only for existence. ‘${PARAMETER//PATTERN/STRING}’ ‘${PARAMETER/#PATTERN/STRING}’ ‘${PARAMETER/%PATTERN/STRING}’ - The PATTERN is expanded to produce a pattern just as in filename - expansion and matched against the expanded value of PARAMETER - according to the rules described below (*note Pattern Matching::). - The longest match of PATTERN in the expanded value is replaced with - STRING. STRING undergoes tilde expansion, parameter and variable - expansion, arithmetic expansion, command and process substitution, - and quote removal. + The PATTERN is expanded to produce a pattern and matched against + the expanded value of PARAMETER as described below (*note Pattern + Matching::). The longest match of PATTERN in the expanded value is + replaced with STRING. STRING undergoes tilde expansion, parameter + and variable expansion, arithmetic expansion, command and process + substitution, and quote removal. In the first form above, only the first match is replaced. If there are two slashes separating PARAMETER and PATTERN (the second @@ -2232,19 +2231,21 @@ omitted, the operator tests only for existence. ‘${PARAMETER,PATTERN}’ ‘${PARAMETER,,PATTERN}’ This expansion modifies the case of alphabetic characters in - PARAMETER. The PATTERN is expanded to produce a pattern just as in - filename expansion. Each character in the expanded value of - PARAMETER is tested against PATTERN, and, if it matches the + PARAMETER. First, the PATTERN is expanded to produce a pattern as + described below in *note Pattern Matching::. + + ‘Bash’ then examines characters in the expanded value of PARAMETER + against PATTERN as described below. If a character matches the pattern, its case is converted. The pattern should not attempt to match more than one character. - The ‘^’ operator converts lowercase letters matching PATTERN to - uppercase; the ‘,’ operator converts matching uppercase letters to - lowercase. The ‘^^’ and ‘,,’ expansions convert each matched - character in the expanded value; the ‘^’ and ‘,’ expansions match - and convert only the first character in the expanded value. If - PATTERN is omitted, it is treated like a ‘?’, which matches every - character. + Using ‘^’ converts lowercase letters matching PATTERN to uppercase; + ‘,’ converts matching uppercase letters to lowercase. The ‘^’ and + ‘,’ variants examine the first character in the expanded value and + convert its case if it matches PATTERN; the ‘^^’ and ‘,,’ variants + examine all characters in the expanded value and convert each one + that matches PATTERN. If PATTERN is omitted, it is treated like a + ‘?’, which matches every character. If PARAMETER is ‘@’ or ‘*’, the case modification operation is applied to each positional parameter in turn, and the expansion is @@ -5633,8 +5634,9 @@ Variables::). command (*note The Shopt Builtin::). The options appearing in ‘BASHOPTS’ are those reported as ‘on’ by ‘shopt’. If this variable is in the environment when Bash starts up, the shell enables each - option in the list before reading any startup files. This variable - is readonly. + option in the list before reading any startup files. If this + variable is exported, child shells will enable each option in the + list. This variable is readonly. ‘BASHPID’ Expands to the process ID of the current Bash process. This @@ -11115,8 +11117,9 @@ expansion uses the entire event. A ‘:’ separates the event specification from the word designator. It may be omitted if the word designator begins with a ‘^’, ‘$’, ‘*’, ‘-’, or ‘%’. Words are numbered from the beginning of the line, with the first word being denoted by 0 -(zero). Words are inserted into the current line separated by single -spaces. +(zero). That first word is usually the command word, and the arguments +begin with the second word. Words are inserted into the current line +separated by single spaces. For example, @@ -11125,7 +11128,7 @@ spaces. preceding command is repeated in toto. ‘!!:$’ - designates the last argument of the preceding command. This may be + designates the last word of the preceding command. This may be shortened to ‘!$’. ‘!fi:2’ @@ -12938,27 +12941,27 @@ D.3 Parameter and Variable Index * auto_resume: Job Control Variables. (line 6) * BASH: Bash Variables. (line 24) -* BASH_ALIASES: Bash Variables. (line 43) -* BASH_ARGC: Bash Variables. (line 52) -* BASH_ARGV: Bash Variables. (line 66) -* BASH_ARGV0: Bash Variables. (line 79) -* BASH_CMDS: Bash Variables. (line 87) -* BASH_COMMAND: Bash Variables. (line 96) -* BASH_COMPAT: Bash Variables. (line 103) -* BASH_ENV: Bash Variables. (line 119) -* BASH_EXECUTION_STRING: Bash Variables. (line 125) -* BASH_LINENO: Bash Variables. (line 128) -* BASH_LOADABLES_PATH: Bash Variables. (line 138) -* BASH_MONOSECONDS: Bash Variables. (line 142) -* BASH_REMATCH: Bash Variables. (line 149) -* BASH_SOURCE: Bash Variables. (line 157) -* BASH_SUBSHELL: Bash Variables. (line 165) -* BASH_TRAPSIG: Bash Variables. (line 171) -* BASH_VERSINFO: Bash Variables. (line 177) -* BASH_VERSION: Bash Variables. (line 200) -* BASH_XTRACEFD: Bash Variables. (line 204) +* BASH_ALIASES: Bash Variables. (line 44) +* BASH_ARGC: Bash Variables. (line 53) +* BASH_ARGV: Bash Variables. (line 67) +* BASH_ARGV0: Bash Variables. (line 80) +* BASH_CMDS: Bash Variables. (line 88) +* BASH_COMMAND: Bash Variables. (line 97) +* BASH_COMPAT: Bash Variables. (line 104) +* BASH_ENV: Bash Variables. (line 120) +* BASH_EXECUTION_STRING: Bash Variables. (line 126) +* BASH_LINENO: Bash Variables. (line 129) +* BASH_LOADABLES_PATH: Bash Variables. (line 139) +* BASH_MONOSECONDS: Bash Variables. (line 143) +* BASH_REMATCH: Bash Variables. (line 150) +* BASH_SOURCE: Bash Variables. (line 158) +* BASH_SUBSHELL: Bash Variables. (line 166) +* BASH_TRAPSIG: Bash Variables. (line 172) +* BASH_VERSINFO: Bash Variables. (line 178) +* BASH_VERSION: Bash Variables. (line 201) +* BASH_XTRACEFD: Bash Variables. (line 205) * BASHOPTS: Bash Variables. (line 27) -* BASHPID: Bash Variables. (line 36) +* BASHPID: Bash Variables. (line 37) * bell-style: Readline Init File Syntax. (line 64) * bind-tty-special-chars: Readline Init File Syntax. @@ -12967,21 +12970,21 @@ D.3 Parameter and Variable Index (line 79) * CDPATH: Bourne Shell Variables. (line 9) -* CHILD_MAX: Bash Variables. (line 216) +* CHILD_MAX: Bash Variables. (line 217) * colored-completion-prefix: Readline Init File Syntax. (line 84) * colored-stats: Readline Init File Syntax. (line 94) -* COLUMNS: Bash Variables. (line 223) +* COLUMNS: Bash Variables. (line 224) * comment-begin: Readline Init File Syntax. (line 100) -* COMP_CWORD: Bash Variables. (line 229) -* COMP_KEY: Bash Variables. (line 235) -* COMP_LINE: Bash Variables. (line 241) -* COMP_POINT: Bash Variables. (line 246) -* COMP_TYPE: Bash Variables. (line 254) -* COMP_WORDBREAKS: Bash Variables. (line 264) -* COMP_WORDS: Bash Variables. (line 270) +* COMP_CWORD: Bash Variables. (line 230) +* COMP_KEY: Bash Variables. (line 236) +* COMP_LINE: Bash Variables. (line 242) +* COMP_POINT: Bash Variables. (line 247) +* COMP_TYPE: Bash Variables. (line 255) +* COMP_WORDBREAKS: Bash Variables. (line 265) +* COMP_WORDS: Bash Variables. (line 271) * completion-display-width: Readline Init File Syntax. (line 104) * completion-ignore-case: Readline Init File Syntax. @@ -12992,18 +12995,18 @@ D.3 Parameter and Variable Index (line 122) * completion-query-items: Readline Init File Syntax. (line 131) -* COMPREPLY: Bash Variables. (line 277) +* COMPREPLY: Bash Variables. (line 278) * convert-meta: Readline Init File Syntax. (line 142) -* COPROC: Bash Variables. (line 283) -* DIRSTACK: Bash Variables. (line 287) +* COPROC: Bash Variables. (line 284) +* DIRSTACK: Bash Variables. (line 288) * disable-completion: Readline Init File Syntax. (line 154) * echo-control-characters: Readline Init File Syntax. (line 159) * editing-mode: Readline Init File Syntax. (line 164) -* EMACS: Bash Variables. (line 297) +* EMACS: Bash Variables. (line 298) * emacs-mode-string: Readline Init File Syntax. (line 170) * enable-active-region The: Readline Init File Syntax. @@ -13014,72 +13017,72 @@ D.3 Parameter and Variable Index (line 202) * enable-meta-key: Readline Init File Syntax. (line 207) -* ENV: Bash Variables. (line 302) -* EPOCHREALTIME: Bash Variables. (line 307) -* EPOCHSECONDS: Bash Variables. (line 315) -* EUID: Bash Variables. (line 322) -* EXECIGNORE: Bash Variables. (line 326) +* ENV: Bash Variables. (line 303) +* EPOCHREALTIME: Bash Variables. (line 308) +* EPOCHSECONDS: Bash Variables. (line 316) +* EUID: Bash Variables. (line 323) +* EXECIGNORE: Bash Variables. (line 327) * expand-tilde: Readline Init File Syntax. (line 217) -* FCEDIT: Bash Variables. (line 338) -* FIGNORE: Bash Variables. (line 341) +* FCEDIT: Bash Variables. (line 339) +* FIGNORE: Bash Variables. (line 342) * force-meta-prefix: Readline Init File Syntax. (line 221) -* FUNCNAME: Bash Variables. (line 347) -* FUNCNEST: Bash Variables. (line 364) -* GLOBIGNORE: Bash Variables. (line 369) -* GLOBSORT: Bash Variables. (line 376) -* GROUPS: Bash Variables. (line 414) -* histchars: Bash Variables. (line 420) -* HISTCMD: Bash Variables. (line 436) -* HISTCONTROL: Bash Variables. (line 442) -* HISTFILE: Bash Variables. (line 460) -* HISTFILESIZE: Bash Variables. (line 466) -* HISTIGNORE: Bash Variables. (line 477) +* FUNCNAME: Bash Variables. (line 348) +* FUNCNEST: Bash Variables. (line 365) +* GLOBIGNORE: Bash Variables. (line 370) +* GLOBSORT: Bash Variables. (line 377) +* GROUPS: Bash Variables. (line 415) +* histchars: Bash Variables. (line 421) +* HISTCMD: Bash Variables. (line 437) +* HISTCONTROL: Bash Variables. (line 443) +* HISTFILE: Bash Variables. (line 461) +* HISTFILESIZE: Bash Variables. (line 467) +* HISTIGNORE: Bash Variables. (line 478) * history-preserve-point: Readline Init File Syntax. (line 234) * history-size: Readline Init File Syntax. (line 240) -* HISTSIZE: Bash Variables. (line 501) -* HISTTIMEFORMAT: Bash Variables. (line 508) +* HISTSIZE: Bash Variables. (line 502) +* HISTTIMEFORMAT: Bash Variables. (line 509) * HOME: Bourne Shell Variables. (line 13) * horizontal-scroll-mode: Readline Init File Syntax. (line 250) -* HOSTFILE: Bash Variables. (line 517) -* HOSTNAME: Bash Variables. (line 528) -* HOSTTYPE: Bash Variables. (line 531) +* HOSTFILE: Bash Variables. (line 518) +* HOSTNAME: Bash Variables. (line 529) +* HOSTTYPE: Bash Variables. (line 532) * IFS: Bourne Shell Variables. (line 18) -* IGNOREEOF: Bash Variables. (line 534) +* IGNOREEOF: Bash Variables. (line 535) * input-meta: Readline Init File Syntax. (line 258) -* INPUTRC: Bash Variables. (line 543) -* INSIDE_EMACS: Bash Variables. (line 547) +* INPUTRC: Bash Variables. (line 544) +* INSIDE_EMACS: Bash Variables. (line 548) * isearch-terminators: Readline Init File Syntax. (line 269) * keymap: Readline Init File Syntax. (line 276) * LANG: Creating Internationalized Scripts. (line 51) -* LANG <1>: Bash Variables. (line 553) -* LC_ALL: Bash Variables. (line 557) -* LC_COLLATE: Bash Variables. (line 561) -* LC_CTYPE: Bash Variables. (line 568) +* LANG <1>: Bash Variables. (line 554) +* LC_ALL: Bash Variables. (line 558) +* LC_COLLATE: Bash Variables. (line 562) +* LC_CTYPE: Bash Variables. (line 569) * LC_MESSAGES: Creating Internationalized Scripts. (line 51) -* LC_MESSAGES <1>: Bash Variables. (line 573) -* LC_NUMERIC: Bash Variables. (line 577) -* LC_TIME: Bash Variables. (line 581) -* LINENO: Bash Variables. (line 585) -* LINES: Bash Variables. (line 592) -* MACHTYPE: Bash Variables. (line 598) +* LC_MESSAGES <1>: Bash Variables. (line 574) +* LC_NUMERIC: Bash Variables. (line 578) +* LC_TIME: Bash Variables. (line 582) +* LINENO: Bash Variables. (line 586) +* LINES: Bash Variables. (line 593) +* MACHTYPE: Bash Variables. (line 599) * MAIL: Bourne Shell Variables. (line 24) -* MAILCHECK: Bash Variables. (line 602) +* MAILCHECK: Bash Variables. (line 603) * MAILPATH: Bourne Shell Variables. (line 29) -* MAPFILE: Bash Variables. (line 610) +* MAPFILE: Bash Variables. (line 611) * mark-modified-lines: Readline Init File Syntax. (line 306) * mark-symlinked-directories: Readline Init File Syntax. @@ -13090,46 +13093,46 @@ D.3 Parameter and Variable Index (line 323) * meta-flag: Readline Init File Syntax. (line 258) -* OLDPWD: Bash Variables. (line 614) +* OLDPWD: Bash Variables. (line 615) * OPTARG: Bourne Shell Variables. (line 36) -* OPTERR: Bash Variables. (line 617) +* OPTERR: Bash Variables. (line 618) * OPTIND: Bourne Shell Variables. (line 40) -* OSTYPE: Bash Variables. (line 622) +* OSTYPE: Bash Variables. (line 623) * output-meta: Readline Init File Syntax. (line 328) * page-completions: Readline Init File Syntax. (line 337) * PATH: Bourne Shell Variables. (line 44) -* PIPESTATUS: Bash Variables. (line 625) -* POSIXLY_CORRECT: Bash Variables. (line 635) -* PPID: Bash Variables. (line 645) -* PROMPT_COMMAND: Bash Variables. (line 649) -* PROMPT_DIRTRIM: Bash Variables. (line 655) -* PS0: Bash Variables. (line 661) +* PIPESTATUS: Bash Variables. (line 626) +* POSIXLY_CORRECT: Bash Variables. (line 636) +* PPID: Bash Variables. (line 646) +* PROMPT_COMMAND: Bash Variables. (line 650) +* PROMPT_DIRTRIM: Bash Variables. (line 656) +* PS0: Bash Variables. (line 662) * PS1: Bourne Shell Variables. (line 53) * PS2: Bourne Shell Variables. (line 58) -* PS3: Bash Variables. (line 666) -* PS4: Bash Variables. (line 671) -* PWD: Bash Variables. (line 679) -* RANDOM: Bash Variables. (line 682) -* READLINE_ARGUMENT: Bash Variables. (line 690) -* READLINE_LINE: Bash Variables. (line 694) -* READLINE_MARK: Bash Variables. (line 698) -* READLINE_POINT: Bash Variables. (line 704) -* REPLY: Bash Variables. (line 708) +* PS3: Bash Variables. (line 667) +* PS4: Bash Variables. (line 672) +* PWD: Bash Variables. (line 680) +* RANDOM: Bash Variables. (line 683) +* READLINE_ARGUMENT: Bash Variables. (line 691) +* READLINE_LINE: Bash Variables. (line 695) +* READLINE_MARK: Bash Variables. (line 699) +* READLINE_POINT: Bash Variables. (line 705) +* REPLY: Bash Variables. (line 709) * revert-all-at-newline: Readline Init File Syntax. (line 350) * search-ignore-case: Readline Init File Syntax. (line 357) -* SECONDS: Bash Variables. (line 712) -* SHELL: Bash Variables. (line 722) -* SHELLOPTS: Bash Variables. (line 727) -* SHLVL: Bash Variables. (line 737) +* SECONDS: Bash Variables. (line 713) +* SHELL: Bash Variables. (line 723) +* SHELLOPTS: Bash Variables. (line 728) +* SHLVL: Bash Variables. (line 738) * show-all-if-ambiguous: Readline Init File Syntax. (line 362) * show-all-if-unmodified: Readline Init File Syntax. @@ -13138,15 +13141,15 @@ D.3 Parameter and Variable Index (line 377) * skip-completed-text: Readline Init File Syntax. (line 383) -* SRANDOM: Bash Variables. (line 742) +* SRANDOM: Bash Variables. (line 743) * TEXTDOMAIN: Creating Internationalized Scripts. (line 51) * TEXTDOMAINDIR: Creating Internationalized Scripts. (line 51) -* TIMEFORMAT: Bash Variables. (line 751) -* TMOUT: Bash Variables. (line 790) -* TMPDIR: Bash Variables. (line 802) -* UID: Bash Variables. (line 806) +* TIMEFORMAT: Bash Variables. (line 752) +* TMOUT: Bash Variables. (line 791) +* TMPDIR: Bash Variables. (line 803) +* UID: Bash Variables. (line 807) * vi-cmd-mode-string: Readline Init File Syntax. (line 396) * vi-ins-mode-string: Readline Init File Syntax. @@ -13576,103 +13579,103 @@ Node: Shell Expansions74043 Node: Brace Expansion76232 Node: Tilde Expansion79578 Node: Shell Parameter Expansion82533 -Node: Command Substitution102293 -Node: Arithmetic Expansion105822 -Node: Process Substitution106836 -Node: Word Splitting107944 -Node: Filename Expansion110388 -Node: Pattern Matching113612 -Node: Quote Removal119335 -Node: Redirections119639 -Node: Executing Commands129902 -Node: Simple Command Expansion130569 -Node: Command Search and Execution132677 -Node: Command Execution Environment135121 -Node: Environment138569 -Node: Exit Status140472 -Node: Signals142530 -Node: Shell Scripts147459 -Node: Shell Builtin Commands150757 -Node: Bourne Shell Builtins152868 -Node: Bash Builtins179432 -Node: Modifying Shell Behavior216356 -Node: The Set Builtin216698 -Node: The Shopt Builtin228686 -Node: Special Builtins245738 -Node: Shell Variables246727 -Node: Bourne Shell Variables247161 -Node: Bash Variables249669 -Node: Bash Features288488 -Node: Invoking Bash289502 -Node: Bash Startup Files296086 -Node: Interactive Shells301328 -Node: What is an Interactive Shell?301736 -Node: Is this Shell Interactive?302398 -Node: Interactive Shell Behavior303222 -Node: Bash Conditional Expressions306983 -Node: Shell Arithmetic312194 -Node: Aliases315523 -Node: Arrays318657 -Node: The Directory Stack325749 -Node: Directory Stack Builtins326546 -Node: Controlling the Prompt330991 -Node: The Restricted Shell333876 -Node: Bash POSIX Mode336758 -Node: Shell Compatibility Mode354819 -Node: Job Control363826 -Node: Job Control Basics364283 -Node: Job Control Builtins370561 -Node: Job Control Variables377243 -Node: Command Line Editing378474 -Node: Introduction and Notation380177 -Node: Readline Interaction382529 -Node: Readline Bare Essentials383717 -Node: Readline Movement Commands385525 -Node: Readline Killing Commands386521 -Node: Readline Arguments388544 -Node: Searching389601 -Node: Readline Init File391844 -Node: Readline Init File Syntax393147 -Node: Conditional Init Constructs419972 -Node: Sample Init File424357 -Node: Bindable Readline Commands427477 -Node: Commands For Moving429015 -Node: Commands For History431383 -Node: Commands For Text436773 -Node: Commands For Killing440898 -Node: Numeric Arguments443686 -Node: Commands For Completion444838 -Node: Keyboard Macros450534 -Node: Miscellaneous Commands451235 -Node: Readline vi Mode457802 -Node: Programmable Completion458779 -Node: Programmable Completion Builtins467516 -Node: A Programmable Completion Example479253 -Node: Using History Interactively484598 -Node: Bash History Facilities485279 -Node: Bash History Builtins489014 -Node: History Interaction495485 -Node: Event Designators500435 -Node: Word Designators502013 -Node: Modifiers504317 -Node: Installing Bash506254 -Node: Basic Installation507370 -Node: Compilers and Options511246 -Node: Compiling For Multiple Architectures511996 -Node: Installation Names513749 -Node: Specifying the System Type515983 -Node: Sharing Defaults516729 -Node: Operation Controls517443 -Node: Optional Features518462 -Node: Reporting Bugs530842 -Node: Major Differences From The Bourne Shell532199 -Node: GNU Free Documentation License553619 -Node: Indexes578796 -Node: Builtin Index579247 -Node: Reserved Word Index586345 -Node: Variable Index588790 -Node: Function Index606203 -Node: Concept Index620198 +Node: Command Substitution102341 +Node: Arithmetic Expansion105870 +Node: Process Substitution106884 +Node: Word Splitting107992 +Node: Filename Expansion110436 +Node: Pattern Matching113660 +Node: Quote Removal119383 +Node: Redirections119687 +Node: Executing Commands129950 +Node: Simple Command Expansion130617 +Node: Command Search and Execution132725 +Node: Command Execution Environment135169 +Node: Environment138617 +Node: Exit Status140520 +Node: Signals142578 +Node: Shell Scripts147507 +Node: Shell Builtin Commands150805 +Node: Bourne Shell Builtins152916 +Node: Bash Builtins179480 +Node: Modifying Shell Behavior216404 +Node: The Set Builtin216746 +Node: The Shopt Builtin228734 +Node: Special Builtins245786 +Node: Shell Variables246775 +Node: Bourne Shell Variables247209 +Node: Bash Variables249717 +Node: Bash Features288622 +Node: Invoking Bash289636 +Node: Bash Startup Files296220 +Node: Interactive Shells301462 +Node: What is an Interactive Shell?301870 +Node: Is this Shell Interactive?302532 +Node: Interactive Shell Behavior303356 +Node: Bash Conditional Expressions307117 +Node: Shell Arithmetic312328 +Node: Aliases315657 +Node: Arrays318791 +Node: The Directory Stack325883 +Node: Directory Stack Builtins326680 +Node: Controlling the Prompt331125 +Node: The Restricted Shell334010 +Node: Bash POSIX Mode336892 +Node: Shell Compatibility Mode354953 +Node: Job Control363960 +Node: Job Control Basics364417 +Node: Job Control Builtins370695 +Node: Job Control Variables377377 +Node: Command Line Editing378608 +Node: Introduction and Notation380311 +Node: Readline Interaction382663 +Node: Readline Bare Essentials383851 +Node: Readline Movement Commands385659 +Node: Readline Killing Commands386655 +Node: Readline Arguments388678 +Node: Searching389735 +Node: Readline Init File391978 +Node: Readline Init File Syntax393281 +Node: Conditional Init Constructs420106 +Node: Sample Init File424491 +Node: Bindable Readline Commands427611 +Node: Commands For Moving429149 +Node: Commands For History431517 +Node: Commands For Text436907 +Node: Commands For Killing441032 +Node: Numeric Arguments443820 +Node: Commands For Completion444972 +Node: Keyboard Macros450668 +Node: Miscellaneous Commands451369 +Node: Readline vi Mode457936 +Node: Programmable Completion458913 +Node: Programmable Completion Builtins467650 +Node: A Programmable Completion Example479387 +Node: Using History Interactively484732 +Node: Bash History Facilities485413 +Node: Bash History Builtins489148 +Node: History Interaction495619 +Node: Event Designators500569 +Node: Word Designators502147 +Node: Modifiers504539 +Node: Installing Bash506476 +Node: Basic Installation507592 +Node: Compilers and Options511468 +Node: Compiling For Multiple Architectures512218 +Node: Installation Names513971 +Node: Specifying the System Type516205 +Node: Sharing Defaults516951 +Node: Operation Controls517665 +Node: Optional Features518684 +Node: Reporting Bugs531064 +Node: Major Differences From The Bourne Shell532421 +Node: GNU Free Documentation License553841 +Node: Indexes579018 +Node: Builtin Index579469 +Node: Reserved Word Index586567 +Node: Variable Index589012 +Node: Function Index606425 +Node: Concept Index620420  End Tag Table diff --git a/doc/bashref.info b/doc/bashref.info index b4c23235..a1565dd7 100644 --- a/doc/bashref.info +++ b/doc/bashref.info @@ -2143,13 +2143,12 @@ omitted, the operator tests only for existence. ‘${PARAMETER//PATTERN/STRING}’ ‘${PARAMETER/#PATTERN/STRING}’ ‘${PARAMETER/%PATTERN/STRING}’ - The PATTERN is expanded to produce a pattern just as in filename - expansion and matched against the expanded value of PARAMETER - according to the rules described below (*note Pattern Matching::). - The longest match of PATTERN in the expanded value is replaced with - STRING. STRING undergoes tilde expansion, parameter and variable - expansion, arithmetic expansion, command and process substitution, - and quote removal. + The PATTERN is expanded to produce a pattern and matched against + the expanded value of PARAMETER as described below (*note Pattern + Matching::). The longest match of PATTERN in the expanded value is + replaced with STRING. STRING undergoes tilde expansion, parameter + and variable expansion, arithmetic expansion, command and process + substitution, and quote removal. In the first form above, only the first match is replaced. If there are two slashes separating PARAMETER and PATTERN (the second @@ -2233,19 +2232,21 @@ omitted, the operator tests only for existence. ‘${PARAMETER,PATTERN}’ ‘${PARAMETER,,PATTERN}’ This expansion modifies the case of alphabetic characters in - PARAMETER. The PATTERN is expanded to produce a pattern just as in - filename expansion. Each character in the expanded value of - PARAMETER is tested against PATTERN, and, if it matches the + PARAMETER. First, the PATTERN is expanded to produce a pattern as + described below in *note Pattern Matching::. + + ‘Bash’ then examines characters in the expanded value of PARAMETER + against PATTERN as described below. If a character matches the pattern, its case is converted. The pattern should not attempt to match more than one character. - The ‘^’ operator converts lowercase letters matching PATTERN to - uppercase; the ‘,’ operator converts matching uppercase letters to - lowercase. The ‘^^’ and ‘,,’ expansions convert each matched - character in the expanded value; the ‘^’ and ‘,’ expansions match - and convert only the first character in the expanded value. If - PATTERN is omitted, it is treated like a ‘?’, which matches every - character. + Using ‘^’ converts lowercase letters matching PATTERN to uppercase; + ‘,’ converts matching uppercase letters to lowercase. The ‘^’ and + ‘,’ variants examine the first character in the expanded value and + convert its case if it matches PATTERN; the ‘^^’ and ‘,,’ variants + examine all characters in the expanded value and convert each one + that matches PATTERN. If PATTERN is omitted, it is treated like a + ‘?’, which matches every character. If PARAMETER is ‘@’ or ‘*’, the case modification operation is applied to each positional parameter in turn, and the expansion is @@ -5634,8 +5635,9 @@ Variables::). command (*note The Shopt Builtin::). The options appearing in ‘BASHOPTS’ are those reported as ‘on’ by ‘shopt’. If this variable is in the environment when Bash starts up, the shell enables each - option in the list before reading any startup files. This variable - is readonly. + option in the list before reading any startup files. If this + variable is exported, child shells will enable each option in the + list. This variable is readonly. ‘BASHPID’ Expands to the process ID of the current Bash process. This @@ -11116,8 +11118,9 @@ expansion uses the entire event. A ‘:’ separates the event specification from the word designator. It may be omitted if the word designator begins with a ‘^’, ‘$’, ‘*’, ‘-’, or ‘%’. Words are numbered from the beginning of the line, with the first word being denoted by 0 -(zero). Words are inserted into the current line separated by single -spaces. +(zero). That first word is usually the command word, and the arguments +begin with the second word. Words are inserted into the current line +separated by single spaces. For example, @@ -11126,7 +11129,7 @@ spaces. preceding command is repeated in toto. ‘!!:$’ - designates the last argument of the preceding command. This may be + designates the last word of the preceding command. This may be shortened to ‘!$’. ‘!fi:2’ @@ -12939,27 +12942,27 @@ D.3 Parameter and Variable Index * auto_resume: Job Control Variables. (line 6) * BASH: Bash Variables. (line 24) -* BASH_ALIASES: Bash Variables. (line 43) -* BASH_ARGC: Bash Variables. (line 52) -* BASH_ARGV: Bash Variables. (line 66) -* BASH_ARGV0: Bash Variables. (line 79) -* BASH_CMDS: Bash Variables. (line 87) -* BASH_COMMAND: Bash Variables. (line 96) -* BASH_COMPAT: Bash Variables. (line 103) -* BASH_ENV: Bash Variables. (line 119) -* BASH_EXECUTION_STRING: Bash Variables. (line 125) -* BASH_LINENO: Bash Variables. (line 128) -* BASH_LOADABLES_PATH: Bash Variables. (line 138) -* BASH_MONOSECONDS: Bash Variables. (line 142) -* BASH_REMATCH: Bash Variables. (line 149) -* BASH_SOURCE: Bash Variables. (line 157) -* BASH_SUBSHELL: Bash Variables. (line 165) -* BASH_TRAPSIG: Bash Variables. (line 171) -* BASH_VERSINFO: Bash Variables. (line 177) -* BASH_VERSION: Bash Variables. (line 200) -* BASH_XTRACEFD: Bash Variables. (line 204) +* BASH_ALIASES: Bash Variables. (line 44) +* BASH_ARGC: Bash Variables. (line 53) +* BASH_ARGV: Bash Variables. (line 67) +* BASH_ARGV0: Bash Variables. (line 80) +* BASH_CMDS: Bash Variables. (line 88) +* BASH_COMMAND: Bash Variables. (line 97) +* BASH_COMPAT: Bash Variables. (line 104) +* BASH_ENV: Bash Variables. (line 120) +* BASH_EXECUTION_STRING: Bash Variables. (line 126) +* BASH_LINENO: Bash Variables. (line 129) +* BASH_LOADABLES_PATH: Bash Variables. (line 139) +* BASH_MONOSECONDS: Bash Variables. (line 143) +* BASH_REMATCH: Bash Variables. (line 150) +* BASH_SOURCE: Bash Variables. (line 158) +* BASH_SUBSHELL: Bash Variables. (line 166) +* BASH_TRAPSIG: Bash Variables. (line 172) +* BASH_VERSINFO: Bash Variables. (line 178) +* BASH_VERSION: Bash Variables. (line 201) +* BASH_XTRACEFD: Bash Variables. (line 205) * BASHOPTS: Bash Variables. (line 27) -* BASHPID: Bash Variables. (line 36) +* BASHPID: Bash Variables. (line 37) * bell-style: Readline Init File Syntax. (line 64) * bind-tty-special-chars: Readline Init File Syntax. @@ -12968,21 +12971,21 @@ D.3 Parameter and Variable Index (line 79) * CDPATH: Bourne Shell Variables. (line 9) -* CHILD_MAX: Bash Variables. (line 216) +* CHILD_MAX: Bash Variables. (line 217) * colored-completion-prefix: Readline Init File Syntax. (line 84) * colored-stats: Readline Init File Syntax. (line 94) -* COLUMNS: Bash Variables. (line 223) +* COLUMNS: Bash Variables. (line 224) * comment-begin: Readline Init File Syntax. (line 100) -* COMP_CWORD: Bash Variables. (line 229) -* COMP_KEY: Bash Variables. (line 235) -* COMP_LINE: Bash Variables. (line 241) -* COMP_POINT: Bash Variables. (line 246) -* COMP_TYPE: Bash Variables. (line 254) -* COMP_WORDBREAKS: Bash Variables. (line 264) -* COMP_WORDS: Bash Variables. (line 270) +* COMP_CWORD: Bash Variables. (line 230) +* COMP_KEY: Bash Variables. (line 236) +* COMP_LINE: Bash Variables. (line 242) +* COMP_POINT: Bash Variables. (line 247) +* COMP_TYPE: Bash Variables. (line 255) +* COMP_WORDBREAKS: Bash Variables. (line 265) +* COMP_WORDS: Bash Variables. (line 271) * completion-display-width: Readline Init File Syntax. (line 104) * completion-ignore-case: Readline Init File Syntax. @@ -12993,18 +12996,18 @@ D.3 Parameter and Variable Index (line 122) * completion-query-items: Readline Init File Syntax. (line 131) -* COMPREPLY: Bash Variables. (line 277) +* COMPREPLY: Bash Variables. (line 278) * convert-meta: Readline Init File Syntax. (line 142) -* COPROC: Bash Variables. (line 283) -* DIRSTACK: Bash Variables. (line 287) +* COPROC: Bash Variables. (line 284) +* DIRSTACK: Bash Variables. (line 288) * disable-completion: Readline Init File Syntax. (line 154) * echo-control-characters: Readline Init File Syntax. (line 159) * editing-mode: Readline Init File Syntax. (line 164) -* EMACS: Bash Variables. (line 297) +* EMACS: Bash Variables. (line 298) * emacs-mode-string: Readline Init File Syntax. (line 170) * enable-active-region The: Readline Init File Syntax. @@ -13015,72 +13018,72 @@ D.3 Parameter and Variable Index (line 202) * enable-meta-key: Readline Init File Syntax. (line 207) -* ENV: Bash Variables. (line 302) -* EPOCHREALTIME: Bash Variables. (line 307) -* EPOCHSECONDS: Bash Variables. (line 315) -* EUID: Bash Variables. (line 322) -* EXECIGNORE: Bash Variables. (line 326) +* ENV: Bash Variables. (line 303) +* EPOCHREALTIME: Bash Variables. (line 308) +* EPOCHSECONDS: Bash Variables. (line 316) +* EUID: Bash Variables. (line 323) +* EXECIGNORE: Bash Variables. (line 327) * expand-tilde: Readline Init File Syntax. (line 217) -* FCEDIT: Bash Variables. (line 338) -* FIGNORE: Bash Variables. (line 341) +* FCEDIT: Bash Variables. (line 339) +* FIGNORE: Bash Variables. (line 342) * force-meta-prefix: Readline Init File Syntax. (line 221) -* FUNCNAME: Bash Variables. (line 347) -* FUNCNEST: Bash Variables. (line 364) -* GLOBIGNORE: Bash Variables. (line 369) -* GLOBSORT: Bash Variables. (line 376) -* GROUPS: Bash Variables. (line 414) -* histchars: Bash Variables. (line 420) -* HISTCMD: Bash Variables. (line 436) -* HISTCONTROL: Bash Variables. (line 442) -* HISTFILE: Bash Variables. (line 460) -* HISTFILESIZE: Bash Variables. (line 466) -* HISTIGNORE: Bash Variables. (line 477) +* FUNCNAME: Bash Variables. (line 348) +* FUNCNEST: Bash Variables. (line 365) +* GLOBIGNORE: Bash Variables. (line 370) +* GLOBSORT: Bash Variables. (line 377) +* GROUPS: Bash Variables. (line 415) +* histchars: Bash Variables. (line 421) +* HISTCMD: Bash Variables. (line 437) +* HISTCONTROL: Bash Variables. (line 443) +* HISTFILE: Bash Variables. (line 461) +* HISTFILESIZE: Bash Variables. (line 467) +* HISTIGNORE: Bash Variables. (line 478) * history-preserve-point: Readline Init File Syntax. (line 234) * history-size: Readline Init File Syntax. (line 240) -* HISTSIZE: Bash Variables. (line 501) -* HISTTIMEFORMAT: Bash Variables. (line 508) +* HISTSIZE: Bash Variables. (line 502) +* HISTTIMEFORMAT: Bash Variables. (line 509) * HOME: Bourne Shell Variables. (line 13) * horizontal-scroll-mode: Readline Init File Syntax. (line 250) -* HOSTFILE: Bash Variables. (line 517) -* HOSTNAME: Bash Variables. (line 528) -* HOSTTYPE: Bash Variables. (line 531) +* HOSTFILE: Bash Variables. (line 518) +* HOSTNAME: Bash Variables. (line 529) +* HOSTTYPE: Bash Variables. (line 532) * IFS: Bourne Shell Variables. (line 18) -* IGNOREEOF: Bash Variables. (line 534) +* IGNOREEOF: Bash Variables. (line 535) * input-meta: Readline Init File Syntax. (line 258) -* INPUTRC: Bash Variables. (line 543) -* INSIDE_EMACS: Bash Variables. (line 547) +* INPUTRC: Bash Variables. (line 544) +* INSIDE_EMACS: Bash Variables. (line 548) * isearch-terminators: Readline Init File Syntax. (line 269) * keymap: Readline Init File Syntax. (line 276) * LANG: Creating Internationalized Scripts. (line 51) -* LANG <1>: Bash Variables. (line 553) -* LC_ALL: Bash Variables. (line 557) -* LC_COLLATE: Bash Variables. (line 561) -* LC_CTYPE: Bash Variables. (line 568) +* LANG <1>: Bash Variables. (line 554) +* LC_ALL: Bash Variables. (line 558) +* LC_COLLATE: Bash Variables. (line 562) +* LC_CTYPE: Bash Variables. (line 569) * LC_MESSAGES: Creating Internationalized Scripts. (line 51) -* LC_MESSAGES <1>: Bash Variables. (line 573) -* LC_NUMERIC: Bash Variables. (line 577) -* LC_TIME: Bash Variables. (line 581) -* LINENO: Bash Variables. (line 585) -* LINES: Bash Variables. (line 592) -* MACHTYPE: Bash Variables. (line 598) +* LC_MESSAGES <1>: Bash Variables. (line 574) +* LC_NUMERIC: Bash Variables. (line 578) +* LC_TIME: Bash Variables. (line 582) +* LINENO: Bash Variables. (line 586) +* LINES: Bash Variables. (line 593) +* MACHTYPE: Bash Variables. (line 599) * MAIL: Bourne Shell Variables. (line 24) -* MAILCHECK: Bash Variables. (line 602) +* MAILCHECK: Bash Variables. (line 603) * MAILPATH: Bourne Shell Variables. (line 29) -* MAPFILE: Bash Variables. (line 610) +* MAPFILE: Bash Variables. (line 611) * mark-modified-lines: Readline Init File Syntax. (line 306) * mark-symlinked-directories: Readline Init File Syntax. @@ -13091,46 +13094,46 @@ D.3 Parameter and Variable Index (line 323) * meta-flag: Readline Init File Syntax. (line 258) -* OLDPWD: Bash Variables. (line 614) +* OLDPWD: Bash Variables. (line 615) * OPTARG: Bourne Shell Variables. (line 36) -* OPTERR: Bash Variables. (line 617) +* OPTERR: Bash Variables. (line 618) * OPTIND: Bourne Shell Variables. (line 40) -* OSTYPE: Bash Variables. (line 622) +* OSTYPE: Bash Variables. (line 623) * output-meta: Readline Init File Syntax. (line 328) * page-completions: Readline Init File Syntax. (line 337) * PATH: Bourne Shell Variables. (line 44) -* PIPESTATUS: Bash Variables. (line 625) -* POSIXLY_CORRECT: Bash Variables. (line 635) -* PPID: Bash Variables. (line 645) -* PROMPT_COMMAND: Bash Variables. (line 649) -* PROMPT_DIRTRIM: Bash Variables. (line 655) -* PS0: Bash Variables. (line 661) +* PIPESTATUS: Bash Variables. (line 626) +* POSIXLY_CORRECT: Bash Variables. (line 636) +* PPID: Bash Variables. (line 646) +* PROMPT_COMMAND: Bash Variables. (line 650) +* PROMPT_DIRTRIM: Bash Variables. (line 656) +* PS0: Bash Variables. (line 662) * PS1: Bourne Shell Variables. (line 53) * PS2: Bourne Shell Variables. (line 58) -* PS3: Bash Variables. (line 666) -* PS4: Bash Variables. (line 671) -* PWD: Bash Variables. (line 679) -* RANDOM: Bash Variables. (line 682) -* READLINE_ARGUMENT: Bash Variables. (line 690) -* READLINE_LINE: Bash Variables. (line 694) -* READLINE_MARK: Bash Variables. (line 698) -* READLINE_POINT: Bash Variables. (line 704) -* REPLY: Bash Variables. (line 708) +* PS3: Bash Variables. (line 667) +* PS4: Bash Variables. (line 672) +* PWD: Bash Variables. (line 680) +* RANDOM: Bash Variables. (line 683) +* READLINE_ARGUMENT: Bash Variables. (line 691) +* READLINE_LINE: Bash Variables. (line 695) +* READLINE_MARK: Bash Variables. (line 699) +* READLINE_POINT: Bash Variables. (line 705) +* REPLY: Bash Variables. (line 709) * revert-all-at-newline: Readline Init File Syntax. (line 350) * search-ignore-case: Readline Init File Syntax. (line 357) -* SECONDS: Bash Variables. (line 712) -* SHELL: Bash Variables. (line 722) -* SHELLOPTS: Bash Variables. (line 727) -* SHLVL: Bash Variables. (line 737) +* SECONDS: Bash Variables. (line 713) +* SHELL: Bash Variables. (line 723) +* SHELLOPTS: Bash Variables. (line 728) +* SHLVL: Bash Variables. (line 738) * show-all-if-ambiguous: Readline Init File Syntax. (line 362) * show-all-if-unmodified: Readline Init File Syntax. @@ -13139,15 +13142,15 @@ D.3 Parameter and Variable Index (line 377) * skip-completed-text: Readline Init File Syntax. (line 383) -* SRANDOM: Bash Variables. (line 742) +* SRANDOM: Bash Variables. (line 743) * TEXTDOMAIN: Creating Internationalized Scripts. (line 51) * TEXTDOMAINDIR: Creating Internationalized Scripts. (line 51) -* TIMEFORMAT: Bash Variables. (line 751) -* TMOUT: Bash Variables. (line 790) -* TMPDIR: Bash Variables. (line 802) -* UID: Bash Variables. (line 806) +* TIMEFORMAT: Bash Variables. (line 752) +* TMOUT: Bash Variables. (line 791) +* TMPDIR: Bash Variables. (line 803) +* UID: Bash Variables. (line 807) * vi-cmd-mode-string: Readline Init File Syntax. (line 396) * vi-ins-mode-string: Readline Init File Syntax. @@ -13577,103 +13580,103 @@ Node: Shell Expansions74139 Node: Brace Expansion76331 Node: Tilde Expansion79680 Node: Shell Parameter Expansion82638 -Node: Command Substitution102401 -Node: Arithmetic Expansion105933 -Node: Process Substitution106950 -Node: Word Splitting108061 -Node: Filename Expansion110508 -Node: Pattern Matching113735 -Node: Quote Removal119461 -Node: Redirections119768 -Node: Executing Commands130034 -Node: Simple Command Expansion130704 -Node: Command Search and Execution132815 -Node: Command Execution Environment135262 -Node: Environment138713 -Node: Exit Status140619 -Node: Signals142680 -Node: Shell Scripts147612 -Node: Shell Builtin Commands150913 -Node: Bourne Shell Builtins153027 -Node: Bash Builtins179594 -Node: Modifying Shell Behavior216521 -Node: The Set Builtin216866 -Node: The Shopt Builtin228857 -Node: Special Builtins245912 -Node: Shell Variables246904 -Node: Bourne Shell Variables247341 -Node: Bash Variables249852 -Node: Bash Features288674 -Node: Invoking Bash289691 -Node: Bash Startup Files296278 -Node: Interactive Shells301523 -Node: What is an Interactive Shell?301934 -Node: Is this Shell Interactive?302599 -Node: Interactive Shell Behavior303426 -Node: Bash Conditional Expressions307190 -Node: Shell Arithmetic312404 -Node: Aliases315736 -Node: Arrays318873 -Node: The Directory Stack325968 -Node: Directory Stack Builtins326768 -Node: Controlling the Prompt331216 -Node: The Restricted Shell334104 -Node: Bash POSIX Mode336989 -Node: Shell Compatibility Mode355053 -Node: Job Control364063 -Node: Job Control Basics364523 -Node: Job Control Builtins370804 -Node: Job Control Variables377489 -Node: Command Line Editing378723 -Node: Introduction and Notation380429 -Node: Readline Interaction382784 -Node: Readline Bare Essentials383975 -Node: Readline Movement Commands385786 -Node: Readline Killing Commands386785 -Node: Readline Arguments388811 -Node: Searching389871 -Node: Readline Init File392117 -Node: Readline Init File Syntax393423 -Node: Conditional Init Constructs420251 -Node: Sample Init File424639 -Node: Bindable Readline Commands427762 -Node: Commands For Moving429303 -Node: Commands For History431674 -Node: Commands For Text437067 -Node: Commands For Killing441195 -Node: Numeric Arguments443986 -Node: Commands For Completion445141 -Node: Keyboard Macros450840 -Node: Miscellaneous Commands451544 -Node: Readline vi Mode458114 -Node: Programmable Completion459094 -Node: Programmable Completion Builtins467834 -Node: A Programmable Completion Example479574 -Node: Using History Interactively484922 -Node: Bash History Facilities485606 -Node: Bash History Builtins489344 -Node: History Interaction495818 -Node: Event Designators500771 -Node: Word Designators502352 -Node: Modifiers504659 -Node: Installing Bash506599 -Node: Basic Installation507718 -Node: Compilers and Options511597 -Node: Compiling For Multiple Architectures512350 -Node: Installation Names514106 -Node: Specifying the System Type516343 -Node: Sharing Defaults517092 -Node: Operation Controls517809 -Node: Optional Features518831 -Node: Reporting Bugs531214 -Node: Major Differences From The Bourne Shell532574 -Node: GNU Free Documentation License553997 -Node: Indexes579177 -Node: Builtin Index579631 -Node: Reserved Word Index586732 -Node: Variable Index589180 -Node: Function Index606596 -Node: Concept Index620594 +Node: Command Substitution102449 +Node: Arithmetic Expansion105981 +Node: Process Substitution106998 +Node: Word Splitting108109 +Node: Filename Expansion110556 +Node: Pattern Matching113783 +Node: Quote Removal119509 +Node: Redirections119816 +Node: Executing Commands130082 +Node: Simple Command Expansion130752 +Node: Command Search and Execution132863 +Node: Command Execution Environment135310 +Node: Environment138761 +Node: Exit Status140667 +Node: Signals142728 +Node: Shell Scripts147660 +Node: Shell Builtin Commands150961 +Node: Bourne Shell Builtins153075 +Node: Bash Builtins179642 +Node: Modifying Shell Behavior216569 +Node: The Set Builtin216914 +Node: The Shopt Builtin228905 +Node: Special Builtins245960 +Node: Shell Variables246952 +Node: Bourne Shell Variables247389 +Node: Bash Variables249900 +Node: Bash Features288808 +Node: Invoking Bash289825 +Node: Bash Startup Files296412 +Node: Interactive Shells301657 +Node: What is an Interactive Shell?302068 +Node: Is this Shell Interactive?302733 +Node: Interactive Shell Behavior303560 +Node: Bash Conditional Expressions307324 +Node: Shell Arithmetic312538 +Node: Aliases315870 +Node: Arrays319007 +Node: The Directory Stack326102 +Node: Directory Stack Builtins326902 +Node: Controlling the Prompt331350 +Node: The Restricted Shell334238 +Node: Bash POSIX Mode337123 +Node: Shell Compatibility Mode355187 +Node: Job Control364197 +Node: Job Control Basics364657 +Node: Job Control Builtins370938 +Node: Job Control Variables377623 +Node: Command Line Editing378857 +Node: Introduction and Notation380563 +Node: Readline Interaction382918 +Node: Readline Bare Essentials384109 +Node: Readline Movement Commands385920 +Node: Readline Killing Commands386919 +Node: Readline Arguments388945 +Node: Searching390005 +Node: Readline Init File392251 +Node: Readline Init File Syntax393557 +Node: Conditional Init Constructs420385 +Node: Sample Init File424773 +Node: Bindable Readline Commands427896 +Node: Commands For Moving429437 +Node: Commands For History431808 +Node: Commands For Text437201 +Node: Commands For Killing441329 +Node: Numeric Arguments444120 +Node: Commands For Completion445275 +Node: Keyboard Macros450974 +Node: Miscellaneous Commands451678 +Node: Readline vi Mode458248 +Node: Programmable Completion459228 +Node: Programmable Completion Builtins467968 +Node: A Programmable Completion Example479708 +Node: Using History Interactively485056 +Node: Bash History Facilities485740 +Node: Bash History Builtins489478 +Node: History Interaction495952 +Node: Event Designators500905 +Node: Word Designators502486 +Node: Modifiers504881 +Node: Installing Bash506821 +Node: Basic Installation507940 +Node: Compilers and Options511819 +Node: Compiling For Multiple Architectures512572 +Node: Installation Names514328 +Node: Specifying the System Type516565 +Node: Sharing Defaults517314 +Node: Operation Controls518031 +Node: Optional Features519053 +Node: Reporting Bugs531436 +Node: Major Differences From The Bourne Shell532796 +Node: GNU Free Documentation License554219 +Node: Indexes579399 +Node: Builtin Index579853 +Node: Reserved Word Index586954 +Node: Variable Index589402 +Node: Function Index606818 +Node: Concept Index620816  End Tag Table diff --git a/doc/bashref.texi b/doc/bashref.texi index fdb1047a..55c4d3c4 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -2583,11 +2583,9 @@ array in turn, and the expansion is the resultant list. @itemx $@{@var{parameter}//@var{pattern}/@var{string}@} @itemx $@{@var{parameter}/#@var{pattern}/@var{string}@} @itemx $@{@var{parameter}/%@var{pattern}/@var{string}@} -The @var{pattern} is expanded to produce a pattern just as in -filename expansion and matched -against the expanded value of @var{parameter} -according to the rules -described below (@pxref{Pattern Matching}). +The @var{pattern} is expanded to produce a pattern +and matched against the expanded value of @var{parameter} +as described below (@pxref{Pattern Matching}). The longest match of @var{pattern} in the expanded value is replaced with @var{string}. @var{string} undergoes tilde expansion, parameter and variable expansion, @@ -2693,18 +2691,28 @@ array in turn, and the expansion is the resultant list. @itemx $@{@var{parameter},@var{pattern}@} @itemx $@{@var{parameter},,@var{pattern}@} This expansion modifies the case of alphabetic characters in @var{parameter}. -The @var{pattern} is expanded to produce a pattern just as in -filename expansion. -Each character in the expanded value of @var{parameter} is tested against -@var{pattern}, and, if it matches the pattern, its case is converted. +First, the @var{pattern} is expanded to produce a pattern +as described below in @ref{Pattern Matching}. + +@code{Bash} +then examines characters in the expanded value of @var{parameter} +against @var{pattern} as described below. +If a character matches the pattern, its case is converted. The pattern should not attempt to match more than one character. -The @samp{^} operator converts lowercase letters matching @var{pattern} -to uppercase; the @samp{,} operator converts matching uppercase letters -to lowercase. -The @samp{^^} and @samp{,,} expansions convert each matched character in the -expanded value; the @samp{^} and @samp{,} expansions match and convert only -the first character in the expanded value. +Using +@samp{^} +converts lowercase letters matching @var{pattern} to uppercase; +@samp{,} +converts matching uppercase letters to lowercase. +The +@samp{^} and @samp{,} variants +examine the first character in the expanded value +and convert its case if it matches @var{pattern}; +the +@samp{^^} and @samp{,,} variants +examine all characters in the expanded value +and convert each one that matches @var{pattern}. If @var{pattern} is omitted, it is treated like a @samp{?}, which matches every character. diff --git a/doc/builtins.0 b/doc/builtins.0 index 7d31f0aa..dc07b3cb 100644 --- a/doc/builtins.0 +++ b/doc/builtins.0 @@ -642,7 +642,7 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS though the shell normally searches for builtins before files. If --nn is supplied, each _n_a_m_e is disabled; otherwise, _n_a_m_es are - enabled. For example, to use the tteesstt binary found usin g PPAATTHH + enabled. For example, to use the tteesstt binary found using PPAATTHH instead of the shell builtin version, run If no _n_a_m_e arguments are supplied, or if the --pp option is sup- @@ -1618,7 +1618,6 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS ccoommppaatt4422 ccoommppaatt4433 ccoommppaatt4444 - ccoommppaatt5500 These control aspects of the shell's compatibility mode (see SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE in _b_a_s_h(1)). ccoommpplleettee__ffuullllqquuoottee diff --git a/eval.c b/eval.c index 0fc6cfca..926aeee0 100644 --- a/eval.c +++ b/eval.c @@ -95,7 +95,11 @@ reader_loop (void) { /* Some kind of throw to top_level has occurred. */ case ERREXIT: - if (exit_immediately_on_error) + /* POSIX says to exit on error "as if by executing the + exit special built-in utility with no arguments," so we + don't reset any local contexts and keep the execution + context in a shell function if we were executing one. */ + if (exit_immediately_on_error && posixly_correct == 0) reset_local_contexts (); /* not in a function */ case FORCE_EOF: case EXITPROG: diff --git a/lib/readline/display.c b/lib/readline/display.c index f0023692..dcc5e806 100644 --- a/lib/readline/display.c +++ b/lib/readline/display.c @@ -1489,7 +1489,7 @@ rl_redisplay (void) but the buffer position needs to be adjusted to account for invisible characters. */ if ((mb_cur_max == 1 || rl_byte_oriented) && cursor_linenum == prompt_last_screen_line) - _rl_last_c_pos = physpos + WRAP_OFFSET (cursor_linenum, wrap_offset);; + _rl_last_c_pos = physpos + WRAP_OFFSET (cursor_linenum, wrap_offset); } /* Now we move the cursor to where it needs to be. First, make @@ -1502,28 +1502,53 @@ rl_redisplay (void) invisible character in the prompt string. */ /* XXX - why not use local_prompt_len? */ nleft = prompt_visible_length + wrap_offset; - if (cursor_linenum == prompt_last_screen_line && wrap_offset > 0 && - _rl_last_c_pos > 0 && local_prompt && - _rl_last_c_pos < PROMPT_ENDING_INDEX) + if (cursor_linenum == prompt_last_screen_line) { - int pmt_offset; - - _rl_cr (); - if (modmark) - _rl_output_some_chars ("*", 1); - - /* If the number of characters in local_prompt is greater than - the screen width, the prompt wraps. We only want to print the - portion after the line wrap. */ - pmt_offset = local_prompt_newlines[cursor_linenum]; - if (cursor_linenum > 0 && pmt_offset > 0 && nleft > pmt_offset) - _rl_output_some_chars (local_prompt + pmt_offset, nleft - pmt_offset); - else - _rl_output_some_chars (local_prompt, nleft); - if (mb_cur_max > 1 && rl_byte_oriented == 0) - _rl_last_c_pos = _rl_col_width (local_prompt, 0, nleft, 1) - wrap_offset + modmark; + int pmt_offset = local_prompt_newlines ? local_prompt_newlines[cursor_linenum] : 0; + int curline_invchars = local_prompt_invis_chars ? local_prompt_invis_chars[cursor_linenum] : wrap_offset; + int cursor_bufpos; + + /* cursor_bufpos is where the portion of the prompt that appears + on the current screen line begins in the buffer. It is a + buffer position, an index into curline + (local_prompt + pmt_offset) */ + cursor_bufpos = pmt_offset; + if (mb_cur_max == 1 || rl_byte_oriented) + cursor_bufpos += _rl_last_c_pos; else - _rl_last_c_pos = nleft + modmark; /* buffer position */ + cursor_bufpos += _rl_last_c_pos + curline_invchars; + + if (local_prompt && local_prompt_invis_chars[cursor_linenum] && + _rl_last_c_pos > 0 && + cursor_bufpos <= prompt_last_invisible) + { + _rl_cr (); + if (modmark) + _rl_output_some_chars ("*", 1); + + /* If the number of characters in local_prompt is greater + than the screen width, the prompt wraps. We only want to + print the portion after the line wrap. */ + + /* Make sure we set _rl_last_c_pos based on the number of + characters we actually output, since we start at column 0. */ + if (cursor_linenum > 0 && pmt_offset > 0 && nleft > pmt_offset) + _rl_output_some_chars (local_prompt + pmt_offset, nleft - pmt_offset); + else + { + _rl_output_some_chars (local_prompt, nleft); + pmt_offset = 0; /* force for calculation below */ + } + + if (mb_cur_max > 1 && rl_byte_oriented == 0) + /* Start width calculation where we started output. */ + _rl_last_c_pos = _rl_col_width (local_prompt, pmt_offset, nleft, 1) - WRAP_OFFSET(cursor_linenum, wrap_offset) + modmark; + else + /* Index into invisible_line+inv_lbreaks[cursor_linenum], + since that's what we use in the call to + _rl_move_cursor_relative below. */ + _rl_last_c_pos = nleft + modmark - inv_lbreaks[cursor_linenum]; /* buffer position */ + } } /* Where on that line? And where does that line start diff --git a/lib/readline/doc/hsuser.texi b/lib/readline/doc/hsuser.texi index a53d5575..5bce1c3d 100644 --- a/lib/readline/doc/hsuser.texi +++ b/lib/readline/doc/hsuser.texi @@ -504,6 +504,8 @@ It may be omitted if the word designator begins with a @samp{^}, @samp{$}, @samp{*}, @samp{-}, or @samp{%}. Words are numbered from the beginning of the line, with the first word being denoted by 0 (zero). +That first word is usually the command word, and the arguments begin +with the second word. Words are inserted into the current line separated by single spaces. @need 0.75 @@ -515,7 +517,7 @@ designates the preceding command. When you type this, the preceding command is repeated in toto. @item !!:$ -designates the last argument of the preceding command. +designates the last word of the preceding command. This may be shortened to @code{!$}. @item !fi:2 diff --git a/parse.y b/parse.y index 96bbd024..90436220 100644 --- a/parse.y +++ b/parse.y @@ -6510,7 +6510,13 @@ decode_prompt_string (char *string, int is_prompt) case 'u': if (current_user.user_name == 0) get_current_user_info (); - temp = savestring (current_user.user_name); + if (promptvars || posixly_correct) + /* Make sure that expand_prompt_string is called with a + second argument of Q_DOUBLE_QUOTES if we use this + function here. */ + temp = sh_backslash_quote_for_double_quotes (current_user.user_name, 0); + else + temp = savestring (current_user.user_name); goto add_string; case 'h': diff --git a/subst.c b/subst.c index 5c0cd844..5f4dfc75 100644 --- a/subst.c +++ b/subst.c @@ -7494,9 +7494,16 @@ array_length_reference (const char *s) failure. */ if ((var == 0 || invisible_p (var) || (assoc_p (var) == 0 && array_p (var) == 0)) && unbound_vars_is_error) { + set_exit_status (EXECUTION_FAILURE); +#if 1 + /* If the array isn't subscripted with `@' or `*', it's an error. */ + if (ALL_ELEMENT_SUB (t[0]) == 0 || t[1] != RBRACK) + return (INTMAX_MIN); /* caller prints error */ +#endif + /* If the variable is subscripted with `@' or `*', ksh93 allows it to + return 0. We treat it as a non-fatal error. */ c = *--t; *t = '\0'; - set_exit_status (EXECUTION_FAILURE); err_unboundvar (s); *t = c; return (-1); @@ -7521,6 +7528,8 @@ array_length_reference (const char *s) return (var_isset (var) ? 1 : 0); } + /* If an array variable is set, length expansions for unset elements + return 0. This is compatible with ksh93. */ if (assoc_p (var)) { t[len - 1] = '\0'; diff --git a/tests/comsub2.right b/tests/comsub2.right index 29a333b0..e9427012 100644 --- a/tests/comsub2.right +++ b/tests/comsub2.right @@ -23,27 +23,27 @@ JOBaa bb cc ddCONTROL NOTFOUND ./comsub2.tests: line 75: p: command not found ./comsub2.tests: line 75: p: command not found -expand_aliases off -expand_aliases off +expand_aliases off +expand_aliases off outside: ./comsub2.tests: line 79: alias: p: not found alias e='echo inside redefine' -expand_aliases off +expand_aliases off 1 -expand_aliases on +expand_aliases on 2 -expand_aliases on +expand_aliases on outside: ./comsub2.tests: line 89: alias: p: not found -expand_aliases on +expand_aliases on 1 xx -expand_aliases on +expand_aliases on 2 xx -expand_aliases on +expand_aliases on outside: -expand_aliases on +expand_aliases on inside: 12 22 42 outside: 42 2 newlines diff --git a/tests/exec.right b/tests/exec.right index ba5ae890..d584d805 100644 --- a/tests/exec.right +++ b/tests/exec.right @@ -79,7 +79,7 @@ this is ohio-state 1 0 testb -expand_aliases on +expand_aliases on 1 1 1 diff --git a/tests/extglob.right b/tests/extglob.right index 59faee10..e01a60fb 100644 --- a/tests/extglob.right +++ b/tests/extglob.right @@ -182,10 +182,10 @@ no dotglob: .a .foo bar ? . .. .a .foo * bar -extglob off +extglob off x -extglob off -extglob off -extglob off -extglob off -extglob off +extglob off +extglob off +extglob off +extglob off +extglob off diff --git a/tests/shopt.right b/tests/shopt.right index bbbc439c..2d47b575 100644 --- a/tests/shopt.right +++ b/tests/shopt.right @@ -126,51 +126,51 @@ shopt -u shift_verbose shopt -u varredir_close shopt -u xpg_echo -- -array_expand_once off -assoc_expand_once off -autocd off -bash_source_fullpath off -cdable_vars off -checkhash off -checkjobs off -checkwinsize off -compat31 off -compat32 off -compat40 off -compat41 off -compat42 off -compat43 off -compat44 off -direxpand off -dirspell off -dotglob off -execfail off -extdebug off -extglob off -failglob off -globstar off -gnu_errfmt off -histappend off -histreedit off -histverify off -huponexit off -inherit_errexit off -lastpipe off -lithist off -localvar_inherit off -localvar_unset off -login_shell off -mailwarn off -no_empty_cmd_completion off -nocaseglob off -nocasematch off -noexpand_translation off -nullglob off -progcomp_alias off -restricted_shell off -shift_verbose off -varredir_close off -xpg_echo off +array_expand_once off +assoc_expand_once off +autocd off +bash_source_fullpath off +cdable_vars off +checkhash off +checkjobs off +checkwinsize off +compat31 off +compat32 off +compat40 off +compat41 off +compat42 off +compat43 off +compat44 off +direxpand off +dirspell off +dotglob off +execfail off +extdebug off +extglob off +failglob off +globstar off +gnu_errfmt off +histappend off +histreedit off +histverify off +huponexit off +inherit_errexit off +lastpipe off +lithist off +localvar_inherit off +localvar_unset off +login_shell off +mailwarn off +no_empty_cmd_completion off +nocaseglob off +nocasematch off +noexpand_translation off +nullglob off +progcomp_alias off +restricted_shell off +shift_verbose off +varredir_close off +xpg_echo off -- set +o allexport set -o braceexpand @@ -310,5 +310,5 @@ xtrace off -- ./shopt.tests: line 106: shopt: xyz1: invalid shell option name ./shopt.tests: line 107: shopt: xyz1: invalid option name -expand_aliases on -expand_aliases on +expand_aliases on +expand_aliases on diff --git a/tests/varenv.right b/tests/varenv.right index e0189681..4ed1e04a 100644 --- a/tests/varenv.right +++ b/tests/varenv.right @@ -270,9 +270,9 @@ declare -x v="x" declare -x v="t" declare -- v declare -x v -ignoreeof on -ignoreeof off -ignoreeof on +ignoreeof on +ignoreeof off +ignoreeof on 10 local - match 1