From: Chet Ramey Date: Tue, 8 Oct 2024 13:52:21 +0000 (-0400) Subject: First set of documentation updates to man page, texinfo manual X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9d1eb43fdd363137dd687bc411b14ab4946f939c;p=thirdparty%2Fbash.git First set of documentation updates to man page, texinfo manual --- diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 6291e6ae..0ae88c93 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -10282,3 +10282,10 @@ variables.c doc/bashref.texi - --enable-bash-source-default: document + + 9/27 + ---- +doc/bash.1,doc/bashref.texi + - update builtins documenation: make language and paragraph breaks + more consistent between the document formats; update active + language diff --git a/INSTALL b/INSTALL index f2e66b22..31aa6a2b 100644 --- a/INSTALL +++ b/INSTALL @@ -24,8 +24,8 @@ The simplest way to compile Bash is: files, some supplemental documentation, a number of example loadable builtin commands, and a set of header files for developing loadable builtins. You may need additional privileges to install - ‘bash’ to your desired destination, so ‘sudo make install’ might be - required. More information about controlling the locations where + ‘bash’ to your desired destination, which may require ‘sudo make + install’. More information about controlling the locations where ‘bash’ and other files are installed is below (*note Installation Names::). @@ -228,7 +228,7 @@ Optional Features The Bash ‘configure’ has a number of ‘--enable-FEATURE’ options, where FEATURE indicates an optional part of Bash. There are also several ‘--with-PACKAGE’ options, where PACKAGE is something like ‘bash-malloc’ -or ‘purify’. To turn off the default use of a package, use +or ‘afs’. To turn off the default use of a package, use ‘--without-PACKAGE’. To configure Bash without a feature that is enabled by default, use ‘--disable-FEATURE’. @@ -240,18 +240,18 @@ the Bash ‘configure’ recognizes. ‘--with-bash-malloc’ Use the Bash version of ‘malloc’ in the directory ‘lib/malloc’. - This is not the same ‘malloc’ that appears in GNU libc, but an - older version originally derived from the 4.2 BSD ‘malloc’. This - ‘malloc’ is very fast, but wastes some space on each allocation. - This option is enabled by default. The ‘NOTES’ file contains a - list of systems for which this should be turned off, and - ‘configure’ disables this option automatically for a number of - systems. + This is not the same ‘malloc’ that appears in GNU libc, but a + custom version originally derived from the 4.2 BSD ‘malloc’. This + ‘malloc’ is very fast, but wastes some space on each allocation, + though it uses several techniques to minimize the waste. This + option is enabled by default. The ‘NOTES’ file contains a list of + systems for which this should be turned off, and ‘configure’ + disables this option automatically for a number of systems. ‘--with-curses’ - Use the curses library instead of the termcap library. This should - be supplied if your system has an inadequate or incomplete termcap - database. + Use the curses library instead of the termcap library. ‘configure’ + usually chooses this automatically, since most systems include the + termcap functions in the curses library. ‘--with-gnu-malloc’ A synonym for ‘--with-bash-malloc’. @@ -268,7 +268,9 @@ the Bash ‘configure’ recognizes. set to any other value, ‘configure’ treats it as a directory pathname and looks for the installed version of Readline in subdirectories of that directory (include files in PREFIX/‘include’ - and the library in PREFIX/‘lib’). + and the library in PREFIX/‘lib’). The Bash default is to link with + a static library built in the ‘lib/readline’ subdirectory of the + build directory. ‘--with-libintl-prefix[=PREFIX]’ Define this to make Bash link with a locally-installed version of @@ -276,10 +278,11 @@ the Bash ‘configure’ recognizes. ‘--with-libiconv-prefix[=PREFIX]’ Define this to make Bash look for libiconv in PREFIX instead of the - standard system locations. There is no version included with Bash. + standard system locations. The Bash distribution does not include + this library. ‘--enable-minimal-config’ - This produces a shell with minimal features, close to the + This produces a shell with minimal features, closer to the historical Bourne shell. There are several ‘--enable-’ options that alter how Bash is compiled, @@ -336,6 +339,12 @@ does not provide the necessary support. Include support for ‘csh’-like history substitution (*note History Interaction::). +‘--enable-bash-source-fullpath-default’ + Set the default value of the ‘bash_source_fullpath’ shell option + described above under *note The Shopt Builtin:: to be enabled. + This controls how filenames are assigned to the ‘BASH_SOURCE’ array + variable. + ‘--enable-brace-expansion’ Include ‘csh’-like brace expansion ( ‘b{a,b}c’ ↦ ‘bac bbc’ ). See *note Brace Expansion::, for a complete description. @@ -352,8 +361,9 @@ does not provide the necessary support. ‘--enable-command-timing’ Include support for recognizing ‘time’ as a reserved word and for displaying timing statistics for the pipeline following ‘time’ - (*note Pipelines::). This allows pipelines as well as shell - builtins and functions to be timed. + (*note Pipelines::). This allows timing pipelines, shell compound + commands, shell builtins, and shell functions, which an external + command cannot do easily. ‘--enable-cond-command’ Include support for the ‘[[’ conditional command. (*note @@ -456,13 +466,13 @@ does not provide the necessary support. version of the Readline library (*note Command Line Editing::). ‘--enable-restricted’ - Include support for a “restricted shell”. If this is enabled, - Bash, when called as ‘rbash’, enters a restricted mode. See *note - The Restricted Shell::, for a description of restricted mode. + Include support for a “restricted shell”. If this is enabled, Bash + enters a restricted mode when called as ‘rbash’. See *note The + Restricted Shell::, for a description of restricted mode. ‘--enable-select’ - Include the ‘select’ compound command, which allows the generation - of simple menus (*note Conditional Constructs::). + Include the ‘select’ compound command, which allows generation of + simple menus (*note Conditional Constructs::). ‘--enable-single-help-strings’ Store the text displayed by the ‘help’ builtin as a single string diff --git a/RBASH b/RBASH index 8dc5d3cb..fedcd315 100644 --- a/RBASH +++ b/RBASH @@ -2,7 +2,7 @@ ========================= If Bash is started with the name ‘rbash’, or the ‘--restricted’ or ‘-r’ -option is supplied at invocation, the shell becomes restricted. A +option is supplied at invocation, the shell becomes RESTRICTED. A restricted shell is used to set up an environment more controlled than the standard shell. A restricted shell behaves identically to ‘bash’ with the exception that the following are disallowed or not performed: @@ -13,6 +13,8 @@ with the exception that the following are disallowed or not performed: • Specifying command names containing slashes. • Specifying a filename containing a slash as an argument to the ‘.’ builtin command. + • Using the ‘-p’ option to the ‘.’ builtin command to specify a + search path. • Specifying a filename containing a slash as an argument to the ‘history’ builtin command. • Specifying a filename containing a slash as an argument to the ‘-p’ diff --git a/builtins/cd.def b/builtins/cd.def index ce2a002a..5b39cb52 100644 --- a/builtins/cd.def +++ b/builtins/cd.def @@ -427,6 +427,7 @@ cd_builtin (WORD_LIST *list) builtin_error ("%s: %s", temp, strerror (e)); if (temp != dirname) free (temp); + /* posix says to return >1 if eflag && no_symlinks?? */ return (EXECUTION_FAILURE); } diff --git a/builtins/declare.def b/builtins/declare.def index 91f2b27d..8f7f4834 100644 --- a/builtins/declare.def +++ b/builtins/declare.def @@ -112,6 +112,9 @@ Define local variables. Create a local variable called NAME, and give it VALUE. OPTION can be any option accepted by `declare'. +If any NAME is "-", local saves the set of shell options and restores +them when the function returns. + Local variables can only be used within a function; they are visible only to the function where they are defined and its children. diff --git a/doc/bash.0 b/doc/bash.0 index 384e2ea1..c2f6d742 100644 --- a/doc/bash.0 +++ b/doc/bash.0 @@ -1,3 +1,4 @@ + _B_A_S_H(1) General Commands Manual _B_A_S_H(1) NNAAMMEE @@ -11,8 +12,9 @@ CCOOPPYYRRIIGGHHTT DDEESSCCRRIIPPTTIIOONN BBaasshh is an sshh-compatible command language interpreter that executes - commands read from the standard input or from a file. BBaasshh also incor- - porates useful features from the _K_o_r_n and _C shells (kksshh and ccsshh). + commands read from the standard input, from a string, or from a file. + BBaasshh also incorporates useful features from the _K_o_r_n and _C shells (kksshh + and ccsshh). POSIX is the name for a family of computing standards based on Unix. BBaasshh is intended to be a conformant implementation of the Shell and @@ -31,29 +33,36 @@ OOPPTTIIOONNSS signed to $$00 and any remaining arguments are assigned to the positional parameters. The assignment to $$00 sets the name of the shell, which is used in warning and error messages. + --ii If the --ii option is present, the shell is _i_n_t_e_r_a_c_t_i_v_e. + --ll Make bbaasshh act as if it had been invoked as a login shell (see IINNVVOOCCAATTIIOONN below). + --rr If the --rr option is present, the shell becomes _r_e_s_t_r_i_c_t_e_d (see RREESSTTRRIICCTTEEDD SSHHEELLLL below). + --ss If the --ss option is present, or if no arguments remain after - option processing, then commands are read from the standard - input. This option allows the positional parameters to be - set when invoking an interactive shell or when reading input + option processing, the shell reads commands from the standard + input. This option allows the positional parameters to be + set when invoking an interactive shell or when reading input through a pipe. - --DD A list of all double-quoted strings preceded by $$ is printed - on the standard output. These are the strings that are sub- - ject to language translation when the current locale is not CC - or PPOOSSIIXX. This implies the --nn option; no commands will be - executed. + + --DD Print a list of all double-quoted strings preceded by $$ on + the standard output. These are the strings that are subject + to language translation when the current locale is not CC or + PPOOSSIIXX. This implies the --nn option; no commands will be exe- + cuted. + [[--++]]OO [[_s_h_o_p_t___o_p_t_i_o_n]] _s_h_o_p_t___o_p_t_i_o_n is one of the shell options accepted by the sshhoopptt builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). If _s_h_o_p_t___o_p_t_i_o_n is present, --OO sets the value of that option; ++OO - unsets it. If _s_h_o_p_t___o_p_t_i_o_n is not supplied, the names and - values of the shell options accepted by sshhoopptt are printed on + unsets it. If _s_h_o_p_t___o_p_t_i_o_n is not supplied, bbaasshh prints the + names and values of the shell options accepted by sshhoopptt on the standard output. If the invocation option is ++OO, the output is displayed in a format that may be reused as input. + ---- A ---- signals the end of options and disables further option processing. Any arguments after the ---- are treated as a shell script filename (see below) and arguments passed to @@ -67,13 +76,17 @@ OOPPTTIIOONNSS Arrange for the debugger profile to be executed before the shell starts. Turns on extended debugging mode (see the description of the eexxttddeebbuugg option to the sshhoopptt builtin below). + ----dduummpp--ppoo--ssttrriinnggss Equivalent to --DD, but the output is in the GNU _g_e_t_t_e_x_t ppoo (portable object) file format. + ----dduummpp--ssttrriinnggss Equivalent to --DD. + ----hheellpp Display a usage message on standard output and exit success- fully. + ----iinniitt--ffiillee _f_i_l_e ----rrccffiillee _f_i_l_e Execute commands from _f_i_l_e instead of the standard personal ini- @@ -122,9 +135,9 @@ AARRGGUUMMEENNTTSS sitional parameters are set to the remaining arguments. BBaasshh reads and executes commands from this file, then exits. BBaasshh's exit status is the exit status of the last command executed in the script. If no com- - mands are executed, the exit status is 0. An attempt is first made to - open the file in the current directory, and, if no file is found, then - the shell searches the directories in PPAATTHH for the script. + mands are executed, the exit status is 0. Bash first attempts to open + the file in the current directory, and, if no file is found, then + searches the directories in PPAATTHH for the script. IINNVVOOCCAATTIIOONN A _l_o_g_i_n _s_h_e_l_l is one whose first character of argument zero is a --, or @@ -132,42 +145,42 @@ IINNVVOOCCAATTIIOONN An _i_n_t_e_r_a_c_t_i_v_e shell is one started without non-option arguments (un- less --ss is specified) and without the --cc option, whose standard input - and error are both connected to terminals (as determined by _i_s_a_t_t_y(3)), - or one started with the --ii option. PPSS11 is set and $$-- includes ii if - bbaasshh is interactive, allowing a shell script or a startup file to test - this state. - - The following paragraphs describe how bbaasshh executes its startup files. - If any of the files exist but cannot be read, bbaasshh reports an error. - Tildes are expanded in filenames as described below under TTiillddee EExxppaann-- + and standard error are both connected to terminals (as determined by + _i_s_a_t_t_y(3)), or one started with the --ii option. BBaasshh sets PPSS11 and $$-- + includes ii if the shell is interactive, so a shell script or a startup + file can test this state. + + The following paragraphs describe how bbaasshh executes its startup files. + If any of the files exist but cannot be read, bbaasshh reports an error. + Tildes are expanded in filenames as described below under TTiillddee EExxppaann-- ssiioonn in the EEXXPPAANNSSIIOONN section. - When bbaasshh is invoked as an interactive login shell, or as a non-inter- - active shell with the ----llooggiinn option, it first reads and executes com- - mands from the file _/_e_t_c_/_p_r_o_f_i_l_e, if that file exists. After reading + When bbaasshh is invoked as an interactive login shell, or as a non-inter- + active shell with the ----llooggiinn option, it first reads and executes com- + mands from the file _/_e_t_c_/_p_r_o_f_i_l_e, if that file exists. After reading that file, it looks for _~_/_._b_a_s_h___p_r_o_f_i_l_e, _~_/_._b_a_s_h___l_o_g_i_n, and _~_/_._p_r_o_f_i_l_e, - in that order, and reads and executes commands from the first one that - exists and is readable. The ----nnoopprrooffiillee option may be used when the + in that order, and reads and executes commands from the first one that + exists and is readable. The ----nnoopprrooffiillee option may be used when the shell is started to inhibit this behavior. When an interactive login shell exits, or a non-interactive login shell - executes the eexxiitt builtin command, bbaasshh reads and executes commands + executes the eexxiitt builtin command, bbaasshh reads and executes commands from the file _~_/_._b_a_s_h___l_o_g_o_u_t, if it exists. - When an interactive shell that is not a login shell is started, bbaasshh - reads and executes commands from _~_/_._b_a_s_h_r_c, if that file exists. This - may be inhibited by using the ----nnoorrcc option. The ----rrccffiillee _f_i_l_e option - will cause bbaasshh to use _f_i_l_e instead of _~_/_._b_a_s_h_r_c. + When an interactive shell that is not a login shell is started, bbaasshh + reads and executes commands from _~_/_._b_a_s_h_r_c, if that file exists. This + may be inhibited by using the ----nnoorrcc option. The ----rrccffiillee _f_i_l_e option + causes bbaasshh to use _f_i_l_e instead of _~_/_._b_a_s_h_r_c. - When bbaasshh is started non-interactively, to run a shell script, for ex- - ample, it looks for the variable BBAASSHH__EENNVV in the environment, expands - its value if it appears there, and uses the expanded value as the name - of a file to read and execute. BBaasshh behaves as if the following com- + When bbaasshh is started non-interactively, to run a shell script, for ex- + ample, it looks for the variable BBAASSHH__EENNVV in the environment, expands + its value if it appears there, and uses the expanded value as the name + of a file to read and execute. BBaasshh behaves as if the following com- mand were executed: if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi - but the value of the PPAATTHH variable is not used to search for the file- + but does not use the value of the PPAATTHH variable to search for the file- name. If bbaasshh is invoked with the name sshh, it tries to mimic the startup be- @@ -187,20 +200,20 @@ IINNVVOOCCAATTIIOONN When bbaasshh is started in _p_o_s_i_x mode, as with the ----ppoossiixx command line option, it follows the POSIX standard for startup files. In this mode, - interactive shells expand the EENNVV variable and commands are read and - executed from the file whose name is the expanded value. No other - startup files are read. + interactive shells expand the EENNVV variable and read and execute com- + mands from the file whose name is the expanded value. No other startup + files are read. BBaasshh attempts to determine when it is being run with its standard input - connected to a network connection, as when executed by the historical - remote shell daemon, usually _r_s_h_d, or the secure shell daemon _s_s_h_d. If - bbaasshh determines it is being run non-interactively in this fashion, it - reads and executes commands from _~_/_._b_a_s_h_r_c, if that file exists and is - readable. It will not do this if invoked as sshh. The ----nnoorrcc option may - be used to inhibit this behavior, and the ----rrccffiillee option will make - bbaasshh use a different file instead of _~_/_._b_a_s_h_r_c, but neither _r_s_h_d nor - _s_s_h_d generally invoke the shell with those options or allow them to be - specified. + connected to a network connection, as when executed by the historical + and rarely-seen remote shell daemon, usually _r_s_h_d, or the secure shell + daemon _s_s_h_d. If bbaasshh determines it is being run non-interactively in + this fashion, it reads and executes commands from _~_/_._b_a_s_h_r_c, if that + file exists and is readable. It will not do this if invoked as sshh. + The ----nnoorrcc option may be used to inhibit this behavior, and the ----rrcc-- + ffiillee option will make bbaasshh use a different file instead of _~_/_._b_a_s_h_r_c, + but neither _r_s_h_d nor _s_s_h_d generally invoke the shell with those options + or allow them to be specified. If the shell is started with the effective user (group) id not equal to the real user (group) id, and the --pp option is not supplied, no startup @@ -260,171 +273,175 @@ SSHHEELLLL GGRRAAMMMMAARR The standard output of _c_o_m_m_a_n_d_1 is connected via a pipe to the standard input of _c_o_m_m_a_n_d_2. This connection is performed before any redirec- - tions specified by the _c_o_m_m_a_n_d_1(see RREEDDIIRREECCTTIIOONN below). If ||&& is used, - _c_o_m_m_a_n_d_1's standard error, in addition to its standard output, is con- - nected to _c_o_m_m_a_n_d_2's standard input through the pipe; it is shorthand - for 22>>&&11 ||. This implicit redirection of the standard error to the - standard output is performed after any redirections specified by _c_o_m_- - _m_a_n_d_1. + tions specified by the _c_o_m_m_a_n_d_1(see RREEDDIIRREECCTTIIOONN below). If ||&& is the + pipeline operator, _c_o_m_m_a_n_d_1's standard error, in addition to its stan- + dard output, is connected to _c_o_m_m_a_n_d_2's standard input through the + pipe; it is shorthand for 22>>&&11 ||. This implicit redirection of the + standard error to the standard output is performed after any redirec- + tions specified by _c_o_m_m_a_n_d_1. The return status of a pipeline is the exit status of the last command, - unless the ppiippeeffaaiill option is enabled. If ppiippeeffaaiill is enabled, the - pipeline's return status is the value of the last (rightmost) command - to exit with a non-zero status, or zero if all commands exit success- + unless the ppiippeeffaaiill option is enabled. If ppiippeeffaaiill is enabled, the + pipeline's return status is the value of the last (rightmost) command + to exit with a non-zero status, or zero if all commands exit success- fully. If the reserved word !! precedes a pipeline, the exit status of - that pipeline is the logical negation of the exit status as described - above. The shell waits for all commands in the pipeline to terminate - before returning a value. - - If the ttiimmee reserved word precedes a pipeline, the elapsed as well as - user and system time consumed by its execution are reported when the - pipeline terminates. The --pp option changes the output format to that - specified by POSIX. When the shell is in _p_o_s_i_x _m_o_d_e, it does not rec- - ognize ttiimmee as a reserved word if the next token begins with a "-". - The TTIIMMEEFFOORRMMAATT variable may be set to a format string that specifies - how the timing information should be displayed; see the description of - TTIIMMEEFFOORRMMAATT under SShheellll VVaarriiaabblleess below. + that pipeline is the logical negation of the exit status as described + above. If a pipeline is executed synchronously, the shell waits for + all commands in the pipeline to terminate before returning a value. + + If the ttiimmee reserved word precedes a pipeline, the shell reports the + elapsed as well as user and system time consumed by its execution when + the pipeline terminates. The --pp option changes the output format to + that specified by POSIX. When the shell is in _p_o_s_i_x _m_o_d_e, it does not + recognize ttiimmee as a reserved word if the next token begins with a "-". + The value of the TTIIMMEEFFOORRMMAATT variable is a format string that specifies + how the timing information should be displayed; see the description of + TTIIMMEEFFOORRMMAATT below under SShheellll VVaarriiaabblleess. When the shell is in _p_o_s_i_x _m_o_d_e, ttiimmee may be followed by a newline. In - this case, the shell displays the total user and system time consumed - by the shell and its children. The TTIIMMEEFFOORRMMAATT variable specifies the + this case, the shell displays the total user and system time consumed + by the shell and its children. The TTIIMMEEFFOORRMMAATT variable specifies the format of the time information. - Each command in a multi-command pipeline, where pipes are created, is - executed in a _s_u_b_s_h_e_l_l, which is a separate process. See CCOOMMMMAANNDD EEXXEE-- - CCUUTTIIOONN EENNVVIIRROONNMMEENNTT for a description of subshells and a subshell envi- - ronment. If the llaassttppiippee option is enabled using the sshhoopptt builtin - (see the description of sshhoopptt below), the last element of a pipeline - may be run by the shell process when job control is not active. + Each command in a multi-command pipeline, where pipes are created, is + executed in a _s_u_b_s_h_e_l_l, which is a separate process. See CCOOMMMMAANNDD EEXXEE-- + CCUUTTIIOONN EENNVVIIRROONNMMEENNTT for a description of subshells and a subshell envi- + ronment. If the llaassttppiippee option is enabled using the sshhoopptt builtin + (see the description of sshhoopptt below), and job control is not active, + the last element of a pipeline may be run by the shell process. LLiissttss - A _l_i_s_t is a sequence of one or more pipelines separated by one of the + A _l_i_s_t is a sequence of one or more pipelines separated by one of the operators ;;, &&, &&&&, or ||||, and optionally terminated by one of ;;, &&, or <>. Of these list operators, &&&& and |||| have equal precedence, followed by ;; and &&, which have equal precedence. - A sequence of one or more newlines may appear in a _l_i_s_t instead of a + A sequence of one or more newlines may appear in a _l_i_s_t instead of a semicolon to delimit commands. - If a command is terminated by the control operator &&, the shell exe- - cutes the command in the _b_a_c_k_g_r_o_u_n_d in a subshell. The shell does not - wait for the command to finish, and the return status is 0. These are - referred to as _a_s_y_n_c_h_r_o_n_o_u_s commands. Commands separated by a ;; are + If a command is terminated by the control operator &&, the shell exe- + cutes the command in the _b_a_c_k_g_r_o_u_n_d in a subshell. The shell does not + wait for the command to finish, and the return status is 0. These are + referred to as _a_s_y_n_c_h_r_o_n_o_u_s commands. Commands separated by a ;; are executed sequentially; the shell waits for each command to terminate in - turn. The return status is the exit status of the last command exe- + turn. The return status is the exit status of the last command exe- cuted. - AND and OR lists are sequences of one or more pipelines separated by - the &&&& and |||| control operators, respectively. AND and OR lists are + AND and OR lists are sequences of one or more pipelines separated by + the &&&& and |||| control operators, respectively. AND and OR lists are executed with left associativity. An AND list has the form _c_o_m_m_a_n_d_1 &&&& _c_o_m_m_a_n_d_2 - _c_o_m_m_a_n_d_2 is executed if, and only if, _c_o_m_m_a_n_d_1 returns an exit status + _c_o_m_m_a_n_d_2 is executed if, and only if, _c_o_m_m_a_n_d_1 returns an exit status of zero (success). An OR list has the form _c_o_m_m_a_n_d_1 |||| _c_o_m_m_a_n_d_2 - _c_o_m_m_a_n_d_2 is executed if, and only if, _c_o_m_m_a_n_d_1 returns a non-zero exit - status. The return status of AND and OR lists is the exit status of + _c_o_m_m_a_n_d_2 is executed if, and only if, _c_o_m_m_a_n_d_1 returns a non-zero exit + status. The return status of AND and OR lists is the exit status of the last command executed in the list. CCoommppoouunndd CCoommmmaannddss - A _c_o_m_p_o_u_n_d _c_o_m_m_a_n_d is one of the following. In most cases a _l_i_s_t in a - command's description may be separated from the rest of the command by - one or more newlines, and may be followed by a newline in place of a + A _c_o_m_p_o_u_n_d _c_o_m_m_a_n_d is one of the following. In most cases a _l_i_s_t in a + command's description may be separated from the rest of the command by + one or more newlines, and may be followed by a newline in place of a semicolon. - (_l_i_s_t) _l_i_s_t is executed in a subshell (see CCOOMMMMAANNDD EEXXEECCUUTTIIOONN EENNVVIIRROONN-- - MMEENNTT below for a description of a subshell environment). Vari- - able assignments and builtin commands that affect the shell's + (_l_i_s_t) _l_i_s_t is executed in a subshell (see CCOOMMMMAANNDD EEXXEECCUUTTIIOONN EENNVVIIRROONN-- + MMEENNTT below for a description of a subshell environment). Vari- + able assignments and builtin commands that affect the shell's environment do not remain in effect after the command completes. The return status is the exit status of _l_i_s_t. { _l_i_s_t; } - _l_i_s_t is simply executed in the current shell environment. _l_i_s_t - must be terminated with a newline or semicolon. This is known - as a _g_r_o_u_p _c_o_m_m_a_n_d. The return status is the exit status of - _l_i_s_t. Note that unlike the metacharacters (( and )), {{ and }} are - _r_e_s_e_r_v_e_d _w_o_r_d_s and must occur where a reserved word is permitted + _l_i_s_t is executed in the current shell environment. _l_i_s_t must be + terminated with a newline or semicolon. This is known as a + _g_r_o_u_p _c_o_m_m_a_n_d. The return status is the exit status of _l_i_s_t. + + Note that unlike the metacharacters (( and )), {{ and }} are _r_e_- + _s_e_r_v_e_d _w_o_r_d_s and must occur where a reserved word is permitted to be recognized. Since they do not cause a word break, they must be separated from _l_i_s_t by whitespace or another shell metacharacter. ((_e_x_p_r_e_s_s_i_o_n)) - The _e_x_p_r_e_s_s_i_o_n is evaluated according to the rules described be- - low under AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN. If the value of the expression - is non-zero, the return status is 0; otherwise the return status - is 1. The _e_x_p_r_e_s_s_i_o_n undergoes the same expansions as if it - were within double quotes, but double quote characters in _e_x_- - _p_r_e_s_s_i_o_n are not treated specially and are removed. + The arithmetic _e_x_p_r_e_s_s_i_o_n is evaluated according to the rules + described below under AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN. If the value of + the expression is non-zero, the return status is 0; otherwise + the return status is 1. The _e_x_p_r_e_s_s_i_o_n undergoes the same ex- + pansions as if it were within double quotes, but double quote + characters in _e_x_p_r_e_s_s_i_o_n are not treated specially and are re- + moved. [[[[ _e_x_p_r_e_s_s_i_o_n ]]]] - Return a status of 0 or 1 depending on the evaluation of the - conditional expression _e_x_p_r_e_s_s_i_o_n. Expressions are composed of - the primaries described below under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS. - The words between the [[[[ and ]]]] do not undergo word splitting - and pathname expansion. The shell performs tilde expansion, pa- - rameter and variable expansion, arithmetic expansion, command - substitution, process substitution, and quote removal on those - words. Conditional operators such as --ff must be unquoted to be - recognized as primaries. - - When used with [[[[, the << and >> operators sort lexicographically + Evaluate the conditional expression _e_x_p_r_e_s_s_i_o_n and return a sta- + tus of zero (true) or non-zero (false). Expressions are com- + posed of the primaries described below under CCOONNDDIITTIIOONNAALL EEXXPPRREESS-- + SSIIOONNSS. The words between the [[[[ and ]]]] do not undergo word + splitting and pathname expansion. The shell performs tilde ex- + pansion, parameter and variable expansion, arithmetic expansion, + command substitution, process substitution, and quote removal on + those words. Conditional operators such as --ff must be unquoted + to be recognized as primaries. + + When used with [[[[, the << and >> operators sort lexicographically using the current locale. - When the ==== and !!== operators are used, the string to the right + When the ==== and !!== operators are used, the string to the right of the operator is considered a pattern and matched according to the rules described below under PPaatttteerrnn MMaattcchhiinngg, as if the eexxtt-- gglloobb shell option were enabled. The == operator is equivalent to - ====. If the nnooccaasseemmaattcchh shell option is enabled, the match is - performed without regard to the case of alphabetic characters. - The return value is 0 if the string matches (====) or does not - match (!!==) the pattern, and 1 otherwise. Any part of the pat- - tern may be quoted to force the quoted portion to be matched as - a string. - - An additional binary operator, ==~~, is available, with the same - precedence as ==== and !!==. When it is used, the string to the + ====. If the nnooccaasseemmaattcchh shell option is enabled, the match is + performed without regard to the case of alphabetic characters. + The return value is 0 if the string matches (====) or does not + match (!!==) the pattern, and 1 otherwise. If any part of the + pattern is quoted, the quoted portion is matched as a string: + every character in the quoted portion matches itself, instead of + having any special pattern matching meaning. + + An additional binary operator, ==~~, is available, with the same + precedence as ==== and !!==. When it is used, the string to the right of the operator is considered a POSIX extended regular ex- - pression and matched accordingly (using the POSIX _r_e_g_c_o_m_p and - _r_e_g_e_x_e_c interfaces usually described in _r_e_g_e_x(3)). The return - value is 0 if the string matches the pattern, and 1 otherwise. + pression and matched accordingly (using the POSIX _r_e_g_c_o_m_p and + _r_e_g_e_x_e_c interfaces usually described in _r_e_g_e_x(3)). The return + value is 0 if the string matches the pattern, and 1 otherwise. If the regular expression is syntactically incorrect, the condi- tional expression's return value is 2. If the nnooccaasseemmaattcchh shell - option is enabled, the match is performed without regard to the - case of alphabetic characters. If any part of the pattern is - quoted, the quoted portion is matched literally. This means - every character in the quoted portion matches itself, instead of - having any special pattern matching meaning. If the pattern is - stored in a shell variable, quoting the variable expansion - forces the entire pattern to be matched literally. Treat - bracket expressions in regular expressions carefully, since nor- - mal quoting and pattern characters lose their meanings between - brackets. - - The pattern will match if it matches any part of the string. - Anchor the pattern using the ^^ and $$ regular expression opera- - tors to force it to match the entire string. The array variable - BBAASSHH__RREEMMAATTCCHH records which parts of the string matched the pat- - tern. The element of BBAASSHH__RREEMMAATTCCHH with index 0 contains the - portion of the string matching the entire regular expression. - Substrings matched by parenthesized subexpressions within the - regular expression are saved in the remaining BBAASSHH__RREEMMAATTCCHH in- - dices. The element of BBAASSHH__RREEMMAATTCCHH with index _n is the portion - of the string matching the _nth parenthesized subexpression. - BBaasshh sets BBAASSHH__RREEMMAATTCCHH in the global scope; declaring it as a - local variable will lead to unexpected results. + option is enabled, the match is performed without regard to the + case of alphabetic characters. + + If any part of the pattern is quoted, the quoted portion is + matched literally, as above. If the pattern is stored in a + shell variable, quoting the variable expansion forces the entire + pattern to be matched literally. Treat bracket expressions in + regular expressions carefully, since normal quoting and pattern + characters lose their meanings between brackets. + + The pattern will match if it matches any part of the string. + Anchor the pattern using the ^^ and $$ regular expression opera- + tors to force it to match the entire string. + + The array variable BBAASSHH__RREEMMAATTCCHH records which parts of the + string matched the pattern. The element of BBAASSHH__RREEMMAATTCCHH with + index 0 contains the portion of the string matching the entire + regular expression. Substrings matched by parenthesized subex- + pressions within the regular expression are saved in the remain- + ing BBAASSHH__RREEMMAATTCCHH indices. The element of BBAASSHH__RREEMMAATTCCHH with in- + dex _n is the portion of the string matching the _nth parenthe- + sized subexpression. BBaasshh sets BBAASSHH__RREEMMAATTCCHH in the global + scope; declaring it as a local variable will lead to unexpected + results. - Expressions may be combined using the following operators, + Expressions may be combined using the following operators, listed in decreasing order of precedence: (( _e_x_p_r_e_s_s_i_o_n )) - Returns the value of _e_x_p_r_e_s_s_i_o_n. This may be used to + Returns the value of _e_x_p_r_e_s_s_i_o_n. This may be used to override the normal precedence of operators. !! _e_x_p_r_e_s_s_i_o_n True if _e_x_p_r_e_s_s_i_o_n is false. @@ -434,67 +451,77 @@ SSHHEELLLL GGRRAAMMMMAARR True if either _e_x_p_r_e_s_s_i_o_n_1 or _e_x_p_r_e_s_s_i_o_n_2 is true. The &&&& and |||| operators do not evaluate _e_x_p_r_e_s_s_i_o_n_2 if the value - of _e_x_p_r_e_s_s_i_o_n_1 is sufficient to determine the return value of + of _e_x_p_r_e_s_s_i_o_n_1 is sufficient to determine the return value of the entire conditional expression. ffoorr _n_a_m_e [ [ iinn [ _w_o_r_d _._._. ] ] ; ] ddoo _l_i_s_t ; ddoonnee - The list of words following iinn is expanded, generating a list of - items. The variable _n_a_m_e is set to each element of this list in - turn, and _l_i_s_t is executed each time. If the iinn _w_o_r_d is omit- - ted, the ffoorr command executes _l_i_s_t once for each positional pa- - rameter that is set (see PPAARRAAMMEETTEERRSS below). The return status - is the exit status of the last command that executes. If the - expansion of the items following iinn results in an empty list, no - commands are executed, and the return status is 0. + First, expand The list of words following iinn, generating a list + of items. Then, the variable _n_a_m_e is set to each element of + this list in turn, and _l_i_s_t is executed each time. If the iinn + _w_o_r_d is omitted, the ffoorr command executes _l_i_s_t once for each po- + sitional parameter that is set (see PPAARRAAMMEETTEERRSS below). The re- + turn status is the exit status of the last command that exe- + cutes. If the expansion of the items following iinn results in an + empty list, no commands are executed, and the return status is + 0. ffoorr (( _e_x_p_r_1 ; _e_x_p_r_2 ; _e_x_p_r_3 )) ; ddoo _l_i_s_t ; ddoonnee - First, the arithmetic expression _e_x_p_r_1 is evaluated according to - the rules described below under AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN. The - arithmetic expression _e_x_p_r_2 is then evaluated repeatedly until - it evaluates to zero. Each time _e_x_p_r_2 evaluates to a non-zero - value, _l_i_s_t is executed and the arithmetic expression _e_x_p_r_3 is - evaluated. If any expression is omitted, it behaves as if it - evaluates to 1. The return value is the exit status of the last - command in _l_i_s_t that is executed, or false if any of the expres- - sions is invalid. + First, evaluate the arithmetic expression _e_x_p_r_1 according to the + rules described below under AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN. Then, re- + peatedly evaluate the arithmetic expression _e_x_p_r_2 until it eval- + uates to zero. Each time _e_x_p_r_2 evaluates to a non-zero value, + execute _l_i_s_t and evaluate the arithmetic expression _e_x_p_r_3. If + any expression is omitted, it behaves as if it evaluates to 1. + The return value is the exit status of the last command in _l_i_s_t + that is executed, or non-zero if any of the expressions is in- + valid. + + Use the bbrreeaakk and ccoonnttiinnuuee builtins (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS + below) to control loop execution. sseelleecctt _n_a_m_e [ iinn _w_o_r_d ] ; ddoo _l_i_s_t ; ddoonnee - The list of words following iinn is expanded, generating a list of - items, and the set of expanded words is printed on the standard - error, each preceded by a number. If the iinn _w_o_r_d is omitted, - the positional parameters are printed (see PPAARRAAMMEETTEERRSS below). - sseelleecctt then displays the PPSS33 prompt and reads a line from the - standard input. If the line consists of a number corresponding - to one of the displayed words, then the value of _n_a_m_e is set to - that word. If the line is empty, the words and prompt are dis- - played again. If EOF is read, the sseelleecctt command completes and - returns 1. Any other value read causes _n_a_m_e to be set to null. - The line read is saved in the variable RREEPPLLYY. The _l_i_s_t is exe- - cuted after each selection until a bbrreeaakk command is executed. - The exit status of sseelleecctt is the exit status of the last command - executed in _l_i_s_t, or zero if no commands were executed. + First, expand the list of words following iinn, generating a list + of items, and print the set of expanded words the standard er- + ror, each preceded by a number. If the iinn _w_o_r_d is omitted, + print the positional parameters (see PPAARRAAMMEETTEERRSS below). sseelleecctt + then displays the PPSS33 prompt and reads a line from the standard + input. If the line consists of a number corresponding to one of + the displayed words, then sseelleecctt sets the value of _n_a_m_e to that + word. If the line is empty, sseelleecctt displays the words and + prompt again. If EOF is read, sseelleecctt completes and returns 1. + Any other value sets _n_a_m_e to null. The line read is saved in + the variable RREEPPLLYY. The _l_i_s_t is executed after each selection + until a bbrreeaakk command is executed. The exit status of sseelleecctt is + the exit status of the last command executed in _l_i_s_t, or zero if + no commands were executed. ccaassee _w_o_r_d iinn [ [(] _p_a_t_t_e_r_n [ || _p_a_t_t_e_r_n ] ... ) _l_i_s_t ;; ] ... eessaacc A ccaassee command first expands _w_o_r_d, and tries to match it against - each _p_a_t_t_e_r_n in turn, using the matching rules described under - PPaatttteerrnn MMaattcchhiinngg below. The _w_o_r_d is expanded using tilde expan- - sion, parameter and variable expansion, arithmetic expansion, - command substitution, process substitution and quote removal. - Each _p_a_t_t_e_r_n examined is expanded using tilde expansion, parame- - ter and variable expansion, arithmetic expansion, command sub- - stitution, process substitution, and quote removal. If the nnoo-- - ccaasseemmaattcchh shell option is enabled, the match is performed with- - out regard to the case of alphabetic characters. When a match - is found, the corresponding _l_i_s_t is executed. If the ;;;; opera- - tor is used, no subsequent matches are attempted after the first - pattern match. Using ;;&& in place of ;;;; causes execution to con- - tinue with the _l_i_s_t associated with the next set of patterns. - Using ;;;;&& in place of ;;;; causes the shell to test the next pat- - tern list in the statement, if any, and execute any associated - _l_i_s_t on a successful match, continuing the case statement execu- - tion as if the pattern list had not matched. The exit status is - zero if no pattern matches. Otherwise, it is the exit status of - the last command executed in _l_i_s_t. + each _p_a_t_t_e_r_n in turn, proceeding from first to last, using the + matching rules described under PPaatttteerrnn MMaattcchhiinngg below. A pat- + tern list is a set of one or more patterns separated by , and + the ) operator terminates the pattern list. The _w_o_r_d is ex- + panded using tilde expansion, parameter and variable expansion, + arithmetic expansion, command substitution, process substitution + and quote removal. Each _p_a_t_t_e_r_n examined is expanded using + tilde expansion, parameter and variable expansion, arithmetic + expansion, command substitution, process substitution, and quote + removal. If the nnooccaasseemmaattcchh shell option is enabled, the match + is performed without regard to the case of alphabetic charac- + ters. A _c_l_a_u_s_e is a pattern list and an associated _l_i_s_t. + + When a match is found, ccaassee executes the corresponding _l_i_s_t. If + the ;;;; operator terminates the case clause, the ccaassee command + completes after the first match. Using ;;&& in place of ;;;; causes + execution to continue with the _l_i_s_t associated with the next + pattern list. Using ;;;;&& in place of ;;;; causes the shell to test + the next pattern list in the statement, if any, and execute any + associated _l_i_s_t if the match succeeds. continuing the case + statement execution as if the pattern list had not matched. The + exit status is zero if no pattern matches. + + Otherwise, it is the exit status of the last command executed in + the last _l_i_s_t executed. iiff _l_i_s_t; tthheenn _l_i_s_t; [ eelliiff _l_i_s_t; tthheenn _l_i_s_t; ] ... [ eellssee _l_i_s_t; ] ffii The iiff _l_i_s_t is executed. If its exit status is zero, the tthheenn @@ -533,9 +560,9 @@ SSHHEELLLL GGRRAAMMMMAARR ccoopprroocc _N_A_M_E { _c_o_m_m_a_n_d [_r_e_d_i_r_e_c_t_i_o_n_s]; } - This form is recommended because simple commands result in the co- - process always being named CCOOPPRROOCC, and it is simpler to use and more - complete than the other compound commands. + This form is preferred because simple commands result in the coprocess + always being named CCOOPPRROOCC, and it is simpler to use and more complete + than the other compound commands. If _c_o_m_m_a_n_d is a compound command, _N_A_M_E is optional. The word following ccoopprroocc determines whether that word is interpreted as a variable name: @@ -558,8 +585,8 @@ SSHHEELLLL GGRRAAMMMMAARR subshells. The process ID of the shell spawned to execute the coprocess is avail- - able as the value of the variable _N_A_M_E_PID. The wwaaiitt builtin command - may be used to wait for the coprocess to terminate. + able as the value of the variable _N_A_M_E_PID. The wwaaiitt builtin may be + used to wait for the coprocess to terminate. Since the coprocess is created as an asynchronous command, the ccoopprroocc command always returns success. The return status of a coprocess is @@ -584,22 +611,26 @@ SSHHEELLLL GGRRAAMMMMAARR When in _p_o_s_i_x _m_o_d_e, _f_n_a_m_e must be a valid shell _n_a_m_e and may not be the name of one of the POSIX _s_p_e_c_i_a_l _b_u_i_l_t_i_n_s. In default mode, a function name can be any unquoted shell word that does - not contain $$. Any redirections (see RREEDDIIRREECCTTIIOONN below) speci- - fied when a function is defined are performed when the function - is executed. The exit status of a function definition is zero - unless a syntax error occurs or a readonly function with the - same name already exists. When executed, the exit status of a - function is the exit status of the last command executed in the - body. (See FFUUNNCCTTIIOONNSS below.) + not contain $$. + + Any redirections (see RREEDDIIRREECCTTIIOONN below) specified when a function is + defined are performed when the function is executed. + + The exit status of a function definition is zero unless a syntax error + occurs or a readonly function with the same name already exists. When + executed, the exit status of a function is the exit status of the last + command executed in the body. (See FFUUNNCCTTIIOONNSS below.) CCOOMMMMEENNTTSS In a non-interactive shell, or an interactive shell in which the iinntteerr-- aaccttiivvee__ccoommmmeennttss option to the sshhoopptt builtin is enabled (see SSHHEELLLL - BBUUIILLTTIINN CCOOMMMMAANNDDSS below), a word beginning with ## causes that word and - all remaining characters on that line to be ignored. An interactive - shell without the iinntteerraaccttiivvee__ccoommmmeennttss option enabled does not allow - comments. The iinntteerraaccttiivvee__ccoommmmeennttss option is on by default in interac- - tive shells. + BBUUIILLTTIINN CCOOMMMMAANNDDSS below), a word beginning with ## introduces a comment. + A word begins at the beginning of a line, after unquoted whitespace, or + after an operator. The comment causes that word and all remaining + characters on that line to be ignored. An interactive shell without + the iinntteerraaccttiivvee__ccoommmmeennttss option enabled does not allow comments. The + iinntteerraaccttiivvee__ccoommmmeennttss option is enabled by default in interactive + shells. QQUUOOTTIINNGG _Q_u_o_t_i_n_g is used to remove the special meaning of certain characters or @@ -614,14 +645,15 @@ QQUUOOTTIINNGG TTOORRYY EEXXPPAANNSSIIOONN below), the _h_i_s_t_o_r_y _e_x_p_a_n_s_i_o_n character, usually !!, must be quoted to prevent history expansion. - There are three quoting mechanisms: the _e_s_c_a_p_e _c_h_a_r_a_c_t_e_r, single - quotes, and double quotes. + There are four quoting mechanisms: the _e_s_c_a_p_e _c_h_a_r_a_c_t_e_r, single quotes, + double quotes, and dollar-single quotes. - A non-quoted backslash (\\) is the _e_s_c_a_p_e _c_h_a_r_a_c_t_e_r. It preserves the - literal value of the next character that follows, with the exception of - . If a \\ pair appears, and the backslash is not it- - self quoted, the \\ is treated as a line continuation (that is, - it is removed from the input stream and effectively ignored). + A non-quoted backslash (\\) is the _e_s_c_a_p_e _c_h_a_r_a_c_t_e_r. It preserves the + literal value of the next character that follows, removing any special + meaning it has, with the exception of . If a \\ pair + appears, and the backslash is not itself quoted, the \\ is + treated as a line continuation (that is, it is removed from the input + stream and effectively ignored). Enclosing characters in single quotes preserves the literal value of each character within the quotes. A single quote may not occur between @@ -634,18 +666,21 @@ QQUUOOTTIINNGG expansion is enabled. The characters $$ and `` retain their special meaning within double quotes. The backslash retains its special mean- ing only when followed by one of the following characters: $$, ``, "", \\, - or <>. A double quote may be quoted within double quotes by - preceding it with a backslash. If enabled, history expansion will be - performed unless an !! appearing in double quotes is escaped using a - backslash. The backslash preceding the !! is not removed. + or <>. Backslashes preceding characters without a special mean- + ing are left unmodified. + + A double quote may be quoted within double quotes by preceding it with + a backslash. If enabled, history expansion will be performed unless an + !! appearing in double quotes is escaped using a backslash. The back- + slash preceding the !! is not removed. - The special parameters ** and @@ have special meaning when in double + The special parameters ** and @@ have special meaning when in double quotes (see PPAARRAAMMEETTEERRSS below). - Character sequences of the form $$'_s_t_r_i_n_g' are treated as a special - variant of single quotes. The sequence expands to _s_t_r_i_n_g, with back- - slash-escaped characters in _s_t_r_i_n_g replaced as specified by the ANSI C - standard. Backslash escape sequences, if present, are decoded as fol- + Character sequences of the form $$'_s_t_r_i_n_g' are treated as a special + variant of single quotes. The sequence expands to _s_t_r_i_n_g, with back- + slash-escaped characters in _s_t_r_i_n_g replaced as specified by the ANSI C + standard. Backslash escape sequences, if present, are decoded as fol- lows: \\aa alert (bell) \\bb backspace @@ -660,38 +695,41 @@ QQUUOOTTIINNGG \\'' single quote \\"" double quote \\?? question mark - \\_n_n_n the eight-bit character whose value is the octal value + \\_n_n_n the eight-bit character whose value is the octal value _n_n_n (one to three octal digits) - \\xx_H_H the eight-bit character whose value is the hexadecimal + \\xx_H_H the eight-bit character whose value is the hexadecimal value _H_H (one or two hex digits) - \\uu_H_H_H_H the Unicode (ISO/IEC 10646) character whose value is the + \\uu_H_H_H_H the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value _H_H_H_H (one to four hex digits) \\UU_H_H_H_H_H_H_H_H - the Unicode (ISO/IEC 10646) character whose value is the + the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value _H_H_H_H_H_H_H_H (one to eight hex digits) \\cc_x a control-_x character - The expanded result is single-quoted, as if the dollar sign had not + The expanded result is single-quoted, as if the dollar sign had not been present. + TTrraannssllaattiinngg SSttrriinnggss A double-quoted string preceded by a dollar sign ($$"_s_t_r_i_n_g") will cause - the string to be translated according to the current locale. The _g_e_t_- - _t_e_x_t infrastructure performs the lookup and translation, using the - LLCC__MMEESSSSAAGGEESS, TTEEXXTTDDOOMMAAIINNDDIIRR, and TTEEXXTTDDOOMMAAIINN shell variables. If the - current locale is CC or PPOOSSIIXX, if there are no translations available, - or if the string is not translated, the dollar sign is ignored. This - is a form of double quoting, so the string remains double-quoted by de- - fault, whether or not it is translated and replaced. If the nnooeexx-- - ppaanndd__ttrraannssllaattiioonn option is enabled using the sshhoopptt builtin, translated - strings are single-quoted instead of double-quoted. See the descrip- - tion of sshhoopptt below under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS. + the string to be translated according to the current locale. The _g_e_t_- + _t_e_x_t infrastructure performs the lookup and translation, using the + LLCC__MMEESSSSAAGGEESS, TTEEXXTTDDOOMMAAIINNDDIIRR, and TTEEXXTTDDOOMMAAIINN shell variables. If the + current locale is CC or PPOOSSIIXX, if there are no translations available, + or if the string is not translated, the dollar sign is ignored, and the + string is treated as double-quoted as described above. This is a form + of double quoting, so the string remains double-quoted by default, + whether or not it is translated and replaced. If the nnooeexxppaanndd__ttrraannssllaa-- + ttiioonn option is enabled using the sshhoopptt builtin, translated strings are + single-quoted instead of double-quoted. See the description of sshhoopptt + below under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS. PPAARRAAMMEETTEERRSS - A _p_a_r_a_m_e_t_e_r is an entity that stores values. It can be a _n_a_m_e, a num- - ber, or one of the special characters listed below under SSppeecciiaall PPaarraa-- + A _p_a_r_a_m_e_t_e_r is an entity that stores values. It can be a _n_a_m_e, a num- + ber, or one of the special characters listed below under SSppeecciiaall PPaarraa-- mmeetteerrss. A _v_a_r_i_a_b_l_e is a parameter denoted by a _n_a_m_e. A variable has a - _v_a_l_u_e and zero or more _a_t_t_r_i_b_u_t_e_s. Attributes are assigned using the - ddeeccllaarree builtin command (see ddeeccllaarree below in SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS). + _v_a_l_u_e and zero or more _a_t_t_r_i_b_u_t_e_s. Attributes are assigned using the + ddeeccllaarree builtin command (see ddeeccllaarree below in SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS). + The eexxppoorrtt and rreeaaddoonnllyy builtins assign specific attributes. A parameter is set if it has been assigned a value. The null string is a valid value. Once a variable is set, it may be unset only by using @@ -714,15 +752,16 @@ PPAARRAAMMEETTEERRSS the ccoommmmaanndd builtin and retain these assignment statement properties. In the context where an assignment statement is assigning a value to a - shell variable or array index, the += operator can be used to append to - or add to the variable's previous value. This includes arguments to - builtin commands such as ddeeccllaarree that accept assignment statements (_d_e_- - _c_l_a_r_a_t_i_o_n commands). When += is applied to a variable for which the - iinntteeggeerr attribute has been set, _v_a_l_u_e is evaluated as an arithmetic ex- - pression and added to the variable's current value, which is also eval- - uated. When += is applied to an array variable using compound assign- - ment (see AArrrraayyss below), the variable's value is not unset (as it is - when using =), and new values are appended to the array beginning at + shell variable or array index, the += operator will append to or add to + the variable's previous value. This includes arguments to _d_e_c_l_a_r_a_t_i_o_n + commands such as ddeeccllaarree that accept assignment statements. When += is + applied to a variable for which the iinntteeggeerr attribute has been set, the + variable's current value and _v_a_l_u_e are each evaluated as arithmetic ex- + pressions, and the sum of the results is assigned as the variable's + value. The current value is usually an integer constant, but may be an + expression. When += is applied to an array variable using compound as- + signment (see AArrrraayyss below), the variable's value is not unset (as it + is when using =), and new values are appended to the array beginning at one greater than the array's maximum index (for indexed arrays) or added as additional key-value pairs in an associative array. When ap- plied to a string-valued variable, _v_a_l_u_e is expanded and appended to @@ -742,100 +781,106 @@ PPAARRAAMMEETTEERRSS declare -n ref=$1 - inside the function creates a nameref variable rreeff whose value is the - variable name passed as the first argument. References and assignments - to rreeff, and changes to its attributes, are treated as references, as- - signments, and attribute modifications to the variable whose name was - passed as $$11. If the control variable in a ffoorr loop has the nameref - attribute, the list of words can be a list of shell variables, and a - name reference will be established for each word in the list, in turn, + inside the function creates a local nameref variable rreeff whose value is + the variable name passed as the first argument. References and assign- + ments to rreeff, and changes to its attributes, are treated as references, + assignments, and attribute modifications to the variable whose name was + passed as $$11. If the control variable in a ffoorr loop has the nameref + attribute, the list of words can be a list of shell variables, and a + name reference will be established for each word in the list, in turn, when the loop is executed. Array variables cannot be given the nnaammeerreeff - attribute. However, nameref variables can reference array variables - and subscripted array variables. Namerefs can be unset using the --nn - option to the uunnsseett builtin. Otherwise, if uunnsseett is executed with the - name of a nameref variable as an argument, the variable referenced by + attribute. However, nameref variables can reference array variables + and subscripted array variables. Namerefs can be unset using the --nn + option to the uunnsseett builtin. Otherwise, if uunnsseett is executed with the + name of a nameref variable as an argument, the variable referenced by the nameref variable will be unset. PPoossiittiioonnaall PPaarraammeetteerrss - A _p_o_s_i_t_i_o_n_a_l _p_a_r_a_m_e_t_e_r is a parameter denoted by one or more digits, + A _p_o_s_i_t_i_o_n_a_l _p_a_r_a_m_e_t_e_r is a parameter denoted by one or more digits, other than the single digit 0. Positional parameters are assigned from - the shell's arguments when it is invoked, and may be reassigned using - the sseett builtin command. Positional parameters may not be assigned to - with assignment statements. The positional parameters are temporarily + the shell's arguments when it is invoked, and may be reassigned using + the sseett builtin command. Positional parameters may not be assigned to + with assignment statements. The positional parameters are temporarily replaced when a shell function is executed (see FFUUNNCCTTIIOONNSS below). - When a positional parameter consisting of more than a single digit is - expanded, it must be enclosed in braces (see EEXXPPAANNSSIIOONN below). + When a positional parameter consisting of more than a single digit is + expanded, it must be enclosed in braces (see EEXXPPAANNSSIIOONN below). Without + braces, a digit following $ can only refer to one of the first nine po- + sitional parameters ($$11--$$99) or the special parameter $$00 (see the next + section). SSppeecciiaall PPaarraammeetteerrss The shell treats several parameters specially. These parameters may - only be referenced; assignment to them is not allowed. - ** Expands to the positional parameters, starting from one. When - the expansion is not within double quotes, each positional para- - meter expands to a separate word. In contexts where these ex- - pansions are performed, those words are subject to further word - splitting and pathname expansion. When the expansion occurs - within double quotes, it expands to a single word with the value - of each parameter separated by the first character of the IIFFSS - special variable. That is, ""$$**"" is equivalent to ""$$11_c$$22_c......"", - where _c is the first character of the value of the IIFFSS variable. - If IIFFSS is unset, the parameters are separated by spaces. If IIFFSS - is null, the parameters are joined without intervening separa- - tors. - @@ Expands to the positional parameters, starting from one. In - contexts where word splitting is performed, this expands each + only be referenced; assignment to them is not allowed. Special parame- + ters are denoted by one of the following characters. + ** ($$**) Expands to the positional parameters, starting from one. + When the expansion is not within double quotes, each positional + parameter expands to a separate word. In contexts where word + expansions are performed, those words are subject to further + word splitting and pathname expansion. When the expansion oc- + curs within double quotes, it expands to a single word with the + value of each parameter separated by the first character of the + IIFFSS variable. That is, ""$$**"" is equivalent to ""$$11_c$$22_c......"", where + _c is the first character of the value of the IIFFSS variable. If + IIFFSS is unset, the parameters are separated by spaces. If IIFFSS is + null, the parameters are joined without intervening separators. + @@ ($$@@) Expands to the positional parameters, starting from one. + In contexts where word splitting is performed, this expands each positional parameter to a separate word; if not within double quotes, these words are subject to word splitting. In contexts - where word splitting is not performed, this expands to a single - word with each positional parameter separated by a space. When - the expansion occurs within double quotes, each parameter ex- - pands to a separate word. That is, ""$$@@"" is equivalent to - ""$$11"" ""$$22"" ...... If the double-quoted expansion occurs within a - word, the expansion of the first parameter is joined with the - beginning part of the original word, and the expansion of the - last parameter is joined with the last part of the original - word. When there are no positional parameters, ""$$@@"" and $$@@ ex- - pand to nothing (i.e., they are removed). - ## Expands to the number of positional parameters in decimal. - ?? Expands to the exit status of the most recently executed com- - mand. - -- Expands to the current option flags as specified upon invoca- - tion, by the sseett builtin command, or those set by the shell it- - self (such as the --ii option). - $$ Expands to the process ID of the shell. In a subshell, it ex- - pands to the process ID of the current shell, not the subshell. - !! Expands to the process ID of the job most recently placed into - the background, whether executed as an asynchronous command or - using the bbgg builtin (see JJOOBB CCOONNTTRROOLL below). - 00 Expands to the name of the shell or shell script. This is set - at shell initialization. If bbaasshh is invoked with a file of com- - mands, $$00 is set to the name of that file. If bbaasshh is started - with the --cc option, then $$00 is set to the first argument after - the string to be executed, if one is present. Otherwise, it is - set to the filename used to invoke bbaasshh, as given by argument - zero. + where word splitting is not performed, such as the value portion + of an assignment statement, this expands to a single word with + each positional parameter separated by a space. When the expan- + sion occurs within double quotes, and word splitting is per- + formed, each parameter expands to a separate word. That is, + ""$$@@"" is equivalent to ""$$11"" ""$$22"" ...... If the double-quoted expan- + sion occurs within a word, the expansion of the first parameter + is joined with the expansion of the beginning part of the origi- + nal word, and the expansion of the last parameter is joined with + the expansion of the last part of the original word. When there + are no positional parameters, ""$$@@"" and $$@@ expand to nothing + (i.e., they are removed). + ## ($$##) Expands to the number of positional parameters in decimal. + ?? ($$??) Expands to the exit status of the most recently executed + command. + -- ($$--) Expands to the current option flags as specified upon invo- + cation, by the sseett builtin command, or those set by the shell + itself (such as the --ii option). + $$ ($$$$) Expands to the process ID of the shell. In a subshell, it + expands to the process ID of the parent shell, not the subshell. + !! ($$!!)Expands to the process ID of the job most recently placed + into the background, whether executed as an asynchronous command + or using the bbgg builtin (see JJOOBB CCOONNTTRROOLL below). + 00 ($$00) Expands to the name of the shell or shell script. This is + set at shell initialization. If bbaasshh is invoked with a file of + commands, $$00 is set to the name of that file. If bbaasshh is + started with the --cc option, then $$00 is set to the first argument + after the string to be executed, if one is present. Otherwise, + it is set to the filename used to invoke bbaasshh, as given by argu- + ment zero. SShheellll VVaarriiaabblleess - The following variables are set by the shell: - - __ At shell startup, set to the pathname used to invoke the shell - or shell script being executed as passed in the environment or - argument list. Subsequently, expands to the last argument to - the previous simple command executed in the foreground, after - expansion. Also set to the full pathname used to invoke each - command executed and placed in the environment exported to that - command. When checking mail, this parameter holds the name of - the mail file currently being checked. - BBAASSHH Expands to the full filename used to invoke this instance of + The shell sets following variables: + + __ ($$__, an underscore) This has a number of meanings depending on + context. At shell startup, __ is set to the pathname used to in- + voke the shell or shell script being executed as passed in the + environment or argument list. Subsequently, it expands to the + last argument to the previous simple command executed in the + foreground, after expansion. It is also set to the full path- + name used to invoke each command executed and placed in the en- + vironment exported to that command. When checking mail, $$__ ex- + pands to the name of the mail file currently being checked. + BBAASSHH Expands to the full filename used to invoke this instance of bbaasshh. BBAASSHHOOPPTTSS - A colon-separated list of enabled shell options. Each word in - the list is a valid argument for the --ss option to the sshhoopptt + A colon-separated list of enabled shell options. Each word in + the list is a valid argument for the --ss option to the sshhoopptt builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). The options - appearing in BBAASSHHOOPPTTSS are those reported as _o_n by sshhoopptt. If - this variable is in the environment when bbaasshh starts up, each - shell option in the list will be enabled before reading any - startup files. This variable is read-only. + 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. BBAASSHHPPIIDD Expands to the process ID of the current bbaasshh process. This differs from $$$$ under certain circumstances, such as subshells @@ -846,54 +891,54 @@ PPAARRAAMMEETTEERRSS 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 cause aliases to be - removed from the alias list. If BBAASSHH__AALLIIAASSEESS is unset, it loses - its special properties, even if it is subsequently reset. + 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 parameters supplied are pushed 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 be- - low). 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 + 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 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). Assignment to BBAASSHH__AARRGGVV00 causes the value - assigned to also be assigned to $$00. If BBAASSHH__AARRGGVV00 is unset, it - loses its special properties, even if it is subsequently reset. + parameter 0 above). Assigning a value to BBAASSHH__AARRGGVV00 assigns the + same value to $$00. 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 - builtin. Elements added to this array appear in the hash table; - however, unsetting array elements currently does not cause com- - mand names to be removed from the hash table. If BBAASSHH__CCMMDDSS is - unset, it loses its special properties, even if it is subse- - quently reset. + 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- + set, it loses its special properties, even if it is subsequently + reset. BBAASSHH__CCOOMMMMAANNDD - 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 proper- - ties, even if it is subsequently reset. + 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 + properties, even if it is subsequently reset. BBAASSHH__EEXXEECCUUTTIIOONN__SSTTRRIINNGG The command argument to the --cc invocation option. BBAASSHH__LLIINNEENNOO @@ -905,41 +950,40 @@ PPAARRAAMMEETTEERRSS 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 shell looks - for dynamically loadable builtins specified by the eennaabbllee com- - mand. - 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- - pression. The element with index _n is the portion of the string - matching the _nth parenthesized subexpression. + 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- 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- + 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). @@ -948,94 +992,96 @@ 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 - bbaasshh. + 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. + 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 completion - attempted 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 + ries already in the stack, but the ppuusshhdd and ppooppdd builtins must be used to add and remove directories. Assignment to this vari- - able will not change the current directory. If DDIIRRSSTTAACCKK is un- + able will 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 @@ -1045,43 +1091,44 @@ PPAARRAAMMEETTEERRSS 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 processes 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 processes in the most-recently-executed + foreground pipeline, which may consist of only a simple command (see SSHHEELLLL GGRRAAMMMMAARR above). - 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. If RRAANNDDOOMM is - unset, it loses its special properties, even if it is subse- - quently reset. + 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 will pro- + duce 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 readline command that was de- fined using "bind -x" (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) when it @@ -1113,47 +1160,48 @@ PPAARRAAMMEETTEERRSS 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, each - shell option in the list will be enabled before reading any - startup files. This variable is read-only. + 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. SSHHLLVVLL Incremented by one each time an instance of bbaasshh is started. SSRRAANNDDOOMM - This variable expands to a 32-bit pseudo-random number each time - it is referenced. 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 re- - turned number has no relationship to the numbers preceding it. + 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 + returned number has no relationship to the numbers preceding it. 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 following variables are used by the shell. In some cases, bbaasshh as- - signs a default value to a variable; these cases are noted below. + 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 value is interpreted as a filename containing commands to - initialize the shell, as in _~_/_._b_a_s_h_r_c. The value of BBAASSHH__EENNVV is - subjected to parameter expansion, command substitution, and - arithmetic expansion before being interpreted as a filename. - PPAATTHH is not used to search for the resultant filename. + 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 + to search for the resultant filename. BBAASSHH__XXTTRRAACCEEFFDD If set to an integer corresponding to a valid file descriptor, bbaasshh will write the trace output generated when "set -x" is en- @@ -1164,8 +1212,8 @@ PPAARRAAMMEETTEERRSS BBAASSHH__XXTTRRAACCEEFFDD to 2 (the standard error file descriptor) and then unsetting it will result in the standard error being closed. CCDDPPAATTHH The search path for the ccdd command. This is a colon-separated - list of directories in which the shell looks for destination di- - rectories specified by the ccdd command. A sample value is + list of directories where the shell looks for directories speci- + 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 @@ -1190,7 +1238,7 @@ PPAARRAAMMEETTEERRSS above) when an interactive shell is invoked in _p_o_s_i_x _m_o_d_e. EEXXEECCIIGGNNOORREE A colon-separated list of shell patterns (see PPaatttteerrnn MMaattcchhiinngg) - defining the list of filenames to be ignored by command search + 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 @@ -1213,45 +1261,49 @@ PPAARRAAMMEETTEERRSS 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. + patterns in GGLLOOBBIIGGNNOORREE, it is removed from the list of matches. + The pattern matching honors the setting of the eexxttgglloobb shell op- + tion. GGLLOOBBSSOORRTT - Control 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 + 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. - 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 - 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 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 the numeric value (so "2" will - sort 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 + 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 + 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 the numeric value (so "2" will + sort 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 sorted by name using the traditional behavior. - A sort specifier of _n_o_s_o_r_t disables sorting completely; the re- + A sort specifier of _n_o_s_o_r_t disables sorting completely; the re- sults are returned in the order they are read from the file sys- - tem, and any leading _+ or _- is ignored. 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 behav- - ior. + tem, and any leading _+ or _- is ignored. + + 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 - matching the previous history entry to not be saved. A value of + 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. @@ -1260,37 +1312,41 @@ PPAARRAAMMEETTEERRSS shell parser are saved on the history list, subject to the value of HHIISSTTIIGGNNOORREE. The second and subsequent lines of a multi-line compound command are not tested, and are added to the history - regardless of the value of HHIISSTTCCOONNTTRROOLL. + regardless of the value of HHIISSTTCCOONNTTRROOLL if the first line of the + command was saved. 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 command history is not saved - when a shell exits. + 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 - truncated to this size after writing it when a shell exits. 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. + 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 + 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 - will 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 + will 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 will - escape the "&&"; the backslash is removed before attempting a + escape the "&&"; the backslash is removed before attempting a match. The second and subsequent lines of a multi-line compound - command are not tested, and are added to the history regardless - of the value of HHIISSTTIIGGNNOORREE. The pattern matching honors the - setting of the eexxttgglloobb shell option. + command 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 ei- + ther. The pattern matching honors the setting of the eexxttgglloobb + shell option. HHIISSTTSSIIZZEE The number of commands to remember in the command history (see HHIISSTTOORRYY below). If the value is 0, commands are not saved in @@ -1302,10 +1358,10 @@ PPAARRAAMMEETTEERRSS 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, time stamps are written to the history - file so they may be preserved across shell sessions. This uses - the history comment character to distinguish timestamps from - other history lines. + 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. @@ -1321,15 +1377,16 @@ PPAARRAAMMEETTEERRSS tions. When HHOOSSTTFFIILLEE is unset, the hostname list is cleared. 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 - builtin command. The default value is "". + builtin command. Word splitting is described above 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 - exists but does not have a numeric value, or has no value, the - default value is 10. If it does not exist, EEOOFF signifies the - end of input to the shell. + 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- fault of _~_/_._i_n_p_u_t_r_c (see RREEAADDLLIINNEE below). @@ -1364,79 +1421,79 @@ PPAARRAAMMEETTEERRSS 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 this parameter is set to a file or directory name and the - MMAAIILLPPAATTHH variable is not set, bbaasshh informs the user of the ar- - rival of mail in the specified file or Maildir-format directory. + 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 + 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. 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 _p_o_s_i_x _m_o_d_e 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 _p_o_s_i_x _m_o_d_e, as if the + If this variable is in the environment when bbaasshh starts, the + shell enters _p_o_s_i_x _m_o_d_e 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 _p_o_s_i_x _m_o_d_e, as if the command "set -o posix" had been executed. When the shell enters _p_o_s_i_x _m_o_d_e, 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. @@ -1444,139 +1501,145 @@ 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. At most six places - after the decimal point may be specified; values of _p greater - than 6 are changed to 6. If _p is not specified, the value 3 is - used. + no decimal point or fraction to be output. ttiimmee will print 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 digits 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, TTMMOOUUTT is treated as the de- - fault timeout for the rreeaadd builtin. The sseelleecctt command termi- - nates if input does not arrive after TTMMOOUUTT seconds when input is - coming from a terminal. In an interactive shell, the value is - interpreted as the number of seconds to wait for a line of input - after 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, single word simple com- + job control. If this variable is set, single-word simple com- mands without redirections are treated as candidates for resump- tion of an existing stopped job. There is no ambiguity allowed; - if there is more than one job beginning with the string typed, - the job most recently accessed is selected. The _n_a_m_e of a - stopped job, in this context, is the command line used to start - it. If set to the value _e_x_a_c_t, the string supplied must match - the name of a stopped job exactly; if set to _s_u_b_s_t_r_i_n_g, the - string supplied needs to match a substring of the name of a - stopped job. The _s_u_b_s_t_r_i_n_g value provides functionality analo- - gous to the %%?? job identifier (see JJOOBB CCOONNTTRROOLL below). If set - to any other value, the supplied string must be a prefix of a + if there is more than one job beginning with the string typed, + the most recently accessed job is selected. The _n_a_m_e of a + stopped job, in this context, is the command line used to start + it. If set to the value _e_x_a_c_t, the string supplied must match + the name of a stopped job exactly; if set to _s_u_b_s_t_r_i_n_g, the + string supplied needs to match a substring of the name of a + stopped job. The _s_u_b_s_t_r_i_n_g value provides functionality analo- + gous to the %%?? job identifier (see JJOOBB CCOONNTTRROOLL below). If set + to any other value, the supplied string 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 and + The two or three characters which control history expansion and tokenization (see HHIISSTTOORRYY EEXXPPAANNSSIIOONN below). 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 signals - the start of 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, which is used as - shorthand for re-running the previous command entered, substi- + is the _h_i_s_t_o_r_y _e_x_p_a_n_s_i_o_n character, the character which signals + the start of 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, which is used as + shorthand for re-running the previous command entered, substi- tuting one string for another in the command, when it appears as - the first character on the line. The default is "^^". The op- + the first character on the line. The default is "^^". The op- tional third character is the character which indicates that the remainder of the line is a comment when found as the first char- - acter of a word, normally "##". The history comment character - causes history substitution to be skipped for the remaining - words on the line. It does not necessarily cause the shell + acter of a word, normally "##". The history comment character + causes history substitution to be skipped 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 will - explicitly declare 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 integers (including + BBaasshh provides one-dimensional indexed and associative array variables. + Any variable may be used as an indexed array; the ddeeccllaarree builtin will + explicitly declare 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 integers (including arithmetic expressions) and are zero-based; associative arrays are ref- erenced 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. To explicitly - declare an indexed array, use ddeeccllaarree --aa _n_a_m_e (see SSHHEELLLL BBUUIILLTTIINN CCOOMM-- - MMAANNDDSS below). ddeeccllaarree --aa _n_a_m_e[[_s_u_b_s_c_r_i_p_t]] is also accepted; the _s_u_b_- - _s_c_r_i_p_t is ignored. + an arithmetic expression that must evaluate 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). ddeeccllaarree --aa _n_a_m_e[[_s_u_b_s_c_r_i_p_t]] is + also accepted; the _s_u_b_s_c_r_i_p_t is ignored. Associative arrays are created using ddeeccllaarree --AA _n_a_m_e. Attributes may be specified for an array variable using the ddeeccllaarree and rreeaaddoonnllyy builtins. Each attribute applies to all members of an array. - Arrays are assigned to 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 below under EEXXPPAANNSSIIOONN, but _v_a_l_u_es that are valid variable as- - signments including the brackets and subscript do not undergo brace ex- - pansion 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 + 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- + 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 + 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 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- - troduced above. When assigning to an indexed array, if _n_a_m_e is sub- - scripted by a negative 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 of the array, and an index of -1 references the - last element. + 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- + 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 + of the array, and an index of -1 references the last element. The += operator will append to an array variable when assigning using the compound assignment syntax; see PPAARRAAMMEETTEERRSS above. - Any element of an array may be referenced using ${_n_a_m_e[_s_u_b_s_c_r_i_p_t]}. - The braces are required to avoid conflicts with pathname expansion. If - _s_u_b_s_c_r_i_p_t is @@ or **, the word expands to all members of _n_a_m_e, unless - noted in the description of a builtin or word expansion. These sub- - scripts differ only when the word appears within double quotes. If the - word is double-quoted, ${_n_a_m_e[*]} expands to a single word with the - value of each array member separated by the first character of the IIFFSS - special variable, and ${_n_a_m_e[@]} expands each element of _n_a_m_e to a sep- - arate word. When there are no array members, ${_n_a_m_e[@]} expands to - nothing. If the double-quoted expansion occurs within a word, the ex- - pansion of the first parameter is joined with the beginning part of the - original word, and the expansion of the last parameter is joined with - the last part of the original word. This is analogous to the expansion - of the special parameters ** and @@ (see SSppeecciiaall PPaarraammeetteerrss above). - ${#_n_a_m_e[_s_u_b_s_c_r_i_p_t]} expands to the length of ${_n_a_m_e[_s_u_b_s_c_r_i_p_t]}. If + 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. + 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-- + 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 _s_u_b_s_c_r_i_p_t is ** or @@, the expansion is the number of elements in the ar- - ray. If the _s_u_b_s_c_r_i_p_t used to reference an element of an indexed array - evaluates to a number less than zero, it is interpreted as relative to - one greater than the maximum index of the array, so negative indices - count back from the end of the array, and an index of -1 references the - last element. + 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 + 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 @@ -1591,28 +1654,32 @@ PPAARRAAMMEETTEERRSS array variable _n_a_m_e. The treatment when in double quotes is similar to the expansion of the special parameters _@ and _* within double quotes. - The uunnsseett builtin is used to destroy arrays. uunnsseett _n_a_m_e[_s_u_b_s_c_r_i_p_t] de- - stroys the array element at index _s_u_b_s_c_r_i_p_t, for both indexed and asso- - ciative arrays. Negative subscripts to indexed arrays are interpreted - as described above. Unsetting the last element of an array variable - does not unset the variable. uunnsseett _n_a_m_e, where _n_a_m_e is an array, re- - moves the entire array. uunnsseett _n_a_m_e[_s_u_b_s_c_r_i_p_t], where _s_u_b_s_c_r_i_p_t is ** or - @@, behaves differently depending on whether _n_a_m_e is an indexed or asso- - ciative array. If _n_a_m_e is an associative array, this unsets the ele- - ment with subscript ** or @@. If _n_a_m_e is an indexed array, unset removes - all of the elements but does not remove the array itself. - - When using a variable name with a subscript as an argument to a com- - mand, such as with uunnsseett, without using the word expansion syntax de- - scribed above, the argument is subject to pathname expansion. If path- - name expansion is not desired, the argument should be quoted. - - The ddeeccllaarree, llooccaall, and rreeaaddoonnllyy builtins each accept a --aa option to - specify an indexed array and a --AA option to specify an associative ar- - ray. If both options are supplied, --AA takes precedence. The rreeaadd - builtin accepts a --aa option to assign a list of words read from the + The 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_- + _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- + 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 + (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 standard input to an array. The sseett and ddeeccllaarree builtins display array - values in a way that allows them to be reused as assignments. + 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 Expansion is performed on the command line after it has been split into @@ -1641,14 +1708,15 @@ EEXXPPAANNSSIIOONN $${{_n_a_m_e[[**]]}} as explained above (see PPAARRAAMMEETTEERRSS). BBrraaccee EExxppaannssiioonn - _B_r_a_c_e _e_x_p_a_n_s_i_o_n is a mechanism by which arbitrary strings may be gener- - ated. This mechanism is similar to _p_a_t_h_n_a_m_e _e_x_p_a_n_s_i_o_n, but the file- - names generated need not exist. Patterns to be brace expanded take the - form of an optional _p_r_e_a_m_b_l_e, followed by either a series of comma-sep- - arated strings or a sequence expression between a pair of braces, fol- - lowed by an optional _p_o_s_t_s_c_r_i_p_t. The preamble is prefixed to each - string contained within the braces, and the postscript is then appended - to each resulting string, expanding left to right. + _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 + string, expanding left to right. Brace expansions may be nested. The results of each expanded string are not sorted; left to right order is preserved. For example, @@ -1675,9 +1743,10 @@ EEXXPPAANNSSIIOONN A correctly-formed brace expansion must contain unquoted opening and closing braces, and at least one unquoted comma or a valid sequence ex- - pression. Any incorrectly formed brace expansion is left unchanged. A - {{ or ,, may be quoted with a backslash to prevent its being considered - part of a brace expression. To avoid conflicts with parameter expan- + pression. Any incorrectly formed brace expansion is left unchanged. + + A {{ or ,, may be quoted with a backslash to prevent its being considered + part of a brace expression. To avoid conflicts with parameter expan- sion, the string $${{ is not considered eligible for brace expansion, and inhibits brace expansion until the closing }}. @@ -1688,93 +1757,99 @@ EEXXPPAANNSSIIOONN or chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}} - Brace expansion introduces a slight incompatibility with historical - versions of sshh. sshh does not treat opening or closing braces specially - when they appear as part of a word, and preserves them in the output. - BBaasshh removes braces from words as a consequence of brace expansion. - For example, a word entered to sshh as _f_i_l_e_{_1_,_2_} appears identically in - the output. The same word is output as _f_i_l_e_1 _f_i_l_e_2 after expansion by - bbaasshh. If strict compatibility with sshh is desired, start bbaasshh with the - ++BB option or disable brace expansion with the ++BB option to the sseett com- - mand (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). + Brace expansion introduces a slight incompatibility with historical + versions of sshh. sshh does not treat opening or closing braces specially + when they appear as part of a word, and preserves them in the output. + BBaasshh removes braces from words as a consequence of brace expansion. + For example, a word entered to sshh as _f_i_l_e_{_1_,_2_} appears identically in + the output. BBaasshh outputs that word as _f_i_l_e_1 _f_i_l_e_2 after brace expan- + 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 - value of the shell parameter HHOOMMEE. If HHOOMMEE is unset, the home direc- - tory of the user executing the shell is substituted instead. Other- + 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 with the specified login name. If the tilde-prefix is a "~+", the value of the shell variable PPWWDD re- - places the tilde-prefix. If the tilde-prefix is a "~-", the value of - the shell variable OOLLDDPPWWDD, if it is set, is substituted. If the char- - acters following the tilde in the tilde-prefix consist of a number _N, - optionally prefixed by a "+" or a "-", the tilde-prefix is replaced + 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 with the corresponding element from the directory stack, as it would be - displayed by the ddiirrss builtin invoked with the tilde-prefix as an argu- - ment. If the characters following the tilde in the tilde-prefix con- - sist of a number without a leading "+" or "-", "+" is assumed. + displayed by the ddiirrss builtin invoked with the characters following the + 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 "-", "+" is assumed. + + 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 word is - unchanged. + If the login name is invalid, or the tilde expansion fails, the tilde- + prefix is unchanged. - Each variable assignment is checked for unquoted tilde-prefixes immedi- - ately following a :: or the first ==. In these cases, tilde expansion is - also performed. Consequently, one may use filenames with tildes in as- - signments to PPAATTHH, MMAAIILLPPAATTHH, and CCDDPPAATTHH, and the shell assigns the ex- + 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 _p_o_s_i_x _m_o_d_e. PPaarraammeetteerr EExxppaannssiioonn The "$$" character introduces parameter expansion, command substitution, - or arithmetic expansion. The parameter name or symbol to be expanded - may be enclosed in braces, which are optional but serve to protect the - variable to be expanded from characters immediately following it which + or arithmetic expansion. The parameter name or symbol to be expanded + may be enclosed in braces, which are optional but serve to protect the + variable to be expanded from characters immediately following it which could be interpreted as part of the name. - When braces are used, the matching ending brace is the first "}}" not + When braces are used, the matching ending brace is the first "}}" not escaped by a backslash or within a quoted string, and not within an em- - bedded arithmetic expansion, command substitution, or parameter expan- + bedded arithmetic expansion, command substitution, or parameter expan- sion. + The basic form of parameter expansion is + ${_p_a_r_a_m_e_t_e_r} - The value of _p_a_r_a_m_e_t_e_r is substituted. The braces are required - when _p_a_r_a_m_e_t_e_r is a positional parameter with more than one - 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 + + 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 + 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 _p_a_r_a_m_e_t_e_r is not a _n_a_m_e_r_e_f, it introduces a level of indirection. BBaasshh uses the value formed by expanding the rest of _p_a_r_a_m_e_t_e_r as the new _p_a_- - _r_a_m_e_t_e_r; this is then expanded and that value is used in the rest of - the expansion, rather than the expansion of the original _p_a_r_a_m_e_t_e_r. - This is known as _i_n_d_i_r_e_c_t _e_x_p_a_n_s_i_o_n. The value is subject to tilde ex- - pansion, parameter expansion, command substitution, and arithmetic ex- - pansion. If _p_a_r_a_m_e_t_e_r is a nameref, this expands to the name of the - parameter referenced by _p_a_r_a_m_e_t_e_r instead of performing the complete - indirect expansion. The exceptions to this are the expansions of - ${!!_p_r_e_f_i_x**} and ${!!_n_a_m_e[_@]} described below. The exclamation point - must immediately follow the left brace in order to introduce indirec- - tion. + _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 + 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. - Omitting the colon results in a test only for a parameter that is un- - set. + 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- @@ -1782,18 +1857,21 @@ EEXXPPAANNSSIIOONN is substituted. ${_p_a_r_a_m_e_t_e_r::==_w_o_r_d} AAssssiiggnn DDeeffaauulltt VVaalluueess. If _p_a_r_a_m_e_t_e_r is unset or null, the ex- - pansion of _w_o_r_d is assigned to _p_a_r_a_m_e_t_e_r. The value of _p_a_r_a_m_e_- - _t_e_r is then substituted. Positional parameters and special pa- - rameters may not be assigned to in this way. + 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, - the expansion of _w_o_r_d (or a message to that effect if _w_o_r_d is - not present) is written to the standard error and the shell, if - it is not interactive, exits. Otherwise, the value of _p_a_r_a_m_e_t_e_r + DDiissppllaayy EErrrroorr iiff NNuullll oorr UUnnsseett. If _p_a_r_a_m_e_t_e_r is null or unset, + the expansion of _w_o_r_d (or a message to that effect if _w_o_r_d is + not present) is written to the standard error and the shell, if + it is not interactive, exits with a non-zero status. An inter- + active shell does not exit, but does not execute the command as- + sociated with the expansion. Otherwise, the value of _p_a_r_a_m_e_t_e_r is substituted. ${_p_a_r_a_m_e_t_e_r::++_w_o_r_d} - UUssee AAlltteerrnnaattee VVaalluuee. If _p_a_r_a_m_e_t_e_r is null or unset, nothing is - 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 @@ -1852,30 +1930,31 @@ EEXXPPAANNSSIIOONN each key expands to a separate word. ${##_p_a_r_a_m_e_t_e_r} - PPaarraammeetteerr lleennggtthh. The length in characters of the value of _p_a_- - _r_a_m_e_t_e_r is substituted. If _p_a_r_a_m_e_t_e_r is ** or @@, the value sub- - stituted 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 substituted 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 in- - terpreted as relative to one greater than the maximum 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 element. + 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} ${_p_a_r_a_m_e_t_e_r####_w_o_r_d} 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} @@ -1883,15 +1962,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} @@ -1899,22 +1978,23 @@ 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. _P_a_r_a_m_e_t_e_r is expanded and - the longest match of _p_a_t_t_e_r_n against its value is replaced with - _s_t_r_i_n_g. _s_t_r_i_n_g undergoes tilde expansion, parameter and vari- - able expansion, arithmetic expansion, command and process sub- - stitution, and quote removal. The match is performed using the - rules described under PPaatttteerrnn MMaattcchhiinngg below. 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 second form - above), all matches of _p_a_t_t_e_r_n are replaced with _s_t_r_i_n_g. If - _p_a_t_t_e_r_n is preceded by ## (the third form above), it must match - at the beginning of the expanded value of _p_a_r_a_m_e_t_e_r. If _p_a_t_t_e_r_n - is preceded by %% (the fourth form above), it must match at the - end of the expanded value of _p_a_r_a_m_e_t_e_r. If the expansion of - _s_t_r_i_n_g is null, matches of _p_a_t_t_e_r_n are deleted. If _s_t_r_i_n_g is - null, matches of _p_a_t_t_e_r_n are deleted and the // following _p_a_t_t_e_r_n - may be omitted. + 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. + + 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- + ond form above), all matches of _p_a_t_t_e_r_n are replaced with + _s_t_r_i_n_g. If _p_a_t_t_e_r_n is preceded by ## (the third form above), it + must match at the beginning of the expanded value of _p_a_r_a_m_e_t_e_r. + If _p_a_t_t_e_r_n is preceded by %% (the fourth form above), it must + match at the end of the expanded value of _p_a_r_a_m_e_t_e_r. + + If the expansion of _s_t_r_i_n_g is null, matches of _p_a_t_t_e_r_n are + deleted and the // following _p_a_t_t_e_r_n may be omitted. If the ppaattssuubb__rreeppllaacceemmeenntt shell option is enabled using sshhoopptt, any unquoted instances of && in _s_t_r_i_n_g are replaced with the @@ -1934,37 +2014,47 @@ EEXXPPAANNSSIIOONN want to be taken literally in the replacement and ensure any in- stances of && they want to be replaced are unquoted. - If the nnooccaasseemmaattcchh shell option is enabled, the match is per- - formed without regard to the case of alphabetic characters. If - _p_a_r_a_m_e_t_e_r is @@ or **, the substitution operation is applied to - each positional parameter in turn, and the expansion is the re- - sultant list. If _p_a_r_a_m_e_t_e_r is an array variable subscripted - with @@ or **, the substitution operation is applied to each mem- - ber of the array in turn, and the expansion is the resultant + Like the pattern removal operators, double quotes surrounding + the replacement string quote the expanded characters, while dou- + ble quotes enclosing the entire parameter substitution do not, + since the expansion is performed in a context that doesn't take + any enclosing double quotes into account. + + If the nnooccaasseemmaattcchh shell option is enabled, the match is per- + formed without regard to the case of alphabetic characters. + + If _p_a_r_a_m_e_t_e_r is @@ or **, the substitution operation is applied to + each positional parameter in turn, and the expansion is the re- + sultant list. If _p_a_r_a_m_e_t_e_r is an array variable subscripted + with @@ or **, the substitution operation is applied to each mem- + ber 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} ${_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} ${_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- + 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 ^^ op- - erator 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 character 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 omit- - ted, 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 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 case modification operation is applied to each - member of the array in turn, and the expansion is the resultant - list. + 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. + + 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 + the resultant list. If _p_a_r_a_m_e_t_e_r is an array variable sub- + scripted with @@ or **, the case modification 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@@_o_p_e_r_a_t_o_r} PPaarraammeetteerr ttrraannssffoorrmmaattiioonn. The expansion is either a transforma- @@ -2072,9 +2162,8 @@ EEXXPPAANNSSIIOONN word splitting and pathname expansion on the results. AArriitthhmmeettiicc EExxppaannssiioonn - Arithmetic expansion allows the evaluation of an arithmetic expression - and the substitution of the result. The format for arithmetic expan- - sion is: + Arithmetic expansion evaluates an arithmetic expression and substitutes + the result. The format for arithmetic expansion is: $$((((_e_x_p_r_e_s_s_i_o_n)))) @@ -2087,84 +2176,97 @@ EEXXPPAANNSSIIOONN The evaluation is performed according to the rules listed below under AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN. If _e_x_p_r_e_s_s_i_o_n is invalid, bbaasshh prints a message - indicating failure and no substitution occurs. + to standard error indicating failure, does not perform the substitu- + tion, and does not execute the command associated with the expansion. PPrroocceessss SSuubbssttiittuuttiioonn - _P_r_o_c_e_s_s _s_u_b_s_t_i_t_u_t_i_o_n allows a process's input or output to be referred - to using a filename. It takes the form of <<((_l_i_s_t)) or >>((_l_i_s_t)). The - process _l_i_s_t is run asynchronously, and its input or output appears as + _P_r_o_c_e_s_s _s_u_b_s_t_i_t_u_t_i_o_n allows a process's input or output to be referred + to using a filename. It takes the form of <<((_l_i_s_t)) or >>((_l_i_s_t)). The + process _l_i_s_t is run asynchronously, and its input or output appears as a filename. This filename is passed as an argument to the current com- - mand as the result of the expansion. If the >>((_l_i_s_t)) form is used, - writing to the file will provide input for _l_i_s_t. If the <<((_l_i_s_t)) form - is used, the file passed as an argument should be read to obtain the - output of _l_i_s_t. Process substitution is supported on systems that sup- - port named pipes (_F_I_F_O_s) or the //ddeevv//ffdd method of naming open files. - - When available, process substitution is performed simultaneously with - parameter and variable expansion, command substitution, and arithmetic + mand as the result of the expansion. + + If the >>((_l_i_s_t)) form is used, writing to the file will provide input for + _l_i_s_t. If the <<((_l_i_s_t)) form is used, reading the file will obtain the + output of _l_i_s_t. No space may appear between the << or >> and the left + parenthesis, otherwise the construct would be interpreted as a redirec- + tion. + + Process substitution is supported on systems that support named pipes + (_F_I_F_O_s) or the //ddeevv//ffdd method of naming open files. + + When available, process substitution is performed simultaneously with + parameter and variable expansion, command substitution, and arithmetic expansion. WWoorrdd SSpplliittttiinngg - The shell scans the results of parameter expansion, command substitu- - tion, and arithmetic expansion that did not occur within double quotes + The shell scans the results of parameter expansion, command substitu- + tion, and arithmetic expansion that did not occur within double quotes for _w_o_r_d _s_p_l_i_t_t_i_n_g. - The shell treats each character of IIFFSS as a delimiter, and splits the - results of the other expansions into words using these characters as + The shell treats each character of IIFFSS as a delimiter, and splits the + results of the other expansions into words using these characters as field terminators. If IIFFSS is unset, or its value is exactly <><><>, the de- - fault, then sequences of ssppaaccee, ttaabb, and nneewwlliinnee at the beginning and - end of the results of the previous expansions are ignored, and any se- - quence of IIFFSS characters not at the beginning or end serves to delimit - words. If IIFFSS has a value other than the default, then sequences of - the whitespace characters ssppaaccee, ttaabb, and nneewwlliinnee are ignored at the - beginning and end of the word, as long as the whitespace character is - in the value of IIFFSS (an IIFFSS whitespace character). Any character in - IIFFSS that is not IIFFSS whitespace, along with any adjacent IIFFSS whitespace - characters, delimits a field. A sequence of IIFFSS whitespace characters - is also treated as a delimiter. - - If the value of IIFFSS is null, no word splitting occurs. If IIFFSS is un- - set, word splitting behaves as if it contained the default value of + fault, then sequences of ssppaaccee, ttaabb, and nneewwlliinnee at the beginning and + end of the results of the previous expansions are ignored, and any se- + quence of IIFFSS characters not at the beginning or end delimits words. + If IIFFSS has a value other than the default, then sequences of the white- + space characters ssppaaccee, ttaabb, and nneewwlliinnee present in the value of IIFFSS + (an IIFFSS whitespace character) are ignored at the beginning and end of + the word. Any character in IIFFSS that is not IIFFSS whitespace, along with + any adjacent IIFFSS whitespace characters, delimits a field. A sequence + of IIFFSS whitespace characters is also treated as a delimiter. + + If the value of IIFFSS is null, no word splitting occurs. If IIFFSS is un- + set, word splitting behaves as if it contained the default value of <><><>. - Explicit null arguments ("""" or '''') are retained and passed to commands + Explicit null arguments ("""" or '''') are retained and passed to commands as empty strings. Unquoted implicit null arguments, resulting from the expansion of parameters that have no values, are removed. If a parame- ter with no value is expanded within double quotes, a null argument re- sults and is retained and passed to a command as an empty string. When - a quoted null argument appears as part of a word whose expansion is - non-null, the null argument is removed. That is, the word "-d''" be- + a quoted null argument appears as part of a word whose expansion is + non-null, the null argument is removed. That is, the word "-d''" be- comes "-d" after word splitting and null argument removal. Note that if no expansion occurs, no splitting is performed. PPaatthhnnaammee EExxppaannssiioonn - After word splitting, unless the --ff option has been set, bbaasshh scans - each word for the characters **, ??, and [[. If one of these characters + After word splitting, unless the --ff option has been set, bbaasshh scans + each word for the characters **, ??, and [[. If one of these characters appears, and is not quoted, then the word is regarded as a _p_a_t_t_e_r_n, and - replaced with an alphabetically sorted list of filenames matching the - pattern (see PPaatttteerrnn MMaattcchhiinngg below). If no matching filenames are - found, and the shell option nnuullllgglloobb is not enabled, the word is left - unchanged. If the nnuullllgglloobb option is set, and no matches are found, - the word is removed. If the ffaaiillgglloobb shell option is set, and no - matches are found, an error message is printed and the command is not - executed. If the shell option nnooccaasseegglloobb is enabled, the match is per- - formed without regard to the case of alphabetic characters. When a - pattern is used for pathname expansion, the character "." at the start - of a name or immediately following a slash must be matched explicitly, - unless the shell option ddoottgglloobb is set. In order to match the file- - names "." and "..", the pattern must begin with "." (for example, - ".?"), even if ddoottgglloobb is set. If the gglloobbsskkiippddoottss shell option is en- - abled, the filenames "." and ".." never match, even if the pattern be- - gins with a "." When not matching pathnames, the "." character is not - treated specially. When matching a pathname, the slash character must - always be matched explicitly by a slash in the pattern, but in other - matching contexts it can be matched by a special pattern character as - described below under PPaatttteerrnn MMaattcchhiinngg. See the description of sshhoopptt - below under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS for a description of the nnooccaasseegglloobb, - nnuullllgglloobb, gglloobbsskkiippddoottss, ffaaiillgglloobb, and ddoottgglloobb shell options. + replaced with a sorted list of filenames matching the pattern (see PPaatt-- + tteerrnn MMaattcchhiinngg below) subject to the value of the GGLLOOBBSSOORRTT shell vari- + able. + + If no matching filenames are found, and the shell option nnuullllgglloobb is + not enabled, the word is left unchanged. If the nnuullllgglloobb option is + set, and no matches are found, the word is removed. If the ffaaiillgglloobb + shell option is set, and no matches are found, bbaasshh prints an error + message and does not execute the command. If the shell option nnooccaassee-- + gglloobb is enabled, the match is performed without regard to the case of + alphabetic characters. + + When a pattern is used for pathname expansion, the character "." at the + start of a name or immediately following a slash must be matched ex- + plicitly, unless the shell option ddoottgglloobb is set. In order to match + the filenames "." and "..", the pattern must begin with "." (for exam- + ple, ".?"), even if ddoottgglloobb is set. If the gglloobbsskkiippddoottss shell option + is enabled, the filenames "." and ".." never match, even if the pattern + begins with a ".". When not matching pathnames, the "." character is + not treated specially. + + When matching a pathname, the slash character must always be matched + explicitly by a slash in the pattern, but in other matching contexts it + can be matched by a special pattern character as described below under + PPaatttteerrnn MMaattcchhiinngg. + + See the description of sshhoopptt below under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS for a + description of the nnooccaasseegglloobb, nnuullllgglloobb, gglloobbsskkiippddoottss, ffaaiillgglloobb, and + ddoottgglloobb shell options. The GGLLOOBBIIGGNNOORREE shell variable may be used to restrict the set of file names matching a _p_a_t_t_e_r_n. If GGLLOOBBIIGGNNOORREE is set, each matching file @@ -2174,55 +2276,58 @@ EEXXPPAANNSSIIOONN case. The filenames "." and ".." are always ignored when GGLLOOBBIIGGNNOORREE is set and not null. However, setting GGLLOOBBIIGGNNOORREE to a non-null value has the effect of enabling the ddoottgglloobb shell option, so all other filenames - beginning with a Q . will match. To get the old behavior of ignoring + beginning with a "." will match. To get the old behavior of ignoring filenames beginning with a ".", make ".*" one of the patterns in GGLLOO-- BBIIGGNNOORREE. The ddoottgglloobb option is disabled when GGLLOOBBIIGGNNOORREE is unset. The - pattern matching honors the setting of the eexxttgglloobb shell option. + GGLLOOBBIIGGNNOORREE pattern matching honors the setting of the eexxttgglloobb shell op- + tion. - The GGLLOOBBSSOORRTT variable controls how the results of pathname expansion - are sorted, as described above. + The GGLLOOBBSSOORRTT shell variable controls how the results of pathname expan- + sion are sorted, as described above. PPaatttteerrnn MMaattcchhiinngg Any character that appears in a pattern, other than the special pattern - characters described below, matches itself. The NUL character may not - occur in a pattern. A backslash escapes the following character; the - escaping backslash is discarded when matching. The special pattern + characters described below, matches itself. The NUL character may not + occur in a pattern. A backslash escapes the following character; the + escaping backslash is discarded when matching. The special pattern characters must be quoted if they are to be matched literally. The special pattern characters have the following meanings: - ** Matches any string, including the null string. When the - gglloobbssttaarr shell option is enabled, and ** is used in a - pathname expansion context, two adjacent **s used as a - single pattern will match all files and zero or more di- - rectories and subdirectories. If followed by a //, two - adjacent **s will match only directories and subdirecto- + ** Matches any string, including the null string. When the + gglloobbssttaarr shell option is enabled, and ** is used in a + pathname expansion context, two adjacent **s used as a + single pattern will match all files and zero or more di- + rectories and subdirectories. If followed by a //, two + adjacent **s will match only directories and subdirecto- ries. ?? Matches any single character. - [[...]] Matches any one of the enclosed characters. A pair of - characters separated by a hyphen denotes a _r_a_n_g_e _e_x_p_r_e_s_- - _s_i_o_n; any character that falls between those two charac- + [[...]] Matches any one of the enclosed characters. A pair of + characters separated by a hyphen denotes a _r_a_n_g_e _e_x_p_r_e_s_- + _s_i_o_n; any character that falls between those two charac- ters, inclusive, using the current locale's collating se- - quence and character set, is matched. If the first char- - acter following the [[ is a !! or a ^^ then any character - not enclosed is matched. The sorting order of characters - in range expressions, and the characters included in the - range, are determined by the current locale and the val- - ues of the LLCC__CCOOLLLLAATTEE or LLCC__AALLLL shell variables, if set. - To obtain the traditional interpretation of range expres- - sions, where [[aa--dd]] is equivalent to [[aabbccdd]], set value of - the LLCC__AALLLL shell variable to CC, or enable the gglloobbaassccii-- - iirraannggeess shell option. A -- may be matched by including it - as the first or last character in the set. A ]] may be - matched by including it as the first character in the - set. - - Within [[ and ]], _c_h_a_r_a_c_t_e_r _c_l_a_s_s_e_s can be specified using + quence and character set, matches. If the first charac- + ter following the [[ is a !! or a ^^ then any character not + within the range matches. A -- may be matched by includ- + ing it as the first or last character in the set. A ]] + may be matched by including it as the first character in + the set. + + The sorting order of characters in range expressions, and + the characters included in the range, are determined by + the current locale and the values of the LLCC__CCOOLLLLAATTEE or + LLCC__AALLLL shell variables, if set. To obtain the tradi- + tional interpretation of range expressions, where [[aa--dd]] + is equivalent to [[aabbccdd]], set the value of the LLCC__CCOOLLLLAATTEE + or LLCC__AALLLL shell variables to CC, or enable the gglloobbaassccii-- + iirraannggeess shell option. + + Within [[ and ]], _c_h_a_r_a_c_t_e_r _c_l_a_s_s_e_s can be specified using the syntax [[::_c_l_a_s_s::]], where _c_l_a_s_s is one of the following classes defined in the POSIX standard: - aallnnuumm aallpphhaa aasscciiii bbllaannkk ccnnttrrll ddiiggiitt ggrraapphh lloowweerr pprriinntt + aallnnuumm aallpphhaa aasscciiii bbllaannkk ccnnttrrll ddiiggiitt ggrraapphh lloowweerr pprriinntt ppuunncctt ssppaaccee uuppppeerr wwoorrdd xxddiiggiitt A character class matches any character belonging to that @@ -2230,43 +2335,44 @@ EEXXPPAANNSSIIOONN and the character _. Within [[ and ]], an _e_q_u_i_v_a_l_e_n_c_e _c_l_a_s_s can be specified us- - ing the syntax [[==_c==]], which matches all characters with - the same collation weight (as defined by the current lo- + ing the syntax [[==_c==]], which matches all characters with + the same collation weight (as defined by the current lo- cale) as the character _c. Within [[ and ]], the syntax [[.._s_y_m_b_o_l..]] matches the collat- ing symbol _s_y_m_b_o_l. - If the eexxttgglloobb shell option is enabled using the sshhoopptt builtin, the - shell recognizes several extended pattern matching operators. In the + If the eexxttgglloobb shell option is enabled using the sshhoopptt builtin, the + shell recognizes several extended pattern matching operators. In the following description, a _p_a_t_t_e_r_n_-_l_i_s_t is a list of one or more patterns - separated by a ||. Composite patterns may be formed using one or more + separated by a ||. Composite patterns may be formed using one or more of the following sub-patterns: ??((_p_a_t_t_e_r_n_-_l_i_s_t)) - Matches zero or one occurrence of the given patterns + Matches zero or one occurrence of the given patterns. **((_p_a_t_t_e_r_n_-_l_i_s_t)) - Matches zero or more occurrences of the given patterns + Matches zero or more occurrences of the given patterns. ++((_p_a_t_t_e_r_n_-_l_i_s_t)) - Matches one or more occurrences of the given patterns + Matches one or more occurrences of the given patterns. @@((_p_a_t_t_e_r_n_-_l_i_s_t)) - Matches one of the given patterns + Matches one of the given patterns. !!((_p_a_t_t_e_r_n_-_l_i_s_t)) - Matches anything except one of the given patterns + Matches anything except one of the given patterns. The eexxttgglloobb option changes the behavior of the parser, since the paren- - theses are normally treated as operators with syntactic meaning. To - ensure that extended matching patterns are parsed correctly, make sure - that eexxttgglloobb is enabled before parsing constructs containing the pat- + theses are normally treated as operators with syntactic meaning. To + ensure that extended matching patterns are parsed correctly, make sure + that eexxttgglloobb is enabled before parsing constructs containing the pat- terns, including shell functions and command substitutions. When matching filenames, the ddoottgglloobb shell option determines the set of - filenames that are tested: when ddoottgglloobb is enabled, the set of file- - names includes all files beginning with ".", but "." and ".." must be - matched by a pattern or sub-pattern that begins with a dot; when it is + filenames that are tested: when ddoottgglloobb is enabled, the set of file- + names includes all files beginning with ".", but "." and ".." must be + matched by a pattern or sub-pattern that begins with a dot; when it is disabled, the set does not include any filenames beginning with "." un- - less the pattern or sub-pattern begins with a ".". As above, "." only - has a special meaning when matching filenames. + less the pattern or sub-pattern begins with a ".". If the gglloobbsskkiippddoottss + shell option is enabled, the filenames "." and ".." never appear in the + set. As above, "." only has a special meaning when matching filenames. Complicated extended pattern matching against long strings is slow, es- pecially when the patterns contain alternations and the strings contain @@ -2283,21 +2389,21 @@ RREEDDIIRREECCTTIIOONN using a special notation interpreted by the shell. _R_e_d_i_r_e_c_t_i_o_n allows commands' file handles to be duplicated, opened, closed, made to refer to different files, and can change the files the command reads from and - writes to. Redirection may also be used to modify file handles in the - current shell execution environment. The following redirection opera- - tors may precede or appear anywhere within a _s_i_m_p_l_e _c_o_m_m_a_n_d or may fol- - low a _c_o_m_m_a_n_d. Redirections are processed in the order they appear, - from left to right. + writes to. When used with the eexxeecc builtin, redirections modify file + handles in the current shell execution environment. The following + redirection operators may precede or appear anywhere within a _s_i_m_p_l_e + _c_o_m_m_a_n_d or may follow a _c_o_m_m_a_n_d. Redirections are processed in the or- + der they appear, from left to right. Each redirection that may be preceded by a file descriptor number may instead be preceded by a word of the form {_v_a_r_n_a_m_e}. In this case, for each redirection operator except >&- and <&-, the shell will allocate a file descriptor greater than or equal to 10 and assign it to _v_a_r_n_a_m_e. - If >&- or <&- is preceded by {_v_a_r_n_a_m_e}, the value of _v_a_r_n_a_m_e defines - the file descriptor to close. If {_v_a_r_n_a_m_e} is supplied, the redirec- - tion persists beyond the scope of the command, allowing the shell pro- - grammer to manage the file descriptor's lifetime manually. The - vvaarrrreeddiirr__cclloossee shell option manages this behavior. + If {_v_a_r_n_a_m_e} precedes >&- or <&-, the value of _v_a_r_n_a_m_e defines the file + descriptor to close. If {_v_a_r_n_a_m_e} is supplied, the redirection per- + sists beyond the scope of the command, which allows the shell program- + mer to manage the file descriptor's lifetime manually without using the + eexxeecc builtin. The vvaarrrreeddiirr__cclloossee shell option manages this behavior. In the following descriptions, if the file descriptor number is omit- ted, and the first character of the redirection operator is <<, the @@ -2305,35 +2411,33 @@ RREEDDIIRREECCTTIIOONN first character of the redirection operator is >>, the redirection refers to the standard output (file descriptor 1). - The word following the redirection operator in the following descrip- + The _w_o_r_d following the redirection operator in the following descrip- tions, unless otherwise noted, is subjected to brace expansion, tilde expansion, parameter and variable expansion, command substitution, arithmetic expansion, quote removal, pathname expansion, and word splitting. If it expands to more than one word, bbaasshh reports an error. - Note that the order of redirections is significant. For example, the - command + The order of redirections is significant. For example, the command ls >> dirlist 2>>&&1 - directs both standard output and standard error to the file _d_i_r_l_i_s_t, + directs both standard output and standard error to the file _d_i_r_l_i_s_t, while the command ls 2>>&&1 >> dirlist - directs only the standard output to file _d_i_r_l_i_s_t, because the standard - error was duplicated from the standard output before the standard out- - put was redirected to _d_i_r_l_i_s_t. + directs only the standard output to file _d_i_r_l_i_s_t, because the standard + error was directed to the standard output before the standard output + was redirected to _d_i_r_l_i_s_t. BBaasshh handles several filenames specially when they are used in redirec- tions, as described in the following table. If the operating system on - which bbaasshh is running provides these special files, bash will use them; - otherwise it will emulate them internally with the behavior described + which bbaasshh is running provides these special files, bbaasshh will use them; + otherwise it will emulate them internally with the behavior described below. //ddeevv//ffdd//_f_d - If _f_d is a valid integer, file descriptor _f_d is dupli- - cated. + If _f_d is a valid integer, duplicate file descriptor _f_d. //ddeevv//ssttddiinn File descriptor 0 is duplicated. //ddeevv//ssttddoouutt @@ -2356,20 +2460,19 @@ RREEDDIIRREECCTTIIOONN nally. RReeddiirreeccttiinngg IInnppuutt - Redirection of input causes the file whose name results from the expan- - sion of _w_o_r_d to be opened for reading on file descriptor _n, or the - standard input (file descriptor 0) if _n is not specified. + Redirecting input opens the file whose name results from the expansion + of _w_o_r_d for reading on file descriptor _n, or the standard input (file + descriptor 0) if _n is not specified. The general format for redirecting input is: [_n]<<_w_o_r_d RReeddiirreeccttiinngg OOuuttppuutt - Redirection of output causes the file whose name results from the ex- - pansion of _w_o_r_d to be opened for writing on file descriptor _n, or the - standard output (file descriptor 1) if _n is not specified. If the file - does not exist it is created; if it does exist it is truncated to zero - size. + Redirecting output opens the file whose name results from the expansion + of _w_o_r_d for writing on file descriptor _n, or the standard output (file + descriptor 1) if _n is not specified. If the file does not exist it is + created; if it does exist it is truncated to zero size. The general format for redirecting output is: @@ -2379,23 +2482,23 @@ RREEDDIIRREECCTTIIOONN builtin has been enabled, the redirection will fail if the file whose name results from the expansion of _w_o_r_d exists and is a regular file. If the redirection operator is >>||, or the redirection operator is >> and - the nnoocclloobbbbeerr option to the sseett builtin command is not enabled, the - redirection is attempted even if the file named by _w_o_r_d exists. + the nnoocclloobbbbeerr option to the sseett builtin command is not enabled, bbaasshh + attempts the redirection even if the file named by _w_o_r_d exists. AAppppeennddiinngg RReeddiirreecctteedd OOuuttppuutt - Redirection of output in this fashion causes the file whose name re- - sults from the expansion of _w_o_r_d to be opened for appending on file de- - scriptor _n, or the standard output (file descriptor 1) if _n is not - specified. If the file does not exist it is created. + Redirecting output in this fashion opens the file whose name results + from the expansion of _w_o_r_d for appending on file descriptor _n, or the + standard output (file descriptor 1) if _n is not specified. If the file + does not exist it is created. The general format for appending output is: [_n]>>>>_w_o_r_d RReeddiirreeccttiinngg SSttaannddaarrdd OOuuttppuutt aanndd SSttaannddaarrdd EErrrroorr - This construct allows both the standard output (file descriptor 1) and - the standard error output (file descriptor 2) to be redirected to the - file whose name is the expansion of _w_o_r_d. + This construct redirects both the standard output (file descriptor 1) + and the standard error output (file descriptor 2) to the file whose + name is the expansion of _w_o_r_d. There are two formats for redirecting standard output and standard er- ror: @@ -2414,9 +2517,9 @@ RREEDDIIRREECCTTIIOONN ssccrriippttoorrss below) for compatibility reasons. AAppppeennddiinngg SSttaannddaarrdd OOuuttppuutt aanndd SSttaannddaarrdd EErrrroorr - This construct allows both the standard output (file descriptor 1) and - the standard error output (file descriptor 2) to be appended to the - file whose name is the expansion of _w_o_r_d. + This construct appends both the standard output (file descriptor 1) and + the standard error output (file descriptor 2) to the file whose name is + the expansion of _w_o_r_d. The format for appending standard output and standard error is: @@ -2431,9 +2534,9 @@ RREEDDIIRREECCTTIIOONN HHeerree DDooccuummeennttss This type of redirection instructs the shell to read input from the current source until it reads a line containing only _d_e_l_i_m_i_t_e_r (with no - trailing blanks). All of the lines read up to that point are then used - as the standard input (or file descriptor _n if _n is specified) for a - command. + trailing blanks). All of the lines read up to that point then become + the standard input (or file descriptor _n if _n is specified) for a com- + mand. The format of here-documents is: @@ -2441,29 +2544,38 @@ RREEDDIIRREECCTTIIOONN _h_e_r_e_-_d_o_c_u_m_e_n_t _d_e_l_i_m_i_t_e_r - No parameter and variable expansion, command substitution, arithmetic - expansion, or pathname expansion is performed on _w_o_r_d. + The shell does not perform parameter and variable expansion, command + substitution, arithmetic expansion, or pathname expansion is performed + on _w_o_r_d. If any part of _w_o_r_d is quoted, the _d_e_l_i_m_i_t_e_r is the result of quote re- moval on _w_o_r_d, and the lines in the here-document are not expanded. If - _w_o_r_d is unquoted, the _d_e_l_i_m_i_t_e_r is _w_o_r_d itself, all lines of the here- - document are subjected to parameter expansion, command substitution, - and arithmetic expansion, the character sequence \\<> is ignored, - and \\ must be used to quote the characters \\, $$, and ``. - - If the redirection operator is <<<<--, then all leading tab characters are - stripped from input lines and the line containing _d_e_l_i_m_i_t_e_r. This al- - lows here-documents within shell scripts to be indented in a natural - fashion. + _w_o_r_d is unquoted, the _d_e_l_i_m_i_t_e_r is _w_o_r_d itself, and the here-document + text is treated similarly to a double-quoted string: all lines of the + here-document are subjected to parameter expansion, command substitu- + tion, and arithmetic expansion, the character sequence \\<> is + treated literally, and \\ must be used to quote the characters \\, $$, and + ``; however, double quote characters have no special meaning. + + If the redirection operator is <<<<--, then the shell strips all leading + tab characters from input lines and the line containing _d_e_l_i_m_i_t_e_r. + This allows here-documents within shell scripts to be indented in a + natural fashion. + + If the delimiter is not quoted, the \\<> sequence is treated as a + line continuation: the two lines are joined and the backslash-newline + is removed. This happens while reading the here-document, before the + check for the ending delimiter, so joined lines can form the end delim- + iter. HHeerree SSttrriinnggss A variant of here documents, the format is: [_n]<<<<<<_w_o_r_d - The _w_o_r_d undergoes tilde expansion, parameter and variable expansion, - command substitution, arithmetic expansion, and quote removal. Path- - name expansion and word splitting are not performed. The result is + The _w_o_r_d undergoes tilde expansion, parameter and variable expansion, + command substitution, arithmetic expansion, and quote removal. Path- + name expansion and word splitting are not performed. The result is supplied as a single string, with a newline appended, to the command on its standard input (or file descriptor _n if _n is specified). @@ -2473,23 +2585,23 @@ RREEDDIIRREECCTTIIOONN [_n]<<&&_w_o_r_d is used to duplicate input file descriptors. If _w_o_r_d expands to one or - more digits, the file descriptor denoted by _n is made to be a copy of - that file descriptor. If the digits in _w_o_r_d do not specify a file de- - scriptor open for input, a redirection error occurs. If _w_o_r_d evaluates - to --, file descriptor _n is closed. If _n is not specified, the standard - input (file descriptor 0) is used. + more digits, file descriptor _n is made to be a copy of that file de- + scriptor. It is a redirection error if the digits in _w_o_r_d do not spec- + ify a file descriptor open for input. If _w_o_r_d evaluates to --, file de- + scriptor _n is closed. If _n is not specified, this uses the standard + input (file descriptor 0). The operator [_n]>>&&_w_o_r_d - is used similarly to duplicate output file descriptors. If _n is not - specified, the standard output (file descriptor 1) is used. If the - digits in _w_o_r_d do not specify a file descriptor open for output, a - redirection error occurs. If _w_o_r_d evaluates to --, file descriptor _n is + is used similarly to duplicate output file descriptors. If _n is not + specified, this uses the standard output (file descriptor 1). It is a + redirection error if the digits in _w_o_r_d do not specify a file descrip- + tor open for output. If _w_o_r_d evaluates to --, file descriptor _n is closed. As a special case, if _n is omitted, and _w_o_r_d does not expand - to one or more digits or --, the standard output and standard error are - redirected as described previously. + to one or more digits or --, this redirects the standard output and + standard error as described previously. MMoovviinngg FFiillee DDeessccrriippttoorrss The redirection operator @@ -2512,9 +2624,9 @@ RREEDDIIRREECCTTIIOONN [_n]<<>>_w_o_r_d - causes the file whose name is the expansion of _w_o_r_d to be opened for - both reading and writing on file descriptor _n, or on file descriptor 0 - if _n is not specified. If the file does not exist, it is created. + opens the file whose name is the expansion of _w_o_r_d for both reading and + writing on file descriptor _n, or on file descriptor 0 if _n is not spec- + ified. If the file does not exist, it is created. AALLIIAASSEESS _A_l_i_a_s_e_s allow a string to be substituted for a word that is in a posi- @@ -2524,7 +2636,7 @@ AALLIIAASSEESS below). If the shell reads an unquoted word in the right position, it checks - the word to see if it matches an alias name. If it matches, the shell + the word to see if it matches an alias name. If it matches, the shell replaces the word with the alias value, and reads that value as if it had been read instead of the word. The shell doesn't look at any char- acters following the word before attempting alias substitution. @@ -2538,14 +2650,15 @@ AALLIIAASSEESS instance, and bbaasshh does not try to recursively expand the replacement text. - If the last character of the alias value is a _b_l_a_n_k, then the next com- - mand word following the alias is also checked for alias expansion. + If the last character of the alias value is a _b_l_a_n_k, the shell checks + the next command word following the alias for alias expansion. Aliases are created and listed with the aalliiaass command, and removed with the uunnaalliiaass command. - There is no mechanism for using arguments in the replacement text. If - arguments are needed, use a shell function (see FFUUNNCCTTIIOONNSS below). + There is no mechanism for using arguments in the replacement text. If + arguments are needed, use a shell function (see FFUUNNCCTTIIOONNSS below) in- + stead. Aliases are not expanded when the shell is not interactive, unless the eexxppaanndd__aalliiaasseess shell option is set using sshhoopptt (see the description of @@ -2557,29 +2670,32 @@ AALLIIAASSEESS commands on that line or the compound command. Aliases are expanded when a command is read, not when it is executed. Therefore, an alias definition appearing on the same line as another command does not take - effect until the next line of input is read. The commands following - the alias definition on that line are not affected by the new alias. - This behavior is also an issue when functions are executed. Aliases - are expanded when a function definition is read, not when the function - is executed, because a function definition is itself a command. As a - consequence, aliases defined in a function are not available until af- - ter that function is executed. To be safe, always put alias defini- - tions on a separate line, and do not use aalliiaass in compound commands. - - For almost every purpose, aliases are superseded by shell functions. + effect until the shell reads the next line of input. The commands fol- + lowing the alias definition on that line are not affected by the new + alias. This behavior is also an issue when functions are executed. + Aliases are expanded when a function definition is read, not when the + function is executed, because a function definition is itself a com- + mand. As a consequence, aliases defined in a function are not avail- + able until after that function is executed. To be safe, always put + alias definitions on a separate line, and do not use aalliiaass in compound + commands. + + For almost every purpose, shell functions are preferable to aliases. FFUUNNCCTTIIOONNSS A shell function, defined as described above under SSHHEELLLL GGRRAAMMMMAARR, stores a series of commands for later execution. When the name of a - shell function is used as a simple command name, the list of commands - associated with that function name is executed. Functions are executed - in the context of the current shell; no new process is created to in- - terpret them (contrast this with the execution of a shell script). - When a function is executed, the arguments to the function become the + shell function is used as a simple command name, the shell executes the + list of commands associated with that function name. Functions are ex- + ecuted in the context of the calling shell; there is no new process + created to interpret them (contrast this with the execution of a shell + script). + + When a function is executed, the arguments to the function become the positional parameters during its execution. The special parameter ## is - updated to reflect the change. Special parameter 00 is unchanged. The - first element of the FFUUNNCCNNAAMMEE variable is set to the name of the func- - tion while the function is executing. + updated to reflect the new positional parameters. Special parameter 00 + is unchanged. The first element of the FFUUNNCCNNAAMMEE variable is set to the + name of the function while the function is executing. All other aspects of the shell execution environment are identical be- tween a function and its caller with these exceptions: the DDEEBBUUGG and @@ -2591,7 +2707,7 @@ FFUUNNCCTTIIOONNSS traps), and the EERRRR trap is not inherited unless the --oo eerrrrttrraaccee shell option has been enabled. - Variables local to the function may be declared with the llooccaall builtin + Variables local to the function are declared with the llooccaall builtin command (_l_o_c_a_l _v_a_r_i_a_b_l_e_s). Ordinarily, variables and their values are shared between the function and its caller. If a variable is declared llooccaall, the variable's visible scope is restricted to that function and @@ -2600,15 +2716,16 @@ FFUUNNCCTTIIOONNSS In the following description, the _c_u_r_r_e_n_t _s_c_o_p_e is a currently- execut- ing function. Previous scopes consist of that function's caller and so on, back to the "global" scope, where the shell is not executing any - shell function. Consequently, a local variable at the current scope is - a variable declared using the llooccaall or ddeeccllaarree builtins in the function - that is currently executing. + shell function. A local variable at the current scope is a variable + declared using the llooccaall or ddeeccllaarree builtins in the function that is + currently executing. Local variables "shadow" variables with the same name declared at pre- vious scopes. For instance, a local variable declared in a function - hides a global variable of the same name: references and assignments - refer to the local variable, leaving the global variable unmodified. - When the function returns, the global variable is once again visible. + hides variables with the same name declared at previous scopes, includ- + ing global variables: references and assignments refer to the local + variable, leaving the variables at previous scopes unmodified. When + the function returns, the global variable is once again visible. The shell uses _d_y_n_a_m_i_c _s_c_o_p_i_n_g to control a variable's visibility within functions. With dynamic scoping, visible variables and their @@ -2641,40 +2758,46 @@ FFUUNNCCTTIIOONNSS If the builtin command rreettuurrnn is executed in a function, the function completes and execution resumes with the next command after the func- - tion call. Any command associated with the RREETTUURRNN trap is executed be- - fore execution resumes. When a function completes, the values of the - positional parameters and the special parameter ## are restored to the - values they had prior to the function's execution. - - Function names and definitions may be listed with the --ff option to the - ddeeccllaarree or ttyyppeesseett builtin commands. The --FF option to ddeeccllaarree or ttyyppee-- - sseett will list the function names only (and optionally the source file - and line number, if the eexxttddeebbuugg shell option is enabled). Functions - may be exported so that child shell processes (those created when exe- - cuting a separate shell invocation) automatically have them defined - with the --ff option to the eexxppoorrtt builtin. A function definition may be - deleted using the --ff option to the uunnsseett builtin. + tion call. If rreettuurrnn is supplied a numeric argument, that is the func- + tion's return status; otherwise the function's return status is the + exit status of the last command executed before the rreettuurrnn. Any com- + mand associated with the RREETTUURRNN trap is executed before execution re- + sumes. When a function completes, the values of the positional parame- + ters and the special parameter ## are restored to the values they had + prior to the function's execution. + + The --ff option to the ddeeccllaarree or ttyyppeesseett builtin commands will list + function names and definitions. The --FF option to ddeeccllaarree or ttyyppeesseett + will list the function names only (and optionally the source file and + line number, if the eexxttddeebbuugg shell option is enabled). Functions may + be exported so that child shell processes (those created when executing + a separate shell invocation) automatically have them defined with the + --ff option to the eexxppoorrtt builtin. The --ff option to the uunnsseett builtin + will delete a function definition. Functions may be recursive. The FFUUNNCCNNEESSTT variable may be used to limit - the depth of the function call stack and restrict the number of func- - tion invocations. By default, no limit is imposed on the number of re- - cursive calls. + the depth of the function call stack and restrict the number of func- + tion invocations. By default, bbaasshh imposes no limit on the number of + recursive calls. AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN The shell allows arithmetic expressions to be evaluated, under certain circumstances (see the lleett and ddeeccllaarree builtin commands, the (((( com- - pound command, and AArriitthhmmeettiicc EExxppaannssiioonn). Evaluation is done in fixed- - width integers with no check for overflow, though division by 0 is - trapped and flagged as an error. The operators and their precedence, - associativity, and values are the same as in the C language. The fol- - lowing list of operators is grouped into levels of equal-precedence op- - erators. The levels are listed in order of decreasing precedence. + pound command, the arithmetic ffoorr command, the [[[[ conditional command, + and AArriitthhmmeettiicc EExxppaannssiioonn). + + Evaluation is done in the largest fixed-width integers available, with + no check for overflow, though division by 0 is trapped and flagged as + an error. The operators and their precedence, associativity, and val- + ues are the same as in the C language. The following list of operators + is grouped into levels of equal-precedence operators. The levels are + listed in order of decreasing precedence. _i_d++++ _i_d---- variable post-increment and post-decrement - -- ++ unary minus and plus ++++_i_d ----_i_d variable pre-increment and pre-decrement + -- ++ unary minus and plus !! ~~ logical and bitwise negation **** exponentiation ** // %% multiplication, division, remainder @@ -2698,8 +2821,11 @@ AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN Shell variables are allowed as operands; parameter expansion is per- formed before the expression is evaluated. Within an expression, shell variables may also be referenced by name without using the parameter - expansion syntax. A shell variable that is null or unset evaluates to - 0 when referenced by name without using the parameter expansion syntax. + expansion syntax. This means you can use "x", where _x is a shell vari- + able name, in an arithmetic expression, and the shell will evaluate its + value as an expression and use the result. A shell variable that is + null or unset evaluates to 0 when referenced by name in an expression. + The value of a variable is evaluated as an arithmetic expression when it is referenced, or when a variable which has been given the _i_n_t_e_g_e_r attribute using ddeeccllaarree --ii is assigned a value. A null value evaluates @@ -2718,9 +2844,8 @@ AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN percase letters may be used interchangeably to represent numbers be- tween 10 and 35. - Operators are evaluated in order of precedence. Sub-expressions in - parentheses are evaluated first and may override the precedence rules - above. + Operators are evaluated in precedence order. Sub-expressions in paren- + theses are evaluated first and may override the precedence rules above. CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS Conditional expressions are used by the [[[[ compound command and the @@ -2729,23 +2854,27 @@ CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS behavior based on the number of arguments; see the descriptions of those commands for any other command-specific actions. - Expressions are formed from the following unary or binary primaries. - BBaasshh handles several filenames specially when they are used in expres- + Expressions are formed from the unary or binary primaries listed below. + Unary expressions are often used to examine the status of a file or + shell variable. Binary operators are used for string, numeric, and + file attribute comparisons. + + BBaasshh handles several filenames specially when they are used in expres- sions. If the operating system on which bbaasshh is running provides these - special files, bash will use them; otherwise it will emulate them in- - ternally with this behavior: If any _f_i_l_e argument to one of the pri- + special files, bash will use them; otherwise it will emulate them in- + ternally with this behavior: If any _f_i_l_e argument to one of the pri- maries is of the form _/_d_e_v_/_f_d_/_n, then file descriptor _n is checked. If - the _f_i_l_e argument to one of the primaries is one of _/_d_e_v_/_s_t_d_i_n, - _/_d_e_v_/_s_t_d_o_u_t, or _/_d_e_v_/_s_t_d_e_r_r, file descriptor 0, 1, or 2, respectively, + the _f_i_l_e argument to one of the primaries is one of _/_d_e_v_/_s_t_d_i_n, + _/_d_e_v_/_s_t_d_o_u_t, or _/_d_e_v_/_s_t_d_e_r_r, file descriptor 0, 1, or 2, respectively, is checked. Unless otherwise specified, primaries that operate on files follow sym- bolic links and operate on the target of the link, rather than the link itself. - When used with [[[[, or when the shell is in _p_o_s_i_x _m_o_d_e, the << and >> op- - erators sort lexicographically using the current locale. When the - shell is not in _p_o_s_i_x _m_o_d_e, the tteesstt command sorts using ASCII order- + When used with [[[[, or when the shell is in _p_o_s_i_x _m_o_d_e, the << and >> op- + erators sort lexicographically using the current locale. When the + shell is not in _p_o_s_i_x _m_o_d_e, the tteesstt command sorts using ASCII order- ing. --aa _f_i_l_e @@ -2784,21 +2913,12 @@ CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS --LL _f_i_l_e True if _f_i_l_e exists and is a symbolic link. --NN _f_i_l_e - True if _f_i_l_e exists and has been modified since it was last - read. + True if _f_i_l_e exists and has been modified since it was last ac- + cessed. --OO _f_i_l_e True if _f_i_l_e exists and is owned by the effective user id. --SS _f_i_l_e True if _f_i_l_e exists and is a socket. - _f_i_l_e_1 --eeff _f_i_l_e_2 - True if _f_i_l_e_1 and _f_i_l_e_2 refer to the same device and inode num- - bers. - _f_i_l_e_1 -nntt _f_i_l_e_2 - True if _f_i_l_e_1 is newer (according to modification date) than - _f_i_l_e_2, or if _f_i_l_e_1 exists and _f_i_l_e_2 does not. - _f_i_l_e_1 -oott _f_i_l_e_2 - True if _f_i_l_e_1 is older than _f_i_l_e_2, or if _f_i_l_e_2 exists and _f_i_l_e_1 - does not. --oo _o_p_t_n_a_m_e True if the shell option _o_p_t_n_a_m_e is enabled. See the list of options under the description of the --oo option to the sseett @@ -2825,104 +2945,112 @@ CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS command for POSIX conformance. When used with the [[[[ command, this performs pattern matching as described above (CCoommppoouunndd CCoomm-- mmaannddss). - _s_t_r_i_n_g_1 !!== _s_t_r_i_n_g_2 True if the strings are not equal. - _s_t_r_i_n_g_1 << _s_t_r_i_n_g_2 True if _s_t_r_i_n_g_1 sorts before _s_t_r_i_n_g_2 lexicographically. - _s_t_r_i_n_g_1 >> _s_t_r_i_n_g_2 True if _s_t_r_i_n_g_1 sorts after _s_t_r_i_n_g_2 lexicographically. + _f_i_l_e_1 --eeff _f_i_l_e_2 + True if _f_i_l_e_1 and _f_i_l_e_2 refer to the same device and inode num- + bers. + _f_i_l_e_1 -nntt _f_i_l_e_2 + True if _f_i_l_e_1 is newer (according to modification date) than + _f_i_l_e_2, or if _f_i_l_e_1 exists and _f_i_l_e_2 does not. + _f_i_l_e_1 -oott _f_i_l_e_2 + True if _f_i_l_e_1 is older than _f_i_l_e_2, or if _f_i_l_e_2 exists and _f_i_l_e_1 + does not. + _a_r_g_1 OOPP _a_r_g_2 - OOPP is one of --eeqq, --nnee, --lltt, --llee, --ggtt, or --ggee. These arithmetic - binary operators return true if _a_r_g_1 is equal to, not equal to, - less than, less than or equal to, greater than, or greater than - or equal to _a_r_g_2, respectively. _A_r_g_1 and _a_r_g_2 may be positive - or negative integers. When used with the [[[[ command, _A_r_g_1 and - _A_r_g_2 are evaluated as arithmetic expressions (see AARRIITTHHMMEETTIICC + OOPP is one of --eeqq, --nnee, --lltt, --llee, --ggtt, or --ggee. These arithmetic + binary operators return true if _a_r_g_1 is equal to, not equal to, + less than, less than or equal to, greater than, or greater than + or equal to _a_r_g_2, respectively. _a_r_g_1 and _a_r_g_2 may be positive + or negative integers. When used with the [[[[ command, _a_r_g_1 and + _a_r_g_2 are evaluated as arithmetic expressions (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN above). SSIIMMPPLLEE CCOOMMMMAANNDD EEXXPPAANNSSIIOONN - When a simple command is executed, the shell performs the following ex- - pansions, assignments, and redirections, from left to right, in the + When the shell executes a simple command, it performs the following ex- + pansions, assignments, and redirections, from left to right, in the following order. - 1. The words that the parser has marked as variable assignments - (those preceding the command name) and redirections are saved + 1. The words that the parser has marked as variable assignments + (those preceding the command name) and redirections are saved for later processing. - 2. The words that are not variable assignments or redirections are - expanded. If any words remain after expansion, the first word - is taken to be the name of the command and the remaining words + 2. The words that are not variable assignments or redirections are + expanded. If any words remain after expansion, the first word + is taken to be the name of the command and the remaining words are the arguments. 3. Redirections are performed as described above under RREEDDIIRREECCTTIIOONN. 4. The text after the == in each variable assignment undergoes tilde expansion, parameter expansion, command substitution, arithmetic - expansion, and quote removal before being assigned to the vari- + expansion, and quote removal before being assigned to the vari- able. If no command name results, the variable assignments affect the current - shell environment. In the case of such a command (one that consists - only of assignment statements and redirections), assignment statements - are performed before redirections. Otherwise, the variables are added - to the environment of the executed command and do not affect the cur- + shell environment. In the case of such a command (one that consists + only of assignment statements and redirections), assignment statements + are performed before redirections. Otherwise, the variables are added + to the environment of the executed command and do not affect the cur- rent shell environment. If any of the assignments attempts to assign a - value to a readonly variable, an error occurs, and the command exits + value to a readonly variable, an error occurs, and the command exits with a non-zero status. - If no command name results, redirections are performed, but do not af- - fect the current shell environment. A redirection error causes the + If no command name results, redirections are performed, but do not af- + fect the current shell environment. A redirection error causes the command to exit with a non-zero status. - If there is a command name left after expansion, execution proceeds as - described below. Otherwise, the command exits. If one of the expan- - sions contained a command substitution, the exit status of the command - is the exit status of the last command substitution performed. If - there were no command substitutions, the command exits with a status of - zero. + If there is a command name left after expansion, execution proceeds as + described below. Otherwise, the command exits. If one of the expan- + sions contained a command substitution, the exit status of the command + is the exit status of the last command substitution performed. If + there were no command substitutions, the command exits with a zero sta- + tus. CCOOMMMMAANNDD EEXXEECCUUTTIIOONN - After a command has been split into words, if it results in a simple - command and an optional list of arguments, the shell performs the fol- + After a command has been split into words, if it results in a simple + command and an optional list of arguments, the shell performs the fol- lowing actions. - If the command name contains no slashes, the shell attempts to locate - it. If there exists a shell function by that name, that function is - invoked as described above in FFUUNNCCTTIIOONNSS. If the name does not match a - function, the shell searches for it in the list of shell builtins. If + If the command name contains no slashes, the shell attempts to locate + it. If there exists a shell function by that name, that function is + invoked as described above in FFUUNNCCTTIIOONNSS. If the name does not match a + function, the shell searches for it in the list of shell builtins. If a match is found, that builtin is invoked. - If the name is neither a shell function nor a builtin, and contains no - slashes, bbaasshh searches each element of the PPAATTHH for a directory con- + If the name is neither a shell function nor a builtin, and contains no + slashes, bbaasshh searches each element of the PPAATTHH for a directory con- taining an executable file by that name. BBaasshh uses a hash table to re- - member the full pathnames of executable files (see hhaasshh under SSHHEELLLL - BBUUIILLTTIINN CCOOMMMMAANNDDSS below). A full search of the directories in PPAATTHH is - performed only if the command is not found in the hash table. If the - search is unsuccessful, the shell searches for a defined shell function - named ccoommmmaanndd__nnoott__ffoouunndd__hhaannddllee. If that function exists, it is invoked - in a separate execution environment with the original command and the - original command's arguments as its arguments, and the function's exit - status becomes the exit status of that subshell. If that function is - not defined, the shell prints an error message and returns an exit sta- - tus of 127. - - If the search is successful, or if the command name contains one or + member the full pathnames of executable files (see hhaasshh under SSHHEELLLL + BBUUIILLTTIINN CCOOMMMMAANNDDSS below). Bash performs a full search of the directo- + ries in PPAATTHH only if the command is not found in the hash table. If + the search is unsuccessful, the shell searches for a defined shell + function named ccoommmmaanndd__nnoott__ffoouunndd__hhaannddllee. If that function exists, it + is invoked in a separate execution environment with the original com- + mand and the original command's arguments as its arguments, and the + function's exit status becomes the exit status of that subshell. If + that function is not defined, the shell prints an error message and re- + turns an exit status of 127. + + If the search is successful, or if the command name contains one or more slashes, the shell executes the named program in a separate execu- tion environment. Argument 0 is set to the name given, and the remain- ing arguments to the command are set to the arguments given, if any. - If this execution fails because the file is not in executable format, - and the file is not a directory, it is assumed to be a _s_h_e_l_l _s_c_r_i_p_t, a + If this execution fails because the file is not in executable format, + and the file is not a directory, it is assumed to be a _s_h_e_l_l _s_c_r_i_p_t, a file containing shell commands, and the shell creates a new instance of - itself to execute it. This subshell reinitializes itself, so that the - effect is as if a new shell had been invoked to handle the script, with - the exception that the locations of commands remembered by the parent - (see hhaasshh below under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS) are retained by the - child. + itself to execute it. Bash tries to determine whether the file is a + text file or a binary, and will not execute files it determines to be + binaries. This subshell reinitializes itself, so that the effect is as + if a new shell had been invoked to handle the script, with the excep- + tion that the locations of commands remembered by the parent (see hhaasshh + below under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS are retained by the child. If the program is a file beginning with ##!!, the remainder of the first line specifies an interpreter for the program. The shell executes the @@ -2990,9 +3118,11 @@ CCOOMMMMAANNDD EEXXEECCUUTTIIOONN EENNVVIIRROONNMMEENN nous commands are invoked in a subshell environment that is a duplicate of the shell environment, except that traps caught by the shell are re- set to the values that the shell inherited from its parent at invoca- - tion. Builtin commands that are invoked as part of a pipeline are also - executed in a subshell environment. Changes made to the subshell envi- - ronment cannot affect the shell's execution environment. + tion. Builtin commands that are invoked as part of a pipeline, except + possibly in the last element depending on the value of the llaassttppiippee + shell option, are also executed in a subshell environment. Changes + made to the subshell environment cannot affect the shell's execution + environment. When the shell is in _p_o_s_i_x _m_o_d_e, subshells spawned to execute command substitutions inherit the value of the --ee option from their parent @@ -3013,250 +3143,273 @@ EENNVVIIRROONNMMEENNTT The shell provides several ways to manipulate the environment. On in- vocation, the shell scans its own environment and creates a parameter for each name found, automatically marking it for _e_x_p_o_r_t to child - processes. Executed commands inherit the environment. The eexxppoorrtt and - ddeeccllaarree --xx commands allow parameters and functions to be added to and - deleted from the environment. If the value of a parameter in the envi- - ronment is modified, the new value becomes part of the environment, re- - placing the old. The environment inherited by any executed command - consists of the shell's initial environment, whose values may be modi- - fied in the shell, less any pairs removed by the uunnsseett command, plus - any additions via the eexxppoorrtt and ddeeccllaarree --xx commands. - - The environment for any _s_i_m_p_l_e _c_o_m_m_a_n_d or function may be augmented - temporarily by prefixing it with parameter assignments, as described - above in PPAARRAAMMEETTEERRSS. These assignment statements affect only the envi- - ronment seen by that command. - - If the --kk option is set (see the sseett builtin command below), then _a_l_l - parameter assignments are placed in the environment for a command, not + processes. Executed commands inherit the environment. The eexxppoorrtt, ddee-- + ccllaarree --xx, and uunnsseett commands modify the environment by adding and + deleting parameters and functions. If the value of a parameter in the + environment is modified, the new value automatically becomes part of + the environment, replacing the old. The environment inherited by any + executed command consists of the shell's initial environment, whose + values may be modified in the shell, less any pairs removed by the uunn-- + sseett or eexxppoorrtt --nn commands, plus any additions via the eexxppoorrtt and ddee-- + ccllaarree --xx commands. + + If any parameter assignments, as described above in PPAARRAAMMEETTEERRSS, appear + before a _s_i_m_p_l_e _c_o_m_m_a_n_d, the variable assignments are part of that com- + mand's environment for as long as it executes. These assignment state- + ments affect only the environment seen by that command. If these as- + signments precede a call to a shell function, the variables are local + to the function and exported to that function's children. + + If the --kk option is set (see the sseett builtin command below), then _a_l_l + parameter assignments are placed in the environment for a command, not just those that precede the command name. - When bbaasshh invokes an external command, the variable __ is set to the - full filename of the command and passed to that command in its environ- + When bbaasshh invokes an external command, the variable __ is set to the + full pathname of the command and passed to that command in its environ- ment. EEXXIITT SSTTAATTUUSS - The exit status of an executed command is the value returned by the + The exit status of an executed command is the value returned by the _w_a_i_t_p_i_d system call or equivalent function. Exit statuses fall between - 0 and 255, though, as explained below, the shell may use values above + 0 and 255, though, as explained below, the shell may use values above 125 specially. Exit statuses from shell builtins and compound commands are also limited to this range. Under certain circumstances, the shell will use special values to indicate specific failure modes. For the shell's purposes, a command which exits with a zero exit status - has succeeded. An exit status of zero indicates success. A non-zero - exit status indicates failure. When a command terminates on a fatal - signal _N, bbaasshh uses the value of 128+_N as the exit status. + has succeeded. So while an exit status of zero indicates success, a + non-zero exit status indicates failure. - If a command is not found, the child process created to execute it re- - turns a status of 127. If a command is found but is not executable, + When a command terminates on a fatal signal _N, bbaasshh uses the value of + 128+_N as the exit status. + + If a command is not found, the child process created to execute it re- + turns a status of 127. If a command is found but is not executable, the return status is 126. If a command fails because of an error during expansion or redirection, the exit status is greater than zero. - Shell builtin commands return a status of 0 (_t_r_u_e) if successful, and - non-zero (_f_a_l_s_e) if an error occurs while they execute. All builtins - return an exit status of 2 to indicate incorrect usage, generally in- + Shell builtin commands return a status of 0 (_t_r_u_e) if successful, and + non-zero (_f_a_l_s_e) if an error occurs while they execute. All builtins + return an exit status of 2 to indicate incorrect usage, generally in- valid options or missing arguments. The exit status of the last command is available in the special parame- ter $?. - BBaasshh itself returns the exit status of the last command executed, un- - less a syntax error occurs, in which case it exits with a non-zero + BBaasshh itself returns the exit status of the last command executed, un- + less a syntax error occurs, in which case it exits with a non-zero value. See also the eexxiitt builtin command below. SSIIGGNNAALLSS - When bbaasshh is interactive, in the absence of any traps, it ignores - SSIIGGTTEERRMM (so that kkiillll 00 does not kill an interactive shell), and SSIIGGIINNTT - is caught and handled (so that the wwaaiitt builtin is interruptible). In + When bbaasshh is interactive, in the absence of any traps, it ignores + SSIIGGTTEERRMM (so that kkiillll 00 does not kill an interactive shell), and + catches and handles SSIIGGIINNTT (so that the wwaaiitt builtin is interruptible). + When bbaasshh receives SSIIGGIINNTT, it breaks out of any executing loops. In all cases, bbaasshh ignores SSIIGGQQUUIITT. If job control is in effect, bbaasshh ig- nores SSIIGGTTTTIINN, SSIIGGTTTTOOUU, and SSIIGGTTSSTTPP. - Non-builtin commands run by bbaasshh have signal handlers set to the values - inherited by the shell from its parent. When job control is not in ef- - fect, asynchronous commands ignore SSIIGGIINNTT and SSIIGGQQUUIITT in addition to - these inherited handlers. Commands run as a result of command substi- - tution ignore the keyboard-generated job control signals SSIIGGTTTTIINN, SSIIGGTT-- - TTOOUU, and SSIIGGTTSSTTPP. - - The shell exits by default upon receipt of a SSIIGGHHUUPP. Before exiting, - an interactive shell resends the SSIIGGHHUUPP to all jobs, running or - stopped. Stopped jobs are sent SSIIGGCCOONNTT to ensure that they receive the - SSIIGGHHUUPP. To prevent the shell from sending the signal to a particular - job, it should be removed from the jobs table with the ddiissoowwnn builtin - (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) or marked to not receive SSIIGGHHUUPP us- - ing ddiissoowwnn --hh. - - If the hhuuppoonneexxiitt shell option has been set with sshhoopptt, bbaasshh sends a + The ttrraapp builtin modifies the shell's signal handling, as described be- + low. + + Non-builtin commands bbaasshh executes have signal handlers set to the val- + ues inherited by the shell from its parent, unless ttrraapp sets them to be + ignored, in which case the child process will ignore them as well. + When job control is not in effect, asynchronous commands ignore SSIIGGIINNTT + and SSIIGGQQUUIITT in addition to these inherited handlers. Commands run as a + result of command substitution ignore the keyboard-generated job con- + trol signals SSIIGGTTTTIINN, SSIIGGTTTTOOUU, and SSIIGGTTSSTTPP. + + The shell exits by default upon receipt of a SSIIGGHHUUPP. Before exiting, + an interactive shell resends the SSIIGGHHUUPP to all jobs, running or + stopped. The shell sends SSIIGGCCOONNTT to stopped jobs to ensure that they + receive the SSIIGGHHUUPP (see JJOOBB CCOONNTTRROOLL below for more information about + running and stopped jobs). To prevent the shell from sending the sig- + nal to a particular job, remove it from the jobs table with the ddiissoowwnn + builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) or mark it not to receive + SSIIGGHHUUPP using ddiissoowwnn --hh. + + If the hhuuppoonneexxiitt shell option has been set using sshhoopptt, bbaasshh sends a SSIIGGHHUUPP to all jobs when an interactive login shell exits. - If bbaasshh is waiting for a command to complete and receives a signal for + If bbaasshh is waiting for a command to complete and receives a signal for which a trap has been set, the trap will not be executed until the com- - mand completes. When bbaasshh is waiting for an asynchronous command via - the wwaaiitt builtin, the reception of a signal for which a trap has been - set will cause the wwaaiitt builtin to return immediately with an exit sta- - tus greater than 128, immediately after which the trap is executed. + mand completes. If bbaasshh is waiting for an asynchronous command via the + wwaaiitt builtin, and it receives a signal for which a trap has been set, + the wwaaiitt builtin will return immediately with an exit status greater + than 128, immediately after which the shell executes the trap. - When job control is not enabled, and bbaasshh is waiting for a foreground + When job control is not enabled, and bbaasshh is waiting for a foreground command to complete, the shell receives keyboard-generated signals such - as SSIIGGIINNTT (usually generated by ^^CC) that users commonly intend to send + as SSIIGGIINNTT (usually generated by ^^CC) that users commonly intend to send to that command. This happens because the shell and the command are in - the same process group as the terminal, and ^^CC sends SSIIGGIINNTT to all - processes in that process group. + the same process group as the terminal, and ^^CC sends SSIIGGIINNTT to all + processes in that process group. See JJOOBB CCOONNTTRROOLL below for more infor- + mation about process groups. - When bbaasshh is running without job control enabled and receives SSIIGGIINNTT - while waiting for a foreground command, it waits until that foreground + When bbaasshh is running without job control enabled and receives SSIIGGIINNTT + while waiting for a foreground command, it waits until that foreground command terminates and then decides what to do about the SSIIGGIINNTT: 1. If the command terminates due to the SSIIGGIINNTT, bbaasshh concludes that - the user meant to end the entire script, and acts on the SSIIGGIINNTT + the user meant to end the entire script, and acts on the SSIIGGIINNTT (e.g., by running a SSIIGGIINNTT trap or exiting itself); - 2. If the command does not terminate due to SSIIGGIINNTT, the program - handled the SSIIGGIINNTT itself and did not treat it as a fatal sig- - nal. In that case, bbaasshh does not treat SSIIGGIINNTT as a fatal sig- - nal, either, instead assuming that the SSIIGGIINNTT was used as part - of the program's normal operation (e.g., emacs uses it to abort + 2. If the command does not terminate due to SSIIGGIINNTT, the program + handled the SSIIGGIINNTT itself and did not treat it as a fatal sig- + nal. In that case, bbaasshh does not treat SSIIGGIINNTT as a fatal sig- + nal, either, instead assuming that the SSIIGGIINNTT was used as part + of the program's normal operation (e.g., emacs uses it to abort editing commands) or deliberately discarded. However, bbaasshh will - run any trap set on SSIIGGIINNTT, as it does with any other trapped - signal it receives while it is waiting for the foreground com- + run any trap set on SSIIGGIINNTT, as it does with any other trapped + signal it receives while it is waiting for the foreground com- mand to complete, for compatibility. JJOOBB CCOONNTTRROOLL _J_o_b _c_o_n_t_r_o_l refers to the ability to selectively stop (_s_u_s_p_e_n_d) the ex- - ecution of processes and continue (_r_e_s_u_m_e) their execution at a later - point. A user typically employs this facility via an interactive in- + ecution of processes and continue (_r_e_s_u_m_e) their execution at a later + point. A user typically employs this facility via an interactive in- terface supplied jointly by the operating system kernel's terminal dri- ver and bbaasshh. - The shell associates a _j_o_b with each pipeline. It keeps a table of - currently executing jobs, which may be listed with the jjoobbss command. - When bbaasshh starts a job asynchronously (in the _b_a_c_k_g_r_o_u_n_d), it prints a + The shell associates a _j_o_b with each pipeline. It keeps a table of + currently executing jobs, which may be listed with the jjoobbss command. + When bbaasshh starts a job asynchronously (in the _b_a_c_k_g_r_o_u_n_d), it prints a line that looks like: [1] 25647 indicating that this job is job number 1 and that the process ID of the last process in the pipeline associated with this job is 25647. All of - the processes in a single pipeline are members of the same job. BBaasshh + the processes in a single pipeline are members of the same job. BBaasshh uses the _j_o_b abstraction as the basis for job control. - To facilitate the implementation of the user interface to job control, + To facilitate the implementation of the user interface to job control, the operating system maintains the notion of a _c_u_r_r_e_n_t _t_e_r_m_i_n_a_l _p_r_o_c_e_s_s _g_r_o_u_p _I_D. Members of this process group (processes whose process group ID is equal to the current terminal process group ID) receive keyboard- - generated signals such as SSIIGGIINNTT. These processes are said to be in - the _f_o_r_e_g_r_o_u_n_d. _B_a_c_k_g_r_o_u_n_d processes are those whose process group ID + generated signals such as SSIIGGIINNTT. These processes are said to be in + the _f_o_r_e_g_r_o_u_n_d. _B_a_c_k_g_r_o_u_n_d processes are those whose process group ID differs from the terminal's; such processes are immune to keyboard-gen- erated signals. Only foreground processes are allowed to read from or, - if the user so specifies with "stty tostop", write to the terminal. + if the user so specifies with "stty tostop", write to the terminal. Background processes which attempt to read from (write to when "tostop" - is in effect) the terminal are sent a SSIIGGTTTTIINN ((SSIIGGTTTTOOUU)) signal by the + is in effect) the terminal are sent a SSIIGGTTTTIINN ((SSIIGGTTTTOOUU)) signal by the kernel's terminal driver, which, unless caught, suspends the process. - If the operating system on which bbaasshh is running supports job control, + If the operating system on which bbaasshh is running supports job control, bbaasshh contains facilities to use it. Typing the _s_u_s_p_e_n_d character (typ- ically ^^ZZ, Control-Z) while a process is running causes that process to - be stopped and returns control to bbaasshh. Typing the _d_e_l_a_y_e_d _s_u_s_p_e_n_d - character (typically ^^YY, Control-Y) causes the process to be stopped + be stopped and returns control to bbaasshh. Typing the _d_e_l_a_y_e_d _s_u_s_p_e_n_d + character (typically ^^YY, Control-Y) causes the process to be stopped when it attempts to read input from the terminal, and control to be re- - turned to bbaasshh. The user may then manipulate the state of this job, - using the bbgg command to continue it in the background, the ffgg command + turned to bbaasshh. The user may then manipulate the state of this job, + using the bbgg command to continue it in the background, the ffgg command to continue it in the foreground, or the kkiillll command to kill it. A ^^ZZ takes effect immediately, and has the additional side effect of causing pending output and typeahead to be discarded. There are a number of ways to refer to a job in the shell. The charac- - ter %% introduces a job specification (_j_o_b_s_p_e_c). Job number _n may be + ter %% introduces a job specification (_j_o_b_s_p_e_c). Job number _n may be referred to as %%nn. A job may also be referred to using a prefix of the name used to start it, or using a substring that appears in its command - line. For example, %%ccee refers to a stopped job whose command name be- - gins with ccee. If a prefix matches more than one job, bbaasshh reports an + line. For example, %%ccee refers to a stopped job whose command name be- + gins with ccee. If a prefix matches more than one job, bbaasshh reports an error. Using %%??ccee, on the other hand, refers to any job containing the - string ccee in its command line. If the substring matches more than one + string ccee in its command line. If the substring matches more than one job, bbaasshh reports an error. The symbols %%%% and %%++ refer to the shell's - notion of the _c_u_r_r_e_n_t _j_o_b, which is the last job stopped while it was - in the foreground or started in the background. The _p_r_e_v_i_o_u_s _j_o_b may - be referenced using %%--. If there is only a single job, %%++ and %%-- can + notion of the _c_u_r_r_e_n_t _j_o_b, which is the last job stopped while it was + in the foreground or started in the background. The _p_r_e_v_i_o_u_s _j_o_b may + be referenced using %%--. If there is only a single job, %%++ and %%-- can both be used to refer to that job. In output pertaining to jobs (e.g., the output of the jjoobbss command), the current job is always flagged with - a ++, and the previous job with a --. A single % (with no accompanying + a ++, and the previous job with a --. A single % (with no accompanying job specification) also refers to the current job. - Simply naming a job can be used to bring it into the foreground: %%11 is - a synonym for "fg %1", bringing job 1 from the background into the + Simply naming a job can be used to bring it into the foreground: %%11 is + a synonym for "fg %1", bringing job 1 from the background into the foreground. Similarly, "%1 &" resumes job 1 in the background, equiva- lent to "bg %1". - The shell learns immediately whenever a job changes state. Normally, + The shell learns immediately whenever a job changes state. Normally, bbaasshh waits until it is about to print a prompt before reporting changes - in a job's status so as to not interrupt any other output, though it - will notify of changes in a job's status after a foreground command in - a list completes, before executing the next command. If the --bb option - to the sseett builtin command is enabled, bbaasshh reports such changes imme- + in a job's status so as to not interrupt any other output, though it + will notify of changes in a job's status after a foreground command in + a list completes, before executing the next command. If the --bb option + to the sseett builtin command is enabled, bbaasshh reports such changes imme- diately. Any trap on SSIIGGCCHHLLDD is executed for each child that exits. - If an attempt to exit bbaasshh is made while jobs are stopped (or, if the - cchheecckkjjoobbss shell option has been enabled using the sshhoopptt builtin, run- + If an attempt to exit bbaasshh is made while jobs are stopped (or, if the + cchheecckkjjoobbss shell option has been enabled using the sshhoopptt builtin, run- ning), the shell prints a warning message, and, if the cchheecckkjjoobbss option - is enabled, lists the jobs and their statuses. The jjoobbss command may - then be used to inspect their status. If a second attempt to exit is - made without an intervening command, the shell does not print another + is enabled, lists the jobs and their statuses. The jjoobbss command may + then be used to inspect their status. If a second attempt to exit is + made without an intervening command, the shell does not print another warning, and any stopped jobs are terminated. - When the shell is waiting for a job or process using the wwaaiitt builtin, - and job control is enabled, wwaaiitt will return when the job changes - state. The --ff option causes wwaaiitt to wait until the job or process ter- + When the shell is waiting for a job or process using the wwaaiitt builtin, + and job control is enabled, wwaaiitt will return when the job changes + state. The --ff option causes wwaaiitt to wait until the job or process ter- minates before returning. PPRROOMMPPTTIINNGG When executing interactively, bbaasshh displays the primary prompt PPSS11 when - it is ready to read a command, and the secondary prompt PPSS22 when it - needs more input to complete a command. BBaasshh displays PPSS00 after it - reads a command but before executing it. BBaasshh displays PPSS44 as de- - scribed above before tracing each command when the --xx option is en- - abled. BBaasshh allows these prompt strings to be customized by inserting - a number of backslash-escaped special characters that are decoded as - follows: - \\aa an ASCII bell character (07) - \\dd the date in "Weekday Month Date" format (e.g., "Tue May - 26") + it is ready to read a command, and the secondary prompt PPSS22 when it + needs more input to complete a command. + + BBaasshh examines the value of the array variable PPRROOMMPPTT__CCOOMMMMAANNDD just be- + fore printing each primary prompt. If any elements in PPRROOMMPPTT__CCOOMMMMAANNDD + are set and non-null, Bash executes each value, in numeric order, just + as if it had been typed on the command line. BBaasshh displays PPSS00 after + it reads a command but before executing it. + + BBaasshh displays PPSS44 as described above before tracing each command when + the --xx option is enabled. + + BBaasshh allows the prompt strings PPSS00, PPSS11, PPSS22, and PPSS44, to be customized + by inserting a number of backslash-escaped special characters that are + decoded as follows: + + \\aa An ASCII bell character (07). + \\dd The date in "Weekday Month Date" format (e.g., "Tue May + 26"). \\DD{{_f_o_r_m_a_t}} - the _f_o_r_m_a_t is passed to _s_t_r_f_t_i_m_e(3) and the result is in- + The _f_o_r_m_a_t is passed to _s_t_r_f_t_i_m_e(3) and the result is in- serted into the prompt string; an empty _f_o_r_m_a_t results in a locale-specific time representation. The braces are - required - \\ee an ASCII escape character (033) - \\hh the hostname up to the first "." - \\HH the hostname - \\jj the number of jobs currently managed by the shell - \\ll the basename of the shell's terminal device name - \\nn newline - \\rr carriage return - \\ss the name of the shell, the basename of $$00 (the portion - following the final slash) - \\tt the current time in 24-hour HH:MM:SS format - \\TT the current time in 12-hour HH:MM:SS format - \\@@ the current time in 12-hour am/pm format - \\AA the current time in 24-hour HH:MM format - \\uu the username of the current user - \\vv the version of bbaasshh (e.g., 2.00) - \\VV the release of bbaasshh, version + patch level (e.g., 2.00.0) - \\ww the value of the PPWWDD shell variable ($$PPWWDD), with $$HHOOMMEE - abbreviated with a tilde (uses the value of the - PPRROOMMPPTT__DDIIRRTTRRIIMM variable) - \\WW the basename of $$PPWWDD, with $$HHOOMMEE abbreviated with a tilde - \\!! the history number of this command - \\## the command number of this command - \\$$ if the effective UID is 0, a ##, otherwise a $$ - \\_n_n_n the character corresponding to the octal number _n_n_n - \\\\ a backslash - \\[[ begin a sequence of non-printing characters, which could + required. + \\ee An ASCII escape character (033). + \\hh The hostname up to the first ".". + \\HH The hostname. + \\jj The number of jobs currently managed by the shell. + \\ll The basename of the shell's terminal device name (e.g., + "ttys0"). + \\nn A newline. + \\rr A carriage return. + \\ss The name of the shell: the basename of $$00 (the portion + following the final slash). + \\tt The current time in 24-hour HH:MM:SS format. + \\TT The current time in 12-hour HH:MM:SS format. + \\@@ The current time in 12-hour am/pm format. + \\AA The current time in 24-hour HH:MM format. + \\uu The username of the current user. + \\vv The bbaasshh version (e.g., 2.00) + \\VV The bbaasshh release, version + patch level (e.g., 2.00.0) + \\ww The value of the PPWWDD shell variable ($$PPWWDD), with $$HHOOMMEE + abbreviated with a tilde (uses the value of the + PPRROOMMPPTT__DDIIRRTTRRIIMM variable). + \\WW The basename of $$PPWWDD, with $$HHOOMMEE abbreviated with a + tilde. + \\!! The history number of this command. + \\## The command number of this command. + \\$$ If the effective UID is 0, a ##, otherwise a $$. + \\_n_n_n The character corresponding to the octal number _n_n_n. + \\\\ A backslash. + \\[[ Begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the - prompt - \\]] end a sequence of non-printing characters + prompt. + \\]] End a sequence of non-printing characters. The command number and the history number are usually different: the history number of a command is its position in the history list, which @@ -3272,63 +3425,63 @@ PPRROOMMPPTTIINNGG RREEAADDLLIINNEE This is the library that handles reading input when using an interac- - tive shell, unless the ----nnooeeddiittiinngg option is given at shell invocation. - Line editing is also used when using the --ee option to the rreeaadd builtin. - By default, the line editing commands are similar to those of Emacs. A - vi-style line editing interface is also available. Line editing can be - enabled at any time using the --oo eemmaaccss or --oo vvii options to the sseett - builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). To turn off line editing - after the shell is running, use the ++oo eemmaaccss or ++oo vvii options to the - sseett builtin. + tive shell, unless the ----nnooeeddiittiinngg option is supplied at shell invoca- + tion. Line editing is also used when using the --ee option to the rreeaadd + builtin. By default, the line editing commands are similar to those of + Emacs. A vi-style line editing interface is also available. Line + editing can be enabled at any time using the --oo eemmaaccss or --oo vvii options + to the sseett builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). To turn off + line editing after the shell is running, use the ++oo eemmaaccss or ++oo vvii op- + tions to the sseett builtin. RReeaaddlliinnee NNoottaattiioonn In this section, the Emacs-style notation is used to denote keystrokes. - Control keys are denoted by C-_k_e_y, e.g., C-n means Control-N. Simi- + Control keys are denoted by C-_k_e_y, e.g., C-n means Control-N. Simi- larly, _m_e_t_a keys are denoted by M-_k_e_y, so M-x means Meta-X. - On keyboards without a _M_e_t_a key, M-_x means ESC _x, i.e., press the Es- + On keyboards without a _M_e_t_a key, M-_x means ESC _x, i.e., press the Es- cape key then the _x key. This makes ESC the _m_e_t_a _p_r_e_f_i_x. The combina- - tion M-C-_x means ESC-Control-_x, or press the Escape key then hold the + tion M-C-_x means ESC-Control-_x, or press the Escape key then hold the Control key while pressing the _x key.) - On some keyboards, the Meta key modifier produces meta characters with - the eighth bit (0200) set (you can use the eennaabbllee--mmeettaa--kkeeyy variable to - control whether or not it does this, if the keyboard allows it). On - many others, the terminal or terminal emulator converts the metafied - key to a key sequence beginning with ESC as described in the preceding + On some keyboards, the Meta key modifier produces meta characters with + the eighth bit (0200) set (you can use the eennaabbllee--mmeettaa--kkeeyy variable to + control whether or not it does this, if the keyboard allows it). On + many others, the terminal or terminal emulator converts the metafied + key to a key sequence beginning with ESC as described in the preceding paragraph. - If the _M_e_t_a key produces a key sequence with the ESC meta prefix, you - can make M-_k_e_y key bindings you specify (see RReeaaddlliinnee KKeeyy BBiinnddiinnggss be- + If the _M_e_t_a key produces a key sequence with the ESC meta prefix, you + can make M-_k_e_y key bindings you specify (see RReeaaddlliinnee KKeeyy BBiinnddiinnggss be- low) do the same thing by setting the ffoorrccee--mmeettaa--pprreeffiixx variable. Readline commands may be given numeric _a_r_g_u_m_e_n_t_s, which normally act as - a repeat count. Sometimes, however, it is the sign of the argument - that is significant. Passing a negative argument to a command that - acts in the forward direction (e.g., kkiillll--lliinnee) causes that command to - act in a backward direction. Commands whose behavior with arguments + a repeat count. Sometimes, however, it is the sign of the argument + that is significant. Passing a negative argument to a command that + acts in the forward direction (e.g., kkiillll--lliinnee) causes that command to + act in a backward direction. Commands whose behavior with arguments deviates from this are noted below. - When a command is described as _k_i_l_l_i_n_g text, the text deleted is saved + When a command is described as _k_i_l_l_i_n_g text, the text deleted is saved for possible future retrieval (_y_a_n_k_i_n_g). The killed text is saved in a _k_i_l_l _r_i_n_g. Consecutive kills cause the text to be accumulated into one unit, which can be yanked all at once. Commands which do not kill text separate the chunks of text on the kill ring. RReeaaddlliinnee IInniittiiaalliizzaattiioonn - Readline is customized by putting commands in an initialization file - (the _i_n_p_u_t_r_c file). The name of this file is taken from the value of + Readline is customized by putting commands in an initialization file + (the _i_n_p_u_t_r_c file). The name of this file is taken from the value of the IINNPPUUTTRRCC variable. If that variable is unset, the default is _~_/_._i_n_- - _p_u_t_r_c. If that file does not exist or cannot be read, the ultimate - default is _/_e_t_c_/_i_n_p_u_t_r_c. When a program which uses the readline li- - brary starts up, the initialization file is read, and the key bindings - and variables are set. There are only a few basic constructs allowed - in the readline initialization file. Blank lines are ignored. Lines - beginning with a ## are comments. Lines beginning with a $$ indicate - conditional constructs. Other lines denote key bindings and variable + _p_u_t_r_c. If that file does not exist or cannot be read, the ultimate + default is _/_e_t_c_/_i_n_p_u_t_r_c. When a program which uses the readline li- + brary starts up, the initialization file is read, and the key bindings + and variables are set. There are only a few basic constructs allowed + in the readline initialization file. Blank lines are ignored. Lines + beginning with a ## are comments. Lines beginning with a $$ indicate + conditional constructs. Other lines denote key bindings and variable settings. - The default key-bindings may be changed with an _i_n_p_u_t_r_c file. Other + The default key-bindings may be changed with an _i_n_p_u_t_r_c file. Other programs that use this library may add their own commands and bindings. For example, placing @@ -3337,18 +3490,18 @@ RREEAADDLLIINNEE or C-Meta-u: universal-argument - into the _i_n_p_u_t_r_c would make M-C-u execute the readline command _u_n_i_v_e_r_- + into the _i_n_p_u_t_r_c would make M-C-u execute the readline command _u_n_i_v_e_r_- _s_a_l_-_a_r_g_u_m_e_n_t. - The following symbolic character names are recognized: _R_U_B_O_U_T, _D_E_L, + The following symbolic character names are recognized: _R_U_B_O_U_T, _D_E_L, _E_S_C, _L_F_D, _N_E_W_L_I_N_E, _R_E_T, _R_E_T_U_R_N, _S_P_C, _S_P_A_C_E, and _T_A_B. - In addition to command names, readline allows keys to be bound to a + In addition to command names, readline allows keys to be bound to a string that is inserted when the key is pressed (a _m_a_c_r_o). RReeaaddlliinnee KKeeyy BBiinnddiinnggss - The syntax for controlling key bindings in the _i_n_p_u_t_r_c file is simple. - All that is required is the name of the command or the text of a macro + The syntax for controlling key bindings in the _i_n_p_u_t_r_c file is simple. + All that is required is the name of the command or the text of a macro and a key sequence to which it should be bound. The name may be speci- fied in one of two ways: as a symbolic key name, possibly with _M_e_t_a_- or _C_o_n_t_r_o_l_- prefixes, or as a key sequence. @@ -3360,15 +3513,15 @@ RREEAADDLLIINNEE Meta-Rubout: backward-kill-word Control-o: "> output" - In the above example, _C_-_u is bound to the function uunniivveerrssaall--aarrgguummeenntt, - _M_-_D_E_L is bound to the function bbaacckkwwaarrdd--kkiillll--wwoorrdd, and _C_-_o is bound to - run the macro expressed on the right hand side (that is, to insert the + In the above example, _C_-_u is bound to the function uunniivveerrssaall--aarrgguummeenntt, + _M_-_D_E_L is bound to the function bbaacckkwwaarrdd--kkiillll--wwoorrdd, and _C_-_o is bound to + run the macro expressed on the right hand side (that is, to insert the text "> output" into the line). - In the second form, ""kkeeyysseeqq"":_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, kkeeyysseeqq differs - from kkeeyynnaammee above in that strings denoting an entire key sequence may - be specified by placing the sequence within double quotes. Some GNU - Emacs style key escapes can be used, as in the following example, but + In the second form, ""kkeeyysseeqq"":_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, kkeeyysseeqq differs + from kkeeyynnaammee above in that strings denoting an entire key sequence may + be specified by placing the sequence within double quotes. Some GNU + Emacs style key escapes can be used, as in the following example, but the symbolic character names are not recognized. "\C-u": universal-argument @@ -3376,20 +3529,20 @@ RREEAADDLLIINNEE "\e[11~": "Function Key 1" In this example, _C_-_u is again bound to the function uunniivveerrssaall--aarrgguummeenntt. - _C_-_x _C_-_r is bound to the function rree--rreeaadd--iinniitt--ffiillee, and _E_S_C _[ _1 _1 _~ is + _C_-_x _C_-_r is bound to the function rree--rreeaadd--iinniitt--ffiillee, and _E_S_C _[ _1 _1 _~ is bound to insert the text "Function Key 1". The full set of GNU Emacs style escape sequences is \\CC-- control prefix - \\MM-- adding the meta prefix or converting the following char- - acter to a meta character, as described below under + \\MM-- adding the meta prefix or converting the following char- + acter to a meta character, as described below under ffoorrccee--mmeettaa--pprreeffiixx \\ee an escape character \\\\ backslash \\"" literal " \\'' literal ' - In addition to the GNU Emacs style escape sequences, a second set of + In addition to the GNU Emacs style escape sequences, a second set of backslash escapes is available: \\aa alert (bell) \\bb backspace @@ -3399,20 +3552,20 @@ RREEAADDLLIINNEE \\rr carriage return \\tt horizontal tab \\vv vertical tab - \\_n_n_n the eight-bit character whose value is the octal value + \\_n_n_n the eight-bit character whose value is the octal value _n_n_n (one to three digits) - \\xx_H_H the eight-bit character whose value is the hexadecimal + \\xx_H_H the eight-bit character whose value is the hexadecimal value _H_H (one or two hex digits) When entering the text of a macro, single or double quotes must be used to indicate a macro definition. Unquoted text is assumed to be a func- - tion name. In the macro body, the backslash escapes described above - are expanded. Backslash will quote any other character in the macro + tion name. In the macro body, the backslash escapes described above + are expanded. Backslash will quote any other character in the macro text, including " and '. - BBaasshh allows the current readline key bindings to be displayed or modi- - fied with the bbiinndd builtin command. The editing mode may be switched - during interactive use by using the --oo option to the sseett builtin com- + BBaasshh allows the current readline key bindings to be displayed or modi- + fied with the bbiinndd builtin command. The editing mode may be switched + during interactive use by using the --oo option to the sseett builtin com- mand (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). RReeaaddlliinnee VVaarriiaabblleess @@ -3423,111 +3576,111 @@ RREEAADDLLIINNEE sseett _v_a_r_i_a_b_l_e_-_n_a_m_e _v_a_l_u_e or using the bbiinndd builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). - Except where noted, readline variables can take the values OOnn or OOffff - (without regard to case). Unrecognized variable names are ignored. + Except where noted, readline variables can take the values OOnn or OOffff + (without regard to case). Unrecognized variable names are ignored. When readline reads a variable value, empty or null values, "on" (case- - insensitive), and "1" are equivalent to OOnn. All other values are + insensitive), and "1" are equivalent to OOnn. All other values are equivalent to OOffff. The variables and their default values are: aaccttiivvee--rreeggiioonn--ssttaarrtt--ccoolloorr - A string variable that controls the text color and background - when displaying the text in the active region (see the descrip- - tion of eennaabbllee--aaccttiivvee--rreeggiioonn below). This string must not take + A string variable that controls the text color and background + when displaying the text in the active region (see the descrip- + tion of eennaabbllee--aaccttiivvee--rreeggiioonn below). This string must not take up any physical character positions on the display, so it should - consist only of terminal escape sequences. It is output to the - terminal before displaying the text in the active region. This - variable is reset to the default value whenever the terminal - type changes. The default value is the string that puts the - terminal in standout mode, as obtained from the terminal's ter- + consist only of terminal escape sequences. It is output to the + terminal before displaying the text in the active region. This + variable is reset to the default value whenever the terminal + type changes. The default value is the string that puts the + terminal in standout mode, as obtained from the terminal's ter- minfo description. A sample value might be "\e[01;33m". aaccttiivvee--rreeggiioonn--eenndd--ccoolloorr - A string variable that "undoes" the effects of aaccttiivvee--rree-- - ggiioonn--ssttaarrtt--ccoolloorr and restores "normal" terminal display appear- - ance after displaying text in the active region. This string - must not take up any physical character positions on the dis- - play, so it should consist only of terminal escape sequences. - It is output to the terminal after displaying the text in the - active region. This variable is reset to the default value - whenever the terminal type changes. The default value is the - string that restores the terminal from standout mode, as ob- + A string variable that "undoes" the effects of aaccttiivvee--rree-- + ggiioonn--ssttaarrtt--ccoolloorr and restores "normal" terminal display appear- + ance after displaying text in the active region. This string + must not take up any physical character positions on the dis- + play, so it should consist only of terminal escape sequences. + It is output to the terminal after displaying the text in the + active region. This variable is reset to the default value + whenever the terminal type changes. The default value is the + string that restores the terminal from standout mode, as ob- tained from the terminal's terminfo description. A sample value might be "\e[0m". bbeellll--ssttyyllee ((aauuddiibbllee)) - Controls what happens when readline wants to ring the terminal + Controls what happens when readline wants to ring the terminal bell. If set to nnoonnee, readline never rings the bell. If set to - vviissiibbllee, readline uses a visible bell if one is available. If + vviissiibbllee, readline uses a visible bell if one is available. If set to aauuddiibbllee, readline attempts to ring the terminal's bell. bbiinndd--ttttyy--ssppeecciiaall--cchhaarrss ((OOnn)) - If set to OOnn (the default), readline attempts to bind the con- + If set to OOnn (the default), readline attempts to bind the con- trol characters that are treated specially by the kernel's ter- - minal driver to their readline equivalents. These override the - default readline bindings described here. Type "stty -a" at a + minal driver to their readline equivalents. These override the + default readline bindings described here. Type "stty -a" at a bbaasshh prompt to see your current terminal settings, including the special control characters (usually cccchhaarrss). bblliinnkk--mmaattcchhiinngg--ppaarreenn ((OOffff)) If set to OOnn, readline attempts to briefly move the cursor to an opening parenthesis when a closing parenthesis is inserted. ccoolloorreedd--ccoommpplleettiioonn--pprreeffiixx ((OOffff)) - If set to OOnn, when listing completions, readline displays the + If set to OOnn, when listing completions, readline displays the common prefix of the set of possible completions using a differ- - ent color. The color definitions are taken from the value of + ent color. The color definitions are taken from the value of the LLSS__CCOOLLOORRSS environment variable. If there is a color defini- - tion in $$LLSS__CCOOLLOORRSS for the custom suffix "readline-colored-com- - pletion-prefix", readline uses this color for the common prefix + tion in $$LLSS__CCOOLLOORRSS for the custom suffix "readline-colored-com- + pletion-prefix", readline uses this color for the common prefix instead of its default. ccoolloorreedd--ssttaattss ((OOffff)) - If set to OOnn, readline displays possible completions using dif- - ferent colors to indicate their file type. The color defini- - tions are taken from the value of the LLSS__CCOOLLOORRSS environment + If set to OOnn, readline displays possible completions using dif- + ferent colors to indicate their file type. The color defini- + tions are taken from the value of the LLSS__CCOOLLOORRSS environment variable. ccoommmmeenntt--bbeeggiinn (("##")) - The string that is inserted when the readline iinnsseerrtt--ccoommmmeenntt + The string that is inserted when the readline iinnsseerrtt--ccoommmmeenntt command is executed. This command is bound to MM--## in emacs mode and to ## in vi command mode. ccoommpplleettiioonn--ddiissppllaayy--wwiiddtthh ((--11)) - The number of screen columns used to display possible matches - when performing completion. The value is ignored if it is less - than 0 or greater than the terminal screen width. A value of 0 - will cause matches to be displayed one per line. The default + The number of screen columns used to display possible matches + when performing completion. The value is ignored if it is less + than 0 or greater than the terminal screen width. A value of 0 + will cause matches to be displayed one per line. The default value is -1. ccoommpplleettiioonn--iiggnnoorree--ccaassee ((OOffff)) If set to OOnn, readline performs filename matching and completion in a case-insensitive fashion. ccoommpplleettiioonn--mmaapp--ccaassee ((OOffff)) - If set to OOnn, and ccoommpplleettiioonn--iiggnnoorree--ccaassee is enabled, readline - treats hyphens (_-) and underscores (__) as equivalent when per- + If set to OOnn, and ccoommpplleettiioonn--iiggnnoorree--ccaassee is enabled, readline + treats hyphens (_-) and underscores (__) as equivalent when per- forming case-insensitive filename matching and completion. ccoommpplleettiioonn--pprreeffiixx--ddiissppllaayy--lleennggtthh ((00)) - The length in characters of the common prefix of a list of pos- - sible completions that is displayed without modification. When - set to a value greater than zero, common prefixes longer than - this value are replaced with an ellipsis when displaying possi- + The length in characters of the common prefix of a list of pos- + sible completions that is displayed without modification. When + set to a value greater than zero, common prefixes longer than + this value are replaced with an ellipsis when displaying possi- ble completions. ccoommpplleettiioonn--qquueerryy--iitteemmss ((110000)) - This determines when the user is queried about viewing the num- - ber of possible completions generated by the ppoossssiibbllee--ccoommppllee-- - ttiioonnss command. It may be set to any integer value greater than - or equal to zero. If the number of possible completions is - greater than or equal to the value of this variable, readline - will ask whether or not the user wishes to view them; otherwise - they are simply listed on the terminal. A zero value means + This determines when the user is queried about viewing the num- + ber of possible completions generated by the ppoossssiibbllee--ccoommppllee-- + ttiioonnss command. It may be set to any integer value greater than + or equal to zero. If the number of possible completions is + greater than or equal to the value of this variable, readline + will ask whether or not the user wishes to view them; otherwise + they are simply listed on the terminal. A zero value means readline should never ask; negative values are treated as zero. ccoonnvveerrtt--mmeettaa ((OOnn)) If set to OOnn, readline will convert characters it reads with the - eighth bit set to an ASCII key sequence by stripping the eighth - bit and prefixing it with an escape character (converting the - character to have the _m_e_t_a _p_r_e_f_i_x). The default is _O_n, but - readline will set it to _O_f_f if the locale contains characters + eighth bit set to an ASCII key sequence by stripping the eighth + bit and prefixing it with an escape character (converting the + character to have the _m_e_t_a _p_r_e_f_i_x). The default is _O_n, but + readline will set it to _O_f_f if the locale contains characters whose encodings may include bytes with the eighth bit set. This - variable is dependent on the LLCC__CCTTYYPPEE locale category, and may + variable is dependent on the LLCC__CCTTYYPPEE locale category, and may change if the locale is changed. This variable also affects key bindings; see the description of ffoorrccee--mmeettaa--pprreeffiixx below. ddiissaabbllee--ccoommpplleettiioonn ((OOffff)) If set to OOnn, readline will inhibit word completion. Completion - characters will be inserted into the line as if they had been + characters will be inserted into the line as if they had been mapped to sseellff--iinnsseerrtt. eecchhoo--ccoonnttrrooll--cchhaarraacctteerrss ((OOnn)) - When set to OOnn, on operating systems that indicate they support + When set to OOnn, on operating systems that indicate they support it, readline echoes a character corresponding to a signal gener- ated from the keyboard. eeddiittiinngg--mmooddee ((eemmaaccss)) @@ -3535,29 +3688,29 @@ RREEAADDLLIINNEE ilar to _E_m_a_c_s or _v_i. eeddiittiinngg--mmooddee can be set to either eemmaaccss or vvii. eemmaaccss--mmooddee--ssttrriinngg ((@@)) - If the _s_h_o_w_-_m_o_d_e_-_i_n_-_p_r_o_m_p_t variable is enabled, this string is + If the _s_h_o_w_-_m_o_d_e_-_i_n_-_p_r_o_m_p_t variable is enabled, this string is displayed immediately before the last line of the primary prompt when emacs editing mode is active. The value is expanded like a - key binding, so the standard set of meta- and control prefixes - and backslash escape sequences is available. Use the \1 and \2 - escapes to begin and end sequences of non-printing characters, - which can be used to embed a terminal control sequence into the + key binding, so the standard set of meta- and control prefixes + and backslash escape sequences is available. Use the \1 and \2 + escapes to begin and end sequences of non-printing characters, + which can be used to embed a terminal control sequence into the mode string. eennaabbllee--aaccttiivvee--rreeggiioonn ((OOnn)) - The _p_o_i_n_t is the current cursor position, and _m_a_r_k refers to a - saved cursor position. The text between the point and mark is - referred to as the _r_e_g_i_o_n. When this variable is set to _O_n, - readline allows certain commands to designate the region as _a_c_- - _t_i_v_e. When the region is active, readline highlights the text - in the region using the value of the aaccttiivvee--rreeggiioonn--ssttaarrtt--ccoolloorr, - which defaults to the string that enables the terminal's stand- - out mode. The active region shows the text inserted by brack- - eted-paste and any matching text found by incremental and non- + The _p_o_i_n_t is the current cursor position, and _m_a_r_k refers to a + saved cursor position. The text between the point and mark is + referred to as the _r_e_g_i_o_n. When this variable is set to _O_n, + readline allows certain commands to designate the region as _a_c_- + _t_i_v_e. When the region is active, readline highlights the text + in the region using the value of the aaccttiivvee--rreeggiioonn--ssttaarrtt--ccoolloorr, + which defaults to the string that enables the terminal's stand- + out mode. The active region shows the text inserted by brack- + eted-paste and any matching text found by incremental and non- incremental history searches. eennaabbllee--bbrraacckkeetteedd--ppaassttee ((OOnn)) - When set to OOnn, readline configures the terminal to insert each - paste into the editing buffer as a single string of characters, - instead of treating each character as if it had been read from + When set to OOnn, readline configures the terminal to insert each + paste into the editing buffer as a single string of characters, + instead of treating each character as if it had been read from the keyboard. This prevents readline from executing any editing commands bound to key sequences appearing in the pasted text. eennaabbllee--kkeeyyppaadd ((OOffff)) @@ -3565,210 +3718,212 @@ RREEAADDLLIINNEE pad when it is called. Some systems need this to enable the ar- row keys. eennaabbllee--mmeettaa--kkeeyy ((OOnn)) - When set to OOnn, readline will try to enable any meta modifier - key the terminal claims to support when it is called. On many - terminals, the Meta key is used to send eight-bit characters; - this variable checks for the terminal capability that indicates - the terminal can enable and disable a mode that sets the eighth - bit of a character (0200) if the Meta key is held down when the + When set to OOnn, readline will try to enable any meta modifier + key the terminal claims to support when it is called. On many + terminals, the Meta key is used to send eight-bit characters; + this variable checks for the terminal capability that indicates + the terminal can enable and disable a mode that sets the eighth + bit of a character (0200) if the Meta key is held down when the character is typed (a meta character). ffoorrccee--mmeettaa--pprreeffiixx ((OOffff)) - If set to OOnn, readline modifies its behavior when binding key - sequences containing \M- or Meta- (see KKeeyy BBiinnddiinnggss above) by + If set to OOnn, readline modifies its behavior when binding key + sequences containing \M- or Meta- (see KKeeyy BBiinnddiinnggss above) by converting a key sequence of the form \M-_C or Meta-_C to the two- - character sequence EESSCC_C (adding the meta prefix). If + character sequence EESSCC_C (adding the meta prefix). If ffoorrccee--mmeettaa--pprreeffiixx is set to OOffff (the default), readline uses the - value of the ccoonnvveerrtt--mmeettaa variable to determine whether to per- - form this conversion: if ccoonnvveerrtt--mmeettaa is OOnn, readline performs - the conversion described above; if it is OOffff, Readline converts + value of the ccoonnvveerrtt--mmeettaa variable to determine whether to per- + form this conversion: if ccoonnvveerrtt--mmeettaa is OOnn, readline performs + the conversion described above; if it is OOffff, Readline converts _C to a meta character by setting the eighth bit (0200). eexxppaanndd--ttiillddee ((OOffff)) - If set to OOnn, tilde expansion is performed when readline at- + If set to OOnn, tilde expansion is performed when readline at- tempts word completion. hhiissttoorryy--pprreesseerrvvee--ppooiinntt ((OOffff)) - If set to OOnn, the history code attempts to place point at the - same location on each history line retrieved with pprreevviioouuss--hhiiss-- + If set to OOnn, the history code attempts to place point at the + same location on each history line retrieved with pprreevviioouuss--hhiiss-- ttoorryy or nneexxtt--hhiissttoorryy. hhiissttoorryy--ssiizzee ((uunnsseett)) - Set the maximum number of history entries saved in the history - list. If set to zero, any existing history entries are deleted + Set the maximum number of history entries saved in the history + list. If set to zero, any existing history entries are deleted and no new entries are saved. If set to a value less than zero, - the number of history entries is not limited. By default, the - number of history entries is set to the value of the HHIISSTTSSIIZZEE - shell variable. If an attempt is made to set _h_i_s_t_o_r_y_-_s_i_z_e to a + the number of history entries is not limited. By default, the + number of history entries is set to the value of the HHIISSTTSSIIZZEE + shell variable. If an attempt is made to set _h_i_s_t_o_r_y_-_s_i_z_e to a non-numeric value, the maximum number of history entries will be set to 500. hhoorriizzoonnttaall--ssccrroollll--mmooddee ((OOffff)) - When set to OOnn, makes readline use a single line for display, + When set to OOnn, makes readline use a single line for display, scrolling the input horizontally on a single screen line when it - becomes longer than the screen width rather than wrapping to a - new line. This setting is automatically enabled for terminals + becomes longer than the screen width rather than wrapping to a + new line. This setting is automatically enabled for terminals of height 1. iinnppuutt--mmeettaa ((OOffff)) - If set to OOnn, readline will enable eight-bit input (that is, it + If set to OOnn, readline will enable eight-bit input (that is, it will not strip the eighth bit from the characters it reads), re- - gardless of what the terminal claims it can support. The name - mmeettaa--ffllaagg is a synonym for this variable. The default is _O_f_f, + gardless of what the terminal claims it can support. The name + mmeettaa--ffllaagg is a synonym for this variable. The default is _O_f_f, but readline will set it to _O_n if the locale contains characters whose encodings may include bytes with the eighth bit set. This - variable is dependent on the LLCC__CCTTYYPPEE locale category, and may + variable is dependent on the LLCC__CCTTYYPPEE locale category, and may change if the locale is changed. iisseeaarrcchh--tteerrmmiinnaattoorrss (("CC--[[CC--JJ")) - The string of characters that should terminate an incremental - search without subsequently executing the character as a com- - mand. If this variable has not been given a value, the charac- + The string of characters that should terminate an incremental + search without subsequently executing the character as a com- + mand. If this variable has not been given a value, the charac- ters _E_S_C and _C_-_J will terminate an incremental search. kkeeyymmaapp ((eemmaaccss)) - Set the current readline keymap. The set of valid keymap names - is _e_m_a_c_s_, _e_m_a_c_s_-_s_t_a_n_d_a_r_d_, _e_m_a_c_s_-_m_e_t_a_, _e_m_a_c_s_-_c_t_l_x_, _v_i_, _v_i_-_c_o_m_- - _m_a_n_d, and _v_i_-_i_n_s_e_r_t. _v_i is equivalent to _v_i_-_c_o_m_m_a_n_d; _e_m_a_c_s is - equivalent to _e_m_a_c_s_-_s_t_a_n_d_a_r_d. The default value is _e_m_a_c_s; the + Set the current readline keymap. The set of valid keymap names + is _e_m_a_c_s_, _e_m_a_c_s_-_s_t_a_n_d_a_r_d_, _e_m_a_c_s_-_m_e_t_a_, _e_m_a_c_s_-_c_t_l_x_, _v_i_, _v_i_-_c_o_m_- + _m_a_n_d, and _v_i_-_i_n_s_e_r_t. _v_i is equivalent to _v_i_-_c_o_m_m_a_n_d; _e_m_a_c_s is + equivalent to _e_m_a_c_s_-_s_t_a_n_d_a_r_d. The default value is _e_m_a_c_s; the value of eeddiittiinngg--mmooddee also affects the default keymap. kkeeyysseeqq--ttiimmeeoouutt ((550000)) - Specifies the duration _r_e_a_d_l_i_n_e will wait for a character when - reading an ambiguous key sequence (one that can form a complete + Specifies the duration _r_e_a_d_l_i_n_e will wait for a character when + reading an ambiguous key sequence (one that can form a complete key sequence using the input read so far, or can take additional - input to complete a longer key sequence). If no input is re- - ceived within the timeout, _r_e_a_d_l_i_n_e will use the shorter but - complete key sequence. The value is specified in milliseconds, - so a value of 1000 means that _r_e_a_d_l_i_n_e will wait one second for - additional input. If this variable is set to a value less than - or equal to zero, or to a non-numeric value, _r_e_a_d_l_i_n_e will wait - until another key is pressed to decide which key sequence to + input to complete a longer key sequence). If no input is re- + ceived within the timeout, _r_e_a_d_l_i_n_e will use the shorter but + complete key sequence. The value is specified in milliseconds, + so a value of 1000 means that _r_e_a_d_l_i_n_e will wait one second for + additional input. If this variable is set to a value less than + or equal to zero, or to a non-numeric value, _r_e_a_d_l_i_n_e will wait + until another key is pressed to decide which key sequence to complete. mmaarrkk--ddiirreeccttoorriieess ((OOnn)) If set to OOnn, completed directory names have a slash appended. mmaarrkk--mmooddiiffiieedd--lliinneess ((OOffff)) - If set to OOnn, history lines that have been modified are dis- + If set to OOnn, history lines that have been modified are dis- played with a preceding asterisk (**). mmaarrkk--ssyymmlliinnkkeedd--ddiirreeccttoorriieess ((OOffff)) If set to OOnn, completed names which are symbolic links to direc- - tories have a slash appended (subject to the value of mmaarrkk--ddii-- + tories have a slash appended (subject to the value of mmaarrkk--ddii-- rreeccttoorriieess). mmaattcchh--hhiiddddeenn--ffiilleess ((OOnn)) - This variable, when set to OOnn, forces readline to match files - whose names begin with a "." (hidden files) when performing - filename completion. If set to OOffff, the user must include the + This variable, when set to OOnn, forces readline to match files + whose names begin with a "." (hidden files) when performing + filename completion. If set to OOffff, the user must include the leading "." in the filename to be completed. mmeennuu--ccoommpplleettee--ddiissppllaayy--pprreeffiixx ((OOffff)) - If set to OOnn, menu completion displays the common prefix of the + If set to OOnn, menu completion displays the common prefix of the list of possible completions (which may be empty) before cycling through the list. oouuttppuutt--mmeettaa ((OOffff)) - If set to OOnn, readline will display characters with the eighth + If set to OOnn, readline will display characters with the eighth bit set directly rather than as a meta-prefixed escape sequence. The default is _O_f_f, but readline will set it to _O_n if the locale - contains characters whose encodings may include bytes with the - eighth bit set. This variable is dependent on the LLCC__CCTTYYPPEE lo- + contains characters whose encodings may include bytes with the + eighth bit set. This variable is dependent on the LLCC__CCTTYYPPEE lo- cale category, and may change if the locale is changed. ppaaggee--ccoommpplleettiioonnss ((OOnn)) - If set to OOnn, readline uses an internal _m_o_r_e-like pager to dis- + If set to OOnn, readline uses an internal _m_o_r_e-like pager to dis- play a screenful of possible completions at a time. + pprreeffeerr--vviissiibbllee--bbeellll + See bbeellll--ssttyyllee. pprriinntt--ccoommpplleettiioonnss--hhoorriizzoonnttaallllyy ((OOffff)) - If set to OOnn, readline will display completions with matches - sorted horizontally in alphabetical order, rather than down the + If set to OOnn, readline will display completions with matches + sorted horizontally in alphabetical order, rather than down the screen. rreevveerrtt--aallll--aatt--nneewwlliinnee ((OOffff)) - If set to OOnn, readline will undo all changes to history lines + If set to OOnn, readline will undo all changes to history lines before returning when aacccceepptt--lliinnee is executed. By default, his- - tory lines may be modified and retain individual undo lists + tory lines may be modified and retain individual undo lists across calls to rreeaaddlliinnee. sseeaarrcchh--iiggnnoorree--ccaassee ((OOffff)) - If set to OOnn, readline performs incremental and non-incremental + If set to OOnn, readline performs incremental and non-incremental history list searches in a case-insensitive fashion. sshhooww--aallll--iiff--aammbbiigguuoouuss ((OOffff)) - This alters the default behavior of the completion functions. + This alters the default behavior of the completion functions. If set to OOnn, words which have more than one possible completion - cause the matches to be listed immediately instead of ringing + cause the matches to be listed immediately instead of ringing the bell. sshhooww--aallll--iiff--uunnmmooddiiffiieedd ((OOffff)) - This alters the default behavior of the completion functions in + This alters the default behavior of the completion functions in a fashion similar to sshhooww--aallll--iiff--aammbbiigguuoouuss. If set to OOnn, words - which have more than one possible completion without any possi- - ble partial completion (the possible completions don't share a - common prefix) cause the matches to be listed immediately in- + which have more than one possible completion without any possi- + ble partial completion (the possible completions don't share a + common prefix) cause the matches to be listed immediately in- stead of ringing the bell. sshhooww--mmooddee--iinn--pprroommpptt ((OOffff)) - If set to OOnn, add a string to the beginning of the prompt indi- - cating the editing mode: emacs, vi command, or vi insertion. + If set to OOnn, add a string to the beginning of the prompt indi- + cating the editing mode: emacs, vi command, or vi insertion. The mode strings are user-settable (e.g., _e_m_a_c_s_-_m_o_d_e_-_s_t_r_i_n_g). sskkiipp--ccoommpplleetteedd--tteexxtt ((OOffff)) - If set to OOnn, this alters the default completion behavior when - inserting a single match into the line. It's only active when - performing completion in the middle of a word. If enabled, - readline does not insert characters from the completion that - match characters after point in the word being completed, so + If set to OOnn, this alters the default completion behavior when + inserting a single match into the line. It's only active when + performing completion in the middle of a word. If enabled, + readline does not insert characters from the completion that + match characters after point in the word being completed, so portions of the word following the cursor are not duplicated. vvii--ccmmdd--mmooddee--ssttrriinngg ((((ccmmdd)))) - If the _s_h_o_w_-_m_o_d_e_-_i_n_-_p_r_o_m_p_t variable is enabled, this string is + If the _s_h_o_w_-_m_o_d_e_-_i_n_-_p_r_o_m_p_t variable is enabled, this string is displayed immediately before the last line of the primary prompt - when vi editing mode is active and in command mode. The value + when vi editing mode is active and in command mode. The value is expanded like a key binding, so the standard set of meta- and - control prefixes and backslash escape sequences is available. - Use the \1 and \2 escapes to begin and end sequences of non- - printing characters, which can be used to embed a terminal con- + control prefixes and backslash escape sequences is available. + Use the \1 and \2 escapes to begin and end sequences of non- + printing characters, which can be used to embed a terminal con- trol sequence into the mode string. vvii--iinnss--mmooddee--ssttrriinngg ((((iinnss)))) - If the _s_h_o_w_-_m_o_d_e_-_i_n_-_p_r_o_m_p_t variable is enabled, this string is + If the _s_h_o_w_-_m_o_d_e_-_i_n_-_p_r_o_m_p_t variable is enabled, this string is displayed immediately before the last line of the primary prompt when vi editing mode is active and in insertion mode. The value is expanded like a key binding, so the standard set of meta- and - control prefixes and backslash escape sequences is available. - Use the \1 and \2 escapes to begin and end sequences of non- - printing characters, which can be used to embed a terminal con- + control prefixes and backslash escape sequences is available. + Use the \1 and \2 escapes to begin and end sequences of non- + printing characters, which can be used to embed a terminal con- trol sequence into the mode string. vviissiibbllee--ssttaattss ((OOffff)) - If set to OOnn, a character denoting a file's type as reported by - _s_t_a_t(2) is appended to the filename when listing possible com- + If set to OOnn, a character denoting a file's type as reported by + _s_t_a_t(2) is appended to the filename when listing possible com- pletions. RReeaaddlliinnee CCoonnddiittiioonnaall CCoonnssttrruuccttss - Readline implements a facility similar in spirit to the conditional - compilation features of the C preprocessor which allows key bindings - and variable settings to be performed as the result of tests. There + Readline implements a facility similar in spirit to the conditional + compilation features of the C preprocessor which allows key bindings + and variable settings to be performed as the result of tests. There are four parser directives used. - $$iiff The $$iiff construct allows bindings to be made based on the edit- - ing mode, the terminal being used, or the application using - readline. The text of the test, after any comparison operator, + $$iiff The $$iiff construct allows bindings to be made based on the edit- + ing mode, the terminal being used, or the application using + readline. The text of the test, after any comparison operator, extends to the end of the line; unless otherwise noted, no char- acters are required to isolate it. - mmooddee The mmooddee== form of the $$iiff directive is used to test - whether readline is in emacs or vi mode. This may be - used in conjunction with the sseett kkeeyymmaapp command, for in- - stance, to set bindings in the _e_m_a_c_s_-_s_t_a_n_d_a_r_d and - _e_m_a_c_s_-_c_t_l_x keymaps only if readline is starting out in + mmooddee The mmooddee== form of the $$iiff directive is used to test + whether readline is in emacs or vi mode. This may be + used in conjunction with the sseett kkeeyymmaapp command, for in- + stance, to set bindings in the _e_m_a_c_s_-_s_t_a_n_d_a_r_d and + _e_m_a_c_s_-_c_t_l_x keymaps only if readline is starting out in emacs mode. - tteerrmm The tteerrmm== form may be used to include terminal-specific + tteerrmm The tteerrmm== form may be used to include terminal-specific key bindings, perhaps to bind the key sequences output by the terminal's function keys. The word on the right side of the == is tested against both the full name of the ter- - minal and the portion of the terminal name before the - first --. This allows _s_u_n to match both _s_u_n and _s_u_n_-_c_m_d, + minal and the portion of the terminal name before the + first --. This allows _s_u_n to match both _s_u_n and _s_u_n_-_c_m_d, for instance. vveerrssiioonn - The vveerrssiioonn test may be used to perform comparisons - against specific readline versions. The vveerrssiioonn expands - to the current readline version. The set of comparison - operators includes ==, (and ====), !!==, <<==, >>==, <<, and >>. - The version number supplied on the right side of the op- - erator consists of a major version number, an optional + The vveerrssiioonn test may be used to perform comparisons + against specific readline versions. The vveerrssiioonn expands + to the current readline version. The set of comparison + operators includes ==, (and ====), !!==, <<==, >>==, <<, and >>. + The version number supplied on the right side of the op- + erator consists of a major version number, an optional decimal point, and an optional minor version (e.g., 77..11). - If the minor version is omitted, it is assumed to be 00. + If the minor version is omitted, it is assumed to be 00. The operator may be separated from the string vveerrssiioonn and from the version number argument by whitespace. _a_p_p_l_i_c_a_t_i_o_n The _a_p_p_l_i_c_a_t_i_o_n construct is used to include application- - specific settings. Each program using the readline li- - brary sets the _a_p_p_l_i_c_a_t_i_o_n _n_a_m_e, and an initialization + specific settings. Each program using the readline li- + brary sets the _a_p_p_l_i_c_a_t_i_o_n _n_a_m_e, and an initialization file can test for a particular value. This could be used - to bind key sequences to functions useful for a specific - program. For instance, the following command adds a key - sequence that quotes the current or previous word in + to bind key sequences to functions useful for a specific + program. For instance, the following command adds a key + sequence that quotes the current or previous word in bbaasshh: $$iiff Bash @@ -3778,12 +3933,12 @@ RREEAADDLLIINNEE _v_a_r_i_a_b_l_e The _v_a_r_i_a_b_l_e construct provides simple equality tests for - readline variables and values. The permitted comparison - operators are _=, _=_=, and _!_=. The variable name must be + readline variables and values. The permitted comparison + operators are _=, _=_=, and _!_=. The variable name must be separated from the comparison operator by whitespace; the - operator may be separated from the value on the right - hand side by whitespace. Both string and boolean vari- - ables may be tested. Boolean variables must be tested + operator may be separated from the value on the right + hand side by whitespace. Both string and boolean vari- + ables may be tested. Boolean variables must be tested against the values _o_n and _o_f_f. $$eennddiiff This command, as seen in the previous example, terminates an $$iiff @@ -3793,59 +3948,59 @@ RREEAADDLLIINNEE test fails. $$iinncclluuddee - This directive takes a single filename as an argument and reads - commands and bindings from that file. For example, the follow- + This directive takes a single filename as an argument and reads + commands and bindings from that file. For example, the follow- ing directive would read _/_e_t_c_/_i_n_p_u_t_r_c: $$iinncclluuddee _/_e_t_c_/_i_n_p_u_t_r_c SSeeaarrcchhiinngg - Readline provides commands for searching through the command history + Readline provides commands for searching through the command history (see HHIISSTTOORRYY below) for lines containing a specified string. There are two search modes: _i_n_c_r_e_m_e_n_t_a_l and _n_o_n_-_i_n_c_r_e_m_e_n_t_a_l. - Incremental searches begin before the user has finished typing the - search string. As each character of the search string is typed, read- + Incremental searches begin before the user has finished typing the + search string. As each character of the search string is typed, read- line displays the next entry from the history matching the string typed - so far. An incremental search requires only as many characters as - needed to find the desired history entry. The characters present in - the value of the iisseeaarrcchh--tteerrmmiinnaattoorrss variable are used to terminate an + so far. An incremental search requires only as many characters as + needed to find the desired history entry. The characters present in + the value of the iisseeaarrcchh--tteerrmmiinnaattoorrss variable are used to terminate an incremental search. If that variable has not been assigned a value the - Escape and Control-J characters will terminate an incremental search. - Control-G will abort an incremental search and restore the original - line. When the search is terminated, the history entry containing the + Escape and Control-J characters will terminate an incremental search. + Control-G will abort an incremental search and restore the original + line. When the search is terminated, the history entry containing the search string becomes the current line. - To find other matching entries in the history list, type Control-S or - Control-R as appropriate. This will search backward or forward in the - history for the next entry matching the search string typed so far. - Any other key sequence bound to a readline command will terminate the - search and execute that command. For instance, a _n_e_w_l_i_n_e will termi- + To find other matching entries in the history list, type Control-S or + Control-R as appropriate. This will search backward or forward in the + history for the next entry matching the search string typed so far. + Any other key sequence bound to a readline command will terminate the + search and execute that command. For instance, a _n_e_w_l_i_n_e will termi- nate the search and accept the line, thereby executing the command from the history list. Readline remembers the last incremental search string. If two Control- - Rs are typed without any intervening characters defining a new search + Rs are typed without any intervening characters defining a new search string, readline uses any remembered search string. - Non-incremental searches read the entire search string before starting - to search for matching history lines. The search string may be typed + Non-incremental searches read the entire search string before starting + to search for matching history lines. The search string may be typed by the user or be part of the contents of the current line. RReeaaddlliinnee CCoommmmaanndd NNaammeess - The following is a list of the names of the commands and the default + The following is a list of the names of the commands and the default key sequences to which they are bound. Command names without an accom- panying key sequence are unbound by default. In the following descrip- - tions, _p_o_i_n_t refers to the current cursor position, and _m_a_r_k refers to - a cursor position saved by the sseett--mmaarrkk command. The text between the + tions, _p_o_i_n_t refers to the current cursor position, and _m_a_r_k refers to + a cursor position saved by the sseett--mmaarrkk command. The text between the point and mark is referred to as the _r_e_g_i_o_n. CCoommmmaannddss ffoorr MMoovviinngg bbeeggiinnnniinngg--ooff--lliinnee ((CC--aa)) - Move to the start of the current line. This may also be bound + Move to the start of the current line. This may also be bound to the Home key on some keyboards. eenndd--ooff--lliinnee ((CC--ee)) - Move to the end of the line. This may also be bound to the End + Move to the end of the line. This may also be bound to the End key on some keyboards. ffoorrwwaarrdd--cchhaarr ((CC--ff)) Move forward a character. @@ -3855,33 +4010,33 @@ RREEAADDLLIINNEE Move forward to the end of the next word. Words are composed of alphanumeric characters (letters and digits). bbaacckkwwaarrdd--wwoorrdd ((MM--bb)) - Move back to the start of the current or previous word. Words + Move back to the start of the current or previous word. Words are composed of alphanumeric characters (letters and digits). sshheellll--ffoorrwwaarrdd--wwoorrdd - Move forward to the end of the next word. Words are delimited + Move forward to the end of the next word. Words are delimited by non-quoted shell metacharacters. sshheellll--bbaacckkwwaarrdd--wwoorrdd - Move back to the start of the current or previous word. Words + Move back to the start of the current or previous word. Words are delimited by non-quoted shell metacharacters. pprreevviioouuss--ssccrreeeenn--lliinnee - Attempt to move point to the same physical screen column on the - previous physical screen line. This will not have the desired - effect if the current readline line does not take up more than - one physical line or if point is not greater than the length of + Attempt to move point to the same physical screen column on the + previous physical screen line. This will not have the desired + effect if the current readline line does not take up more than + one physical line or if point is not greater than the length of the prompt plus the screen width. nneexxtt--ssccrreeeenn--lliinnee - Attempt to move point to the same physical screen column on the + Attempt to move point to the same physical screen column on the next physical screen line. This will not have the desired effect - if the current readline line does not take up more than one - physical line or if the length of the current readline line is + if the current readline line does not take up more than one + physical line or if the length of the current readline line is not greater than the length of the prompt plus the screen width. cclleeaarr--ddiissppllaayy ((MM--CC--ll)) - Clear the screen and, if possible, the terminal's scrollback - buffer, then redraw the current line, leaving the current line + Clear the screen and, if possible, the terminal's scrollback + buffer, then redraw the current line, leaving the current line at the top of the screen. cclleeaarr--ssccrreeeenn ((CC--ll)) Clear the screen, then redraw the current line, leaving the cur- - rent line at the top of the screen. With an argument, refresh + rent line at the top of the screen. With an argument, refresh the current line without clearing the screen. rreeddrraaww--ccuurrrreenntt--lliinnee Refresh the current line. @@ -3889,114 +4044,114 @@ RREEAADDLLIINNEE CCoommmmaannddss ffoorr MMaanniippuullaattiinngg tthhee HHiissttoorryy aacccceepptt--lliinnee ((NNeewwlliinnee,, RReettuurrnn)) Accept the line regardless of where the cursor is. If this line - is non-empty, add it to the history list according to the state - of the HHIISSTTCCOONNTTRROOLL variable. If the line is a modified history + is non-empty, add it to the history list according to the state + of the HHIISSTTCCOONNTTRROOLL variable. If the line is a modified history line, then restore the history line to its original state. pprreevviioouuss--hhiissttoorryy ((CC--pp)) Fetch the previous command from the history list, moving back in the list. nneexxtt--hhiissttoorryy ((CC--nn)) - Fetch the next command from the history list, moving forward in + Fetch the next command from the history list, moving forward in the list. bbeeggiinnnniinngg--ooff--hhiissttoorryy ((MM--<<)) Move to the first line in the history. eenndd--ooff--hhiissttoorryy ((MM-->>)) - Move to the end of the input history, i.e., the line currently + Move to the end of the input history, i.e., the line currently being entered. ooppeerraattee--aanndd--ggeett--nneexxtt ((CC--oo)) - Accept the current line for execution and fetch the next line - relative to the current line from the history for editing. A - numeric argument, if supplied, specifies the history entry to + Accept the current line for execution and fetch the next line + relative to the current line from the history for editing. A + numeric argument, if supplied, specifies the history entry to use instead of the current line. ffeettcchh--hhiissttoorryy - With a numeric argument, fetch that entry from the history list + With a numeric argument, fetch that entry from the history list and make it the current line. Without an argument, move back to the first entry in the history list. rreevveerrssee--sseeaarrcchh--hhiissttoorryy ((CC--rr)) - Search backward starting at the current line and moving "up" - through the history as necessary. This is an incremental + Search backward starting at the current line and moving "up" + through the history as necessary. This is an incremental search. ffoorrwwaarrdd--sseeaarrcchh--hhiissttoorryy ((CC--ss)) - Search forward starting at the current line and moving "down" - through the history as necessary. This is an incremental + Search forward starting at the current line and moving "down" + through the history as necessary. This is an incremental search. nnoonn--iinnccrreemmeennttaall--rreevveerrssee--sseeaarrcchh--hhiissttoorryy ((MM--pp)) Search backward through the history starting at the current line - using a non-incremental search for a string supplied by the + using a non-incremental search for a string supplied by the user. nnoonn--iinnccrreemmeennttaall--ffoorrwwaarrdd--sseeaarrcchh--hhiissttoorryy ((MM--nn)) - Search forward through the history using a non-incremental + Search forward through the history using a non-incremental search for a string supplied by the user. hhiissttoorryy--sseeaarrcchh--bbaacckkwwaarrdd Search backward through the history for the string of characters - between the start of the current line and the point. This is a + between the start of the current line and the point. This is a non-incremental search. This may be bound to the Page Up key on some keyboards. hhiissttoorryy--sseeaarrcchh--ffoorrwwaarrdd - Search forward through the history for the string of characters - between the start of the current line and the point. This is a - non-incremental search. This may be bound to the Page Down key + Search forward through the history for the string of characters + between the start of the current line and the point. This is a + non-incremental search. This may be bound to the Page Down key on some keyboards. hhiissttoorryy--ssuubbssttrriinngg--sseeaarrcchh--bbaacckkwwaarrdd Search backward through the history for the string of characters between the start of the current line and the current cursor po- - sition (the _p_o_i_n_t). The search string may match anywhere in a + sition (the _p_o_i_n_t). The search string may match anywhere in a history line. This is a non-incremental search. hhiissttoorryy--ssuubbssttrriinngg--sseeaarrcchh--ffoorrwwaarrdd - Search forward through the history for the string of characters + Search forward through the history for the string of characters between the start of the current line and the point. The search - string may match anywhere in a history line. This is a non-in- + string may match anywhere in a history line. This is a non-in- cremental search. yyaannkk--nntthh--aarrgg ((MM--CC--yy)) - Insert the first argument to the previous command (usually the + Insert the first argument to the previous command (usually the second word on the previous line) at point. With an argument _n, - insert the _nth word from the previous command (the words in the - previous command begin with word 0). A negative argument in- - serts the _nth word from the end of the previous command. Once - the argument _n is computed, the argument is extracted as if the + insert the _nth word from the previous command (the words in the + previous command begin with word 0). A negative argument in- + serts the _nth word from the end of the previous command. Once + the argument _n is computed, the argument is extracted as if the "!_n" history expansion had been specified. yyaannkk--llaasstt--aarrgg ((MM--..,, MM--__)) - Insert the last argument to the previous command (the last word + Insert the last argument to the previous command (the last word of the previous history entry). With a numeric argument, behave - exactly like yyaannkk--nntthh--aarrgg. Successive calls to yyaannkk--llaasstt--aarrgg - move back through the history list, inserting the last word (or - the word specified by the argument to the first call) of each + exactly like yyaannkk--nntthh--aarrgg. Successive calls to yyaannkk--llaasstt--aarrgg + move back through the history list, inserting the last word (or + the word specified by the argument to the first call) of each line in turn. Any numeric argument supplied to these successive - calls determines the direction to move through the history. A - negative argument switches the direction through the history + calls determines the direction to move through the history. A + negative argument switches the direction through the history (back or forward). The history expansion facilities are used to extract the last word, as if the "!$" history expansion had been specified. sshheellll--eexxppaanndd--lliinnee ((MM--CC--ee)) - Expand the line by performing shell word expansions. This per- + Expand the line by performing shell word expansions. This per- forms alias and history expansion, $$'_s_t_r_i_n_g' and $$"_s_t_r_i_n_g" quot- - ing, tilde expansion, parameter and variable expansion, arith- - metic expansion, command and process substitution, word split- - ting, and quote removal. An explicit argument suppresses com- - mand and process substitution. See HHIISSTTOORRYY EEXXPPAANNSSIIOONN below for + ing, tilde expansion, parameter and variable expansion, arith- + metic expansion, command and process substitution, word split- + ting, and quote removal. An explicit argument suppresses com- + mand and process substitution. See HHIISSTTOORRYY EEXXPPAANNSSIIOONN below for a description of history expansion. hhiissttoorryy--eexxppaanndd--lliinnee ((MM--^^)) - Perform history expansion on the current line. See HHIISSTTOORRYY EEXX-- + Perform history expansion on the current line. See HHIISSTTOORRYY EEXX-- PPAANNSSIIOONN below for a description of history expansion. mmaaggiicc--ssppaaccee - Perform history expansion on the current line and insert a + Perform history expansion on the current line and insert a space. See HHIISSTTOORRYY EEXXPPAANNSSIIOONN below for a description of history expansion. aalliiaass--eexxppaanndd--lliinnee - Perform alias expansion on the current line. See AALLIIAASSEESS above + Perform alias expansion on the current line. See AALLIIAASSEESS above for a description of alias expansion. hhiissttoorryy--aanndd--aalliiaass--eexxppaanndd--lliinnee Perform history and alias expansion on the current line. iinnsseerrtt--llaasstt--aarrgguummeenntt ((MM--..,, MM--__)) A synonym for yyaannkk--llaasstt--aarrgg. eeddiitt--aanndd--eexxeeccuuttee--ccoommmmaanndd ((CC--xx CC--ee)) - Invoke an editor on the current command line, and execute the + Invoke an editor on the current command line, and execute the result as shell commands. BBaasshh attempts to invoke $$VVIISSUUAALL, $$EEDD-- IITTOORR, and _e_m_a_c_s as the editor, in that order. CCoommmmaannddss ffoorr CChhaannggiinngg TTeexxtt _e_n_d_-_o_f_-_f_i_l_e ((uussuuaallllyy CC--dd)) - The character indicating end-of-file as set, for example, by + The character indicating end-of-file as set, for example, by _s_t_t_y(1). If this character is read when there are no characters on the line, and point is at the beginning of the line, readline interprets it as the end of input and returns EEOOFF. @@ -4005,46 +4160,46 @@ RREEAADDLLIINNEE same character as the tty EEOOFF character, as CC--dd commonly is, see above for the effects. bbaacckkwwaarrdd--ddeelleettee--cchhaarr ((RRuubboouutt)) - Delete the character behind the cursor. When given a numeric + Delete the character behind the cursor. When given a numeric argument, save the deleted text on the kill ring. ffoorrwwaarrdd--bbaacckkwwaarrdd--ddeelleettee--cchhaarr - Delete the character under the cursor, unless the cursor is at + Delete the character under the cursor, unless the cursor is at the end of the line, in which case the character behind the cur- sor is deleted. qquuootteedd--iinnsseerrtt ((CC--qq,, CC--vv)) - Add the next character typed to the line verbatim. This is how + Add the next character typed to the line verbatim. This is how to insert characters like CC--qq, for example. ttaabb--iinnsseerrtt ((CC--vv TTAABB)) Insert a tab character. sseellff--iinnsseerrtt ((aa,, bb,, AA,, 11,, !!,, ...)) Insert the character typed. ttrraannssppoossee--cchhaarrss ((CC--tt)) - Drag the character before point forward over the character at - point, moving point forward as well. If point is at the end of - the line, then this transposes the two characters before point. + Drag the character before point forward over the character at + point, moving point forward as well. If point is at the end of + the line, then this transposes the two characters before point. Negative arguments have no effect. ttrraannssppoossee--wwoorrddss ((MM--tt)) - Drag the word before point past the word after point, moving - point over that word as well. If point is at the end of the + Drag the word before point past the word after point, moving + point over that word as well. If point is at the end of the line, this transposes the last two words on the line. uuppccaassee--wwoorrdd ((MM--uu)) - Uppercase the current (or following) word. With a negative ar- + Uppercase the current (or following) word. With a negative ar- gument, uppercase the previous word, but do not move point. ddoowwnnccaassee--wwoorrdd ((MM--ll)) - Lowercase the current (or following) word. With a negative ar- + Lowercase the current (or following) word. With a negative ar- gument, lowercase the previous word, but do not move point. ccaappiittaalliizzee--wwoorrdd ((MM--cc)) Capitalize the current (or following) word. With a negative ar- gument, capitalize the previous word, but do not move point. oovveerrwwrriittee--mmooddee - Toggle overwrite mode. With an explicit positive numeric argu- + Toggle overwrite mode. With an explicit positive numeric argu- ment, switches to overwrite mode. With an explicit non-positive numeric argument, switches to insert mode. This command affects - only eemmaaccss mode; vvii mode does overwrite differently. Each call + only eemmaaccss mode; vvii mode does overwrite differently. Each call to _r_e_a_d_l_i_n_e_(_) starts in insert mode. In overwrite mode, charac- - ters bound to sseellff--iinnsseerrtt replace the text at point rather than - pushing the text to the right. Characters bound to bbaacckk-- - wwaarrdd--ddeelleettee--cchhaarr replace the character before point with a + ters bound to sseellff--iinnsseerrtt replace the text at point rather than + pushing the text to the right. Characters bound to bbaacckk-- + wwaarrdd--ddeelleettee--cchhaarr replace the character before point with a space. By default, this command is unbound, but may be bound to the Insert key on some keyboards. @@ -4054,31 +4209,31 @@ RREEAADDLLIINNEE bbaacckkwwaarrdd--kkiillll--lliinnee ((CC--xx RRuubboouutt)) Kill backward to the beginning of the line. uunniixx--lliinnee--ddiissccaarrdd ((CC--uu)) - Kill backward from point to the beginning of the line. The + Kill backward from point to the beginning of the line. The killed text is saved on the kill-ring. kkiillll--wwhhoollee--lliinnee - Kill all characters on the current line, no matter where point + Kill all characters on the current line, no matter where point is. kkiillll--wwoorrdd ((MM--dd)) - Kill from point to the end of the current word, or if between - words, to the end of the next word. Word boundaries are the + Kill from point to the end of the current word, or if between + words, to the end of the next word. Word boundaries are the same as those used by ffoorrwwaarrdd--wwoorrdd. bbaacckkwwaarrdd--kkiillll--wwoorrdd ((MM--RRuubboouutt)) - Kill the word behind point. Word boundaries are the same as + Kill the word behind point. Word boundaries are the same as those used by bbaacckkwwaarrdd--wwoorrdd. sshheellll--kkiillll--wwoorrdd - Kill from point to the end of the current word, or if between - words, to the end of the next word. Word boundaries are the + Kill from point to the end of the current word, or if between + words, to the end of the next word. Word boundaries are the same as those used by sshheellll--ffoorrwwaarrdd--wwoorrdd. sshheellll--bbaacckkwwaarrdd--kkiillll--wwoorrdd - Kill the word behind point. Word boundaries are the same as + Kill the word behind point. Word boundaries are the same as those used by sshheellll--bbaacckkwwaarrdd--wwoorrdd. uunniixx--wwoorrdd--rruubboouutt ((CC--ww)) - Kill the word behind point, using white space as a word bound- + Kill the word behind point, using white space as a word bound- ary. The killed text is saved on the kill-ring. uunniixx--ffiilleennaammee--rruubboouutt - Kill the word behind point, using white space and the slash - character as the word boundaries. The killed text is saved on + Kill the word behind point, using white space and the slash + character as the word boundaries. The killed text is saved on the kill-ring. ddeelleettee--hhoorriizzoonnttaall--ssppaaccee ((MM--\\)) Delete all spaces and tabs around point. @@ -4087,64 +4242,64 @@ RREEAADDLLIINNEE ccooppyy--rreeggiioonn--aass--kkiillll Copy the text in the region to the kill buffer. ccooppyy--bbaacckkwwaarrdd--wwoorrdd - Copy the word before point to the kill buffer. The word bound- + Copy the word before point to the kill buffer. The word bound- aries are the same as bbaacckkwwaarrdd--wwoorrdd. ccooppyy--ffoorrwwaarrdd--wwoorrdd - Copy the word following point to the kill buffer. The word + Copy the word following point to the kill buffer. The word boundaries are the same as ffoorrwwaarrdd--wwoorrdd. yyaannkk ((CC--yy)) Yank the top of the kill ring into the buffer at point. yyaannkk--ppoopp ((MM--yy)) - Rotate the kill ring, and yank the new top. Only works follow- + Rotate the kill ring, and yank the new top. Only works follow- ing yyaannkk or yyaannkk--ppoopp. NNuummeerriicc AArrgguummeennttss ddiiggiitt--aarrgguummeenntt ((MM--00,, MM--11,, ...,, MM----)) - Add this digit to the argument already accumulating, or start a + Add this digit to the argument already accumulating, or start a new argument. M-- starts a negative argument. uunniivveerrssaall--aarrgguummeenntt - This is another way to specify an argument. If this command is - followed by one or more digits, optionally with a leading minus - sign, those digits define the argument. If the command is fol- + This is another way to specify an argument. If this command is + followed by one or more digits, optionally with a leading minus + sign, those digits define the argument. If the command is fol- lowed by digits, executing uunniivveerrssaall--aarrgguummeenntt again ends the nu- meric argument, but is otherwise ignored. As a special case, if this command is immediately followed by a character that is nei- - ther a digit nor minus sign, the argument count for the next - command is multiplied by four. The argument count is initially - one, so executing this function the first time makes the argu- + ther a digit nor minus sign, the argument count for the next + command is multiplied by four. The argument count is initially + one, so executing this function the first time makes the argu- ment count four, a second time makes the argument count sixteen, and so on. CCoommpplleettiinngg ccoommpplleettee ((TTAABB)) - Attempt to perform completion on the text before point. BBaasshh + Attempt to perform completion on the text before point. BBaasshh attempts completion treating the text as a variable (if the text - begins with $$), username (if the text begins with ~~), hostname - (if the text begins with @@), or command (including aliases and + begins with $$), username (if the text begins with ~~), hostname + (if the text begins with @@), or command (including aliases and functions) in turn. If none of these produces a match, filename completion is attempted. ppoossssiibbllee--ccoommpplleettiioonnss ((MM--??)) List the possible completions of the text before point. iinnsseerrtt--ccoommpplleettiioonnss ((MM--**)) - Insert all completions of the text before point that would have + Insert all completions of the text before point that would have been generated by ppoossssiibbllee--ccoommpplleettiioonnss. mmeennuu--ccoommpplleettee - Similar to ccoommpplleettee, but replaces the word to be completed with - a single match from the list of possible completions. Repeated - execution of mmeennuu--ccoommpplleettee steps through the list of possible - completions, inserting each match in turn. At the end of the + Similar to ccoommpplleettee, but replaces the word to be completed with + a single match from the list of possible completions. Repeated + execution of mmeennuu--ccoommpplleettee steps through the list of possible + completions, inserting each match in turn. At the end of the list of completions, the bell is rung (subject to the setting of bbeellll--ssttyyllee) and the original text is restored. An argument of _n moves _n positions forward in the list of matches; a negative ar- gument may be used to move backward through the list. This com- mand is intended to be bound to TTAABB, but is unbound by default. mmeennuu--ccoommpplleettee--bbaacckkwwaarrdd - Identical to mmeennuu--ccoommpplleettee, but moves backward through the list - of possible completions, as if mmeennuu--ccoommpplleettee had been given a + Identical to mmeennuu--ccoommpplleettee, but moves backward through the list + of possible completions, as if mmeennuu--ccoommpplleettee had been given a negative argument. This command is unbound by default. ddeelleettee--cchhaarr--oorr--lliisstt - Deletes the character under the cursor if not at the beginning - or end of the line (like ddeelleettee--cchhaarr). If at the end of the + Deletes the character under the cursor if not at the beginning + or end of the line (like ddeelleettee--cchhaarr). If at the end of the line, behaves identically to ppoossssiibbllee--ccoommpplleettiioonnss. This command is unbound by default. ccoommpplleettee--ffiilleennaammee ((MM--//)) @@ -4153,67 +4308,67 @@ RREEAADDLLIINNEE List the possible completions of the text before point, treating it as a filename. ccoommpplleettee--uusseerrnnaammee ((MM--~~)) - Attempt completion on the text before point, treating it as a + Attempt completion on the text before point, treating it as a username. ppoossssiibbllee--uusseerrnnaammee--ccoommpplleettiioonnss ((CC--xx ~~)) List the possible completions of the text before point, treating it as a username. ccoommpplleettee--vvaarriiaabbllee ((MM--$$)) - Attempt completion on the text before point, treating it as a + Attempt completion on the text before point, treating it as a shell variable. ppoossssiibbllee--vvaarriiaabbllee--ccoommpplleettiioonnss ((CC--xx $$)) List the possible completions of the text before point, treating it as a shell variable. ccoommpplleettee--hhoossttnnaammee ((MM--@@)) - Attempt completion on the text before point, treating it as a + Attempt completion on the text before point, treating it as a hostname. ppoossssiibbllee--hhoossttnnaammee--ccoommpplleettiioonnss ((CC--xx @@)) List the possible completions of the text before point, treating it as a hostname. ccoommpplleettee--ccoommmmaanndd ((MM--!!)) - Attempt completion on the text before point, treating it as a - command name. Command completion attempts to match the text - against aliases, reserved words, shell functions, shell + Attempt completion on the text before point, treating it as a + command name. Command completion attempts to match the text + against aliases, reserved words, shell functions, shell builtins, and finally executable filenames, in that order. ppoossssiibbllee--ccoommmmaanndd--ccoommpplleettiioonnss ((CC--xx !!)) List the possible completions of the text before point, treating it as a command name. ddyynnaammiicc--ccoommpplleettee--hhiissttoorryy ((MM--TTAABB)) - Attempt completion on the text before point, comparing the text - against lines from the history list for possible completion + Attempt completion on the text before point, comparing the text + against lines from the history list for possible completion matches. ddaabbbbrreevv--eexxppaanndd - Attempt menu completion on the text before point, comparing the + Attempt menu completion on the text before point, comparing the text against lines from the history list for possible completion matches. ccoommpplleettee--iinnttoo--bbrraacceess ((MM--{{)) Perform filename completion and insert the list of possible com- - pletions enclosed within braces so the list is available to the + pletions enclosed within braces so the list is available to the shell (see BBrraaccee EExxppaannssiioonn above). KKeeyybbooaarrdd MMaaccrrooss ssttaarrtt--kkbbdd--mmaaccrroo ((CC--xx (()) - Begin saving the characters typed into the current keyboard + Begin saving the characters typed into the current keyboard macro. eenndd--kkbbdd--mmaaccrroo ((CC--xx )))) Stop saving the characters typed into the current keyboard macro and store the definition. ccaallll--llaasstt--kkbbdd--mmaaccrroo ((CC--xx ee)) - Re-execute the last keyboard macro defined, by making the char- + Re-execute the last keyboard macro defined, by making the char- acters in the macro appear as if typed at the keyboard. pprriinntt--llaasstt--kkbbdd--mmaaccrroo (()) - Print the last keyboard macro defined in a format suitable for + Print the last keyboard macro defined in a format suitable for the _i_n_p_u_t_r_c file. MMiisscceellllaanneeoouuss rree--rreeaadd--iinniitt--ffiillee ((CC--xx CC--rr)) - Read in the contents of the _i_n_p_u_t_r_c file, and incorporate any + Read in the contents of the _i_n_p_u_t_r_c file, and incorporate any bindings or variable assignments found there. aabboorrtt ((CC--gg)) - Abort the current editing command and ring the terminal's bell + Abort the current editing command and ring the terminal's bell (subject to the setting of bbeellll--ssttyyllee). ddoo--lloowweerrccaassee--vveerrssiioonn ((MM--AA,, MM--BB,, MM--_x,, ...)) - If the metafied character _x is uppercase, run the command that + If the metafied character _x is uppercase, run the command that is bound to the corresponding metafied lowercase character. The behavior is undefined if _x is already lowercase. pprreeffiixx--mmeettaa ((EESSCC)) @@ -4221,204 +4376,205 @@ RREEAADDLLIINNEE uunnddoo ((CC--__,, CC--xx CC--uu)) Incremental undo, separately remembered for each line. rreevveerrtt--lliinnee ((MM--rr)) - Undo all changes made to this line. This is like executing the - uunnddoo command enough times to return the line to its initial + Undo all changes made to this line. This is like executing the + uunnddoo command enough times to return the line to its initial state. ttiillddee--eexxppaanndd ((MM--&&)) Perform tilde expansion on the current word. sseett--mmaarrkk ((CC--@@,, MM--<>)) - Set the mark to the point. If a numeric argument is supplied, + Set the mark to the point. If a numeric argument is supplied, the mark is set to that position. eexxcchhaannggee--ppooiinntt--aanndd--mmaarrkk ((CC--xx CC--xx)) - Swap the point with the mark. The current cursor position is - set to the saved position, and the old cursor position is saved + Swap the point with the mark. The current cursor position is + set to the saved position, and the old cursor position is saved as the mark. cchhaarraacctteerr--sseeaarrcchh ((CC--]])) A character is read and point is moved to the next occurrence of - that character. A negative argument searches for previous oc- + that character. A negative argument searches for previous oc- currences. cchhaarraacctteerr--sseeaarrcchh--bbaacckkwwaarrdd ((MM--CC--]])) - A character is read and point is moved to the previous occur- - rence of that character. A negative argument searches for sub- + A character is read and point is moved to the previous occur- + rence of that character. A negative argument searches for sub- sequent occurrences. sskkiipp--ccssii--sseeqquueennccee - Read enough characters to consume a multi-key sequence such as - those defined for keys like Home and End. Such sequences begin + Read enough characters to consume a multi-key sequence such as + those defined for keys like Home and End. Such sequences begin with a Control Sequence Indicator (CSI), usually ESC-[. If this - sequence is bound to "\[", keys producing such sequences will - have no effect unless explicitly bound to a readline command, - instead of inserting stray characters into the editing buffer. + sequence is bound to "\[", keys producing such sequences will + have no effect unless explicitly bound to a readline command, + instead of inserting stray characters into the editing buffer. This is unbound by default, but usually bound to ESC-[. iinnsseerrtt--ccoommmmeenntt ((MM--##)) - Without a numeric argument, the value of the readline ccoomm-- - mmeenntt--bbeeggiinn variable is inserted at the beginning of the current + Without a numeric argument, the value of the readline ccoomm-- + mmeenntt--bbeeggiinn variable is inserted at the beginning of the current line. If a numeric argument is supplied, this command acts as a - toggle: if the characters at the beginning of the line do not - match the value of ccoommmmeenntt--bbeeggiinn, the value is inserted, other- + toggle: if the characters at the beginning of the line do not + match the value of ccoommmmeenntt--bbeeggiinn, the value is inserted, other- wise the characters in ccoommmmeenntt--bbeeggiinn are deleted from the begin- - ning of the line. In either case, the line is accepted as if a - newline had been typed. The default value of ccoommmmeenntt--bbeeggiinn - causes this command to make the current line a shell comment. - If a numeric argument causes the comment character to be re- + ning of the line. In either case, the line is accepted as if a + newline had been typed. The default value of ccoommmmeenntt--bbeeggiinn + causes this command to make the current line a shell comment. + If a numeric argument causes the comment character to be re- moved, the line will be executed by the shell. ssppeellll--ccoorrrreecctt--wwoorrdd ((CC--xx ss)) - Perform spelling correction on the current word, treating it as - a directory or filename, in the same way as the ccddssppeellll shell - option. Word boundaries are the same as those used by + Perform spelling correction on the current word, treating it as + a directory or filename, in the same way as the ccddssppeellll shell + option. Word boundaries are the same as those used by sshheellll--ffoorrwwaarrdd--wwoorrdd. gglloobb--ccoommpplleettee--wwoorrdd ((MM--gg)) - The word before point is treated as a pattern for pathname ex- - pansion, with an asterisk implicitly appended. This pattern is - used to generate a list of matching filenames for possible com- + The word before point is treated as a pattern for pathname ex- + pansion, with an asterisk implicitly appended. This pattern is + used to generate a list of matching filenames for possible com- pletions. gglloobb--eexxppaanndd--wwoorrdd ((CC--xx **)) - The word before point is treated as a pattern for pathname ex- + The word before point is treated as a pattern for pathname ex- pansion, and the list of matching filenames is inserted, replac- ing the word. If a numeric argument is supplied, an asterisk is appended before pathname expansion. gglloobb--lliisstt--eexxppaannssiioonnss ((CC--xx gg)) - The list of expansions that would have been generated by - gglloobb--eexxppaanndd--wwoorrdd is displayed, and the line is redrawn. If a - numeric argument is supplied, an asterisk is appended before + The list of expansions that would have been generated by + gglloobb--eexxppaanndd--wwoorrdd is displayed, and the line is redrawn. If a + numeric argument is supplied, an asterisk is appended before pathname expansion. dduummpp--ffuunnccttiioonnss - Print all of the functions and their key bindings to the read- + Print all of the functions and their key bindings to the read- line output stream. If a numeric argument is supplied, the out- - put is formatted in such a way that it can be made part of an + put is formatted in such a way that it can be made part of an _i_n_p_u_t_r_c file. dduummpp--vvaarriiaabblleess Print all of the settable readline variables and their values to - the readline output stream. If a numeric argument is supplied, - the output is formatted in such a way that it can be made part + the readline output stream. If a numeric argument is supplied, + the output is formatted in such a way that it can be made part of an _i_n_p_u_t_r_c file. dduummpp--mmaaccrrooss - Print all of the readline key sequences bound to macros and the - strings they output. If a numeric argument is supplied, the + Print all of the readline key sequences bound to macros and the + strings they output. If a numeric argument is supplied, the output is formatted in such a way that it can be made part of an _i_n_p_u_t_r_c file. ddiissppllaayy--sshheellll--vveerrssiioonn ((CC--xx CC--vv)) Display version information about the current instance of bbaasshh. PPrrooggrraammmmaabbllee CCoommpplleettiioonn - When word completion is attempted for an argument to a command for - which a completion specification (a _c_o_m_p_s_p_e_c) has been defined using - the ccoommpplleettee builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below), the programma- - ble completion facilities are invoked. - - First, the command name is identified. If the command word is the - empty string (completion attempted at the beginning of an empty line), - any compspec defined with the --EE option to ccoommpplleettee is used. If a - compspec has been defined for that command, the compspec is used to - generate the list of possible completions for the word. If the command - word is a full pathname, a compspec for the full pathname is searched - for first. If no compspec is found for the full pathname, an attempt - is made to find a compspec for the portion following the final slash. - If those searches do not result in a compspec, any compspec defined - with the --DD option to ccoommpplleettee is used as the default. If there is no - default compspec, bbaasshh attempts alias expansion on the command word as - a final resort, and attempts to find a compspec for the command word + When a user attempts word completion for an argument to a command for + which a completion specification (a _c_o_m_p_s_p_e_c) has been defined using + the ccoommpplleettee builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below), Readline in- + vokes the programmable completion facilities. + + First, the command name is identified. If a compspec has been defined + for that command, the compspec is used to generate the list of possible + completions for the word. If the command word is the empty string + (completion attempted at the beginning of an empty line), any compspec + defined with the --EE option to ccoommpplleettee is used. If the command word is + a full pathname, a compspec for the full pathname is searched for + first. If no compspec is found for the full pathname, completion at- + tempts to find a compspec for the portion following the final slash. + If those searches do not result in a compspec, any compspec defined + with the --DD option to ccoommpplleettee is used as the default. If there is no + default compspec, bbaasshh attempts alias expansion on the command word as + a final resort, and attempts to find a compspec for the command word from any successful expansion. - Once a compspec has been found, it is used to generate the list of - matching words. If a compspec is not found, the default bbaasshh comple- + Once a compspec has been found, it is used to generate the list of + matching words. If a compspec is not found, the default bbaasshh comple- tion as described above under CCoommpplleettiinngg is performed. - First, the actions specified by the compspec are used. Only matches - which are prefixed by the word being completed are returned. When the - --ff or --dd option is used for filename or directory name completion, the + First, the actions specified by the compspec are used. Only matches + which are prefixed by the word being completed are returned. When the + --ff or --dd option is used for filename or directory name completion, the shell variable FFIIGGNNOORREE is used to filter the matches. Any completions specified by a pathname expansion pattern to the --GG op- - tion are generated next. The words generated by the pattern need not - match the word being completed. The GGLLOOBBIIGGNNOORREE shell variable is not + tion are generated next. The words generated by the pattern need not + match the word being completed. The GGLLOOBBIIGGNNOORREE shell variable is not used to filter the matches, but the FFIIGGNNOORREE variable is used. - Next, the string specified as the argument to the --WW option is consid- - ered. The string is first split using the characters in the IIFFSS spe- - cial variable as delimiters. Shell quoting is honored. Each word is - then expanded using brace expansion, tilde expansion, parameter and - variable expansion, command substitution, and arithmetic expansion, as + Next, the string specified as the argument to the --WW option is consid- + ered. The string is first split using the characters in the IIFFSS spe- + cial variable as delimiters. Shell quoting is honored. Each word is + then expanded using brace expansion, tilde expansion, parameter and + variable expansion, command substitution, and arithmetic expansion, as described above under EEXXPPAANNSSIIOONN. The results are split using the rules described above under WWoorrdd SSpplliittttiinngg. The results of the expansion are prefix-matched against the word being completed, and the matching words become the possible completions. - After these matches have been generated, any shell function or command - specified with the --FF and --CC options is invoked. When the command or + After these matches have been generated, any shell function or command + specified with the --FF and --CC options is invoked. When the command or function is invoked, the CCOOMMPP__LLIINNEE, CCOOMMPP__PPOOIINNTT, CCOOMMPP__KKEEYY, and CCOOMMPP__TTYYPPEE variables are assigned values as described above under SShheellll VVaarriiaabblleess. - If a shell function is being invoked, the CCOOMMPP__WWOORRDDSS and CCOOMMPP__CCWWOORRDD - variables are also set. When the function or command is invoked, the - first argument ($$11) is the name of the command whose arguments are be- - ing completed, the second argument ($$22) is the word being completed, - and the third argument ($$33) is the word preceding the word being com- + If a shell function is being invoked, the CCOOMMPP__WWOORRDDSS and CCOOMMPP__CCWWOORRDD + variables are also set. When the function or command is invoked, the + first argument ($$11) is the name of the command whose arguments are be- + ing completed, the second argument ($$22) is the word being completed, + and the third argument ($$33) is the word preceding the word being com- pleted on the current command line. No filtering of the generated com- pletions against the word being completed is performed; the function or command has complete freedom in generating the matches. - Any function specified with --FF is invoked first. The function may use - any of the shell facilities, including the ccoommppggeenn builtin described - below, to generate the matches. It must put the possible completions - in the CCOOMMPPRREEPPLLYY array variable, one per array element. + Any function specified with --FF is invoked first. The function may use + any of the shell facilities, including the ccoommppggeenn and ccoommppoopptt builtins + described below, to generate the matches. It must put the possible + completions in the CCOOMMPPRREEPPLLYY array variable, one per array element. Next, any command specified with the --CC option is invoked in an envi- ronment equivalent to command substitution. It should print a list of completions, one per line, to the standard output. Backslash may be - used to escape a newline, if necessary. - - After all of the possible completions are generated, any filter speci- - fied with the --XX option is applied to the list. The filter is a pat- - tern as used for pathname expansion; a && in the pattern is replaced - with the text of the word being completed. A literal && may be escaped - with a backslash; the backslash is removed before attempting a match. - Any completion that matches the pattern will be removed from the list. + used to escape a newline, if necessary. These are added to the set of + possible completions. + + After all of the possible completions are generated, any filter speci- + fied with the --XX option is applied to the list. The filter is a pat- + tern as used for pathname expansion; a && in the pattern is replaced + with the text of the word being completed. A literal && may be escaped + with a backslash; the backslash is removed before attempting a match. + Any completion that matches the pattern will be removed from the list. A leading !! negates the pattern; in this case any completion not match- - ing the pattern will be removed. If the nnooccaasseemmaattcchh shell option is - enabled, the match is performed without regard to the case of alpha- + ing the pattern will be removed. If the nnooccaasseemmaattcchh shell option is + enabled, the match is performed without regard to the case of alpha- betic characters. Finally, any prefix and suffix specified with the --PP and --SS options are added to each member of the completion list, and the result is returned - to the readline completion code as the list of possible completions. + to rreeaaddlliinnee as the list of possible completions. - If the previously-applied actions do not generate any matches, and the - --oo ddiirrnnaammeess option was supplied to ccoommpplleettee when the compspec was de- + If the previously-applied actions do not generate any matches, and the + --oo ddiirrnnaammeess option was supplied to ccoommpplleettee when the compspec was de- fined, directory name completion is attempted. - If the --oo pplluussddiirrss option was supplied to ccoommpplleettee when the compspec + If the --oo pplluussddiirrss option was supplied to ccoommpplleettee when the compspec was defined, directory name completion is attempted and any matches are added to the results of the other actions. - By default, if a compspec is found, whatever it generates is returned - to the completion code as the full set of possible completions. The - default bbaasshh completions are not attempted, and the readline default of - filename completion is disabled. If the --oo bbaasshhddeeffaauulltt option was sup- - plied to ccoommpplleettee when the compspec was defined, the bbaasshh default com- - pletions are attempted if the compspec generates no matches. If the --oo - ddeeffaauulltt option was supplied to ccoommpplleettee when the compspec was defined, - readline's default completion will be performed if the compspec (and, - if attempted, the default bbaasshh completions) generate no matches. - - When a compspec indicates that directory name completion is desired, - the programmable completion functions force readline to append a slash - to completed names which are symbolic links to directories, subject to - the value of the mmaarrkk--ddiirreeccttoorriieess readline variable, regardless of the + By default, if a compspec is found, whatever it generates is returned + to the completion code as the full set of possible completions. The + default bbaasshh completions and the rreeaaddlliinnee default of filename comple- + tion are disabled. If the --oo bbaasshhddeeffaauulltt option was supplied to ccoomm-- + pplleettee when the compspec was defined, if the compspec generates no + matches, the bbaasshh default completions are attempted. If the --oo ddeeffaauulltt + option was supplied to ccoommpplleettee when the compspec was defined, read- + line's default completion will be performed if the compspec (and, if + attempted, the default bbaasshh completions) generate no matches. + + When a compspec indicates that directory name completion is desired, + the programmable completion functions force readline to append a slash + to completed names which are symbolic links to directories, subject to + the value of the mmaarrkk--ddiirreeccttoorriieess readline variable, regardless of the setting of the mmaarrkk--ssyymmlliinnkkeedd--ddiirreeccttoorriieess readline variable. - There is some support for dynamically modifying completions. This is - most useful when used in combination with a default completion speci- - fied with ccoommpplleettee --DD. It's possible for shell functions executed as - completion handlers to indicate that completion should be retried by - returning an exit status of 124. If a shell function returns 124, and + There is some support for dynamically modifying completions. This is + most useful when used in combination with a default completion speci- + fied with ccoommpplleettee --DD. It's possible for shell functions executed as + completion handlers to indicate that completion should be retried by + returning an exit status of 124. If a shell function returns 124, and changes the compspec associated with the command on which completion is - being attempted (supplied as the first argument when the function is + being attempted (supplied as the first argument when the function is executed), programmable completion restarts from the beginning, with an - attempt to find a new compspec for that command. This allows a set of - completions to be built dynamically as completion is attempted, rather + attempt to find a new compspec for that command. This allows a set of + completions to be built dynamically as completion is attempted, rather than being loaded all at once. - For instance, assuming that there is a library of compspecs, each kept - in a file corresponding to the name of the command, the following de- + For instance, assuming that there is a library of compspecs, each kept + in a file corresponding to the name of the command, the following de- fault completion function would load completions dynamically: _completion_loader() { @@ -4429,119 +4585,128 @@ RREEAADDLLIINNEE -o bashdefault -o default HHIISSTTOORRYY - When the --oo hhiissttoorryy option to the sseett builtin is enabled, the shell + When the --oo hhiissttoorryy option to the sseett builtin is enabled, the shell provides access to the _c_o_m_m_a_n_d _h_i_s_t_o_r_y, the list of commands previously - typed. The value of the HHIISSTTSSIIZZEE variable is used as the number of + typed. The value of the HHIISSTTSSIIZZEE variable is used as the number of commands to save in a history list. The text of the last HHIISSTTSSIIZZEE com- - mands (default 500) is saved. The shell stores each command in the - history list prior to parameter and variable expansion (see EEXXPPAANNSSIIOONN - above) but after history expansion is performed, subject to the values + mands (default 500) is saved. The shell stores each command in the + history list prior to parameter and variable expansion (see EEXXPPAANNSSIIOONN + above) but after history expansion is performed, subject to the values of the shell variables HHIISSTTIIGGNNOORREE and HHIISSTTCCOONNTTRROOLL. - On startup, the history is initialized from the file named by the vari- - able HHIISSTTFFIILLEE (default _~_/_._b_a_s_h___h_i_s_t_o_r_y). The file named by the value - of HHIISSTTFFIILLEE is truncated, if necessary, to contain no more than the - number of lines specified by the value of HHIISSTTFFIILLEESSIIZZEE. If HHIISSTTFFIILLEE-- - SSIIZZEE is unset, or set to null, a non-numeric value, or a numeric value - less than zero, the history file is not truncated. When the history - file is read, lines beginning with the history comment character fol- - lowed immediately by a digit are interpreted as timestamps for the fol- - lowing history line. These timestamps are optionally displayed depend- - ing on the value of the HHIISSTTTTIIMMEEFFOORRMMAATT variable. When a shell with - history enabled exits, the last $$HHIISSTTSSIIZZEE lines are copied from the - history list to $$HHIISSTTFFIILLEE. If the hhiissttaappppeenndd shell option is enabled - (see the description of sshhoopptt under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below), the - lines are appended to the history file, otherwise the history file is - overwritten. If HHIISSTTFFIILLEE is unset or null, or if the history file is - unwritable, the history is not saved. If the HHIISSTTTTIIMMEEFFOORRMMAATT variable - is set, time stamps are written to the history file, marked with the - history comment character, so they may be preserved across shell ses- - sions. This uses the history comment character to distinguish time- - stamps from other history lines. After saving the history, the history - file is truncated to contain no more than HHIISSTTFFIILLEESSIIZZEE lines. If HHIISSTT-- - FFIILLEESSIIZZEE is unset, or set to null, a non-numeric value, or a numeric - value less than zero, the history file is not truncated. - - The builtin command ffcc (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) may be used - to list or edit and re-execute a portion of the history list. The hhiiss-- - ttoorryy builtin may be used to display or modify the history list and ma- - nipulate the history file. When using command-line editing, search - commands are available in each editing mode that provide access to the - history list. - - The shell allows control over which commands are saved on the history - list. The HHIISSTTCCOONNTTRROOLL and HHIISSTTIIGGNNOORREE variables are used to cause the - shell to save only a subset of the commands entered. The ccmmddhhiisstt shell - option, if enabled, causes the shell to attempt to save each line of a - multi-line command in the same history entry, adding semicolons where - necessary to preserve syntactic correctness. The lliitthhiisstt shell option - causes the shell to save the command with embedded newlines instead of - semicolons. See the description of the sshhoopptt builtin below under SSHHEELLLL - BBUUIILLTTIINN CCOOMMMMAANNDDSS for information on setting and unsetting shell op- - tions. + On startup, bbaasshh initializes the history list by reading history en- + tries from the the file named by the HHIISSTTFFIILLEE variable (default + _~_/_._b_a_s_h___h_i_s_t_o_r_y). That file is referred to as the _h_i_s_t_o_r_y _f_i_l_e. The + history file is truncated, if necessary, to contain no more than the + number of history entries specified by the value of HHIISSTTFFIILLEESSIIZZEE. If + HHIISSTTFFIILLEESSIIZZEE is unset, or set to null, a non-numeric value, or a nu- + meric value less than zero, the history file is not truncated. + + When the history file is read, lines beginning with the history comment + character followed immediately by a digit are interpreted as timestamps + for the following history line. These timestamps are optionally dis- + played depending on the value of the HHIISSTTTTIIMMEEFFOORRMMAATT variable. When + present, history timestamps delimit history entries, making multi-line + entries possible. + + When a shell with history enabled exits, bbaasshh copies the last $$HHIISSTTSSIIZZEE + entries from the history list to $$HHIISSTTFFIILLEE. If the hhiissttaappppeenndd shell + option is enabled (see the description of sshhoopptt under SSHHEELLLL BBUUIILLTTIINN + CCOOMMMMAANNDDSS below), bbaasshh appends the entries to the history file, other- + wise the history file is overwritten. If HHIISSTTFFIILLEE is unset or null, or + if the history file is unwritable, the history is not saved. If the + HHIISSTTTTIIMMEEFFOORRMMAATT variable is set, time stamps are written to the history + file, marked with the history comment character, so they may be pre- + served across shell sessions. This uses the history comment character + to distinguish timestamps from other history lines. As above, when us- + ing HHIISSTTTTIIMMEEFFOORRMMAATT, the timestamps delimit multi-line history entries. + After saving the history, bbaasshh truncates the history file to contain no + more than HHIISSTTFFIILLEESSIIZZEE lines. If HHIISSTTFFIILLEESSIIZZEE is unset, or set to + null, a non-numeric value, or a numeric value less than zero, the his- + tory file is not truncated. + + The ffcc builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) will list or + edit and re-execute a portion of the history list. The hhiissttoorryy builtin + can display or modify the history list and manipulate the history file. + When using command-line editing, search commands are available in each + editing mode that provide access to the history list. + + The shell allows control over which commands are saved on the history + list. The HHIISSTTCCOONNTTRROOLL and HHIISSTTIIGGNNOORREE variables are used to save only a + subset of the commands entered. The ccmmddhhiisstt shell option, if enabled, + causes the shell to attempt to save each line of a multi-line command + in the same history entry, adding semicolons where necessary to pre- + serve syntactic correctness. The lliitthhiisstt shell option modifies ccmmddhhiisstt + by saving the command with embedded newlines instead of semicolons. + See the description of the sshhoopptt builtin below under SSHHEELLLL BBUUIILLTTIINN CCOOMM-- + MMAANNDDSS for information on setting and unsetting shell options. HHIISSTTOORRYY EEXXPPAANNSSIIOONN - The shell supports a history expansion feature that is similar to the - history expansion in ccsshh. This section describes what syntax features - are available. This feature is enabled by default for interactive - shells, and can be disabled using the ++HH option to the sseett builtin com- - mand (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). Non-interactive shells do not - perform history expansion by default. + The shell supports a history expansion feature that is similar to the + history expansion in ccsshh. This section describes what syntax features + are available. + + History expansion is enabled by default for interactive shells, and can + be disabled using the ++HH option to the sseett builtin command (see SSHHEELLLL + BBUUIILLTTIINN CCOOMMMMAANNDDSS below). Non-interactive shells do not perform history + expansion by default, but it can be enabled with "set -H". History expansions introduce words from the history list into the input - stream, making it easy to repeat commands, insert the arguments to a + stream, making it easy to repeat commands, insert the arguments to a previous command into the current input line, or fix errors in previous commands quickly. - History expansion is performed immediately after a complete line is - read, before the shell breaks it into words, and is performed on each - line individually without taking quoting on previous lines into ac- - count. It takes place in two parts. The first is to determine which - line from the history list to use during substitution. The second is - to select portions of that line for inclusion into the current one. - The line selected from the history is the _e_v_e_n_t, and the portions of - that line that are acted upon are _w_o_r_d_s. The line is broken into words - in the same fashion as when reading input, so that several _m_e_t_a_c_h_a_r_a_c_- - _t_e_r-separated words surrounded by quotes are considered one word. The - _e_v_e_n_t _d_e_s_i_g_n_a_t_o_r selects the event, the optional _w_o_r_d _d_e_s_i_g_n_a_t_o_r se- - lects words from the event, and various optional _m_o_d_i_f_i_e_r_s are avail- - able to manipulate the selected words. - - History expansions are introduced by the appearance of the history ex- - pansion character, which is !! by default. History expansions may ap- + History expansion is performed immediately after a complete line is + read, before the shell breaks it into words, and is performed on each + line individually. The shell attempts to inform the history expansion + functions about quoting still in effect from previous lines. + + It takes place in two parts. The first is to determine which history + list entry to use during substitution. The second is to select por- + tions of that entry to include into the current one. The entry se- + lected from the history is the _e_v_e_n_t, and the portions of that entry + that are acted upon are _w_o_r_d_s. The entry is split into words in the + same fashion as when reading input, so that several _m_e_t_a_c_h_a_r_a_c_t_e_r-sepa- + rated words surrounded by quotes are considered one word. The _e_v_e_n_t + _d_e_s_i_g_n_a_t_o_r selects the event, the optional _w_o_r_d _d_e_s_i_g_n_a_t_o_r selects + words from the event, and various optional _m_o_d_i_f_i_e_r_s are available to + manipulate the selected words. + + History expansions are introduced by the appearance of the history ex- + pansion character, which is !! by default. History expansions may ap- pear anywhere in the input, but do not nest. - Only backslash (\\) and single quotes can quote the history expansion - character, but the history expansion character is also treated as + Only backslash (\\) and single quotes can quote the history expansion + character, but the history expansion character is also treated as quoted if it immediately precedes the closing double quote in a double- quoted string. - Several characters inhibit history expansion if found immediately fol- - lowing the history expansion character, even if it is unquoted: space, - tab, newline, carriage return, ==, and the other shell metacharacters + Several characters inhibit history expansion if found immediately fol- + lowing the history expansion character, even if it is unquoted: space, + tab, newline, carriage return, ==, and the other shell metacharacters defined above. There is a special abbreviation for substitution, active when the _q_u_i_c_k - _s_u_b_s_t_i_t_u_t_i_o_n character (described above under hhiissttcchhaarrss) is the first + _s_u_b_s_t_i_t_u_t_i_o_n character (described above under hhiissttcchhaarrss) is the first character on the line. It selects the previous history entry, using an - event designator equivalent to !!!!, and substitutes one string for an- - other in that line. It is described below under EEvveenntt DDeessiiggnnaattoorrss. + event designator equivalent to !!!!, and substitutes one string for an- + other in that entry. It is described below under EEvveenntt DDeessiiggnnaattoorrss. This is the only history expansion that does not begin with the history expansion character. - Several shell options settable with the sshhoopptt builtin may be used to - tailor the behavior of history expansion. If the hhiissttvveerriiffyy shell op- - tion is enabled (see the description of the sshhoopptt builtin below), and - rreeaaddlliinnee is being used, history substitutions are not immediately - passed to the shell parser. Instead, the expanded line is reloaded - into the rreeaaddlliinnee editing buffer for further modification. If rreeaaddlliinnee - is being used, and the hhiissttrreeeeddiitt shell option is enabled, a failed - history substitution will be reloaded into the rreeaaddlliinnee editing buffer - for correction. The --pp option to the hhiissttoorryy builtin command may be - used to see what a history expansion will do before using it. The --ss - option to the hhiissttoorryy builtin may be used to add commands to the end of - the history list without actually executing them, so that they are - available for subsequent recall. + Several shell options settable with the sshhoopptt builtin will modify his- + tory expansion behavior (see the description of the sshhoopptt builtin be- + low).and If the hhiissttvveerriiffyy shell option is enabled, and rreeaaddlliinnee is be- + ing used, history substitutions are not immediately passed to the shell + parser. Instead, the expanded line is reloaded into the rreeaaddlliinnee edit- + ing buffer for further modification. If rreeaaddlliinnee is being used, and + the hhiissttrreeeeddiitt shell option is enabled, a failed history substitution + is reloaded into the rreeaaddlliinnee editing buffer for correction. + + The --pp option to the hhiissttoorryy builtin command shows what a history ex- + pansion will do before using it. The --ss option to the hhiissttoorryy builtin + will add commands to the end of the history list without actually exe- + cuting them, so that they are available for subsequent recall. The shell allows control of the various characters used by the history expansion mechanism (see the description of hhiissttcchhaarrss above under SShheellll @@ -4549,68 +4714,69 @@ HHIISSTTOORRYY EEXXPPAANNSSIIOONN tory timestamps when writing the history file. EEvveenntt DDeessiiggnnaattoorrss - An event designator is a reference to a command line entry in the his- - tory list. The event designator consists of the portion of the word - beginning with the history expansion character and ending with the word - designator if present, or the end of the word. Unless the reference is - absolute, events are relative to the current position in the history - list. + An event designator is a reference to an entry in the history list. + The event designator consists of the portion of the word beginning with + the history expansion character and ending with the word designator if + present, or the end of the word. Unless the reference is absolute, + events are relative to the current position in the history list. !! Start a history substitution, except when followed by a bbllaannkk, - newline, carriage return, = or ( (when the eexxttgglloobb shell option - is enabled using the sshhoopptt builtin). - !!_n Refer to command line _n. - !!--_n Refer to the current command minus _n. + newline, carriage return, = or, when the eexxttgglloobb shell option is + enabled using the sshhoopptt builtin, (. + !!_n Refer to history list entry _n. + !!--_n Refer to the current entry minus _n. !!!! Refer to the previous command. This is a synonym for "!-1". !!_s_t_r_i_n_g - Refer to the most recent command preceding the current position + Refer to the most recent command preceding the current position in the history list starting with _s_t_r_i_n_g. !!??_s_t_r_i_n_g[[??]] - Refer to the most recent command preceding the current position - in the history list containing _s_t_r_i_n_g. The trailing ?? may be - omitted if _s_t_r_i_n_g is followed immediately by a newline. If - _s_t_r_i_n_g is missing, the string from the most recent search is - used; it is an error if there is no previous search string. + Refer to the most recent command preceding the current position + in the history list containing _s_t_r_i_n_g. The trailing ?? may be + omitted if _s_t_r_i_n_g is followed immediately by a newline. If + _s_t_r_i_n_g is missing, this uses the string from the most recent + search; it is an error if there is no previous search string. ^^_s_t_r_i_n_g_1^^_s_t_r_i_n_g_2^^ - Quick substitution. Repeat the previous command, replacing - _s_t_r_i_n_g_1 with _s_t_r_i_n_g_2. Equivalent to "!!:s^_s_t_r_i_n_g_1^_s_t_r_i_n_g_2^" + Quick substitution. Repeat the previous command, replacing + _s_t_r_i_n_g_1 with _s_t_r_i_n_g_2. Equivalent to "!!:s^_s_t_r_i_n_g_1^_s_t_r_i_n_g_2^" (see MMooddiiffiieerrss below). !!## The entire command line typed so far. WWoorrdd DDeessiiggnnaattoorrss - Word designators are used to select desired words from the 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 sepa- - rated by single spaces. + Word designators are used to select desired words from the event. They + are optional; if the word designator isn't supplied, the history expan- + sion 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 in- + serted into the current line separated by single spaces. 00 ((zzeerroo)) The zeroth word. For the shell, this is the command word. _n The _nth word. - ^^ The first argument. That is, word 1. - $$ The last word. This is usually the last argument, but will ex- + ^^ The first argument: word 1. + $$ The last word. This is usually the last argument, but will ex- pand to the zeroth word if there is only one word in the line. - %% The first word matched by the most recent "?_s_t_r_i_n_g?'" search, - if the search string begins with a character that is part of a - word. By default, searches begin at the end of each line and - proceed to the beginning, so the first word matched is the one + %% The first word matched by the most recent "?_s_t_r_i_n_g?'" search, + if the search string begins with a character that is part of a + word. By default, searches begin at the end of each line and + proceed to the beginning, so the first word matched is the one closest to the end of the line. _x--_y A range of words; "-_y" abbreviates "0-_y". - ** All of the words but the zeroth. This is a synonym for "_1_-_$". - It is not an error to use ** if there is just one word in the - event; the empty string is returned in that case. + ** All of the words but the zeroth. This is a synonym for "_1_-_$". + It is not an error to use ** if there is just one word in the + event; it expands to the empty string in this case. xx** Abbreviates _x_-_$. xx-- Abbreviates _x_-_$ like xx**, but omits the last word. If xx is miss- ing, it defaults to 0. - If a word designator is supplied without an event specification, the - previous command is used as the event. + If a word designator is supplied without an event specification, the + previous command is used as the event, equivalent to !!!!. MMooddiiffiieerrss - After the optional word designator, there may appear a sequence of one - or more of the following modifiers, each preceded by a ":". These mod- - ify, or edit, the word or words selected from the history event. + After the optional word designator, the expansion may include a se- + quence of one or more of the following modifiers, each preceded by a + ":". These modify, or edit, the word or words selected from the his- + tory event. hh Remove a trailing filename component, leaving only the head. tt Remove all leading filename components, leaving the tail. @@ -4618,19 +4784,19 @@ HHIISSTTOORRYY EEXXPPAANNSSIIOONN ee Remove all but the trailing suffix. pp Print the new command but do not execute it. qq Quote the substituted words, escaping further substitutions. - xx Quote the substituted words as with qq, but break into words at - bbllaannkkss and newlines. The qq and xx modifiers are mutually exclu- - sive; the last one supplied is used. + xx Quote the substituted words as with qq, but break into words at + bbllaannkkss and newlines. The qq and xx modifiers are mutually exclu- + sive; expansion uses the last one supplied. ss//_o_l_d//_n_e_w// - Substitute _n_e_w for the first occurrence of _o_l_d in the event + Substitute _n_e_w for the first occurrence of _o_l_d in the event line. Any character may be used as the delimiter in place of /. - The final delimiter is optional if it is the last character of - the event line. The delimiter may be quoted in _o_l_d and _n_e_w with - a single backslash. If & appears in _n_e_w, it is replaced by _o_l_d. - A single backslash will quote the &. If _o_l_d is null, it is set - to the last _o_l_d substituted, or, if no previous history substi- - tutions took place, the last _s_t_r_i_n_g in a !!??_s_t_r_i_n_g[[??]] search. - If _n_e_w is null, each matching _o_l_d is deleted. + The final delimiter is optional if it is the last character of + the event line. A single backslash will quote the delimiter in + _o_l_d and _n_e_w. If & appears in _n_e_w, it is replaced with _o_l_d. A + single backslash will quote the &. If _o_l_d is null, it is set to + the last _o_l_d substituted, or, if no previous history substitu- + tions took place, the last _s_t_r_i_n_g in a !!??_s_t_r_i_n_g[[??]] search. If + _n_e_w is null, each matching _o_l_d is deleted. && Repeat the previous substitution. gg Cause changes to be applied over the entire event line. This is used in conjunction with "::ss" (e.g., "::ggss//_o_l_d//_n_e_w//") or "::&&". @@ -4660,37 +4826,41 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS ssoouurrccee [--pp _p_a_t_h] _f_i_l_e_n_a_m_e [_a_r_g_u_m_e_n_t_s] The .. command (ssoouurrccee) reads and execute commands from _f_i_l_e_n_a_m_e in the current shell environment and returns the exit status of - the last command executed from _f_i_l_e_n_a_m_e. If _f_i_l_e_n_a_m_e does not - contain a slash, .. searchs for it. If the --pp option is sup- - plied, .. treats _p_a_t_h as a colon-separated list of directories - in which to find _f_i_l_e_n_a_m_e; otherwise, .. uses the entries in - PPAATTHH to find the directory containing _f_i_l_e_n_a_m_e. _f_i_l_e_n_a_m_e does - not need to be executable. When bbaasshh is not in _p_o_s_i_x _m_o_d_e, it - searches the current directory if no file is found in PPAATTHH, but - does not search the current directory if --pp is supplied. If the - ssoouurrcceeppaatthh option to the sshhoopptt builtin command is turned off, .. - does not search PPAATTHH. If any _a_r_g_u_m_e_n_t_s are supplied, they be- - come the positional parameters when _f_i_l_e_n_a_m_e is executed. Oth- - erwise the positional parameters are unchanged. If the --TT op- - tion is enabled, .. inherits any trap on DDEEBBUUGG; if it is not, any - DDEEBBUUGG trap string is saved and restored around the call to .., - and .. unsets the DDEEBBUUGG trap while it executes. If --TT is not - set, and the sourced file changes the DDEEBBUUGG trap, the new value - is retained when .. completes. The return status is the status - of the last command exited within the script (0 if no commands - are executed), and false if _f_i_l_e_n_a_m_e is not found or cannot be - read. + the last command executed from _f_i_l_e_n_a_m_e. + + If _f_i_l_e_n_a_m_e does not contain a slash, .. searchs for it. If the + --pp option is supplied, .. treats _p_a_t_h as a colon-separated list + of directories in which to find _f_i_l_e_n_a_m_e; otherwise, .. uses the + entries in PPAATTHH to find the directory containing _f_i_l_e_n_a_m_e. + _f_i_l_e_n_a_m_e does not need to be executable. When bbaasshh is not in + _p_o_s_i_x _m_o_d_e, it searches the current directory if _f_i_l_e_n_a_m_e is not + found in PPAATTHH, but does not search the current directory if --pp + is supplied. If the ssoouurrcceeppaatthh option to the sshhoopptt builtin com- + mand is turned off, .. does not search PPAATTHH. + + If any _a_r_g_u_m_e_n_t_s are supplied, they become the positional para- + meters when _f_i_l_e_n_a_m_e is executed. Otherwise the positional pa- + rameters are unchanged. + + If the --TT option is enabled, .. inherits any trap on DDEEBBUUGG; if it + is not, any DDEEBBUUGG trap string is saved and restored around the + call to .., and .. unsets the DDEEBBUUGG trap while it executes. If --TT + is not set, and the sourced file changes the DDEEBBUUGG trap, the new + value persists after .. completes. The return status is the sta- + tus of the last command executed from _f_i_l_e_n_a_m_e (0 if no commands + are executed), and non-zero if _f_i_l_e_n_a_m_e is not found or cannot + be read. aalliiaass [--pp] [_n_a_m_e[=_v_a_l_u_e] ...] - AAlliiaass with no arguments or with the --pp option prints the list of - aliases in the form aalliiaass _n_a_m_e=_v_a_l_u_e on standard output. When - arguments are supplied, an alias is defined for each _n_a_m_e whose - _v_a_l_u_e is given. A trailing space in _v_a_l_u_e causes the next word - to be checked for alias substitution when the alias is expanded. - For each _n_a_m_e in the argument list for which no _v_a_l_u_e is sup- - plied, the name and value of the alias is printed. AAlliiaass re- - turns true unless a _n_a_m_e is given for which no alias has been - defined. + With no arguments or with the --pp option,aalliiaass prints the list of + aliases in the form aalliiaass _n_a_m_e=_v_a_l_u_e on standard output. When + arguments are supplied, define an alias for each _n_a_m_e whose + _v_a_l_u_e is given. A trailing space in _v_a_l_u_e causes the next word + to be checked for alias substitution when the alias is expanded + during command parsing. For each _n_a_m_e in the argument list for + which no _v_a_l_u_e is supplied, print the name and value of the + alias _n_a_m_e. aalliiaass returns true unless a _n_a_m_e is given (without + a corresponding =_v_a_l_u_e) for which no alias has been defined. bbgg [_j_o_b_s_p_e_c ...] Resume each suspended job _j_o_b_s_p_e_c in the background, as if it @@ -4709,166 +4879,197 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS bbiinndd [--mm _k_e_y_m_a_p] _k_e_y_s_e_q:_r_e_a_d_l_i_n_e_-_c_o_m_m_a_n_d bbiinndd _r_e_a_d_l_i_n_e_-_c_o_m_m_a_n_d_-_l_i_n_e Display current rreeaaddlliinnee key and function bindings, bind a key - sequence to a rreeaaddlliinnee function or macro, or set a rreeaaddlliinnee - variable. Each non-option argument is a command as it would ap- - pear in a rreeaaddlliinnee initialization file such as _._i_n_p_u_t_r_c, but - each binding or command must be passed as a separate argument; - e.g., '"\C-x\C-r": re-read-init-file'. In the following de- - scriptions, output available to be re-read is formatted as com- - mands that would appear in a rreeaaddlliinnee initialization file or - that would be supplied as individual arguments to a bbiinndd com- - mand. Options, if supplied, have the following meanings: + sequence to a rreeaaddlliinnee function or macro or to a shell command, + or set a rreeaaddlliinnee variable. Each non-option argument is a key + binding or command as it would appear in a rreeaaddlliinnee initializa- + tion file such as _._i_n_p_u_t_r_c, but each binding or command must be + passed as a separate argument; e.g., '"\C-x\C-r": + re-read-init-file'. In the following descriptions, output + available to be re-read is formatted as commands that would ap- + pear in a rreeaaddlliinnee initialization file or that would be supplied + as individual arguments to a bbiinndd command. Options, if sup- + plied, have the following meanings: --mm _k_e_y_m_a_p Use _k_e_y_m_a_p as the keymap to be affected by the subsequent bindings. Acceptable _k_e_y_m_a_p names are _e_m_a_c_s_, _e_m_a_c_s_-_s_t_a_n_- - _d_a_r_d_, _e_m_a_c_s_-_m_e_t_a_, _e_m_a_c_s_-_c_t_l_x_, _v_i_, _v_i_-_m_o_v_e_, _v_i_-_c_o_m_m_a_n_d, - and _v_i_-_i_n_s_e_r_t. _v_i is equivalent to _v_i_-_c_o_m_m_a_n_d (_v_i_-_m_o_v_e - is also a synonym); _e_m_a_c_s is equivalent to _e_m_a_c_s_-_s_t_a_n_- + _d_a_r_d_, _e_m_a_c_s_-_m_e_t_a_, _e_m_a_c_s_-_c_t_l_x_, _v_i_, _v_i_-_m_o_v_e_, _v_i_-_c_o_m_m_a_n_d, + and _v_i_-_i_n_s_e_r_t. _v_i is equivalent to _v_i_-_c_o_m_m_a_n_d (_v_i_-_m_o_v_e + is also a synonym); _e_m_a_c_s is equivalent to _e_m_a_c_s_-_s_t_a_n_- _d_a_r_d. --ll List the names of all rreeaaddlliinnee functions. - --pp Display rreeaaddlliinnee function names and bindings in such a - way that they can be re-read. If arguments remain after - option processing, bbiinndd treats them as readline command - names and restricts output to those names. - --PP List current rreeaaddlliinnee function names and bindings. If + --pp Display rreeaaddlliinnee function names and bindings in such a + way that they can be used as an argument to a subsequent + bbiinndd command or in a rreeaaddlliinnee initialization file. If arguments remain after option processing, bbiinndd treats them as readline command names and restricts output to those names. - --ss Display rreeaaddlliinnee key sequences bound to macros and the - strings they output in such a way that they can be re- - read. - --SS Display rreeaaddlliinnee key sequences bound to macros and the + --PP List current rreeaaddlliinnee function names and bindings. If + arguments remain after option processing, bbiinndd treats + them as readline command names and restricts output to + those names. + --ss Display rreeaaddlliinnee key sequences bound to macros and the + strings they output in such a way that they can be used + as an argument to a subsequent bbiinndd command or in a rreeaadd-- + lliinnee initialization file. + --SS Display rreeaaddlliinnee key sequences bound to macros and the strings they output. - --vv Display rreeaaddlliinnee variable names and values in such a way - that they can be re-read. + --vv Display rreeaaddlliinnee variable names and values in such a way + that they can be used as an argument to a subsequent bbiinndd + command or in a rreeaaddlliinnee initialization file. --VV List current rreeaaddlliinnee variable names and values. --ff _f_i_l_e_n_a_m_e Read key bindings from _f_i_l_e_n_a_m_e. --qq _f_u_n_c_t_i_o_n - Query about which keys invoke the named _f_u_n_c_t_i_o_n. + Display key sequences that invoke the named rreeaaddlliinnee + _f_u_n_c_t_i_o_n. --uu _f_u_n_c_t_i_o_n - Unbind all keys bound to the named _f_u_n_c_t_i_o_n. + Unbind all key sequences bound to the named rreeaaddlliinnee + _f_u_n_c_t_i_o_n. --rr _k_e_y_s_e_q Remove any current binding for _k_e_y_s_e_q. --xx _k_e_y_s_e_q[[:: ]]_s_h_e_l_l_-_c_o_m_m_a_n_d Cause _s_h_e_l_l_-_c_o_m_m_a_n_d to be executed whenever _k_e_y_s_e_q is en- tered. The separator between _k_e_y_s_e_q and _s_h_e_l_l_-_c_o_m_m_a_n_d is - either whitespace or a colon optionally followed by - whitespace. If the separator is whitespace, _s_h_e_l_l_-_c_o_m_- - _m_a_n_d must be enclosed in double quotes and rreeaaddlliinnee ex- - pands any of its special backslash-escapes in _s_h_e_l_l_-_c_o_m_- - _m_a_n_d before saving it. If the separator is a colon, any - enclosing double quotes are optional, and rreeaaddlliinnee does - not expand the command string before saving it. Since - the entire key binding expression must be a single argu- - ment, it should be enclosed in quotes. When _s_h_e_l_l_-_c_o_m_- - _m_a_n_d is executed, the shell sets the RREEAADDLLIINNEE__LLIINNEE vari- - able to the contents of the rreeaaddlliinnee line buffer and the - RREEAADDLLIINNEE__PPOOIINNTT and RREEAADDLLIINNEE__MMAARRKK variables to the current - location of the insertion point and the saved insertion - point (the mark), respectively. The shell assigns any - numeric argument the user supplied to the RREEAADDLLIINNEE__AARRGGUU-- - MMEENNTT variable. If there was no argument, that variable - is not set. If the executed command changes the value of - any of RREEAADDLLIINNEE__LLIINNEE, RREEAADDLLIINNEE__PPOOIINNTT, or RREEAADDLLIINNEE__MMAARRKK, - those new values will be reflected in the editing state. - --XX List all key sequences bound to shell commands and the - associated commands in a format that can be reused as in- - put. - - The return value is 0 unless an unrecognized option is given or - an error occurred. + either whitespace or a colon optionally followed by + whitespace. If the separator is whitespace, _s_h_e_l_l_-_c_o_m_- + _m_a_n_d must be enclosed in double quotes and rreeaaddlliinnee ex- + pands any of its special backslash-escapes in _s_h_e_l_l_-_c_o_m_- + _m_a_n_d before saving it. If the separator is a colon, any + enclosing double quotes are optional, and rreeaaddlliinnee does + not expand the command string before saving it. Since + the entire key binding expression must be a single argu- + ment, it should be enclosed in single quotes. When + _s_h_e_l_l_-_c_o_m_m_a_n_d is executed, the shell sets the RREEAADD-- + LLIINNEE__LLIINNEE variable to the contents of the rreeaaddlliinnee line + buffer and the RREEAADDLLIINNEE__PPOOIINNTT and RREEAADDLLIINNEE__MMAARRKK variables + to the current location of the insertion point and the + saved insertion point (the mark), respectively. The + shell assigns any numeric argument the user supplied to + the RREEAADDLLIINNEE__AARRGGUUMMEENNTT variable. If there was no argu- + ment, that variable is not set. If the executed command + changes the value of any of RREEAADDLLIINNEE__LLIINNEE, RREEAADD-- + LLIINNEE__PPOOIINNTT, or RREEAADDLLIINNEE__MMAARRKK, those new values will be + reflected in the editing state. + --XX List all key sequences bound to shell commands and the + associated commands in a format that can be reused as an + argument to a subsequent @code{bind} command. + + The return value is 0 unless an unrecognized option is supplied + or an error occurred. bbrreeaakk [_n] Exit from within a ffoorr, wwhhiillee, uunnttiill, or sseelleecctt loop. If _n is - specified, break _n levels. _n must be >= 1. If _n is greater - than the number of enclosing loops, all enclosing loops are ex- - ited. The return value is 0 unless _n is not greater than or - equal to 1. + specified, bbrreeaakk exits _n enclosing loops. _n must be >= 1. If _n + is greater than the number of enclosing loops, all enclosing + loops are exited. The return value is 0 unless _n is not greater + than or equal to 1. bbuuiillttiinn _s_h_e_l_l_-_b_u_i_l_t_i_n [_a_r_g_u_m_e_n_t_s] - Execute the specified shell builtin, passing it _a_r_g_u_m_e_n_t_s, and - return its exit status. This is useful when defining a function - whose name is the same as a shell builtin, retaining the func- - tionality of the builtin within the function. The ccdd builtin is - commonly redefined this way. The return status is false if - _s_h_e_l_l_-_b_u_i_l_t_i_n is not a shell builtin command. + Execute the specified shell builtin _s_h_e_l_l_-_b_u_i_l_t_i_n, passing it + _a_r_g_u_m_e_n_t_s, and return its exit status. This is useful when + defining a function whose name is the same as a shell builtin, + retaining the functionality of the builtin within the function. + The ccdd builtin is commonly redefined this way. The return sta- + tus is false if _s_h_e_l_l_-_b_u_i_l_t_i_n is not a shell builtin command. ccaalllleerr [_e_x_p_r] Returns the context of any active subroutine call (a shell func- - tion or a script executed with the .. or ssoouurrccee builtins). With- - out _e_x_p_r, ccaalllleerr displays the line number and source filename of - the current subroutine call. If a non-negative integer is sup- - plied as _e_x_p_r, ccaalllleerr displays the line number, subroutine name, - and source file corresponding to that position in the current - execution call stack. This extra information may be used, for - example, to print a stack trace. The current frame is frame 0. - The return value is 0 unless the shell is not executing a sub- - routine call or _e_x_p_r does not correspond to a valid position in + tion or a script executed with the .. or ssoouurrccee builtins). + + Without _e_x_p_r, ccaalllleerr displays the line number and source file- + name of the current subroutine call. If a non-negative integer + is supplied as _e_x_p_r, ccaalllleerr displays the line number, subroutine + name, and source file corresponding to that position in the cur- + rent execution call stack. This extra information may be used, + for example, to print a stack trace. The current frame is frame + 0. + + The return value is 0 unless the shell is not executing a sub- + routine call or _e_x_p_r does not correspond to a valid position in the call stack. ccdd [--LL|[--PP [--ee]]] [-@] [_d_i_r] - Change the current directory to _d_i_r. if _d_i_r is not supplied, - the value of the HHOOMMEE shell variable is the default. The vari- - able CCDDPPAATTHH defines the search path for the directory containing - _d_i_r: the shell searches each directory name in CCDDPPAATTHH for _d_i_r. - Alternative directory names in CCDDPPAATTHH are separated by a colon - (:). A null directory name in CCDDPPAATTHH is the same as the current - directory, i.e., ".". If _d_i_r begins with a slash (/), then CCDD-- - PPAATTHH is not used. The --PP option causes ccdd to use the physical - directory structure by resolving symbolic links while traversing - _d_i_r and before processing instances of _._. in _d_i_r (see also the - --PP option to the sseett builtin command); the --LL option forces sym- - bolic links to be followed by resolving the link after process- - ing instances of _._. in _d_i_r. If _._. appears in _d_i_r, it is - processed by removing the immediately previous pathname compo- - nent from _d_i_r, back to a slash or the beginning of _d_i_r. If the - --ee option is supplied with --PP, and the current working directory - cannot be successfully determined after a successful directory - change, ccdd will return an unsuccessful status. On systems that - support it, the --@@ option presents the extended attributes asso- - ciated with a file as a directory. An argument of -- is con- - verted to $$OOLLDDPPWWDD before the directory change is attempted. If - a non-empty directory name from CCDDPPAATTHH is used, or if -- is the - first argument, and the directory change is successful, the ab- - solute pathname of the new working directory is written to the - standard output. If the directory change is successful, ccdd sets - the value of the PPWWDD environment variable to the new directory - name, and sets the OOLLDDPPWWDD environment variable to the value of - the current working directory before the change. The return - value is true if the directory was successfully changed; false - otherwise. + Change the current directory to _d_i_r. if _d_i_r is not supplied, + the value of the HHOOMMEE shell variable is used as _d_i_r. The vari- + able CCDDPPAATTHH exists, ccdd uses it as a search path: the shell + searches each directory name in CCDDPPAATTHH for _d_i_r. Alternative di- + rectory names in CCDDPPAATTHH are separated by a colon (:). A null + directory name in CCDDPPAATTHH is the same as the current directory, + i.e., ".". If _d_i_r begins with a slash (/), then CCDDPPAATTHH is not + used. + + The --PP option causes ccdd to use the physical directory structure + by resolving symbolic links while traversing _d_i_r and before pro- + cessing instances of _._. in _d_i_r (see also the --PP option to the + sseett builtin command). + + The --LL option forces symbolic links to be followed by resolving + the link after processing instances of _._. in _d_i_r. If _._. appears + in _d_i_r, it is processed by removing the immediately previous + pathname component from _d_i_r, back to a slash or the beginning of + _d_i_r. + + If the --ee option is supplied with --PP, and the current working + directory cannot be successfully determined after a successful + directory change, ccdd will return a non-zero status. + + On systems that support it, the --@@ option presents the extended + attributes associated with a file as a directory. + + An argument of -- is converted to $$OOLLDDPPWWDD before attempting the + directory change. + + If ccdd uses a non-empty directory name from CCDDPPAATTHH,, or if -- is + the first argument, and the directory change is successful, ccdd + writes the absolute pathname of the new working directory to the + standard output. + + If the directory change is successful, ccdd sets the value of the + PPWWDD environment variable to the new directory name, and sets the + OOLLDDPPWWDD environment variable to the value of the current working + directory before the change. + + The return value is true if the directory was successfully + changed; false otherwise. ccoommmmaanndd [--ppVVvv] _c_o_m_m_a_n_d [_a_r_g ...] - Run _c_o_m_m_a_n_d with _a_r_g_s suppressing the normal shell function - lookup. Only builtin commands or commands found in the PPAATTHH are - executed. If the --pp option is given, the search for _c_o_m_m_a_n_d is - performed using a default value for PPAATTHH that is guaranteed to - find all of the standard utilities. If either the --VV or --vv op- - tion is supplied, a description of _c_o_m_m_a_n_d is printed. The --vv - option causes a single word indicating the command or filename - used to invoke _c_o_m_m_a_n_d to be displayed; the --VV option produces a - more verbose description. If the --VV or --vv option is supplied, - the exit status is 0 if _c_o_m_m_a_n_d was found, and 1 if not. If - neither option is supplied and an error occurred or _c_o_m_m_a_n_d can- - not be found, the exit status is 127. Otherwise, the exit sta- - tus of the ccoommmmaanndd builtin is the exit status of _c_o_m_m_a_n_d. + The ccoommmmaanndd builtin runs _c_o_m_m_a_n_d with _a_r_g_s suppressing the nor- + mal shell function lookup for _c_o_m_m_a_n_d. Only builtin commands or + commands found in the PPAATTHH named _c_o_m_m_a_n_d are executed. If the + --pp option is supplied, the search for _c_o_m_m_a_n_d is performed using + a default value for PPAATTHH that is guaranteed to find all of the + standard utilities. + + If either the --VV or --vv option is supplied, ccoommmmaanndd prints a de- + scription of _c_o_m_m_a_n_d. The --vv option displays a single word in- + dicating the command or filename used to invoke _c_o_m_m_a_n_d; the --VV + option produces a more verbose description. + + If the --VV or --vv option is supplied, the exit status is zero if + _c_o_m_m_a_n_d was found, and non-zero if not. If neither option is + supplied and an error occurred or _c_o_m_m_a_n_d cannot be found, the + exit status is 127. Otherwise, the exit status of the ccoommmmaanndd + builtin is the exit status of _c_o_m_m_a_n_d. ccoommppggeenn [--VV _v_a_r_n_a_m_e] [_o_p_t_i_o_n] [_w_o_r_d] - Generate possible completion matches for _w_o_r_d according to the - _o_p_t_i_o_ns, which may be any option accepted by the ccoommpplleettee + Generate possible completion matches for _w_o_r_d according to the + _o_p_t_i_o_ns, which may be any option accepted by the ccoommpplleettee builtin with the exceptions of --pp, --rr, --DD, --EE, and --II, and write - the matches to the standard output. If the --VV option is sup- - plied, ccoommppggeenn stores the generated completions into the indexed - array variable _v_a_r_n_a_m_e instead of writing them to the standard - output. When using the --FF or --CC options, the various shell - variables set by the programmable completion facilities, while - available, will not have useful values. + the matches to the standard output. + + If the --VV option is supplied, ccoommppggeenn stores the generated com- + pletions into the indexed array variable _v_a_r_n_a_m_e instead of + writing them to the standard output. + + When using the --FF or --CC options, the various shell variables set + by the programmable completion facilities, while available, will + not have useful values. The matches will be generated in the same way as if the program- mable completion code had generated them directly from a comple- - tion specification with the same flags. If _w_o_r_d is specified, - only those completions matching _w_o_r_d will be displayed. + tion specification with the same flags. If _w_o_r_d is specified, + only those completions matching _w_o_r_d will be displayed or + stored. The return value is true unless an invalid option is supplied, or no matches were generated. @@ -4939,9 +5140,9 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS line. pplluussddiirrss After any matches defined by the compspec are - generated, directory name completion is at- - tempted and any matches are added to the results - of the other actions. + generated, attempt directory name completion and + add any matches to the results of the other ac- + tions. --AA _a_c_t_i_o_n The _a_c_t_i_o_n may be one of the following to generate a list of possible completions: @@ -4995,21 +5196,21 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS guments are being completed, the second argument ($$22) is the word being completed, and the third argument ($$33) is the word preceding the word being completed on the cur- - rent command line. When it finishes, the possible com- - pletions are retrieved from the value of the CCOOMMPPRREEPPLLYY - array variable. + rent command line. When _f_u_n_c_t_i_o_n finishes, the possible + completions are retrieved from the value of the CCOOMMPPRREE-- + PPLLYY array variable. --GG _g_l_o_b_p_a_t - The pathname expansion pattern _g_l_o_b_p_a_t is expanded to - generate the possible completions. + Expand the pathname expansion pattern _g_l_o_b_p_a_t to gener- + ate the possible completions. --PP _p_r_e_f_i_x - _p_r_e_f_i_x is added at the beginning of each possible com- - pletion after all other options have been applied. + Add _p_r_e_f_i_x to the beginning of each possible completion + after all other options have been applied. --SS _s_u_f_f_i_x - _s_u_f_f_i_x is appended to each possible completion after all + Append _s_u_f_f_i_x to each possible completion after all other options have been applied. --WW _w_o_r_d_l_i_s_t The _w_o_r_d_l_i_s_t is split using the characters in the IIFFSS - special variable as delimiters, and each resultant word + special variable as delimiters, and each resulting word is expanded. Shell quoting is honored within _w_o_r_d_l_i_s_t, in order to provide a mechanism for the words to contain shell metacharacters or characters in the value of IIFFSS. @@ -5032,8 +5233,8 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS ccoommppoopptt [--oo _o_p_t_i_o_n] [--DDEEII] [++oo _o_p_t_i_o_n] [_n_a_m_e] Modify completion options for each _n_a_m_e according to the _o_p_- _t_i_o_ns, or for the currently-executing completion if no _n_a_m_es are - supplied. If no _o_p_t_i_o_ns are given, display the completion op- - tions for each _n_a_m_e or the current completion. The possible + supplied. If no _o_p_t_i_o_ns are supplied, display the completion + options for each _n_a_m_e or the current completion. The possible values of _o_p_t_i_o_n are those valid for the ccoommpplleettee builtin de- scribed above. The --DD option indicates that other supplied op- tions should apply to the "default" command completion; that is, @@ -5046,138 +5247,161 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS mand delimiter such as ;; or ||, which is usually command name completion. + If multiple options are supplied, the --DD option takes precedence + over --EE, and both take precedence over --II. + The return value is true unless an invalid option is supplied, an attempt is made to modify the options for a _n_a_m_e for which no completion specification exists, or an output error occurs. ccoonnttiinnuuee [_n] - Resume the next iteration of the enclosing ffoorr, wwhhiillee, uunnttiill, or - sseelleecctt loop. If _n is specified, resume at the _nth enclosing - loop. _n must be >= 1. If _n is greater than the number of en- - closing loops, the shell resumes the last enclosing loop (the - "top-level" loop). The return value is 0 unless _n is not - greater than or equal to 1. + ccoonnttiinnuuee resumes the next iteration of the enclosing ffoorr, wwhhiillee, + uunnttiill, or sseelleecctt loop. If _n is specified, bbaasshh resumes the _nth + enclosing loop. _n must be >= 1. If _n is greater than the num- + ber of enclosing loops, the shell resumes the last enclosing + loop (the "top-level" loop). The return value is 0 unless _n is + not greater than or equal to 1. ddeeccllaarree [--aaAAffFFggiiIIllnnrrttuuxx] [--pp] [_n_a_m_e[=_v_a_l_u_e] ...] ttyyppeesseett [--aaAAffFFggiiIIllnnrrttuuxx] [--pp] [_n_a_m_e[=_v_a_l_u_e] ...] Declare variables and/or give them attributes. If no _n_a_m_es are - given then display the values of variables. The --pp option will - display the attributes and values of each _n_a_m_e. When --pp is used - with _n_a_m_e arguments, additional options, other than --ff and --FF, - are ignored. When --pp is supplied without _n_a_m_e arguments, it - will display the attributes and values of all variables having - the attributes specified by the additional options. If no other - options are supplied with --pp, ddeeccllaarree will display the attrib- - utes and values of all shell variables. The --ff option will re- - strict the display to shell functions. The --FF option inhibits - the display of function definitions; only the function name and - attributes are printed. If the eexxttddeebbuugg shell option is enabled - using sshhoopptt, the source file name and line number where each - _n_a_m_e is defined are displayed as well. The --FF option implies - --ff. The --gg option forces variables to be created or modified at - the global scope, even when ddeeccllaarree is executed in a shell func- - tion. It is ignored in all other cases. The --II option causes - local variables to inherit the attributes (except the _n_a_m_e_r_e_f - attribute) and value of any existing variable with the same _n_a_m_e - at a surrounding scope. If there is no existing variable, the - local variable is initially unset. The following options can be - used to restrict output to variables with the specified at- - tribute or to give variables attributes: - --aa Each _n_a_m_e is an indexed array variable (see AArrrraayyss + given then display the values of variables or functions. The --pp + option will display the attributes and values of each _n_a_m_e. + When --pp is used with _n_a_m_e arguments, additional options, other + than --ff and --FF, are ignored. + + When --pp is supplied without _n_a_m_e arguments, ddeeccllaarree will display + the attributes and values of all variables having the attributes + specified by the additional options. If no other options are + supplied with --pp, ddeeccllaarree will display the attributes and values + of all shell variables. The --ff option restricts the display to + shell functions. + + The --FF option inhibits the display of function definitions; only + the function name and attributes are printed. If the eexxttddeebbuugg + shell option is enabled using sshhoopptt, the source file name and + line number where each _n_a_m_e is defined are displayed as well. + The --FF option implies --ff. + + The --gg option forces variables to be created or modified at the + global scope, even when ddeeccllaarree is executed in a shell function. + It is ignored when ddeeccllaarree is not executed in a shell function. + + The --II option causes local variables to inherit the attributes + (except the _n_a_m_e_r_e_f attribute) and value of any existing vari- + able with the same _n_a_m_e at a surrounding scope. If there is no + existing variable, the local variable is initially unset. + + The following options can be used to restrict output to vari- + ables with the specified attribute or to give variables attrib- + utes: + --aa Each _n_a_m_e is an indexed array variable (see AArrrraayyss above). - --AA Each _n_a_m_e is an associative array variable (see AArrrraayyss + --AA Each _n_a_m_e is an associative array variable (see AArrrraayyss above). - --ff Use function names only. + --ff Each _n_a_m_e refers to a shell function. --ii The variable is treated as an integer; arithmetic evalua- - tion (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN above) is performed when + tion (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN above) is performed when the variable is assigned a value. - --ll When the variable is assigned a value, all upper-case - characters are converted to lower-case. The upper-case + --ll When the variable is assigned a value, all upper-case + characters are converted to lower-case. The upper-case attribute is disabled. - --nn Give each _n_a_m_e the _n_a_m_e_r_e_f attribute, making it a name - reference to another variable. That other variable is - defined by the value of _n_a_m_e. All references, assign- - ments, and attribute modifications to _n_a_m_e, except those - using or changing the --nn attribute itself, are performed - on the variable referenced by _n_a_m_e's value. The nameref + --nn Give each _n_a_m_e the _n_a_m_e_r_e_f attribute, making it a name + reference to another variable. That other variable is + defined by the value of _n_a_m_e. All references, assign- + ments, and attribute modifications to _n_a_m_e, except those + using or changing the --nn attribute itself, are performed + on the variable referenced by _n_a_m_e's value. The nameref attribute cannot be applied to array variables. --rr Make _n_a_m_es readonly. These names cannot then be assigned values by subsequent assignment statements or unset. --tt Give each _n_a_m_e the _t_r_a_c_e attribute. Traced functions in- - herit the DDEEBBUUGG and RREETTUURRNN traps from the calling shell. + herit the DDEEBBUUGG and RREETTUURRNN traps from the calling shell. The trace attribute has no special meaning for variables. - --uu When the variable is assigned a value, all lower-case - characters are converted to upper-case. The lower-case + --uu When the variable is assigned a value, all lower-case + characters are converted to upper-case. The lower-case attribute is disabled. - --xx Mark _n_a_m_es for export to subsequent commands via the en- - vironment. - - Using "+" instead of "-" turns off the attribute instead, with - the exceptions that ++aa and ++AA may not be used to destroy array - variables and ++rr will not remove the readonly attribute. When - used in a function, ddeeccllaarree and ttyyppeesseett make each _n_a_m_e local, as - with the llooccaall command, unless the --gg option is supplied. If a - variable name is followed by =_v_a_l_u_e, the value of the variable - is set to _v_a_l_u_e. When using --aa or --AA and the compound assign- - ment syntax to create array variables, additional attributes do - not take effect until subsequent assignments. The return value - is 0 unless an invalid option is encountered, an attempt is made - to define a function using "-f foo=bar". an attempt is made to - assign a value to a readonly variable, an attempt is made to as- - sign a value to an array variable without using the compound as- - signment syntax (see AArrrraayyss above), one of the _n_a_m_e_s is not a - valid shell variable name, an attempt is made to turn off read- - only status for a readonly variable, an attempt is made to turn - off array status for an array variable, or an attempt is made to - display a non-existent function with --ff. + --xx Mark each _n_a_m_e for export to subsequent commands via the + environment. + + Using "+" instead of "-" turns off the specified attribute in- + stead, with the exceptions that ++aa and ++AA may not be used to de- + stroy array variables and ++rr will not remove the readonly at- + tribute. + + When used in a function, ddeeccllaarree and ttyyppeesseett make each _n_a_m_e lo- + cal, as with the llooccaall command, unless the --gg option is sup- + plied. If a variable name is followed by =_v_a_l_u_e, the value of + the variable is set to _v_a_l_u_e. When using --aa or --AA and the com- + pound assignment syntax to create array variables, additional + attributes do not take effect until subsequent assignments. + + The return value is 0 unless an invalid option is encountered, + an attempt is made to define a function using "-f foo=bar". an + attempt is made to assign a value to a readonly variable, an at- + tempt is made to assign a value to an array variable without us- + ing the compound assignment syntax (see AArrrraayyss above), one of + the _n_a_m_e_s is not a valid shell variable name, an attempt is made + to turn off readonly status for a readonly variable, an attempt + is made to turn off array status for an array variable, or an + attempt is made to display a non-existent function with --ff. ddiirrss [[--ccllppvv]] [[++_n]] [[--_n]] - Without options, displays the list of currently remembered di- - rectories. The default display is on a single line with direc- - tory names separated by spaces. Directories are added to the - list with the ppuusshhdd command; the ppooppdd command removes entries - from the list. The current directory is always the first direc- - tory in the stack. - --cc Clears the directory stack by deleting all of the en- + Without options, display the list of currently remembered direc- + tories. The default display is on a single line with directory + names separated by spaces. Directories are added to the list + with the ppuusshhdd command; the ppooppdd command removes entries from + the list. The current directory is always the first directory + in the stack. + + Options, if supplied, have the following meanings: + --cc Clears the directory stack by deleting all of the en- tries. - --ll Produces a listing using full pathnames; the default + --ll Produces a listing using full pathnames; the default listing format uses a tilde to denote the home directory. --pp Print the directory stack with one entry per line. - --vv Print the directory stack with one entry per line, pre- + --vv Print the directory stack with one entry per line, pre- fixing each entry with its index in the stack. ++_n Displays the _nth entry counting from the left of the list shown by ddiirrss when invoked without options, starting with zero. - --_n Displays the _nth entry counting from the right of the + --_n Displays the _nth entry counting from the right of the list shown by ddiirrss when invoked without options, starting with zero. - The return value is 0 unless an invalid option is supplied or _n + The return value is 0 unless an invalid option is supplied or _n indexes beyond the end of the directory stack. - ddiissoowwnn [--aarr] [--hh] [_j_o_b_s_p_e_c ... | _p_i_d ... ] - Without options, remove each _j_o_b_s_p_e_c from the table of active - jobs. If _j_o_b_s_p_e_c is not present, and neither the --aa nor the --rr - option is supplied, the _c_u_r_r_e_n_t _j_o_b is used. If the --hh option - is given, each _j_o_b_s_p_e_c is not removed from the table, but is - marked so that SSIIGGHHUUPP is not sent to the job if the shell re- - ceives a SSIIGGHHUUPP. If no _j_o_b_s_p_e_c is supplied, the --aa option means - to remove or mark all jobs; the --rr option without a _j_o_b_s_p_e_c ar- - gument restricts operation to running jobs. The return value is - 0 unless a _j_o_b_s_p_e_c does not specify a valid job. + ddiissoowwnn [--aarr] [--hh] [_i_d ...] + Without options, remove each _i_d from the table of active jobs. + Each _i_d may be a job specification _j_o_b_s_p_e_c or a process ID _p_i_d; + if _i_d is a _p_i_d, ddiissoowwnn uses the job containing _p_i_d as _j_o_b_s_p_e_c. + If _i_d is not present, and neither the --aa nor the --rr option is + supplied, ddiissoowwnn removes the _c_u_r_r_e_n_t _j_o_b. If the --hh option is + supplied, the job corresponding to each _i_d is not removed from + the table, but is marked so that SSIIGGHHUUPP is not sent to the job + if the shell receives a SSIIGGHHUUPP. + + If no _i_d is supplied, the --aa option means to remove or mark all + jobs; the --rr option without an _i_d argument restricts operation + to running jobs. + + The return value is 0 unless an _i_d does not specify a valid job. eecchhoo [--nneeEE] [_a_r_g ...] Output the _a_r_gs, separated by spaces, followed by a newline. The return status is 0 unless a write error occurs. If --nn is - specified, the trailing newline is suppressed. If the --ee option - is given, interpretation of the following backslash-escaped - characters is enabled. The --EE option disables the interpreta- - tion of these escape characters, even on systems where they are - interpreted by default. The xxppgg__eecchhoo shell option may be used - to dynamically determine whether or not eecchhoo interprets any op- - tions and expands these escape characters by default. eecchhoo does - not interpret ---- to mean the end of options. eecchhoo interprets - the following escape sequences: + specified, the trailing newline is not printed. + + If the --ee option is given, eecchhoo interprets the following back- + slash-escaped characters. The --EE option disables interpretation + of these escape characters, even on systems where they are in- + terpreted by default. The xxppgg__eecchhoo shell option determines + whether or not eecchhoo interprets any options and expands these es- + cape characters. eecchhoo does not interpret ---- to mean the end of + options. + + eecchhoo interprets the following escape sequences: \\aa alert (bell) \\bb backspace \\cc suppress further output @@ -5199,75 +5423,95 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value _H_H_H_H_H_H_H_H (one to eight hex digits) + eecchhoo writes any unrecognized backslash-escaped characters un- + changed. + eennaabbllee [--aa] [--ddnnppss] [--ff _f_i_l_e_n_a_m_e] [_n_a_m_e ...] - Enable and disable builtin shell commands. Disabling a builtin - allows a disk command which has the same name as a shell builtin - to be executed without specifying a full pathname, even though - the shell normally searches for builtins before disk commands. - If --nn is used, each _n_a_m_e is disabled; otherwise, _n_a_m_e_s are en- - abled. For example, to use the tteesstt binary found via the PPAATTHH - instead of the shell builtin version, run "enable -n test". The - --ff option means to load the new builtin command _n_a_m_e from shared - object _f_i_l_e_n_a_m_e, on systems that support dynamic loading. BBaasshh - will use the value of the BBAASSHH__LLOOAADDAABBLLEESS__PPAATTHH variable as a - colon-separated list of directories in which to search for _f_i_l_e_- - _n_a_m_e, if _f_i_l_e_n_a_m_e does not contain a slash. The default is sys- - tem-dependent, and may include "." to force a search of the cur- - rent directory. The --dd option will delete a builtin previously - loaded with --ff. If no _n_a_m_e arguments are given, or if the --pp - option is supplied, a list of shell builtins is printed. With - no other option arguments, the list consists of all enabled - shell builtins. If --nn is supplied, only disabled builtins are - printed. If --aa is supplied, the list printed includes all - builtins, with an indication of whether or not each is enabled. - If --ss is supplied, the output is restricted to the POSIX _s_p_e_c_i_a_l - builtins. If no options are supplied and a _n_a_m_e is not a shell - builtin, eennaabbllee will attempt to load _n_a_m_e from a shared object - named _n_a_m_e, as if the command were "enable -f _n_a_m_e _n_a_m_e". The - return value is 0 unless a _n_a_m_e is not a shell builtin or there - is an error loading a new builtin from a shared object. + Enable and disable builtin shell commands. Disabling a builtin + allows an executable file which has the same name as a shell + builtin to be executed without specifying a full pathname, even + 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 + instead of the shell builtin version, run "enable -n test". + + If no _n_a_m_e arguments are supplied, or if the --pp option is sup- + plied, print a list of shell builtins. With no other option ar- + guments, the list consists of all enabled shell builtins. If --nn + is supplied, print only disabled builtins. If --aa is supplied, + the list printed includes all builtins, with an indication of + whether or not each is enabled. The --ss option means to restrict + the output to the POSIX _s_p_e_c_i_a_l builtins. + + The --ff option means to load the new builtin command _n_a_m_e from + shared object _f_i_l_e_n_a_m_e, on systems that support dynamic loading. + If _f_i_l_e_n_a_m_e does not contain a slash, BBaasshh will use the value of + the BBAASSHH__LLOOAADDAABBLLEESS__PPAATTHH variable as a colon-separated list of + directories in which to search for _f_i_l_e_n_a_m_e. The default for + BBAASSHH__LLOOAADDAABBLLEESS__PPAATTHH is system-dependent, and may include "." to + force a search of the current directory. The --dd option will + delete a builtin previously loaded with --ff. If _-_s is used with + _-_f, the new builtin becomes a POSIX special builtin. + + If no options are supplied and a _n_a_m_e is not a shell builtin, + eennaabbllee will attempt to load _n_a_m_e from a shared object named + _n_a_m_e, as if the command were "enable -f _n_a_m_e _n_a_m_e". + + The return value is 0 unless a _n_a_m_e is not a shell builtin or + there is an error loading a new builtin from a shared object. eevvaall [_a_r_g ...] - The _a_r_gs are read and concatenated together into a single com- - mand. This command is then read and executed by the shell, and - its exit status is returned as the value of eevvaall. If there are - no _a_r_g_s, or only null arguments, eevvaall returns 0. + Concatenate the _a_r_gs together into a single command, separating + them with spaces. BBaasshh then reads and execute this command, and + returns its exit status as the return status of eevvaall. If there + are no _a_r_g_s, or only null arguments, eevvaall returns 0. eexxeecc [--ccll] [--aa _n_a_m_e] [_c_o_m_m_a_n_d [_a_r_g_u_m_e_n_t_s]] - If _c_o_m_m_a_n_d is specified, it replaces the shell. No new process - is created. The _a_r_g_u_m_e_n_t_s become the arguments to _c_o_m_m_a_n_d. If - the --ll option is supplied, the shell places a dash at the begin- - ning of the zeroth argument passed to _c_o_m_m_a_n_d. This is what _l_o_- - _g_i_n(1) does. The --cc option causes _c_o_m_m_a_n_d to be executed with - an empty environment. If --aa is supplied, the shell passes _n_a_m_e - as the zeroth argument to the executed command. If _c_o_m_m_a_n_d can- - not be executed for some reason, a non-interactive shell exits, - unless the eexxeeccffaaiill shell option is enabled. In that case, it - returns failure. An interactive shell returns failure if the - file cannot be executed. A subshell exits unconditionally if - eexxeecc fails. If _c_o_m_m_a_n_d is not specified, any redirections take - effect in the current shell, and the return status is 0. If - there is a redirection error, the return status is 1. + If _c_o_m_m_a_n_d is specified, it replaces the shell without creating + a new process. _c_o_m_m_a_n_d cannot be a shell builtin or function. + The _a_r_g_u_m_e_n_t_s become the arguments to _c_o_m_m_a_n_d. If the --ll option + is supplied, the shell places a dash at the beginning of the ze- + roth argument passed to _c_o_m_m_a_n_d. This is what _l_o_g_i_n(1) does. + The --cc option causes _c_o_m_m_a_n_d to be executed with an empty envi- + ronment. If --aa is supplied, the shell passes _n_a_m_e as the zeroth + argument to the executed command. + + If _c_o_m_m_a_n_d cannot be executed for some reason, a non-interactive + shell exits, unless the eexxeeccffaaiill shell option is enabled. In + that case, it returns a non-zero status. An interactive shell + returns a non-zero status if the file cannot be executed. A + subshell exits unconditionally if eexxeecc fails. + + If _c_o_m_m_a_n_d is not specified, any redirections take effect in the + current shell, and the return status is 0. If there is a redi- + rection error, the return status is 1. eexxiitt [_n] - Cause the shell to exit with a status of _n. If _n is omitted, - the exit status is that of the last command executed. A trap on - EEXXIITT is executed before the shell terminates. + Cause the shell to exit with a status of _n. If _n is omitted, + the exit status is that of the last command executed. Any trap + on EEXXIITT is executed before the shell terminates. - eexxppoorrtt [--ffnn] [_n_a_m_e[=_w_o_r_d]] ... + eexxppoorrtt [--ffnn] [_n_a_m_e[=_v_a_l_u_e]] ... eexxppoorrtt --pp The supplied _n_a_m_e_s are marked for automatic export to the envi- ronment of subsequently executed commands. If the --ff option is - given, the _n_a_m_e_s refer to functions. If no _n_a_m_e_s are given, or - if the --pp option is supplied, a list of names of all exported - variables is printed. The --nn option causes the export property - to be removed from each _n_a_m_e. If a variable name is followed by - =_w_o_r_d, the value of the variable is set to _w_o_r_d. eexxppoorrtt returns - an exit status of 0 unless an invalid option is encountered, one - of the _n_a_m_e_s is not a valid shell variable name, or --ff is sup- - plied with a _n_a_m_e that is not a function. + given, the _n_a_m_e_s refer to functions. + + The --nn option unexports, or removes the export attribute, from + each _n_a_m_e. If no _n_a_m_e_s are given, or if the --pp option is sup- + plied, eexxppoorrtt prints a list of names of all exported variables + on the standard output. - ffaallssee Does nothing, returns a non-zero status. + eexxppoorrtt allows the value of a variable to be set when it is ex- + ported or unexported by following the variable name with =_v_a_l_u_e. + This sets the value of the variable to _v_a_l_u_e while modifying the + export attribute. eexxppoorrtt returns an exit status of 0 unless an + invalid option is encountered, one of the _n_a_m_e_s is not a valid + shell variable name, or --ff is supplied with a _n_a_m_e that is not a + function. + + ffaallssee Does nothing; returns a non-zero status. ffcc [--ee _e_n_a_m_e] [--llnnrr] [_f_i_r_s_t] [_l_a_s_t] ffcc --ss [_p_a_t=_r_e_p] [_c_m_d] @@ -5276,121 +5520,136 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS them. _F_i_r_s_t and _l_a_s_t may be specified as a string (to locate the last command beginning with that string) or as a number (an index into the history list, where a negative number is used as - an offset from the current command number). When listing, a - _f_i_r_s_t or _l_a_s_t of 0 is equivalent to -1 and -0 is equivalent to - the current command (usually the ffcc command); otherwise 0 is - equivalent to -1 and -0 is invalid. If _l_a_s_t is not specified, - it is set to the current command for listing (so that "fc -l - -10" prints the last 10 commands) and to _f_i_r_s_t otherwise. If - _f_i_r_s_t is not specified, it is set to the previous command for + an offset from the current command number). + + When listing, a _f_i_r_s_t or _l_a_s_t of 0 is equivalent to -1 and -0 is + equivalent to the current command (usually the ffcc command); oth- + erwise 0 is equivalent to -1 and -0 is invalid. If _l_a_s_t is not + specified, it is set to the current command for listing (so that + "fc -l -10" prints the last 10 commands) and to _f_i_r_s_t otherwise. + If _f_i_r_s_t is not specified, it is set to the previous command for editing and -16 for listing. - The --nn option suppresses the command numbers when listing. The - --rr option reverses the order of the commands. If the --ll option - is given, the commands are listed on standard output. Other- - wise, the editor given by _e_n_a_m_e is invoked on a file containing - those commands. If _e_n_a_m_e is not given, the value of the FFCCEEDDIITT - variable is used, and the value of EEDDIITTOORR if FFCCEEDDIITT is not set. - If neither variable is set, _v_i is used. When editing is com- - plete, the edited commands are echoed and executed. - - In the second form, _c_o_m_m_a_n_d is re-executed after each instance - of _p_a_t is replaced by _r_e_p. _C_o_m_m_a_n_d is interpreted the same as - _f_i_r_s_t above. A useful alias to use with this is "r="fc -s"", so - that typing "r cc" runs the last command beginning with "cc" and - typing "r" re-executes the last command. - - If the first form is used, the return value is 0 unless an in- - valid option is encountered or _f_i_r_s_t or _l_a_s_t specify history - lines out of range. If the --ee option is supplied, the return - value is the value of the last command executed or failure if an - error occurs with the temporary file of commands. If the second - form is used, the return status is that of the command re-exe- - cuted, unless _c_m_d does not specify a valid history line, in - which case ffcc returns failure. + If the --ll option is supplied, the commands are listed on the + standard output. The --nn option suppresses the command numbers + when listing. The --rr option reverses the order of the commands. + + Otherwise, ffcc invokes the editor named by _e_n_a_m_e on a file con- + taining those commands. If _e_n_a_m_e is not supplied, ffcc uses the + value of the FFCCEEDDIITT variable, and the value of EEDDIITTOORR if FFCCEEDDIITT + is not set. If neither variable is set, ffcc uses _v_i_. When edit- + ing is complete, ffcc reads the file containing the edited com- + mands and echoes and executes them. + + In the second form, ffcc re-executes _c_o_m_m_a_n_d after replacing each + instance of _p_a_t with _r_e_p. _C_o_m_m_a_n_d is interpreted the same as + _f_i_r_s_t above. + + A useful alias to use with ffcc is "r="fc -s"", so that typing "r + cc" runs the last command beginning with "cc" and typing "r" re- + executes the last command. + + If the first form is used, the return value is zero unless an + invalid option is encountered or _f_i_r_s_t or _l_a_s_t specify history + lines out of range. When editing and re-executing a file of + commands, the return value is the value of the last command exe- + cuted or failure if an error occurs with the temporary file. If + the second form is used, the return status is that of the re-ex- + ecuted command, unless _c_m_d does not specify a valid history en- + try, in which case ffcc returns a non-zero status. ffgg [_j_o_b_s_p_e_c] Resume _j_o_b_s_p_e_c in the foreground, and make it the current job. - If _j_o_b_s_p_e_c is not present, the shell's notion of the _c_u_r_r_e_n_t _j_o_b - is used. The return value is that of the command placed into - the foreground, or failure if run when job control is disabled - or, when run with job control enabled, if _j_o_b_s_p_e_c does not spec- - ify a valid job or _j_o_b_s_p_e_c specifies a job that was started - without job control. + If _j_o_b_s_p_e_c is not present, use the shell's notion of the _c_u_r_r_e_n_t + _j_o_b. The return value is that of the command placed into the + foreground, or failure if run when job control is disabled or, + when run with job control enabled, if _j_o_b_s_p_e_c does not specify a + valid job or _j_o_b_s_p_e_c specifies a job that was started without + job control. ggeettooppttss _o_p_t_s_t_r_i_n_g _n_a_m_e [_a_r_g ...] - ggeettooppttss is used by shell procedures to parse positional parame- - ters. _o_p_t_s_t_r_i_n_g contains the option characters to be recog- - nized; if a character is followed by a colon, the option is ex- - pected to have an argument, which should be separated from it by - white space. The colon and question mark characters may not be - used as option characters. Each time it is invoked, ggeettooppttss - places the next option in the shell variable _n_a_m_e, initializing - _n_a_m_e if it does not exist, and the index of the next argument to - be processed into the variable OOPPTTIINNDD. OOPPTTIINNDD is initialized to - 1 each time the shell or a shell script is invoked. When an op- - tion requires an argument, ggeettooppttss places that argument into the - variable OOPPTTAARRGG. The shell does not reset OOPPTTIINNDD automatically; - it must be manually reset between multiple calls to ggeettooppttss - within the same shell invocation if a new set of parameters is - to be used. - - When the end of options is encountered, ggeettooppttss exits with a re- - turn value greater than zero. OOPPTTIINNDD is set to the index of the + ggeettooppttss is used by shell scripts and functions to parse posi- + tional parameters and obtain options and their arguments. _o_p_t_- + _s_t_r_i_n_g contains the option characters to be recognized; if a + character is followed by a colon, the option is expected to have + an argument, which should be separated from it by white space. + The colon and question mark characters may not be used as option + characters. + + Each time it is invoked, ggeettooppttss places the next option in the + shell variable _n_a_m_e, initializing _n_a_m_e if it does not exist, and + the index of the next argument to be processed into the variable + OOPPTTIINNDD. OOPPTTIINNDD is initialized to 1 each time the shell or a + shell script is invoked. When an option requires an argument, + ggeettooppttss places that argument into the variable OOPPTTAARRGG. + + The shell does not reset OOPPTTIINNDD automatically; it must be manu- + ally reset between multiple calls to ggeettooppttss within the same + shell invocation to use a new set of parameters. + + When it reaches the end of options, ggeettooppttss exits with a return + value greater than zero. OOPPTTIINNDD is set to the index of the first non-option argument, and _n_a_m_e is set to ?. - ggeettooppttss normally parses the positional parameters, but if more - arguments are supplied as _a_r_g values, ggeettooppttss parses those in- + ggeettooppttss normally parses the positional parameters, but if more + arguments are supplied as _a_r_g values, ggeettooppttss parses those in- stead. - ggeettooppttss can report errors in two ways. If the first character - of _o_p_t_s_t_r_i_n_g is a colon, _s_i_l_e_n_t error reporting is used. In - normal operation, diagnostic messages are printed when invalid - options or missing option arguments are encountered. If the - variable OOPPTTEERRRR is set to 0, no error messages will be dis- + ggeettooppttss can report errors in two ways. If the first character + of _o_p_t_s_t_r_i_n_g is a colon, ggeettooppttss uses _s_i_l_e_n_t error reporting. + In normal operation, ggeettooppttss prints diagnostic messages when it + encounters invalid options or missing option arguments. If the + variable OOPPTTEERRRR is set to 0, no error messages will be dis- played, even if the first character of _o_p_t_s_t_r_i_n_g is not a colon. If ggeettooppttss detects an invalid option, it places ? into _n_a_m_e and, - if not silent, prints an error message and unsets OOPPTTAARRGG. If - ggeettooppttss is silent, it assigns the option character found to OOPP-- + if not silent, prints an error message and unsets OOPPTTAARRGG. If + ggeettooppttss is silent, it assigns the option character found to OOPP-- TTAARRGG and does not print a diagnostic message. - If a required argument is not found, and ggeettooppttss is not silent, + If a required argument is not found, and ggeettooppttss is not silent, it sets the value of _n_a_m_e to a question mark (??), unsets OOPPTTAARRGG, - and prints a diagnostic message. If ggeettooppttss is silent, it sets - the value of _n_a_m_e to a colon (::) and sets OOPPTTAARRGG to the option + and prints a diagnostic message. If ggeettooppttss is silent, it sets + the value of _n_a_m_e to a colon (::) and sets OOPPTTAARRGG to the option character found. - ggeettooppttss returns true if an option, specified or unspecified, is + ggeettooppttss returns true if an option, specified or unspecified, is found. It returns false if the end of options is encountered or an error occurs. hhaasshh [--llrr] [--pp _f_i_l_e_n_a_m_e] [--ddtt] [_n_a_m_e] - Each time hhaasshh is invoked, the full pathname of the command _n_a_m_e - is determined by searching the directories in $$PPAATTHH and remem- - bered. Any previously-remembered pathname is discarded. If the - --pp option is supplied, hhaasshh uses _f_i_l_e_n_a_m_e as the full filename - of the command. The --rr option causes the shell to forget all - remembered locations. Assigning to the PPAATTHH variable also - clears all hashed filenames. The --dd option causes the shell to - forget the remembered location of each _n_a_m_e. If the --tt option - is supplied, the full pathname to which each _n_a_m_e corresponds is - printed. If multiple _n_a_m_e arguments are supplied with --tt, the - _n_a_m_e is printed before the hashed full pathname. The --ll option - causes output to be displayed in a format that may be reused as - input. If no arguments are given, or if only --ll is supplied, - information about remembered commands is printed. The --tt, --dd, - and --pp options (the options that act on the _n_a_m_e arguments) are - mutually exclusive. Only one will be active. If more than one - is supplied, --tt has higher priority than --pp, and both are higher - priority than --dd. The return status is true unless a _n_a_m_e is - not found or an invalid option is supplied. + Each time hhaasshh is invoked, it remembers the full pathname of the + command _n_a_m_e as determined by searching the directories in + $$PPAATTHH. Any previously-remembered pathname associated with _n_a_m_e + is discarded. If the --pp option is supplied, hhaasshh uses _f_i_l_e_n_a_m_e + as the full pathname of the command. + + The --rr option causes the shell to forget all remembered loca- + tions. Assigning to the PPAATTHH variable also clears all hashed + filenames. The --dd option causes the shell to forget the remem- + bered location of each _n_a_m_e. + + If the --tt option is supplied, hhaasshh prints the full pathname cor- + responding to each _n_a_m_e. If multiple _n_a_m_e arguments are sup- + plied with --tt, hhaasshh prints the _n_a_m_e before the corresponding + hashed full pathname. The --ll option displays output in a format + that may be reused as input. + + If no arguments are given, or if only --ll is supplied, hhaasshh + prints information about remembered commands. The --tt, --dd, and + --pp options (the options that act on the _n_a_m_e arguments) are mu- + tually exclusive. Only one will be active. If more than one is + supplied, --tt has higher priority than --pp, and both have higher + priority than --dd. + + The return status is zero unless a _n_a_m_e is not found or an in- + valid option is supplied. hheellpp [--ddmmss] [_p_a_t_t_e_r_n] Display helpful information about builtin commands. If _p_a_t_t_e_r_n is specified, hheellpp gives detailed help on all commands matching - _p_a_t_t_e_r_n; otherwise help for all the builtins and shell control - structures is printed. + _p_a_t_t_e_r_n; otherwise it displays a list of all the builtins and + shell compound commands. --dd Display a short description of each _p_a_t_t_e_r_n --mm Display the description of each _p_a_t_t_e_r_n in a manpage-like format @@ -5405,172 +5664,187 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS hhiissttoorryy --aannrrww [_f_i_l_e_n_a_m_e] hhiissttoorryy --pp _a_r_g [_a_r_g ...] hhiissttoorryy --ss _a_r_g [_a_r_g ...] - With no options, display the command history list with line num- - bers. Lines listed with a ** have been modified. An argument of - _n lists only the last _n lines. If the shell variable HHIISSTTTTIIMMEE-- + With no options, display the command history list with numbers. + Entries prefixed with a ** have been modified. An argument of _n + lists only the last _n entries. If the shell variable HHIISSTTTTIIMMEE-- FFOORRMMAATT is set and not null, it is used as a format string for _s_t_r_f_t_i_m_e(3) to display the time stamp associated with each dis- - played history entry. No intervening blank is printed between - the formatted time stamp and the history line. If _f_i_l_e_n_a_m_e is - supplied, it is used as the name of the history file; if not, - the value of HHIISSTTFFIILLEE is used. If _f_i_l_e_n_a_m_e is not supplied and - HHIISSTTFFIILLEE is unset or null, the --aa,, --nn,, --rr,, and --ww options have - no effect. Options, if supplied, have the following meanings: - --cc Clear the history list by deleting all the entries. + played history entry. If hhiissttoorryy uses HHIISSTTTTIIMMEEFFOORRMMAATT, it does + not print an intervening space between the formatted time stamp + and the history entry. + + If _f_i_l_e_n_a_m_e is supplied, hhiissttoorryy uses it as the name of the his- + tory file; if not, it uses the value of HHIISSTTFFIILLEE. If _f_i_l_e_n_a_m_e + is not supplied and HHIISSTTFFIILLEE is unset or null, the --aa,, --nn,, --rr,, + and --ww options have no effect. + + Options, if supplied, have the following meanings: + --cc Clear the history list by deleting all the entries. This + can be used with the other options to replace the history + list. --dd _o_f_f_s_e_t - Delete the history entry at position _o_f_f_s_e_t. If _o_f_f_s_e_t + Delete the history entry at position _o_f_f_s_e_t. If _o_f_f_s_e_t is negative, it is interpreted as relative to one greater than the last history position, so negative indices count - back from the end of the history, and an index of -1 + back from the end of the history, and an index of -1 refers to the current hhiissttoorryy --dd command. --dd _s_t_a_r_t-_e_n_d - Delete the range of history entries between positions - _s_t_a_r_t and _e_n_d, inclusive. Positive and negative values + Delete the range of history entries between positions + _s_t_a_r_t and _e_n_d, inclusive. Positive and negative values for _s_t_a_r_t and _e_n_d are interpreted as described above. - --aa Append the "new" history lines to the history file. - These are history lines entered since the beginning of + --aa Append the "new" history lines to the history file. + These are history lines entered since the beginning of the current bbaasshh session, but not already appended to the history file. - --nn Read the history lines not already read from the history - file into the current history list. These are lines ap- - pended to the history file since the beginning of the + --nn Read the history lines not already read from the history + file into the current history list. These are lines ap- + pended to the history file since the beginning of the current bbaasshh session. - --rr Read the contents of the history file and append them to - the current history list. + --rr Read the history file and append its contents to the cur- + rent history list. --ww Write the current history list to the history file, over- writing the history file's contents. --pp Perform history substitution on the following _a_r_g_s and - display the result on the standard output. Does not - store the results in the history list. Each _a_r_g must be + display the result on the standard output, without stor- + ing the results in the history list. Each _a_r_g must be quoted to disable normal history expansion. --ss Store the _a_r_g_s in the history list as a single entry. The last command in the history list is removed before - the _a_r_g_s are added. - - If the HHIISSTTTTIIMMEEFFOORRMMAATT variable is set, the time stamp informa- - tion associated with each history entry is written to the his- - tory file, marked with the history comment character. When the - history file is read, lines beginning with the history comment - character followed immediately by a digit are interpreted as - timestamps for the following history entry. The return value is - 0 unless an invalid option is encountered, an error occurs while - reading or writing the history file, an invalid _o_f_f_s_e_t or range - is supplied as an argument to --dd, or the history expansion sup- - plied as an argument to --pp fails. + adding the _a_r_g_s. + + If the HHIISSTTTTIIMMEEFFOORRMMAATT variable is set, hhiissttoorryy writes the time + stamp information associated with each history entry to the his- + tory file, marked with the history comment character. When the + history file is read, lines beginning with the history comment + character followed immediately by a digit are interpreted as + timestamps for the following history entry. + + The return value is 0 unless an invalid option is encountered, + an error occurs while reading or writing the history file, an + invalid _o_f_f_s_e_t or range is supplied as an argument to --dd, or the + history expansion supplied as an argument to --pp fails. jjoobbss [--llnnpprrss] [ _j_o_b_s_p_e_c ... ] jjoobbss --xx _c_o_m_m_a_n_d [ _a_r_g_s ... ] The first form lists the active jobs. The options have the fol- lowing meanings: --ll List process IDs in addition to the normal information. - --nn Display information only about jobs that have changed + --nn Display information only about jobs that have changed status since the user was last notified of their status. - --pp List only the process ID of the job's process group + --pp List only the process ID of the job's process group leader. --rr Display only running jobs. --ss Display only stopped jobs. - If _j_o_b_s_p_e_c is given, output is restricted to information about - that job. The return status is 0 unless an invalid option is - encountered or an invalid _j_o_b_s_p_e_c is supplied. + If _j_o_b_s_p_e_c is supplied, jjoobbss restricts output to information + about that job. The return status is 0 unless an invalid option + is encountered or an invalid _j_o_b_s_p_e_c is supplied. If the --xx option is supplied, jjoobbss replaces any _j_o_b_s_p_e_c found in _c_o_m_m_a_n_d or _a_r_g_s with the corresponding process group ID, and ex- - ecutes _c_o_m_m_a_n_d passing it _a_r_g_s, returning its exit status. + ecutes _c_o_m_m_a_n_d, passing it _a_r_g_s, returning its exit status. kkiillll [--ss _s_i_g_s_p_e_c | --nn _s_i_g_n_u_m | --_s_i_g_s_p_e_c] [_p_i_d | _j_o_b_s_p_e_c] ... kkiillll --ll|--LL [_s_i_g_s_p_e_c | _e_x_i_t___s_t_a_t_u_s] - Send the signal named by _s_i_g_s_p_e_c or _s_i_g_n_u_m to the processes + Send the signal specified by _s_i_g_s_p_e_c or _s_i_g_n_u_m to the processes named by _p_i_d or _j_o_b_s_p_e_c. _s_i_g_s_p_e_c is either a case-insensitive signal name such as SSIIGGKKIILLLL (with or without the SSIIGG prefix) or a signal number; _s_i_g_n_u_m is a signal number. If _s_i_g_s_p_e_c is not - present, then SSIIGGTTEERRMM is assumed. An argument of --ll lists the - signal names. If any arguments are supplied when --ll is given, - the names of the signals corresponding to the arguments are - listed, and the return status is 0. The _e_x_i_t___s_t_a_t_u_s argument to - --ll is a number specifying either a signal number or the exit - status of a process terminated by a signal. The --LL option is - equivalent to --ll. kkiillll returns true if at least one signal was - successfully sent, or false if an error occurs or an invalid op- - tion is encountered. + supplied, then kkiillll sends SSIIGGTTEERRMM. + + An argument of --ll lists the signal names. If any arguments are + supplied when --ll is given, kkiillll lists the names of the signals + corresponding to the arguments, and the return status is 0. The + _e_x_i_t___s_t_a_t_u_s argument to --ll is a number specifying either a sig- + nal number or the exit status of a process terminated by a sig- + nal. The --LL option is equivalent to --ll. + + kkiillll returns true if at least one signal was successfully sent, + or false if an error occurs or an invalid option is encountered. lleett _a_r_g [_a_r_g ...] - Each _a_r_g is an arithmetic expression to be evaluated (see AARRIITTHH-- + Each _a_r_g is evaluated as an arithmetic expression (see AARRIITTHH-- MMEETTIICC EEVVAALLUUAATTIIOONN above). If the last _a_r_g evaluates to 0, lleett - returns 1; 0 is returned otherwise. + returns 1; otherwise lleett returns 0. llooccaall [_o_p_t_i_o_n] [_n_a_m_e[=_v_a_l_u_e] ... | - ] - For each argument, a local variable named _n_a_m_e is created, and - assigned _v_a_l_u_e. The _o_p_t_i_o_n can be any of the options accepted - by ddeeccllaarree. When llooccaall is used within a function, it causes the + For each argument, create a local variable named _n_a_m_e and assign + it _v_a_l_u_e. The _o_p_t_i_o_n can be any of the options accepted by ddee-- + ccllaarree. When llooccaall is used within a function, it causes the variable _n_a_m_e to have a visible scope restricted to that func- - tion and its children. If _n_a_m_e is -, the set of shell options - is made local to the function in which llooccaall is invoked: shell - options changed using the sseett builtin inside the function after - the call to llooccaall are restored to their original values when the - function returns. The restore is effected as if a series of sseett - commands were executed to restore the values that were in place - before the function. With no operands, llooccaall writes a list of - local variables to the standard output. It is an error to use - llooccaall when not within a function. The return status is 0 unless - llooccaall is used outside a function, an invalid _n_a_m_e is supplied, - or _n_a_m_e is a readonly variable. - - llooggoouutt Exit a login shell. + tion and its children. It is an error to use llooccaall when not + within a function. + + If _n_a_m_e is -, it makes the set of shell options local to the + function in which llooccaall is invoked: any shell options changed + using the sseett builtin inside the function after the call to lloo-- + ccaall are restored to their original values when the function re- + turns. The restore is performed as if a series of sseett commands + were executed to restore the values that were in place before + the function. + + With no operands, llooccaall writes a list of local variables to the + standard output. + + The return status is 0 unless llooccaall is used outside a function, + an invalid _n_a_m_e is supplied, or _n_a_m_e is a readonly variable. + + llooggoouutt [[_n]] + Exit a login shell, returning a status of _n to the shell's par- + ent. mmaappffiillee [--dd _d_e_l_i_m] [--nn _c_o_u_n_t] [--OO _o_r_i_g_i_n] [--ss _c_o_u_n_t] [--tt] [--uu _f_d] [--CC _c_a_l_l_b_a_c_k] [--cc _q_u_a_n_t_u_m] [_a_r_r_a_y] rreeaaddaarrrraayy [--dd _d_e_l_i_m] [--nn _c_o_u_n_t] [--OO _o_r_i_g_i_n] [--ss _c_o_u_n_t] [--tt] [--uu _f_d] [--CC _c_a_l_l_b_a_c_k] [--cc _q_u_a_n_t_u_m] [_a_r_r_a_y] - Read lines from the standard input into the indexed array vari- - able _a_r_r_a_y, or from file descriptor _f_d if the --uu option is sup- - plied. The variable MMAAPPFFIILLEE is the default _a_r_r_a_y. Options, if + Read lines from the standard input, or from file descriptor _f_d + if the --uu option is supplied, into the indexed array variable + _a_r_r_a_y. The variable MMAAPPFFIILLEE is the default _a_r_r_a_y. Options, if supplied, have the following meanings: - --dd The first character of _d_e_l_i_m is used to terminate each - input line, rather than newline. If _d_e_l_i_m is the empty - string, mmaappffiillee will terminate a line when it reads a NUL - character. - --nn Copy at most _c_o_u_n_t lines. If _c_o_u_n_t is 0, all lines are - copied. - --OO Begin assigning to _a_r_r_a_y at index _o_r_i_g_i_n. The default + --dd Use the first character of _d_e_l_i_m to terminate each input + line, rather than newline. If _d_e_l_i_m is the empty string, + mmaappffiillee will terminate a line when it reads a NUL charac- + ter. + --nn Copy at most _c_o_u_n_t lines. If _c_o_u_n_t is 0, copy all lines. + --OO Begin assigning to _a_r_r_a_y at index _o_r_i_g_i_n. The default index is 0. --ss Discard the first _c_o_u_n_t lines read. - --tt Remove a trailing _d_e_l_i_m (default newline) from each line + --tt Remove a trailing _d_e_l_i_m (default newline) from each line read. - --uu Read lines from file descriptor _f_d instead of the stan- + --uu Read lines from file descriptor _f_d instead of the stan- dard input. - --CC Evaluate _c_a_l_l_b_a_c_k each time _q_u_a_n_t_u_m lines are read. The + --CC Evaluate _c_a_l_l_b_a_c_k each time _q_u_a_n_t_u_m lines are read. The --cc option specifies _q_u_a_n_t_u_m. - --cc Specify the number of lines read between each call to + --cc Specify the number of lines read between each call to _c_a_l_l_b_a_c_k. - If --CC is specified without --cc, the default quantum is 5000. + If --CC is specified without --cc, the default quantum is 5000. When _c_a_l_l_b_a_c_k is evaluated, it is supplied the index of the next array element to be assigned and the line to be assigned to that - element as additional arguments. _c_a_l_l_b_a_c_k is evaluated after + element as additional arguments. _c_a_l_l_b_a_c_k is evaluated after the line is read but before the array element is assigned. - If not supplied with an explicit origin, mmaappffiillee will clear _a_r_- + If not supplied with an explicit origin, mmaappffiillee will clear _a_r_- _r_a_y before assigning to it. - mmaappffiillee returns successfully unless an invalid option or option - argument is supplied, _a_r_r_a_y is invalid or unassignable, or if - _a_r_r_a_y is not an indexed array. + mmaappffiillee returns zero unless an invalid option or option argument + is supplied, _a_r_r_a_y is invalid or unassignable, or if _a_r_r_a_y is + not an indexed array. ppooppdd [-nn] [+_n] [-_n] - Removes entries from the directory stack. The elements are num- - bered from 0 starting at the first directory listed by ddiirrss. - With no arguments, ppooppdd removes the top directory from the - stack, and changes to the new top directory. Arguments, if sup- - plied, have the following meanings: - --nn Suppresses the normal change of directory when removing - directories from the stack, so that only the stack is ma- - nipulated. - ++_n Removes the _nth entry counting from the left of the list - shown by ddiirrss, starting with zero, from the stack. For + Remove entries from the directory stack. The elements are num- + bered from 0 starting at the first directory listed by ddiirrss, so + ppooppdd is equivalent to "popd +0." With no arguments, ppooppdd re- + moves the top directory from the stack, and changes to the new + top directory. Arguments, if supplied, have the following mean- + ings: + --nn Suppress the normal change of directory when removing di- + rectories from the stack, only manipulate the stack. + ++_n Remove the _nth entry counting from the left of the list + shown by ddiirrss, starting with zero, from the stack. For example: "popd +0" removes the first directory, "popd +1" the second. - --_n Removes the _nth entry counting from the right of the list + --_n Remove the _nth entry counting from the right of the list shown by ddiirrss, starting with zero. For example: "popd -0" removes the last directory, "popd -1" the next to last. @@ -5580,19 +5854,18 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS to the directory at the top of the stack. If the ccdd fails, ppooppdd returns a non-zero value. - Otherwise, ppooppdd returns false if an invalid option is encoun- - tered, the directory stack is empty, or a non-existent directory - stack entry is specified. + Otherwise, ppooppdd returns false if an invalid option is supplied, + the directory stack is empty, or _n specifies a non-existent di- + rectory stack entry. - If the ppooppdd command is successful, bash runs ddiirrss to show the - final contents of the directory stack, and the return status is + If the ppooppdd command is successful, bbaasshh runs ddiirrss to show the + final contents of the directory stack, and the return status is 0. pprriinnttff [--vv _v_a_r] _f_o_r_m_a_t [_a_r_g_u_m_e_n_t_s] - Write the formatted _a_r_g_u_m_e_n_t_s to the standard output under the - control of the _f_o_r_m_a_t. The --vv option causes the output to be - assigned to the variable _v_a_r rather than being printed to the - standard output. + Write the formatted _a_r_g_u_m_e_n_t_s to the standard output under the + control of the _f_o_r_m_a_t. The --vv option assigns the output to the + variable _v_a_r rather than printing it to the standard output. The _f_o_r_m_a_t is a character string which contains three types of objects: plain characters, which are simply copied to standard @@ -5617,12 +5890,12 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS causes pprriinnttff to output the date-time string resulting from using _d_a_t_e_f_m_t as a format string for _s_t_r_f_t_i_m_e(3). The corresponding _a_r_g_u_m_e_n_t is an integer representing the - number of seconds since the epoch. Two special argument - values may be used: -1 represents the current time, and - -2 represents the time the shell was invoked. If no ar- - gument is specified, conversion behaves as if -1 had been - given. This is an exception to the usual pprriinnttff behav- - ior. + number of seconds since the epoch. This format specifier + recognizes two special argument values: -1 represents the + current time, and -2 represents the time the shell was + invoked. If no argument is specified, conversion behaves + as if -1 had been supplied. This is an exception to the + usual pprriinnttff behavior. The %b, %q, and %T format specifiers all use the field width and precision arguments from the format specification and write that @@ -5654,70 +5927,70 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS ppuusshhdd [--nn] [+_n] [-_n] ppuusshhdd [--nn] [_d_i_r] - Adds a directory to the top of the directory stack, or rotates - the stack, making the new top of the stack the current working - directory. With no arguments, ppuusshhdd exchanges the top two ele- - ments of the directory stack. Arguments, if supplied, have the + Add a directory to the top of the directory stack, or rotate the + stack, making the new top of the stack the current working di- + rectory. With no arguments, ppuusshhdd exchanges the top two ele- + ments of the directory stack. Arguments, if supplied, have the following meanings: - --nn Suppresses the normal change of directory when rotating - or adding directories to the stack, so that only the - stack is manipulated. - ++_n Rotates the stack so that the _nth directory (counting - from the left of the list shown by ddiirrss, starting with - zero) is at the top. + --nn Suppress the normal change of directory when rotating or + adding directories to the stack, only manipulate the + stack. + ++_n Rotate the stack so that the _nth directory (counting from + the left of the list shown by ddiirrss, starting with zero) + is at the top. --_n Rotates the stack so that the _nth directory (counting from the right of the list shown by ddiirrss, starting with zero) is at the top. - _d_i_r Adds _d_i_r to the directory stack at the top + _d_i_r Adds _d_i_r to the directory stack at the top. After the stack has been modified, if the --nn option was not sup- plied, ppuusshhdd uses the ccdd builtin to change to the directory at the top of the stack. If the ccdd fails, ppuusshhdd returns a non-zero value. - Otherwise, if no arguments are supplied, ppuusshhdd returns 0 unless - the directory stack is empty. When rotating the directory - stack, ppuusshhdd returns 0 unless the directory stack is empty or a - non-existent directory stack element is specified. + Otherwise, if no arguments are supplied, ppuusshhdd returns zero un- + less the directory stack is empty. When rotating the directory + stack, ppuusshhdd returns zero unless the directory stack is empty or + _n specifies a non-existent directory stack element. - If the ppuusshhdd command is successful, bash runs ddiirrss to show the + If the ppuusshhdd command is successful, bbaasshh runs ddiirrss to show the final contents of the directory stack. ppwwdd [--LLPP] - Print the absolute pathname of the current working directory. + Print the absolute pathname of the current working directory. The pathname printed contains no symbolic links if the --PP option is supplied or the --oo pphhyyssiiccaall option to the sseett builtin command - is enabled. If the --LL option is used, the pathname printed may - contain symbolic links. The return status is 0 unless an error + is enabled. If the --LL option is used, the pathname printed may + contain symbolic links. The return status is 0 unless an error occurs while reading the name of the current directory or an in- valid option is supplied. rreeaadd [--EEeerrss] [--aa _a_n_a_m_e] [--dd _d_e_l_i_m] [--ii _t_e_x_t] [--nn _n_c_h_a_r_s] [--NN _n_c_h_a_r_s] [--pp _p_r_o_m_p_t] [--tt _t_i_m_e_o_u_t] [--uu _f_d] [_n_a_m_e ...] - One line is read from the standard input, or from the file de- - scriptor _f_d supplied as an argument to the --uu option, split into - words as described above under WWoorrdd SSpplliittttiinngg, and the first - word is assigned to the first _n_a_m_e, the second word to the sec- - ond _n_a_m_e, and so on. If there are more words than names, the - remaining words and their intervening delimiters are assigned to + Read one line from the standard input, or from the file descrip- + tor _f_d supplied as an argument to the --uu option, split it into + words as described above under WWoorrdd SSpplliittttiinngg, and assign the + first word to the first _n_a_m_e, the second word to the second + _n_a_m_e, and so on. If there are more words than names, the re- + maining words and their intervening delimiters are assigned to the last _n_a_m_e. If there are fewer words read from the input stream than names, the remaining names are assigned empty val- - ues. The characters in IIFFSS are used to split the line into - words using the same rules the shell uses for expansion (de- - scribed above under WWoorrdd SSpplliittttiinngg). The backslash character - (\\) may be used to remove any special meaning for the next char- - acter read and for line continuation. Options, if supplied, - have the following meanings: + ues. The characters in the value of the IIFFSS variable are used + to split the line into words using the same rules the shell uses + for expansion (described above under WWoorrdd SSpplliittttiinngg). The back- + slash character (\\) removes any special meaning for the next + character read and is used for line continuation. + + Options, if supplied, have the following meanings: --aa _a_n_a_m_e The words are assigned to sequential indices of the array variable _a_n_a_m_e, starting at 0. _a_n_a_m_e is unset before any new values are assigned. Other _n_a_m_e arguments are ig- nored. --dd _d_e_l_i_m - The first character of _d_e_l_i_m is used to terminate the in- - put line, rather than newline. If _d_e_l_i_m is the empty - string, rreeaadd will terminate a line when it reads a NUL - character. + The first character of _d_e_l_i_m terminates the input line, + rather than newline. If _d_e_l_i_m is the empty string, rreeaadd + will terminate a line when it reads a NUL character. --ee If the standard input is coming from a terminal, rreeaadd uses rreeaaddlliinnee (see RREEAADDLLIINNEE above) to obtain the line. Readline uses the current (or default, if line editing @@ -5730,117 +6003,129 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS bash's default completion, including programmable comple- tion. --ii _t_e_x_t - If rreeaaddlliinnee is being used to read the line, _t_e_x_t is - placed into the editing buffer before editing begins. + If rreeaaddlliinnee is being used to read the line, rreeaadd places + _t_e_x_t into the editing buffer before editing begins. --nn _n_c_h_a_r_s rreeaadd returns after reading _n_c_h_a_r_s characters rather than - waiting for a complete line of input, but honors a delim- - iter if fewer than _n_c_h_a_r_s characters are read before the - delimiter. + waiting for a complete line of input, unless it encoun- + ters EOF or rreeaadd times out, but honors a delimiter if it + reads fewer than _n_c_h_a_r_s characters before the delimiter. --NN _n_c_h_a_r_s - rreeaadd returns after reading exactly _n_c_h_a_r_s characters - rather than waiting for a complete line of input, unless - EOF is encountered or rreeaadd times out. Delimiter charac- - ters encountered in the input are not treated specially - and do not cause rreeaadd to return until _n_c_h_a_r_s characters - are read. The result is not split on the characters in - IIFFSS; the intent is that the variable is assigned exactly - the characters read (with the exception of backslash; see - the --rr option below). + rreeaadd returns after reading exactly _n_c_h_a_r_s characters + rather than waiting for a complete line of input, unless + it encounters EOF or rreeaadd times out. Any delimiter char- + acters in the input are not treated specially and do not + cause rreeaadd to return until it has read _n_c_h_a_r_s characters. + The result is not split on the characters in IIFFSS; the in- + tent is that the variable is assigned exactly the charac- + ters read (with the exception of backslash; see the --rr + option below). --pp _p_r_o_m_p_t Display _p_r_o_m_p_t on standard error, without a trailing new- - line, before attempting to read any input. The prompt is - displayed only if input is coming from a terminal. + line, before attempting to read any input, but only if + input is coming from a terminal. --rr Backslash does not act as an escape character. The back- - slash is considered to be part of the line. In particu- - lar, a backslash-newline pair may not then be used as a + slash is considered to be part of the line. In particu- + lar, a backslash-newline pair may not then be used as a line continuation. --ss Silent mode. If input is coming from a terminal, charac- ters are not echoed. --tt _t_i_m_e_o_u_t - Cause rreeaadd to time out and return failure if a complete - line of input (or a specified number of characters) is - not read within _t_i_m_e_o_u_t seconds. _t_i_m_e_o_u_t may be a deci- - mal number with a fractional portion following the deci- - mal point. This option is only effective if rreeaadd is - reading input from a terminal, pipe, or other special - file; it has no effect when reading from regular files. - If rreeaadd times out, rreeaadd saves any partial input read into - the specified variable _n_a_m_e. If _t_i_m_e_o_u_t is 0, rreeaadd re- - turns immediately, without trying to read any data. The - exit status is 0 if input is available on the specified - file descriptor, or the read will return EOF, non-zero - otherwise. The exit status is greater than 128 if the - timeout is exceeded. - --uu _f_d Read input from file descriptor _f_d. - - Other than the case where _d_e_l_i_m is the empty string, rreeaadd ig- + Cause rreeaadd to time out and return failure if it does not + read a complete line of input (or a specified number of + characters) within _t_i_m_e_o_u_t seconds. _t_i_m_e_o_u_t may be a + decimal number with a fractional portion following the + decimal point. This option is only effective if rreeaadd is + reading input from a terminal, pipe, or other special + file; it has no effect when reading from regular files. + If rreeaadd times out, it saves any partial input read into + the specified variable _n_a_m_e, and the exit status is + greater than 128. If _t_i_m_e_o_u_t is 0, rreeaadd returns immedi- + ately, without trying to read any data. In this case, + the exit status is 0 if input is available on the speci- + fied file descriptor, or the read will return EOF, non- + zero otherwise. + --uu _f_d Read input from file descriptor _f_d instead of the stan- + dard input. + + Other than the case where _d_e_l_i_m is the empty string, rreeaadd ig- nores any NUL characters in the input. - If no _n_a_m_e_s are supplied, the line read, without the ending de- - limiter but otherwise unmodified, is assigned to the variable - RREEPPLLYY. The exit status is zero, unless end-of-file is encoun- - tered, rreeaadd times out (in which case the status is greater than - 128), a variable assignment error (such as assigning to a read- - only variable) occurs, or an invalid file descriptor is supplied - as the argument to --uu. + If no _n_a_m_e_s are supplied, rreeaadd assigns the line read, without + the ending delimiter but otherwise unmodified, to the variable + RREEPPLLYY. + + The exit status is zero, unless end-of-file is encountered, rreeaadd + times out (in which case the status is greater than 128), a + variable assignment error (such as assigning to a readonly vari- + able) occurs, or an invalid file descriptor is supplied as the + argument to --uu. rreeaaddoonnllyy [--aaAAff] [--pp] [_n_a_m_e[=_w_o_r_d] ...] The given _n_a_m_e_s are marked readonly; the values of these _n_a_m_e_s - may not be changed by subsequent assignment. If the --ff option - is supplied, the functions corresponding to the _n_a_m_e_s are so - marked. The --aa option restricts the variables to indexed ar- - rays; the --AA option restricts the variables to associative ar- - rays. If both options are supplied, --AA takes precedence. If no - _n_a_m_e arguments are given, or if the --pp option is supplied, a - list of all readonly names is printed. The other options may be - used to restrict the output to a subset of the set of readonly - names. The --pp option causes output to be displayed in a format - that may be reused as input. If a variable name is followed by - =_w_o_r_d, the value of the variable is set to _w_o_r_d. The return - status is 0 unless an invalid option is encountered, one of the - _n_a_m_e_s is not a valid shell variable name, or --ff is supplied with - a _n_a_m_e that is not a function. + may not be changed by subsequent assignment or unset. If the --ff + option is supplied, each _n_a_m_e refers to a shell function. The + --aa option restricts the variables to indexed arrays; the --AA op- + tion restricts the variables to associative arrays. If both op- + tions are supplied, --AA takes precedence. If no _n_a_m_e arguments + are supplied, or if the --pp option is supplied, print a list of + all readonly names. The other options may be used to restrict + the output to a subset of the set of readonly names. The --pp op- + tion displays output in a format that may be reused as input. + + rreeaaddoonnllyy allows the value of a variable to be set at the same + time the readonly attribute is changed by following the variable + name with =_v_a_l_u_e. This sets the value of the variable is to + _v_a_l_u_e while modifying the readonly attribute. + + The return status is 0 unless an invalid option is encountered, + one of the _n_a_m_e_s is not a valid shell variable name, or --ff is + supplied with a _n_a_m_e that is not a function. rreettuurrnn [_n] - Causes a function to stop executing and return the value speci- - fied by _n to its caller. If _n is omitted, the return status is - that of the last command executed in the function body. If rree-- - ttuurrnn is executed by a trap handler, the last command used to de- - termine the status is the last command executed before the trap - handler. If rreettuurrnn is executed during a DDEEBBUUGG trap, the last - command used to determine the status is the last command exe- - cuted by the trap handler before rreettuurrnn was invoked. If rreettuurrnn - is used outside a function, but during execution of a script by - the .. (ssoouurrccee) command, it causes the shell to stop executing - that script and return either _n or the exit status of the last - command executed within the script as the exit status of the - script. If _n is supplied, the return value is its least signif- - icant 8 bits. The return status is non-zero if rreettuurrnn is sup- - plied a non-numeric argument, or is used outside a function and - not during execution of a script by .. or ssoouurrccee. Any command - associated with the RREETTUURRNN trap is executed before execution re- - sumes after the function or script. + Stop executing a shell function or sourced file and return the + value specified by _n to its caller. If _n is omitted, the return + status is that of the last command executed. If rreettuurrnn is exe- + cuted by a trap handler, the last command used to determine the + status is the last command executed before the trap handler. If + rreettuurrnn is executed during a DDEEBBUUGG trap, the last command used to + determine the status is the last command executed by the trap + handler before rreettuurrnn was invoked. + + When rreettuurrnn is used to terminate execution of a script being ex- + ecuted by the .. (ssoouurrccee) command, it causes the shell to stop + executing that script and return either _n or the exit status of + the last command executed within the script as the exit status + of the script. If _n is supplied, the return value is its least + significant 8 bits. + + Any command associated with the RREETTUURRNN trap is executed before + execution resumes after the function or script. + + The return status is non-zero if rreettuurrnn is supplied a non-nu- + meric argument, or is used outside a function and not during ex- + ecution of a script by .. or ssoouurrccee. sseett [--aabbeeffhhkkmmnnppttuuvvxxBBCCEEHHPPTT] [--oo _o_p_t_i_o_n_-_n_a_m_e] [----] [--] [_a_r_g ...] sseett [++aabbeeffhhkkmmnnppttuuvvxxBBCCEEHHPPTT] [++oo _o_p_t_i_o_n_-_n_a_m_e] [----] [--] [_a_r_g ...] sseett --oo - sseett ++oo Without options, display the name and value of each shell vari- - able in a format that can be reused as input for setting or re- + sseett ++oo Without options, display the name and value of each shell vari- + able in a format that can be reused as input for setting or re- setting the currently-set variables. Read-only variables cannot - be reset. In _p_o_s_i_x _m_o_d_e, only shell variables are listed. The - output is sorted according to the current locale. When options - are specified, they set or unset shell attributes. Any argu- - ments remaining after option processing are treated as values + be reset. In _p_o_s_i_x _m_o_d_e, only shell variables are listed. The + output is sorted according to the current locale. When options + are specified, they set or unset shell attributes. Any argu- + ments remaining after option processing are treated as values for the positional parameters and are assigned, in order, to $$11, - $$22, ..., $$_n. Options, if specified, have the following mean- + $$22, ..., $$_n. Options, if specified, have the following mean- ings: --aa Each variable or function that is created or modified is - given the export attribute and marked for export to the + given the export attribute and marked for export to the environment of subsequent commands. - --bb Report the status of terminated background jobs immedi- - ately, rather than before the next primary prompt. This - is effective only when job control is enabled. + --bb Report the status of terminated background jobs immedi- + ately, rather than before the next primary prompt or af- + ter a foreground command terminates. This is effective + only when job control is enabled. --ee Exit immediately if a _p_i_p_e_l_i_n_e (which may consist of a single _s_i_m_p_l_e _c_o_m_m_a_n_d), a _l_i_s_t, or a _c_o_m_p_o_u_n_d _c_o_m_m_a_n_d (see SSHHEELLLL GGRRAAMMMMAARR above), exits with a non-zero status. @@ -5946,40 +6231,40 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS no _o_p_t_i_o_n_-_n_a_m_e, sseett prints a series of sseett commands to recreate the current option settings on the standard output. - --pp Turn on _p_r_i_v_i_l_e_g_e_d mode. In this mode, the $$EENNVV and - $$BBAASSHH__EENNVV files are not processed, shell functions are - not inherited from the environment, and the SSHHEELLLLOOPPTTSS, - BBAASSHHOOPPTTSS, CCDDPPAATTHH, and GGLLOOBBIIGGNNOORREE variables, if they ap- - pear in the environment, are ignored. If the shell is - started with the effective user (group) id not equal to - the real user (group) id, and the --pp option is not sup- - plied, these actions are taken and the effective user id - is set to the real user id. If the --pp option is sup- - plied at startup, the effective user id is not reset. - Turning this option off causes the effective user and + --pp Turn on _p_r_i_v_i_l_e_g_e_d mode. In this mode, the shell does + not read the $$EENNVV and $$BBAASSHH__EENNVV files, shell functions + are not inherited from the environment, and the SSHHEELL-- + LLOOPPTTSS, BBAASSHHOOPPTTSS, CCDDPPAATTHH, and GGLLOOBBIIGGNNOORREE variables, if + they appear in the environment, are ignored. If the + shell is started with the effective user (group) id not + equal to the real user (group) id, and the --pp option is + not supplied, these actions are taken and the effective + user id is set to the real user id. If the --pp option is + supplied at startup, the effective user id is not reset. + Turning this option off causes the effective user and group ids to be set to the real user and group ids. --rr Enable restricted shell mode. This option cannot be un- set once it has been set. --tt Exit after reading and executing one command. --uu Treat unset variables and parameters other than the spe- - cial parameters "@" and "*", or array variables sub- - scripted with "@" or "*", as an error when performing - parameter expansion. If expansion is attempted on an - unset variable or parameter, the shell prints an error - message, and, if not interactive, exits with a non-zero + cial parameters "@" and "*", or array variables sub- + scripted with "@" or "*", as an error when performing + parameter expansion. If expansion is attempted on an + unset variable or parameter, the shell prints an error + message, and, if not interactive, exits with a non-zero status. --vv Print shell input lines as they are read. - --xx After expanding each _s_i_m_p_l_e _c_o_m_m_a_n_d, ffoorr command, ccaassee + --xx After expanding each _s_i_m_p_l_e _c_o_m_m_a_n_d, ffoorr command, ccaassee command, sseelleecctt command, or arithmetic ffoorr command, dis- - play the expanded value of PPSS44, followed by the command - and its expanded arguments or associated word list, to - standard error. - --BB The shell performs brace expansion (see BBrraaccee EExxppaannssiioonn + play the expanded value of PPSS44, followed by the command + and its expanded arguments or associated word list, to + the standard error. + --BB The shell performs brace expansion (see BBrraaccee EExxppaannssiioonn above). This is on by default. - --CC If set, bbaasshh does not overwrite an existing file with - the >>, >>&&, and <<>> redirection operators. This may be - overridden when creating output files by using the redi- - rection operator >>|| instead of >>. + --CC If set, bbaasshh does not overwrite an existing file with + the >>, >>&&, and <<>> redirection operators. Using the + redirection operator >>|| instead of >> will override this + and force the creation of an output file. --EE If set, any trap on EERRRR is inherited by shell functions, command substitutions, and commands executed in a sub- shell environment. The EERRRR trap is normally not inher- @@ -5996,48 +6281,47 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS shell functions, command substitutions, and commands ex- ecuted in a subshell environment. The DDEEBBUUGG and RREETTUURRNN traps are normally not inherited in such cases. - ---- If no arguments follow this option, then the positional - parameters are unset. Otherwise, the positional parame- - ters are set to the _a_r_gs, even if some of them begin - with a --. - -- Signal the end of options, cause all remaining _a_r_gs to - be assigned to the positional parameters. The --xx and --vv - options are turned off. If there are no _a_r_gs, the posi- - tional parameters remain unchanged. + ---- If no arguments follow this option, unset the positional + parameters. Otherwise, set the positional parameters to + the _a_r_gs, even if some of them begin with a --. + -- Signal the end of options, and assign all remaining _a_r_gs + to the positional parameters. The --xx and --vv options are + turned off. If there are no _a_r_gs, the positional para- + meters remain unchanged. The options are off by default unless otherwise noted. Using + rather than - causes these options to be turned off. The op- tions can also be specified as arguments to an invocation of the shell. The current set of options may be found in $$--. The re- - turn status is always true unless an invalid option is encoun- + turn status is always zero unless an invalid option is encoun- tered. sshhiifftt [_n] - The positional parameters from _n+1 ... are renamed to $$11 ........ - Parameters represented by the numbers $$## down to $$##-_n+1 are un- - set. _n must be a non-negative number less than or equal to $$##. - If _n is 0, no parameters are changed. If _n is not given, it is - assumed to be 1. If _n is greater than $$##, the positional para- - meters are not changed. The return status is greater than zero - if _n is greater than $$## or less than zero; otherwise 0. + Rename positional parameters from _n+1 ... to $$11 ........ Parameters + represented by the numbers $$## down to $$##-_n+1 are unset. _n must + be a non-negative number less than or equal to $$##. If _n is 0, + no parameters are changed. If _n is not given, it is assumed to + be 1. If _n is greater than $$##, the positional parameters are + not changed. The return status is greater than zero if _n is + greater than $$## or less than zero; otherwise 0. sshhoopptt [--ppqqssuu] [--oo] [_o_p_t_n_a_m_e ...] - Toggle the values of settings controlling optional shell behav- - ior. The settings can be either those listed below, or, if the + Toggle the values of settings controlling optional shell behav- + ior. The settings can be either those listed below, or, if the --oo option is used, those available with the --oo option to the sseett - builtin command. With no options, or with the --pp option, a list - of all settable options is displayed, with an indication of - whether or not each is set; if _o_p_t_n_a_m_e_s are supplied, the output - is restricted to those options. The --pp option causes output to - be displayed in a form that may be reused as input. Other op- - tions have the following meanings: + builtin command. With no options, or with the --pp option, dis- + play a list of all settable options, with an indication of + whether or not each is set; if any _o_p_t_n_a_m_e_s are supplied, the + output is restricted to those options. The --pp option displays + output in a form that may be reused as input. Other options + have the following meanings: --ss Enable (set) each _o_p_t_n_a_m_e. --uu Disable (unset) each _o_p_t_n_a_m_e. - --qq Suppresses normal output (quiet mode); the return status + --qq Suppresses normal output (quiet mode); the return status indicates whether the _o_p_t_n_a_m_e is set or unset. If multi- - ple _o_p_t_n_a_m_e arguments are given with --qq, the return sta- - tus is zero if all _o_p_t_n_a_m_e_s are enabled; non-zero other- - wise. + ple _o_p_t_n_a_m_e arguments are supplied with --qq, the return + status is zero if all _o_p_t_n_a_m_e_s are enabled; non-zero oth- + erwise. --oo Restricts the values of _o_p_t_n_a_m_e to be those defined for the --oo option to the sseett builtin. @@ -6072,30 +6356,30 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS If set, an argument to the ccdd builtin command that is not a directory is assumed to be the name of a variable whose value is the directory to change to. - ccddssppeellll If set, minor errors in the spelling of a directory com- - ponent in a ccdd command will be corrected. The errors - checked for are transposed characters, a missing charac- - ter, and one character too many. If a correction is - found, the corrected filename is printed, and the com- - mand proceeds. This option is only used by interactive - shells. + ccddssppeellll If set, the ccdd command attempts to correct minor errors + in the spelling of a directory component. Minor errors + include transposed characters, a missing character, and + one extra character. If ccdd corrects the directory name, + it prints the corrected filename, and the command pro- + ceeds. This option is only used by interactive shells. cchheecckkhhaasshh If set, bbaasshh checks that a command found in the hash ta- ble exists before trying to execute it. If a hashed - command no longer exists, a normal path search is per- - formed. + command no longer exists, bbaasshh performs a normal path + search. cchheecckkjjoobbss If set, bbaasshh lists the status of any stopped and running jobs before exiting an interactive shell. If any jobs - are running, this causes the exit to be deferred until a - second exit is attempted without an intervening command - (see JJOOBB CCOONNTTRROOLL above). The shell always postpones ex- - iting if any jobs are stopped. + are running, bbaasshh defers the exit until a second exit is + attempted without an intervening command (see JJOOBB CCOONN-- + TTRROOLL above). The shell always postpones exiting if any + jobs are stopped. cchheecckkwwiinnssiizzee - If set, bbaasshh checks the window size after each external - (non-builtin) command and, if necessary, updates the - values of LLIINNEESS and CCOOLLUUMMNNSS. This option is enabled by - default. + If set, bbaasshh checks the window size after each external + (non-builtin) command and, if necessary, updates the + values of LLIINNEESS and CCOOLLUUMMNNSS, using the file descriptor + associated with the standard error if it is a terminal. + This option is enabled by default. ccmmddhhiisstt If set, bbaasshh attempts to save all lines of a multiple- line command in the same history entry. This allows easy re-editing of multi-line commands. This option is @@ -6147,8 +6431,8 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS eexxeeccffaaiill If set, a non-interactive shell will not exit if it can- not execute the file specified as an argument to the - eexxeecc builtin command. An interactive shell does not - exit if eexxeecc fails. + eexxeecc builtin. An interactive shell does not exit if + eexxeecc fails. eexxppaanndd__aalliiaasseess If set, aliases are expanded as described above under @@ -6187,44 +6471,44 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS shell functions, and subshells invoked with (( _c_o_m_m_a_n_d )) inherit the EERRRR trap. - eexxttgglloobb If set, the extended pattern matching features described - above under PPaatthhnnaammee EExxppaannssiioonn are enabled. + eexxttgglloobb If set, enable the extended pattern matching features + described above under PPaatthhnnaammee EExxppaannssiioonn. eexxttqquuoottee - If set, $$'_s_t_r_i_n_g' and $$"_s_t_r_i_n_g" quoting is performed - within $${{_p_a_r_a_m_e_t_e_r}} expansions enclosed in double + If set, $$'_s_t_r_i_n_g' and $$"_s_t_r_i_n_g" quoting is performed + within $${{_p_a_r_a_m_e_t_e_r}} expansions enclosed in double quotes. This option is enabled by default. ffaaiillgglloobb - If set, patterns which fail to match filenames during + If set, patterns which fail to match filenames during pathname expansion result in an expansion error. ffoorrccee__ffiiggnnoorree - If set, the suffixes specified by the FFIIGGNNOORREE shell - variable cause words to be ignored when performing word + If set, the suffixes specified by the FFIIGGNNOORREE shell + variable cause words to be ignored when performing word completion even if the ignored words are the only possi- - ble completions. See SSHHEELLLL VVAARRIIAABBLLEESS above for a de- - scription of FFIIGGNNOORREE. This option is enabled by de- + ble completions. See SSHHEELLLL VVAARRIIAABBLLEESS above for a de- + scription of FFIIGGNNOORREE. This option is enabled by de- fault. gglloobbaasscciiiirraannggeess - If set, range expressions used in pattern matching - bracket expressions (see PPaatttteerrnn MMaattcchhiinngg above) behave - as if in the traditional C locale when performing com- - parisons. That is, the current locale's collating se- - quence is not taken into account, so bb will not collate - between AA and BB, and upper-case and lower-case ASCII - characters will collate together. + If set, range expressions used in pattern matching + bracket expressions (see PPaatttteerrnn MMaattcchhiinngg above) behave + as if in the traditional C locale when performing com- + parisons. That is, pattern matching does not take the + current locale's collating sequence into account, so bb + will not collate between AA and BB, and upper-case and + lower-case ASCII characters will collate together. gglloobbsskkiippddoottss - If set, pathname expansion will never match the file- - names "." and "..", even if the pattern begins with a + If set, pathname expansion will never match the file- + names "." and "..", even if the pattern begins with a ".". This option is enabled by default. gglloobbssttaarr If set, the pattern **** used in a pathname expansion con- - text will match all files and zero or more directories - and subdirectories. If the pattern is followed by a //, + text will match all files and zero or more directories + and subdirectories. If the pattern is followed by a //, only directories and subdirectories match. ggnnuu__eerrrrffmmtt @@ -6232,13 +6516,14 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS GNU error message format. hhiissttaappppeenndd - If set, the history list is appended to the file named + If set, the history list is appended to the file named by the value of the HHIISSTTFFIILLEE variable when the shell ex- its, rather than overwriting the file. hhiissttrreeeeddiitt - If set, and rreeaaddlliinnee is being used, a user is given the - opportunity to re-edit a failed history substitution. + If set, and rreeaaddlliinnee is being used, the user is given + the opportunity to re-edit a failed history substitu- + tion. hhiissttvveerriiffyy If set, and rreeaaddlliinnee is being used, the results of his- @@ -6264,17 +6549,17 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS enabled. iinntteerraaccttiivvee__ccoommmmeennttss - If set, allow a word beginning with ## to cause that word - and all remaining characters on that line to be ignored - in an interactive shell (see CCOOMMMMEENNTTSS above). This op- - tion is enabled by default. + In an interactive shell, a word beginning with ## causes + that word and all remaining characters on that line to + be ignored, as in a non-interactive shell (see CCOOMMMMEENNTTSS + above). This option is enabled by default. llaassttppiippee - If set, and job control is not active, the shell runs + If set, and job control is not active, the shell runs the last command of a pipeline not executed in the back- ground in the current shell environment. - lliitthhiisstt If set, and the ccmmddhhiisstt option is enabled, multi-line + lliitthhiisstt If set, and the ccmmddhhiisstt option is enabled, multi-line commands are saved to the history with embedded newlines rather than using semicolon separators where possible. @@ -6285,9 +6570,9 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS tribute is not inherited. llooccaallvvaarr__uunnsseett - If set, calling uunnsseett on local variables in previous - function scopes marks them so subsequent lookups find - them unset until that function returns. This is identi- + If set, calling uunnsseett on local variables in previous + function scopes marks them so subsequent lookups find + them unset until that function returns. This is identi- cal to the behavior of unsetting local variables at the current function scope. @@ -6303,25 +6588,25 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS read". nnoo__eemmppttyy__ccmmdd__ccoommpplleettiioonn - If set, and rreeaaddlliinnee is being used, bbaasshh will not at- - tempt to search the PPAATTHH for possible completions when - completion is attempted on an empty line. + If set, and rreeaaddlliinnee is being used, bbaasshh does not search + PPAATTHH for possible completions when completion is at- + tempted on an empty line. nnooccaasseegglloobb - If set, bbaasshh matches filenames in a case-insensitive + If set, bbaasshh matches filenames in a case-insensitive fashion when performing pathname expansion (see PPaatthhnnaammee EExxppaannssiioonn above). nnooccaasseemmaattcchh - If set, bbaasshh matches patterns in a case-insensitive + If set, bbaasshh matches patterns in a case-insensitive fashion when performing matching while executing ccaassee or [[[[ conditional commands, when performing pattern substi- - tution word expansions, or when filtering possible com- + tution word expansions, or when filtering possible com- pletions as part of programmable completion. nnooeexxppaanndd__ttrraannssllaattiioonn - If set, bbaasshh encloses the translated results of $$""..."" - quoting in single quotes instead of double quotes. If + If set, bbaasshh encloses the translated results of $$""..."" + quoting in single quotes instead of double quotes. If the string is not translated, this has no effect. nnuullllgglloobb @@ -6331,82 +6616,82 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS ppaattssuubb__rreeppllaacceemmeenntt If set, bbaasshh expands occurrences of && in the replacement - string of pattern substitution to the text matched by - the pattern, as described under PPaarraammeetteerr EExxppaannssiioonn + string of pattern substitution to the text matched by + the pattern, as described under PPaarraammeetteerr EExxppaannssiioonn above. This option is enabled by default. pprrooggccoommpp - If set, the programmable completion facilities (see PPrroo-- - ggrraammmmaabbllee CCoommpplleettiioonn above) are enabled. This option is - enabled by default. + If set, enable the programmable completion facilities + (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn above). This option is en- + abled by default. pprrooggccoommpp__aalliiaass If set, and programmable completion is enabled, bbaasshh treats a command name that doesn't have any completions - as a possible alias and attempts alias expansion. If it - has an alias, bbaasshh attempts programmable completion us- + as a possible alias and attempts alias expansion. If it + has an alias, bbaasshh attempts programmable completion us- ing the command word resulting from the expanded alias. pprroommppttvvaarrss If set, prompt strings undergo parameter expansion, com- - mand substitution, arithmetic expansion, and quote re- - moval after being expanded as described in PPRROOMMPPTTIINNGG + mand substitution, arithmetic expansion, and quote re- + moval after being expanded as described in PPRROOMMPPTTIINNGG above. This option is enabled by default. rreessttrriicctteedd__sshheellll - The shell sets this option if it is started in re- - stricted mode (see RREESSTTRRIICCTTEEDD SSHHEELLLL below). The value - may not be changed. This is not reset when the startup - files are executed, allowing the startup files to dis- + The shell sets this option if it is started in re- + stricted mode (see RREESSTTRRIICCTTEEDD SSHHEELLLL below). The value + may not be changed. This is not reset when the startup + files are executed, allowing the startup files to dis- cover whether or not a shell is restricted. sshhiifftt__vveerrbboossee - If set, the sshhiifftt builtin prints an error message when + If set, the sshhiifftt builtin prints an error message when the shift count exceeds the number of positional parame- ters. ssoouurrcceeppaatthh If set, the .. (ssoouurrccee) builtin uses the value of PPAATTHH to - find the directory containing the file supplied as an - argument when the --pp option is not supplied. This op- + find the directory containing the file supplied as an + argument when the --pp option is not supplied. This op- tion is enabled by default. vvaarrrreeddiirr__cclloossee - If set, the shell automatically closes file descriptors - assigned using the _{_v_a_r_n_a_m_e_} redirection syntax (see + If set, the shell automatically closes file descriptors + assigned using the _{_v_a_r_n_a_m_e_} redirection syntax (see RREEDDIIRREECCTTIIOONN above) instead of leaving them open when the command completes. xxppgg__eecchhoo - If set, the eecchhoo builtin expands backslash-escape se- - quences by default. If the ppoossiixx shell option is also + If set, the eecchhoo builtin expands backslash-escape se- + quences by default. If the ppoossiixx shell option is also enabled, eecchhoo does not interpret any options. ssuussppeenndd [--ff] - Suspend the execution of this shell until it receives a SSIIGGCCOONNTT - signal. A login shell, or a shell without job control enabled, - cannot be suspended; the --ff option can be used to override this - and force the suspension. The return status is 0 unless the - shell is a login shell or job control is not enabled and --ff is - not supplied. + Suspend the execution of this shell until it receives a SSIIGGCCOONNTT + signal. A login shell, or a shell without job control enabled, + cannot be suspended; the --ff option will override this and force + the suspension. The return status is 0 unless the shell is a + login shell or job control is not enabled and --ff is not sup- + plied. tteesstt _e_x_p_r [[ _e_x_p_r ]] Return a status of 0 (true) or 1 (false) depending on the evalu- - ation of the conditional expression _e_x_p_r. Each operator and - operand must be a separate argument. Expressions are composed - of the primaries described above under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS. - tteesstt does not accept any options, nor does it accept and ignore + ation of the conditional expression _e_x_p_r. Each operator and + operand must be a separate argument. Expressions are composed + of the primaries described above under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS. + tteesstt does not accept any options, nor does it accept and ignore an argument of ---- as signifying the end of options. - Expressions may be combined using the following operators, - listed in decreasing order of precedence. The evaluation de- - pends on the number of arguments; see below. Operator prece- - dence is used when there are five or more arguments. + Expressions may be combined using the following operators, + listed in decreasing order of precedence. The evaluation de- + pends on the number of arguments; see below. tteesstt uses operator + precedence when there are five or more arguments. !! _e_x_p_r True if _e_x_p_r is false. (( _e_x_p_r )) Returns the value of _e_x_p_r. This may be used to override - the normal precedence of operators. + normal operator precedence. _e_x_p_r_1 -aa _e_x_p_r_2 True if both _e_x_p_r_1 and _e_x_p_r_2 are true. _e_x_p_r_1 -oo _e_x_p_r_2 @@ -6445,76 +6730,82 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS The following conditions are applied in the order listed. If the first argument is !!, the result is the negation of the three-argument expression composed of the remaining - arguments. the two-argument test using the second and - third arguments. If the first argument is exactly (( and - the fourth argument is exactly )), the result is the two- - argument test of the second and third arguments. Other- - wise, the expression is parsed and evaluated according to + arguments. If the first argument is exactly (( and the + fourth argument is exactly )), the result is the two-argu- + ment test of the second and third arguments. Otherwise, + the expression is parsed and evaluated according to precedence using the rules listed above. 5 or more arguments - The expression is parsed and evaluated according to + The expression is parsed and evaluated according to precedence using the rules listed above. When the shell is in _p_o_s_i_x _m_o_d_e, or if the expression is part of the [[[[ command, the << and >> operators sort using the current lo- - cale. If the shell is not in _p_o_s_i_x _m_o_d_e, the tteesstt and [[ com- + cale. If the shell is not in _p_o_s_i_x _m_o_d_e, the tteesstt and [[ com- mands sort lexicographically using ASCII ordering. + The historical operator-precedence parsing with 4 or more + arguments can lead to ambiguities when it encounters + strings that look like primaries. The POSIX standard has + deprecated the --aa and --oo primaries and enclosing expres- + sions within parentheses. Scripts should no longer use + them. It's much more reliable to restrict test invoca- + tions to a single primary, and to replace uses of --aa and + --oo with the shell's &&&& and |||| list operators. + ttiimmeess Print the accumulated user and system times for the shell and for processes run from the shell. The return status is 0. - ttrraapp [--llpp] [[_a_c_t_i_o_n] _s_i_g_s_p_e_c ...] + ttrraapp [--PPllpp] [[_a_c_t_i_o_n] _s_i_g_s_p_e_c ...] The _a_c_t_i_o_n is a command that is read and executed when the shell - receives signal(s) _s_i_g_s_p_e_c. If _a_c_t_i_o_n is absent (and there is a - single _s_i_g_s_p_e_c) or --, each specified signal is reset to its - original disposition (the value it had upon entrance to the - shell). If _a_c_t_i_o_n is the null string the signal specified by - each _s_i_g_s_p_e_c is ignored by the shell and by the commands it in- - vokes. - - If no arguments are supplied, ttrraapp displays the actions associ- + receives any of the signals _s_i_g_s_p_e_c. If _a_c_t_i_o_n is absent (and + there is a single _s_i_g_s_p_e_c) or --, each specified _s_i_g_s_p_e_c is reset + to the value it had when the shell was started. If _a_c_t_i_o_n is + the null string the signal specified by each _s_i_g_s_p_e_c is ignored + by the shell and by the commands it invokes. + + If no arguments are supplied, ttrraapp displays the actions associ- ated with each trapped signal as a set of ttrraapp commands that can - be reused as shell input to restore the current signal disposi- - tions. If --pp is given, and _a_c_t_i_o_n is not present, then ttrraapp - displays the actions associated with each _s_i_g_s_p_e_c or, if none + be reused as shell input to restore the current signal disposi- + tions. If --pp is given, and _a_c_t_i_o_n is not present, then ttrraapp + displays the actions associated with each _s_i_g_s_p_e_c or, if none are supplied, for all trapped signals, as a set of ttrraapp commands - that can be reused as shell input to restore the current signal - dispositions. The --PP option behaves similarly, but displays - only the actions associated with each _s_i_g_s_p_e_c argument. --PP re- - quires at least one _s_i_g_s_p_e_c argument. The --PP or --pp options to - ttrraapp may be used in a subshell environment (e.g., command sub- - stitution) and, as long as they are used before ttrraapp is used to - change a signal's handling, will display the state of its par- - ent's traps. - - The --ll option causes ttrraapp to print a list of signal names and - their corresponding numbers. Each _s_i_g_s_p_e_c is either a signal - name defined in <_s_i_g_n_a_l_._h>, or a signal number. Signal names - are case insensitive and the SSIIGG prefix is optional. - - If a _s_i_g_s_p_e_c is EEXXIITT (0) the command _a_c_t_i_o_n is executed on exit - from the shell. If a _s_i_g_s_p_e_c is DDEEBBUUGG, the command _a_c_t_i_o_n is - executed before every _s_i_m_p_l_e _c_o_m_m_a_n_d, _f_o_r command, _c_a_s_e command, - _s_e_l_e_c_t command, (( arithmetic command, [[ conditional command, - arithmetic _f_o_r command, and before the first command executes in - a shell function (see SSHHEELLLL GGRRAAMMMMAARR above). Refer to the de- - scription of the eexxttddeebbuugg option to the sshhoopptt builtin for de- - tails of its effect on the DDEEBBUUGG trap. If a _s_i_g_s_p_e_c is RREETTUURRNN, - the command _a_c_t_i_o_n is executed each time a shell function or a - script executed with the .. or ssoouurrccee builtins finishes execut- - ing. - - If a _s_i_g_s_p_e_c is EERRRR, the command _a_c_t_i_o_n is executed whenever a - pipeline (which may consist of a single simple command), a list, - or a compound command returns a non-zero exit status, subject to - the following conditions. The EERRRR trap is not executed if the + that can be reused as shell input to restore the current signal + dispositions. The --PP option behaves similarly, but displays + only the actions associated with each _s_i_g_s_p_e_c argument. --PP re- + quires at least one _s_i_g_s_p_e_c argument. The --PP or --pp options may + be used in a subshell environment (e.g., command substitution) + and, as long as they are used before ttrraapp is used to change a + signal's handling, will display the state of its parent's traps. + + The --ll option prints a list of signal names and their corre- + sponding numbers. Each _s_i_g_s_p_e_c is either a signal name defined + in <_s_i_g_n_a_l_._h>, or a signal number. Signal names are case insen- + sitive and the SSIIGG prefix is optional. If --ll is supplied with + no _s_i_g_s_p_e_c arguments, it prints a list of valid signal names. + + If a _s_i_g_s_p_e_c is EEXXIITT (0), _a_c_t_i_o_n is executed on exit from the + shell. If a _s_i_g_s_p_e_c is DDEEBBUUGG, _a_c_t_i_o_n is executed before every + _s_i_m_p_l_e _c_o_m_m_a_n_d, _f_o_r command, _c_a_s_e command, _s_e_l_e_c_t command, (( + arithmetic command, [[ conditional command, arithmetic _f_o_r com- + mand, and before the first command executes in a shell function + (see SSHHEELLLL GGRRAAMMMMAARR above). Refer to the description of the + eexxttddeebbuugg shell option (see sshhoopptt above) for details of its ef- + fect on the DDEEBBUUGG trap. If a _s_i_g_s_p_e_c is RREETTUURRNN, _a_c_t_i_o_n is exe- + cuted each time a shell function or a script executed with the .. + or ssoouurrccee builtins finishes executing. + + If a _s_i_g_s_p_e_c is EERRRR, _a_c_t_i_o_n is executed whenever a pipeline + (which may consist of a single simple command), a list, or a + compound command returns a non-zero exit status, subject to the + following conditions. The EERRRR trap is not executed if the failed command is part of the command list immediately following a wwhhiillee or uunnttiill keyword, part of the test in an _i_f statement, part of a command executed in a &&&& or |||| list except the command following the final &&&& or ||||, any command in a pipeline but the - last, or if the command's return value is being inverted using - !!. These are the same conditions obeyed by the eerrrreexxiitt (--ee) op- - tion. + last (subject to the state of the ppiippeeffaaiill shell option), or if + the command's return value is being inverted using !!. These are + the same conditions obeyed by the eerrrreexxiitt (--ee) option. When the shell is not interactive, signals ignored upon entry to the shell cannot be trapped or reset. Interactive shells permit @@ -6526,57 +6817,64 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS ttrruuee Does nothing, returns a 0 status. ttyyppee [--aaffttppPP] _n_a_m_e [_n_a_m_e ...] - With no options, indicate how each _n_a_m_e would be interpreted if - used as a command name. If the --tt option is used, ttyyppee prints a - string which is one of _a_l_i_a_s, _k_e_y_w_o_r_d, _f_u_n_c_t_i_o_n, _b_u_i_l_t_i_n, or - _f_i_l_e if _n_a_m_e is an alias, shell reserved word, function, - builtin, or executable disk file, respectively. If the _n_a_m_e is - not found, then nothing is printed, and ttyyppee returns a non-zero - exit status. If the --pp option is used, ttyyppee either returns the - name of the executable file that would be found by searching - $$PPAATTHH if _n_a_m_e were specified as a command name, or nothing if - "type -t name" would not return _f_i_l_e. The --PP option forces a - PPAATTHH search for each _n_a_m_e, even if "type -t name" would not re- - turn _f_i_l_e. If a command is hashed, --pp and --PP print the hashed - value, which is not necessarily the file that appears first in - PPAATTHH. If the --aa option is used, ttyyppee prints all of the places - that contain a command named _n_a_m_e. This includes aliases, re- - served words, functions, and builtins, but the path search op- - tions (--pp and --PP) can be supplied to restrict the output to exe- - cutable files. ttyyppee does not consult the table of hashed com- - mands when using --aa with --pp, and only performs a PPAATTHH search for - _n_a_m_e. The --ff option suppresses shell function lookup, as with - the ccoommmmaanndd builtin. ttyyppee returns true if all of the arguments - are found, false if any are not found. + Indicate how each _n_a_m_e would be interpreted if used as a command + name. + + If the --tt option is used, ttyyppee prints a string which is one of + _a_l_i_a_s, _k_e_y_w_o_r_d, _f_u_n_c_t_i_o_n, _b_u_i_l_t_i_n, or _f_i_l_e if _n_a_m_e is an alias, + shell reserved word, function, builtin, or executable file, re- + spectively. If the _n_a_m_e is not found, ttyyppee prints nothing and + returns a non-zero exit status. + + If the --pp option is used, ttyyppee either returns the pathname of + the executable file that would be found by searching $$PPAATTHH for + _n_a_m_e or nothing if "type -t name" would not return _f_i_l_e. The --PP + option forces a PPAATTHH search for each _n_a_m_e, even if "type -t + name" would not return _f_i_l_e. If _n_a_m_e is present in the table of + hashed commands, --pp and --PP print the hashed value, which is not + necessarily the file that appears first in PPAATTHH. + + If the --aa option is used, ttyyppee prints all of the places that + contain a command named _n_a_m_e. This includes aliases, reserved + words, functions, and builtins, but the path search options (--pp + and --PP) can be supplied to restrict the output to executable + files. ttyyppee does not consult the table of hashed commands when + using --aa with --pp, and only performs a PPAATTHH search for _n_a_m_e. + + The --ff option suppresses shell function lookup, as with the ccoomm-- + mmaanndd builtin. ttyyppee returns true if all of the arguments are + found, false if any are not found. uulliimmiitt [--HHSS] --aa uulliimmiitt [--HHSS] [--bbccddeeffiikkllmmnnppqqrrssttuuvvxxPPRRTT [_l_i_m_i_t]] Provides control over the resources available to the shell and - to processes started by it, on systems that allow such control. + to processes it starts, on systems that allow such control. + The --HH and --SS options specify that the hard or soft limit is set - for the given resource. A hard limit cannot be increased by a - non-root user once it is set; a soft limit may be increased up - to the value of the hard limit. If neither --HH nor --SS is speci- - fied, both the soft and hard limits are set. The value of _l_i_m_i_t - can be a number in the unit specified for the resource or one of - the special values hhaarrdd, ssoofftt, or uunnlliimmiitteedd, which stand for the - current hard limit, the current soft limit, and no limit, re- - spectively. If _l_i_m_i_t is omitted, the current value of the soft - limit of the resource is printed, unless the --HH option is given. - When more than one resource is specified, the limit name and - unit, if appropriate, are printed before the value. Other op- - tions are interpreted as follows: - --aa All current limits are reported; no limits are set + for the given resource. A hard limit cannot be increased by a + non-root user once it is set; a soft limit may be increased up + to the value of the hard limit. If neither --HH nor --SS is speci- + fied, uulliimmiitt sets both the soft and hard limits. + + The value of _l_i_m_i_t can be a number in the unit specified for the + resource or one of the special values hhaarrdd, ssoofftt, or uunnlliimmiitteedd, + which stand for the current hard limit, the current soft limit, + and no limit, respectively. If _l_i_m_i_t is omitted, uulliimmiitt prints + the current value of the soft limit of the resource, unless the + --HH option is given. When more than one resource is specified, + the limit name and unit, if appropriate, are printed before the + value. Other options are interpreted as follows: + --aa Report all current limits; no limits are set --bb The maximum socket buffer size --cc The maximum size of core files created --dd The maximum size of a process's data segment --ee The maximum scheduling priority ("nice"). - --ff The maximum size of files written by the shell and its + --ff The maximum size of files written by the shell and its children --ii The maximum number of pending signals --kk The maximum number of kqueues that may be allocated --ll The maximum size that may be locked into memory - --mm The maximum resident set size (many systems do not honor + --mm The maximum resident set size (many systems do not honor this limit) --nn The maximum number of open file descriptors (most systems do not allow this value to be set) @@ -6585,67 +6883,70 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS --rr The maximum real-time scheduling priority --ss The maximum stack size --tt The maximum amount of cpu time in seconds - --uu The maximum number of processes available to a single + --uu The maximum number of processes available to a single user - --vv The maximum amount of virtual memory available to the + --vv The maximum amount of virtual memory available to the shell and, on some systems, to its children --xx The maximum number of file locks --PP The maximum number of pseudoterminals - --RR The maximum time a real-time process can run before + --RR The maximum time a real-time process can run before blocking, in microseconds --TT The maximum number of threads - If _l_i_m_i_t is given, and the --aa option is not used, _l_i_m_i_t is the - new value of the specified resource. If no option is given, - then --ff is assumed. Values are in 1024-byte increments, except - for --tt, which is in seconds; --RR, which is in microseconds; --pp, - which is in units of 512-byte blocks; --PP, --TT, --bb, --kk, --nn, and - --uu, which are unscaled values; and, when in posix mode, --cc and - --ff, which are in 512-byte increments. The return status is 0 - unless an invalid option or argument is supplied, or an error - occurs while setting a new limit. + If _l_i_m_i_t is supplied, and the --aa option is not used, _l_i_m_i_t is + the new value of the specified resource. If no option is sup- + plied, then --ff is assumed. + + Values are in 1024-byte increments, except for --tt, which is in + seconds; --RR, which is in microseconds; --pp, which is in units of + 512-byte blocks; --PP, --TT, --bb, --kk, --nn, and --uu, which are unscaled + values; and, when in posix mode, --cc and --ff, which are in + 512-byte increments. The return status is 0 unless an invalid + option or argument is supplied, or an error occurs while setting + a new limit. uummaasskk [--pp] [--SS] [_m_o_d_e] - The user file-creation mask is set to _m_o_d_e. If _m_o_d_e begins with - a digit, it is interpreted as an octal number; otherwise it is - interpreted as a symbolic mode mask similar to that accepted by - _c_h_m_o_d(1). If _m_o_d_e is omitted, the current value of the mask is - printed. The --SS option causes the mask to be printed in sym- - bolic form; the default output is an octal number. If the --pp - option is supplied, and _m_o_d_e is omitted, the output is in a form - that may be reused as input. The return status is 0 if the mode - was successfully changed or if no _m_o_d_e argument was supplied, - and false otherwise. + Set the user file-creation mask to _m_o_d_e. If _m_o_d_e begins with a + digit, it is interpreted as an octal number; otherwise it is in- + terpreted as a symbolic mode mask similar to that accepted by + _c_h_m_o_d(1). If _m_o_d_e is omitted, uummaasskk prints the current value of + the mask. The --SS option without a _m_o_d_e argument prints the mask + in a symbolic format; the default output is an octal number. If + the --pp option is supplied, and _m_o_d_e is omitted, the output is in + a form that may be reused as input. The return status is zero + if the mode was successfully changed or if no _m_o_d_e argument was + supplied, and non-zero otherwise. uunnaalliiaass [-aa] [_n_a_m_e ...] Remove each _n_a_m_e from the list of defined aliases. If --aa is - supplied, all alias definitions are removed. The return value - is true unless a supplied _n_a_m_e is not a defined alias. + supplied, remove all alias definitions. The return value is + true unless a supplied _n_a_m_e is not a defined alias. uunnsseett [-ffvv] [-nn] [_n_a_m_e ...] For each _n_a_m_e, remove the corresponding variable or function. If the --vv option is given, each _n_a_m_e refers to a shell variable, - and that variable is removed. Read-only variables may not be - unset. If --ff is specified, each _n_a_m_e refers to a shell func- - tion, and the function definition is removed. If the --nn option - is supplied, and _n_a_m_e is a variable with the _n_a_m_e_r_e_f attribute, - _n_a_m_e will be unset rather than the variable it references. --nn - has no effect if the --ff option is supplied. If no options are - supplied, each _n_a_m_e refers to a variable; if there is no vari- - able by that name, a function with that name, if any, is unset. - Each unset variable or function is removed from the environment - passed to subsequent commands. If any of BBAASSHH__AALLIIAASSEESS, - BBAASSHH__AARRGGVV00, BBAASSHH__CCMMDDSS, BBAASSHH__CCOOMMMMAANNDD, BBAASSHH__SSUUBBSSHHEELLLL, BBAASSHHPPIIDD, - CCOOMMPP__WWOORRDDBBRREEAAKKSS, DDIIRRSSTTAACCKK, EEPPOOCCHHRREEAALLTTIIMMEE, EEPPOOCCHHSSEECCOONNDDSS, FFUUNNCC-- - NNAAMMEE, GGRROOUUPPSS, HHIISSTTCCMMDD, LLIINNEENNOO, RRAANNDDOOMM, SSEECCOONNDDSS, or SSRRAANNDDOOMM are - unset, they lose their special properties, even if they are sub- - sequently reset. The exit status is true unless a _n_a_m_e is read- - only or may not be unset. + and that variable is removed. If --ff is specified, each _n_a_m_e + refers to a shell function, and the function definition is re- + moved. If the --nn option is supplied, and _n_a_m_e is a variable + with the _n_a_m_e_r_e_f attribute, _n_a_m_e will be unset rather than the + variable it references. --nn has no effect if the --ff option is + supplied. Read-only variables and functions may not be unset. + When variables or functions are removed, they are also removed + from the environment passed to subsequent commands. If no op- + tions are supplied, each _n_a_m_e refers to a variable; if there is + no variable by that name, a function with that name, if any, is + unset. Some shell variables may not be unset. If any of + BBAASSHH__AALLIIAASSEESS, BBAASSHH__AARRGGVV00, BBAASSHH__CCMMDDSS, BBAASSHH__CCOOMMMMAANNDD, BBAASSHH__SSUUBB-- + SSHHEELLLL, BBAASSHHPPIIDD, CCOOMMPP__WWOORRDDBBRREEAAKKSS, DDIIRRSSTTAACCKK, EEPPOOCCHHRREEAALLTTIIMMEE, + EEPPOOCCHHSSEECCOONNDDSS, FFUUNNCCNNAAMMEE, GGRROOUUPPSS, HHIISSTTCCMMDD, LLIINNEENNOO, RRAANNDDOOMM, SSEECC-- + OONNDDSS, or SSRRAANNDDOOMM are unset, they lose their special properties, + even if they are subsequently reset. The exit status is true + unless a _n_a_m_e is readonly or may not be unset. wwaaiitt [--ffnn] [--pp _v_a_r_n_a_m_e] [_i_d ...] Wait for each specified child process _i_d and return the termina- - tion status of the last _i_d. Each _i_d may be a process ID or a - job specification; if a job spec is given, wwaaiitt waits for all + tion status of the last _i_d. Each _i_d may be a process ID or a + job specification; if a job spec is supplied, wwaaiitt waits for all processes in the job. If no options or _i_ds are supplied, wwaaiitt waits for all running @@ -6661,9 +6962,9 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS If the --pp option is supplied, the process or job identifier of the job for which the exit status is returned is assigned to the - variable _v_a_r_n_a_m_e named by the option argument. The variable - will be unset initially, before any assignment. This is useful - only when the --nn option is supplied. + variable _v_a_r_n_a_m_e named by the option argument. The variable, + which cannot be readonly, will be unset initially, before any + assignment. This is useful only when the --nn option is supplied. Supplying the --ff option, when job control is enabled, forces wwaaiitt to wait for each _i_d to terminate before returning its sta- @@ -6682,38 +6983,38 @@ SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE level -- each option is mutually exclusive. The compatibility level is intended to allow users to select behavior from previous versions that is incompatible with newer versions while they migrate scripts to use - current features and behavior. It's intended to be a temporary solu- + current features and behavior. It's intended to be a temporary solu- tion. This section does not mention behavior that is standard for a particu- - lar version (e.g., setting ccoommppaatt3322 means that quoting the rhs of the - regexp matching operator quotes special regexp characters in the word, - which is default behavior in bash-3.2 and subsequent versions). - - If a user enables, say, ccoommppaatt3322, it may affect the behavior of other - compatibility levels up to and including the current compatibility - level. The idea is that each compatibility level controls behavior - that changed in that version of bbaasshh, but that behavior may have been - present in earlier versions. For instance, the change to use locale- - based comparisons with the [[[[ command came in bash-4.1, and earlier + lar version (e.g., setting ccoommppaatt3322 means that quoting the right hand + side of the regexp matching operator quotes special regexp characters + in the word, which is default behavior in bash-3.2 and subsequent ver- + sions). + + If a user enables, say, ccoommppaatt3322, it may affect the behavior of other + compatibility levels up to and including the current compatibility + level. The idea is that each compatibility level controls behavior + that changed in that version of bbaasshh, but that behavior may have been + present in earlier versions. For instance, the change to use locale- + based comparisons with the [[[[ command came in bash-4.1, and earlier versions used ASCII-based comparisons, so enabling ccoommppaatt3322 will enable - ASCII-based comparisons as well. That granularity may not be suffi- - cient for all uses, and as a result users should employ compatibility - levels carefully. Read the documentation for a particular feature to + ASCII-based comparisons as well. That granularity may not be suffi- + cient for all uses, and as a result users should employ compatibility + levels carefully. Read the documentation for a particular feature to find out the current behavior. - Bash-4.3 introduced a new shell variable: BBAASSHH__CCOOMMPPAATT. The value as- + Bash-4.3 introduced a new shell variable: BBAASSHH__CCOOMMPPAATT. The value as- signed to this variable (a decimal version number like 4.2, or an inte- - ger corresponding to the ccoommppaatt_N_N option, like 42) determines the com- + ger corresponding to the ccoommppaatt_N_N option, like 42) determines the com- patibility level. - Starting with bash-4.4, bbaasshh has begun deprecating older compatibility - levels. Eventually, the options will be removed in favor of BBAASSHH__CCOOMM-- - PPAATT. + Starting with bash-4.4, bbaasshh began deprecating older compatibility lev- + els. Eventually, the options will be removed in favor of BBAASSHH__CCOOMMPPAATT. - Bash-5.0 was the final version for which there will be an individual - shopt option for the previous version. Users should control the compat- - ibility level with BBAASSHH__CCOOMMPPAATT. + Bash-5.0 was the final version for which there was an individual shopt + option for the previous version. BBAASSHH__CCOOMMPPAATT is the only mechanism to + control the compatibility level in versions newer than bash-5.0. The following table describes the behavior changes controlled by each compatibility level setting. The ccoommppaatt_N_N tag is used as shorthand for @@ -6724,77 +7025,78 @@ SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE quired for bash-5.1 and later versions. ccoommppaatt3311 - +o quoting the rhs of the [[[[ command's regexp matching oper- - ator (=~) has no special effect + +o Quoting the rhs of the [[[[ command's regexp matching oper- + ator (=~) has no special effect. ccoommppaatt3322 - +o the << and >> operators to the [[[[ command do not consider + +o The << and >> operators to the [[[[ command do not consider the current locale when comparing strings; they use ASCII ordering. ccoommppaatt4400 - +o the << and >> operators to the [[[[ command do not consider + +o The << and >> operators to the [[[[ command do not consider the current locale when comparing strings; they use ASCII ordering. BBaasshh versions prior to bash-4.1 use ASCII col- lation and _s_t_r_c_m_p(3); bash-4.1 and later use the current locale's collation sequence and _s_t_r_c_o_l_l(3). ccoommppaatt4411 - +o in _p_o_s_i_x mode, ttiimmee may be followed by options and still + +o In _p_o_s_i_x mode, ttiimmee may be followed by options and still be recognized as a reserved word (this is POSIX interpre- - tation 267) - +o in _p_o_s_i_x mode, the parser requires that an even number of + tation 267). + +o In _p_o_s_i_x mode, the parser requires that an even number of single quotes occur in the _w_o_r_d portion of a double- quoted parameter expansion and treats them specially, so that characters within the single quotes are considered - quoted (this is POSIX interpretation 221) + quoted (this is POSIX interpretation 221). ccoommppaatt4422 - +o the replacement string in double-quoted pattern substitu- + +o The replacement string in double-quoted pattern substitu- tion does not undergo quote removal, as it does in ver- - sions after bash-4.2 - +o in posix mode, single quotes are considered special when + sions after bash-4.2. + +o In posix mode, single quotes are considered special when expanding the _w_o_r_d portion of a double-quoted parameter expansion and can be used to quote a closing brace or other special character (this is part of POSIX interpre- tation 221); in later versions, single quotes are not - special within double-quoted word expansions + special within double-quoted word expansions. ccoommppaatt4433 - +o word expansion errors are considered non-fatal errors + +o Word expansion errors are considered non-fatal errors that cause the current command to fail, even in posix mode (the default behavior is to make them fatal errors - that cause the shell to exit) - +o when executing a shell function, the loop state + that cause the shell to exit). + +o When executing a shell function, the loop state (while/until/etc.) is not reset, so bbrreeaakk or ccoonnttiinnuuee in that function will break or continue loops in the calling context. Bash-4.4 and later reset the loop state to pre- - vent this + vent this. ccoommppaatt4444 - +o the shell sets up the values used by BBAASSHH__AARRGGVV and - BBAASSHH__AARRGGCC so they can expand to the shell's positional - parameters even if extended debugging mode is not enabled - +o a subshell inherits loops from its parent context, so + +o The shell sets up the values used by BBAASSHH__AARRGGVV and + BBAASSHH__AARRGGCC so they can expand to the shell's positional + parameters even if extended debugging mode is not en- + abled. + +o A subshell inherits loops from its parent context, so bbrreeaakk or ccoonnttiinnuuee will cause the subshell to exit. Bash-5.0 and later reset the loop state to prevent the exit - +o variable assignments preceding builtins like eexxppoorrtt and + +o Variable assignments preceding builtins like eexxppoorrtt and rreeaaddoonnllyy that set attributes continue to affect variables with the same name in the calling environment even if the - shell is not in posix mode + shell is not in posix mode. ccoommppaatt5500 +o Bash-5.1 changed the way $$RRAANNDDOOMM is generated to intro- - duce slightly more randomness. If the shell compatibility - level is set to 50 or lower, it reverts to the method + duce slightly more randomness. If the shell compatibil- + ity level is set to 50 or lower, it reverts to the method from bash-5.0 and previous versions, so seeding the ran- dom number generator by assigning a value to RRAANNDDOOMM will - produce the same sequence as in bash-5.0 + produce the same sequence as in bash-5.0. +o If the command hash table is empty, bash versions prior to bash-5.1 printed an informational message to that ef- fect, even when producing output that can be reused as - input. Bash-5.1 suppresses that message when the --ll op- + input. Bash-5.1 suppresses that message when the --ll op- tion is supplied. ccoommppaatt5511 @@ -6802,88 +7104,92 @@ SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE scripts @@ and ** differently depending on whether the ar- ray is indexed or associative, and differently than in previous versions. - +o arithmetic commands ( ((((...)))) ) and the expressions in an - arithmetic for statement can be expanded more than once - +o expressions used as arguments to arithmetic operators in - the [[[[ conditional command can be expanded more than once - +o the expressions in substring parameter brace expansion - can be expanded more than once - +o the expressions in the $$((((...)))) word expansion can be ex- - panded more than once - +o arithmetic expressions used as indexed array subscripts - can be expanded more than once - +o tteesstt --vv, when given an argument of AA[[@@]], where AA is an + +o Arithmetic commands ( ((((...)))) ) and the expressions in an + arithmetic for statement can be expanded more than once. + +o Expressions used as arguments to arithmetic operators in + the [[[[ conditional command can be expanded more than + once. + +o The expressions in substring parameter brace expansion + can be expanded more than once. + +o The expressions in the $$((((...)))) word expansion can be ex- + panded more than once. + +o Arithmetic expressions used as indexed array subscripts + can be expanded more than once. + +o tteesstt --vv, when given an argument of AA[[@@]], where AA is an existing associative array, will return true if the array - has any set elements. Bash-5.2 will look for and report + has any set elements. Bash-5.2 will look for and report on a key named @@. - +o the ${_p_a_r_a_m_e_t_e_r[[::]]==_v_a_l_u_e} word expansion will return - _v_a_l_u_e, before any variable-specific transformations have + +o The ${_p_a_r_a_m_e_t_e_r[[::]]==_v_a_l_u_e} word expansion will return + _v_a_l_u_e, before any variable-specific transformations have been performed (e.g., converting to lowercase). Bash-5.2 will return the final value assigned to the variable. - +o Parsing command substitutions will behave as if extended + +o Parsing command substitutions will behave as if extended globbing (see the description of the sshhoopptt builtin above) - is enabled, so that parsing a command substitution con- + is enabled, so that parsing a command substitution con- taining an extglob pattern (say, as part of a shell func- - tion) will not fail. This assumes the intent is to en- - able extglob before the command is executed and word ex- - pansions are performed. It will fail at word expansion - time if extglob hasn't been enabled by the time the com- + tion) will not fail. This assumes the intent is to en- + able extglob before the command is executed and word ex- + pansions are performed. It will fail at word expansion + time if extglob hasn't been enabled by the time the com- mand is executed. ccoommppaatt5522 - +o The tteesstt builtin uses its historical algorithm to parse - parenthesized subexpressions when given five or more ar- + +o The tteesstt builtin uses its historical algorithm to parse + parenthesized subexpressions when given five or more ar- guments. - +o If the --pp or --PP option is supplied to the bbiinndd builtin, + +o If the --pp or --PP option is supplied to the bbiinndd builtin, bbiinndd treats any arguments remaining after option process- - ing as bindable command names, and displays any key se- - quences bound to those commands, instead of treating the + ing as bindable command names, and displays any key se- + quences bound to those commands, instead of treating the arguments as key sequences to bind. RREESSTTRRIICCTTEEDD SSHHEELLLL If bbaasshh is started with the name rrbbaasshh, or the --rr option is supplied at - invocation, the shell becomes restricted. A restricted shell is used - to set up an environment more controlled than the standard shell. It - behaves identically to bbaasshh with the exception that the following are + invocation, the shell becomes _r_e_s_t_r_i_c_t_e_d. A restricted shell is used + to set up an environment more controlled than the standard shell. It + behaves identically to bbaasshh with the exception that the following are disallowed or not performed: - +o changing directories with ccdd + +o Changing directories with ccdd. - +o setting or unsetting the values of SSHHEELLLL, PPAATTHH, HHIISSTTFFIILLEE, EENNVV, - or BBAASSHH__EENNVV + +o Setting or unsetting the values of SSHHEELLLL, PPAATTHH, HHIISSTTFFIILLEE, EENNVV, + or BBAASSHH__EENNVV. - +o specifying command names containing // + +o Specifying command names containing //. - +o specifying a filename containing a // as an argument to the .. - builtin command + +o Specifying a filename containing a // as an argument to the .. + builtin command. - +o specifying a filename containing a slash as an argument to the - hhiissttoorryy builtin command + +o Using the --pp option to the .. builtin command to specify a + search path. - +o specifying a filename containing a slash as an argument to the - --pp option to the hhaasshh builtin command + +o Specifying a filename containing a slash as an argument to the + hhiissttoorryy builtin command. - +o importing function definitions from the shell environment at - startup + +o Specifying a filename containing a slash as an argument to the + --pp option to the hhaasshh builtin command. - +o parsing the value of SSHHEELLLLOOPPTTSS from the shell environment at - startup + +o Importing function definitions from the shell environment at + startup. - +o redirecting output using the >, >|, <>, >&, &>, and >> redirec- - tion operators + +o Parsing the value of SSHHEELLLLOOPPTTSS from the shell environment at + startup. - +o using the eexxeecc builtin command to replace the shell with another - command + +o Redirecting output using the >, >|, <>, >&, &>, and >> redirec- + tion operators. - +o adding or deleting builtin commands with the --ff and --dd options - to the eennaabbllee builtin command + +o Using the eexxeecc builtin command to replace the shell with another + command. + + +o Adding or deleting builtin commands with the --ff and --dd options + to the eennaabbllee builtin command. - +o using the eennaabbllee builtin command to enable disabled shell - builtins + +o Using the eennaabbllee builtin command to enable disabled shell + builtins. - +o specifying the --pp option to the ccoommmmaanndd builtin command + +o Specifying the --pp option to the ccoommmmaanndd builtin command. - +o turning off restricted mode with sseett ++rr or sshhoopptt --uu rree-- + +o Turning off restricted mode with sseett ++rr or sshhoopptt --uu rree-- ssttrriicctteedd__sshheellll. These restrictions are enforced after any startup files are read. @@ -6976,6 +7282,4 @@ BBUUGGSS Array variables may not (yet) be exported. - There may be only one active coprocess at a time. - -GNU Bash 5.3 2024 September 5 _B_A_S_H(1) +GNU Bash 5.3 2024 September 29 _B_A_S_H(1) diff --git a/doc/bash.1 b/doc/bash.1 index f7eedcbb..95f21cf0 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -1,18 +1,18 @@ -.\" +\" .\" MAN PAGE COMMENTS to .\" .\" Chet Ramey .\" Case Western Reserve University .\" chet.ramey@case.edu .\" -.\" Last Change: Thu Sep 5 15:41:56 EDT 2024 +.\" Last Change: Sun Sep 29 22:28:23 EDT 2024 .\" .\" bash_builtins, strip all but Built-Ins section .\" avoid a warning about an undefined register .\" .if !rzY .nr zY 0 .if \n(zZ=1 .ig zZ .if \n(zY=1 .ig zY -.TH BASH 1 "2024 September 5" "GNU Bash 5.3" +.TH BASH 1 "2024 September 29" "GNU Bash 5.3" .\" .ie \n(.g \{\ .ds ' \(aq @@ -66,7 +66,8 @@ bash \- GNU Bourne-Again SHell .SH DESCRIPTION .B Bash is an \fBsh\fP-compatible command language interpreter that -executes commands read from the standard input or from a file. +executes commands read from the standard input, from a string, +or from a file. .B Bash also incorporates useful features from the \fIKorn\fP and \fIC\fP shells (\fBksh\fP and \fBcsh\fP). @@ -85,7 +86,6 @@ can be used as options when the shell is invoked. In addition, \fBbash\fP interprets the following options when it is invoked: .PP -.PD 0 .TP 10 .B \-c If the @@ -129,14 +129,14 @@ below). If the .B \-s option is present, or if no arguments remain after option -processing, then commands are read from the standard input. +processing, the shell reads commands from the standard input. This option allows the positional parameters to be set when invoking an interactive shell or when reading input through a pipe. .TP .B \-D -A list of all double-quoted strings preceded by \fB$\fP -is printed on the standard output. +Print a list of all double-quoted strings preceded by \fB$\fP +on the standard output. These are the strings that are subject to language translation when the current locale is not \fBC\fP or \fBPOSIX\fP. @@ -146,12 +146,13 @@ This implies the \fB\-n\fP option; no commands will be executed. \fIshopt_option\fP is one of the shell options accepted by the \fBshopt\fP builtin (see .SM -.B SHELL BUILTIN COMMANDS +.B "SHELL BUILTIN COMMANDS" below). If \fIshopt_option\fP is present, \fB\-O\fP sets the value of that option; \fB+O\fP unsets it. -If \fIshopt_option\fP is not supplied, the names and values of the shell -options accepted by \fBshopt\fP are printed on the standard output. +If \fIshopt_option\fP is not supplied, \fBbash\fP prints +the names and values of the shell +options accepted by \fBshopt\fP on the standard output. If the invocation option is \fB+O\fP, the output is displayed in a format that may be reused as input. .TP @@ -166,14 +167,12 @@ and arguments passed to that script. An argument of .B \- is equivalent to \fB\-\-\fP. -.PD .PP .B Bash also interprets a number of multi-character options. These options must appear on the command line before the single-character options to be recognized. .PP -.PD 0 .TP .B \-\-debugger Arrange for the debugger profile to be executed before the shell @@ -194,8 +193,8 @@ Equivalent to \fB\-D\fP. .B \-\-help Display a usage message on standard output and exit successfully. .TP -\fB\-\-init\-file\fP \fIfile\fP .PD 0 +\fB\-\-init\-file\fP \fIfile\fP .TP \fB\-\-rcfile\fP \fIfile\fP .PD @@ -260,7 +259,6 @@ Equivalent to \fB\-v\fP. Show version information for this instance of .B bash on the standard output and exit successfully. -.PD .SH ARGUMENTS If arguments remain after option processing, and neither the .B \-c @@ -279,8 +277,8 @@ reads and executes commands from this file, then exits. \fBBash\fP's exit status is the exit status of the last command executed in the script. If no commands are executed, the exit status is 0. -An attempt is first made to open the file in the current directory, and, -if no file is found, then the shell searches the directories in +Bash first attempts to open the file in the current directory, and, +if no file is found, then searches the directories in .SM .B PATH for the script. @@ -296,22 +294,22 @@ An \fIinteractive\fP shell is one started without non-option arguments and without the .B \-c option, -whose standard input and error are +whose standard input and standard error are both connected to terminals (as determined by .IR isatty (3)), or one started with the .B \-i option. +.B Bash +sets .SM .B PS1 -is set and +and .B $\- includes .B i -if -.B bash -is interactive, -allowing a shell script or a startup file to test this state. +if the shell is interactive, +so a shell script or a startup file can test this state. .PP The following paragraphs describe how .B bash @@ -351,7 +349,7 @@ reads and executes commands from \fI\*~/.bashrc\fP, if that file exists. This may be inhibited by using the .B \-\-norc option. -The \fB\-\-rcfile\fP \fIfile\fP option will cause +The \fB\-\-rcfile\fP \fIfile\fP option causes .B bash to use \fIfile\fP instead of \fI\*~/.bashrc\fP. .PP @@ -372,10 +370,10 @@ if [ \-n \*"$BASH_ENV\*" ]; then . \*"$BASH_ENV\*"; fi .EE .RE .PP -but the value of the +but does not use the value of the .SM .B PATH -variable is not used to search for the filename. +variable to search for the filename. .PP If .B bash @@ -429,14 +427,14 @@ command line option, it follows the POSIX standard for startup files. In this mode, interactive shells expand the .SM .B ENV -variable and commands are read and executed from the file +variable and read and execute commands from the file whose name is the expanded value. No other startup files are read. .PP .B Bash attempts to determine when it is being run with its standard input connected to a network connection, as when executed by -the historical remote shell daemon, usually \fIrshd\fP, +the historical and rarely-seen remote shell daemon, usually \fIrshd\fP, or the secure shell daemon \fIsshd\fP. If .B bash @@ -491,7 +489,8 @@ referred to as an .BR identifier . .TP .B metacharacter -A character that, when unquoted, separates words. One of the following: +A character that, when unquoted, separates words. +One of the following: .br .RS .PP @@ -500,8 +499,8 @@ A character that, when unquoted, separates words. One of the following: .RE .TP .B control operator -A \fItoken\fP that performs a control function. It is one of the following -symbols: +A \fItoken\fP that performs a control function. +It is one of the following symbols: .RS .PP .if t \fB|| & && ; ;; ;& ;;& ( ) | |& \fP @@ -513,7 +512,7 @@ symbols: The following words are recognized as reserved when unquoted and either the first word of a command (see .SM -.B SHELL GRAMMAR +.B "SHELL GRAMMAR" below), the third word of a .B case or @@ -534,7 +533,8 @@ This section describes the syntax of the various forms of shell commands. .SS Simple Commands A \fIsimple command\fP is a sequence of optional variable assignments followed by \fBblank\fP-separated words and redirections, and -terminated by a \fIcontrol operator\fP. The first word +terminated by a \fIcontrol operator\fP. +The first word specifies the command to be executed, and is passed as argument zero. The remaining words are passed as arguments to the invoked command. .PP @@ -561,7 +561,8 @@ This connection is performed before any redirections specified by the .SM .B REDIRECTION below). -If \fB|&\fP is used, \fIcommand1\fP's standard error, in addition to its +If \fB|&\fP is the pipeline operator, +\fIcommand1\fP's standard error, in addition to its standard output, is connected to \fIcommand2\fP's standard input through the pipe; it is shorthand for \fB2>&1 |\fP. @@ -577,31 +578,32 @@ If the reserved word .B ! precedes a pipeline, the exit status of that pipeline is the logical negation of the exit status as described above. -The shell waits for all commands in the pipeline to +If a pipeline is executed synchronously, +the shell waits for all commands in the pipeline to terminate before returning a value. .PP If the .B time -reserved word precedes a pipeline, the elapsed as well as user and -system time consumed by its execution are reported when the pipeline -terminates. +reserved word precedes a pipeline, the shell reports the +elapsed as well as user and system time consumed by its execution +when the pipeline terminates. The \fB\-p\fP option changes the output format to that specified by POSIX. When the shell is in \fIposix mode\fP, it does not recognize \fBtime\fP as a reserved word if the next token begins with a .Q \- . -The +The value of the .SM .B TIMEFORMAT -variable may be set to a format string that specifies how the timing +variable is a format string that specifies how the timing information should be displayed; see the description of .SM .B TIMEFORMAT -under -.B "Shell Variables" -below. +below under +.BR "Shell Variables" . .PP When the shell is in \fIposix mode\fP, \fBtime\fP -may be followed by a newline. In this case, the shell displays the +may be followed by a newline. +In this case, the shell displays the total user and system time consumed by the shell and its children. The .SM @@ -618,8 +620,8 @@ See for a description of subshells and a subshell environment. If the \fBlastpipe\fP option is enabled using the \fBshopt\fP builtin (see the description of \fBshopt\fP below), -the last element of a pipeline may be run by the shell process -when job control is not active. +and job control is not active, +the last element of a pipeline may be run by the shell process. .SS Lists A \fIlist\fP is a sequence of one or more pipelines separated by one of the operators @@ -700,24 +702,24 @@ newline in place of a semicolon. below for a description of a subshell environment). Variable assignments and builtin commands that affect the shell's environment do not remain in effect -after the command completes. The return status is the exit status of -\fIlist\fP. +after the command completes. +The return status is the exit status of \fIlist\fP. .TP { \fIlist\fP; } -\fIlist\fP is simply executed in the current shell environment. +\fIlist\fP is executed in the current shell environment. \fIlist\fP must be terminated with a newline or semicolon. This is known as a \fIgroup command\fP. -The return status is the exit status of -\fIlist\fP. +The return status is the exit status of \fIlist\fP. +.IP Note that unlike the metacharacters \fB(\fP and \fB)\fP, \fB{\fP and \fB}\fP are \fIreserved words\fP and must occur where a reserved -word is permitted to be recognized. Since they do not cause a word -break, they must be separated from \fIlist\fP by whitespace or another -shell metacharacter. +word is permitted to be recognized. +Since they do not cause a word break, they must be separated from +\fIlist\fP by whitespace or another shell metacharacter. .TP ((\fIexpression\fP)) -The \fIexpression\fP is evaluated according to the rules described -below under +The arithmetic \fIexpression\fP is evaluated according to the rules +described below under .SM .BR "ARITHMETIC EVALUATION" . If the value of the expression is non-zero, the return status is 0; @@ -725,13 +727,13 @@ otherwise the return status is 1. The \fIexpression\fP undergoes the same expansions as if it were within double quotes, -but double quote characters in \fIexpression\fP are not treated specially -and are removed. +but double quote characters in \fIexpression\fP are not treated +specially and are removed. .TP \fB[[\fP \fIexpression\fP \fB]]\fP .PD -Return a status of 0 or 1 depending on the evaluation of -the conditional expression \fIexpression\fP. +Evaluate the conditional expression \fIexpression\fP +and return a status of zero (true) or non-zero (false). Expressions are composed of the primaries described below under .SM .BR "CONDITIONAL EXPRESSIONS" . @@ -757,8 +759,9 @@ shell option is enabled, the match is performed without regard to the case of alphabetic characters. The return value is 0 if the string matches (\fB==\fP) or does not match (\fB!=\fP) the pattern, and 1 otherwise. -Any part of the pattern may be quoted to force the quoted portion -to be matched as a string. +If any part of the pattern is quoted, the quoted portion is matched +as a string: every character in the quoted portion matches itself, +instead of having any special pattern matching meaning. .IP An additional binary operator, \fB=\*~\fP, is available, with the same precedence as \fB==\fP and \fB!=\fP. @@ -775,9 +778,9 @@ If the .B nocasematch shell option is enabled, the match is performed without regard to the case of alphabetic characters. -If any part of the pattern is quoted, the quoted portion is matched literally. -This means every character in the quoted portion matches itself, -instead of having any special pattern matching meaning. +.IP +If any part of the pattern is quoted, the quoted portion is matched literally, +as above. If the pattern is stored in a shell variable, quoting the variable expansion forces the entire pattern to be matched literally. Treat bracket expressions in regular expressions carefully, @@ -787,6 +790,7 @@ between brackets. The pattern will match if it matches any part of the string. Anchor the pattern using the \fB\*^\fP and \fB$\fP regular expression operators to force it to match the entire string. +.IP The array variable .SM .B BASH_REMATCH @@ -800,7 +804,8 @@ Substrings matched by parenthesized subexpressions within the regular expression are saved in the remaining .SM .B BASH_REMATCH -indices. The element of +indices. +The element of .SM .B BASH_REMATCH with index \fIn\fP is the portion of the @@ -848,9 +853,9 @@ the entire conditional expression. .RE .TP \fBfor\fP \fIname\fP [ [ \fBin\fP [ \fIword .\|.\|.\&\fP ] ] ; ] \fBdo\fP \fIlist\fP ; \fBdone\fP -The list of words following \fBin\fP is expanded, generating a list +First, expand The list of words following \fBin\fP, generating a list of items. -The variable \fIname\fP is set to each element of this list +Then, the variable \fIname\fP is set to each element of this list in turn, and \fIlist\fP is executed each time. If the \fBin\fP \fIword\fP is omitted, the \fBfor\fP command executes \fIlist\fP once for each positional parameter that is set (see @@ -862,23 +867,32 @@ If the expansion of the items following \fBin\fP results in an empty list, no commands are executed, and the return status is 0. .TP \fBfor\fP (( \fIexpr1\fP ; \fIexpr2\fP ; \fIexpr3\fP )) ; \fBdo\fP \fIlist\fP ; \fBdone\fP -First, the arithmetic expression \fIexpr1\fP is evaluated according +First, evaluate the arithmetic expression \fIexpr1\fP according to the rules described below under .SM .BR "ARITHMETIC EVALUATION" . -The arithmetic expression \fIexpr2\fP is then evaluated repeatedly +Then, repeatedly evaluate the arithmetic expression \fIexpr2\fP until it evaluates to zero. -Each time \fIexpr2\fP evaluates to a non-zero value, \fIlist\fP is -executed and the arithmetic expression \fIexpr3\fP is evaluated. +Each time \fIexpr2\fP evaluates to a non-zero value, +execute \fIlist\fP +and evaluate the arithmetic expression \fIexpr3\fP. If any expression is omitted, it behaves as if it evaluates to 1. The return value is the exit status of the last command in \fIlist\fP -that is executed, or false if any of the expressions is invalid. +that is executed, or non-zero if any of the expressions is invalid. +.IP +Use the \fBbreak\fP and \fPcontinue\fP builtins +(see +.SM +.B "SHELL BUILTIN COMMANDS" +below) +to control loop execution. .TP \fBselect\fP \fIname\fP [ \fBin\fP \fIword\fP ] ; \fBdo\fP \fIlist\fP ; \fBdone\fP -The list of words following \fBin\fP is expanded, generating a list -of items, and the set of expanded words is printed on the standard -error, each preceded by a number. If the \fBin\fP -\fIword\fP is omitted, the positional parameters are printed (see +First, expand the list of words following \fBin\fP, +generating a list of items, and print the set of expanded words +the standard error, each preceded by a number. +If the \fBin\fP +\fIword\fP is omitted, print the positional parameters (see .SM .B PARAMETERS below). @@ -888,14 +902,15 @@ then displays the .B PS3 prompt and reads a line from the standard input. If the line consists of a number corresponding to one of -the displayed words, then the value of +the displayed words, then \fBselect\fP sets the value of .I name -is set to that word. -If the line is empty, the words and prompt are displayed again. -If EOF is read, the \fBselect\fP command completes and returns 1. -Any other value read causes +to that word. +If the line is empty, \fBselect\fP displays the words and prompt again. +If EOF is read, \fBselect\fP completes and returns 1. +Any other value sets .I name -to be set to null. The line read is saved in the variable +to null. +The line read is saved in the variable .SM .BR REPLY . The @@ -913,10 +928,14 @@ or zero if no commands were executed. .\|.\|.\& ) \fIlist\fP ;; ] .\|.\|.\& \ \fBesac\fP A \fBcase\fP command first expands \fIword\fP, and tries to match -it against each \fIpattern\fP in turn, using the matching rules +it against each \fIpattern\fP in turn, +proceeding from first to last, +using the matching rules described under .B Pattern Matching below. +A pattern list is a set of one or more patterns separated by \|, +and the ) operator terminates the pattern list. The \fIword\fP is expanded using tilde expansion, parameter and variable expansion, arithmetic expansion, command substitution, process substitution and quote removal. @@ -927,18 +946,21 @@ If the .B nocasematch shell option is enabled, the match is performed without regard to the case of alphabetic characters. -When a match is found, the corresponding \fIlist\fP is executed. -If the \fB;;\fP operator is used, no subsequent matches are attempted after -the first pattern match. +A \fIclause\fP is a pattern list and an associated \fIlist\fP. +.IP +When a match is found, \fBcase\fP executes the corresponding \fIlist\fP. +If the \fB;;\fP operator terminates the case clause, the \fBcase\fP +command completes after the first match. Using \fB;&\fP in place of \fB;;\fP causes execution to continue with -the \fIlist\fP associated with the next set of patterns. +the \fIlist\fP associated with the next pattern list. Using \fB;;&\fP in place of \fB;;\fP causes the shell to test the next pattern list in the statement, if any, and execute any associated \fIlist\fP -on a successful match, +if the match succeeds. continuing the case statement execution as if the pattern list had not matched. -The exit status is zero if no -pattern matches. Otherwise, it is the exit status of the -last command executed in \fIlist\fP. +The exit status is zero if no pattern matches. +.IP +Otherwise, it is the exit status of the +last command executed in the last \fIlist\fP executed. .TP \fBif\fP \fIlist\fP; \fBthen\fP \fIlist\fP; \ [ \fBelif\fP \fIlist\fP; \fBthen\fP \fIlist\fP; ] .\|.\|.\& \ @@ -946,12 +968,14 @@ last command executed in \fIlist\fP. The .B if .I list -is executed. If its exit status is zero, the -\fBthen\fP \fIlist\fP is executed. Otherwise, each \fBelif\fP -\fIlist\fP is executed in turn, and if its exit status is zero, -the corresponding \fBthen\fP \fIlist\fP is executed and the -command completes. Otherwise, the \fBelse\fP \fIlist\fP is -executed, if present. The exit status is the exit status of the +is executed. +If its exit status is zero, the +\fBthen\fP \fIlist\fP is executed. +Otherwise, each \fBelif\fP \fIlist\fP is executed in turn, +and if its exit status is zero, the corresponding \fBthen\fP \fIlist\fP +is executed and the command completes. +Otherwise, the \fBelse\fP \fIlist\fP is executed, if present. +The exit status is the exit status of the last command executed, or zero if no condition tested true. .TP \fBwhile\fP \fIlist-1\fP; \fBdo\fP \fIlist-2\fP; \fBdone\fP @@ -961,7 +985,8 @@ last command executed, or zero if no condition tested true. .PD The \fBwhile\fP command continuously executes the list \fIlist-2\fP as long as the last command in the list \fIlist-1\fP returns -an exit status of zero. The \fBuntil\fP command is identical +an exit status of zero. +The \fBuntil\fP command is identical to the \fBwhile\fP command, except that the test is negated: .I list-2 is executed as long as the last command in @@ -996,7 +1021,7 @@ The recommended form to use for a coprocess is \fBcoproc\fP \fINAME\fP { \fIcommand\fP [\fIredirections\fP]; } .RE .PP -This form is recommended because simple commands result in the coprocess +This form is preferred because simple commands result in the coprocess always being named \fBCOPROC\fP, and it is simpler to use and more complete than the other compound commands. .PP @@ -1032,7 +1057,7 @@ the file descriptors are not available in subshells. The process ID of the shell spawned to execute the coprocess is available as the value of the variable \fINAME\fP_PID. The \fBwait\fP -builtin command may be used to wait for the coprocess to terminate. +builtin may be used to wait for the coprocess to terminate. .PP Since the coprocess is created as an asynchronous command, the \fBcoproc\fP command always returns success. @@ -1060,15 +1085,16 @@ parentheses are not supplied, the braces are recommended. \fIcompound\-command\fP is executed whenever \fIfname\fP is specified as the name of a simple command. When in \fIposix mode\fP, \fIfname\fP must be a valid shell \fIname\fP -and may not be the name of one of the -POSIX \fIspecial builtins\fP. +and may not be the name of one of the POSIX \fIspecial builtins\fP. In default mode, a function name can be any unquoted shell word that does not contain \fB$\fP. +.PP Any redirections (see .SM .B REDIRECTION below) specified when a function is defined are performed when the function is executed. +.PP The exit status of a function definition is zero unless a syntax error occurs or a readonly function with the same name already exists. When executed, the exit status of a function is the exit status of the @@ -1086,15 +1112,21 @@ builtin is enabled (see .B "SHELL BUILTIN COMMANDS" below), a word beginning with .B # -causes that word and all remaining characters on that line to -be ignored. An interactive shell without the +introduces a comment. +A word begins at the beginning of a line, after unquoted whitespace, or +after an operator. +The comment causes that word and all remaining characters on that line to +be ignored. +An interactive shell without the .B interactive_comments -option enabled does not allow comments. The +option enabled does not allow comments. +The .B interactive_comments -option is on by default in interactive shells. +option is enabled by default in interactive shells. .SH QUOTING \fIQuoting\fP is used to remove the special meaning of certain -characters or words to the shell. Quoting can be used to +characters or words to the shell. +Quoting can be used to disable special treatment for special characters, to prevent reserved words from being recognized as such, and to prevent parameter expansion. @@ -1113,20 +1145,23 @@ below), the \fIhistory expansion\fP character, usually \fB!\fP, must be quoted to prevent history expansion. .PP -There are three quoting mechanisms: the +There are four quoting mechanisms: the .IR "escape character" , -single quotes, and double quotes. +single quotes, double quotes, +and dollar-single quotes. .PP A non-quoted backslash (\fB\e\fP) is the .IR "escape character" . It preserves the literal value of the next character that follows, -with the exception of . If a \fB\e\fP pair -appears, and the backslash is not itself quoted, the \fB\e\fP -is treated as a line continuation (that is, it is removed from the -input stream and effectively ignored). +removing any special meaning it has, +with the exception of . +If a \fB\e\fP pair appears, and the backslash is not itself quoted, +the \fB\e\fP is treated as a line continuation (that is, it is +removed from the input stream and effectively ignored). .PP Enclosing characters in single quotes preserves the literal value -of each character within the quotes. A single quote may not occur +of each character within the quotes. +A single quote may not occur between single quotes, even when preceded by a backslash. .PP Enclosing characters in double quotes preserves the literal value @@ -1136,21 +1171,25 @@ of all characters within the quotes, with the exception of .BR \e , and, when history expansion is enabled, .BR ! . -When the shell is in \fIposix mode\fP, the \fB!\fP has no special meaning +When the shell is in \fIposix mode\fP, +the \fB!\fP has no special meaning within double quotes, even when history expansion is enabled. The characters .B $ and .B \` -retain their special meaning within double quotes. The backslash -retains its special meaning only when followed by one of the following -characters: +retain their special meaning within double quotes. +The backslash retains its special meaning only when followed by one of +the following characters: .BR $ , .BR \` , \^\fB\*"\fP\^, .BR \e , or .BR . +Backslashes preceding characters without a +special meaning are left unmodified. +.PP A double quote may be quoted within double quotes by preceding it with a backslash. If enabled, history expansion will be performed unless an @@ -1239,7 +1278,7 @@ a control-\fIx\fP character .LP The expanded result is single-quoted, as if the dollar sign had not been present. -.PP +.SS "Translating Strings" A double-quoted string preceded by a dollar sign (\fB$\fP\*"\fIstring\fP\*") will cause the string to be translated according to the current locale. The \fIgettext\fP infrastructure performs the lookup and @@ -1247,8 +1286,8 @@ translation, using the \fBLC_MESSAGES\fP, \fBTEXTDOMAINDIR\fP, and \fBTEXTDOMAIN\fP shell variables. If the current locale is \fBC\fP or \fBPOSIX\fP, if there are no translations available, -or if the string is not translated, -the dollar sign is ignored. +or if the string is not translated, the dollar sign is ignored, +and the string is treated as double-quoted as described above. This is a form of double quoting, so the string remains double-quoted by default, whether or not it is translated and replaced. If the \fBnoexpand_translation\fP option is enabled @@ -1279,14 +1318,15 @@ builtin command (see below in .SM .BR "SHELL BUILTIN COMMANDS" ). +The \fBexport\fP and \fBreadonly\fP builtins assign specific attributes. .PP -A parameter is set if it has been assigned a value. The null string is -a valid value. Once a variable is set, it may be unset only by using -the +A parameter is set if it has been assigned a value. +The null string is a valid value. +Once a variable is set, it may be unset only by using the .B unset builtin command (see .SM -.B SHELL BUILTIN COMMANDS +.B "SHELL BUILTIN COMMANDS" below). .PP A @@ -1299,14 +1339,16 @@ may be assigned to by a statement of the form .PP If .I value -is not given, the variable is assigned the null string. All +is not given, the variable is assigned the null string. +All .I values undergo tilde expansion, parameter and variable expansion, command substitution, arithmetic expansion, and quote removal (see .SM .B EXPANSION -below). If the variable has its +below). +If the variable has its .B integer attribute set, then .I value @@ -1330,13 +1372,16 @@ one or more instances of the \fBcommand\fP builtin and retain these assignment statement properties. .PP In the context where an assignment statement is assigning a value -to a shell variable or array index, the += operator can be used to +to a shell variable or array index, the += operator will append to or add to the variable's previous value. -This includes arguments to builtin commands such as \fBdeclare\fP that -accept assignment statements (\fIdeclaration\fP commands). -When += is applied to a variable for which the \fBinteger\fP attribute has been -set, \fIvalue\fP is evaluated as an arithmetic expression and added to the -variable's current value, which is also evaluated. +This includes arguments to \fIdeclaration\fP commands such as +\fBdeclare\fP that accept assignment statements. +When += is applied to a variable for which the \fBinteger\fP attribute +has been set, +the variable's current value and \fIvalue\fP are each evaluated as +arithmetic expressions, +and the sum of the results is assigned as the variable's value. +The current value is usually an integer constant, but may be an expression. When += is applied to an array variable using compound assignment (see .B Arrays below), the @@ -1368,8 +1413,8 @@ declare \-n ref=$1 .EE .RE .PP -inside the function creates a nameref variable \fBref\fP whose value is -the variable name passed as the first argument. +inside the function creates a local nameref variable \fBref\fP whose value +is the variable name passed as the first argument. References and assignments to \fBref\fP, and changes to its attributes, are treated as references, assignments, and attribute modifications to the variable whose name was passed as \fB$1\fP. @@ -1387,12 +1432,15 @@ as an argument, the variable referenced by the nameref variable will be unset. A .I positional parameter is a parameter denoted by one or more -digits, other than the single digit 0. Positional parameters are +digits, other than the single digit 0. +Positional parameters are assigned from the shell's arguments when it is invoked, and may be reassigned using the .B set -builtin command. Positional parameters may not be assigned to -with assignment statements. The positional parameters are +builtin command. +Positional parameters may not be assigned to +with assignment statements. +The positional parameters are temporarily replaced when a shell function is executed (see .SM .B FUNCTIONS @@ -1403,22 +1451,28 @@ digit is expanded, it must be enclosed in braces (see .SM .B EXPANSION below). +Without braces, a digit following $ can only refer to +one of the first nine positional parameters (\fB$1\-$9\fP) or the +special parameter \fB$0\fP (see the next section). .SS Special Parameters -The shell treats several parameters specially. These parameters may -only be referenced; assignment to them is not allowed. +The shell treats several parameters specially. +These parameters may only be referenced; assignment to them is +not allowed. +Special parameters are denoted by one of the following characters. .PD 0 .TP .B * -Expands to the positional parameters, starting from one. +(\fB$*\fP) Expands to the positional parameters, starting from one. When the expansion is not within double quotes, each positional parameter expands to a separate word. -In contexts where these expansions are performed, those words +In contexts where word expansions are performed, those words are subject to further word splitting and pathname expansion. -When the expansion occurs within double quotes, it expands to a single word -with the value of each parameter separated by the first character of the +When the expansion occurs within double quotes, it expands to a +single word with the value of each parameter separated by the first +character of the .SM .B IFS -special variable. +variable. That is, .B \*"$*\*" is equivalent to @@ -1428,7 +1482,8 @@ where is the first character of the value of the .SM .B IFS -variable. If +variable. +If .SM .B IFS is unset, the parameters are separated by spaces. @@ -1438,23 +1493,26 @@ If is null, the parameters are joined without intervening separators. .TP .B @ -Expands to the positional parameters, starting from one. +(\fB$@\fP) Expands to the positional parameters, starting from one. In contexts where word splitting is performed, this expands each positional parameter to a separate word; if not within double quotes, these words are subject to word splitting. In contexts where word splitting is not performed, +such as the value portion of an assignment statement, this expands to a single word with each positional parameter separated by a space. When the expansion occurs within double quotes, +and word splitting is performed, each parameter expands to a separate word. That is, .B \&\*"$@\*" is equivalent to .B \&\*"\&$1\&\*"\ \*"$2\*"\ .\|.\|. If the double-quoted expansion occurs within a word, the expansion of -the first parameter is joined with the beginning part of the original -word, and the expansion of the last parameter is joined with the last -part of the original word. +the first parameter is joined with the expansion of the +beginning part of the original word, +and the expansion of the last parameter is joined with the +expansion of the last part of the original word. When there are no positional parameters, .B \&\*"$@\*" and @@ -1462,13 +1520,13 @@ and expand to nothing (i.e., they are removed). .TP .B # -Expands to the number of positional parameters in decimal. +(\fB$#\fP) Expands to the number of positional parameters in decimal. .TP .B ? -Expands to the exit status of the most recently executed command. +(\fB$?\fP) Expands to the exit status of the most recently executed command. .TP .B \- -Expands to the current option flags as specified upon invocation, +(\fB$\-\fP) Expands to the current option flags as specified upon invocation, by the .B set builtin command, or those set by the shell itself @@ -1477,12 +1535,12 @@ builtin command, or those set by the shell itself option). .TP .B $ -Expands to the process ID of the shell. In a subshell, it -expands to the process ID of the current shell, not the -subshell. +(\fB$$\fP) Expands to the process ID of the shell. +In a subshell, it expands to the process ID of the parent shell, +not the subshell. .TP .B ! -Expands to the process ID of the job most recently placed into the +(\fB$!\fP)Expands to the process ID of the job most recently placed into the background, whether executed as an asynchronous command or using the \fBbg\fP builtin (see .SM @@ -1490,37 +1548,37 @@ the \fBbg\fP builtin (see below). .TP .B 0 -Expands to the name of the shell or shell script. This is set at -shell initialization. If -.B bash -is invoked with a file of commands, +(\fB$0\fP) Expands to the name of the shell or shell script. +This is set at shell initialization. +If \fBbash\fP is invoked with a file of commands, .B $0 -is set to the name of that file. If -.B bash -is started with the +is set to the name of that file. +If \fBbash\fP is started with the .B \-c option, then .B $0 is set to the first argument after the string to be -executed, if one is present. Otherwise, it is set -to the filename used to invoke +executed, if one is present. +Otherwise, it is set to the filename used to invoke .BR bash , as given by argument zero. .PD .SS Shell Variables -The following variables are set by the shell: +The shell sets following variables: .PP .PD 0 .TP .B _ -At shell startup, set to the pathname used to invoke the +(\fB$_\fP, an underscore) +This has a number of meanings depending on context. +At shell startup, \fB_\fP is set to the pathname used to invoke the shell or shell script being executed as passed in the environment or argument list. -Subsequently, expands to the last argument to the previous simple +Subsequently, it expands to the last argument to the previous simple command executed in the foreground, after expansion. -Also set to the full pathname used to invoke each command executed +It is also set to the full pathname used to invoke each command executed and placed in the environment exported to that command. -When checking mail, this parameter holds the name of the mail file +When checking mail, \fB$_\fP expands to the name of the mail file currently being checked. .TP .B BASH @@ -1536,7 +1594,8 @@ option to the builtin command (see .SM .B "SHELL BUILTIN COMMANDS" -below). The options appearing in +below). +The options appearing in .SM .B BASHOPTS are those reported as @@ -1544,7 +1603,7 @@ are those reported as by \fBshopt\fP. If this variable is in the environment when .B bash -starts up, each shell option in the list will be enabled before +starts up, the shell enables each option in the list before reading any startup files. This variable is read-only. .TP @@ -1565,7 +1624,7 @@ subsequently reset. An associative array variable whose members correspond to the internal list of aliases as maintained by the \fBalias\fP builtin. Elements added to this array appear in the alias list; however, -unsetting array elements currently does not cause aliases to be removed +unsetting array elements currently does not remove aliases from the alias list. If .B BASH_ALIASES @@ -1575,9 +1634,8 @@ subsequently reset. .B BASH_ARGC An array variable whose values are the number of parameters in each frame of the current \fBbash\fP execution call stack. -The number of -parameters to the current subroutine (shell function or script executed -with \fB.\fP or \fBsource\fP) is at the top of the stack. +The number of parameters to the current subroutine (shell function or +script executed with \fB.\fP or \fBsource\fP) is at the top of the stack. When a subroutine is executed, the number of parameters passed is pushed onto .SM .BR BASH_ARGC . @@ -1599,10 +1657,10 @@ have no effect, and it may not be unset. .TP .B BASH_ARGV An array variable containing all of the parameters in the current \fBbash\fP -execution call stack. The final parameter of the last subroutine call -is at the top of the stack; the first parameter of the initial call is -at the bottom. When a subroutine is executed, the parameters supplied -are pushed onto +execution call stack. +The final parameter of the last subroutine call is at the top of the stack; +the first parameter of the initial call is at the bottom. +When a subroutine is executed, the shell pushes the supplied parameters onto .SM .BR BASH_ARGV . The shell sets @@ -1627,9 +1685,9 @@ When referenced, this variable expands to the name of the shell or shell script (identical to .BR $0 ; see the description of special parameter 0 above). -Assignment to +Assigning a value to .B BASH_ARGV0 -causes the value assigned to also be assigned to \fB$0\fP. +assigns the same value to \fB$0\fP. If .B BASH_ARGV0 is unset, it loses its special properties, even if it is @@ -1638,8 +1696,8 @@ subsequently reset. .B BASH_CMDS An associative array variable whose members correspond to the internal hash table of commands as maintained by the \fBhash\fP builtin. -Elements added to this array appear in the hash table; however, -unsetting array elements currently does not cause command names to be removed +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 .B BASH_CMDS @@ -1647,8 +1705,8 @@ is unset, it loses its special properties, even if it is subsequently reset. .TP .B BASH_COMMAND -The command currently being executed or about to be executed, unless the -shell is executing a command as the result of a trap, +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 .B BASH_COMMAND @@ -1679,18 +1737,11 @@ Assignments to have no effect, and it may not be unset. .TP .B BASH_LOADABLES_PATH -A colon-separated list of directories in which the shell looks for -dynamically loadable builtins specified by the +A colon-separated list of directories in which the .B enable command. -.TP -.B BASH_REMATCH -An array variable whose members are assigned by the \fB=\*~\fP binary -operator to the \fB[[\fP conditional command. -The element with index 0 is the portion of the string -matching the entire regular expression. -The element with index \fIn\fP is the portion of the -string matching the \fIn\fPth parenthesized subexpression. +looks for +dynamically loadable builtins. .TP .B BASH_MONOSECONDS Each time this variable is referenced, it expands to the value returned @@ -1701,6 +1752,14 @@ If is unset, it loses its special properties, even if it is subsequently reset. .TP +.B BASH_REMATCH +An array variable whose members are assigned by the \fB=\*~\fP binary +operator to the \fB[[\fP conditional command. +The element with index 0 is the portion of the string +matching the entire regular expression. +The element with index \fIn\fP is the portion of the +string matching the \fIn\fPth parenthesized subexpression. +.TP .B BASH_SOURCE An array variable whose members are the source filenames where the corresponding shell function names in the @@ -1730,7 +1789,7 @@ Set to the signal number corresponding to the trap action being executed during its execution. See the description of \fBtrap\fP under .SM -.B SHELL BUILTIN COMMANDS +.B "SHELL BUILTIN COMMANDS" below for information about signal numbers and trap execution. .TP .B BASH_VERSINFO @@ -1764,7 +1823,8 @@ The value of .TP .B BASH_VERSION Expands to a string describing the version of this instance of -.BR bash . +.B bash +(e.g., 5.2.37(3)-release). .TP .B COMP_CWORD An index into \fB${COMP_WORDS}\fP of the word containing the current @@ -1776,6 +1836,10 @@ below). .B COMP_KEY The key (or final key of a key sequence) used to invoke the current completion function. +This variable is available only in shell functions and external +commands invoked by the +programmable completion facilities (see \fBProgrammable Completion\fP +below). .TP .B COMP_LINE The current command line. @@ -1795,7 +1859,7 @@ programmable completion facilities (see \fBProgrammable Completion\fP below). .TP .B COMP_TYPE -Set to an integer value corresponding to the type of completion attempted +Set to an integer value corresponding to the type of attempted completion that caused a completion function to be called: \fITAB\fP, for normal completion, \fI?\fP, for listing completions after successive tabs, @@ -1954,9 +2018,9 @@ The default is system-dependent. .B LINENO 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. +(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 .SM .B LINENO @@ -1984,7 +2048,7 @@ The value of the last option argument processed by the .B getopts builtin command (see .SM -.B SHELL BUILTIN COMMANDS +.B "SHELL BUILTIN COMMANDS" below). .TP .B OPTIND @@ -1992,7 +2056,7 @@ The index of the next argument to be processed by the .B getopts builtin command (see .SM -.B SHELL BUILTIN COMMANDS +.B "SHELL BUILTIN COMMANDS" below). .TP .B OSTYPE @@ -2013,7 +2077,8 @@ consist of only a simple command above). .TP .B PPID -The process ID of the shell's parent. This variable is readonly. +The process ID of the shell's parent. +This variable is readonly. .TP .B PWD The current working directory as set by the @@ -2028,6 +2093,8 @@ a value to .SM .B RANDOM initializes (seeds) the sequence of random numbers. +Seeding the random number generator with the same constant value will +produce the same sequence of values. If .SM .B RANDOM @@ -2098,15 +2165,16 @@ is unset, it loses its special properties, even if it is subsequently reset. .TP .B SHELLOPTS -A colon-separated list of enabled shell options. Each word in -the list is a valid argument for the +A colon-separated list of enabled shell options. +Each word in the list is a valid argument for the .B \-o option to the .B set builtin command (see .SM .B "SHELL BUILTIN COMMANDS" -below). The options appearing in +below). +The options appearing in .SM .B SHELLOPTS are those reported as @@ -2114,7 +2182,7 @@ are those reported as by \fBset \-o\fP. If this variable is in the environment when .B bash -starts up, each shell option in the list will be enabled before +starts up, the shell enables each option in the list before reading any startup files. This variable is read-only. .TP @@ -2124,8 +2192,9 @@ Incremented by one each time an instance of is started. .TP .B SRANDOM -This variable expands to a 32-bit pseudo-random number each time it is -referenced. The random number generator is not linear on systems that +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 .FN /dev/urandom or @@ -2145,7 +2214,7 @@ Expands to the user ID of the current user, initialized at shell startup. This variable is readonly. .PD .PP -The following variables are used by the shell. In some cases, +The shell uses the following variables. In some cases, .B bash assigns a default value to a variable; these cases are noted below. @@ -2177,9 +2246,9 @@ The current version is also a valid value. .TP .B BASH_ENV If this parameter is set when \fBbash\fP is executing a shell script, -its value is interpreted as a filename containing commands to -initialize the shell, as in -.IR \*~/.bashrc . +its expanded value is interpreted as a filename containing commands to +initialize the shell before it reads and executes commands from the +script. The value of .SM .B BASH_ENV @@ -2214,8 +2283,8 @@ being closed. The search path for the .B cd command. -This is a colon-separated list of directories in which the shell looks -for destination directories specified by the +This is a colon-separated list of directories where the shell looks for +directories specified as arguments to the .B cd command. A sample value is @@ -2259,7 +2328,7 @@ when an interactive shell is invoked in \fIposix mode\fP. .TP .B EXECIGNORE A colon-separated list of shell patterns (see \fBPattern Matching\fP) -defining the list of filenames to be ignored by command search using +defining the set of filenames to be ignored by command search using \fBPATH\fP. Files whose full pathnames match one of these patterns are not considered executable files for the purposes of completion and command execution @@ -2292,7 +2361,8 @@ A sample value is .TP .B FUNCNEST If set to a numeric value greater than 0, defines a maximum function -nesting level. Function invocations that exceed this nesting level +nesting level. +Function invocations that exceed this nesting level will cause the current command to abort. .TP .B GLOBIGNORE @@ -2303,10 +2373,12 @@ of the patterns in .SM .BR GLOBIGNORE , it is removed from the list of matches. +The pattern matching honors the setting of the \fBextglob\fP shell +option. .TP .B GLOBSORT .PD -Control how the results of pathname expansion are sorted. +Controls how the results of pathname expansion are sorted. The value of this variable specifies the sort criteria and sort order for the results of pathname expansion. If this variable is unset or set to the null string, pathname expansion @@ -2324,11 +2396,13 @@ The valid sort specifiers are .IR ctime , and .IR blocks , -which sort the files on name, names in numeric rather than lexicographic order, +which sort the files on name, +names in numeric rather than lexicographic order, file size, modification time, access time, inode 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. +.IP For example, a value of \fI\-mtime\fP sorts the results in descending order by modification time (newest first). .IP @@ -2341,6 +2415,7 @@ the all-digit names and are sorted by name using the traditional behavior. A sort specifier of \fInosort\fP disables sorting completely; the results are returned in the order they are read from the file system, and any leading \fI+\fP or \fI\-\fP is ignored. +.IP If the sort specifier is missing, it defaults to \fIname\fP, so a value of \fI+\fP is equivalent to the null string, and a value of \fI-\fP sorts by name in descending order. @@ -2357,7 +2432,7 @@ lines which begin with a character are not saved in the history list. A value of .I ignoredups -causes lines matching the previous history entry to not be saved. +causes lines matching the previous history entry not to be saved. A value of .I ignoreboth is shorthand for \fIignorespace\fP and \fIignoredups\fP. @@ -2377,7 +2452,10 @@ subject to the value of The second and subsequent lines of a multi-line compound command are not tested, and are added to the history regardless of the value of .SM -.BR HISTCONTROL . +.B HISTCONTROL +if the first line of the command was saved. +If the first line was not saved, the second and subsequent lines of +the command are not saved either. .TP .B HISTFILE The name of the file in which command history is saved (see @@ -2386,15 +2464,15 @@ The name of the file in which command history is saved (see below). \fBBash\fP assigns a default value of \fI\*~/.bash_history\fP. If \fBHISTFILE\fP is unset or null, -the command history is not saved when a shell exits. +the shell does not save the command history when it exits. .TP .B HISTFILESIZE -The maximum number of lines contained in the history file. When this -variable is assigned a value, the history file is truncated, if -necessary, -to contain no more than that number of lines by removing the oldest entries. +The maximum number of lines contained in the history file. +When this variable is assigned a value, the history file is truncated, +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. +writing it when a shell exits or by the \fBhistory\fP 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 \fBHISTSIZE\fP @@ -2426,6 +2504,8 @@ The second and subsequent lines of a multi-line compound command are not tested, and are added to the history regardless of the value of .SM .BR HISTIGNORE . +If the first line was not saved, the second and subsequent lines of +the command are not saved either. The pattern matching honors the setting of the \fBextglob\fP shell option. .TP @@ -2445,7 +2525,7 @@ for .IR strftime (3) to print the time stamp associated with each history entry displayed by the \fBhistory\fP builtin. -If this variable is set, time stamps are written to the history file so +If this variable is set, the shell writes time stamps to the history file so they may be preserved across shell sessions. This uses the history comment character to distinguish timestamps from other history lines. @@ -2485,7 +2565,11 @@ that is used for word splitting after expansion and to split lines into words with the .B read -builtin command. The default value is +builtin command. +Word splitting is described above under +.SM +.BR EXPANSION . +The default value is .Q . .TP .B IGNOREEOF @@ -2493,15 +2577,18 @@ Controls the action of an interactive shell on receipt of an .SM .B EOF -character as the sole input. If set, the value is the number of -consecutive +character as the sole input. +If set, the value is the number of consecutive .SM .B EOF characters which must be typed as the first characters on an input line before .B bash -exits. If the variable exists but does not have a numeric value, or -has no value, the default value is 10. If it does not exist, +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, .SM .B EOF signifies the end of input to the shell. @@ -2564,7 +2651,7 @@ option is enabled or in an interactive shell upon receipt of a .BR SIGWINCH . .TP .B MAIL -If this parameter is set to a file or directory name and the +If the value is set to a file or directory name and the .SM .B MAILPATH variable is not set, @@ -2576,8 +2663,10 @@ Maildir-format directory. Specifies how often (in seconds) .B bash -checks for mail. The default is 60 seconds. When it is time to check -for mail, the shell does so before displaying the primary prompt. +checks for mail. +The default 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. .TP @@ -2609,7 +2698,7 @@ displays error messages generated by the .B getopts builtin command (see .SM -.B SHELL BUILTIN COMMANDS +.B "SHELL BUILTIN COMMANDS" below). .SM .B OPTERR @@ -2617,8 +2706,8 @@ is initialized to 1 each time the shell is invoked or a shell script is executed. .TP .B PATH -The search path for commands. It -is a colon-separated list of directories in which +The search path for commands. +It is a colon-separated list of directories in which the shell looks for commands (see .SM .B COMMAND EXECUTION @@ -2661,7 +2750,8 @@ trailing directory components to retain when expanding the \fB\ew\fP and \fB\eW\fP prompt string escapes (see .SM .B PROMPTING -below). Characters removed are replaced with an ellipsis. +below). +Characters removed are replaced with an ellipsis. .TP .B PS0 The value of this parameter is expanded (see @@ -2674,14 +2764,16 @@ and before the command is executed. The value of this parameter is expanded (see .SM .B PROMPTING -below) and used as the primary prompt string. The default value is +below) and used as the primary prompt string. +The default value is .Q \es\-\ev\e$\ . .TP .B PS2 The value of this parameter is expanded as with .SM .B PS1 -and used as the secondary prompt string. The default is +and used as the secondary prompt string. +The default is .Q >\ . .TP .B PS3 @@ -2746,9 +2838,10 @@ The CPU percentage, computed as (%U + %S) / %R. The optional \fIp\fP is a digit specifying the \fIprecision\fP, the number of fractional digits after a decimal point. A value of 0 causes no decimal point or fraction to be output. -At most six places after the decimal point may be specified; +\fBtime\fP will print at most six digits after the decimal point; values of \fIp\fP greater than 6 are changed to 6. -If \fIp\fP is not specified, the value 3 is used. +If \fIp\fP is not specified, +\fBtime\fP prints three digits after the decimal point. .IP The optional \fBl\fP specifies a longer format, including minutes, of the form \fIMM\fPm\fISS\fP.\fIFF\fPs. @@ -2763,10 +2856,8 @@ A trailing newline is added when the format string is displayed. .TP .B TMOUT If set to a value greater than zero, -.SM -.B TMOUT -is treated as the -default timeout for the \fBread\fP builtin. +the \fBread\fP builtin uses the value as its +default timeout. The \fBselect\fP command terminates if input does not arrive after .SM @@ -2776,8 +2867,8 @@ In an interactive shell, the value is interpreted as the number of seconds to wait for a line of input after issuing the primary prompt. .B Bash -terminates after waiting for that number of seconds if a complete -line of input does not arrive. +terminates after waiting for that number of seconds if a +complete line of input does not arrive. .TP .B TMPDIR If set, \fBbash\fP uses its value as the name of a directory in which @@ -2785,11 +2876,14 @@ If set, \fBbash\fP uses its value as the name of a directory in which .TP .B auto_resume This variable controls how the shell interacts with the user and -job control. If this variable is set, single word simple +job control. +If this variable is set, single-word simple commands 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 the string typed, the job most recently -accessed is selected. The +of an existing stopped job. +There is no ambiguity allowed; if there is more than one job +beginning with the string typed, the most recently accessed job +is selected. +The .I name of a stopped job, in this context, is the command line used to start it. @@ -2815,7 +2909,8 @@ The two or three characters which control history expansion and tokenization (see .SM .B HISTORY EXPANSION -below). The first character is the \fIhistory expansion\fP character, +below). +The first character is the \fIhistory expansion\fP character, the character which signals the start of a history expansion, normally .Q \fB!\fP . @@ -2851,12 +2946,13 @@ Unless otherwise noted, indexed array indices must be non-negative integers. An indexed array is created automatically if any variable is assigned to using the syntax \fIname\fP[\fIsubscript\fP]=\fIvalue\fP. The .I subscript -is treated as an arithmetic expression that must evaluate to a number. +is treated as an arithmetic expression that must evaluate to a number +greater than or equal to zero. To explicitly declare an indexed array, use .B declare \-a \fIname\fP (see .SM -.B SHELL BUILTIN COMMANDS +.B "SHELL BUILTIN COMMANDS" below). .B declare \-a \fIname\fP[\fIsubscript\fP] is also accepted; the \fIsubscript\fP is ignored. @@ -2869,9 +2965,10 @@ specified for an array variable using the .B declare and .B readonly -builtins. Each attribute applies to all members of an array. +builtins. +Each attribute applies to all members of an array. .PP -Arrays are assigned to using compound assignments of the form +Arrays are assigned using compound assignments of the form \fIname\fP=\fB(\fPvalue\fI1\fP .\|.\|.\& value\fIn\fP\fB)\fP, where each \fIvalue\fP may be of the form [\fIsubscript\fP]=\fIstring\fP. Indexed array assignments do not require anything but \fIstring\fP. @@ -2883,10 +2980,12 @@ but \fIvalue\fPs that are valid variable assignments including the brackets and subscript do not undergo brace expansion and word splitting, as with individual variable assignments. +.PP When assigning to indexed arrays, if the optional brackets and subscript 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. +to by the statement plus one. +Indexing starts at zero. .PP When assigning to an associative array, the words in a compound assignment may be either assignment statements, for which the subscript is required, @@ -2903,8 +3002,10 @@ a final missing value is treated like the empty string. .PP This syntax is also accepted by the .B declare -builtin. Individual array elements may be assigned to using the +builtin. +Individual array elements may be assigned to using the \fIname\fP[\fIsubscript\fP]=\fIvalue\fP syntax introduced above. +.PP When assigning to an indexed array, if .I name is subscripted by a negative number, that number is @@ -2918,32 +3019,38 @@ using the compound assignment syntax; see .B PARAMETERS above. .PP -Any element of an array may be referenced using -${\fIname\fP[\fIsubscript\fP]}. The braces are required to avoid -conflicts with pathname expansion. If -\fIsubscript\fP is \fB@\fP or \fB*\fP, the word expands to +An array element is referenced using +${\fIname\fP[\fIsubscript\fP]}. +The braces are required to avoid conflicts with pathname expansion. +If \fIsubscript\fP is \fB@\fP or \fB*\fP, the word expands to all members of \fIname\fP, 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 double-quoted, -${\fIname\fP[*]} expands to a single +word appears within double quotes. +If the word is double-quoted, ${\fIname\fP[*]} expands to a single word with the value of each array member separated by the first character of the .SM .B IFS special variable, and ${\fIname\fP[@]} expands each element of -\fIname\fP to a separate word. When there are no array members, -${\fIname\fP[@]} expands to nothing. +\fIname\fP to a separate word. +When there are no array members, ${\fIname\fP[@]} 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 original -word, and the expansion of the last parameter is joined with the last -part of the original word. +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 \fB*\fP and \fB@\fP (see .B Special Parameters -above). ${#\fIname\fP[\fIsubscript\fP]} expands to the length of -${\fIname\fP[\fIsubscript\fP]}. If \fIsubscript\fP is \fB*\fP or -\fB@\fP, the expansion is the number of elements in the array. +above). +.PP +${#\fIname\fP[\fIsubscript\fP]} expands to the length of +${\fIname\fP[\fIsubscript\fP]}. +If \fIsubscript\fP is \fB*\fP or \fB@\fP, +the expansion is the number of elements in the array. +.PP If the .I subscript used to reference an element of an indexed array @@ -2959,7 +3066,8 @@ Any reference to a variable using a valid subscript is valid, and will create an array if necessary. .PP An array variable is considered set if a subscript has been assigned a -value. The null string is a valid value. +value. +The null string is a valid value. .PP It is possible to obtain the keys (indices) of an array as well as the values. ${\fB!\fP\fIname\fP[\fI@\fP]} and ${\fB!\fP\fIname\fP[\fI*\fP]} @@ -2969,16 +3077,18 @@ special parameters \fI@\fP and \fI*\fP within double quotes. .PP The .B unset -builtin is used to destroy arrays. \fBunset\fP \fIname\fP[\fIsubscript\fP] -destroys the array element at index \fIsubscript\fP, +builtin is used to destroy arrays. +\fBunset\fP \fIname\fP[\fIsubscript\fP] +unsets the array element at index \fIsubscript\fP, for both indexed and associative arrays. Negative subscripts to indexed arrays are interpreted as described above. Unsetting the last element of an array variable does not unset the variable. \fBunset\fP \fIname\fP, where \fIname\fP is an array, removes the entire array. -\fBunset\fP \fIname\fP[\fIsubscript\fP], where -\fIsubscript\fP is \fB*\fP or \fB@\fP, behaves differently depending on -whether \fIname\fP is an indexed or associative array. +\fBunset\fP \fIname\fP[\fIsubscript\fP] +behaves differently depending on +whether \fIname\fP is an indexed or associative array +when \fIsubscript\fP is \fB*\fP or \fB@\fP. If \fIname\fP is an associative array, this unsets the element with subscript \fB*\fP or \fB@\fP. If \fIname\fP is an indexed array, unset removes all of the elements but @@ -2986,8 +3096,11 @@ does not remove the array itself. .PP When using a variable name with a subscript as an argument to a command, such as with \fBunset\fP, without using the word expansion syntax -described above, the argument is subject to pathname expansion. -If pathname expansion is not desired, the argument should be quoted. +described 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]\*'). .PP The .BR declare , @@ -3007,12 +3120,17 @@ The builtin accepts a .B \-a option to assign a list of words read from the standard input -to an array. The +to an array. +The .B set and .B declare 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., \fBmapfile\fP); see the descriptions +of individual builtins below for details. +The shell provides a number of builtin array variables. .SH EXPANSION Expansion is performed on the command line after it has been split into words. The shell performs these expansions: @@ -3059,11 +3177,12 @@ as explained above (see .BR PARAMETERS ). .SS Brace Expansion .I "Brace expansion" -is a mechanism by which arbitrary strings -may be generated. This mechanism is similar to +is a mechanism to generate arbitrary strings +sharing a common prefix and suffix, either of which can be empty. +This mechanism is similar to \fIpathname expansion\fP, but the filenames generated -need not exist. Patterns to be brace expanded take -the form of an optional +need not exist. +Patterns to be brace expanded are formed from an optional .IR preamble , followed by either a series of comma-separated strings or a sequence expression between a pair of braces, followed by @@ -3095,11 +3214,13 @@ using the default C locale. Note that both \fIx\fP and \fIy\fP must be of the same type (integer or letter). When the increment is supplied, it is used as the difference between -each term. The default increment is 1 or \-1 as appropriate. +each term. +The default increment is 1 or \-1 as appropriate. .PP Brace expansion is performed before any other expansions, and any characters special to other expansions are preserved -in the result. It is strictly textual. +in the result. +It is strictly textual. .B Bash does not apply any syntactic interpretation to the context of the expansion or the text between the braces. @@ -3108,6 +3229,7 @@ A correctly-formed brace expansion must contain unquoted opening and closing braces, and at least one unquoted comma or a valid sequence expression. Any incorrectly formed brace expansion is left unchanged. +.PP A \fB{\fP or \fB,\fP may be quoted with a backslash to prevent its being considered part of a brace expression. To avoid conflicts with parameter expansion, the string \fB${\fP @@ -3134,17 +3256,15 @@ does not treat opening or closing braces specially when they appear as part of a word, and preserves them in the output. .B Bash removes braces from words as a consequence of brace -expansion. For example, a word entered to +expansion. +For example, a word entered to .B sh as \fIfile{1,2}\fP -appears identically in the output. The same word is -output as +appears identically in the output. +\fBBash\fP outputs that word as .I file1 file2 -after expansion by -.BR bash . -If strict compatibility with -.B sh -is desired, start +after brace expansion. +Start .B bash with the .B +B @@ -3154,8 +3274,8 @@ option to the .B set command (see .SM -.B SHELL BUILTIN COMMANDS -below). +.B "SHELL BUILTIN COMMANDS" +below) for strict \fBsh\fP compatibility. .SS Tilde Expansion If a word begins with an unquoted tilde character (\c .Q \fB\*~\fP ), @@ -3172,8 +3292,8 @@ value of the shell parameter If .SM .B HOME -is unset, the home directory of the user executing the shell is -substituted instead. +is unset, the tilde expands to +the home directory of the user executing the shell instead. Otherwise, the tilde-prefix is replaced with the home directory associated with the specified login name. .PP @@ -3185,10 +3305,10 @@ the value of the shell variable replaces the tilde-prefix. If the tilde-prefix is a .Q \*~\- , -the value of the shell variable +the shell substitutes the value of the shell variable .SM .BR OLDPWD , -if it is set, is substituted. +if it is set. If the characters following the tilde in the tilde-prefix consist of a number \fIN\fP, optionally prefixed by a @@ -3198,7 +3318,8 @@ or a the tilde-prefix is replaced with the corresponding element from the directory stack, as it would be displayed by the .B dirs -builtin invoked with the tilde-prefix as an argument. +builtin invoked with the characters following the 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 .Q + @@ -3207,15 +3328,19 @@ or .Q + is assumed. .PP -If the login name is invalid, or the tilde expansion fails, the word -is unchanged. +The results of tilde expansion are treated as if they were quoted, so +the replacement is not subject to word splitting and pathname expansion. .PP -Each variable assignment is checked for unquoted tilde-prefixes immediately +If the login name is invalid, or the tilde expansion fails, the +tilde-prefix is unchanged. +.PP +\fBBash\fP checks each variable assignment +for unquoted tilde-prefixes immediately following a .B : or the first -.BR = . -In these cases, tilde expansion is also performed. +.BR = , +and performs tilde expansion in these cases. Consequently, one may use filenames with tildes in assignments to .SM .BR PATH , @@ -3237,7 +3362,8 @@ above, when in \fIposix mode\fP. The .Q \fB$\fP character introduces parameter expansion, -command substitution, or arithmetic expansion. The parameter name +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 could be @@ -3249,10 +3375,12 @@ not escaped by a backslash or within a quoted string, and not within an embedded arithmetic expansion, command substitution, or parameter expansion. .PP -.PD 0 -.TP +The basic form of parameter expansion is +.PP ${\fIparameter\fP} -The value of \fIparameter\fP is substituted. The braces are required +.LP +which substitutes the value of \fIparameter\fP. +The braces are required when .I parameter is a positional parameter with more than one digit, @@ -3268,15 +3396,15 @@ If the first character of \fIparameter\fP is an exclamation point (\fB!\fP), and \fIparameter\fP is not a \fInameref\fP, it introduces a level of indirection. \fBBash\fP uses the value formed by expanding the rest of -\fIparameter\fP as the new \fIparameter\fP; this is then -expanded and that value is used in the rest of the expansion, rather +\fIparameter\fP as the new \fIparameter\fP; +this new parameter is then expanded and that value is used in the rest of the expansion, rather than the expansion of the original \fIparameter\fP. This is known as \fIindirect expansion\fP. The value is subject to tilde expansion, parameter expansion, command substitution, and arithmetic expansion. If \fIparameter\fP is a nameref, this expands to the name of the parameter referenced by \fIparameter\fP instead of performing the -complete indirect expansion. +complete indirect expansion, for compatibility. The exceptions to this are the expansions of ${\fB!\fP\fIprefix\fP\fB*\fP} and ${\fB!\fP\fIname\fP[\fI@\fP]} described below. The exclamation point must immediately follow the left brace in order to @@ -3287,8 +3415,8 @@ parameter expansion, command substitution, and arithmetic expansion. .PP When not performing substring expansion, using the forms documented below (e.g., \fB:-\fP), -\fBbash\fP tests for a parameter that is unset or null. Omitting the colon -results in a test only for a parameter that is unset. +\fBbash\fP tests for a parameter that is unset or null. +Omitting the colon tests only for a parameter that is unset. .PP .PD 0 .TP @@ -3297,7 +3425,8 @@ ${\fIparameter\fP\fB:\-\fP\fIword\fP} .I parameter is unset or null, the expansion of .I word -is substituted. Otherwise, the value of +is substituted. +Otherwise, the value of .I parameter is substituted. .TP @@ -3308,11 +3437,11 @@ If is unset or null, the expansion of .I word is assigned to +.IR parameter , +and the expansion is the final value of .IR parameter . -The value of -.I parameter -is then substituted. Positional parameters and special parameters may -not be assigned to in this way. +Positional parameters and special parameters may +not be assigned in this way. .TP ${\fIparameter\fP\fB:?\fP\fIword\fP} \fBDisplay Error if Null or Unset\fP. @@ -3322,8 +3451,10 @@ is null or unset, the expansion of \fIword\fP (or a message to that effect if .I word is not present) is written to the standard error and the shell, if it -is not interactive, exits. Otherwise, the value of \fIparameter\fP is -substituted. +is 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 \fIparameter\fP is substituted. .TP ${\fIparameter\fP\fB:+\fP\fIword\fP} \fBUse Alternate Value\fP. @@ -3332,6 +3463,7 @@ If is null or unset, nothing is substituted, otherwise the expansion of .I word is substituted. +The value of \fIparameter\fP is not used. .TP ${\fIparameter\fP\fB:\fP\fIoffset\fP} .PD 0 @@ -3417,7 +3549,7 @@ key expands to a separate word. .TP ${\fB#\fP\fIparameter\fP} \fBParameter length\fP. -The length in characters of the value of \fIparameter\fP is substituted. +Substitutes the length in characters of the expanded value of \fIparameter\fP. If .I parameter is @@ -3529,14 +3661,16 @@ ${\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. -\fIParameter\fP is expanded and the longest match of \fIpattern\fP -against its value is replaced with \fIstring\fP. -\fIstring\fP undergoes tilde expansion, parameter and variable expansion, -arithmetic expansion, command and process substitution, and quote removal. -The match is performed using the rules described under +pathname expansion and matched against the expanded value of +\fIparameter\fP +using the rules described under .B Pattern Matching below. +The longest match of \fIpattern\fP +in the expanded value is replaced with \fIstring\fP. +\fIstring\fP undergoes tilde expansion, parameter and variable expansion, +arithmetic expansion, command and process substitution, and quote removal. +.IP In the first form above, only the first match is replaced. If there are two slashes separating \fIparameter\fP and \fIpattern\fP (the second form above), all matches of \fIpattern\fP are @@ -3545,9 +3679,8 @@ If \fIpattern\fP is preceded by \fB#\fP (the third form above), it must match at the beginning of the expanded value of \fIparameter\fP. If \fIpattern\fP is preceded by \fB%\fP (the fourth form above), it must match at the end of the expanded value of \fIparameter\fP. +.IP If the expansion of \fIstring\fP is null, -matches of \fIpattern\fP are deleted. -If \fIstring\fP is null, matches of \fIpattern\fP are deleted and the \fB/\fP following \fIpattern\fP may be omitted. .IP @@ -3571,10 +3704,17 @@ shell programmers should quote any occurrences of \fB&\fP they want to be taken literally in the replacement and ensure any instances of \fB&\fP they want to be replaced are unquoted. .IP +Like the pattern removal operators, double quotes surrounding the +replacement string quote the expanded characters, while double quotes +enclosing the entire parameter substitution do not, since +the expansion is performed in a +context that doesn't take any enclosing double quotes into account. +.IP If the .B nocasematch shell option is enabled, the match is performed without regard to the case of alphabetic characters. +.IP If .I parameter is @@ -3608,6 +3748,7 @@ 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. 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. @@ -3616,6 +3757,7 @@ expanded value; the \fB\*^\fP and \fB,\fP expansions match and convert only the first character in the expanded value. If \fIpattern\fP is omitted, it is treated like a \fB?\fP, which matches every character. +.IP If .I parameter is @@ -3787,8 +3929,9 @@ escape the inner backquotes with backslashes. If the substitution appears within double quotes, \fBbash\fP does not perform word splitting and pathname expansion on the results. .SS Arithmetic Expansion -Arithmetic expansion allows the evaluation of an arithmetic expression -and the substitution of the result. The format for arithmetic expansion is: +Arithmetic expansion evaluates an arithmetic expression +and substitutes the result. +The format for arithmetic expansion is: .RS .PP \fB$((\fP\fIexpression\fP\fB))\fP @@ -3812,7 +3955,9 @@ If .I expression is invalid, .B bash -prints a message indicating failure and no substitution occurs. +prints a message to standard error indicating failure, +does not perform the substitution, +and does not execute the command associated with the expansion. .SS Process Substitution \fIProcess substitution\fP allows a process's input or output to be referred to using a filename. @@ -3825,10 +3970,16 @@ appears as a filename. This filename is passed as an argument to the current command as the result of the expansion. +.PP If the \fB>(\fP\fIlist\^\fP\fB)\fP form is used, writing to -the file will provide input for \fIlist\fP. If the -\fB<(\fP\fIlist\^\fP\fB)\fP form is used, the file passed as an -argument should be read to obtain the output of \fIlist\fP. +the file will provide input for \fIlist\fP. +If the +\fB<(\fP\fIlist\^\fP\fB)\fP form is used, reading the file +will obtain the output of \fIlist\fP. +No space may appear between the \fB<\fP or \fB>\fP +and the left parenthesis, otherwise the construct would be interpreted +as a redirection. +.PP Process substitution is supported on systems that support named pipes (\fIFIFOs\fP) or the \fB/dev/fd\fP method of naming open files. .PP @@ -3868,7 +4019,7 @@ expansions are ignored, and any sequence of .SM .B IFS -characters not at the beginning or end serves to delimit words. +characters not at the beginning or end delimits words. If .SM .B IFS @@ -3878,15 +4029,14 @@ the whitespace characters .BR tab , and .B newline -are ignored at the beginning and end of the -word, as long as the whitespace character is in the -value of +present in the value of .SM .B IFS (an .SM .B IFS -whitespace character). +whitespace character) +are ignored at the beginning and end of the word. Any character in .SM .B IFS @@ -3929,8 +4079,7 @@ becomes .Q \-d after word splitting and null argument removal. .PP -Note that if no expansion occurs, no splitting -is performed. +Note that if no expansion occurs, no splitting is performed. .SS Pathname Expansion After word splitting, unless the @@ -3945,12 +4094,13 @@ and If one of these characters appears, and is not quoted, then the word is regarded as a .IR pattern , -and replaced with an alphabetically sorted list of -filenames matching the pattern +and replaced with a sorted list of filenames matching the pattern (see .SM .B "Pattern Matching" -below). +below) +subject to the value of the \fBGLOBSORT\fP shell variable. +.PP If no matching filenames are found, and the shell option .B nullglob @@ -3961,12 +4111,13 @@ option is set, and no matches are found, the word is removed. If the .B failglob -shell option is set, and no matches are found, an error message -is printed and the command is not executed. +shell option is set, and no matches are found, +\fBbash\fP prints an error message and does not execute the command. If the shell option .B nocaseglob is enabled, the match is performed without regard to the case of alphabetic characters. +.PP When a pattern is used for pathname expansion, the character .Q .\& @@ -3992,21 +4143,23 @@ shell option is enabled, the filenames and .Q ..\& never match, even if the pattern begins with a -.Q .\& +.Q .\& . When not matching pathnames, the .Q .\& character is not treated specially. +.PP When matching a pathname, the slash character must always be matched explicitly by a slash in the pattern, but in other matching contexts it can be matched by a special pattern character as described below under .SM .BR "Pattern Matching" . +.PP See the description of .B shopt below under .SM -.B SHELL BUILTIN COMMANDS +.B "SHELL BUILTIN COMMANDS" for a description of the .BR nocaseglob , .BR nullglob , @@ -4046,7 +4199,7 @@ However, setting to a non-null value has the effect of enabling the .B dotglob shell option, so all other filenames beginning with a -Q .\& +.Q .\& will match. To get the old behavior of ignoring filenames beginning with a .Q .\& , @@ -4061,14 +4214,16 @@ option is disabled when .SM .B GLOBIGNORE is unset. -The pattern matching honors the setting of the \fBextglob\fP shell +The +.B GLOBIGNORE +pattern matching honors the setting of the \fBextglob\fP shell option. .PP The .SM .B GLOBSORT -variable controls how the results of pathname expansion are sorted, as -described above. +shell variable controls how the results of pathname expansion are sorted, +as described above. .PP \fBPattern Matching\fP .PP @@ -4098,22 +4253,31 @@ and subdirectories. Matches any single character. .TP .BR [ .\|.\|. ] +.PD Matches any one of the enclosed characters. A pair of characters separated by a hyphen denotes a \fIrange expression\fP; any character that falls between those two characters, inclusive, -using the current locale's collating sequence and character set, -is matched. If the first character following the +using the current locale's collating sequence and character set, matches. +If the first character following the .B [ is a .B ! or a .B \*^ -then any character not enclosed is matched. +then any character not within the range matches. +A +.B \- +may be matched by including it as the first or last character +in the set. +A +.B ] +may be matched by including it as the first character +in the set. +.IP The sorting order of characters in range expressions, and the characters included in the range, -are determined by -the current locale and the values of the +are determined by the current locale and the values of the .SM .B LC_COLLATE or @@ -4124,22 +4288,15 @@ To obtain the traditional interpretation of range expressions, where .B [a\-d] is equivalent to .BR [abcd] , -set value of the +set the value of the +.B LC_COLLATE +or .B LC_ALL -shell variable to +shell variables to .BR C , or enable the .B globasciiranges shell option. -A -.B \- -may be matched by including it as the first or last character -in the set. -A -.B ] -may be matched by including it as the first character -in the set. -.PD .IP Within .B [ @@ -4188,19 +4345,19 @@ sub-patterns: .RS .TP \fB?(\fP\^\fIpattern-list\^\fP\fB)\fP -Matches zero or one occurrence of the given patterns +Matches zero or one occurrence of the given patterns. .TP \fB*(\fP\^\fIpattern-list\^\fP\fB)\fP -Matches zero or more occurrences of the given patterns +Matches zero or more occurrences of the given patterns. .TP \fB+(\fP\^\fIpattern-list\^\fP\fB)\fP -Matches one or more occurrences of the given patterns +Matches one or more occurrences of the given patterns. .TP \fB@(\fP\^\fIpattern-list\^\fP\fB)\fP -Matches one of the given patterns +Matches one of the given patterns. .TP \fB!(\fP\^\fIpattern-list\^\fP\fB)\fP -Matches anything except one of the given patterns +Matches anything except one of the given patterns. .RE .PD .PP @@ -4225,6 +4382,13 @@ include any filenames beginning with .Q .\& unless the pattern or sub-pattern begins with a .Q .\& . +If the +.B globskipdots +shell option is enabled, the filenames +.Q .\& +and +.Q ..\& +never appear in the set. As above, .Q .\& only has a special meaning when matching filenames. @@ -4250,8 +4414,8 @@ using a special notation interpreted by the shell. duplicated, opened, closed, made to refer to different files, and can change the files the command reads from and writes to. -Redirection may also be used to modify file handles in the -current shell execution environment. +When used with the \fBexec\fP builtin, +redirections modify file handles in the current shell execution environment. The following redirection operators may precede or appear anywhere within a .I simple command @@ -4265,12 +4429,12 @@ may instead be preceded by a word of the form {\fIvarname\fP}. In this case, for each redirection operator except >&- and <&-, the shell will allocate a file descriptor greater than or equal to 10 and assign it to \fIvarname\fP. -If >&- or <&- is preceded -by {\fIvarname\fP}, the value of \fIvarname\fP defines the file -descriptor to close. +If {\fIvarname\fP} precedes >&- or <&-, +the value of \fIvarname\fP defines the file descriptor to close. If {\fIvarname\fP} is supplied, the redirection persists beyond -the scope of the command, allowing the shell programmer to manage -the file descriptor's lifetime manually. +the scope of the command, which allows the shell programmer to manage +the file descriptor's lifetime manually +without using the \fBexec\fP builtin. The \fBvarredir_close\fP shell option manages this behavior. .PP In the following descriptions, if the file descriptor number is @@ -4282,16 +4446,22 @@ the redirection refers to the standard input (file descriptor the redirection refers to the standard output (file descriptor 1). .PP -The word following the redirection operator in the following +The \fIword\fP following the redirection operator in the following descriptions, unless otherwise noted, is subjected to -brace expansion, tilde expansion, parameter and variable expansion, -command substitution, arithmetic expansion, quote removal, -pathname expansion, and word splitting. +brace expansion, +tilde expansion, +parameter and variable expansion, +command substitution, +arithmetic expansion, +quote removal, +pathname expansion, +and word splitting. If it expands to more than one word, .B bash reports an error. .PP -Note that the order of redirections is significant. For example, +The order of redirections is significant. +For example, the command .RS .PP @@ -4308,21 +4478,21 @@ ls 2\fB>&\fP1 \fB>\fP dirlist .PP directs only the standard output to file .IR dirlist , -because the standard error was duplicated from the standard output +because the standard error was directed to the standard output before the standard output was redirected to .IR dirlist . .PP \fBBash\fP handles several filenames specially when they are used in redirections, as described in the following table. If the operating system on which \fBbash\fP is running provides these -special files, bash will use them; otherwise it will emulate them +special files, \fBbash\fP will use them; otherwise it will emulate them internally with the behavior described below. .RS .PP .PD 0 .TP .B /dev/fd/\fIfd\fP -If \fIfd\fP is a valid integer, file descriptor \fIfd\fP is duplicated. +If \fIfd\fP is a valid integer, duplicate file descriptor \fIfd\fP. .TP .B /dev/stdin File descriptor 0 is duplicated. @@ -4351,10 +4521,10 @@ Redirections using file descriptors greater than 9 should be used with care, as they may conflict with file descriptors the shell uses internally. .SS Redirecting Input -Redirection of input causes the file whose name results from +Redirecting input opens the file whose name results from the expansion of .I word -to be opened for reading on file descriptor +for reading on file descriptor .IR n , or the standard input (file descriptor 0) if .I n @@ -4366,14 +4536,15 @@ The general format for redirecting input is: [\fIn\fP]\fB<\fP\fIword\fP .RE .SS Redirecting Output -Redirection of output causes the file whose name results from +Redirecting output opens the file whose name results from the expansion of .I word -to be opened for writing on file descriptor +for writing on file descriptor .IR n , or the standard output (file descriptor 1) if .I n -is not specified. If the file does not exist it is created; +is not specified. +If the file does not exist it is created; if it does exist it is truncated to zero size. .PP The general format for redirecting output is: @@ -4399,18 +4570,19 @@ and the .B noclobber option to the .B set -builtin command is not enabled, the redirection is attempted even -if the file named by \fIword\fP exists. +builtin command is not enabled, +\fBbash\fP attempts the redirection +even if the file named by \fIword\fP exists. .SS Appending Redirected Output -Redirection of output in this fashion -causes the file whose name results from -the expansion of +Redirecting output in this fashion opens +the file whose name results from the expansion of .I word -to be opened for appending on file descriptor +for appending on file descriptor .IR n , or the standard output (file descriptor 1) if .I n -is not specified. If the file does not exist it is created. +is not specified. +If the file does not exist it is created. .PP The general format for appending output is: .RS @@ -4418,11 +4590,10 @@ The general format for appending output is: [\fIn\fP]\fB>>\fP\fIword\fP .RE .SS Redirecting Standard Output and Standard Error -This construct allows both the +This construct redirects both the standard output (file descriptor 1) and the standard error output (file descriptor 2) -to be redirected to the file whose name is the -expansion of +to the file whose name is the expansion of .IR word . .PP There are two formats for redirecting standard output and @@ -4444,15 +4615,15 @@ This is semantically equivalent to .RE .PP When using the second form, \fIword\fP may not expand to a number or -\fB\-\fP. If it does, other redirection operators apply +\fB\-\fP. +If it does, other redirection operators apply (see \fBDuplicating File Descriptors\fP below) for compatibility reasons. .SS Appending Standard Output and Standard Error -This construct allows both the +This construct appends both the standard output (file descriptor 1) and the standard error output (file descriptor 2) -to be appended to the file whose name is the -expansion of +to the file whose name is the expansion of .IR word . .PP The format for appending standard output and standard error is: @@ -4473,7 +4644,7 @@ This type of redirection instructs the shell to read input from the current source until it reads a line containing only .I delimiter (with no trailing blanks). -All of the lines read up to that point are then used as the standard +All of the lines read up to that point then become the standard input (or file descriptor \fIn\fP if \fIn\fP is specified) for a command. .PP The format of here-documents is: @@ -4486,7 +4657,8 @@ The format of here-documents is: .fi .RE .PP -No parameter and variable expansion, command substitution, +The shell does not perform +parameter and variable expansion, command substitution, arithmetic expansion, or pathname expansion is performed on .IR word . .PP @@ -4500,26 +4672,35 @@ and the lines in the here-document are not expanded. If \fIword\fP is unquoted, the .I delimiter is \fIword\fP itself, +and the here-document text is treated similarly to a double-quoted string: all lines of the here-document are subjected to parameter expansion, command substitution, and arithmetic expansion, the character sequence .B \e -is ignored, and +is treated literally, and .B \e must be used to quote the characters .BR \e , .BR $ , and -.BR \` . +.BR \` ; +however, double quote characters have no special meaning. .PP If the redirection operator is .BR <<\- , -then all leading tab characters are stripped from input lines and the -line containing +then the shell strips all leading tab characters from input lines +and the line containing .IR delimiter . This allows here-documents within shell scripts to be indented in a natural fashion. +.PP +If the delimiter is not quoted, the +.B \e +sequence is treated as a line continuation: the two lines are joined +and the backslash-newline is removed. +This happens while reading the here-document, before the check for +the ending delimiter, so joined lines can form the end delimiter. .SS "Here Strings" A variant of here documents, the format is: .RS @@ -4546,21 +4727,22 @@ The redirection operator is used to duplicate input file descriptors. If .I word -expands to one or more digits, the file descriptor denoted by +expands to one or more digits, file descriptor .I n is made to be a copy of that file descriptor. -If the digits in +It is a redirection error if the digits in .I word -do not specify a file descriptor open for input, a redirection error occurs. +do not specify a file descriptor open for input. If .I word evaluates to .BR \- , file descriptor .I n -is closed. If +is closed. +If .I n -is not specified, the standard input (file descriptor 0) is used. +is not specified, this uses the standard input (file descriptor 0). .PP The operator .RS @@ -4568,12 +4750,13 @@ The operator [\fIn\fP]\fB>&\fP\fIword\fP .RE .PP -is used similarly to duplicate output file descriptors. If +is used similarly to duplicate output file descriptors. +If .I n -is not specified, the standard output (file descriptor 1) is used. -If the digits in +is not specified, this uses the standard output (file descriptor 1). +It is a redirection error if the digits in .I word -do not specify a file descriptor open for output, a redirection error occurs. +do not specify a file descriptor open for output. If .I word evaluates to @@ -4581,9 +4764,10 @@ evaluates to file descriptor .I n is closed. -As a special case, if \fIn\fP is omitted, and \fIword\fP does not -expand to one or more digits or \fB\-\fP, the standard output and standard -error are redirected as described previously. +As a special case, if \fIn\fP is omitted, +and \fIword\fP does not expand to one or more digits or \fB\-\fP, +this redirects the standard output and standard error as described +previously. .SS "Moving File Descriptors" The redirection operator .RS @@ -4612,25 +4796,28 @@ The redirection operator [\fIn\fP]\fB<>\fP\fIword\fP .RE .PP -causes the file whose name is the expansion of +opens the file whose name is the expansion of .I word -to be opened for both reading and writing on file descriptor +for both reading and writing on file descriptor .IR n , or on file descriptor 0 if .I n -is not specified. If the file does not exist, it is created. +is not specified. +If the file does not exist, it is created. .SH ALIASES \fIAliases\fP allow a string to be substituted for a word that is in a position in the input where it can be the first word of a simple -command. Aliases have names and corresponding values that are set +command. +Aliases have names and corresponding values that are set and unset using the \fBalias\fP and \fBunalias\fP builtin commands (see .SM -.B SHELL BUILTIN COMMANDS +.B "SHELL BUILTIN COMMANDS" below). .PP If the shell reads an unquoted word in the right position, it checks -the word to see if it matches an alias name. If it matches, the shell +the word to see if it matches an alias name. +If it matches, the shell replaces the word with the alias value, and reads that value as if it had been read instead of the word. The shell doesn't look at any characters following the word before @@ -4654,8 +4841,8 @@ does not try to recursively expand the replacement text. .PP If the last character of the alias value is a .IR blank , -then the next command -word following the alias is also checked for alias expansion. +the shell checks the next command +word following the alias for alias expansion. .PP Aliases are created and listed with the .B alias @@ -4667,7 +4854,7 @@ There is no mechanism for using arguments in the replacement text. If arguments are needed, use a shell function (see .SM .B FUNCTIONS -below). +below) instead. .PP Aliases are not expanded when the shell is not interactive, unless the @@ -4678,7 +4865,7 @@ shell option is set using .B shopt under .SM -\fBSHELL BUILTIN COMMANDS\fP +.B "SHELL BUILTIN COMMANDS" below). .PP The rules concerning the definition and use of aliases are @@ -4687,41 +4874,44 @@ somewhat confusing. always reads at least one complete line of input, and all lines that make up a compound command, before executing any of the commands on that line or the compound command. -Aliases are expanded when a -command is read, not when it is executed. Therefore, an +Aliases are expanded when a command is read, not when it is executed. +Therefore, an alias definition appearing on the same line as another -command does not take effect until the next line of input is read. +command does not take effect until the shell reads the next line of input. The commands following the alias definition on that line are not affected by the new alias. This behavior is also an issue when functions are executed. Aliases are expanded when a function definition is read, not when the function is executed, because a function definition -is itself a command. As a consequence, aliases +is itself a command. +As a consequence, aliases defined in a function are not available until after that -function is executed. To be safe, always put +function is executed. +To be safe, always put alias definitions on a separate line, and do not use .B alias in compound commands. .PP -For almost every purpose, aliases are superseded by -shell functions. +For almost every purpose, shell functions are preferable to aliases. .SH FUNCTIONS A shell function, defined as described above under .SM .BR "SHELL GRAMMAR" , stores a series of commands for later execution. When the name of a shell function is used as a simple command name, -the list of commands associated with that function name is executed. +the shell executes +the list of commands associated with that function name. Functions are executed in the context of the -current shell; no new process is created to interpret +calling shell; there is no new process created to interpret them (contrast this with the execution of a shell script). +.PP When a function is executed, the arguments to the function become the positional parameters during its execution. The special parameter .B # -is updated to reflect the change. Special parameter \fB0\fP -is unchanged. +is updated to reflect the new positional parameters. +Special parameter \fB0\fP is unchanged. The first element of the .SM .B FUNCNAME @@ -4754,7 +4944,7 @@ and the trap is not inherited unless the \fB\-o errtrace\fP shell option has been enabled. .PP -Variables local to the function may be declared with the +Variables local to the function are declared with the .B local builtin command (\fIlocal variables\fP). Ordinarily, variables and their values @@ -4769,17 +4959,18 @@ Previous scopes consist of that function's caller and so on, back to the .Q global scope, where the shell is not executing any shell function. -Consequently, a local variable at the current scope is a variable +A local variable at the current scope is a variable declared using the \fBlocal\fP or \fBdeclare\fP builtins in the function that is currently executing. .PP Local variables .Q shadow -variables with the same name declared at -previous scopes. +variables with the same name declared at previous scopes. For instance, a local variable declared in a function -hides a global variable of the same name: references and assignments -refer to the local variable, leaving the global variable unmodified. +hides variables with the same name declared at previous scopes, +including global variables: references and assignments +refer to the local variable, leaving the variables +at previous scopes unmodified. When the function returns, the global variable is once again visible. .PP The shell uses \fIdynamic scoping\fP to control a variable's visibility @@ -4815,8 +5006,8 @@ variable with that name that had been shadowed will become visible (see below how the \fBlocalvar_unset\fP shell option changes this behavior). .PP The \fBFUNCNEST\fP variable, if set to a numeric value greater -than 0, defines a maximum function nesting level. Function -invocations that exceed the limit cause the entire command to +than 0, defines a maximum function nesting level. +Function invocations that exceed the limit cause the entire command to abort. .PP If the builtin command @@ -4824,6 +5015,10 @@ If the builtin command is executed in a function, the function completes and execution resumes with the next command after the function call. +If \fBreturn\fP is supplied a numeric argument, +that is the function's return status; otherwise the function's +return status is the exit status of the last command executed +before the \fBreturn\fP. Any command associated with the \fBRETURN\fP trap is executed before execution resumes. When a function completes, the values of the @@ -4832,13 +5027,15 @@ positional parameters and the special parameter are restored to the values they had prior to the function's execution. .PP -Function names and definitions may be listed with the +The .B \-f option to the .B declare or .B typeset -builtin commands. The +builtin commands +will list function names and definitions. +The .B \-F option to .B declare @@ -4854,20 +5051,26 @@ automatically have them defined with the option to the .B export builtin. -A function definition may be deleted using the \fB\-f\fP option to +The \fB\-f\fP option to the .B unset -builtin. +builtin will delete a function definition. .PP Functions may be recursive. The \fBFUNCNEST\fP variable may be used to limit the depth of the function call stack and restrict the number of function invocations. -By default, no limit is imposed on the number of recursive calls. +By default, \fBbash\fP imposes no limit on the number of recursive calls. .SH "ARITHMETIC EVALUATION" The shell allows arithmetic expressions to be evaluated, under -certain circumstances (see the \fBlet\fP and \fBdeclare\fP builtin -commands, the \fB((\fP compound command, and \fBArithmetic Expansion\fP). -Evaluation is done in fixed-width integers with no check for overflow, +certain circumstances +(see the \fBlet\fP and \fBdeclare\fP builtin commands, +the \fB((\fP compound command, +the arithmetic \fBfor\fP command, +the \fB[[\fP conditional command, +and \fBArithmetic Expansion\fP). +.PP +Evaluation is done in the largest fixed-width integers available, +with no check for overflow, though division by 0 is trapped and flagged as an error. The operators and their precedence, associativity, and values are the same as in the C language. @@ -4880,12 +5083,12 @@ The levels are listed in order of decreasing precedence. .B \fIid\fP++ \fIid\fP\-\- variable post-increment and post-decrement .TP -.B \- + -unary minus and plus -.TP .B ++\fIid\fP \-\-\fIid\fP variable pre-increment and pre-decrement .TP +.B \- + +unary minus and plus +.TP .B ! \*~ logical and bitwise negation .TP @@ -4936,8 +5139,12 @@ Shell variables are allowed as operands; parameter expansion is performed before the expression is evaluated. Within an expression, shell variables may also be referenced by name without using the parameter expansion syntax. +This means you can use "x", where \fIx\fP is a shell variable name, +in an arithmetic expression, and the shell will evaluate its value as +an expression and use the result. A shell variable that is null or unset evaluates to 0 when referenced -by name without using the parameter expansion syntax. +by name in an expression. +.PP The value of a variable is evaluated as an arithmetic expression when it is referenced, or when a variable which has been given the \fIinteger\fP attribute using \fBdeclare \-i\fP is assigned a value. @@ -4961,9 +5168,9 @@ If \fIbase\fP is less than or equal to 36, lowercase and uppercase letters may be used interchangeably to represent numbers between 10 and 35. .PP -Operators are evaluated in order of precedence. Sub-expressions in -parentheses are evaluated first and may override the precedence -rules above. +Operators are evaluated in precedence order. +Sub-expressions in parentheses are evaluated first +and may override the precedence rules above. .SH "CONDITIONAL EXPRESSIONS" Conditional expressions are used by the \fB[[\fP compound command and the \fBtest\fP and \fB[\fP builtin commands to test file attributes @@ -4972,7 +5179,12 @@ The \fBtest\fP and \fB[\fP commands determine their behavior based on the number of arguments; see the descriptions of those commands for any other command-specific actions. .PP -Expressions are formed from the following unary or binary primaries. +Expressions are formed from the unary or binary primaries listed below. +Unary expressions are often used to examine the status of a file +or shell variable. +Binary operators are used for string, numeric, and file attribute +comparisons. +.PP \fBBash\fP handles several filenames specially when they are used in expressions. If the operating system on which \fBbash\fP is running provides these @@ -5055,7 +5267,8 @@ True if \fIfile\fP exists and is owned by the effective group id. True if \fIfile\fP exists and is a symbolic link. .TP .B \-N \fIfile\fP -True if \fIfile\fP exists and has been modified since it was last read. +True if \fIfile\fP exists and has been modified since it was last +accessed. .TP .B \-O \fIfile\fP True if \fIfile\fP exists and is owned by the effective user id. @@ -5063,18 +5276,6 @@ True if \fIfile\fP exists and is owned by the effective user id. .B \-S \fIfile\fP True if \fIfile\fP exists and is a socket. .TP -\fIfile1\fP \fB\-ef\fP \fIfile2\fP -True if \fIfile1\fP and \fIfile2\fP refer to the same device and -inode numbers. -.TP -\fIfile1\fP \-\fBnt\fP \fIfile2\fP -True if \fIfile1\fP is newer (according to modification date) than \fIfile2\fP, -or if \fIfile1\fP exists and \fPfile2\fP does not. -.TP -\fIfile1\fP \-\fBot\fP \fIfile2\fP -True if \fIfile1\fP is older than \fIfile2\fP, or if \fIfile2\fP exists -and \fIfile1\fP does not. -.TP .B \-o \fIoptname\fP True if the shell option .I optname @@ -5105,21 +5306,19 @@ is set and is a name reference. True if the length of \fIstring\fP is zero. .TP \fIstring\fP -.PD 0 .TP .B \-n \fIstring\fP -.PD True if the length of .I string is non-zero. +.PD .TP \fIstring1\fP \fB==\fP \fIstring2\fP .PD 0 .TP \fIstring1\fP \fB=\fP \fIstring2\fP -.PD -True if the strings are equal. \fB=\fP should be used -with the \fBtest\fP command for POSIX conformance. +True if the strings are equal. +\fB=\fP should be used with the \fBtest\fP command for POSIX conformance. When used with the \fB[[\fP command, this performs pattern matching as described above (\fBCompound Commands\fP). .TP @@ -5131,6 +5330,21 @@ True if \fIstring1\fP sorts before \fIstring2\fP lexicographically. .TP \fIstring1\fP \fB>\fP \fIstring2\fP True if \fIstring1\fP sorts after \fIstring2\fP lexicographically. +.PD +.TP +.PD 0 +\fIfile1\fP \fB\-ef\fP \fIfile2\fP +True if \fIfile1\fP and \fIfile2\fP refer to the same device and +inode numbers. +.TP +\fIfile1\fP \-\fBnt\fP \fIfile2\fP +True if \fIfile1\fP is newer (according to modification date) than \fIfile2\fP, +or if \fIfile1\fP exists and \fPfile2\fP does not. +.TP +\fIfile1\fP \-\fBot\fP \fIfile2\fP +True if \fIfile1\fP is older than \fIfile2\fP, or if \fIfile2\fP exists +and \fIfile1\fP does not. +.PD .TP .I \fIarg1\fP \fBOP\fP \fIarg2\fP .SM @@ -5146,21 +5360,21 @@ or These arithmetic binary operators return true if \fIarg1\fP is equal to, not equal to, less than, less than or equal to, greater than, or greater than or equal to \fIarg2\fP, respectively. -.I Arg1 +.I arg1 and .I arg2 may be positive or negative integers. When used with the \fB[[\fP command, -.I Arg1 +.I arg1 and -.I Arg2 +.I arg2 are evaluated as arithmetic expressions (see .SM .B "ARITHMETIC EVALUATION" above). .PD .SH "SIMPLE COMMAND EXPANSION" -When a simple command is executed, the shell performs the following +When the shell executes a simple command, it performs the following expansions, assignments, and redirections, from left to right, in the following order. .IP 1. @@ -5169,7 +5383,8 @@ preceding the command name) and redirections are saved for later processing. .IP 2. The words that are not variable assignments or redirections are -expanded. If any words remain after expansion, the first word +expanded. +If any words remain after expansion, the first word is taken to be the name of the command and the remaining words are the arguments. .IP 3. @@ -5192,27 +5407,31 @@ If any of the assignments attempts to assign a value to a readonly variable, an error occurs, and the command exits with a non-zero status. .PP If no command name results, redirections are performed, but do not -affect the current shell environment. A redirection error causes the -command to exit with a non-zero status. +affect the current shell environment. +A redirection error causes the command to exit with a non-zero status. .PP If there is a command name left after expansion, execution proceeds as -described below. Otherwise, the command exits. If one of the expansions -contained a command substitution, the exit status of the command is -the exit status of the last command substitution performed. If there -were no command substitutions, the command exits with a status of zero. +described below. +Otherwise, the command exits. +If one of the expansions contained a command substitution, +the exit status of the command is the exit status of +the last command substitution performed. +If there were no command substitutions, +the command exits with a zero status. .SH "COMMAND EXECUTION" After a command has been split into words, if it results in a simple command and an optional list of arguments, the shell performs the following actions. .PP If the command name contains no slashes, the shell attempts to -locate it. If there exists a shell function by that name, that -function is invoked as described above in +locate it. +If there exists a shell function by that name, that function is +invoked as described above in .SM .BR FUNCTIONS . If the name does not match a function, the shell searches for -it in the list of shell builtins. If a match is found, that -builtin is invoked. +it in the list of shell builtins. +If a match is found, that builtin is invoked. .PP If the name is neither a shell function nor a builtin, and contains no slashes, @@ -5229,10 +5448,10 @@ under .SM .B "SHELL BUILTIN COMMANDS" below). -A full search of the directories in +Bash performs a full search of the directories in .SM .B PATH -is performed only if the command is not found in the hash table. +only if the command is not found in the hash table. If the search is unsuccessful, the shell searches for a defined shell function named \fBcommand_not_found_handle\fP. If that function exists, it is invoked in a separate execution environment @@ -5250,10 +5469,10 @@ to the command are set to the arguments given, if any. .PP If this execution fails because the file is not in executable format, and the file is not a directory, it is assumed to be -a \fIshell script\fP, a file -containing shell commands, and the shell creates a -new instance of itself -to execute it. +a \fIshell script\fP, a file containing shell commands, +and the shell creates a new instance of itself to execute it. +Bash tries to determine whether the file is a text file or a binary, +and will not execute files it determines to be binaries. This subshell reinitializes itself, so that the effect is as if a new shell had been invoked to handle the script, with the exception that the locations of @@ -5261,15 +5480,17 @@ commands remembered by the parent (see .B hash below under .SM -\fBSHELL BUILTIN COMMANDS\fP) +.B "SHELL BUILTIN COMMANDS" are retained by the child. .PP If the program is a file beginning with .BR #! , the remainder of the first line specifies an interpreter -for the program. The shell executes the +for the program. +The shell executes the specified interpreter on operating systems that do not -handle this executable format themselves. The arguments to the +handle this executable format themselves. +The arguments to the interpreter consist of a single optional argument following the interpreter name on the first line of the program, followed by the name of the program, followed by the command @@ -5335,9 +5556,12 @@ Command substitution, commands grouped with parentheses, and asynchronous commands are invoked in a subshell environment that is a duplicate of the shell environment, except that traps caught by the shell are reset to the values -that the shell inherited from its parent at invocation. Builtin -commands that are invoked as part of a pipeline are also executed in a -subshell environment. Changes made to the subshell environment +that the shell inherited from its parent at invocation. +Builtin commands that are invoked as part of a pipeline, +except possibly in the last element depending on the value of the +\fBlastpipe\fP shell option, +are also executed in a subshell environment. +Changes made to the subshell environment cannot affect the shell's execution environment. .PP When the shell is in @@ -5367,33 +5591,42 @@ On invocation, the shell scans its own environment and creates a parameter for each name found, automatically marking it for .I export -to child processes. Executed commands inherit the environment. +to child processes. +Executed commands inherit the environment. The -.B export +.BR export , +.BR "declare \-x" , and -.B declare \-x -commands allow parameters and functions to be added to and -deleted from the environment. If the value of a parameter -in the environment is modified, the new value becomes part -of the environment, replacing the old. The environment +.B unset +commands modify the environment by +adding and deleting parameters and functions. +If the value of a parameter +in the environment is modified, the new value automatically +becomes part of the environment, replacing the old. +The environment inherited by any executed command consists of the shell's initial environment, whose values may be modified in the shell, less any pairs removed by the .B unset -command, plus any additions via the +or +.B "export \-n" +commands, plus any additions via the .B export and -.B declare \-x +.B "declare \-x" commands. .PP -The environment for any -.I simple command -or function may be augmented temporarily by prefixing it with -parameter assignments, as described above in +If any parameter assignments, as described above in .SM -.BR PARAMETERS . +.BR PARAMETERS , +appear before a +.IR "simple command" , +the variable assignments are part of that command's environment +for as long as it executes. These assignment statements affect only the environment seen by that command. +If these assignments precede a call to a shell function, the variables +are local to the function and exported to that function's children. .PP If the .B \-k @@ -5408,20 +5641,23 @@ When .B bash invokes an external command, the variable .B _ -is set to the full filename of the command and passed to that +is set to the full pathname of the command and passed to that command in its environment. .SH "EXIT STATUS" The exit status of an executed command is the value returned by the -\fIwaitpid\fP system call or equivalent function. Exit statuses -fall between 0 and 255, though, as explained below, the shell may -use values above 125 specially. Exit statuses from shell builtins and -compound commands are also limited to this range. Under certain -circumstances, the shell will use special values to indicate specific -failure modes. +\fIwaitpid\fP system call or equivalent function. +Exit statuses fall between 0 and 255, though, as explained below, +the shell may use values above 125 specially. +Exit statuses from shell builtins and compound commands are also +limited to this range. +Under certain circumstances, the shell will use special values to +indicate specific failure modes. .PP For the shell's purposes, a command which exits with a -zero exit status has succeeded. An exit status of zero -indicates success. A non-zero exit status indicates failure. +zero exit status has succeeded. +So while an exit status of zero indicates success, a non-zero +exit status indicates failure. +.PP When a command terminates on a fatal signal \fIN\fP, \fBbash\fP uses the value of 128+\fIN\fP as the exit status. .PP @@ -5443,17 +5679,21 @@ parameter $?. .PP \fBBash\fP itself returns the exit status of the last command executed, unless a syntax error occurs, in which case it exits -with a non-zero value. See also the \fBexit\fP builtin -command below. +with a non-zero value. +See also the \fBexit\fP builtin command below. .SH SIGNALS When \fBbash\fP is interactive, in the absence of any traps, it ignores .SM .B SIGTERM (so that \fBkill 0\fP does not kill an interactive shell), -and +and catches and handles .SM .B SIGINT -is caught and handled (so that the \fBwait\fP builtin is interruptible). +(so that the \fBwait\fP builtin is interruptible). +When \fBbash\fP receives +.SM +.BR SIGINT , +it breaks out of any executing loops. In all cases, \fBbash\fP ignores .SM .BR SIGQUIT . @@ -5468,8 +5708,13 @@ and .SM .BR SIGTSTP . .PP -Non-builtin commands run by \fBbash\fP have signal handlers -set to the values inherited by the shell from its parent. +The \fBtrap\fP builtin modifies the shell's signal handling, as +described below. +.PP +Non-builtin commands \fBbash\fP executes have signal handlers +set to the values inherited by the shell from its parent, +unless \fBtrap\fP sets them to be ignored, in which case the child +process will ignore them as well. When job control is not in effect, asynchronous commands ignore .SM @@ -5495,21 +5740,24 @@ Before exiting, an interactive shell resends the .SM .B SIGHUP to all jobs, running or stopped. -Stopped jobs are sent +The shell sends .SM .B SIGCONT -to ensure that they receive the +to stopped jobs to ensure that they receive the .SM -.BR SIGHUP . +.B SIGHUP +(see +.SM +.B "JOB CONTROL" +below for more information about running and stopped jobs). To prevent the shell from -sending the signal to a particular job, it should be removed from the +sending the signal to a particular job, remove it from the jobs table with the .B disown builtin (see .SM .B "SHELL BUILTIN COMMANDS" -below) or marked -to not receive +below) or mark it not to receive .SM .B SIGHUP using @@ -5517,7 +5765,7 @@ using .PP If the .B huponexit -shell option has been set with +shell option has been set using .BR shopt , .B bash sends a @@ -5528,10 +5776,11 @@ to all jobs when an interactive login shell exits. If \fBbash\fP is waiting for a command to complete and receives a signal for which a trap has been set, the trap will not be executed until the command completes. -When \fBbash\fP is waiting for an asynchronous command via the \fBwait\fP -builtin, the reception of a signal for which a trap has been set will -cause the \fBwait\fP builtin to return immediately with an exit status -greater than 128, immediately after which the trap is executed. +If \fBbash\fP is waiting for an asynchronous command via the \fBwait\fP +builtin, +and it receives a signal for which a trap has been set, +the \fBwait\fP builtin will return immediately with an exit status +greater than 128, immediately after which the shell executes the trap. .PP When job control is not enabled, and \fBbash\fP is waiting for a foreground command to complete, the shell receives keyboard-generated signals @@ -5545,6 +5794,10 @@ same process group as the terminal, and \fB\*^C\fP sends .SM .B SIGINT to all processes in that process group. +See +.SM +.B "JOB CONTROL" +below for more information about process groups. .PP When \fBbash\fP is running without job control enabled and receives .SM @@ -5782,89 +6035,102 @@ when it is ready to read a command, and the secondary prompt .SM .B PS2 when it needs more input to complete a command. +.PP +.B Bash +examines the value of the array variable \fBPROMPT_COMMAND\fP just before +printing each primary prompt. +If any elements in \fBPROMPT_COMMAND\fP are set and non-null, Bash +executes each value, in numeric order, +just as if it had been typed on the command line. .B Bash displays .SM .B PS0 after it reads a command but before executing it. +.PP .B Bash displays .SM .B PS4 as described above before tracing each command when the \fB\-x\fP option is enabled. +.PP .B Bash -allows these prompt strings to be customized by inserting a number of +allows the prompt strings +\fBPS0\fP, \fBPS1\fP, \fBPS2\fP, and \fBPS4\fP, +to be customized by inserting a number of backslash-escaped special characters that are decoded as follows: .RS -.PD 0 .TP .B \ea -an ASCII bell character (07) +An ASCII bell character (07). +.PD 0 .TP .B \ed -the date in +The date in .Q "Weekday Month Date" format (e.g., -.Q "Tue May 26" ) +.Q "Tue May 26" ). .TP .B \eD{\fIformat\fP} -the \fIformat\fP is passed to +The \fIformat\fP is passed to .IR strftime (3) and the result is inserted into the prompt string; an empty \fIformat\fP results in a locale-specific -time representation. The braces are required +time representation. +The braces are required. .TP .B \ee -an ASCII escape character (033) +An ASCII escape character (033). .TP .B \eh -the hostname up to the first -.Q . +The hostname up to the first +.Q . . .TP .B \eH -the hostname +The hostname. .TP .B \ej -the number of jobs currently managed by the shell +The number of jobs currently managed by the shell. .TP .B \el -the basename of the shell's terminal device name +The basename of the shell's terminal device name (e.g., +.Q ttys0 ). .TP .B \en -newline +A newline. .TP .B \er -carriage return +A carriage return. .TP .B \es -the name of the shell, the basename of +The name of the shell: the basename of .B $0 -(the portion following the final slash) +(the portion following the final slash). .TP .B \et -the current time in 24-hour HH:MM:SS format +The current time in 24-hour HH:MM:SS format. .TP .B \eT -the current time in 12-hour HH:MM:SS format +The current time in 12-hour HH:MM:SS format. .TP .B \e@ -the current time in 12-hour am/pm format +The current time in 12-hour am/pm format. .TP .B \eA -the current time in 24-hour HH:MM format +The current time in 24-hour HH:MM format. .TP .B \eu -the username of the current user +The username of the current user. .TP .B \ev -the version of \fBbash\fP (e.g., 2.00) +The \fBbash\fP version (e.g., 2.00) .TP .B \eV -the release of \fBbash\fP, version + patch level (e.g., 2.00.0) +The \fBbash\fP release, version + patch level (e.g., 2.00.0) .TP .B \ew -the value of the \fBPWD\fP shell variable (\fB$PWD\fP), +The value of the \fBPWD\fP shell variable (\fB$PWD\fP), with .SM .B $HOME @@ -5872,39 +6138,39 @@ abbreviated with a tilde (uses the value of the .SM .B PROMPT_DIRTRIM -variable) +variable). .TP .B \eW -the basename of \fB$PWD\fP, +The basename of \fB$PWD\fP, with .SM .B $HOME -abbreviated with a tilde +abbreviated with a tilde. .TP .B \e! -the history number of this command +The history number of this command. .TP .B \e# -the command number of this command +The command number of this command. .TP .B \e$ -if the effective UID is 0, a +If the effective UID is 0, a .BR # , otherwise a -.B $ +.BR $ . .TP .B \e\fInnn\fP -the character corresponding to the octal number \fInnn\fP +The character corresponding to the octal number \fInnn\fP. .TP .B \e\e -a backslash +A backslash. .TP .B \e[ -begin a sequence of non-printing characters, which could be used to -embed a terminal control sequence into the prompt +Begin a sequence of non-printing characters, which could be used to +embed a terminal control sequence into the prompt. .TP .B \e] -end a sequence of non-printing characters +End a sequence of non-printing characters. .PD .RE .PP @@ -5933,7 +6199,7 @@ word expansion. This is the library that handles reading input when using an interactive shell, unless the .B \-\-noediting -option is given at shell invocation. +option is supplied at shell invocation. Line editing is also used when using the \fB\-e\fP option to the \fBread\fP builtin. By default, the line editing commands are similar to those of Emacs. @@ -5946,7 +6212,7 @@ options to the .B set builtin (see .SM -.B SHELL BUILTIN COMMANDS +.B "SHELL BUILTIN COMMANDS" below). To turn off line editing after the shell is running, use the .B +o emacs @@ -6213,7 +6479,7 @@ option to the .B set builtin command (see .SM -.B SHELL BUILTIN COMMANDS +.B "SHELL BUILTIN COMMANDS" below). .SS "Readline Variables" Readline has variables that can be used to further customize its @@ -6226,7 +6492,7 @@ file with a statement of the form .RE or using the \fBbind\fP builtin command (see .SM -.B SHELL BUILTIN COMMANDS +.B "SHELL BUILTIN COMMANDS" below). .PP Except where noted, readline variables can take the values @@ -7435,22 +7701,22 @@ Display version information about the current instance of .BR bash . .PD .SS Programmable Completion -When word completion is attempted for an argument to a command for +When a user attempts word completion for an argument to a command for which a completion specification (a \fIcompspec\fP) has been defined using the \fBcomplete\fP builtin (see .SM .B "SHELL BUILTIN COMMANDS" -below), the programmable completion facilities are invoked. +below), Readline invokes the programmable completion facilities. .PP First, the command name is identified. +If a compspec has been defined for that command, the +compspec is used to generate the list of possible completions for the word. If the command word is the empty string (completion attempted at the beginning of an empty line), any compspec defined with the \fB\-E\fP option to \fBcomplete\fP is used. -If a compspec has been defined for that command, the -compspec is used to generate the list of possible completions for the word. If the command word is a full pathname, a compspec for the full pathname is searched for first. -If no compspec is found for the full pathname, an attempt is made to +If no compspec is found for the full pathname, completion attempts to find a compspec for the portion following the final slash. If those searches do not result in a compspec, any compspec defined with the \fB\-D\fP option to \fBcomplete\fP is used as the default. @@ -7539,7 +7805,8 @@ the matches. .PP Any function specified with \fB\-F\fP is invoked first. The function may use any of the shell facilities, including the -\fBcompgen\fP builtin described below, to generate the matches. +\fBcompgen\fP and \fBcompopt\fP +builtins described below, to generate the matches. It must put the possible completions in the .SM .B COMPREPLY @@ -7550,6 +7817,7 @@ in an environment equivalent to command substitution. It should print a list of completions, one per line, to the standard output. Backslash may be used to escape a newline, if necessary. +These are added to the set of possible completions. .PP After all of the possible completions are generated, any filter specified with the \fB\-X\fP option is applied to the list. @@ -7567,8 +7835,7 @@ of alphabetic characters. .PP Finally, any prefix and suffix specified with the \fB\-P\fP and \fB\-S\fP options are added to each member of the completion list, and the result is -returned to the readline completion code as the list of possible -completions. +returned to \fBreadline\fP as the list of possible completions. .PP If the previously-applied actions do not generate any matches, and the \fB\-o dirnames\fP option was supplied to \fBcomplete\fP when the @@ -7580,11 +7847,12 @@ matches are added to the results of the other actions. .PP By default, if a compspec is found, whatever it generates is returned to the completion code as the full set of possible completions. -The default \fBbash\fP completions are not attempted, and the readline -default of filename completion is disabled. +The default \fBbash\fP completions and the \fBreadline\fP +default of filename completion are disabled. If the \fB\-o bashdefault\fP option was supplied to \fBcomplete\fP when -the compspec was defined, the \fBbash\fP default completions are attempted -if the compspec generates no matches. +the compspec was defined, +if the compspec generates no matches, +the \fBbash\fP default completions are attempted. If the \fB\-o default\fP option was supplied to \fBcomplete\fP when the compspec was defined, readline's default completion will be performed if the compspec (and, if attempted, the default \fBbash\fP completions) @@ -7596,18 +7864,19 @@ to completed names which are symbolic links to directories, subject to the value of the \fBmark\-directories\fP readline variable, regardless of the setting of the \fBmark-symlinked\-directories\fP readline variable. .PP -There is some support for dynamically modifying completions. This is -most useful when used in combination with a default completion specified -with \fBcomplete \-D\fP. +There is some support for dynamically modifying completions. +This is most useful when used in combination with a default completion +specified with \fBcomplete \-D\fP. It's possible for shell functions executed as completion handlers to indicate that completion should be retried by returning an -exit status of 124. If a shell function returns 124, and changes +exit status of 124. +If a shell function returns 124, and changes the compspec associated with the command on which completion is being attempted (supplied as the first argument when the function is executed), programmable completion restarts from the beginning, with an -attempt to find a new compspec for that command. This allows a set of -completions to be built dynamically as completion is attempted, rather than -being loaded all at once. +attempt to find a new compspec for that command. +This allows a set of completions to be built dynamically as completion +is attempted, rather than being loaded all at once. .PP For instance, assuming that there is a library of compspecs, each kept in a file corresponding to the name of the command, the following default @@ -7651,7 +7920,8 @@ number of commands to save in a history list. The text of the last .SM .B HISTSIZE -commands (default 500) is saved. The shell +commands (default 500) is saved. +The shell stores each command in the history list prior to parameter and variable expansion (see .SM @@ -7664,20 +7934,21 @@ and .SM .BR HISTCONTROL . .PP -On startup, the history is initialized from the file named by -the variable +On startup, \fBbash\fP initializes the history list +by reading history entries from the +the file named by the .SM .B HISTFILE -(default \fI\*~/.bash_history\fP). -The file named by the value of -.SM -.B HISTFILE -is truncated, if necessary, to contain no more than -the number of lines specified by the value of +variable (default \fI\*~/.bash_history\fP). +That file is referred to as the \fIhistory file\fP. +The history file is truncated, if necessary, +to contain no more than the number of history entries +specified by the value of .SM .BR HISTFILESIZE . If \fBHISTFILESIZE\fP is unset, or set to null, a non-numeric value, or a numeric value less than zero, the history file is not truncated. +.PP When the history file is read, lines beginning with the history comment character followed immediately by a digit are interpreted as timestamps for the following history line. @@ -7685,10 +7956,13 @@ These timestamps are optionally displayed depending on the value of the .SM .B HISTTIMEFORMAT variable. -When a shell with history enabled exits, the last +When present, history timestamps delimit history entries, making +multi-line entries possible. +.PP +When a shell with history enabled exits, \fBbash\fP copies the last .SM .B $HISTSIZE -lines are copied from the history list to +entries from the history list to .SM .BR $HISTFILE . If the @@ -7699,7 +7973,7 @@ shell option is enabled under .SM .B "SHELL BUILTIN COMMANDS" -below), the lines are appended to the history file, +below), \fBbash\fP appends the entries to the history file, otherwise the history file is overwritten. If .SM @@ -7714,40 +7988,43 @@ with the history comment character, so they may be preserved across shell sessions. This uses the history comment character to distinguish timestamps from other history lines. -After saving the history, the history file is truncated +As above, when using +.SM +.BR HISTTIMEFORMAT , +the timestamps delimit multi-line history entries. +After saving the history, \fBbash\fP truncates the history file to contain no more than .SM .B HISTFILESIZE -lines. If +lines. +If .SM .B HISTFILESIZE is unset, or set to null, a non-numeric value, or a numeric value less than zero, the history file is not truncated. .PP -The builtin command +The .B fc -(see +builtin command (see .SM -.B SHELL BUILTIN COMMANDS -below) may be used to list or edit and re-execute a portion of -the history list. +.B "SHELL BUILTIN COMMANDS" +below) will list or edit and re-execute a portion of the history list. The .B history -builtin may be used to display or modify the history list and +builtin can display or modify the history list and manipulate the history file. When using command-line editing, search commands are available in each editing mode that provide access to the history list. .PP -The shell allows control over which commands are saved on the history -list. The +The shell allows control over which commands are saved on the history list. +The .SM .B HISTCONTROL and .SM .B HISTIGNORE -variables are used to cause the shell to save only a subset of the -commands entered. +variables are used to save only a subset of the commands entered. The .B cmdhist shell option, if enabled, causes the shell to attempt to save each @@ -7755,8 +8032,9 @@ line of a multi-line command in the same history entry, adding semicolons where necessary to preserve syntactic correctness. The .B lithist -shell option causes the shell to save the command with embedded newlines -instead of semicolons. See the description of the +shell option modifies \fBcmdhist\fP by saving +the command with embedded newlines instead of semicolons. +See the description of the .B shopt builtin below under .SM @@ -7766,17 +8044,20 @@ for information on setting and unsetting shell options. The shell supports a history expansion feature that is similar to the history expansion in .BR csh . -This section describes what syntax features are available. This -feature is enabled by default for interactive shells, and can be -disabled using the +This section describes what syntax features are available. +.PP +History expansion is enabled by default for interactive shells, +and can be disabled using the .B +H option to the .B set builtin command (see .SM -.B SHELL BUILTIN COMMANDS -below). Non-interactive shells do not perform history expansion -by default. +.B "SHELL BUILTIN COMMANDS" +below). +Non-interactive shells do not perform history expansion by default, +but it can be enabled with +.Q "set -H" . .PP History expansions introduce words from the history list into the input stream, making it easy to repeat commands, insert the @@ -7785,16 +8066,18 @@ fix errors in previous commands quickly. .PP History expansion is performed immediately after a complete line is read, before the shell breaks it into words, and is performed -on each line individually without taking quoting on previous lines into -account. +on each line individually. +The shell attempts to inform the history +expansion functions about quoting still in effect from previous lines. +.PP It takes place in two parts. -The first is to determine which line from the history list +The first is to determine which history list entry to use during substitution. -The second is to select portions of that line for inclusion into +The second is to select portions of that entry to include into the current one. -The line selected from the history is the \fIevent\fP, -and the portions of that line that are acted upon are \fIwords\fP. -The line is broken into words in the same fashion as when reading input, +The entry selected from the history is the \fIevent\fP, +and the portions of that entry that are acted upon are \fIwords\fP. +The entry is split into words in the same fashion as when reading input, so that several \fImetacharacter\fP-separated words surrounded by quotes are considered one word. The \fIevent designator\fP selects the event, the optional @@ -7822,19 +8105,20 @@ There is a special abbreviation for substitution, active when the is the first character on the line. It selects the previous history entry, using an event designator equivalent to \fB!!\fP, -and substitutes one string for another in that line. +and substitutes one string for another in that entry. It is described below under \fBEvent Designators\fP. This is the only history expansion that does not begin with the history expansion character. .PP Several shell options settable with the .B shopt -builtin may be used to tailor the behavior of history expansion. +builtin will modify history expansion behavior +(see the description of the +.B shopt +builtin below).and If the .B histverify -shell option is enabled (see the description of the -.B shopt -builtin below), and +shell option is enabled, and .B readline is being used, history substitutions are not immediately passed to the shell parser. @@ -7845,21 +8129,22 @@ If .B readline is being used, and the .B histreedit -shell option is enabled, a failed history substitution will be reloaded +shell option is enabled, a failed history substitution is reloaded into the .B readline editing buffer for correction. +.PP The .B \-p option to the .B history -builtin command may be used to see what a history expansion will +builtin command shows what a history expansion will do before using it. The .B \-s option to the .B history -builtin may be used to add commands to the end of the history list +builtin will add commands to the end of the history list without actually executing them, so that they are available for subsequent recall. .PP @@ -7872,8 +8157,7 @@ The shell uses the history comment character to mark history timestamps when writing the history file. .SS Event Designators -An event designator is a reference to a command line entry in the -history list. +An event designator is a reference to an entry in the history list. The event designator consists of the portion of the word beginning with the history expansion character and ending with the word designator if present, @@ -7887,19 +8171,20 @@ position in the history list. Start a history substitution, except when followed by a .BR blank , newline, carriage return, = -or ( (when the \fBextglob\fP shell option is enabled using -the \fBshopt\fP builtin). +or, when the \fBextglob\fP shell option is enabled using +the \fBshopt\fP builtin, (. .TP .B !\fIn\fP -Refer to command line +Refer to history list entry .IR n . .TP .B !\-\fIn\fP -Refer to the current command minus +Refer to the current entry minus .IR n . .TP .B !! -Refer to the previous command. This is a synonym for +Refer to the previous command. +This is a synonym for .Q !\-1 . .TP .B !\fIstring\fP @@ -7914,11 +8199,13 @@ history list containing The trailing \fB?\fP may be omitted if .I string is followed immediately by a newline. -If \fIstring\fP is missing, the string from the most recent search is used; +If \fIstring\fP is missing, this uses +the string from the most recent search; it is an error if there is no previous search string. .TP .B \d\s+2\*^\s-2\u\fIstring1\fP\d\s+2\*^\s-2\u\fIstring2\fP\d\s+2\*^\s-2\u -Quick substitution. Repeat the previous command, replacing +Quick substitution. +Repeat the previous command, replacing .I string1 with .IR string2 . @@ -7931,6 +8218,8 @@ The entire command line typed so far. .PD .SS Word Designators Word designators are used to select desired words from the event. +They are optional; if the word designator isn't supplied, the history +expansion uses the entire event. A .B : separates the event specification from the word designator. @@ -7948,17 +8237,18 @@ Words are inserted into the current line separated by single spaces. .PD 0 .TP .B 0 (zero) -The zeroth word. For the shell, this is the command -word. +The zeroth word. +For the shell, this is the command word. .TP .I n The \fIn\fPth word. .TP .B \*^ -The first argument. That is, word 1. +The first argument: word 1. .TP .B $ -The last word. This is usually the last argument, but will expand to the +The last word. +This is usually the last argument, but will expand to the zeroth word if there is only one word in the line. .TP .B % @@ -7982,8 +8272,8 @@ This is a synonym for .Q \fI1\-$\fP . It is not an error to use .B * -if there is just one -word in the event; the empty string is returned in that case. +if there is just one word in the event; +it expands to the empty string in this case. .TP .B x* Abbreviates \fIx\-$\fP. @@ -7994,10 +8284,10 @@ If \fBx\fP is missing, it defaults to 0. .PD .PP If a word designator is supplied without an event specification, the -previous command is used as the event. +previous command is used as the event, equivalent to \fB!!\fP. .SS Modifiers -After the optional word designator, there may appear a sequence of -one or more of the following modifiers, each preceded by a +After the optional word designator, the expansion may include a +sequence of one or more of the following modifiers, each preceded by a .Q : . These modify, or edit, the word or words selected from the history event. .PP @@ -8028,8 +8318,8 @@ Quote the substituted words as with but break into words at .B blanks and newlines. -The \fBq\fP and \fBx\fP modifiers are mutually exclusive; the last one -supplied is used. +The \fBq\fP and \fBx\fP modifiers are mutually exclusive; +expansion uses the last one supplied. .TP .B s/\fIold\fP/\fInew\fP/ Substitute @@ -8040,13 +8330,13 @@ in the event line. Any character may be used as the delimiter in place of /. The final delimiter is optional if it is the last character of the event line. -The delimiter may be quoted in +A single backslash will quote the delimiter in .I old and -.I new -with a single backslash. If & appears in +.IR new . +If & appears in .IR new , -it is replaced by +it is replaced with .IR old . A single backslash will quote the &. If @@ -8130,6 +8420,7 @@ The \fB\&.\| \fP command (\fBsource\fP) reads and execute commands from in the current shell environment and returns the exit status of the last command executed from .IR filename . +.IP If \fIfilename\fP does not contain a slash, \fB\&.\| \fP searchs for it. If the \fB\-p\fP option is supplied, \fB\&.\| \fP treats \fIpath\fP as a colon-separated list of directories in which to find \fIfilename\fP; @@ -8140,7 +8431,7 @@ to find the directory containing .IR filename . \fIfilename\fP does not need to be executable. When \fBbash\fP is not in \fIposix mode\fP, it searches -the current directory if no file is found in +the current directory if \fIfilename\fP is not found in .SM .BR PATH , but does not search the current directory if \fB\-p\fP is supplied. @@ -8151,33 +8442,37 @@ option to the builtin command is turned off, \fB\&.\| \fP does not search .SM .BR PATH . +.IP If any \fIarguments\fP are supplied, they become the positional parameters when \fIfilename\fP is executed. Otherwise the positional parameters are unchanged. +.IP If the \fB\-T\fP option is enabled, \fB.\fP inherits any trap on \fBDEBUG\fP; if it is not, any \fBDEBUG\fP trap string is saved and restored around the call to \fB.\fP, and \fB.\fP unsets the \fBDEBUG\fP trap while it executes. If \fB\-T\fP is not set, and the sourced file changes -the \fBDEBUG\fP trap, the new value is retained when \fB.\fP completes. -The return status is the status of the last command exited within -the script (0 if no commands are executed), and false if +the \fBDEBUG\fP trap, the new value persists after \fB.\fP completes. +The return status is the status of the last command executed from +\fIfilename\fP (0 if no commands are executed), and non-zero if .I filename is not found or cannot be read. .TP \fBalias\fP [\fB\-p\fP] [\fIname\fP[=\fIvalue\fP] .\|.\|.] -\fBAlias\fP with no arguments or with the +With no arguments or with the .B \-p -option prints the list of aliases in the form +option,\fBalias\fP prints the list of aliases in the form \fBalias\fP \fIname\fP=\fIvalue\fP on standard output. -When arguments are supplied, an alias is defined for +When arguments are supplied, define an alias for each \fIname\fP whose \fIvalue\fP is given. A trailing space in \fIvalue\fP causes the next word to be -checked for alias substitution when the alias is expanded. +checked for alias substitution when the alias is expanded +during command parsing. For each \fIname\fP in the argument list for which no \fIvalue\fP -is supplied, the name and value of the alias is printed. -\fBAlias\fP returns true unless a \fIname\fP is given for which -no alias has been defined. +is supplied, print the name and value of the alias \fIname\fP. +\fBalias\fP returns true unless a \fIname\fP is given +(without a corresponding =\fIvalue\fP) +for which no alias has been defined. .TP \fBbg\fP [\fIjobspec\fP .\|.\|.] Resume each suspended job \fIjobspec\fP in the background, as if it @@ -8213,10 +8508,11 @@ Display current .B readline key and function bindings, bind a key sequence to a .B readline -function or macro, or set a +function or macro +or to a shell command, or set a .B readline variable. -Each non-option argument is a command as it would appear in a +Each non-option argument is a key binding or command as it would appear in a .B readline initialization file such as .IR .inputrc , @@ -8242,16 +8538,18 @@ names are \fIemacs, emacs\-standard, emacs\-meta, emacs\-ctlx, vi, vi\-move, vi\-command\fP, and .IR vi\-insert . -\fIvi\fP is equivalent to \fIvi\-command\fP (\fIvi\-move\fP is also -a synonym); \fIemacs\fP is -equivalent to \fIemacs\-standard\fP. +\fIvi\fP is equivalent to \fIvi\-command\fP +(\fIvi\-move\fP is also a synonym); +\fIemacs\fP is equivalent to \fIemacs\-standard\fP. .TP .B \-l List the names of all \fBreadline\fP functions. .TP .B \-p Display \fBreadline\fP function names and bindings in such a way -that they can be re-read. +that they can be +used as an argument to a subsequent +\fBbind\fP command or in a \fBreadline\fP initialization file. If arguments remain after option processing, \fBbind\fP treats them as readline command names and restricts output to those names. .TP @@ -8262,7 +8560,9 @@ them as readline command names and restricts output to those names. .TP .B \-s Display \fBreadline\fP key sequences bound to macros and the strings -they output in such a way that they can be re-read. +they output in such a way that they can be used +as an argument to a subsequent \fBbind\fP command +or in a \fBreadline\fP initialization file. .TP .B \-S Display \fBreadline\fP key sequences bound to macros and the strings @@ -8270,7 +8570,9 @@ they output. .TP .B \-v Display \fBreadline\fP variable names and values in such a way that they -can be re-read. +can be +used as an argument to a subsequent +\fBbind\fP command or in a \fBreadline\fP initialization file. .TP .B \-V List current \fBreadline\fP variable names and values. @@ -8279,10 +8581,10 @@ List current \fBreadline\fP variable names and values. Read key bindings from \fIfilename\fP. .TP .B \-q \fIfunction\fP -Query about which keys invoke the named \fIfunction\fP. +Display key sequences that invoke the named \fBreadline\fP \fIfunction\fP. .TP .B \-u \fIfunction\fP -Unbind all keys bound to the named \fIfunction\fP. +Unbind all key sequences bound to the named \fBreadline\fP \fIfunction\fP. .TP .B \-r \fIkeyseq\fP Remove any current binding for \fIkeyseq\fP. @@ -8298,7 +8600,7 @@ special backslash-escapes in \fIshell\-command\fP before saving it. If the separator is a colon, any enclosing double quotes are optional, and \fBreadline\fP does not expand the command string before saving it. Since the entire key binding expression must be a single argument, it -should be enclosed in quotes. +should be enclosed in single quotes. When \fIshell\-command\fP is executed, the shell sets the .SM .B READLINE_LINE @@ -8327,10 +8629,11 @@ those new values will be reflected in the editing state. .TP .B \-X List all key sequences bound to shell commands and the associated commands -in a format that can be reused as input. +in a format that can be reused as +an argument to a subsequent @code{bind} command. .PD .PP -The return value is 0 unless an unrecognized option is given or an +The return value is 0 unless an unrecognized option is supplied or an error occurred. .RE .TP @@ -8341,7 +8644,8 @@ Exit from within a .BR until , or .B select -loop. If \fIn\fP is specified, break \fIn\fP levels. +loop. +If \fIn\fP is specified, \fBbreak\fP exits \fIn\fP enclosing loops. .I n must be \(>= 1. If .I n @@ -8350,7 +8654,7 @@ are exited. The return value is 0 unless \fIn\fP is not greater than or equal to 1. .TP \fBbuiltin\fP \fIshell\-builtin\fP [\fIarguments\fP] -Execute the specified shell builtin, passing it +Execute the specified shell builtin \fIshell\-builtin\fP, passing it .IR arguments , and return its exit status. This is useful when defining a @@ -8364,13 +8668,15 @@ is not a shell builtin command. \fBcaller\fP [\fIexpr\fP] Returns the context of any active subroutine call (a shell function or a script executed with the \fB.\fP or \fBsource\fP builtins). +.IP Without \fIexpr\fP, \fBcaller\fP displays the line number and source filename of the current subroutine call. If a non-negative integer is supplied as \fIexpr\fP, \fBcaller\fP displays the line number, subroutine name, and source file corresponding -to that position in the current execution call stack. This extra -information may be used, for example, to print a stack trace. The -current frame is frame 0. +to that position in the current execution call stack. +This extra information may be used, for example, to print a stack trace. +The current frame is frame 0. +.IP The return value is 0 unless the shell is not executing a subroutine call or \fIexpr\fP does not correspond to a valid position in the call stack. @@ -8380,12 +8686,11 @@ Change the current directory to \fIdir\fP. if \fIdir\fP is not supplied, the value of the .SM .B HOME -shell variable is the default. +shell variable is used as \fIdir\fP. The variable .SM .B CDPATH -defines the search path for the directory containing -.IR dir : +exists, \fBcd\fP uses it as a search path: the shell searches each directory name in .SM .B CDPATH @@ -8393,7 +8698,8 @@ for \fIdir\fP. Alternative directory names in .SM .B CDPATH -are separated by a colon (:). A null directory name in +are separated by a colon (:). +A null directory name in .SM .B CDPATH is the same as the current directory, i.e., @@ -8404,7 +8710,9 @@ begins with a slash (/), then .SM .B CDPATH -is not used. The +is not used. +.IP +The .B \-P option causes \fBcd\fP to use the physical directory structure by resolving symbolic links while traversing \fIdir\fP and @@ -8412,83 +8720,94 @@ before processing instances of \fI..\fP in \fIdir\fP (see also the .B \-P option to the .B set -builtin command); the +builtin command). +.IP +The .B \-L option forces symbolic links to be followed by resolving the link after processing instances of \fI..\fP in \fIdir\fP. If \fI..\fP appears in \fIdir\fP, it is processed by removing the immediately previous pathname component from \fIdir\fP, back to a slash or the beginning of \fIdir\fP. +.IP If the .B \-e option is supplied with .BR \-P , and the current working directory cannot be successfully determined -after a successful directory change, \fBcd\fP will return an unsuccessful +after a successful directory change, \fBcd\fP will return a non-zero status. +.IP On systems that support it, the \fB\-@\fP option presents the extended attributes associated with a file as a directory. +.IP An argument of .B \- is converted to .SM .B $OLDPWD -before the directory change is attempted. -If a non-empty directory name from +before attempting the directory change. +.IP +If \fBcd\fP uses a non-empty directory name from .SM -.B CDPATH -is used, or if -\fB\-\fP is the first argument, and the directory change is -successful, the absolute pathname of the new working directory is -written to the standard output. +.BR CDPATH, +or if \fB\-\fP is the first argument, and the directory change is +successful, \fBcd\fP writes the absolute pathname of the new +working directory to the standard output. +.IP If the directory change is successful, \fBcd\fP sets the value of the \fBPWD\fP environment variable to the new directory name, and sets the \fBOLDPWD\fP environment variable to the value of the current working directory before the change. +.IP The return value is true if the directory was successfully changed; false otherwise. .TP \fBcommand\fP [\fB\-pVv\fP] \fIcommand\fP [\fIarg\fP .\|.\|.] -Run +The \fBcommand\fP builtin runs .I command with .I args -suppressing the normal shell function lookup. +suppressing the normal shell function lookup for \fIcommand\fP. Only builtin commands or commands found in the .SM .B PATH -are executed. If the +named \fIcommand\fP are executed. +If the .B \-p -option is given, the search for +option is supplied, the search for .I command is performed using a default value for .SM .B PATH that is guaranteed to find all of the standard utilities. +.IP If either the .B \-V or .B \-v -option is supplied, a description of -.I command -is printed. The +option is supplied, \fBcommand\fP prints a description of +.IR command . +The .B \-v -option causes a single word indicating the command or filename +option displays a single word indicating the command or filename used to invoke -.I command -to be displayed; the +.IR command ; +the .B \-V option produces a more verbose description. +.IP If the .B \-V or .B \-v -option is supplied, the exit status is 0 if +option is supplied, the exit status is zero if .I command -was found, and 1 if not. If neither option is supplied and -an error occurred or +was found, and non-zero if not. +If neither option is supplied and an error occurred or .I command -cannot be found, the exit status is 127. Otherwise, the exit status of the +cannot be found, the exit status is 127. +Otherwise, the exit status of the .B command builtin is the exit status of .IR command . @@ -8505,9 +8824,11 @@ builtin with the exceptions of and .BR \-I , and write the matches to the standard output. +.IP If the \fB\-V\fP option is supplied, \fBcompgen\fP stores the generated completions into the indexed array variable \fIvarname\fP instead of writing them to the standard output. +.IP When using the \fB\-F\fP or \fB\-C\fP options, the various shell variables set by the programmable completion facilities, while available, will not have useful values. @@ -8516,7 +8837,7 @@ The matches will be generated in the same way as if the programmable completion code had generated them directly from a completion specification with the same flags. If \fIword\fP is specified, only those completions matching \fIword\fP -will be displayed. +will be displayed or stored. .IP The return value is true unless an invalid option is supplied, or no matches were generated. @@ -8614,8 +8935,8 @@ the end of the line. .TP 8 .B plusdirs After any matches defined by the compspec are generated, -directory name completion is attempted and any -matches are added to the results of the other actions. +attempt directory name completion and add any +matches to the results of the other actions. .RE .TP 8 \fB\-A\fP \fIaction\fP @@ -8713,29 +9034,30 @@ being completed, the second argument (\fB$2\fP) is the word being completed, and the third argument (\fB$3\fP) is the word preceding the word being completed on the current command line. -When it finishes, the possible completions are retrieved from the value +When \fIfunction\fP finishes, +the possible completions are retrieved from the value of the .SM .B COMPREPLY array variable. .TP 8 \fB\-G\fP \fIglobpat\fP -The pathname expansion pattern \fIglobpat\fP is expanded to generate +Expand the pathname expansion pattern \fIglobpat\fP to generate the possible completions. .TP 8 \fB\-P\fP \fIprefix\fP -\fIprefix\fP is added at the beginning of each possible completion +Add \fIprefix\fP to the beginning of each possible completion after all other options have been applied. .TP 8 \fB\-S\fP \fIsuffix\fP -\fIsuffix\fP is appended to each possible completion +Append \fIsuffix\fP to each possible completion after all other options have been applied. .TP 8 \fB\-W\fP \fIwordlist\fP The \fIwordlist\fP is split using the characters in the .SM .B IFS -special variable as delimiters, and each resultant word is expanded. +special variable as delimiters, and each resulting word is expanded. Shell quoting is honored within \fIwordlist\fP, in order to provide a mechanism for the words to contain shell metacharacters or characters @@ -8772,7 +9094,7 @@ an error occurs adding a completion specification. Modify completion options for each \fIname\fP according to the \fIoption\fPs, or for the currently-executing completion if no \fIname\fPs are supplied. -If no \fIoption\fPs are given, display the completion options for each +If no \fIoption\fPs are supplied, display the completion options for each \fIname\fP or the current completion. The possible values of \fIoption\fP are those valid for the \fBcomplete\fP builtin described above. @@ -8790,12 +9112,15 @@ apply to completion on the initial non-assignment word on the line, or after a command delimiter such as \fB;\fP or \fB|\fP, which is usually command name completion. .IP +If multiple options are supplied, the \fB\-D\fP option takes precedence +over \fB\-E\fP, and both take precedence over \fB\-I\fP. +.IP The return value is true unless an invalid option is supplied, an attempt is made to modify the options for a \fIname\fP for which no completion specification exists, or an output error occurs. .TP \fBcontinue\fP [\fIn\fP] -Resume the next iteration of the enclosing +\fBcontinue\fP resumes the next iteration of the enclosing .BR for , .BR while , .BR until , @@ -8804,9 +9129,10 @@ or loop. If .I n -is specified, resume at the \fIn\fPth enclosing loop. +is specified, \fBbash\fP resumes the \fIn\fPth enclosing loop. .I n -must be \(>= 1. If +must be \(>= 1. +If .I n is greater than the number of enclosing loops, the shell resumes the last enclosing loop @@ -8823,7 +9149,8 @@ The return value is 0 unless \fIn\fP is not greater than or equal to 1. [\fIname\fP[=\fIvalue\fP] .\|.\|.] .PD Declare variables and/or give them attributes. -If no \fIname\fPs are given then display the values of variables. +If no \fIname\fPs are given then display the values of variables +or functions. The .B \-p option will display the attributes and values of each @@ -8832,29 +9159,34 @@ When .B \-p is used with \fIname\fP arguments, additional options, other than \fB\-f\fP and \fB\-F\fP, are ignored. +.IP When .B \-p -is supplied without \fIname\fP arguments, it will display the attributes -and values of all variables having the attributes specified by the -additional options. -If no other options are supplied with \fB\-p\fP, \fBdeclare\fP will display -the attributes and values of all shell variables. The \fB\-f\fP option -will restrict the display to shell functions. +is supplied without \fIname\fP arguments, +\fBdeclare\fP will display the attributes and values +of all variables having the attributes specified by the additional options. +If no other options are supplied with \fB\-p\fP, \fBdeclare\fP will +display the attributes and values of all shell variables. +The \fB\-f\fP option restricts the display to shell functions. +.IP The .B \-F option inhibits the display of function definitions; only the function name and attributes are printed. If the \fBextdebug\fP shell option is enabled using \fBshopt\fP, the source file name and line number where each \fIname\fP -is defined are displayed as well. The +is defined are displayed as well. +The .B \-F option implies .BR \-f . +.IP The .B \-g option forces variables to be created or modified at the global scope, even when \fBdeclare\fP is executed in a shell function. -It is ignored in all other cases. +It is ignored when \fBdeclare\fP is not executed in a shell function. +.IP The .B \-I option causes local variables to inherit the attributes @@ -8862,6 +9194,7 @@ option causes local variables to inherit the attributes and value of any existing variable with the same \fIname\fP at a surrounding scope. If there is no existing variable, the local variable is initially unset. +.IP The following options can be used to restrict output to variables with the specified attribute or to give variables attributes: @@ -8881,10 +9214,11 @@ Each \fIname\fP is an associative array variable (see .el above). .TP .B \-f -Use function names only. +Each \fIname\fP refers to a shell function. .TP .B \-i -The variable is treated as an integer; arithmetic evaluation (see +The variable is treated as an integer; +arithmetic evaluation (see .SM .B "ARITHMETIC EVALUATION" .ie \n(zZ=1 in \fIbash\fP(1)) @@ -8907,7 +9241,8 @@ to \fIname\fP, except those using or changing the The nameref attribute cannot be applied to array variables. .TP .B \-r -Make \fIname\fPs readonly. These names cannot then be assigned values +Make \fIname\fPs readonly. +These names cannot then be assigned values by subsequent assignment statements or unset. .TP .B \-t @@ -8922,17 +9257,18 @@ converted to upper-case. The lower-case attribute is disabled. .TP .B \-x -Mark \fIname\fPs for export to subsequent commands via the environment. +Mark each \fIname\fP for export to subsequent commands via the environment. .PD .PP Using .Q + instead of .Q \- -turns off the attribute instead, -with the exceptions that \fB+a\fP and \fB+A\fP +turns off the specified +attribute instead, with the exceptions that \fB+a\fP and \fB+A\fP may not be used to destroy array variables and \fB+r\fP will not remove the readonly attribute. +.PP When used in a function, .B declare and @@ -8947,6 +9283,7 @@ the variable is set to \fIvalue\fP. When using \fB\-a\fP or \fB\-A\fP and the compound assignment syntax to create array variables, additional attributes do not take effect until subsequent assignments. +.PP The return value is 0 unless an invalid option is encountered, an attempt is made to define a function using .Q "\-f foo=bar" . @@ -8963,7 +9300,7 @@ or an attempt is made to display a non-existent function with \fB\-f\fP. .RE .TP .B dirs [\fB\-clpv\fP] [+\fIn\fP] [\-\fIn\fP] -Without options, displays the list of currently remembered directories. +Without options, display the list of currently remembered directories. The default display is on a single line with directory names separated by spaces. Directories are added to the list with the @@ -8972,6 +9309,8 @@ command; the .B popd command removes entries from the list. The current directory is always the first directory in the stack. +.IP +Options, if supplied, have the following meanings: .RS .PD 0 .TP @@ -9007,51 +9346,58 @@ invalid option is supplied or \fIn\fP indexes beyond the end of the directory stack. .RE .TP -\fBdisown\fP [\fB\-ar\fP] [\fB\-h\fP] \ -[\fIjobspec\fP .\|.\|. | \fIpid\fP .\|.\|. ] +\fBdisown\fP [\fB\-ar\fP] [\fB\-h\fP] [\fIid\fP .\|.\|.] Without options, remove each -.I jobspec +.I id from the table of active jobs. +Each \fIid\fP may be a job specification \fIjobspec\fP +or a process ID +\fIpid\fP; if \fIid\fP is a \fIpid\fP, +\fBdisown\fP uses the job containing \fIpid\fP as \fIjobspec\fP. If -.I jobspec +.I id is not present, and neither the \fB\-a\fP nor the \fB\-r\fP option -is supplied, the \fIcurrent job\fP is used. -If the \fB\-h\fP option is given, each -.I jobspec +is supplied, \fBdisown\fP removes the \fIcurrent job\fP. +If the \fB\-h\fP option is supplied, the job corresponding to each +.I id is not removed from the table, but is marked so that .SM .B SIGHUP is not sent to the job if the shell receives a .SM .BR SIGHUP . +.IP If no -.I jobspec +.I id is supplied, the .B \-a option means to remove or mark all jobs; the .B \-r -option without a -.I jobspec +option without an +.I id argument restricts operation to running jobs. -The return value is 0 unless a -.I jobspec +.IP +The return value is 0 unless an +.I id does not specify a valid job. .TP \fBecho\fP [\fB\-neE\fP] [\fIarg\fP .\|.\|.] Output the \fIarg\fPs, separated by spaces, followed by a newline. The return status is 0 unless a write error occurs. -If \fB\-n\fP is specified, the trailing newline is -suppressed. If the \fB\-e\fP option is given, interpretation of -the following backslash-escaped characters is enabled. The +If \fB\-n\fP is specified, the trailing newline is not printed. +.IP +If the \fB\-e\fP option is given, \fBecho\fP interprets +the following backslash-escaped characters. +The .B \-E -option disables the interpretation of these escape characters, +option disables interpretation of these escape characters, even on systems where they are interpreted by default. -The \fBxpg_echo\fP shell option may be used to -dynamically determine whether or not \fBecho\fP -interprets any options -and expands these escape characters by default. +The \fBxpg_echo\fP shell option determines +whether or not \fBecho\fP interprets any options +and expands these escape characters. .B echo does not interpret \fB\-\-\fP to mean the end of options. +.IP .B echo interprets the following escape sequences: .RS @@ -9105,23 +9451,38 @@ the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value \fIHHHHHHHH\fP (one to eight hex digits) .PD +.PP +\fBecho\fP writes any unrecognized backslash-escaped characters unchanged. .RE .TP \fBenable\fP [\fB\-a\fP] [\fB\-dnps\fP] [\fB\-f\fP \fIfilename\fP] \ [\fIname\fP .\|.\|.] Enable and disable builtin shell commands. -Disabling a builtin allows a disk command which has the same name +Disabling a builtin allows an executable file which has the same name as a shell builtin to be executed without specifying a full pathname, -even though the shell normally searches for builtins before disk commands. -If \fB\-n\fP is used, each \fIname\fP -is disabled; otherwise, -\fInames\fP are enabled. For example, to use the +even though the shell normally searches for builtins before files. +.IP +If \fB\-n\fP is supplied, each \fIname\fP is disabled; otherwise, +\fIname\fPs are enabled. +For example, to use the .B test -binary found via the +binary found usin g .SM .B PATH instead of the shell builtin version, run .QN "enable \-n test" . +.IP +If no \fIname\fP arguments are supplied, or if the +.B \-p +option is supplied, print a list of shell builtins. +With no other option arguments, the list consists of all enabled +shell builtins. +If \fB\-n\fP is supplied, print only disabled builtins. +If \fB\-a\fP is supplied, the list printed includes all builtins, with an +indication of whether or not each is enabled. +The \fB\-s\fP option means to restrict the output to the POSIX +\fIspecial\fP builtins. +.IP The .B \-f option means to load the new builtin command @@ -9129,41 +9490,34 @@ option means to load the new builtin command from shared object .IR filename , on systems that support dynamic loading. +If \fIfilename\fP does not contain a slash, \fBBash\fP will use the value of the \fBBASH_LOADABLES_PATH\fP variable as a -colon-separated list of directories in which to search for \fIfilename\fP, -if \fIfilename\fP does not contain a slash. -The default is system-dependent, +colon-separated list of directories in which to search for \fIfilename\fP. +The default for \fBBASH_LOADABLES_PATH\fP is system-dependent, and may include .Q .\& to force a search of the current directory. The .B \-d -option will delete a builtin previously loaded with -.BR \-f . -If no \fIname\fP arguments are given, or if the -.B \-p -option is supplied, a list of shell builtins is printed. -With no other option arguments, the list consists of all enabled -shell builtins. -If \fB\-n\fP is supplied, only disabled builtins are printed. -If \fB\-a\fP is supplied, the list printed includes all builtins, with an -indication of whether or not each is enabled. -If \fB\-s\fP is supplied, the output is restricted to the POSIX -\fIspecial\fP builtins. +option will delete a builtin previously loaded with \fB\-f\fP. +If \fI\-s\fP is used with \fI\-f\fP, the new builtin becomes a POSIX +special builtin. +.IP If no options are supplied and a \fIname\fP is not a shell builtin, -\fBenable\fP will attempt to load \fIname\fP from a shared object named -\fIname\fP, as if the command were +\fBenable\fP will attempt to load \fIname\fP from a shared +object named \fIname\fP, as if the command were .QN "enable \-f \fIname name\fP" . +.IP The return value is 0 unless a .I name is not a shell builtin or there is an error loading a new builtin from a shared object. .TP \fBeval\fP [\fIarg\fP .\|.\|.] -The \fIarg\fPs are read and concatenated together into a single -command. This command is then read and executed by the shell, and -its exit status is returned as the value of -.BR eval . +Concatenate the \fIarg\fPs together into a single command, separating +them with spaces. +\fBBash\fP then reads and execute this command, and returns its exit status +as the return status of \fBeval\fP. If there are no .IR args , or only null arguments, @@ -9173,8 +9527,9 @@ returns 0. \fBexec\fP [\fB\-cl\fP] [\fB\-a\fP \fIname\fP] [\fIcommand\fP [\fIarguments\fP]] If .I command -is specified, it replaces the shell. -No new process is created. The +is specified, it replaces the shell without creating a new process. +\fIcommand\fP cannot be a shell builtin or function. +The .I arguments become the arguments to \fIcommand\fP. If the @@ -9188,20 +9543,23 @@ does. The .B \-c option causes .I command -to be executed with an empty environment. If +to be executed with an empty environment. +If .B \-a is supplied, the shell passes .I name as the zeroth argument to the executed command. +.IP If .I command cannot be executed for some reason, a non-interactive shell exits, unless the .B execfail -shell option -is enabled. In that case, it returns failure. -An interactive shell returns failure if the file cannot be executed. +shell option is enabled. +In that case, it returns a non-zero status. +An interactive shell returns a non-zero status if the file cannot be executed. A subshell exits unconditionally if \fBexec\fP fails. +.IP If .I command is not specified, any redirections take effect in the current shell, @@ -9209,17 +9567,16 @@ and the return status is 0. If there is a redirection error, the return status is 1. .TP \fBexit\fP [\fIn\fP] -Cause the shell to exit -with a status of \fIn\fP. If +Cause the shell to exit with a status of \fIn\fP. +If .I n -is omitted, the exit status -is that of the last command executed. -A trap on +is omitted, the exit status is that of the last command executed. +Any trap on .SM .B EXIT is executed before the shell terminates. .TP -\fBexport\fP [\fB\-fn\fP\^] [\fIname\fP[=\fIword\fP]] .\|.\|. +\fBexport\fP [\fB\-fn\fP\^] [\fIname\fP[=\fIvalue\fP]] .\|.\|. .PD 0 .TP .B export \-p @@ -9227,23 +9584,27 @@ is executed before the shell terminates. The supplied .I names are marked for automatic export to the environment of -subsequently executed commands. If the +subsequently executed commands. +If the .B \-f option is given, the .I names refer to functions. +.IP +The +.B \-n +option unexports, or removes the export attribute, from each \fIname\fP. If no .I names are given, or if the .B \-p -option is supplied, a list -of names of all exported variables is printed. -The -.B \-n -option causes the export property to be removed from each -\fIname\fP. -If a variable name is followed by =\fIword\fP, the value of -the variable is set to \fIword\fP. +option is supplied, \fBexport\fP prints a list of names of all exported +variables on the standard output. +.IP +\fBexport\fP allows the value of a variable to be set when it is exported +or unexported by following the variable name with =\fIvalue\fP. +This sets the value of the variable to \fIvalue\fP while modifying the +export attribute. .B export returns an exit status of 0 unless an invalid option is encountered, @@ -9254,7 +9615,7 @@ is supplied with a that is not a function. .TP \fBfalse\fP -Does nothing, returns a non-zero status. +Does nothing; returns a non-zero status. .TP \fBfc\fP [\fB\-e\fP \fIename\fP] [\fB\-lnr\fP] [\fIfirst\fP] [\fIlast\fP] .PD 0 @@ -9273,6 +9634,7 @@ may be specified as a string (to locate the last command beginning with that string) or as a number (an index into the history list, where a negative number is used as an offset from the current command number). +.IP When listing, a \fIfirst\fP or \fIlast\fP of 0 is equivalent to \-1 and \-0 is equivalent to the current command (usually the \fBfc\fP command); otherwise 0 is equivalent to \-1 @@ -9290,41 +9652,44 @@ If is not specified, it is set to the previous command for editing and \-16 for listing. .IP +If the +.B \-l +option is supplied, the commands are listed on the standard output. The .B \-n option suppresses -the command numbers when listing. The +the command numbers when listing. +The .B \-r option reverses the order of -the commands. If the -.B \-l -option is given, -the commands are listed on -standard output. Otherwise, the editor given by +the commands. +.IP +Otherwise, \fBfc\fP invokes the editor named by .I ename -is invoked -on a file containing those commands. If +on a file containing those commands. +If .I ename -is not given, the -value of the +is not supplied, \fBfc\fP uses the value of the .SM .B FCEDIT -variable is used, and +variable, and the value of .SM .B EDITOR if .SM .B FCEDIT -is not set. If neither variable is set, -.FN vi -is used. When editing is complete, the edited commands are -echoed and executed. +is not set. +If neither variable is set, \fBfc\fP uses +.FN vi. +When editing is complete, \fBfc\fP reads the file containing +the edited commands and echoes and executes them. .IP -In the second form, \fIcommand\fP is re-executed after each instance -of \fIpat\fP is replaced by \fIrep\fP. +In the second form, \fBfc\fP re-executes \fIcommand\fP +after replacing each instance of \fIpat\fP with \fIrep\fP. \fICommand\fP is interpreted the same as \fIfirst\fP above. -A useful alias to use with this is +.IP +A useful alias to use with \fBfc\fP is .Q "r=\*"fc \-s\*"" , so that typing .Q "r cc" @@ -9334,22 +9699,21 @@ and typing .Q r re-executes the last command. .IP -If the first form is used, the return value is 0 unless an invalid +If the first form is used, the return value is zero unless an invalid option is encountered or .I first or .I last specify history lines out of range. -If the -.B \-e -option is supplied, the return value is the value of the last -command executed or failure if an error occurs with the temporary -file of commands. If the second form is used, the return status -is that of the command re-executed, unless +When editing and re-executing a file of commands, +the return value is the value of the last command executed +or failure if an error occurs with the temporary file. +If the second form is used, the return status +is that of the re-executed command, unless .I cmd -does not specify a valid history line, in which case +does not specify a valid history entry, in which case .B fc -returns failure. +returns a non-zero status. .TP \fBfg\fP [\fIjobspec\fP] Resume @@ -9357,7 +9721,7 @@ Resume in the foreground, and make it the current job. If .I jobspec -is not present, the shell's notion of the \fIcurrent job\fP is used. +is not present, use the shell's notion of the \fIcurrent job\fP. The return value is that of the command placed into the foreground, or failure if run when job control is disabled or, when run with job control enabled, if @@ -9368,13 +9732,15 @@ specifies a job that was started without job control. .TP \fBgetopts\fP \fIoptstring\fP \fIname\fP [\fIarg\fP .\|.\|.] .B getopts -is used by shell procedures to parse positional parameters. +is used by shell scripts and functions to parse positional parameters +and obtain options and their arguments. .I optstring contains the option characters to be recognized; if a character is followed by a colon, the option is expected to have an argument, which should be separated from it by white space. The colon and question mark characters may not be used as option characters. +.IP Each time it is invoked, .B getopts places the next option in the shell variable @@ -9389,21 +9755,22 @@ variable .SM .B OPTIND is initialized to 1 each time the shell or a shell script -is invoked. When an option requires an argument, +is invoked. +When an option requires an argument, .B getopts places that argument into the variable .SM .BR OPTARG . +.IP The shell does not reset .SM .B OPTIND automatically; it must be manually reset between multiple calls to .B getopts -within the same shell invocation if a new set of parameters -is to be used. +within the same shell invocation to use a new set of parameters. .IP -When the end of options is encountered, \fBgetopts\fP exits with a +When it reaches the end of options, \fBgetopts\fP exits with a return value greater than zero. .SM .B OPTIND @@ -9419,13 +9786,14 @@ values, parses those instead. .IP .B getopts -can report errors in two ways. If the first character of +can report errors in two ways. +If the first character of .I optstring -is a colon, +is a colon, \fBgetopts\fP uses .I silent -error reporting is used. In normal operation, diagnostic messages -are printed when invalid options or missing option arguments are -encountered. +error reporting. +In normal operation, \fBgetopts\fP prints diagnostic messages +when it encounters invalid options or missing option arguments. If the variable .SM .B OPTERR @@ -9470,18 +9838,19 @@ It returns false if the end of options is encountered or an error occurs. .TP \fBhash\fP [\fB\-lr\fP] [\fB\-p\fP \fIfilename\fP] [\fB\-dt\fP] [\fIname\fP] -Each time \fBhash\fP is invoked, +Each time \fBhash\fP is invoked, it remembers the full pathname of the command .I name -is determined by searching +as determined by searching the directories in -.B $PATH -and remembered. Any previously-remembered pathname is discarded. +.BR $PATH . +Any previously-remembered pathname associated with \fIname\fP is discarded. If the .B \-p option is supplied, \fBhash\fP uses .I filename -as the full filename of the command. +as the full pathname of the command. +.IP The .B \-r option causes the shell to forget all @@ -9490,34 +9859,40 @@ Assigning to the \fBPATH\fP variable also clears all hashed filenames. The .B \-d option causes the shell to forget the remembered location of each \fIname\fP. +.IP If the .B \-t -option is supplied, the full pathname to which each \fIname\fP corresponds -is printed. If multiple \fIname\fP arguments are supplied with \fB\-t\fP, -the \fIname\fP is printed before the hashed full pathname. +option is supplied, \fBhash\fP prints the full pathname corresponding to +each \fIname\fP. +If multiple \fIname\fP arguments are supplied with \fB\-t\fP, +\fBhash\fP prints the \fIname\fP before the corresponding hashed +full pathname. The .B \-l -option causes output to be displayed in a format that may be reused as input. +option displays output in a format that may be reused as input. +.IP If no arguments are given, or if only \fB\-l\fP is supplied, -information about remembered commands is printed. +\fBhash\fP prints information about remembered commands. The \fB\-t\fP, \fB\-d\fP, and \fB\-p\fP options (the options that act on the \fIname\fP arguments) are mutually exclusive. Only one will be active. If more than one is supplied, \fB\-t\fP has higher priority than -\fB\-p\fP, and both are higher priority than \fB\-d\fP. -The return status is true unless a +\fB\-p\fP, and both have higher priority than \fB\-d\fP. +.IP +The return status is zero unless a .I name is not found or an invalid option is supplied. .TP \fBhelp\fP [\fB\-dms\fP] [\fIpattern\fP] -Display helpful information about builtin commands. If +Display helpful information about builtin commands. +If .I pattern is specified, .B help gives detailed help on all commands matching .IR pattern ; -otherwise help for all the builtins and shell control structures -is printed. +otherwise it displays a list of +all the builtins and shell compound commands. .RS .PD 0 .TP @@ -9550,15 +9925,15 @@ The return status is 0 unless no command matches .TP \fBhistory\fP \fB\-s\fP \fIarg\fP [\fIarg\fP .\|.\|.] .PD -With no options, display the command -history list with line numbers. Lines listed -with a +With no options, display the command history list with numbers. +Entries prefixed with a .B * -have been modified. An argument of +have been modified. +An argument of .I n lists only the last .I n -lines. +entries. If the shell variable .SM .B HISTTIMEFORMAT @@ -9566,24 +9941,31 @@ is set and not null, it is used as a format string for .IR strftime (3) to display the time stamp associated with each displayed history entry. -No intervening blank is printed between the formatted time stamp -and the history line. -If \fIfilename\fP is supplied, it is used as the -name of the history file; if not, the value of +If +.B history +uses .SM -.B HISTFILE -is used. +.BR HISTTIMEFORMAT , +it does not print an intervening space between the formatted time stamp +and the history entry. +.IP +If \fIfilename\fP is supplied, \fBhistory\fP uses it as the +name of the history file; if not, it uses the value of +.SM +.BR HISTFILE . If \fIfilename\fP is not supplied and .SM .B HISTFILE is unset or null, the \fB\-a, \-n, \-r,\fP and \fB\-w\fP options have no effect. +.IP Options, if supplied, have the following meanings: .RS .PD 0 .TP .B \-c Clear the history list by deleting all the entries. +This can be used with the other options to replace the history list. .TP \fB\-d\fP \fIoffset\fP Delete the history entry at position \fIoffset\fP. @@ -9607,13 +9989,12 @@ These are history lines entered since the beginning of the current .TP .B \-n Read the history lines not already read from the history -file into the current history list. These are lines -appended to the history file since the beginning of the +file into the current history list. +These are lines appended to the history file since the beginning of the current \fBbash\fP session. .TP .B \-r -Read the contents of the history file -and append them to the current history list. +Read the history file and append its contents to the current history list. .TP .B \-w Write the current history list to the history file, overwriting the @@ -9621,55 +10002,54 @@ history file's contents. .TP .B \-p Perform history substitution on the following \fIargs\fP and display -the result on the standard output. -Does not store the results in the history list. +the result on the standard output, +without storing the results in the history list. Each \fIarg\fP must be quoted to disable normal history expansion. .TP .B \-s Store the .I args -in the history list as a single entry. The last command in the -history list is removed before the -.I args -are added. +in the history list as a single entry. +The last command in the +history list is removed before adding the +.IR args . .PD -.PP +.RE +.IP If the .SM .B HISTTIMEFORMAT -variable is set, the time stamp information -associated with each history entry is written to the history file, +variable is set, \fBhistory\fP writes the time stamp information +associated with each history entry to the history file, marked with the history comment character. When the history file is read, lines beginning with the history comment character followed immediately by a digit are interpreted as timestamps for the following history entry. +.IP The return value is 0 unless an invalid option is encountered, an error occurs while reading or writing the history file, an invalid \fIoffset\fP or range is supplied as an argument to \fB\-d\fP, or the history expansion supplied as an argument to \fB\-p\fP fails. -.RE .TP \fBjobs\fP [\fB\-lnprs\fP] [ \fIjobspec\fP .\|.\|. ] .PD 0 .TP \fBjobs\fP \fB\-x\fP \fIcommand\fP [ \fIargs\fP .\|.\|. ] .PD -The first form lists the active jobs. The options have the following -meanings: +The first form lists the active jobs. +The options have the following meanings: .RS .PD 0 .TP .B \-l -List process IDs -in addition to the normal information. +List process IDs in addition to the normal information. .TP .B \-n Display information only about jobs that have changed status since the user was last notified of their status. .TP .B \-p -List only the process ID of the job's process group -leader. +List only the process ID of the job's process group leader. .TP .B \-r Display only running jobs. @@ -9677,15 +10057,16 @@ Display only running jobs. .B \-s Display only stopped jobs. .PD -.PP +.RE +.IP If .I jobspec -is given, output is restricted to information about that job. +is supplied, \fBjobs\fP restricts output to information about that job. The return status is 0 unless an invalid option is encountered or an invalid .I jobspec is supplied. -.PP +.IP If the .B \-x option is supplied, @@ -9697,11 +10078,10 @@ found in or .I args with the corresponding process group ID, and executes -.I command +.IR command , passing it .IR args , returning its exit status. -.RE .TP \fBkill\fP [\fB\-s\fP \fIsigspec\fP | \fB\-n\fP \fIsignum\fP | \fB\-\fP\fIsigspec\fP] \ [\fIpid\fP | \fIjobspec\fP] .\|.\|. @@ -9709,7 +10089,7 @@ returning its exit status. .TP \fBkill\fP \fB\-l\fP|\fB\-L\fP [\fIsigspec\fP | \fIexit_status\fP] .PD -Send the signal named by +Send the signal specified by .I sigspec or .I signum @@ -9729,17 +10109,21 @@ prefix) or a signal number; is a signal number. If .I sigspec -is not present, then +is not supplied, then +.B kill +sends .SM -.B SIGTERM -is assumed. +.BR SIGTERM . +.IP An argument of .B \-l lists the signal names. If any arguments are supplied when .B \-l -is given, the names of the signals corresponding to the arguments are -listed, and the return status is 0. +is given, +.B kill +lists the names of the signals corresponding to the arguments, +and the return status is 0. The \fIexit_status\fP argument to .B \-l is a number specifying either a signal number or the exit status of @@ -9747,6 +10131,7 @@ a process terminated by a signal. The .B \-L option is equivalent to \fB\-l\fP. +.IP .B kill returns true if at least one signal was successfully sent, or false if an error occurs or an invalid option is encountered. @@ -9754,7 +10139,7 @@ if an error occurs or an invalid option is encountered. \fBlet\fP \fIarg\fP [\fIarg\fP .\|.\|.] Each .I arg -is an arithmetic expression to be evaluated (see +is evaluated as an arithmetic expression (see .SM .B "ARITHMETIC EVALUATION" .ie \n(zZ=1 in \fIbash\fP(1)). @@ -9763,12 +10148,14 @@ If the last .I arg evaluates to 0, .B let -returns 1; 0 is returned otherwise. +returns 1; otherwise +.B let +returns 0. .TP \fBlocal\fP [\fIoption\fP] [\fIname\fP[=\fIvalue\fP] .\|.\|. | \- ] -For each argument, a local variable named +For each argument, create a local variable named .I name -is created, and assigned +and assign it .IR value . The \fIoption\fP can be any of the options accepted by \fBdeclare\fP. When @@ -9776,41 +10163,46 @@ When is used within a function, it causes the variable .I name to have a visible scope restricted to that function and its children. -If \fIname\fP is \-, the set of shell options is made local to the function -in which \fBlocal\fP is invoked: shell options changed using the -\fBset\fP builtin inside the function -after the call to \fBlocal\fP -are restored to their original values -when the function returns. -The restore is effected as if a series of \fBset\fP commands were executed -to restore the values that were in place before the function. -With no operands, +It is an error to use .B local -writes a list of local variables to the standard output. It is -an error to use +when not within a function. +.IP +If \fIname\fP is \-, it makes the set of shell options +local to the function in which \fBlocal\fP is invoked: +any shell options changed using the \fBset\fP builtin inside +the function after the call to \fBlocal\fP are restored to their +original values when the function returns. +The restore is performed as if a series of \fBset\fP commands were +executed to restore the values that were in place before the function. +.IP +With no operands, .B local -when not within a function. The return status is 0 unless +writes a list of local variables to the standard output. +.IP +The return status is 0 unless .B local is used outside a function, an invalid .I name is supplied, or \fIname\fP is a readonly variable. .TP -.B logout -Exit a login shell. +.B logout [\fIn\fP] +Exit a login shell, +returning a status of \fIn\fP to the shell's parent. .TP \fBmapfile\fP [\fB\-d\fP \fIdelim\fP] [\fB\-n\fP \fIcount\fP] [\fB\-O\fP \fIorigin\fP] [\fB\-s\fP \fIcount\fP] [\fB\-t\fP] [\fB\-u\fP \fIfd\fP] [\fB\-C\fP \fIcallback\fP] [\fB\-c\fP \fIquantum\fP] [\fIarray\fP] .PD 0 .TP \fBreadarray\fP [\fB\-d\fP \fIdelim\fP] [\fB\-n\fP \fIcount\fP] [\fB\-O\fP \fIorigin\fP] [\fB\-s\fP \fIcount\fP] [\fB\-t\fP] [\fB\-u\fP \fIfd\fP] [\fB\-C\fP \fIcallback\fP] [\fB\-c\fP \fIquantum\fP] [\fIarray\fP] .PD -Read lines from the standard input into the indexed array variable -.IR array , +Read lines from the standard input, or from file descriptor .I fd if the .B \-u -option is supplied. +option is supplied, +into the indexed array variable +.IR array . The variable .SM .B MAPFILE @@ -9820,7 +10212,7 @@ Options, if supplied, have the following meanings: .PD 0 .TP .B \-d -The first character of \fIdelim\fP is used to terminate each input line, +Use the first character of \fIdelim\fP to terminate each input line, rather than newline. If \fIdelim\fP is the empty string, \fBmapfile\fP will terminate a line when it reads a NUL character. @@ -9828,7 +10220,8 @@ when it reads a NUL character. .B \-n Copy at most .I count -lines. If \fIcount\fP is 0, all lines are copied. +lines. +If \fIcount\fP is 0, copy all lines. .TP .B \-O Begin assigning to @@ -9849,14 +10242,16 @@ Read lines from file descriptor \fIfd\fP instead of the standard input. .B \-C Evaluate .I callback -each time \fIquantum\fP lines are read. The \fB\-c\fP option specifies +each time \fIquantum\fP lines are read. +The \fB\-c\fP option specifies .IR quantum . .TP .B \-c Specify the number of lines read between each call to .IR callback . .PD -.PP +.RE +.IP If .B \-C is specified without @@ -9867,32 +10262,31 @@ array element to be assigned and the line to be assigned to that element as additional arguments. \fIcallback\fP is evaluated after the line is read but before the array element is assigned. -.PP +.IP If not supplied with an explicit origin, \fBmapfile\fP will clear \fIarray\fP before assigning to it. -.PP -\fBmapfile\fP returns successfully unless an invalid option or option +.IP +\fBmapfile\fP returns zero unless an invalid option or option argument is supplied, \fIarray\fP is invalid or unassignable, or if \fIarray\fP is not an indexed array. -.RE .TP \fBpopd\fP [\-\fBn\fP] [+\fIn\fP] [\-\fIn\fP] -Removes entries from the directory stack. +Remove entries from the directory stack. The elements are numbered from 0 starting at the first directory -listed by \fBdirs\fP. -With no arguments, \fBpopd\fP -removes the top directory from the stack, and -changes to the new top directory. +listed by \fBdirs\fP, so \fBpopd\fP is equivalent to +.Q "popd +0." +With no arguments, \fBpopd\fP removes the top directory from the stack, +and changes to the new top directory. Arguments, if supplied, have the following meanings: .RS .PD 0 .TP .B \-n -Suppresses the normal change of directory when removing directories -from the stack, so that only the stack is manipulated. +Suppress the normal change of directory when removing directories +from the stack, only manipulate the stack. .TP \fB+\fP\fIn\fP -Removes the \fIn\fPth entry counting from the left of the list +Remove the \fIn\fPth entry counting from the left of the list shown by .BR dirs , starting with zero, from the stack. @@ -9903,7 +10297,7 @@ removes the first directory, the second. .TP \fB\-\fP\fIn\fP -Removes the \fIn\fPth entry counting from the right of the list +Remove the \fIn\fPth entry counting from the right of the list shown by .BR dirs , starting with zero. For example: @@ -9912,31 +10306,31 @@ removes the last directory, .Q "popd \-1" the next to last. .PD -.PP +.RE +.IP If the top element of the directory stack is modified, and the \fI\-n\fP option was not supplied, \fBpopd\fP uses the \fBcd\fP builtin to change to the directory at the top of the stack. If the \fBcd\fP fails, \fBpopd\fP returns a non-zero value. -.PP +.IP Otherwise, .B popd -returns false if an invalid option is encountered, the directory stack -is empty, or a non-existent directory stack entry is specified. -.PP +returns false if an invalid option is supplied, the directory stack +is empty, or \fIn\fP specifies a non-existent directory stack entry. +.IP If the .B popd command is successful, -bash runs +\fBbash\fP runs .B dirs to show the final contents of the directory stack, and the return status is 0. -.RE .TP \fBprintf\fP [\fB\-v\fP \fIvar\fP] \fIformat\fP [\fIarguments\fP] Write the formatted \fIarguments\fP to the standard output under the control of the \fIformat\fP. -The \fB\-v\fP option causes the output to be assigned to the variable -\fIvar\fP rather than being printed to the standard output. +The \fB\-v\fP option assigns the output to the variable +\fIvar\fP rather than printing it to the standard output. .IP The \fIformat\fP is a character string which contains three types of objects: plain characters, which are simply copied to standard output, character @@ -9975,33 +10369,35 @@ causes \fBprintf\fP to output the date-time string resulting from using .IR strftime (3). The corresponding \fIargument\fP is an integer representing the number of seconds since the epoch. -Two special argument values may be used: \-1 represents the current -time, and \-2 represents the time the shell was invoked. -If no argument is specified, conversion behaves as if \-1 had been given. +This format specifier recognizes two special argument values: +\-1 represents the current time, +and \-2 represents the time the shell was invoked. +If no argument is specified, conversion behaves as if \-1 had been supplied. This is an exception to the usual \fBprintf\fP behavior. .PD -.PP +.RE +.IP The %b, %q, and %T format specifiers all use the field width and precision arguments from the format specification and write that many bytes from (or use that wide a field for) the expanded argument, which usually contains more characters than the original. -.PP +.IP The %n format specifier accepts a corresponding argument that is treated as a shell variable name. -.PP +.IP The %s and %c format specifiers accept an l (long) modifier, which forces them to convert the argument string to a wide-character string and apply any supplied field width and precision in terms of characters, not bytes. The %S and %C format specifiers are equivalent to %ls and %lc, respectively. -.\" .PP +.\" .IP .\" The %s format specifier understands the "altform" flag (#) and behaves .\" identically to the %b format specifier if it's supplied. -.PP +.IP Arguments to non-string format specifiers are treated as C constants, except that a leading plus or minus sign is allowed, and if the leading character is a single or double quote, the value is the numeric value of the following character, using the current locale. -.PP +.IP The \fIformat\fP is reused as necessary to consume all of the \fIarguments\fP. If the \fIformat\fP requires more \fIarguments\fP than are supplied, the extra format specifications behave as if a zero value or null string, as @@ -10009,14 +10405,13 @@ appropriate, had been supplied. The return value is zero on success, non-zero if an invalid option is supplied or a write or assignment error occurs. -.RE .TP \fBpushd\fP [\fB\-n\fP] [+\fIn\fP] [\-\fIn\fP] .PD 0 .TP \fBpushd\fP [\fB\-n\fP] [\fIdir\fP] .PD -Adds a directory to the top of the directory stack, or rotates +Add a directory to the top of the directory stack, or rotate the stack, making the new top of the stack the current working directory. With no arguments, \fBpushd\fP exchanges the top two elements of @@ -10026,11 +10421,11 @@ Arguments, if supplied, have the following meanings: .PD 0 .TP .B \-n -Suppresses the normal change of directory when rotating or -adding directories to the stack, so that only the stack is manipulated. +Suppress the normal change of directory when rotating or +adding directories to the stack, only manipulate the stack. .TP \fB+\fP\fIn\fP -Rotates the stack so that the \fIn\fPth directory +Rotate the stack so that the \fIn\fPth directory (counting from the left of the list shown by .BR dirs , starting with zero) @@ -10045,29 +10440,29 @@ starting with zero) is at the top. .I dir Adds .I dir -to the directory stack at the top +to the directory stack at the top. .PD -.PP +.RE +.IP After the stack has been modified, if the \fB\-n\fP option was not supplied, \fBpushd\fP uses the \fBcd\fP builtin to change to the directory at the top of the stack. If the \fBcd\fP fails, \fBpushd\fP returns a non-zero value. -.PP +.IP Otherwise, if no arguments are supplied, .B pushd -returns 0 unless the directory stack is empty. +returns zero unless the directory stack is empty. When rotating the directory stack, .B pushd -returns 0 unless the directory stack is empty or -a non-existent directory stack element is specified. -.PP +returns zero unless the directory stack is empty or +\fIn\fP specifies a non-existent directory stack element. +.IP If the .B pushd command is successful, -bash runs +\fBbash\fP runs .B dirs to show the final contents of the directory stack. -.RE .TP \fBpwd\fP [\fB\-LP\fP] Print the absolute pathname of the current working directory. @@ -10090,14 +10485,13 @@ invalid option is supplied. [\fB\-n\fP \fInchars\fP] [\fB\-N\fP \fInchars\fP] \ [\fB\-p\fP \fIprompt\fP] [\fB\-t\fP \fItimeout\fP] \ [\fB\-u\fP \fIfd\fP] [\fIname\fP .\|.\|.] -One line is read from the standard input, or from the file descriptor +Read one line from the standard input, or from the file descriptor \fIfd\fP supplied as an argument to the \fB\-u\fP option, -split into words as described +split it into words as described .ie \n(zZ=1 in \fIbash\fP (1) .el above under \fBWord Splitting\fP, -and the first word -is assigned to the first +and assign the first word to the first .IR name , the second word to the second .IR name , @@ -10107,23 +10501,24 @@ intervening delimiters are assigned to the last .IR name . If there are fewer words read from the input stream than names, the remaining names are assigned empty values. -The characters in +The characters in the value of the .SM .B IFS +variable are used to split the line into words using the same rules the shell uses for expansion (described .ie \n(zZ=1 in \fIbash\fP (1) .el above under \fBWord Splitting\fP). -The backslash character (\fB\e\fP) may be used to remove any special -meaning for the next character read and for line continuation. +The backslash character (\fB\e\fP) removes any special +meaning for the next character read and is used for line continuation. +.IP Options, if supplied, have the following meanings: .RS .PD 0 .TP .B \-a \fIaname\fP -The words are assigned to sequential indices -of the array variable +The words are assigned to sequential indices of the array variable .IR aname , starting at 0. .I aname @@ -10131,14 +10526,13 @@ is unset before any new values are assigned. Other \fIname\fP arguments are ignored. .TP .B \-d \fIdelim\fP -The first character of \fIdelim\fP is used to terminate the input line, +The first character of \fIdelim\fP terminates the input line, rather than newline. If \fIdelim\fP is the empty string, \fBread\fP will terminate a line when it reads a NUL character. .TP .B \-e -If the standard input -is coming from a terminal, +If the standard input is coming from a terminal, \fBread\fP uses .B readline (see @@ -10151,8 +10545,7 @@ Readline uses the current (or default, if line editing was not previously active) editing settings, but uses readline's default filename completion. .TP .B \-E -If the standard input -is coming from a terminal, +If the standard input is coming from a terminal, \fBread\fP uses .B readline (see @@ -10168,29 +10561,31 @@ programmable completion. .B \-i \fItext\fP If .B readline -is being used to read the line, \fItext\fP is placed into the editing -buffer before editing begins. +is being used to read the line, \fBread\fP places \fItext\fP into +the editing buffer before editing begins. .TP .B \-n \fInchars\fP \fBread\fP returns after reading \fInchars\fP characters rather than -waiting for a complete line of input, but honors a delimiter if fewer -than \fInchars\fP characters are read before the delimiter. +waiting for a complete line of input, +unless it encounters EOF or \fBread\fP times out, +but honors a delimiter if it reads fewer +than \fInchars\fP characters before the delimiter. .TP .B \-N \fInchars\fP \fBread\fP returns after reading exactly \fInchars\fP characters rather -than waiting for a complete line of input, unless EOF is encountered or -\fBread\fP times out. -Delimiter characters encountered in the input are +than waiting for a complete line of input, +unless it encounters EOF or \fBread\fP times out. +Any delimiter characters in the input are not treated specially and do not cause \fBread\fP to return until -\fInchars\fP characters are read. +it has read \fInchars\fP characters. The result is not split on the characters in \fBIFS\fP; the intent is that the variable is assigned exactly the characters read (with the exception of backslash; see the \fB\-r\fP option below). .TP .B \-p \fIprompt\fP Display \fIprompt\fP on standard error, without a -trailing newline, before attempting to read any input. The prompt -is displayed only if input is coming from a terminal. +trailing newline, before attempting to read any input, but +only if input is coming from a terminal. .TP .B \-r Backslash does not act as an escape character. @@ -10199,58 +10594,55 @@ In particular, a backslash-newline pair may not then be used as a line continuation. .TP .B \-s -Silent mode. If input is coming from a terminal, characters are -not echoed. +Silent mode. +If input is coming from a terminal, characters are not echoed. .TP .B \-t \fItimeout\fP -Cause \fBread\fP to time out and return failure if a complete line of -input (or a specified number of characters) -is not read within \fItimeout\fP seconds. +Cause \fBread\fP to time out and return failure if it does not read +a complete line of input (or a specified number of characters) +within \fItimeout\fP seconds. \fItimeout\fP may be a decimal number with a fractional portion following the decimal point. This option is only effective if \fBread\fP is reading input from a terminal, pipe, or other special file; it has no effect when reading from regular files. -If \fBread\fP times out, \fBread\fP saves any partial input read into -the specified variable \fIname\fP. +If \fBread\fP times out, it saves any partial input read into +the specified variable \fIname\fP, and the exit status is greater than 128. If \fItimeout\fP is 0, \fBread\fP returns immediately, without trying to read any data. -The exit status is 0 if input is available on the specified file descriptor, -or the read will return EOF, -non-zero otherwise. -The exit status is greater than 128 if the timeout is exceeded. +In this case, the exit status is 0 if input is available on the specified +file descriptor, or the read will return EOF, non-zero otherwise. .TP .B \-u \fIfd\fP -Read input from file descriptor \fIfd\fP. +Read input from file descriptor \fIfd\fP instead of the standard input. .PD -.PP +.RE +.IP Other than the case where \fIdelim\fP is the empty string, \fBread\fP ignores any NUL characters in the input. -.PP +.IP If no .I names -are supplied, the line read, +are supplied, \fBread\fP assigns the line read, without the ending delimiter but otherwise unmodified, -is assigned to the variable +to the variable .SM .BR REPLY . +.IP The exit status is zero, unless end-of-file is encountered, \fBread\fP times out (in which case the status is greater than 128), a variable assignment error (such as assigning to a readonly variable) occurs, or an invalid file descriptor is supplied as the argument to \fB\-u\fP. -.RE .TP \fBreadonly\fP [\fB\-aAf\fP] [\fB\-p\fP] [\fIname\fP[=\fIword\fP] .\|.\|.] .PD The given \fInames\fP are marked readonly; the values of these .I names -may not be changed by subsequent assignment. +may not be changed by subsequent assignment or unset. If the .B \-f -option is supplied, the functions corresponding to the -\fInames\fP are so -marked. +option is supplied, each \fIname\fP refers to a shell function. The .B \-a option restricts the variables to indexed arrays; the @@ -10261,17 +10653,21 @@ If both options are supplied, takes precedence. If no .I name -arguments are given, or if the +arguments are supplied, or if the .B \-p -option is supplied, a list of all readonly names is printed. +option is supplied, print a list of all readonly names. The other options may be used to restrict the output to a subset of the set of readonly names. The .B \-p -option causes output to be displayed in a format that -may be reused as input. -If a variable name is followed by =\fIword\fP, the value of -the variable is set to \fIword\fP. +option displays output in a format that may be reused as input. +.IP +\fBreadonly\fP allows the value of a variable to be set at the same time +the readonly attribute is changed by following the variable name with +=\fIvalue\fP. +This sets the value of the variable is to \fIvalue\fP while modifying +the readonly attribute. +.IP The return status is 0 unless an invalid option is encountered, one of the .I names @@ -10282,22 +10678,23 @@ is supplied with a that is not a function. .TP \fBreturn\fP [\fIn\fP] -Causes a function to stop executing and return the value specified by +Stop executing a shell function or sourced file and return the value +specified by .I n to its caller. If .I n is omitted, the return status is that of the last command -executed in the function body. +executed. If \fBreturn\fP is executed by a trap handler, the last command used to determine the status is the last command executed before the trap handler. If \fBreturn\fP is executed during a \fBDEBUG\fP trap, the last command used to determine the status is the last command executed by the trap handler before \fBreturn\fP was invoked. -If +.IP +When .B return -is used outside a function, -but during execution of a script by the +is used to terminate execution of a script being executed by the .B . (\fBsource\fP) command, it causes the shell to stop executing that script and return either @@ -10306,13 +10703,14 @@ or the exit status of the last command executed within the script as the exit status of the script. If \fIn\fP is supplied, the return value is its least significant 8 bits. +.IP +Any command associated with the \fBRETURN\fP trap is executed +before execution resumes after the function or script. +.IP The return status is non-zero if .B return -is supplied a non-numeric argument, or -is used outside a +is supplied a non-numeric argument, or is used outside a function and not during execution of a script by \fB.\fP\^ or \fBsource\fP. -Any command associated with the \fBRETURN\fP trap is executed -before execution resumes after the function or script. .TP \fBset\fP [\fB\-abefhkmnptuvxBCEHPT\fP] [\fB\-o\fP \fIoption\-name\fP] \ [\fB\-\-\fP] [\fB\-\fP] [\fIarg\fP .\|.\|.] @@ -10349,8 +10747,9 @@ subsequent commands. .TP 8 .B \-b Report the status of terminated background jobs -immediately, rather than before the next primary prompt. This is -effective only when job control is enabled. +immediately, rather than before the next primary prompt or after a +foreground command terminates. +This is effective only when job control is enabled. .TP 8 .B \-e .PD @@ -10421,9 +10820,10 @@ are placed in the environment for a command, not just those that precede the command name. .TP 8 .B \-m -Monitor mode. Job control is enabled. This option is on -by default for interactive shells on systems that support -it (see +Monitor mode. +Job control is enabled. +This option is on by default for interactive shells on systems +that support it (see .SM .B JOB CONTROL .ie \n(zZ=1 in \fIbash\fP(1)). @@ -10585,13 +10985,13 @@ on the standard output. .B \-p Turn on .I privileged -mode. In this mode, the +mode. In this mode, the shell does not read the .SM .B $ENV and .SM .B $BASH_ENV -files are not processed, shell functions are not inherited from the +files, shell functions are not inherited from the environment, and the .SM .BR SHELLOPTS , @@ -10643,7 +11043,7 @@ arithmetic \fBfor\fP command, display the expanded value of .SM .BR PS4 , followed by the command and its expanded arguments -or associated word list, to standard error. +or associated word list, to the standard error. .TP 8 .B \-B The shell performs brace expansion (see @@ -10660,11 +11060,12 @@ does not overwrite an existing file with the .BR >& , and .B <> -redirection operators. This may be overridden when -creating output files by using the redirection operator +redirection operators. +Using the redirection operator .B >| instead of -.BR > . +.B > +will override this and force the creation of an output file. .TP 8 .B \-E If set, any trap on \fBERR\fP is inherited by shell functions, command @@ -10674,15 +11075,16 @@ The \fBERR\fP trap is normally not inherited in such cases. .B \-H Enable .B ! -style history substitution. This option is on by -default when the shell is interactive. +style history substitution. +This option is on by default when the shell is interactive. .TP 8 .B \-P If set, the shell does not resolve symbolic links when executing commands such as .B cd -that change the current working directory. It uses the -physical directory structure instead. By default, +that change the current working directory. +It uses the physical directory structure instead. +By default, .B bash follows the logical chain of directories when performing commands which change the current directory. @@ -10695,20 +11097,20 @@ The \fBDEBUG\fP and \fBRETURN\fP traps are normally not inherited in such cases. .TP 8 .B \-\- -If no arguments follow this option, then the positional parameters are -unset. Otherwise, the positional parameters are set to the +If no arguments follow this option, unset the positional parameters. +Otherwise, set the positional parameters to the \fIarg\fPs, even if some of them begin with a .BR \- . .TP 8 .B \- -Signal the end of options, cause all remaining \fIarg\fPs to be -assigned to the positional parameters. The +Signal the end of options, and assign all remaining \fIarg\fPs to +the positional parameters. +The .B \-x and .B \-v options are turned off. -If there are no \fIarg\fPs, -the positional parameters remain unchanged. +If there are no \fIarg\fPs, the positional parameters remain unchanged. .PD .PP The options are off by default unless otherwise noted. @@ -10717,11 +11119,11 @@ The options can also be specified as arguments to an invocation of the shell. The current set of options may be found in .BR $\- . -The return status is always true unless an invalid option is encountered. +The return status is always zero unless an invalid option is encountered. .RE .TP \fBshift\fP [\fIn\fP] -The positional parameters from \fIn\fP+1 .\|.\|.\& are renamed to +Rename positional parameters from \fIn\fP+1 .\|.\|.\& to .B $1 .B .\|.\|.. Parameters represented by the numbers \fB$#\fP @@ -10752,10 +11154,10 @@ option is used, those available with the option to the \fBset\fP builtin command. With no options, or with the .B \-p -option, a list of all settable options is displayed, with +option, display a list of all settable options, with an indication of whether or not each is set; -if \fIoptnames\fP are supplied, the output is restricted to those options. -The \fB\-p\fP option causes output to be displayed in a form that +if any \fIoptnames\fP are supplied, the output is restricted to those options. +The \fB\-p\fP option displays output in a form that may be reused as input. Other options have the following meanings: .RS @@ -10770,7 +11172,7 @@ Disable (unset) each \fIoptname\fP. .B \-q Suppresses normal output (quiet mode); the return status indicates whether the \fIoptname\fP is set or unset. -If multiple \fIoptname\fP arguments are given with +If multiple \fIoptname\fP arguments are supplied with .BR \-q , the return status is zero if all \fIoptnames\fP are enabled; non-zero otherwise. @@ -10829,25 +11231,26 @@ is not a directory is assumed to be the name of a variable whose value is the directory to change to. .TP 8 .B cdspell -If set, minor errors in the spelling of a directory component in a +If set, the .B cd -command will be corrected. -The errors checked for are transposed characters, -a missing character, and one character too many. -If a correction is found, the corrected filename is printed, +command attempts to correct +minor errors in the spelling of a directory component. +Minor errors include transposed characters, +a missing character, and one extra character. +If \fBcd\fP corrects the directory name, it prints the corrected filename, and the command proceeds. This option is only used by interactive shells. .TP 8 .B checkhash If set, \fBbash\fP checks that a command found in the hash -table exists before trying to execute it. If a hashed command no -longer exists, a normal path search is performed. +table exists before trying to execute it. +If a hashed command no longer exists, \fBbash\fP performs a normal path search. .TP 8 .B checkjobs If set, \fBbash\fP lists the status of any stopped and running jobs before -exiting an interactive shell. If any jobs are running, this causes -the exit to be deferred until a second exit is attempted without an -intervening command (see +exiting an interactive shell. +If any jobs are running, \fBbash\fP defers the exit until a second +exit is attempted without an intervening command (see .SM .B "JOB CONTROL" .ie \n(zZ=1 in \fIbash\fP(1)). @@ -10856,21 +11259,23 @@ The shell always postpones exiting if any jobs are stopped. .TP 8 .B checkwinsize If set, \fBbash\fP checks the window size after each external (non-builtin) -command and, if necessary, updates the values of +command +and, if necessary, updates the values of .SM .B LINES and .SM .BR COLUMNS , -using the file descriptor associated with stderr if it is a terminal. +using the file descriptor associated with the standard error +if it is a terminal. This option is enabled by default. .TP 8 .B cmdhist If set, .B bash attempts to save all lines of a multiple-line -command in the same history entry. This allows -easy re-editing of multi-line commands. +command in the same history entry. +This allows easy re-editing of multi-line commands. This option is enabled by default, but only has an effect if command history is enabled, as described .ie \n(zZ=1 in \fIbash\fP(1) @@ -10926,8 +11331,8 @@ versions through 4.2. If set, .B bash replaces directory names with the results of word expansion when performing -filename completion. This changes the contents of the readline editing -buffer. +filename completion. +This changes the contents of the readline editing buffer. If not set, .B bash attempts to preserve what the user typed. @@ -10956,7 +11361,8 @@ is set. If set, a non-interactive shell will not exit if it cannot execute the file specified as an argument to the .B exec -builtin command. An interactive shell does not exit if +builtin. +An interactive shell does not exit if .B exec fails. .TP 8 @@ -10970,8 +11376,7 @@ under This option is enabled by default for interactive shells. .TP 8 .B extdebug -If set at shell invocation, -or in a shell startup file, +If set at shell invocation, or in a shell startup file, arrange to execute the debugger profile before the shell starts, identical to the \fB\-\-debugger\fP option. If set after invocation, behavior intended for use by debuggers is enabled: @@ -11014,16 +11419,17 @@ subshells invoked with \fB(\fP \fIcommand\fP \fB)\fP inherit the .RE .TP 8 .B extglob -If set, the extended pattern matching features described +If set, enable the extended pattern matching features described .ie \n(zZ=1 in \fIbash\fP(1) .el above under -\fBPathname Expansion\fP are enabled. +\fBPathname Expansion\fP. .TP 8 .B extquote If set, \fB$\fP\*'\fIstring\fP\*' and \fB$\fP\*"\fIstring\fP\*" quoting is performed within \fB${\fP\fIparameter\fP\fB}\fP expansions -enclosed in double quotes. This option is enabled by default. +enclosed in double quotes. +This option is enabled by default. .TP 8 .B failglob If set, patterns which fail to match filenames during pathname expansion @@ -11052,9 +11458,9 @@ If set, range expressions used in pattern matching bracket expressions (see .B Pattern Matching .ie \n(zZ=1 in \fIbash\fP(1)) .el above) -behave as if in the traditional C locale when performing -comparisons. That is, the current locale's collating sequence -is not taken into account, so +behave as if in the traditional C locale when performing comparisons. +That is, pattern matching does not take +the current locale's collating sequence into account, so .B b will not collate between .B A @@ -11091,15 +11497,16 @@ variable when the shell exits, rather than overwriting the file. .B histreedit If set, and .B readline -is being used, a user is given the opportunity to re-edit a +is being used, the user is given the opportunity to re-edit a failed history substitution. .TP 8 .B histverify If set, and .B readline is being used, the results of history substitution are not immediately -passed to the shell parser. Instead, the resulting line is loaded into -the \fBreadline\fP editing buffer, allowing further modification. +passed to the shell parser. +Instead, the resulting line is loaded into the \fBreadline\fP editing buffer, +allowing further modification. .TP 8 .B hostcomplete If set, and @@ -11126,10 +11533,10 @@ instead of unsetting it in the subshell environment. This option is enabled when \fIposix mode\fP is enabled. .TP 8 .B interactive_comments -If set, allow a word beginning with -.B # -to cause that word and all remaining characters on that -line to be ignored in an interactive shell (see +In an interactive shell, a word beginning with \fB#\fP +causes that word and all remaining characters on that +line to be ignored, as in a non-interactive shell +(see .SM .B COMMENTS .ie \n(zZ=1 in \fIbash\fP(1)). @@ -11149,13 +11556,15 @@ embedded newlines rather than using semicolon separators where possible. .B localvar_inherit If set, local variables inherit the value and attributes of a variable of the same name that exists at a previous scope before any new value is -assigned. The nameref attribute is not inherited. +assigned. +The nameref attribute is not inherited. .TP 8 .B localvar_unset If set, calling \fBunset\fP on local variables in previous function scopes marks them so subsequent lookups find them unset until that function -returns. This is identical to the behavior of unsetting local variables -at the current function scope. +returns. +This is identical to the behavior of unsetting local variables at the +current function scope. .TP 8 .B login_shell The shell sets this option if it is started as a login shell (see @@ -11176,11 +11585,10 @@ If set, and .B readline is being used, .B bash -will not attempt to search the +does not search .SM .B PATH -for possible completions when -completion is attempted on an empty line. +for possible completions when completion is attempted on an empty line. .TP 8 .B nocaseglob If set, @@ -11213,8 +11621,7 @@ If set, pathname expansion patterns which match no files .B Pathname Expansion .ie \n(zZ=1 in \fIbash\fP(1)) .el above) -expand to nothing and are removed, -rather than expanding to themselves. +expand to nothing and are removed, rather than expanding to themselves. .TP 8 .B patsub_replacement If set, \fBbash\fP @@ -11226,17 +11633,17 @@ under \fBParameter Expansion\fP This option is enabled by default. .TP 8 .B progcomp -If set, the programmable completion facilities (see +If set, enable the programmable completion facilities (see \fBProgrammable Completion\fP -.ie \n(zZ=1 in \fIbash\fP(1)) -.el above) -are enabled. +.ie \n(zZ=1 in \fIbash\fP(1)). +.el above). This option is enabled by default. .TP 8 .B progcomp_alias If set, and programmable completion is enabled, \fBbash\fP treats a command name that doesn't have any completions as a possible alias and attempts -alias expansion. If it has an alias, \fBbash\fP attempts programmable +alias expansion. +If it has an alias, \fBbash\fP attempts programmable completion using the command word resulting from the expanded alias. .TP 8 .B promptvars @@ -11296,11 +11703,11 @@ interpret any options. Suspend the execution of this shell until it receives a .SM .B SIGCONT -signal. A login shell, -or a shell without job control enabled, +signal. +A login shell, or a shell without job control enabled, cannot be suspended; the .B \-f -option can be used to override this and force the suspension. +option will override this and force the suspension. The return status is 0 unless the shell is a login shell or job control is not enabled and @@ -11328,7 +11735,7 @@ an argument of \fB\-\-\fP as signifying the end of options. Expressions may be combined using the following operators, listed in decreasing order of precedence. The evaluation depends on the number of arguments; see below. -Operator precedence is used when there are five or more arguments. +\fBtest\fP uses operator precedence when there are five or more arguments. .RS .PD 0 .TP @@ -11339,7 +11746,7 @@ is false. .TP .B ( \fIexpr\fP ) Returns the value of \fIexpr\fP. -This may be used to override the normal precedence of operators. +This may be used to override normal operator precedence. .TP \fIexpr1\fP \-\fBa\fP \fIexpr2\fP True if both @@ -11403,7 +11810,6 @@ Otherwise, the expression is false. The following conditions are applied in the order listed. If the first argument is \fB!\fP, the result is the negation of the three-argument expression composed of the remaining arguments. -the two-argument test using the second and third arguments. If the first argument is exactly \fB(\fP and the fourth argument is exactly \fB)\fP, the result is the two-argument test of the second and third arguments. @@ -11421,25 +11827,35 @@ the \fB<\fP and \fB>\fP operators sort using the current locale. If the shell is not in \fIposix mode\fP, the \fBtest\fP and \fB[\fP commands sort lexicographically using ASCII ordering. +.IP +The historical operator-precedence parsing with 4 or more arguments can +lead to ambiguities when it encounters strings that look like primaries. +The POSIX +standard has deprecated the \fB\-a\fP and \fB\-o\fP +primaries and enclosing expressions within parentheses. +Scripts should no longer use them. +It's much more reliable to restrict test invocations to a single primary, +and to replace uses of \fB\-a\fP and \fB\-o\fP with the shell's +\fB&&\fP and \fB||\fP list operators. .RE .TP .B times Print the accumulated user and system times for the shell and -for processes run from the shell. The return status is 0. +for processes run from the shell. +The return status is 0. .TP -\fBtrap\fP [\fB\-lp\fP] [[\fIaction\fP] \fIsigspec\fP .\|.\|.] +\fBtrap\fP [\fB\-Plp\fP] [[\fIaction\fP] \fIsigspec\fP .\|.\|.] The .I action is a command that is read and executed when the shell receives -signal(s) +any of the signals .IR sigspec . If .I action is absent (and there is a single \fIsigspec\fP) or .BR \- , -each specified signal is -reset to its original disposition (the value it had -upon entrance to the shell). +each specified \fIsigspec\fP is +reset to the value it had when the shell was started. If .I action is the null string the signal specified by each @@ -11470,14 +11886,14 @@ option behaves similarly, but displays only the actions associated with each \fIsigspec\fP argument. .B \-P requires at least one \fIsigspec\fP argument. -The \fB\-P\fP or \fB\-p\fP options to \fBtrap\fP may be used +The \fB\-P\fP or \fB\-p\fP options may be used in a subshell environment (e.g., command substitution) and, as long as they are used before \fBtrap\fP is used to change a signal's handling, will display the state of its parent's traps. .IP The .B \-l -option causes \fBtrap\fP to print a list of signal names and +option prints a list of signal names and their corresponding numbers. Each .I sigspec @@ -11487,13 +11903,15 @@ Signal names are case insensitive and the .SM .B SIG prefix is optional. +If \fB\-l\fP is supplied with no \fIsigspec\fP arguments, it prints a +list of valid signal names. .IP If a .I sigspec is .SM .B EXIT -(0) the command +(0), .I action is executed on exit from the shell. If a @@ -11501,7 +11919,6 @@ If a is .SM .BR DEBUG , -the command .I action is executed before every \fIsimple command\fP, \fIfor\fP command, \fIcase\fP command, \fIselect\fP command, (( arithmetic command, @@ -11512,14 +11929,17 @@ in a shell function (see .B SHELL GRAMMAR .ie \n(zZ=1 in \fIbash\fP(1)). .el above). -Refer to the description of the \fBextdebug\fP option to the -\fBshopt\fP builtin for details of its effect on the \fBDEBUG\fP trap. +Refer to the description of the \fBextdebug\fP shell option +(see +.B shopt +.ie \n(zZ=1 in \fIbash\fP(1)) +.el above) +for details of its effect on the \fBDEBUG\fP trap. If a .I sigspec is .SM .BR RETURN , -the command .I action is executed each time a shell function or a script executed with the \fB.\fP or \fBsource\fP builtins finishes executing. @@ -11529,7 +11949,6 @@ If a is .SM .BR ERR , -the command .I action is executed whenever a pipeline (which may consist of a single simple @@ -11552,7 +11971,8 @@ statement, part of a command executed in a or .B || list except the command following the final \fB&&\fP or \fB||\fP, -any command in a pipeline but the last, +any command in a pipeline but the last +(subject to the state of the \fBpipefail\fP shell option), or if the command's return value is being inverted using .BR ! . @@ -11573,10 +11993,10 @@ returns true. Does nothing, returns a 0 status. .TP \fBtype\fP [\fB\-aftpP\fP] \fIname\fP [\fIname\fP .\|.\|.] -With no options, -indicate how each +Indicate how each .I name would be interpreted if used as a command name. +.IP If the .B \-t option is used, @@ -11590,22 +12010,21 @@ or .I file if .I name -is an alias, shell reserved word, function, builtin, or executable disk file, +is an alias, shell reserved word, function, builtin, or executable file, respectively. If the .I name -is not found, then nothing is printed, and \fBtype\fP returns a -non-zero exit status. +is not found, \fBtype\fP prints nothing and returns a non-zero exit status. +.IP If the .B \-p option is used, .B type -either returns the name of the executable file +either returns the pathname of the executable file that would be found by searching .B $PATH -if +for .I name -were specified as a command name, or nothing if .Q "type \-t name" would not return @@ -11619,7 +12038,7 @@ search for each \fIname\fP, even if .Q "type \-t name" would not return .IR file . -If a command is hashed, +If \fIname\fP is present in the table of hashed commands, .B \-p and .B \-P @@ -11627,6 +12046,7 @@ print the hashed value, which is not necessarily the file that appears first in .SM .BR PATH . +.IP If the .B \-a option is used, @@ -11645,6 +12065,7 @@ and only performs a .SM .B PATH search for \fIname\fP. +.IP The .B \-f option suppresses shell function lookup, as with the \fBcommand\fP builtin. @@ -11658,13 +12079,15 @@ any are not found. \fBulimit\fP [\fB\-HS\fP] [\fB\-bcdefiklmnpqrstuvxPRT\fP [\fIlimit\fP]] .PD Provides control over the resources available to the shell and to -processes started by it, on systems that allow such control. +processes it starts, on systems that allow such control. +.IP The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is set for the given resource. A hard limit cannot be increased by a non-root user once it is set; a soft limit may be increased up to the value of the hard limit. -If neither \fB\-H\fP nor \fB\-S\fP is specified, both the soft and hard -limits are set. +If neither \fB\-H\fP nor \fB\-S\fP is specified, +\fBulimit\fP sets both the soft and hard limits. +.IP The value of .I limit can be a number in the unit specified for the resource @@ -11677,16 +12100,16 @@ which stand for the current hard limit, the current soft limit, and no limit, respectively. If .I limit -is omitted, the current value of the soft limit of the resource is -printed, unless the \fB\-H\fP option is given. When more than one -resource is specified, the limit name and unit, if appropriate, -are printed before the value. +is omitted, \fBulimit\fP prints the current value of the soft limit of +the resource, unless the \fB\-H\fP option is given. +When more than one resource is specified, the limit name and unit, +if appropriate, are printed before the value. Other options are interpreted as follows: .RS .PD 0 .TP .B \-a -All current limits are reported; no limits are set +Report all current limits; no limits are set .TP .B \-b The maximum socket buffer size @@ -11757,13 +12180,15 @@ The maximum number of threads .PP If .I limit -is given, and the +is supplied, and the .B \-a option is not used, \fIlimit\fP is the new value of the specified resource. -If no option is given, then +If no option is supplied, then .B \-f -is assumed. Values are in 1024-byte increments, except for +is assumed. +.PP +Values are in 1024-byte increments, except for .BR \-t , which is in seconds; .BR \-R , @@ -11788,35 +12213,36 @@ or an error occurs while setting a new limit. .RE .TP \fBumask\fP [\fB\-p\fP] [\fB\-S\fP] [\fImode\fP] -The user file-creation mask is set to +Set the user file-creation mask to .IR mode . If .I mode -begins with a digit, it -is interpreted as an octal number; otherwise -it is interpreted as a symbolic mode mask similar +begins with a digit, it is interpreted as an octal number; +otherwise it is interpreted as a symbolic mode mask similar to that accepted by .IR chmod (1). If .I mode -is omitted, the current value of the mask is printed. +is omitted, \fBumask\fP prints the current value of the mask. The .B \-S -option causes the mask to be printed in symbolic form; the -default output is an octal number. +option without a \fImode\fP argument +prints the mask in a symbolic format; +the default output is an octal number. If the .B \-p option is supplied, and .I mode is omitted, the output is in a form that may be reused as input. -The return status is 0 if the mode was successfully changed or if -no \fImode\fP argument was supplied, and false otherwise. +The return status is zero if the mode was successfully changed or +if no \fImode\fP argument was supplied, and non-zero otherwise. .TP \fBunalias\fP [\-\fBa\fP] [\fIname\fP .\|.\|.] -Remove each \fIname\fP from the list of defined aliases. If +Remove each \fIname\fP from the list of defined aliases. +If .B \-a -is supplied, all alias definitions are removed. The return -value is true unless a supplied +is supplied, remove all alias definitions. +The return value is true unless a supplied .I name is not a defined alias. .TP @@ -11829,7 +12255,6 @@ If the option is given, each .I name refers to a shell variable, and that variable is removed. -Read-only variables may not be unset. If .B \-f is specified, each @@ -11842,11 +12267,13 @@ option is supplied, and \fIname\fP is a variable with the \fInameref\fP attribute, \fIname\fP will be unset rather than the variable it references. \fB\-n\fP has no effect if the \fB\-f\fP option is supplied. +Read-only variables and functions may not be unset. +When variables or functions are removed, they are also removed +from the environment passed to subsequent commands. If no options are supplied, each \fIname\fP refers to a variable; if there is no variable by that name, a function with that name, if any, is unset. -Each unset variable or function is removed from the environment -passed to subsequent commands. +Some shell variables may not be unset. If any of .SM .BR BASH_ALIASES , @@ -11884,7 +12311,8 @@ or .SM .B SRANDOM are unset, they lose their special properties, even if they are -subsequently reset. The exit status is true unless a +subsequently reset. +The exit status is true unless a .I name is readonly or may not be unset. .TP @@ -11892,7 +12320,7 @@ is readonly or may not be unset. Wait for each specified child process \fIid\fP and return the termination status of the last \fIid\fP. Each \fIid\fP may be a process ID or a job specification; -if a job spec is given, \fBwait\fP waits for all processes in the job. +if a job spec is supplied, \fBwait\fP waits for all processes in the job. .IP If no options or \fIid\fPs are supplied, \fBwait\fP waits for all running background jobs and @@ -11911,7 +12339,9 @@ the exit status is 127. If the \fB\-p\fP option is supplied, the process or job identifier of the job for which the exit status is returned is assigned to the variable \fIvarname\fP named by the option argument. -The variable will be unset initially, before any assignment. +The variable, +which cannot be readonly, +will be unset initially, before any assignment. This is useful only when the \fB\-n\fP option is supplied. .IP Supplying the \fB\-f\fP option, when job control is enabled, @@ -11940,11 +12370,12 @@ There is only one current compatibility level \(em each option is mutually exclusive. The compatibility level is intended to allow users to select behavior from previous versions that is incompatible with newer versions -while they migrate scripts to use current features and -behavior. It's intended to be a temporary solution. +while they migrate scripts to use current features and behavior. +It's intended to be a temporary solution. .PP This section does not mention behavior that is standard for a particular -version (e.g., setting \fBcompat32\fP means that quoting the rhs of the regexp +version (e.g., setting \fBcompat32\fP means that quoting the right hand +side of the regexp matching operator quotes special regexp characters in the word, which is default behavior in bash-3.2 and subsequent versions). .PP @@ -11969,17 +12400,18 @@ to this variable (a decimal version number like 4.2, or an integer corresponding to the \fBcompat\fP\fINN\fP option, like 42) determines the compatibility level. .PP -Starting with bash-4.4, \fBbash\fP has begun deprecating older compatibility +Starting with bash-4.4, \fBbash\fP began deprecating older compatibility levels. Eventually, the options will be removed in favor of .SM .BR BASH_COMPAT . .PP -Bash-5.0 was the final version for which there will be an individual shopt -option for the previous version. Users should control the compatibility -level with +Bash-5.0 was the final version for which there was an individual shopt +option for the previous version. .SM -.BR BASH_COMPAT . +.B BASH_COMPAT +is the only mechanism to control the compatibility level +in versions newer than bash-5.0. .PP The following table describes the behavior changes controlled by each compatibility level setting. @@ -11998,8 +12430,8 @@ and it is required for bash-5.1 and later versions. .PD 0 .RS .IP \(bu -quoting the rhs of the \fB[[\fP command's regexp matching operator (=\*~) -has no special effect +Quoting the rhs of the \fB[[\fP command's regexp matching operator (=\*~) +has no special effect. .RE .PD .TP @@ -12007,7 +12439,7 @@ has no special effect .PD 0 .RS .IP \(bu -the \fB<\fP and \fB>\fP operators to the \fB[[\fP command do not +The \fB<\fP and \fB>\fP operators to the \fB[[\fP command do not consider the current locale when comparing strings; they use ASCII ordering. .RE @@ -12017,7 +12449,7 @@ ordering. .PD 0 .RS .IP \(bu -the \fB<\fP and \fB>\fP operators to the \fB[[\fP command do not +The \fB<\fP and \fB>\fP operators to the \fB[[\fP command do not consider the current locale when comparing strings; they use ASCII ordering. \fBBash\fP versions prior to bash-4.1 use ASCII collation and @@ -12031,14 +12463,14 @@ bash-4.1 and later use the current locale's collation sequence and .PD 0 .RS .IP \(bu -in \fIposix\fP mode, \fBtime\fP may be followed by options and still be -recognized as a reserved word (this is POSIX interpretation 267) +In \fIposix\fP mode, \fBtime\fP may be followed by options and still be +recognized as a reserved word (this is POSIX interpretation 267). .IP \(bu -in \fIposix\fP mode, the parser requires that an even number of single +In \fIposix\fP mode, the parser requires that an even number of single quotes occur in the \fIword\fP portion of a double-quoted parameter expansion and treats them specially, so that characters within the single quotes are considered quoted -(this is POSIX interpretation 221) +(this is POSIX interpretation 221). .RE .PD .TP @@ -12046,15 +12478,15 @@ the single quotes are considered quoted .PD 0 .RS .IP \(bu -the replacement string in double-quoted pattern substitution does not -undergo quote removal, as it does in versions after bash-4.2 +The replacement string in double-quoted pattern substitution does not +undergo quote removal, as it does in versions after bash-4.2. .IP \(bu -in posix mode, single quotes are considered special when expanding +In posix mode, single quotes are considered special when expanding the \fIword\fP portion of a double-quoted parameter expansion and can be used to quote a closing brace or other special character (this is part of POSIX interpretation 221); in later versions, single quotes -are not special within double-quoted word expansions +are not special within double-quoted word expansions. .RE .PD .TP @@ -12062,15 +12494,15 @@ are not special within double-quoted word expansions .PD 0 .RS .IP \(bu -word expansion errors are considered non-fatal errors that cause the +Word expansion errors are considered non-fatal errors that cause the current command to fail, even in posix mode (the default behavior is to make them fatal errors that cause the shell -to exit) +to exit). .IP \(bu -when executing a shell function, the loop state (while/until/etc.) +When executing a shell function, the loop state (while/until/etc.) is not reset, so \fBbreak\fP or \fBcontinue\fP in that function will break -or continue loops in the calling context. Bash-4.4 and later reset -the loop state to prevent this +or continue loops in the calling context. +Bash-4.4 and later reset the loop state to prevent this. .RE .PD .TP @@ -12078,23 +12510,23 @@ the loop state to prevent this .PD 0 .RS .IP \(bu -the shell sets up the values used by +The shell sets up the values used by .SM .B BASH_ARGV and .SM .B BASH_ARGC so they can expand to the shell's positional parameters even if extended -debugging mode is not enabled +debugging mode is not enabled. .IP \(bu -a subshell inherits loops from its parent context, so \fBbreak\fP +A subshell inherits loops from its parent context, so \fBbreak\fP or \fBcontinue\fP will cause the subshell to exit. Bash-5.0 and later reset the loop state to prevent the exit .IP \(bu -variable assignments preceding builtins like \fBexport\fP and \fBreadonly\fP +Variable assignments preceding builtins like \fBexport\fP and \fBreadonly\fP that set attributes continue to affect variables with the same name in the calling environment even if the shell is not in posix -mode +mode. .RE .PD .TP @@ -12105,17 +12537,18 @@ mode Bash-5.1 changed the way .SM .B $RANDOM -is generated to introduce slightly -more randomness. If the shell compatibility level is set to 50 or +is generated to introduce slightly more randomness. +If the shell compatibility level is set to 50 or lower, it reverts to the method from bash-5.0 and previous versions, so seeding the random number generator by assigning a value to .SM .B RANDOM -will produce the same sequence as in bash-5.0 +will produce the same sequence as in bash-5.0. .IP \(bu If the command hash table is empty, bash versions prior to bash-5.1 printed an informational message to that effect, even when producing -output that can be reused as input. Bash-5.1 suppresses that message +output that can be reused as input. +Bash-5.1 suppresses that message when the \fB\-l\fP option is supplied. .RE .PD @@ -12128,30 +12561,30 @@ The \fBunset\fP builtin treats attempts to unset array subscripts \fB@\fP and \fB*\fP differently depending on whether the array is indexed or associative, and differently than in previous versions. .IP \(bu -arithmetic commands ( +Arithmetic commands ( .BR (( .\|.\|.\& )) ) and the expressions in an arithmetic for -statement can be expanded more than once +statement can be expanded more than once. .IP \(bu -expressions used as arguments to arithmetic operators in the \fB[[\fP -conditional command can be expanded more than once +Expressions used as arguments to arithmetic operators in the \fB[[\fP +conditional command can be expanded more than once. .IP \(bu -the expressions in substring parameter brace expansion can be -expanded more than once +The expressions in substring parameter brace expansion can be +expanded more than once. .IP \(bu -the expressions in the +The expressions in the .BR $(( .\|.\|.\& )) -word expansion can be expanded more than once +word expansion can be expanded more than once. .IP \(bu -arithmetic expressions used as indexed array subscripts can be -expanded more than once +Arithmetic expressions used as indexed array subscripts can be +expanded more than once. .IP \(bu \fBtest \-v\fP, when given an argument of \fBA[@]\fP, where \fBA\fP is an existing associative array, will return true if the array has any set elements. Bash-5.2 will look for and report on a key named \fB@\fP. .IP \(bu -the ${\fIparameter\fP\fB[:]=\fP\fIvalue\fP} word expansion will return +The ${\fIparameter\fP\fB[:]=\fP\fIvalue\fP} word expansion will return \fIvalue\fP, before any variable-specific transformations have been performed (e.g., converting to lowercase). Bash-5.2 will return the final value assigned to the variable. @@ -12195,17 +12628,16 @@ is started with the name .BR rbash , or the .B \-r -option is supplied at invocation, -the shell becomes restricted. +option is supplied at invocation, the shell becomes \fIrestricted\fP. A restricted shell is used to set up an environment more controlled than the standard shell. It behaves identically to .B bash with the exception that the following are disallowed or not performed: .IP \(bu -changing directories with \fBcd\fP +Changing directories with \fBcd\fP. .IP \(bu -setting or unsetting the values of +Setting or unsetting the values of .SM .BR SHELL , .SM @@ -12216,57 +12648,61 @@ setting or unsetting the values of .BR ENV , or .SM -.B BASH_ENV +.BR BASH_ENV . .IP \(bu -specifying command names containing -.B / +Specifying command names containing +.BR / . .IP \(bu -specifying a filename containing a +Specifying a filename containing a .B / as an argument to the .B . -builtin command +builtin command. +.IP \(bu +Using the \fB\-p\fP option to the +.B . +builtin command to specify a search path. .IP \(bu -specifying a filename containing a slash as an argument to the +Specifying a filename containing a slash as an argument to the .B history -builtin command +builtin command. .IP \(bu -specifying a filename containing a slash as an argument to the +Specifying a filename containing a slash as an argument to the .B \-p option to the .B hash -builtin command +builtin command. .IP \(bu -importing function definitions from the shell environment at startup +Importing function definitions from the shell environment at startup. .IP \(bu -parsing the value of +Parsing the value of .SM .B SHELLOPTS -from the shell environment at startup +from the shell environment at startup. .IP \(bu -redirecting output using the >, >|, <>, >&, &>, and >> redirection operators +Redirecting output using the >, >|, <>, >&, &>, and >> redirection operators. .IP \(bu -using the +Using the .B exec -builtin command to replace the shell with another command +builtin command to replace the shell with another command. .IP \(bu -adding or deleting builtin commands with the +Adding or deleting builtin commands with the .B \-f and .B \-d options to the .B enable -builtin command +builtin command. .IP \(bu -using the \fBenable\fP builtin command to enable disabled shell builtins +Using the \fBenable\fP builtin command to enable disabled shell builtins. .IP \(bu -specifying the +Specifying the .B \-p option to the .B command -builtin command +builtin command. .IP \(bu -turning off restricted mode with +Turning off restricted mode with \fBset +r\fP or \fBshopt \-u restricted_shell\fP. .PP These restrictions are enforced after any startup files are read. @@ -12408,7 +12844,5 @@ or to start the command in the background and immediately bring it into the foreground. .PP Array variables may not (yet) be exported. -.PP -There may be only one active coprocess at a time. .zZ .zY diff --git a/doc/bash.html b/doc/bash.html index ae38d273..3d9db74e 100644 --- a/doc/bash.html +++ b/doc/bash.html @@ -3,7 +3,7 @@ -
BASH(1)2024 August 13BASH(1) +BASH(1)2024 September 29BASH(1)

Index @@ -55,7 +55,8 @@ Bash is Copyright © 1989-2024 by the Free Software Foundation, Inc. Bash is an sh-compatible command language interpreter that -executes commands read from the standard input or from a file. +executes commands read from the standard input, from a string, +or from a file. Bash also incorporates useful features from the Korn and C @@ -81,7 +82,6 @@ In addition, bash interprets the following options when it is invoked:

-

-c @@ -144,15 +144,15 @@ If the -s option is present, or if no arguments remain after option -processing, then commands are read from the standard input. +processing, the shell reads commands from the standard input. This option allows the positional parameters to be set when invoking an interactive shell or when reading input through a pipe.
-D
-A list of all double-quoted strings preceded by $ -is printed on the standard output. +Print a list of all double-quoted strings preceded by $ +on the standard output. These are the strings that are subject to language translation when the current locale is not C or POSIX. @@ -168,8 +168,9 @@ This implies the -n option; no commands will be executed. below). If shopt_option is present, -O sets the value of that option; +O unsets it. -If shopt_option is not supplied, the names and values of the shell -options accepted by shopt are printed on the standard output. +If shopt_option is not supplied, bash prints +the names and values of the shell +options accepted by shopt on the standard output. If the invocation option is +O, the output is displayed in a format that may be reused as input.
-- @@ -188,7 +189,6 @@ An argument of - is equivalent to --. -

@@ -199,7 +199,6 @@ These options must appear on the command line before the single-character options to be recognized.

-

--debugger @@ -226,8 +225,9 @@ Equivalent to -D.
Display a usage message on standard output and exit successfully. -
--init-file file
- +
+
+--init-file file
--rcfile file
Execute commands from @@ -315,7 +315,6 @@ Show version information for this instance of bash on the standard output and exit successfully. -
 

ARGUMENTS

@@ -342,8 +341,8 @@ reads and executes commands from this file, then exits. Bash's exit status is the exit status of the last command executed in the script. If no commands are executed, the exit status is 0. -An attempt is first made to open the file in the current directory, and, -if no file is found, then the shell searches the directories in +Bash first attempts to open the file in the current directory, and, +if no file is found, then searches the directories in PATH @@ -366,7 +365,7 @@ and without the -c option, -whose standard input and error are +whose standard input and standard error are both connected to terminals (as determined by isatty(3)), @@ -374,20 +373,20 @@ or one started with the -i option. +Bash + +sets PS1 -is set and +and $- includes i -if -bash - -is interactive, -allowing a shell script or a startup file to test this state. +if the shell is interactive, +so a shell script or a startup file can test this state.

The following paragraphs describe how @@ -440,7 +439,7 @@ This may be inhibited by using the --norc option. -The --rcfile file option will cause +The --rcfile file option causes bash to use file instead of ~/.bashrc. @@ -473,11 +472,11 @@ $BASH_ENV"

-but the value of the +but does not use the value of the PATH -variable is not used to search for the filename. +variable to search for the filename.

If @@ -552,7 +551,7 @@ In this mode, interactive shells expand the ENV -variable and commands are read and executed from the file +variable and read and execute commands from the file whose name is the expanded value. No other startup files are read.

@@ -561,7 +560,7 @@ No other startup files are read. attempts to determine when it is being run with its standard input connected to a network connection, as when executed by -the historical remote shell daemon, usually rshd, +the historical and rarely-seen remote shell daemon, usually rshd, or the secure shell daemon sshd. If bash @@ -634,7 +633,8 @@ referred to as an

metacharacter
-A character that, when unquoted, separates words. One of the following: +A character that, when unquoted, separates words. +One of the following:
@@ -647,8 +647,8 @@ A character that, when unquoted, separates words. One of the following:
control operator
-A token that performs a control function. It is one of the following -symbols: +A token that performs a control function. +It is one of the following symbols:

@@ -698,7 +698,8 @@ This section describes the syntax of the various forms of shell commands. A simple command is a sequence of optional variable assignments followed by blank-separated words and redirections, and -terminated by a control operator. The first word +terminated by a control operator. +The first word specifies the command to be executed, and is passed as argument zero. The remaining words are passed as arguments to the invoked command.

@@ -737,7 +738,8 @@ This connection is performed before any redirections specified by the below). -If |& is used, command1's standard error, in addition to its +If |& is the pipeline operator, +command1's standard error, in addition to its standard output, is connected to command2's standard input through the pipe; it is shorthand for 2>&1 |. @@ -755,37 +757,38 @@ If the reserved word precedes a pipeline, the exit status of that pipeline is the logical negation of the exit status as described above. -The shell waits for all commands in the pipeline to +If a pipeline is executed synchronously, +the shell waits for all commands in the pipeline to terminate before returning a value.

If the time -reserved word precedes a pipeline, the elapsed as well as user and -system time consumed by its execution are reported when the pipeline -terminates. +reserved word precedes a pipeline, the shell reports the +elapsed as well as user and system time consumed by its execution +when the pipeline terminates. The -p option changes the output format to that specified by POSIX. When the shell is in posix mode, it does not recognize time as a reserved word if the next token begins with a -The +The value of the TIMEFORMAT -variable may be set to a format string that specifies how the timing +variable is a format string that specifies how the timing information should be displayed; see the description of TIMEFORMAT -under -Shell Variables +below under +Shell Variables. -below.

When the shell is in posix mode, time -may be followed by a newline. In this case, the shell displays the +may be followed by a newline. +In this case, the shell displays the total user and system time consumed by the shell and its children. The TIMEFORMAT @@ -803,8 +806,8 @@ See for a description of subshells and a subshell environment. If the lastpipe option is enabled using the shopt builtin (see the description of shopt below), -the last element of a pipeline may be run by the shell process -when job control is not active. +and job control is not active, +the last element of a pipeline may be run by the shell process.  

Lists

@@ -916,22 +919,22 @@ newline in place of a semicolon. below for a description of a subshell environment). Variable assignments and builtin commands that affect the shell's environment do not remain in effect -after the command completes. The return status is the exit status of -list. +after the command completes. +The return status is the exit status of list.
{ list; }
-list is simply executed in the current shell environment. +list is executed in the current shell environment. list must be terminated with a newline or semicolon. This is known as a group command. -The return status is the exit status of -list. +The return status is the exit status of list. +
Note that unlike the metacharacters ( and ), { and } are reserved words and must occur where a reserved -word is permitted to be recognized. Since they do not cause a word -break, they must be separated from list by whitespace or another -shell metacharacter. +word is permitted to be recognized. +Since they do not cause a word break, they must be separated from +list by whitespace or another shell metacharacter.
((expression))
-The expression is evaluated according to the rules described -below under +The arithmetic expression is evaluated according to the rules +described below under ARITHMETIC EVALUATION. @@ -940,12 +943,12 @@ otherwise the return status is 1. The expression undergoes the same expansions as if it were within double quotes, -but double quote characters in expression are not treated specially -and are removed. +but double quote characters in expression are not treated +specially and are removed.
[[ expression ]]
-Return a status of 0 or 1 depending on the evaluation of -the conditional expression expression. +Evaluate the conditional expression expression +and return a status of zero (true) or non-zero (false). Expressions are composed of the primaries described below under CONDITIONAL EXPRESSIONS. @@ -973,8 +976,9 @@ shell option is enabled, the match is performed without regard to the case of alphabetic characters. The return value is 0 if the string matches (==) or does not match (!=) the pattern, and 1 otherwise. -Any part of the pattern may be quoted to force the quoted portion -to be matched as a string. +If any part of the pattern is quoted, the quoted portion is matched +as a string: every character in the quoted portion matches itself, +instead of having any special pattern matching meaning.
An additional binary operator, =~, is available, with the same precedence as == and !=. @@ -993,9 +997,9 @@ If the shell option is enabled, the match is performed without regard to the case of alphabetic characters. -If any part of the pattern is quoted, the quoted portion is matched literally. -This means every character in the quoted portion matches itself, -instead of having any special pattern matching meaning. +
+If any part of the pattern is quoted, the quoted portion is matched literally, +as above. If the pattern is stored in a shell variable, quoting the variable expansion forces the entire pattern to be matched literally. Treat bracket expressions in regular expressions carefully, @@ -1005,6 +1009,7 @@ between brackets. The pattern will match if it matches any part of the string. Anchor the pattern using the ^ and $ regular expression operators to force it to match the entire string. +
The array variable BASH_REMATCH @@ -1021,7 +1026,8 @@ expression are saved in the remaining BASH_REMATCH -indices. The element of +indices. +The element of BASH_REMATCH @@ -1079,9 +1085,9 @@ the entire conditional expression.
for name [ [ in [ word ... ] ] ; ] do list ; done
-The list of words following in is expanded, generating a list +First, expand The list of words following in, generating a list of items. -The variable name is set to each element of this list +Then, the variable name is set to each element of this list in turn, and list is executed each time. If the in word is omitted, the for command executes list once for each positional parameter that is set (see @@ -1093,23 +1099,33 @@ The return status is the exit status of the last command that executes. If the expansion of the items following in results in an empty list, no commands are executed, and the return status is 0.
for (( expr1 ; expr2 ; expr3 )) ; do list ; done
-First, the arithmetic expression expr1 is evaluated according +First, evaluate the arithmetic expression expr1 according to the rules described below under ARITHMETIC EVALUATION. -The arithmetic expression expr2 is then evaluated repeatedly +Then, repeatedly evaluate the arithmetic expression expr2 until it evaluates to zero. -Each time expr2 evaluates to a non-zero value, list is -executed and the arithmetic expression expr3 is evaluated. +Each time expr2 evaluates to a non-zero value, +execute list +and evaluate the arithmetic expression expr3. If any expression is omitted, it behaves as if it evaluates to 1. The return value is the exit status of the last command in list -that is executed, or false if any of the expressions is invalid. +that is executed, or non-zero if any of the expressions is invalid. +
+Use the break and continue builtins +(see +SHELL BUILTIN COMMANDS + + +below) +to control loop execution.
select name [ in word ] ; do list ; done
-The list of words following in is expanded, generating a list -of items, and the set of expanded words is printed on the standard -error, each preceded by a number. If the in -word is omitted, the positional parameters are printed (see +First, expand the list of words following in, +generating a list of items, and print the set of expanded words +the standard error, each preceded by a number. +If the in +word is omitted, print the positional parameters (see PARAMETERS @@ -1122,16 +1138,17 @@ then displays the prompt and reads a line from the standard input. If the line consists of a number corresponding to one of -the displayed words, then the value of +the displayed words, then select sets the value of name -is set to that word. -If the line is empty, the words and prompt are displayed again. -If EOF is read, the select command completes and returns 1. -Any other value read causes +to that word. +If the line is empty, select displays the words and prompt again. +If EOF is read, select completes and returns 1. +Any other value sets name -to be set to null. The line read is saved in the variable +to null. +The line read is saved in the variable REPLY. @@ -1152,11 +1169,15 @@ or zero if no commands were executed.
case word in [ [(] pattern [ | pattern ] .. ) list ;; ] ... esac
A case command first expands word, and tries to match -it against each pattern in turn, using the matching rules +it against each pattern in turn, +proceeding from first to last, +using the matching rules described under Pattern Matching below. +A pattern list is a set of one or more patterns separated by , +and the ) operator terminates the pattern list. The word is expanded using tilde expansion, parameter and variable expansion, arithmetic expansion, command substitution, process substitution and quote removal. @@ -1168,30 +1189,35 @@ If the shell option is enabled, the match is performed without regard to the case of alphabetic characters. -When a match is found, the corresponding list is executed. -If the ;; operator is used, no subsequent matches are attempted after -the first pattern match. +A clause is a pattern list and an associated list. +
+When a match is found, case executes the corresponding list. +If the ;; operator terminates the case clause, the case +command completes after the first match. Using ;& in place of ;; causes execution to continue with -the list associated with the next set of patterns. +the list associated with the next pattern list. Using ;;& in place of ;; causes the shell to test the next pattern list in the statement, if any, and execute any associated list -on a successful match, +if the match succeeds. continuing the case statement execution as if the pattern list had not matched. -The exit status is zero if no -pattern matches. Otherwise, it is the exit status of the -last command executed in list. +The exit status is zero if no pattern matches. +
+Otherwise, it is the exit status of the +last command executed in the last list executed.
if list; then list; [ elif list; then list; ] ... [ else list; ] fi
The if list -is executed. If its exit status is zero, the -then list is executed. Otherwise, each elif -list is executed in turn, and if its exit status is zero, -the corresponding then list is executed and the -command completes. Otherwise, the else list is -executed, if present. The exit status is the exit status of the +is executed. +If its exit status is zero, the +then list is executed. +Otherwise, each elif list is executed in turn, +and if its exit status is zero, the corresponding then list +is executed and the command completes. +Otherwise, the else list is executed, if present. +The exit status is the exit status of the last command executed, or zero if no condition tested true.
while list-1; do list-2; done
@@ -1199,7 +1225,8 @@ last command executed, or zero if no condition tested true. The while command continuously executes the list list-2 as long as the last command in the list list-1 returns -an exit status of zero. The until command is identical +an exit status of zero. +The until command is identical to the while command, except that the test is negated: list-2 @@ -1247,7 +1274,7 @@ The recommended form to use for a coprocess is

-This form is recommended because simple commands result in the coprocess +This form is preferred because simple commands result in the coprocess always being named COPROC, and it is simpler to use and more complete than the other compound commands.

@@ -1290,7 +1317,7 @@ the file descriptors are not available in subshells. The process ID of the shell spawned to execute the coprocess is available as the value of the variable NAME_PID. The wait -builtin command may be used to wait for the coprocess to terminate. +builtin may be used to wait for the coprocess to terminate.

Since the coprocess is created as an asynchronous command, @@ -1321,16 +1348,20 @@ parentheses are not supplied, the braces are recommended. compound-command is executed whenever fname is specified as the name of a simple command. When in posix mode, fname must be a valid shell name -and may not be the name of one of the -POSIX special builtins. +and may not be the name of one of the POSIX special builtins. In default mode, a function name can be any unquoted shell word that does not contain $. +

+

+ Any redirections (see REDIRECTION below) specified when a function is defined are performed when the function is executed. +

+ The exit status of a function definition is zero unless a syntax error occurs or a readonly function with the same name already exists. When executed, the exit status of a function is the exit status of the @@ -1339,7 +1370,6 @@ last command executed in the body. (See below.) -  

COMMENTS

@@ -1356,19 +1386,25 @@ builtin is enabled (see below), a word beginning with # -causes that word and all remaining characters on that line to -be ignored. An interactive shell without the +introduces a comment. +A word begins at the beginning of a line, after unquoted whitespace, or +after an operator. +The comment causes that word and all remaining characters on that line to +be ignored. +An interactive shell without the interactive_comments -option enabled does not allow comments. The +option enabled does not allow comments. +The interactive_comments -option is on by default in interactive shells. +option is enabled by default in interactive shells.  

QUOTING

Quoting is used to remove the special meaning of certain -characters or words to the shell. Quoting can be used to +characters or words to the shell. +Quoting can be used to disable special treatment for special characters, to prevent reserved words from being recognized as such, and to prevent parameter expansion. @@ -1392,24 +1428,27 @@ below), the to prevent history expansion.

-There are three quoting mechanisms: the +There are four quoting mechanisms: the escape character, -single quotes, and double quotes. +single quotes, double quotes, +and dollar-single quotes.

A non-quoted backslash (\) is the escape character. It preserves the literal value of the next character that follows, -with the exception of <newline>. If a \<newline> pair -appears, and the backslash is not itself quoted, the \<newline> -is treated as a line continuation (that is, it is removed from the -input stream and effectively ignored). +removing any special meaning it has, +with the exception of <newline>. +If a \<newline> pair appears, and the backslash is not itself quoted, +the \<newline> is treated as a line continuation (that is, it is +removed from the input stream and effectively ignored).

Enclosing characters in single quotes preserves the literal value -of each character within the quotes. A single quote may not occur +of each character within the quotes. +A single quote may not occur between single quotes, even when preceded by a backslash.

@@ -1424,7 +1463,8 @@ of all characters within the quotes, with the exception of and, when history expansion is enabled, !. -When the shell is in posix mode, the ! has no special meaning +When the shell is in posix mode, +the ! has no special meaning within double quotes, even when history expansion is enabled. The characters $ @@ -1432,9 +1472,9 @@ The characters and ` -retain their special meaning within double quotes. The backslash -retains its special meaning only when followed by one of the following -characters: +retain their special meaning within double quotes. +The backslash retains its special meaning only when followed by one of +the following characters: $, `, @@ -1446,6 +1486,10 @@ characters: or <newline>. +Backslashes preceding characters without a +special meaning are left unmodified. +

+ A double quote may be quoted within double quotes by preceding it with a backslash. If enabled, history expansion will be performed unless an @@ -1562,7 +1606,8 @@ a control-x character The expanded result is single-quoted, as if the dollar sign had not been present. -

+  +

Translating Strings

A double-quoted string preceded by a dollar sign ($" string" @@ -1573,8 +1618,8 @@ translation, using the LC_MESSAGES, TEXTDOMAINDIR, and TEXTDOMAIN shell variables. If the current locale is C or POSIX, if there are no translations available, -or if the string is not translated, -the dollar sign is ignored. +or if the string is not translated, the dollar sign is ignored, +and the string is treated as double-quoted as described above. This is a form of double quoting, so the string remains double-quoted by default, whether or not it is translated and replaced. If the noexpand_translation option is enabled @@ -1587,7 +1632,7 @@ below under SHELL BUILTIN COMMANDS. -  + 

PARAMETERS

A @@ -1617,11 +1662,12 @@ below in SHELL BUILTIN COMMANDS). +The export and readonly builtins assign specific attributes.

-A parameter is set if it has been assigned a value. The null string is -a valid value. Once a variable is set, it may be unset only by using -the +A parameter is set if it has been assigned a value. +The null string is a valid value. +Once a variable is set, it may be unset only by using the unset builtin command (see @@ -1646,7 +1692,8 @@ may be assigned to by a statement of the form If value -is not given, the variable is assigned the null string. All +is not given, the variable is assigned the null string. +All values undergo tilde expansion, parameter and variable expansion, @@ -1655,7 +1702,8 @@ removal (see EXPANSION -below). If the variable has its +below). +If the variable has its integer attribute set, then @@ -1690,13 +1738,16 @@ assignment statement properties.

In the context where an assignment statement is assigning a value -to a shell variable or array index, the += operator can be used to +to a shell variable or array index, the += operator will append to or add to the variable's previous value. -This includes arguments to builtin commands such as declare that -accept assignment statements (declaration commands). -When += is applied to a variable for which the integer attribute has been -set, value is evaluated as an arithmetic expression and added to the -variable's current value, which is also evaluated. +This includes arguments to declaration commands such as +declare that accept assignment statements. +When += is applied to a variable for which the integer attribute +has been set, +the variable's current value and value are each evaluated as +arithmetic expressions, +and the sum of the results is assigned as the variable's value. +The current value is usually an integer constant, but may be an expression. When += is applied to an array variable using compound assignment (see Arrays @@ -1733,8 +1784,8 @@ declare -n ref=$1

-inside the function creates a nameref variable ref whose value is -the variable name passed as the first argument. +inside the function creates a local nameref variable ref whose value +is the variable name passed as the first argument. References and assignments to ref, and changes to its attributes, are treated as references, assignments, and attribute modifications to the variable whose name was passed as $1. @@ -1748,20 +1799,23 @@ array variables. Namerefs can be unset using the -n option to the unset builtin. Otherwise, if unset is executed with the name of a nameref variable as an argument, the variable referenced by the nameref variable will be unset. -  + 

Positional Parameters

A positional parameter is a parameter denoted by one or more -digits, other than the single digit 0. Positional parameters are +digits, other than the single digit 0. +Positional parameters are assigned from the shell's arguments when it is invoked, and may be reassigned using the set -builtin command. Positional parameters may not be assigned to -with assignment statements. The positional parameters are +builtin command. +Positional parameters may not be assigned to +with assignment statements. +The positional parameters are temporarily replaced when a shell function is executed (see FUNCTIONS @@ -1775,27 +1829,33 @@ digit is expanded, it must be enclosed in braces (see below). -  +Without braces, a digit following $ can only refer to +one of the first nine positional parameters ($1-$9) or the +special parameter $0 (see the next section). + 

Special Parameters

-The shell treats several parameters specially. These parameters may -only be referenced; assignment to them is not allowed. +The shell treats several parameters specially. +These parameters may only be referenced; assignment to them is +not allowed. +Special parameters are denoted by one of the following characters.
*
-Expands to the positional parameters, starting from one. +($*) Expands to the positional parameters, starting from one. When the expansion is not within double quotes, each positional parameter expands to a separate word. -In contexts where it is performed, those words +In contexts where word expansions are performed, those words are subject to further word splitting and pathname expansion. -When the expansion occurs within double quotes, it expands to a single word -with the value of each parameter separated by the first character of the +When the expansion occurs within double quotes, it expands to a +single word with the value of each parameter separated by the first +character of the IFS -special variable. +variable. That is, $* @@ -1809,7 +1869,8 @@ is the first character of the value of the IFS -variable. If +variable. +If IFS @@ -1822,14 +1883,16 @@ is null, the parameters are joined without intervening separators.
@
-Expands to the positional parameters, starting from one. +($@) Expands to the positional parameters, starting from one. In contexts where word splitting is performed, this expands each positional parameter to a separate word; if not within double quotes, these words are subject to word splitting. In contexts where word splitting is not performed, +such as the value portion of an assignment statement, this expands to a single word with each positional parameter separated by a space. When the expansion occurs within double quotes, +and word splitting is performed, each parameter expands to a separate word. That is, $@ @@ -1838,9 +1901,10 @@ is equivalent to $1 $2 ... If the double-quoted expansion occurs within a word, the expansion of -the first parameter is joined with the beginning part of the original -word, and the expansion of the last parameter is joined with the last -part of the original word. +the first parameter is joined with the expansion of the +beginning part of the original word, +and the expansion of the last parameter is joined with the +expansion of the last part of the original word. When there are no positional parameters, $@ @@ -1851,16 +1915,15 @@ expand to nothing (i.e., they are removed).
#
-Expands to the number of positional parameters in decimal. +($#) Expands to the number of positional parameters in decimal.
?
-Expands to the exit status of the most recently executed foreground -command. +($?) Expands to the exit status of the most recently executed command.
-
-Expands to the current option flags as specified upon invocation, +($-) Expands to the current option flags as specified upon invocation, by the set @@ -1872,13 +1935,13 @@ option).
$
-Expands to the process ID of the shell. In a subshell, it -expands to the process ID of the current shell, not the -subshell. +($$) Expands to the process ID of the shell. +In a subshell, it expands to the process ID of the parent shell, +not the subshell.
!
-Expands to the process ID of the job most recently placed into the +($!)Expands to the process ID of the job most recently placed into the background, whether executed as an asynchronous command or using the bg builtin (see JOB CONTROL @@ -1888,34 +1951,30 @@ below).
0
-Expands to the name of the shell or shell script. This is set at -shell initialization. If -bash - -is invoked with a file of commands, +($0) Expands to the name of the shell or shell script. +This is set at shell initialization. +If bash is invoked with a file of commands, $0 -is set to the name of that file. If -bash - -is started with the +is set to the name of that file. +If bash is started with the -c option, then $0 is set to the first argument after the string to be -executed, if one is present. Otherwise, it is set -to the filename used to invoke +executed, if one is present. +Otherwise, it is set to the filename used to invoke bash, as given by argument zero.
-  + 

Shell Variables

-The following variables are set by the shell: +The shell sets following variables:

@@ -1923,14 +1982,16 @@ The following variables are set by the shell:

_
-At shell startup, set to the pathname used to invoke the +($_, an underscore) +This has a number of meanings depending on context. +At shell startup, _ is set to the pathname used to invoke the shell or shell script being executed as passed in the environment or argument list. -Subsequently, expands to the last argument to the previous simple +Subsequently, it expands to the last argument to the previous simple command executed in the foreground, after expansion. -Also set to the full pathname used to invoke each command executed +It is also set to the full pathname used to invoke each command executed and placed in the environment exported to that command. -When checking mail, this parameter holds the name of the mail file +When checking mail, $_ expands to the name of the mail file currently being checked.
BASH @@ -1952,7 +2013,8 @@ builtin command (see SHELL BUILTIN COMMANDS -below). The options appearing in +below). +The options appearing in BASHOPTS @@ -1963,7 +2025,7 @@ by shopt. If this variable is in the environment when bash -starts up, each shell option in the list will be enabled before +starts up, the shell enables each option in the list before reading any startup files. This variable is read-only.
BASHPID @@ -1988,7 +2050,7 @@ subsequently reset. An associative array variable whose members correspond to the internal list of aliases as maintained by the alias builtin. Elements added to this array appear in the alias list; however, -unsetting array elements currently does not cause aliases to be removed +unsetting array elements currently does not remove aliases from the alias list. If BASH_ALIASES @@ -2000,9 +2062,8 @@ subsequently reset.
An array variable whose values are the number of parameters in each frame of the current bash execution call stack. -The number of -parameters to the current subroutine (shell function or script executed -with . or source) is at the top of the stack. +The number of parameters to the current subroutine (shell function or +script executed with . or source) is at the top of the stack. When a subroutine is executed, the number of parameters passed is pushed onto BASH_ARGC. @@ -2030,10 +2091,10 @@ have no effect, and it may not be unset.
An array variable containing all of the parameters in the current bash -execution call stack. The final parameter of the last subroutine call -is at the top of the stack; the first parameter of the initial call is -at the bottom. When a subroutine is executed, the parameters supplied -are pushed onto +execution call stack. +The final parameter of the last subroutine call is at the top of the stack; +the first parameter of the initial call is at the bottom. +When a subroutine is executed, the shell pushes the supplied parameters onto BASH_ARGV. @@ -2065,10 +2126,10 @@ script (identical to $0; see the description of special parameter 0 above). -Assignment to +Assigning a value to BASH_ARGV0 -causes the value assigned to also be assigned to $0. +assigns the same value to $0. If BASH_ARGV0 @@ -2079,8 +2140,8 @@ subsequently reset.
An associative array variable whose members correspond to the internal hash table of commands as maintained by the hash builtin. -Elements added to this array appear in the hash table; however, -unsetting array elements currently does not cause command names to be removed +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 BASH_CMDS @@ -2090,8 +2151,8 @@ subsequently reset.
BASH_COMMAND
-The command currently being executed or about to be executed, unless the -shell is executing a command as the result of a trap, +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 BASH_COMMAND @@ -2129,20 +2190,12 @@ have no effect, and it may not be unset.
BASH_LOADABLES_PATH
-A colon-separated list of directories in which the shell looks for -dynamically loadable builtins specified by the +A colon-separated list of directories in which the enable command. -
BASH_REMATCH - -
-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 expression. -The element with index n is the portion of the -string matching the nth parenthesized subexpression. +looks for +dynamically loadable builtins.
BASH_MONOSECONDS
@@ -2154,6 +2207,15 @@ If is unset, it loses its special properties, even if it is subsequently reset. +
BASH_REMATCH + +
+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 expression. +The element with index n is the portion of the +string matching the nth parenthesized subexpression.
BASH_SOURCE
@@ -2240,8 +2302,9 @@ The value of
Expands to a string describing the version of this instance of -bash. +bash +(e.g., 5.2.37(3)-release).
COMP_CWORD
@@ -2255,6 +2318,10 @@ below).
The key (or final key of a key sequence) used to invoke the current completion function. +This variable is available only in shell functions and external +commands invoked by the +programmable completion facilities (see Programmable Completion +below).
COMP_LINE
@@ -2277,7 +2344,7 @@ below).
COMP_TYPE
-Set to an integer value corresponding to the type of completion attempted +Set to an integer value corresponding to the type of attempted completion that caused a completion function to be called: TAB, for normal completion, ?, for listing completions after successive tabs, @@ -2469,9 +2536,9 @@ The default is system-dependent.
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. +(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 LINENO @@ -2546,7 +2613,8 @@ above).
PPID
-The process ID of the shell's parent. This variable is readonly. +The process ID of the shell's parent. +This variable is readonly.
PWD
@@ -2565,6 +2633,8 @@ a value to initializes (seeds) the sequence of random numbers. +Seeding the random number generator with the same constant value will +produce the same sequence of values. If RANDOM @@ -2653,8 +2723,8 @@ subsequently reset.
SHELLOPTS
-A colon-separated list of enabled shell options. Each word in -the list is a valid argument for the +A colon-separated list of enabled shell options. +Each word in the list is a valid argument for the -o option to the @@ -2664,7 +2734,8 @@ builtin command (see SHELL BUILTIN COMMANDS -below). The options appearing in +below). +The options appearing in SHELLOPTS @@ -2675,7 +2746,7 @@ by set -o. If this variable is in the environment when bash -starts up, each shell option in the list will be enabled before +starts up, the shell enables each option in the list before reading any startup files. This variable is read-only.
SHLVL @@ -2688,8 +2759,9 @@ is started.
SRANDOM
-This variable expands to a 32-bit pseudo-random number each time it is -referenced. The random number generator is not linear on systems that +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 /dev/urandom @@ -2716,7 +2788,7 @@ This variable is readonly.

-The following variables are used by the shell. In some cases, +The shell uses the following variables. In some cases, bash assigns a default value to a variable; these cases are noted @@ -2755,10 +2827,9 @@ The current version is also a valid value.

If this parameter is set when bash is executing a shell script, -its value is interpreted as a filename containing commands to -initialize the shell, as in -~/.bashrc. - +its expanded value is interpreted as a filename containing commands to +initialize the shell before it reads and executes commands from the +script. The value of BASH_ENV @@ -2801,8 +2872,8 @@ The search path for the cd command. -This is a colon-separated list of directories in which the shell looks -for destination directories specified by the +This is a colon-separated list of directories where the shell looks for +directories specified as arguments to the cd command. @@ -2856,7 +2927,7 @@ when an interactive shell is invoked in posix mode.
A colon-separated list of shell patterns (see Pattern Matching) -defining the list of filenames to be ignored by command search using +defining the set of filenames to be ignored by command search using PATH. Files whose full pathnames match one of these patterns are not considered executable files for the purposes of completion and command execution @@ -2895,7 +2966,8 @@ A sample value is
If set to a numeric value greater than 0, defines a maximum function -nesting level. Function invocations that exceed this nesting level +nesting level. +Function invocations that exceed this nesting level will cause the current command to abort.
GLOBIGNORE @@ -2908,11 +2980,13 @@ of the patterns in it is removed from the list of matches. +The pattern matching honors the setting of the extglob shell +option.
GLOBSORT
-Control how the results of pathname expansion are sorted. +Controls how the results of pathname expansion are sorted. The value of this variable specifies the sort criteria and sort order for the results of pathname expansion. If this variable is unset or set to the null string, pathname expansion @@ -2937,11 +3011,13 @@ The valid sort specifiers are and blocks, -which sort the files on name, names in numeric rather than lexicographic order, +which sort the files on name, +names in numeric rather than lexicographic order, file size, modification time, access time, inode 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 -mtime sorts the results in descending order by modification time (newest first).
@@ -2954,6 +3030,7 @@ the all-digit names and are sorted by name using the traditional behavior. A sort specifier of nosort disables sorting completely; the results are returned in the order they are read from the file system, and any leading + or - is ignored. +
If the sort specifier is missing, it defaults to name, so a value of + is equivalent to the null string, and a value of - sorts by name in descending order. @@ -2974,7 +3051,7 @@ character are not saved in the history list. A value of ignoredups -causes lines matching the previous history entry to not be saved. +causes lines matching the previous history entry not to be saved. A value of ignoreboth @@ -2997,9 +3074,12 @@ subject to the value of The second and subsequent lines of a multi-line compound command are not tested, and are added to the history regardless of the value of -HISTCONTROL. +HISTCONTROL +if the first line of the command was saved. +If the first line was not saved, the second and subsequent lines of +the command are not saved either.
HISTFILE
@@ -3010,16 +3090,16 @@ The name of the file in which command history is saved (see below). Bash assigns a default value of ~/.bash_history. If HISTFILE is unset or null, -the command history is not saved when a shell exits. +the shell does not save the command history when it exits.
HISTFILESIZE
-The maximum number of lines contained in the history file. When this -variable is assigned a value, the history file is truncated, if -necessary, -to contain no more than that number of lines by removing the oldest entries. +The maximum number of lines contained in the history file. +When this variable is assigned a value, the history file is truncated, +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. +writing it when a shell exits or by the history 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 HISTSIZE @@ -3055,6 +3135,8 @@ not tested, and are added to the history regardless of the value of HISTIGNORE. +If the first line was not saved, the second and subsequent lines of +the command are not saved either. The pattern matching honors the setting of the extglob shell option.
HISTSIZE @@ -3078,7 +3160,7 @@ for to print the time stamp associated with each history entry displayed by the history builtin. -If this variable is set, time stamps are written to the history file so +If this variable is set, the shell writes time stamps to the history file so they may be preserved across shell sessions. This uses the history comment character to distinguish timestamps from other history lines. @@ -3130,7 +3212,12 @@ for word splitting after expansion and to split lines into words with the read -builtin command. The default value is +builtin command. +Word splitting is described above under +EXPANSION. + + +The default value is
IGNOREEOF @@ -3140,8 +3227,8 @@ action of an interactive shell on receipt of an EOF -character as the sole input. If set, the value is the number of -consecutive +character as the sole input. +If set, the value is the number of consecutive EOF @@ -3149,8 +3236,11 @@ characters which must be typed as the first characters on an input line before bash -exits. If the variable exists but does not have a numeric value, or -has no value, the default value is 10. If it does not exist, +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, EOF @@ -3232,7 +3322,7 @@ option is enabled or in an interactive shell upon receipt of a
MAIL
-If this parameter is set to a file or directory name and the +If the value is set to a file or directory name and the MAILPATH @@ -3248,8 +3338,10 @@ Specifies how often (in seconds) bash -checks for mail. The default is 60 seconds. When it is time to check -for mail, the shell does so before displaying the primary prompt. +checks for mail. +The default 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.
MAILPATH @@ -3304,8 +3396,8 @@ script is executed.
PATH
-The search path for commands. It -is a colon-separated list of directories in which +The search path for commands. +It is a colon-separated list of directories in which the shell looks for commands (see COMMAND EXECUTION @@ -3356,7 +3448,8 @@ trailing directory components to retain when expanding the \w and PROMPTING -below). Characters removed are replaced with an ellipsis. +below). +Characters removed are replaced with an ellipsis.
PS0
@@ -3373,7 +3466,8 @@ The value of this parameter is expanded (see PROMPTING -below) and used as the primary prompt string. The default value is +below) and used as the primary prompt string. +The default value is
PS2 @@ -3382,7 +3476,8 @@ The value of this parameter is expanded as with PS1 -and used as the secondary prompt string. The default is +and used as the secondary prompt string. +The default is
PS3 @@ -3468,9 +3563,10 @@ The CPU percentage, computed as (%U + %S) / %R. The optional p is a digit specifying the precision, the number of fractional digits after a decimal point. A value of 0 causes no decimal point or fraction to be output. -At most six places after the decimal point may be specified; +time will print at most six digits after the decimal point; values of p greater than 6 are changed to 6. -If p is not specified, the value 3 is used. +If p is not specified, +time prints three digits after the decimal point.
The optional l specifies a longer format, including minutes, of the form MMmSS.FFs. @@ -3486,11 +3582,8 @@ A trailing newline is added when the format string is displayed.
If set to a value greater than zero, -TMOUT - - -is treated as the -default timeout for the read builtin. +the read builtin uses the value as its +default timeout. The select command terminates if input does not arrive after TMOUT @@ -3502,8 +3595,8 @@ number of seconds to wait for a line of input after issuing the primary prompt. Bash -terminates after waiting for that number of seconds if a complete -line of input does not arrive. +terminates after waiting for that number of seconds if a +complete line of input does not arrive.
TMPDIR
@@ -3513,11 +3606,14 @@ If set, bash uses its value as the name of a directory in which
This variable controls how the shell interacts with the user and -job control. If this variable is set, single word simple +job control. +If this variable is set, single-word simple commands 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 the string typed, the job most recently -accessed is selected. The +of an existing stopped job. +There is no ambiguity allowed; if there is more than one job +beginning with the string typed, the most recently accessed job +is selected. +The name of a stopped job, in this context, is the command line used to @@ -3551,7 +3647,8 @@ and tokenization (see HISTORY EXPANSION -below). The first character is the history expansion character, +below). +The first character is the history expansion character, the character which signals the start of a history expansion, normally @@ -3571,7 +3668,7 @@ It does not necessarily cause the shell parser to treat the rest of the line as a comment. -  + 

Arrays

Bash @@ -3594,7 +3691,8 @@ An indexed array is created automatically if any variable is assigned to using the syntax name[subscript]=value. The subscript -is treated as an arithmetic expression that must evaluate to a number. +is treated as an arithmetic expression that must evaluate to a number +greater than or equal to zero. To explicitly declare an indexed array, use declare -a name @@ -3620,10 +3718,11 @@ specified for an array variable using the and readonly -builtins. Each attribute applies to all members of an array. +builtins. +Each attribute applies to all members of an array.

-Arrays are assigned to using compound assignments of the form +Arrays are assigned using compound assignments of the form name=(value1 ... valuen), where each value may be of the form [subscript]=string. Indexed array assignments do not require anything but string. @@ -3636,10 +3735,13 @@ but values that are valid variable assignments including 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 subscript 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. +to by the statement plus one. +Indexing starts at zero.

When assigning to an associative array, the words in a compound assignment @@ -3659,8 +3761,11 @@ a final missing value is treated like the empty string. This syntax is also accepted by the declare -builtin. Individual array elements may be assigned to using the +builtin. +Individual array elements may be assigned to using the name[subscript]=value syntax introduced above. +

+ When assigning to an indexed array, if name @@ -3678,34 +3783,42 @@ using the compound assignment syntax; see above.

-Any element of an array may be referenced using -${name[subscript]}. The braces are required to avoid -conflicts with pathname expansion. If -subscript is @ or *, the word expands to +An array element is referenced using +${name[subscript]}. +The braces are required to avoid conflicts with pathname expansion. +If subscript is @ or *, the word expands to all members of name, 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 double-quoted, -${name[*]} expands to a single +word appears within double quotes. +If the word is double-quoted, ${name[*]} expands to a single word with the value of each array member separated by the first character of the IFS special variable, and ${name[@]} expands each element of -name to a separate word. When there are no array members, -${name[@]} expands to nothing. +name to a separate word. +When there are no array members, ${name[@]} 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 original -word, and the expansion of the last parameter is joined with the last -part of the original word. +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 Special Parameters -above). ${#name[subscript]} expands to the length of -${name[subscript]}. If subscript is * or -@, the expansion is the number of elements in the array. +above). +

+ +${#name[subscript]} expands to the length of +${name[subscript]}. +If subscript is * or @, +the expansion is the number of elements in the array. +

+ If the subscript @@ -3725,7 +3838,8 @@ will create an array if necessary.

An array variable is considered set if a subscript has been assigned a -value. The null string is a valid value. +value. +The null string is a valid value.

It is possible to obtain the keys (indices) of an array as well as the values. @@ -3738,16 +3852,18 @@ special parameters @ and * within double quotes. The unset -builtin is used to destroy arrays. unset name[subscript] -destroys the array element at index subscript, +builtin is used to destroy arrays. +unset name[subscript] +unsets the array element at index subscript, for both indexed and associative arrays. Negative subscripts to indexed arrays are interpreted as described above. Unsetting the last element of an array variable does not unset the variable. unset name, where name is an array, removes the entire array. -unset name[subscript], where -subscript is * or @, behaves differently depending on -whether name is an indexed or associative array. +unset name[subscript] +behaves differently depending on +whether name is an indexed or associative array +when subscript is * or @. If name is an associative array, this unsets the element with subscript * or @. If name is an indexed array, unset removes all of the elements but @@ -3756,8 +3872,11 @@ does not remove the array itself. When using a variable name with a subscript as an argument to a command, such as with unset, without using the word expansion syntax -described above, the argument is subject to pathname expansion. -If pathname expansion is not desired, the argument should be quoted. +described 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 @@ -3786,7 +3905,8 @@ builtin accepts a -a option to assign a list of words read from the standard input -to an array. The +to an array. +The set and @@ -3794,7 +3914,11 @@ and 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., mapfile); see the descriptions +of individual builtins below for details. +The shell provides a number of builtin array variables. + 

EXPANSION

Expansion is performed on the command line after it has been split into @@ -3856,16 +3980,17 @@ as explained above (see PARAMETERS). -  + 

Brace Expansion

Brace expansion -is a mechanism by which arbitrary strings -may be generated. This mechanism is similar to +is a mechanism to generate arbitrary strings +sharing a common prefix and suffix, either of which can be empty. +This mechanism is similar to pathname expansion, but the filenames generated -need not exist. Patterns to be brace expanded take -the form of an optional +need not exist. +Patterns to be brace expanded are formed from an optional preamble, followed by either a series of comma-separated strings or @@ -3901,12 +4026,14 @@ using the default C locale. Note that both x and y must be of the same type (integer or letter). When the increment is supplied, it is used as the difference between -each term. The default increment is 1 or -1 as appropriate. +each term. +The default increment is 1 or -1 as appropriate.

Brace expansion is performed before any other expansions, and any characters special to other expansions are preserved -in the result. It is strictly textual. +in the result. +It is strictly textual. Bash does not apply any syntactic interpretation to the context of the @@ -3917,6 +4044,8 @@ A correctly-formed brace expansion must contain unquoted opening and closing braces, and at least one unquoted comma or a valid sequence expression. Any incorrectly formed brace expansion is left unchanged. +

+ A { or , may be quoted with a backslash to prevent its being considered part of a brace expression. To avoid conflicts with parameter expansion, the string ${ @@ -3951,21 +4080,17 @@ appear as part of a word, and preserves them in the output. Bash removes braces from words as a consequence of brace -expansion. For example, a word entered to +expansion. +For example, a word entered to sh as file{1,2} -appears identically in the output. The same word is -output as +appears identically in the output. +Bash outputs that word as file1 file2 -after expansion by -bash. - -If strict compatibility with -sh - -is desired, start +after brace expansion. +Start bash with the @@ -3981,8 +4106,8 @@ command (see SHELL BUILTIN COMMANDS -below). -  +below) for strict sh compatibility. + 

Tilde Expansion

If a word begins with an unquoted tilde character ( @@ -4002,8 +4127,8 @@ If HOME -is unset, the home directory of the user executing the shell is -substituted instead. +is unset, the tilde expands to +the home directory of the user executing the shell instead. Otherwise, the tilde-prefix is replaced with the home directory associated with the specified login name.

@@ -4017,11 +4142,11 @@ the value of the shell variable replaces the tilde-prefix. If the tilde-prefix is a -the value of the shell variable +the shell substitutes the value of the shell variable OLDPWD, -if it is set, is substituted. +if it is set. If the characters following the tilde in the tilde-prefix consist of a number N, optionally prefixed by a @@ -4032,7 +4157,8 @@ the tilde-prefix is replaced with the corresponding element from the directory stack, as it would be displayed by the dirs -builtin invoked with the tilde-prefix as an argument. +builtin invoked with the characters following the 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 @@ -4042,18 +4168,23 @@ or is assumed.

-If the login name is invalid, or the tilde expansion fails, the word -is unchanged. +The results of tilde expansion are treated as if they were quoted, so +the replacement is not subject to word splitting and pathname expansion. +

+ +If the login name is invalid, or the tilde expansion fails, the +tilde-prefix is unchanged.

-Each variable assignment is checked for unquoted tilde-prefixes immediately +Bash checks each variable assignment +for unquoted tilde-prefixes immediately following a : or the first -=. +=, -In these cases, tilde expansion is also performed. +and performs tilde expansion in these cases. Consequently, one may use filenames with tildes in assignments to PATH, @@ -4076,13 +4207,14 @@ of variable assignments (as described above under when they appear as arguments to simple commands. Bash does not do this, except for the declaration commands listed above, when in posix mode. -  + 

Parameter Expansion

The character introduces parameter expansion, -command substitution, or arithmetic expansion. The parameter name +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 could be @@ -4096,10 +4228,14 @@ embedded arithmetic expansion, command substitution, or parameter expansion.

+The basic form of parameter expansion is +

-

-
${parameter}
-The value of parameter is substituted. The braces are required +${parameter} +

+ +which substitutes the value of parameter. +The braces are required when parameter @@ -4112,22 +4248,21 @@ interpreted as part of its name. The parameter is a shell parameter as described above PARAMETERS) or an array reference (Arrays). -

If the first character of parameter is an exclamation point (!), and parameter is not a nameref, it introduces a level of indirection. Bash uses the value formed by expanding the rest of -parameter as the new parameter; this is then -expanded and that value is used in the rest of the expansion, rather +parameter as the new parameter; +this new parameter is then expanded and that value is used in the rest of the expansion, rather than the expansion of the original parameter. This is known as indirect expansion. The value is subject to tilde expansion, parameter expansion, command substitution, and arithmetic expansion. If parameter is a nameref, this expands to the name of the parameter referenced by parameter instead of performing the -complete indirect expansion. +complete indirect expansion, for compatibility. The exceptions to this are the expansions of ${!prefix*} and ${!name[@]} described below. The exclamation point must immediately follow the left brace in order to @@ -4140,8 +4275,8 @@ parameter expansion, command substitution, and arithmetic expansion. When not performing substring expansion, using the forms documented below (e.g., :-), -bash tests for a parameter that is unset or null. Omitting the colon -results in a test only for a parameter that is unset. +bash tests for a parameter that is unset or null. +Omitting the colon tests only for a parameter that is unset.

@@ -4153,7 +4288,8 @@ results in a test only for a parameter that is unset. is unset or null, the expansion of word -is substituted. Otherwise, the value of +is substituted. +Otherwise, the value of parameter is substituted. @@ -4166,13 +4302,13 @@ is unset or null, the expansion of word is assigned to -parameter. +parameter, -The value of -parameter +and the expansion is the final value of +parameter. -is then substituted. Positional parameters and special parameters may -not be assigned to in this way. +Positional parameters and special parameters may +not be assigned in this way.

${parameter:?word}
Display Error if Null or Unset. If @@ -4183,8 +4319,10 @@ if word is not present) is written to the standard error and the shell, if it -is not interactive, exits. Otherwise, the value of parameter is -substituted. +is 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 parameter is substituted.
${parameter:+word}
Use Alternate Value. If @@ -4194,6 +4332,7 @@ is null or unset, nothing is substituted, otherwise the expansion of word is substituted. +The value of parameter is not used.
${parameter:offset}
${parameter:offset:length}
@@ -4273,7 +4412,7 @@ When @ is used and the expansion appears within double quotes, each key expands to a separate word.
${#parameter}
Parameter length. -The length in characters of the value of parameter is substituted. +Substitutes the length in characters of the expanded value of parameter. If parameter @@ -4405,15 +4544,17 @@ array in turn, and the expansion is the resultant list. Pattern substitution. The pattern is expanded to produce a pattern just as in -pathname expansion. -Parameter is expanded and the longest match of pattern -against its value is replaced with string. -string undergoes tilde expansion, parameter and variable expansion, -arithmetic expansion, command and process substitution, and quote removal. -The match is performed using the rules described under +pathname expansion and matched against the expanded value of +parameter +using the rules described under Pattern Matching below. +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 form above), all matches of pattern are @@ -4422,9 +4563,8 @@ If pattern is preceded by # (the third form above), it must match at the beginning of the expanded value of parameter. If pattern is preceded by % (the fourth form above), it must match at the end of the expanded value of parameter. +
If the expansion of string is null, -matches of pattern are deleted. -If string is null, matches of pattern are deleted and the / following pattern may be omitted.
@@ -4448,11 +4588,18 @@ shell programmers should quote any occurrences of & they want to be taken literally in the replacement and ensure any instances of & they want to be replaced are unquoted.
+Like the pattern removal operators, double quotes surrounding the +replacement string quote the expanded characters, while double quotes +enclosing the entire parameter substitution do not, since +the expansion is performed in a +context that doesn't take any enclosing double quotes into account. +
If the nocasematch shell option is enabled, the match is performed without regard to the case of alphabetic characters. +
If parameter @@ -4488,6 +4635,7 @@ pathname expansion. Each character in the expanded value of parameter is tested against pattern, 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 pattern to uppercase; the , operator converts matching uppercase letters to lowercase. @@ -4496,6 +4644,7 @@ 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. +
If parameter @@ -4616,7 +4765,7 @@ The result of the expansion is subject to word splitting and pathname expansion as described below. -  + 

Command Substitution

Command substitution allows the output of a command to replace @@ -4715,11 +4864,12 @@ escape the inner backquotes with backslashes. If the substitution appears within double quotes, bash does not perform word splitting and pathname expansion on the results. -  + 

Arithmetic Expansion

-Arithmetic expansion allows the evaluation of an arithmetic expression -and the substitution of the result. The format for arithmetic expansion is: +Arithmetic expansion evaluates an arithmetic expression +and substitutes the result. +The format for arithmetic expansion is:

@@ -4751,8 +4901,10 @@ If is invalid, bash -prints a message indicating failure and no substitution occurs. -  +prints a message to standard error indicating failure, +does not perform the substitution, +and does not execute the command associated with the expansion. + 

Process Substitution

Process substitution allows a process's input or output to be @@ -4766,10 +4918,18 @@ appears as a filename. This filename is passed as an argument to the current command as the result of the expansion. +

+ If the >(list) form is used, writing to -the file will provide input for list. If the -<(list) form is used, the file passed as an -argument should be read to obtain the output of list. +the file will provide input for list. +If the +<(list) form is used, reading the file +will obtain the output of list. +No space may appear between the < or > +and the left parenthesis, otherwise the construct would be interpreted +as a redirection. +

+ Process substitution is supported on systems that support named pipes (FIFOs) or the /dev/fd method of naming open files.

@@ -4778,7 +4938,7 @@ When available, process substitution is performed simultaneously with parameter and variable expansion, command substitution, and arithmetic expansion. -  + 

Word Splitting

The shell scans the results of @@ -4822,7 +4982,7 @@ any sequence of IFS -characters not at the beginning or end serves to delimit words. +characters not at the beginning or end delimits words. If IFS @@ -4836,9 +4996,7 @@ the whitespace characters and newline -are ignored at the beginning and end of the -word, as long as the whitespace character is in the -value of +present in the value of IFS @@ -4846,7 +5004,8 @@ value of IFS -whitespace character). +whitespace character) +are ignored at the beginning and end of the word. Any character in IFS @@ -4901,9 +5060,8 @@ becomes after word splitting and null argument removal.

-Note that if no expansion occurs, no splitting -is performed. -  +Note that if no expansion occurs, no splitting is performed. + 

Pathname Expansion

After word splitting, @@ -4925,13 +5083,15 @@ If one of these characters appears, and is not quoted, then the word is regarded as a pattern, -and replaced with an alphabetically sorted list of -filenames matching the pattern +and replaced with a sorted list of filenames matching the pattern (see Pattern Matching -below). +below) +subject to the value of the GLOBSORT shell variable. +

+ If no matching filenames are found, and the shell option nullglob @@ -4945,13 +5105,15 @@ the word is removed. If the failglob -shell option is set, and no matches are found, an error message -is printed and the command is not executed. +shell option is set, and no matches are found, +bash prints an error message and does not execute the command. If the shell option nocaseglob is enabled, the match is performed without regard to the case of alphabetic characters. +

+ When a pattern is used for pathname expansion, the character @@ -4984,6 +5146,8 @@ never match, even if the pattern begins with a When not matching pathnames, the character is not treated specially. +

+ When matching a pathname, the slash character must always be matched explicitly by a slash in the pattern, but in other matching contexts it can be matched by a special pattern character as described @@ -4991,6 +5155,8 @@ below under Pattern Matching. +

+ See the description of shopt @@ -5051,7 +5217,7 @@ to a non-null value has the effect of enabling the dotglob shell option, so all other filenames beginning with a -Q . + will match. To get the old behavior of ignoring filenames beginning with a @@ -5069,7 +5235,10 @@ option is disabled when is unset. -The pattern matching honors the setting of the extglob shell +The +GLOBIGNORE + +pattern matching honors the setting of the extglob shell option.

@@ -5077,8 +5246,8 @@ The GLOBSORT -variable controls how the results of pathname expansion are sorted, as -described above. +shell variable controls how the results of pathname expansion are sorted, +as described above.

Pattern Matching @@ -5116,12 +5285,13 @@ Matches any single character.

[...]
+ Matches any one of the enclosed characters. A pair of characters separated by a hyphen denotes a range expression; any character that falls between those two characters, inclusive, -using the current locale's collating sequence and character set, -is matched. If the first character following the +using the current locale's collating sequence and character set, matches. +If the first character following the [ is a @@ -5130,11 +5300,21 @@ is a or a ^ -then any character not enclosed is matched. +then any character not within the range matches. +A +- + +may be matched by including it as the first or last character +in the set. +A +] + +may be matched by including it as the first character +in the set. +
The sorting order of characters in range expressions, and the characters included in the range, -are determined by -the current locale and the values of the +are determined by the current locale and the values of the LC_COLLATE @@ -5149,27 +5329,19 @@ To obtain the traditional interpretation of range expressions, where is equivalent to [abcd], -set value of the +set the value of the +LC_COLLATE + +or LC_ALL -shell variable to +shell variables to C, or enable the globasciiranges shell option. -A -- - -may be matched by including it as the first or last character -in the set. -A -] - -may be matched by including it as the first character -in the set. -
Within [ @@ -5227,15 +5399,15 @@ sub-patterns:
?(pattern-list)
-Matches zero or one occurrence of the given patterns +Matches zero or one occurrence of the given patterns.
*(pattern-list)
-Matches zero or more occurrences of the given patterns +Matches zero or more occurrences of the given patterns.
+(pattern-list)
-Matches one or more occurrences of the given patterns +Matches one or more occurrences of the given patterns.
@(pattern-list)
-Matches one of the given patterns +Matches one of the given patterns.
!(pattern-list)
-Matches anything except one of the given patterns +Matches anything except one of the given patterns.
@@ -5263,6 +5435,14 @@ include any filenames beginning with unless the pattern or sub-pattern begins with a +If the +globskipdots + +shell option is enabled, the filenames + +and + +never appear in the set. As above, only has a special meaning when matching filenames. @@ -5273,7 +5453,7 @@ especially when the patterns contain alternations and the strings contain multiple matches. Using separate matches against shorter strings, or using arrays of strings instead of a single long string, may be faster. -  + 

Quote Removal

After the preceding expansions, all unquoted occurrences of the @@ -5285,7 +5465,7 @@ characters and " that did not result from one of the above expansions are removed. -  + 

REDIRECTION

Before a command is executed, its input and output @@ -5297,8 +5477,8 @@ using a special notation interpreted by the shell. duplicated, opened, closed, made to refer to different files, and can change the files the command reads from and writes to. -Redirection may also be used to modify file handles in the -current shell execution environment. +When used with the exec builtin, +redirections modify file handles in the current shell execution environment. The following redirection operators may precede or appear anywhere within a simple command @@ -5315,12 +5495,12 @@ may instead be preceded by a word of the form {varname}. In this case, for each redirection operator except >&- and <&-, the shell will allocate a file descriptor greater than or equal to 10 and assign it to varname. -If >&- or <&- is preceded -by {varname}, the value of varname defines the file -descriptor to close. +If {varname} precedes >&- or <&-, +the value of varname defines the file descriptor to close. If {varname} is supplied, the redirection persists beyond -the scope of the command, allowing the shell programmer to manage -the file descriptor's lifetime manually. +the scope of the command, which allows the shell programmer to manage +the file descriptor's lifetime manually +without using the exec builtin. The varredir_close shell option manages this behavior.

@@ -5336,18 +5516,24 @@ the redirection refers to the standard output (file descriptor 1).

-The word following the redirection operator in the following +The word following the redirection operator in the following descriptions, unless otherwise noted, is subjected to -brace expansion, tilde expansion, parameter and variable expansion, -command substitution, arithmetic expansion, quote removal, -pathname expansion, and word splitting. +brace expansion, +tilde expansion, +parameter and variable expansion, +command substitution, +arithmetic expansion, +quote removal, +pathname expansion, +and word splitting. If it expands to more than one word, bash reports an error.

-Note that the order of redirections is significant. For example, +The order of redirections is significant. +For example, the command

@@ -5372,7 +5558,7 @@ ls 2>&1 > dirlist directs only the standard output to file dirlist, -because the standard error was duplicated from the standard output +because the standard error was directed to the standard output before the standard output was redirected to dirlist. @@ -5381,7 +5567,7 @@ before the standard output was redirected to Bash handles several filenames specially when they are used in redirections, as described in the following table. If the operating system on which bash is running provides these -special files, bash will use them; otherwise it will emulate them +special files, bash will use them; otherwise it will emulate them internally with the behavior described below.

@@ -5391,7 +5577,7 @@ internally with the behavior described below.

/dev/fd/fd
-If fd is a valid integer, file descriptor fd is duplicated. +If fd is a valid integer, duplicate file descriptor fd.
/dev/stdin
@@ -5427,14 +5613,14 @@ A failure to open or create a file causes the redirection to fail. Redirections using file descriptors greater than 9 should be used with care, as they may conflict with file descriptors the shell uses internally. -  + 

Redirecting Input

-Redirection of input causes the file whose name results from +Redirecting input opens the file whose name results from the expansion of word -to be opened for reading on file descriptor +for reading on file descriptor n, or the standard input (file descriptor 0) if @@ -5450,20 +5636,21 @@ The general format for redirecting input is: [n]<word
-  + 

Redirecting Output

-Redirection of output causes the file whose name results from +Redirecting output opens the file whose name results from the expansion of word -to be opened for writing on file descriptor +for writing on file descriptor n, or the standard output (file descriptor 1) if n -is not specified. If the file does not exist it is created; +is not specified. +If the file does not exist it is created; if it does exist it is truncated to zero size.

@@ -5500,23 +5687,24 @@ and the option to the set -builtin command is not enabled, the redirection is attempted even -if the file named by word exists. -  +builtin command is not enabled, +bash attempts the redirection +even if the file named by word exists. + 

Appending Redirected Output

-Redirection of output in this fashion -causes the file whose name results from -the expansion of +Redirecting output in this fashion opens +the file whose name results from the expansion of word -to be opened for appending on file descriptor +for appending on file descriptor n, or the standard output (file descriptor 1) if n -is not specified. If the file does not exist it is created. +is not specified. +If the file does not exist it is created.

The general format for appending output is: @@ -5526,14 +5714,13 @@ The general format for appending output is: [n]>>word

-  + 

Redirecting Standard Output and Standard Error

-This construct allows both the +This construct redirects both the standard output (file descriptor 1) and the standard error output (file descriptor 2) -to be redirected to the file whose name is the -expansion of +to the file whose name is the expansion of word.

@@ -5564,17 +5751,17 @@ This is semantically equivalent to

When using the second form, word may not expand to a number or --. If it does, other redirection operators apply +-. +If it does, other redirection operators apply (see Duplicating File Descriptors below) for compatibility reasons. -  + 

Appending Standard Output and Standard Error

-This construct allows both the +This construct appends both the standard output (file descriptor 1) and the standard error output (file descriptor 2) -to be appended to the file whose name is the -expansion of +to the file whose name is the expansion of word.

@@ -5598,7 +5785,7 @@ This is semantically equivalent to

(see Duplicating File Descriptors below). -  + 

Here Documents

This type of redirection instructs the shell to read input from the @@ -5606,7 +5793,7 @@ current source until it reads a line containing only delimiter (with no trailing blanks). -All of the lines read up to that point are then used as the standard +All of the lines read up to that point then become the standard input (or file descriptor n if n is specified) for a command.

@@ -5624,7 +5811,8 @@ The format of here-documents is:

-No parameter and variable expansion, command substitution, +The shell does not perform +parameter and variable expansion, command substitution, arithmetic expansion, or pathname expansion is performed on word. @@ -5644,12 +5832,13 @@ If word is unquoted, the delimiter is word itself, +and the here-document text is treated similarly to a double-quoted string: all lines of the here-document are subjected to parameter expansion, command substitution, and arithmetic expansion, the character sequence \<newline> -is ignored, and +is treated literally, and \ must be used to quote the characters @@ -5658,21 +5847,31 @@ must be used to quote the characters $, and -`. +`; +however, double quote characters have no special meaning.

If the redirection operator is <<-, -then all leading tab characters are stripped from input lines and the -line containing +then the shell strips all leading tab characters from input lines +and the line containing delimiter. This allows here-documents within shell scripts to be indented in a natural fashion. -  +

+ +If the delimiter is not quoted, the +\<newline> + +sequence is treated as a line continuation: the two lines are joined +and the backslash-newline is removed. +This happens while reading the here-document, before the check for +the ending delimiter, so joined lines can form the end delimiter. + 

Here Strings

A variant of here documents, the format is: @@ -5694,7 +5893,7 @@ Pathname expansion and word splitting are not performed. The result is supplied as a single string, with a newline appended, to the command on its standard input (or file descriptor n if n is specified). -  + 

Duplicating File Descriptors

The redirection operator @@ -5710,14 +5909,14 @@ is used to duplicate input file descriptors. If word -expands to one or more digits, the file descriptor denoted by +expands to one or more digits, file descriptor n is made to be a copy of that file descriptor. -If the digits in +It is a redirection error if the digits in word -do not specify a file descriptor open for input, a redirection error occurs. +do not specify a file descriptor open for input. If word @@ -5727,10 +5926,11 @@ evaluates to file descriptor n -is closed. If +is closed. +If n -is not specified, the standard input (file descriptor 0) is used. +is not specified, this uses the standard input (file descriptor 0).

The operator @@ -5742,14 +5942,15 @@ The operator

-is used similarly to duplicate output file descriptors. If +is used similarly to duplicate output file descriptors. +If n -is not specified, the standard output (file descriptor 1) is used. -If the digits in +is not specified, this uses the standard output (file descriptor 1). +It is a redirection error if the digits in word -do not specify a file descriptor open for output, a redirection error occurs. +do not specify a file descriptor open for output. If word @@ -5760,10 +5961,11 @@ file descriptor n is closed. -As a special case, if n is omitted, and word does not -expand to one or more digits or -, the standard output and standard -error are redirected as described previously. -  +As a special case, if n is omitted, +and word does not expand to one or more digits or -, +this redirects the standard output and standard error as described +previously. + 

Moving File Descriptors

The redirection operator @@ -5795,7 +5997,7 @@ moves the file descriptor digit to file descriptor n, or the standard output (file descriptor 1) if n is not specified. -  + 

Opening File Descriptors for Reading and Writing

The redirection operator @@ -5807,22 +6009,24 @@ The redirection operator

-causes the file whose name is the expansion of +opens the file whose name is the expansion of word -to be opened for both reading and writing on file descriptor +for both reading and writing on file descriptor n, or on file descriptor 0 if n -is not specified. If the file does not exist, it is created. -  +is not specified. +If the file does not exist, it is created. + 

ALIASES

Aliases allow a string to be substituted for a word that is in a position in the input where it can be the first word of a simple -command. Aliases have names and corresponding values that are set +command. +Aliases have names and corresponding values that are set and unset using the alias and unalias builtin commands (see SHELL BUILTIN COMMANDS @@ -5832,7 +6036,8 @@ below).

If the shell reads an unquoted word in the right position, it checks -the word to see if it matches an alias name. If it matches, the shell +the word to see if it matches an alias name. +If it matches, the shell replaces the word with the alias value, and reads that value as if it had been read instead of the word. The shell doesn't look at any characters following the word before @@ -5862,8 +6067,8 @@ does not try to recursively expand the replacement text. If the last character of the alias value is a blank, -then the next command -word following the alias is also checked for alias expansion. +the shell checks the next command +word following the alias for alias expansion.

Aliases are created and listed with the @@ -5880,7 +6085,7 @@ If arguments are needed, use a shell function (see FUNCTIONS -below). +below) instead.

Aliases are not expanded when the shell is not interactive, unless @@ -5894,7 +6099,9 @@ shell option is set using shopt under -SHELL BUILTIN COMMANDS +SHELL BUILTIN COMMANDS + + below).

@@ -5905,27 +6112,28 @@ somewhat confusing. always reads at least one complete line of input, and all lines that make up a compound command, before executing any of the commands on that line or the compound command. -Aliases are expanded when a -command is read, not when it is executed. Therefore, an +Aliases are expanded when a command is read, not when it is executed. +Therefore, an alias definition appearing on the same line as another -command does not take effect until the next line of input is read. +command does not take effect until the shell reads the next line of input. The commands following the alias definition on that line are not affected by the new alias. This behavior is also an issue when functions are executed. Aliases are expanded when a function definition is read, not when the function is executed, because a function definition -is itself a command. As a consequence, aliases +is itself a command. +As a consequence, aliases defined in a function are not available until after that -function is executed. To be safe, always put +function is executed. +To be safe, always put alias definitions on a separate line, and do not use alias in compound commands.

-For almost every purpose, aliases are superseded by -shell functions. -  +For almost every purpose, shell functions are preferable to aliases. + 

FUNCTIONS

A shell function, defined as described above under @@ -5934,18 +6142,21 @@ A shell function, defined as described above under
stores a series of commands for later execution. When the name of a shell function is used as a simple command name, -the list of commands associated with that function name is executed. +the shell executes +the list of commands associated with that function name. Functions are executed in the context of the -current shell; no new process is created to interpret +calling shell; there is no new process created to interpret them (contrast this with the execution of a shell script). +

+ When a function is executed, the arguments to the function become the positional parameters during its execution. The special parameter # -is updated to reflect the change. Special parameter 0 -is unchanged. +is updated to reflect the new positional parameters. +Special parameter 0 is unchanged. The first element of the FUNCNAME @@ -5987,7 +6198,7 @@ trap is not inherited unless the -o errtrace shell option has been enabled.

-Variables local to the function may be declared with the +Variables local to the function are declared with the local builtin command (local variables). @@ -6004,18 +6215,19 @@ Previous scopes consist of that function's caller and so on, back to the scope, where the shell is not executing any shell function. -Consequently, a local variable at the current scope is a variable +A local variable at the current scope is a variable declared using the local or declare builtins in the function that is currently executing.

Local variables -variables with the same name declared at -previous scopes. +variables with the same name declared at previous scopes. For instance, a local variable declared in a function -hides a global variable of the same name: references and assignments -refer to the local variable, leaving the global variable unmodified. +hides variables with the same name declared at previous scopes, +including global variables: references and assignments +refer to the local variable, leaving the variables +at previous scopes unmodified. When the function returns, the global variable is once again visible.

@@ -6055,8 +6267,8 @@ variable with that name that had been shadowed will become visible

The FUNCNEST variable, if set to a numeric value greater -than 0, defines a maximum function nesting level. Function -invocations that exceed the limit cause the entire command to +than 0, defines a maximum function nesting level. +Function invocations that exceed the limit cause the entire command to abort.

@@ -6066,6 +6278,10 @@ If the builtin command is executed in a function, the function completes and execution resumes with the next command after the function call. +If return is supplied a numeric argument, +that is the function's return status; otherwise the function's +return status is the exit status of the last command executed +before the return. Any command associated with the RETURN trap is executed before execution resumes. When a function completes, the values of the @@ -6076,7 +6292,7 @@ are restored to the values they had prior to the function's execution.

-Function names and definitions may be listed with the +The -f option to the @@ -6085,7 +6301,9 @@ option to the or typeset -builtin commands. The +builtin commands +will list function names and definitions. +The -F option to @@ -6106,24 +6324,31 @@ option to the export builtin. -A function definition may be deleted using the -f option to +The -f option to the unset -builtin. +builtin will delete a function definition.

Functions may be recursive. The FUNCNEST variable may be used to limit the depth of the function call stack and restrict the number of function invocations. -By default, no limit is imposed on the number of recursive calls. -  +By default, bash imposes no limit on the number of recursive calls. + 

ARITHMETIC EVALUATION

The shell allows arithmetic expressions to be evaluated, under -certain circumstances (see the let and declare builtin -commands, the (( compound command, and Arithmetic Expansion). -Evaluation is done in fixed-width integers with no check for overflow, +certain circumstances +(see the let and declare builtin commands, +the (( compound command, +the arithmetic for command, +the [[ conditional command, +and Arithmetic Expansion). +

+ +Evaluation is done in the largest fixed-width integers available, +with no check for overflow, though division by 0 is trapped and flagged as an error. The operators and their precedence, associativity, and values are the same as in the C language. @@ -6138,14 +6363,14 @@ The levels are listed in order of decreasing precedence.

variable post-increment and post-decrement -
- + - -
-unary minus and plus
++id --id
variable pre-increment and pre-decrement +
- + + +
+unary minus and plus
! ~
@@ -6214,8 +6439,13 @@ Shell variables are allowed as operands; parameter expansion is performed before the expression is evaluated. Within an expression, shell variables may also be referenced by name without using the parameter expansion syntax. +This means you can use "x", where x is a shell variable name, +in an arithmetic expression, and the shell will evaluate its value as +an expression and use the result. A shell variable that is null or unset evaluates to 0 when referenced -by name without using the parameter expansion syntax. +by name in an expression. +

+ The value of a variable is evaluated as an arithmetic expression when it is referenced, or when a variable which has been given the integer attribute using declare -i is assigned a value. @@ -6241,10 +6471,10 @@ letters may be used interchangeably to represent numbers between 10 and 35.

-Operators are evaluated in order of precedence. Sub-expressions in -parentheses are evaluated first and may override the precedence -rules above. -  +Operators are evaluated in precedence order. +Sub-expressions in parentheses are evaluated first +and may override the precedence rules above. + 

CONDITIONAL EXPRESSIONS

Conditional expressions are used by the [[ compound command and @@ -6255,7 +6485,13 @@ the number of arguments; see the descriptions of those commands for any other command-specific actions.

-Expressions are formed from the following unary or binary primaries. +Expressions are formed from the unary or binary primaries listed below. +Unary expressions are often used to examine the status of a file +or shell variable. +Binary operators are used for string, numeric, and file attribute +comparisons. +

+ Bash handles several filenames specially when they are used in expressions. If the operating system on which bash is running provides these @@ -6362,7 +6598,8 @@ True if file exists and is a symbolic link.

-N file
-True if file exists and has been modified since it was last read. +True if file exists and has been modified since it was last +accessed.
-O file
@@ -6371,15 +6608,6 @@ True if file exists and is owned by the effective user id.
True if file exists and is a socket. -
file1 -ef file2
-True if file1 and file2 refer to the same device and -inode numbers. -
file1 -nt file2
-True if file1 is newer (according to modification date) than file2, -or if file1 exists and file2 does not. -
file1 -ot file2
-True if file1 is older than file2, or if file2 exists -and file1 does not.
-o optname
@@ -6419,21 +6647,19 @@ is set and is a name reference.
True if the length of string is zero.
string
-
-n string
- True if the length of string is non-zero. +
string1 == string2
string1 = string2
- -True if the strings are equal. = should be used -with the test command for POSIX conformance. +True if the strings are equal. += should be used with the test command for POSIX conformance. When used with the [[ command, this performs pattern matching as described above (Compound Commands).
string1 != string2
@@ -6442,6 +6668,19 @@ True if the strings are not equal. True if string1 sorts before string2 lexicographically.
string1 > string2
True if string1 sorts after string2 lexicographically. + +
+
+file1 -ef file2 +True if file1 and file2 refer to the same device and +inode numbers. +
file1 -nt file2
+True if file1 is newer (according to modification date) than file2, +or if file1 exists and file2 does not. +
file1 -ot file2
+True if file1 is older than file2, or if file2 exists +and file1 does not. +
arg1 OP arg2
@@ -6465,17 +6704,17 @@ or These arithmetic binary operators return true if arg1 is equal to, not equal to, less than, less than or equal to, greater than, or greater than or equal to arg2, respectively. -Arg1 +arg1 and arg2 may be positive or negative integers. When used with the [[ command, -Arg1 +arg1 and -Arg2 +arg2 are evaluated as arithmetic expressions (see ARITHMETIC EVALUATION @@ -6484,10 +6723,10 @@ are evaluated as arithmetic expressions (see above).
-  + 

SIMPLE COMMAND EXPANSION

-When a simple command is executed, the shell performs the following +When the shell executes a simple command, it performs the following expansions, assignments, and redirections, from left to right, in the following order.
@@ -6497,7 +6736,8 @@ preceding the command name) and redirections are saved for later processing.
2.
The words that are not variable assignments or redirections are -expanded. If any words remain after expansion, the first word +expanded. +If any words remain after expansion, the first word is taken to be the name of the command and the remaining words are the arguments.
3.
@@ -6524,16 +6764,19 @@ an error occurs, and the command exits with a non-zero status.

If no command name results, redirections are performed, but do not -affect the current shell environment. A redirection error causes the -command to exit with a non-zero status. +affect the current shell environment. +A redirection error causes the command to exit with a non-zero status.

If there is a command name left after expansion, execution proceeds as -described below. Otherwise, the command exits. If one of the expansions -contained a command substitution, the exit status of the command is -the exit status of the last command substitution performed. If there -were no command substitutions, the command exits with a status of zero. -  +described below. +Otherwise, the command exits. +If one of the expansions contained a command substitution, +the exit status of the command is the exit status of +the last command substitution performed. +If there were no command substitutions, +the command exits with a zero status. + 

COMMAND EXECUTION

After a command has been split into words, if it results in a @@ -6542,14 +6785,15 @@ the following actions.

If the command name contains no slashes, the shell attempts to -locate it. If there exists a shell function by that name, that -function is invoked as described above in +locate it. +If there exists a shell function by that name, that function is +invoked as described above in FUNCTIONS. If the name does not match a function, the shell searches for -it in the list of shell builtins. If a match is found, that -builtin is invoked. +it in the list of shell builtins. +If a match is found, that builtin is invoked.

If the name is neither a shell function nor a builtin, @@ -6572,11 +6816,11 @@ under below). -A full search of the directories in +Bash performs a full search of the directories in PATH -is performed only if the command is not found in the hash table. +only if the command is not found in the hash table. If the search is unsuccessful, the shell searches for a defined shell function named command_not_found_handle. If that function exists, it is invoked in a separate execution environment @@ -6596,10 +6840,10 @@ to the command are set to the arguments given, if any. If this execution fails because the file is not in executable format, and the file is not a directory, it is assumed to be -a shell script, a file -containing shell commands, and the shell creates a -new instance of itself -to execute it. +a shell script, a file containing shell commands, +and the shell creates a new instance of itself to execute it. +Bash tries to determine whether the file is a text file or a binary, +and will not execute files it determines to be binaries. This subshell reinitializes itself, so that the effect is as if a new shell had been invoked to handle the script, with the exception that the locations of @@ -6607,7 +6851,9 @@ commands remembered by the parent (see hash below under -SHELL BUILTIN COMMANDS) +SHELL BUILTIN COMMANDS + + are retained by the child.

@@ -6615,14 +6861,16 @@ If the program is a file beginning with #!, the remainder of the first line specifies an interpreter -for the program. The shell executes the +for the program. +The shell executes the specified interpreter on operating systems that do not -handle this executable format themselves. The arguments to the +handle this executable format themselves. +The arguments to the interpreter consist of a single optional argument following the interpreter name on the first line of the program, followed by the name of the program, followed by the command arguments, if any. -  + 

COMMAND EXECUTION ENVIRONMENT

The shell has an execution environment, which consists of the @@ -6694,9 +6942,12 @@ Command substitution, commands grouped with parentheses, and asynchronous commands are invoked in a subshell environment that is a duplicate of the shell environment, except that traps caught by the shell are reset to the values -that the shell inherited from its parent at invocation. Builtin -commands that are invoked as part of a pipeline are also executed in a -subshell environment. Changes made to the subshell environment +that the shell inherited from its parent at invocation. +Builtin commands that are invoked as part of a pipeline, +except possibly in the last element depending on the value of the +lastpipe shell option, +are also executed in a subshell environment. +Changes made to the subshell environment cannot affect the shell's execution environment.

@@ -6715,7 +6966,7 @@ If a command is followed by a & and job control is not active, the default standard input for the command is the empty file /dev/null. Otherwise, the invoked command inherits the file descriptors of the calling shell as modified by redirections. -  + 

ENVIRONMENT

When a program is invoked it is given an array of strings @@ -6734,23 +6985,31 @@ creates a parameter for each name found, automatically marking it for export -to child processes. Executed commands inherit the environment. +to child processes. +Executed commands inherit the environment. The -export +export, + +declare -x, and -declare -x +unset -commands allow parameters and functions to be added to and -deleted from the environment. If the value of a parameter -in the environment is modified, the new value becomes part -of the environment, replacing the old. The environment +commands modify the environment by +adding and deleting parameters and functions. +If the value of a parameter +in the environment is modified, the new value automatically +becomes part of the environment, replacing the old. +The environment inherited by any executed command consists of the shell's initial environment, whose values may be modified in the shell, less any pairs removed by the unset -command, plus any additions via the +or +export -n + +commands, plus any additions via the export and @@ -6759,16 +7018,19 @@ and commands.

-The environment for any -simple command - -or function may be augmented temporarily by prefixing it with -parameter assignments, as described above in -PARAMETERS. +If any parameter assignments, as described above in +PARAMETERS, +appear before a +simple command, + +the variable assignments are part of that command's environment +for as long as it executes. These assignment statements affect only the environment seen by that command. +If these assignments precede a call to a shell function, the variables +are local to the function and exported to that function's children.

If the @@ -6790,23 +7052,27 @@ When invokes an external command, the variable _ -is set to the full filename of the command and passed to that +is set to the full pathname of the command and passed to that command in its environment. -  + 

EXIT STATUS

The exit status of an executed command is the value returned by the -waitpid system call or equivalent function. Exit statuses -fall between 0 and 255, though, as explained below, the shell may -use values above 125 specially. Exit statuses from shell builtins and -compound commands are also limited to this range. Under certain -circumstances, the shell will use special values to indicate specific -failure modes. +waitpid system call or equivalent function. +Exit statuses fall between 0 and 255, though, as explained below, +the shell may use values above 125 specially. +Exit statuses from shell builtins and compound commands are also +limited to this range. +Under certain circumstances, the shell will use special values to +indicate specific failure modes.

For the shell's purposes, a command which exits with a -zero exit status has succeeded. An exit status of zero -indicates success. A non-zero exit status indicates failure. +zero exit status has succeeded. +So while an exit status of zero indicates success, a non-zero +exit status indicates failure. +

+ When a command terminates on a fatal signal N, bash uses the value of 128+N as the exit status.

@@ -6833,9 +7099,9 @@ parameter $?. Bash itself returns the exit status of the last command executed, unless a syntax error occurs, in which case it exits -with a non-zero value. See also the exit builtin -command below. -  +with a non-zero value. +See also the exit builtin command below. + 

SIGNALS

When bash is interactive, in the absence of any traps, it ignores @@ -6843,11 +7109,16 @@ When bash is interactive, in the absence of any traps, it ignores
(so that kill 0 does not kill an interactive shell), -and +and catches and handles SIGINT -is caught and handled (so that the wait builtin is interruptible). +(so that the wait builtin is interruptible). +When bash receives +SIGINT, + + +it breaks out of any executing loops. In all cases, bash ignores SIGQUIT. @@ -6868,8 +7139,14 @@ and

-Non-builtin commands run by bash have signal handlers -set to the values inherited by the shell from its parent. +The trap builtin modifies the shell's signal handling, as +described below. +

+ +Non-builtin commands bash executes have signal handlers +set to the values inherited by the shell from its parent, +unless trap sets them to be ignored, in which case the child +process will ignore them as well. When job control is not in effect, asynchronous commands ignore SIGINT @@ -6903,16 +7180,21 @@ Before exiting, an interactive shell resends the to all jobs, running or stopped. -Stopped jobs are sent +The shell sends SIGCONT -to ensure that they receive the -SIGHUP. +to stopped jobs to ensure that they receive the +SIGHUP + + +(see +JOB CONTROL +below for more information about running and stopped jobs). To prevent the shell from -sending the signal to a particular job, it should be removed from the +sending the signal to a particular job, remove it from the jobs table with the disown @@ -6920,8 +7202,7 @@ builtin (see SHELL BUILTIN COMMANDS -below) or marked -to not receive +below) or mark it not to receive SIGHUP @@ -6933,7 +7214,7 @@ using If the huponexit -shell option has been set with +shell option has been set using shopt, bash @@ -6948,10 +7229,11 @@ to all jobs when an interactive login shell exits. If bash is waiting for a command to complete and receives a signal for which a trap has been set, the trap will not be executed until the command completes. -When bash is waiting for an asynchronous command via the wait -builtin, the reception of a signal for which a trap has been set will -cause the wait builtin to return immediately with an exit status -greater than 128, immediately after which the trap is executed. +If bash is waiting for an asynchronous command via the wait +builtin, +and it receives a signal for which a trap has been set, +the wait builtin will return immediately with an exit status +greater than 128, immediately after which the shell executes the trap.

When job control is not enabled, and bash is waiting for a foreground @@ -6968,6 +7250,11 @@ same process group as the terminal, and ^C sends to all processes in that process group. +See +JOB CONTROL + + +below for more information about process groups.

When bash is running without job control enabled and receives @@ -7025,7 +7312,7 @@ as it does with any other trapped signal it receives while it is waiting for the foreground command to complete, for compatibility.

-  + 

JOB CONTROL

Job control @@ -7227,7 +7514,11 @@ Normally, waits until it is about to print a prompt before reporting changes in a job's status so as to not interrupt -any other output. If the +any other output, +though it will notify of changes in a job's status after a +foreground command in +a list completes, before executing the next command. +If the -b option to the @@ -7265,7 +7556,7 @@ When the shell is waiting for a job or process using the wait builtin, and job control is enabled, wait will return when the job changes state. The -f option causes wait to wait until the job or process terminates before returning. -  + 

PROMPTING

When executing interactively, @@ -7280,6 +7571,15 @@ when it is ready to read a command, and the secondary prompt
when it needs more input to complete a command. +

+ +Bash + +examines the value of the array variable PROMPT_COMMAND just before +printing each primary prompt. +If any elements in PROMPT_COMMAND are set and non-null, Bash +executes each value, in numeric order, +just as if it had been typed on the command line. Bash displays @@ -7287,6 +7587,8 @@ displays after it reads a command but before executing it. +

+ Bash displays @@ -7295,101 +7597,107 @@ displays as described above before tracing each command when the -x option is enabled. +

+ Bash -allows these prompt strings to be customized by inserting a number of +allows the prompt strings +PS0, PS1, PS2, and PS4, +to be customized by inserting a number of backslash-escaped special characters that are decoded as follows:

-
\a
-an ASCII bell character (07) +An ASCII bell character (07). +
\d
-the date in +The date in format (e.g.,
\D{format}
-the format is passed to +The format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific -time representation. The braces are required +time representation. +The braces are required.
\e
-an ASCII escape character (033) +An ASCII escape character (033).
\h
-the hostname up to the first +The hostname up to the first
\H
-the hostname +The hostname.
\j
-the number of jobs currently managed by the shell +The number of jobs currently managed by the shell.
\l
-the basename of the shell's terminal device name +The basename of the shell's terminal device name (e.g., +
\n
-newline +A newline.
\r
-carriage return +A carriage return.
\s
-the name of the shell, the basename of +The name of the shell: the basename of $0 -(the portion following the final slash) +(the portion following the final slash).
\t
-the current time in 24-hour HH:MM:SS format +The current time in 24-hour HH:MM:SS format.
\T
-the current time in 12-hour HH:MM:SS format +The current time in 12-hour HH:MM:SS format.
\@
-the current time in 12-hour am/pm format +The current time in 12-hour am/pm format.
\A
-the current time in 24-hour HH:MM format +The current time in 24-hour HH:MM format.
\u
-the username of the current user +The username of the current user.
\v
-the version of bash (e.g., 2.00) +The bash version (e.g., 2.00)
\V
-the release of bash, version + patch level (e.g., 2.00.0) +The bash release, version + patch level (e.g., 2.00.0)
\w
-the value of the PWD shell variable ($PWD), +The value of the PWD shell variable ($PWD), with $HOME @@ -7399,50 +7707,50 @@ abbreviated with a tilde PROMPT_DIRTRIM -variable) +variable).
\W
-the basename of $PWD, +The basename of $PWD, with $HOME -abbreviated with a tilde +abbreviated with a tilde.
\!
-the history number of this command +The history number of this command.
\#
-the command number of this command +The command number of this command.
\$
-if the effective UID is 0, a +If the effective UID is 0, a #, otherwise a -$ +$.
\nnn
-the character corresponding to the octal number nnn +The character corresponding to the octal number nnn.
\\
-a backslash +A backslash.
\[
-begin a sequence of non-printing characters, which could be used to -embed a terminal control sequence into the prompt +Begin a sequence of non-printing characters, which could be used to +embed a terminal control sequence into the prompt.
\]
-end a sequence of non-printing characters +End a sequence of non-printing characters.
@@ -7473,14 +7781,14 @@ below). This can have unwanted side effects if escaped portions of the string appear within command substitution or contain characters special to word expansion. -  + 

READLINE

This is the library that handles reading input when using an interactive shell, unless the --noediting -option is given at shell invocation. +option is supplied at shell invocation. Line editing is also used when using the -e option to the read builtin. By default, the line editing commands are similar to those of Emacs. @@ -7509,7 +7817,7 @@ options to the set builtin. -  + 

Readline Notation

In this section, the Emacs-style notation is used to denote @@ -7519,14 +7827,17 @@ Similarly, meta keys are denoted by M-key, so M-x means Meta-X. -(On keyboards without a -meta +

+ +On keyboards without a +Meta key, M-x means ESC x, i.e., press the Escape key then the x -key. This makes ESC the meta prefix. +key. +This makes ESC the meta prefix. The combination M-C-x means ESC-Control-x, or press the Escape key then hold the Control key while pressing the @@ -7535,6 +7846,21 @@ then hold the Control key while pressing the key.)

+On some keyboards, the Meta key modifier produces meta characters with +the eighth bit (0200) set (you can use the enable-meta-key variable +to control whether or not it does this, if the keyboard allows it). +On many others, the terminal or terminal emulator converts the metafied +key to a key sequence beginning with ESC as described in the +preceding paragraph. +

+ +If the Meta key produces a key sequence with the ESC meta prefix, +you can make M-key key bindings you specify (see +Readline Key Bindings + +below) do the same thing by setting the force-meta-prefix variable. +

+ Readline commands may be given numeric arguments, @@ -7554,7 +7880,7 @@ deleted is saved for possible future retrieval accumulated into one unit, which can be yanked all at once. Commands which do not kill text separate the chunks of text on the kill ring. -  + 

Readline Initialization

Readline is customized by putting commands in an initialization @@ -7636,7 +7962,7 @@ and In addition to command names, readline allows keys to be bound to a string that is inserted when the key is pressed (a macro). -  + 

Readline Key Bindings

The syntax for controlling key bindings in the @@ -7756,7 +8082,8 @@ control prefix
\M-
-meta prefix +adding the meta prefix or converting the following character to a meta +character, as described below under force-meta-prefix
\e
@@ -7858,7 +8185,7 @@ builtin command (see below). -  + 

Readline Variables

Readline has variables that can be used to further customize its @@ -8032,14 +8359,17 @@ treated as zero.
convert-meta (On)
-If set to On, readline will convert characters with the -eighth bit set to an ASCII key sequence -by stripping the eighth bit and prefixing an -escape character (in effect, using escape as the meta prefix). -The default is On, but readline will set it to Off if the -locale contains eight-bit characters. +If set to On, readline will convert characters it reads +with the eighth bit set to an ASCII key sequence +by stripping the eighth bit and prefixing it with an escape character +(converting the character to have the meta prefix). +The default is On, but readline will set it to Off +if the locale contains +characters whose encodings may include bytes with the eighth bit set. This variable is dependent on the LC_CTYPE locale category, and may change if the locale is changed. +This variable also affects key bindings; see the description of +force-meta-prefix below.
disable-completion (Off)
@@ -8108,8 +8438,32 @@ arrow keys.
When set to On, readline will try to enable any meta modifier -key the terminal claims to support when it is called. On many terminals, -the meta key is used to send eight-bit characters. +key the terminal claims to support when it is called. +On many terminals, the Meta key is used to send eight-bit characters; +this variable checks for the terminal capability that indicates the +terminal can enable and disable a mode that sets the eighth bit of a +character (0200) if the Meta key is held down when the character is +typed (a meta character). +
force-meta-prefix (Off) + +
+If set to On, readline modifies its behavior when binding key +sequences containing \M- or Meta- +(see Key Bindings above) by converting a key sequence of the form +\M-C or Meta-C to the two-character sequence +ESCC (adding the meta prefix). +If +force-meta-prefix + +is set to Off (the default), +readline uses the value of the +convert-meta + +variable to determine whether to perform this conversion: +if convert-meta is On, +readline performs the conversion described above; +if it is Off, Readline converts C to a meta character by +setting the eighth bit (0200).
expand-tilde (Off)
@@ -8145,12 +8499,14 @@ This setting is automatically enabled for terminals of height 1.
If set to On, readline will enable eight-bit input (that is, it will not strip the eighth bit from the characters it reads), -regardless of what the terminal claims it can support. The name +regardless of what the terminal claims it can support. +The name meta-flag is a synonym for this variable. -The default is Off, but readline will set it to On if the -locale contains eight-bit characters. +The default is Off, but readline will set it to On +if the locale contains +characters whose encodings may include bytes with the eighth bit set. This variable is dependent on the LC_CTYPE locale category, and may change if the locale is changed.
isearch-terminators ( @@ -8229,8 +8585,9 @@ the list. If set to On, readline will display characters with the eighth bit set directly rather than as a meta-prefixed escape sequence. -The default is Off, but readline will set it to On if the -locale contains eight-bit characters. +The default is Off, but readline will set it to On +if the locale contains +characters whose encodings may include bytes with the eighth bit set. This variable is dependent on the LC_CTYPE locale category, and may change if the locale is changed.
page-completions (On) @@ -8238,6 +8595,10 @@ may change if the locale is changed.
If set to On, readline uses an internal more-like pager to display a screenful of possible completions at a time. +
prefer-visible-bell + +
+See bell-style.
print-completions-horizontally (Off)
@@ -8323,7 +8684,7 @@ by stat(2) is appended to the filename when listing possible completions. -  + 

Readline Conditional Constructs

Readline implements a facility similar in spirit to the conditional @@ -8473,7 +8834,7 @@ would read /etc/inputrc: -  + 

Searching

Readline provides commands for searching through the command history @@ -8524,7 +8885,7 @@ new search string, readline uses any remembered search string. Non-incremental searches read the entire search string before starting to search for matching history lines. The search string may be typed by the user or be part of the contents of the current line. -  + 

Readline Command Names

The following is a list of the names of the commands and the default @@ -8534,7 +8895,7 @@ In the following descriptions, point refers to the current cursor position, and mark refers to a cursor position saved by the set-mark command. The text between the point and mark is referred to as the region. -  + 

Commands for Moving

@@ -8612,7 +8973,7 @@ screen. Refresh the current line. -  + 

Commands for Manipulating the History

@@ -8810,7 +9171,7 @@ commands. and emacs as the editor, in that order. -  + 

Commands for Changing Text

@@ -8905,7 +9266,7 @@ By default, this command is unbound, but may be bound to the Insert key on some keyboards. -  + 

Killing and Yanking

@@ -8998,7 +9359,7 @@ or -  + 

Numeric Arguments

@@ -9026,7 +9387,7 @@ first time makes the argument count four, a second time makes the argument count sixteen, and so on. -  + 

Completing

@@ -9155,7 +9516,7 @@ enclosed within braces so the list is available to the shell (see above). -  + 

Keyboard Macros

@@ -9181,7 +9542,7 @@ Print the last keyboard macro defined in a format suitable for the inputrc file. -  + 

Miscellaneous

@@ -9338,27 +9699,27 @@ Display version information about the current instance of -  + 

Programmable Completion

-When word completion is attempted for an argument to a command for +When a user attempts word completion for an argument to a command for which a completion specification (a compspec) has been defined using the complete builtin (see SHELL BUILTIN COMMANDS -below), the programmable completion facilities are invoked. +below), Readline invokes the programmable completion facilities.

First, the command name is identified. +If a compspec has been defined for that command, the +compspec is used to generate the list of possible completions for the word. If the command word is the empty string (completion attempted at the beginning of an empty line), any compspec defined with the -E option to complete is used. -If a compspec has been defined for that command, the -compspec is used to generate the list of possible completions for the word. If the command word is a full pathname, a compspec for the full pathname is searched for first. -If no compspec is found for the full pathname, an attempt is made to +If no compspec is found for the full pathname, completion attempts to find a compspec for the portion following the final slash. If those searches do not result in a compspec, any compspec defined with the -D option to complete is used as the default. @@ -9466,7 +9827,8 @@ the matches. Any function specified with -F is invoked first. The function may use any of the shell facilities, including the -compgen builtin described below, to generate the matches. +compgen and compopt +builtins described below, to generate the matches. It must put the possible completions in the COMPREPLY @@ -9479,6 +9841,7 @@ in an environment equivalent to command substitution. It should print a list of completions, one per line, to the standard output. Backslash may be used to escape a newline, if necessary. +These are added to the set of possible completions.

After all of the possible completions are generated, any filter @@ -9499,8 +9862,7 @@ of alphabetic characters. Finally, any prefix and suffix specified with the -P and -S options are added to each member of the completion list, and the result is -returned to the readline completion code as the list of possible -completions. +returned to readline as the list of possible completions.

If the previously-applied actions do not generate any matches, and the @@ -9515,11 +9877,12 @@ matches are added to the results of the other actions. By default, if a compspec is found, whatever it generates is returned to the completion code as the full set of possible completions. -The default bash completions are not attempted, and the readline -default of filename completion is disabled. +The default bash completions and the readline +default of filename completion are disabled. If the -o bashdefault option was supplied to complete when -the compspec was defined, the bash default completions are attempted -if the compspec generates no matches. +the compspec was defined, +if the compspec generates no matches, +the bash default completions are attempted. If the -o default option was supplied to complete when the compspec was defined, readline's default completion will be performed if the compspec (and, if attempted, the default bash completions) @@ -9533,18 +9896,19 @@ the value of the mark-directories readline variable, regardless of the setting of the mark-symlinked-directories readline variable.

-There is some support for dynamically modifying completions. This is -most useful when used in combination with a default completion specified -with complete -D. +There is some support for dynamically modifying completions. +This is most useful when used in combination with a default completion +specified with complete -D. It's possible for shell functions executed as completion handlers to indicate that completion should be retried by returning an -exit status of 124. If a shell function returns 124, and changes +exit status of 124. +If a shell function returns 124, and changes the compspec associated with the command on which completion is being attempted (supplied as the first argument when the function is executed), programmable completion restarts from the beginning, with an -attempt to find a new compspec for that command. This allows a set of -completions to be built dynamically as completion is attempted, rather than -being loaded all at once. +attempt to find a new compspec for that command. +This allows a set of completions to be built dynamically as completion +is attempted, rather than being loaded all at once.

For instance, assuming that there is a library of compspecs, each kept in a @@ -9577,7 +9941,7 @@ complete -D -F _completion_loader -  + 

HISTORY

When the @@ -9599,7 +9963,8 @@ The text of the last HISTSIZE -commands (default 500) is saved. The shell +commands (default 500) is saved. +The shell stores each command in the history list prior to parameter and variable expansion (see EXPANSION @@ -9616,23 +9981,24 @@ and

-On startup, the history is initialized from the file named by -the variable -HISTFILE - - -(default ~/.bash_history). -The file named by the value of +On startup, bash initializes the history list +by reading history entries from the +the file named by the HISTFILE -is truncated, if necessary, to contain no more than -the number of lines specified by the value of +variable (default ~/.bash_history). +That file is referred to as the history file. +The history file is truncated, if necessary, +to contain no more than the number of history entries +specified by the value of HISTFILESIZE. If HISTFILESIZE is unset, or set to null, a non-numeric value, or a numeric value less than zero, the history file is not truncated. +

+ When the history file is read, lines beginning with the history comment character followed immediately by a digit are interpreted as timestamps for the following history line. @@ -9641,11 +10007,15 @@ These timestamps are optionally displayed depending on the value of the variable. -When a shell with history enabled exits, the last +When present, history timestamps delimit history entries, making +multi-line entries possible. +

+ +When a shell with history enabled exits, bash copies the last $HISTSIZE -lines are copied from the history list to +entries from the history list to $HISTFILE. @@ -9660,7 +10030,7 @@ under SHELL BUILTIN COMMANDS -below), the lines are appended to the history file, +below), bash appends the entries to the history file, otherwise the history file is overwritten. If HISTFILE @@ -9677,12 +10047,18 @@ with the history comment character, so they may be preserved across shell sessions. This uses the history comment character to distinguish timestamps from other history lines. -After saving the history, the history file is truncated +As above, when using +HISTTIMEFORMAT, + + +the timestamps delimit multi-line history entries. +After saving the history, bash truncates the history file to contain no more than HISTFILESIZE -lines. If +lines. +If HISTFILESIZE @@ -9690,27 +10066,26 @@ is unset, or set to null, a non-numeric value, or a numeric value less than zero, the history file is not truncated.

-The builtin command +The fc -(see +builtin command (see SHELL BUILTIN COMMANDS -below) may be used to list or edit and re-execute a portion of -the history list. +below) will list or edit and re-execute a portion of the history list. The history -builtin may be used to display or modify the history list and +builtin can display or modify the history list and manipulate the history file. When using command-line editing, search commands are available in each editing mode that provide access to the history list.

-The shell allows control over which commands are saved on the history -list. The +The shell allows control over which commands are saved on the history list. +The HISTCONTROL @@ -9718,8 +10093,7 @@ and HISTIGNORE -variables are used to cause the shell to save only a subset of the -commands entered. +variables are used to save only a subset of the commands entered. The cmdhist @@ -9729,8 +10103,9 @@ semicolons where necessary to preserve syntactic correctness. The lithist -shell option causes the shell to save the command with embedded newlines -instead of semicolons. See the description of the +shell option modifies cmdhist by saving +the command with embedded newlines instead of semicolons. +See the description of the shopt builtin below under @@ -9738,16 +10113,18 @@ builtin below under for information on setting and unsetting shell options. -  + 

HISTORY EXPANSION

The shell supports a history expansion feature that is similar to the history expansion in csh. -This section describes what syntax features are available. This -feature is enabled by default for interactive shells, and can be -disabled using the +This section describes what syntax features are available. +

+ +History expansion is enabled by default for interactive shells, +and can be disabled using the +H option to the @@ -9757,8 +10134,10 @@ builtin command (see SHELL BUILTIN COMMANDS -below). Non-interactive shells do not perform history expansion -by default. +below). +Non-interactive shells do not perform history expansion by default, +but it can be enabled with +

History expansions introduce words from the history list into @@ -9769,16 +10148,19 @@ fix errors in previous commands quickly. History expansion is performed immediately after a complete line is read, before the shell breaks it into words, and is performed -on each line individually without taking quoting on previous lines into -account. +on each line individually. +The shell attempts to inform the history +expansion functions about quoting still in effect from previous lines. +

+ It takes place in two parts. -The first is to determine which line from the history list +The first is to determine which history list entry to use during substitution. -The second is to select portions of that line for inclusion into +The second is to select portions of that entry to include into the current one. -The line selected from the history is the event, -and the portions of that line that are acted upon are words. -The line is broken into words in the same fashion as when reading input, +The entry selected from the history is the event, +and the portions of that entry that are acted upon are words. +The entry is split into words in the same fashion as when reading input, so that several metacharacter-separated words surrounded by quotes are considered one word. The event designator selects the event, the optional @@ -9811,7 +10193,7 @@ There is a special abbreviation for substitution, active when the is the first character on the line. It selects the previous history entry, using an event designator equivalent to !!, -and substitutes one string for another in that line. +and substitutes one string for another in that entry. It is described below under Event Designators. This is the only history expansion that does not begin with the history expansion character. @@ -9820,14 +10202,15 @@ expansion character. Several shell options settable with the shopt -builtin may be used to tailor the behavior of history expansion. +builtin will modify history expansion behavior +(see the description of the +shopt + +builtin below).and If the histverify -shell option is enabled (see the description of the -shopt - -builtin below), and +shell option is enabled, and readline is being used, history substitutions are not immediately passed to @@ -9842,18 +10225,20 @@ If is being used, and the histreedit -shell option is enabled, a failed history substitution will be reloaded +shell option is enabled, a failed history substitution is reloaded into the readline editing buffer for correction. +

+ The -p option to the history -builtin command may be used to see what a history expansion will +builtin command shows what a history expansion will do before using it. The -s @@ -9861,7 +10246,7 @@ The option to the history -builtin may be used to add commands to the end of the history list +builtin will add commands to the end of the history list without actually executing them, so that they are available for subsequent recall.

@@ -9876,11 +10261,10 @@ above under The shell uses the history comment character to mark history timestamps when writing the history file. -  + 

Event Designators

-An event designator is a reference to a command line entry in the -history list. +An event designator is a reference to an entry in the history list. The event designator consists of the portion of the word beginning with the history expansion character and ending with the word designator if present, @@ -9898,24 +10282,25 @@ Start a history substitution, except when followed by a blank, newline, carriage return, = -or ( (when the extglob shell option is enabled using -the shopt builtin). +or, when the extglob shell option is enabled using +the shopt builtin, (.
!n
-Refer to command line +Refer to history list entry n.
!-n
-Refer to the current command minus +Refer to the current entry minus n.
!!
-Refer to the previous command. This is a synonym for +Refer to the previous command. +This is a synonym for
!string @@ -9935,12 +10320,14 @@ The trailing ? may be omitted if string is followed immediately by a newline. -If string is missing, the string from the most recent search is used; +If string is missing, this uses +the string from the most recent search; it is an error if there is no previous search string.
^string1^string2^
-Quick substitution. Repeat the previous command, replacing +Quick substitution. +Repeat the previous command, replacing string1 with @@ -9955,10 +10342,12 @@ Equivalent to The entire command line typed so far. -  + 

Word Designators

Word designators are used to select desired words from the event. +They are optional; if the word designator isn't supplied, the history +expansion uses the entire event. A : @@ -9985,8 +10374,8 @@ Words are inserted into the current line separated by single spaces.
0 (zero)
-The zeroth word. For the shell, this is the command -word. +The zeroth word. +For the shell, this is the command word.
n
@@ -9994,11 +10383,12 @@ The nth word.
^
-The first argument. That is, word 1. +The first argument: word 1.
$
-The last word. This is usually the last argument, but will expand to the +The last word. +This is usually the last argument, but will expand to the zeroth word if there is only one word in the line.
% @@ -10026,8 +10416,8 @@ This is a synonym for It is not an error to use * -if there is just one -word in the event; the empty string is returned in that case. +if there is just one word in the event; +it expands to the empty string in this case.
x*
@@ -10042,12 +10432,12 @@ If x is missing, it defaults to 0.

If a word designator is supplied without an event specification, the -previous command is used as the event. -  +previous command is used as the event, equivalent to !!. + 

Modifiers

-After the optional word designator, there may appear a sequence of -one or more of the following modifiers, each preceded by a +After the optional word designator, the expansion may include a +sequence of one or more of the following modifiers, each preceded by a These modify, or edit, the word or words selected from the history event.

@@ -10089,8 +10479,8 @@ but break into words at blanks and newlines. -The q and x modifiers are mutually exclusive; the last one -supplied is used. +The q and x modifiers are mutually exclusive; +expansion uses the last one supplied.

s/old/new/
@@ -10104,16 +10494,16 @@ in the event line. Any character may be used as the delimiter in place of /. The final delimiter is optional if it is the last character of the event line. -The delimiter may be quoted in +A single backslash will quote the delimiter in old and -new +new. -with a single backslash. If & appears in +If & appears in new, -it is replaced by +it is replaced with old. A single backslash will quote the &. @@ -10168,7 +10558,7 @@ or modifier once to each word in the event line. -  + 

SHELL BUILTIN COMMANDS

@@ -10215,6 +10605,7 @@ in the current shell environment and returns the exit status of the last command executed from filename. +
If filename does not contain a slash, . searchs for it. If the -p option is supplied, . treats path as a colon-separated list of directories in which to find filename; @@ -10227,7 +10618,7 @@ to find the directory containing filename does not need to be executable. When bash is not in posix mode, it searches -the current directory if no file is found in +the current directory if filename is not found in PATH, @@ -10242,34 +10633,38 @@ builtin command is turned off, . does not search PATH. +
If any arguments are supplied, they become the positional parameters when filename is executed. Otherwise the positional parameters are unchanged. +
If the -T option is enabled, . inherits any trap on DEBUG; if it is not, any DEBUG trap string is saved and restored around the call to ., and . unsets the DEBUG trap while it executes. If -T is not set, and the sourced file changes -the DEBUG trap, the new value is retained when . completes. -The return status is the status of the last command exited within -the script (0 if no commands are executed), and false if +the DEBUG trap, the new value persists after . completes. +The return status is the status of the last command executed from +filename (0 if no commands are executed), and non-zero if filename is not found or cannot be read.
alias [-p] [name[=value] ...]
-Alias with no arguments or with the +With no arguments or with the -p -option prints the list of aliases in the form +option,alias prints the list of aliases in the form alias name=value on standard output. -When arguments are supplied, an alias is defined for +When arguments are supplied, define an alias for each name whose value is given. A trailing space in value causes the next word to be -checked for alias substitution when the alias is expanded. +checked for alias substitution when the alias is expanded +during command parsing. For each name in the argument list for which no value -is supplied, the name and value of the alias is printed. -Alias returns true unless a name is given for which -no alias has been defined. +is supplied, print the name and value of the alias name. +alias returns true unless a name is given +(without a corresponding =value) +for which no alias has been defined.
bg [jobspec ...]
Resume each suspended job jobspec in the background, as if it had been started with @@ -10302,11 +10697,12 @@ Display current key and function bindings, bind a key sequence to a readline -function or macro, or set a +function or macro +or to a shell command, or set a readline variable. -Each non-option argument is a command as it would appear in a +Each non-option argument is a key binding or command as it would appear in a readline initialization file such as @@ -10343,9 +10739,9 @@ names are vi-move, vi-command, and vi-insert. -vi is equivalent to vi-command (vi-move is also -a synonym); emacs is -equivalent to emacs-standard. +vi is equivalent to vi-command +(vi-move is also a synonym); +emacs is equivalent to emacs-standard.
-l
@@ -10354,7 +10750,9 @@ List the names of all readline functions.
Display readline function names and bindings in such a way -that they can be re-read. +that they can be +used as an argument to a subsequent +bind command or in a readline initialization file. If arguments remain after option processing, bind treats them as readline command names and restricts output to those names.
-P @@ -10367,7 +10765,9 @@ them as readline command names and restricts output to those names.
Display readline key sequences bound to macros and the strings -they output in such a way that they can be re-read. +they output in such a way that they can be used +as an argument to a subsequent bind command +or in a readline initialization file.
-S
@@ -10377,7 +10777,9 @@ they output.
Display readline variable names and values in such a way that they -can be re-read. +can be +used as an argument to a subsequent +bind command or in a readline initialization file.
-V
@@ -10389,11 +10791,11 @@ Read key bindings from filename.
-q function
-Query about which keys invoke the named function. +Display key sequences that invoke the named readline function.
-u function
-Unbind all keys bound to the named function. +Unbind all key sequences bound to the named readline function.
-r keyseq
@@ -10411,7 +10813,7 @@ special backslash-escapes in shell-command before saving it. If the separator is a colon, any enclosing double quotes are optional, and readline does not expand the command string before saving it. Since the entire key binding expression must be a single argument, it -should be enclosed in quotes. +should be enclosed in single quotes. When shell-command is executed, the shell sets the READLINE_LINE @@ -10448,12 +10850,13 @@ those new values will be reflected in the editing state.
List all key sequences bound to shell commands and the associated commands -in a format that can be reused as input. +in a format that can be reused as +an argument to a subsequent @code{bind} command.

-The return value is 0 unless an unrecognized option is given or an +The return value is 0 unless an unrecognized option is supplied or an error occurred. @@ -10468,7 +10871,8 @@ Exit from within a or select -loop. If n is specified, break n levels. +loop. +If n is specified, break exits n enclosing loops. n must be >= 1. If @@ -10478,7 +10882,7 @@ is greater than the number of enclosing loops, all enclosing loops are exited. The return value is 0 unless n is not greater than or equal to 1.

builtin shell-builtin [arguments]
-Execute the specified shell builtin, passing it +Execute the specified shell builtin shell-builtin, passing it arguments, and return its exit status. @@ -10493,13 +10897,15 @@ is not a shell builtin command.
caller [expr]
Returns the context of any active subroutine call (a shell function or a script executed with the . or source builtins). +
Without expr, caller displays the line number and source filename of the current subroutine call. If a non-negative integer is supplied as expr, caller displays the line number, subroutine name, and source file corresponding -to that position in the current execution call stack. This extra -information may be used, for example, to print a stack trace. The -current frame is frame 0. +to that position in the current execution call stack. +This extra information may be used, for example, to print a stack trace. +The current frame is frame 0. +
The return value is 0 unless the shell is not executing a subroutine call or expr does not correspond to a valid position in the call stack. @@ -10509,14 +10915,12 @@ if dir is not supplied, the value of the HOME -shell variable is the default. +shell variable is used as dir. The variable CDPATH -defines the search path for the directory containing -dir: - +exists, cd uses it as a search path: the shell searches each directory name in CDPATH @@ -10526,7 +10930,8 @@ Alternative directory names in CDPATH -are separated by a colon (:). A null directory name in +are separated by a colon (:). +A null directory name in CDPATH @@ -10540,7 +10945,9 @@ then CDPATH -is not used. The +is not used. +
+The -P option causes cd to use the physical directory structure @@ -10551,7 +10958,9 @@ before processing instances of .. in dir (see also the option to the set -builtin command); the +builtin command). +
+The -L option forces symbolic links to be followed by resolving the link @@ -10559,6 +10968,7 @@ after processing instances of .. in dir. If .. appears in dir, it is processed by removing the immediately previous pathname component from dir, back to a slash or the beginning of dir. +
If the -e @@ -10566,10 +10976,12 @@ option is supplied with -P, and the current working directory cannot be successfully determined -after a successful directory change, cd will return an unsuccessful +after a successful directory change, cd will return a non-zero status. +
On systems that support it, the -@ option presents the extended attributes associated with a file as a directory. +
An argument of - @@ -10577,37 +10989,40 @@ is converted to $OLDPWD -before the directory change is attempted. -If a non-empty directory name from -CDPATH +before attempting the directory change. +
+If cd uses a non-empty directory name from +CDPATH, -is used, or if -- is the first argument, and the directory change is -successful, the absolute pathname of the new working directory is -written to the standard output. +or if - is the first argument, and the directory change is +successful, cd writes the absolute pathname of the new +working directory to the standard output. +
If the directory change is successful, cd sets the value of the PWD environment variable to the new directory name, and sets the OLDPWD environment variable to the value of the current working directory before the change. +
The return value is true if the directory was successfully changed; false otherwise.
command [-pVv] command [arg ...]
-Run +The command builtin runs command with args -suppressing the normal shell function lookup. +suppressing the normal shell function lookup for command. Only builtin commands or commands found in the PATH -are executed. If the +named command are executed. +If the -p -option is given, the search for +option is supplied, the search for command is performed using a default value for @@ -10615,40 +11030,43 @@ is performed using a default value for that is guaranteed to find all of the standard utilities. +
If either the -V or -v -option is supplied, a description of -command +option is supplied, command prints a description of +command. -is printed. The +The -v -option causes a single word indicating the command or filename +option displays a single word indicating the command or filename used to invoke -command +command; -to be displayed; the +the -V option produces a more verbose description. +
If the -V or -v -option is supplied, the exit status is 0 if +option is supplied, the exit status is zero if command -was found, and 1 if not. If neither option is supplied and -an error occurred or +was found, and non-zero if not. +If neither option is supplied and an error occurred or command -cannot be found, the exit status is 127. Otherwise, the exit status of the +cannot be found, the exit status is 127. +Otherwise, the exit status of the command builtin is the exit status of @@ -10672,9 +11090,11 @@ and -I, and write the matches to the standard output. +
If the -V option is supplied, compgen stores the generated completions into the indexed array variable varname instead of writing them to the standard output. +
When using the -F or -C options, the various shell variables set by the programmable completion facilities, while available, will not have useful values. @@ -10683,7 +11103,7 @@ The matches will be generated in the same way as if the programmable completion code had generated them directly from a completion specification with the same flags. If word is specified, only those completions matching word -will be displayed. +will be displayed or stored.
The return value is true unless an invalid option is supplied, or no matches were generated. @@ -10791,8 +11211,8 @@ the end of the line.
After any matches defined by the compspec are generated, -directory name completion is attempted and any -matches are added to the results of the other actions. +attempt directory name completion and add any +matches to the results of the other actions.
-A action
@@ -10915,27 +11335,28 @@ being completed, the second argument ($2) is the word being completed, and the third argument ($3) is the word preceding the word being completed on the current command line. -When it finishes, the possible completions are retrieved from the value +When function finishes, +the possible completions are retrieved from the value of the COMPREPLY array variable.
-G globpat
-The pathname expansion pattern globpat is expanded to generate +Expand the pathname expansion pattern globpat to generate the possible completions.
-P prefix
-prefix is added at the beginning of each possible completion +Add prefix to the beginning of each possible completion after all other options have been applied.
-S suffix
-suffix is appended to each possible completion +Append suffix to each possible completion after all other options have been applied.
-W wordlist
The wordlist is split using the characters in the IFS -special variable as delimiters, and each resultant word is expanded. +special variable as delimiters, and each resulting word is expanded. Shell quoting is honored within wordlist, in order to provide a mechanism for the words to contain shell metacharacters or characters @@ -10979,7 +11400,7 @@ an error occurs adding a completion specification. Modify completion options for each name according to the options, or for the currently-executing completion if no names are supplied. -If no options are given, display the completion options for each +If no options are supplied, display the completion options for each name or the current completion. The possible values of option are those valid for the complete builtin described above. @@ -10997,11 +11418,14 @@ apply to completion on the initial non-assignment word on the line, or after a command delimiter such as ; or |, which is usually command name completion.
+If multiple options are supplied, the -D option takes precedence +over -E, and both take precedence over -I. +
The return value is true unless an invalid option is supplied, an attempt is made to modify the options for a name for which no completion specification exists, or an output error occurs.
continue [n]
-Resume the next iteration of the enclosing +continue resumes the next iteration of the enclosing for, while, @@ -11015,10 +11439,11 @@ loop. If n -is specified, resume at the nth enclosing loop. +is specified, bash resumes the nth enclosing loop. n -must be >= 1. If +must be >= 1. +If n is greater than the number of enclosing loops, the shell resumes @@ -11032,7 +11457,8 @@ The return value is 0 unless n is not greater than or equal to 1.
typeset [-aAfFgiIlnrtux] [-p] [name[=value] ...]
Declare variables and/or give them attributes. -If no names are given then display the values of variables. +If no names are given then display the values of variables +or functions. The -p @@ -11044,15 +11470,17 @@ When is used with name arguments, additional options, other than -f and -F, are ignored. +
When -p -is supplied without name arguments, it will display the attributes -and values of all variables having the attributes specified by the -additional options. -If no other options are supplied with -p, declare will display -the attributes and values of all shell variables. The -f option -will restrict the display to shell functions. +is supplied without name arguments, +declare will display the attributes and values +of all variables having the attributes specified by the additional options. +If no other options are supplied with -p, declare will +display the attributes and values of all shell variables. +The -f option restricts the display to shell functions. +
The -F @@ -11060,18 +11488,21 @@ option inhibits the display of function definitions; only the function name and attributes are printed. If the extdebug shell option is enabled using shopt, the source file name and line number where each name -is defined are displayed as well. The +is defined are displayed as well. +The -F option implies -f. +
The -g option forces variables to be created or modified at the global scope, even when declare is executed in a shell function. -It is ignored in all other cases. +It is ignored when declare is not executed in a shell function. +
The -I @@ -11080,6 +11511,7 @@ option causes local variables to inherit the attributes and value of any existing variable with the same name at a surrounding scope. If there is no existing variable, the local variable is initially unset. +
The following options can be used to restrict output to variables with the specified attribute or to give variables attributes: @@ -11105,11 +11537,12 @@ above).
-f
-Use function names only. +Each name refers to a shell function.
-i
-The variable is treated as an integer; arithmetic evaluation (see +The variable is treated as an integer; +arithmetic evaluation (see ARITHMETIC EVALUATION @@ -11136,7 +11569,8 @@ The nameref attribute cannot be applied to array variables.
-r
-Make names readonly. These names cannot then be assigned values +Make names readonly. +These names cannot then be assigned values by subsequent assignment statements or unset.
-t @@ -11154,7 +11588,7 @@ The lower-case attribute is disabled.
-x
-Mark names for export to subsequent commands via the environment. +Mark each name for export to subsequent commands via the environment.

@@ -11163,10 +11597,12 @@ Using instead of -turns off the attribute instead, -with the exceptions that +a and +A +turns off the specified +attribute instead, with the exceptions that +a and +A may not be used to destroy array variables and +r will not remove the readonly attribute. +

+ When used in a function, declare @@ -11184,6 +11620,8 @@ the variable is set to value. When using -a or -A and the compound assignment syntax to create array variables, additional attributes do not take effect until subsequent assignments. +

+ The return value is 0 unless an invalid option is encountered, an attempt is made to define a function using @@ -11203,7 +11641,7 @@ or an attempt is made to display a non-existent function with -f.

dirs [-clpv] [+n] [-n]
-Without options, displays the list of currently remembered directories. +Without options, display the list of currently remembered directories. The default display is on a single line with directory names separated by spaces. Directories are added to the list with the @@ -11214,6 +11652,8 @@ command; the command removes entries from the list. The current directory is always the first directory in the stack. +
+Options, if supplied, have the following meanings:
@@ -11256,18 +11696,22 @@ invalid option is supplied or n indexes beyond the end of the directory stack.
-
disown [-ar] [-h] [jobspec ... | pid ... ]
+
disown [-ar] [-h] [id ...]
Without options, remove each -jobspec +id from the table of active jobs. +Each id may be a job specification jobspec +or a process ID +pid; if id is a pid, +disown uses the job containing pid as jobspec. If -jobspec +id is not present, and neither the -a nor the -r option -is supplied, the current job is used. -If the -h option is given, each -jobspec +is supplied, disown removes the current job. +If the -h option is supplied, the job corresponding to each +id is not removed from the table, but is marked so that SIGHUP @@ -11277,8 +11721,9 @@ is not sent to the job if the shell receives a SIGHUP. +
If no -jobspec +id is supplied, the -a @@ -11286,31 +11731,34 @@ is supplied, the option means to remove or mark all jobs; the -r -option without a -jobspec +option without an +id argument restricts operation to running jobs. -The return value is 0 unless a -jobspec +
+The return value is 0 unless an +id does not specify a valid job.
echo [-neE] [arg ...]
Output the args, separated by spaces, followed by a newline. The return status is 0 unless a write error occurs. -If -n is specified, the trailing newline is -suppressed. If the -e option is given, interpretation of -the following backslash-escaped characters is enabled. The +If -n is specified, the trailing newline is not printed. +
+If the -e option is given, echo interprets +the following backslash-escaped characters. +The -E -option disables the interpretation of these escape characters, +option disables interpretation of these escape characters, even on systems where they are interpreted by default. -The xpg_echo shell option may be used to -dynamically determine whether or not echo -interprets any options -and expands these escape characters by default. +The xpg_echo shell option determines +whether or not echo interprets any options +and expands these escape characters. echo does not interpret -- to mean the end of options. +
echo interprets the following escape sequences: @@ -11381,19 +11829,24 @@ the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value HHHHHHHH (one to eight hex digits) -
+ +

+ +echo writes any unrecognized backslash-escaped characters unchanged. +

enable [-a] [-dnps] [-f filename] [name ...]
Enable and disable builtin shell commands. -Disabling a builtin allows a disk command which has the same name +Disabling a builtin allows an executable file which has the same name as a shell builtin to be executed without specifying a full pathname, -even though the shell normally searches for builtins before disk commands. -If -n is used, each name -is disabled; otherwise, -names are enabled. For example, to use the +even though the shell normally searches for builtins before files. +
+If -n is supplied, each name is disabled; otherwise, +names are enabled. +For example, to use the test -binary found via the +binary found usin g PATH @@ -11407,6 +11860,19 @@ instead of the shell builtin version, run +
+If no name arguments are supplied, or if the +-p + +option is supplied, print a list of shell builtins. +With no other option arguments, the list consists of all enabled +shell builtins. +If -n is supplied, print only disabled builtins. +If -a is supplied, the list printed includes all builtins, with an +indication of whether or not each is enabled. +The -s option means to restrict the output to the POSIX +special builtins. +
The -f @@ -11417,33 +11883,23 @@ from shared object filename, on systems that support dynamic loading. +If filename does not contain a slash, Bash will use the value of the BASH_LOADABLES_PATH variable as a -colon-separated list of directories in which to search for filename, -if filename does not contain a slash. -The default is system-dependent, +colon-separated list of directories in which to search for filename. +The default for BASH_LOADABLES_PATH is system-dependent, and may include to force a search of the current directory. The -d -option will delete a builtin previously loaded with --f. - -If no name arguments are given, or if the --p - -option is supplied, a list of shell builtins is printed. -With no other option arguments, the list consists of all enabled -shell builtins. -If -n is supplied, only disabled builtins are printed. -If -a is supplied, the list printed includes all builtins, with an -indication of whether or not each is enabled. -If -s is supplied, the output is restricted to the POSIX -special builtins. +option will delete a builtin previously loaded with -f. +If -s is used with -f, the new builtin becomes a POSIX +special builtin. +
If no options are supplied and a name is not a shell builtin, -enable will attempt to load name from a shared object named -name, as if the command were +enable will attempt to load name from a shared +object named name, as if the command were ``enable -f name name''. @@ -11453,17 +11909,17 @@ If no options are supplied and a name is not a shell builtin, +
The return value is 0 unless a name is not a shell builtin or there is an error loading a new builtin from a shared object.
eval [arg ...]
-The args are read and concatenated together into a single -command. This command is then read and executed by the shell, and -its exit status is returned as the value of -eval. - +Concatenate the args together into a single command, separating +them with spaces. +Bash then reads and execute this command, and returns its exit status +as the return status of eval. If there are no args, @@ -11475,8 +11931,9 @@ returns 0. If command -is specified, it replaces the shell. -No new process is created. The +is specified, it replaces the shell without creating a new process. +command cannot be a shell builtin or function. +The arguments become the arguments to command. @@ -11496,13 +11953,15 @@ does. The option causes command -to be executed with an empty environment. If +to be executed with an empty environment. +If -a is supplied, the shell passes name as the zeroth argument to the executed command. +
If command @@ -11510,10 +11969,11 @@ cannot be executed for some reason, a non-interactive shell exits, unless the execfail -shell option -is enabled. In that case, it returns failure. -An interactive shell returns failure if the file cannot be executed. +shell option is enabled. +In that case, it returns a non-zero status. +An interactive shell returns a non-zero status if the file cannot be executed. A subshell exits unconditionally if exec fails. +
If command @@ -11521,18 +11981,17 @@ is not specified, any redirections take effect in the current shell, and the return status is 0. If there is a redirection error, the return status is 1.
exit [n]
-Cause the shell to exit -with a status of n. If +Cause the shell to exit with a status of n. +If n -is omitted, the exit status -is that of the last command executed. -A trap on +is omitted, the exit status is that of the last command executed. +Any trap on EXIT is executed before the shell terminates. -
export [-fn] [name[=word]] ...
+
export [-fn] [name[=value]] ...
export -p @@ -11542,28 +12001,32 @@ The supplied names are marked for automatic export to the environment of -subsequently executed commands. If the +subsequently executed commands. +If the -f option is given, the names refer to functions. +
+The +-n + +option unexports, or removes the export attribute, from each name. If no names are given, or if the -p -option is supplied, a list -of names of all exported variables is printed. -The --n - -option causes the export property to be removed from each -name. -If a variable name is followed by =word, the value of -the variable is set to word. +option is supplied, export prints a list of names of all exported +variables on the standard output. +
+export allows the value of a variable to be set when it is exported +or unexported by following the variable name with =value. +This sets the value of the variable to value while modifying the +export attribute. export returns an exit status of 0 unless an invalid option is @@ -11576,7 +12039,7 @@ is supplied with a that is not a function.
false
-Does nothing, returns a non-zero status. +Does nothing; returns a non-zero status.
fc [-e ename] [-lnr] [first] [last]
fc -s [pat=rep] [cmd]
@@ -11597,6 +12060,7 @@ may be specified as a string (to locate the last command beginning with that string) or as a number (an index into the history list, where a negative number is used as an offset from the current command number). +
When listing, a first or last of 0 is equivalent to -1 and -0 is equivalent to the current command (usually the fc command); otherwise 0 is equivalent to -1 @@ -11625,32 +12089,33 @@ If is not specified, it is set to the previous command for editing and -16 for listing.
+If the +-l + +option is supplied, the commands are listed on the standard output. The -n option suppresses -the command numbers when listing. The +the command numbers when listing. +The -r option reverses the order of -the commands. If the --l - -option is given, -the commands are listed on -standard output. Otherwise, the editor given by +the commands. +
+Otherwise, fc invokes the editor named by ename -is invoked -on a file containing those commands. If +on a file containing those commands. +If ename -is not given, the -value of the +is not supplied, fc uses the value of the FCEDIT -variable is used, and +variable, and the value of EDITOR @@ -11659,17 +12124,19 @@ if FCEDIT -is not set. If neither variable is set, +is not set. +If neither variable is set, fc uses -vi +vi. -is used. When editing is complete, the edited commands are -echoed and executed. +When editing is complete, fc reads the file containing +the edited commands and echoes and executes them.
-In the second form, command is re-executed after each instance -of pat is replaced by rep. +In the second form, fc re-executes command +after replacing each instance of pat with rep. Command is interpreted the same as first above. -A useful alias to use with this is +
+A useful alias to use with fc is so that typing @@ -11679,7 +12146,7 @@ and typing re-executes the last command.
-If the first form is used, the return value is 0 unless an invalid +If the first form is used, the return value is zero unless an invalid option is encountered or first @@ -11687,19 +12154,17 @@ or last specify history lines out of range. -If the --e - -option is supplied, the return value is the value of the last -command executed or failure if an error occurs with the temporary -file of commands. If the second form is used, the return status -is that of the command re-executed, unless +When editing and re-executing a file of commands, +the return value is the value of the last command executed +or failure if an error occurs with the temporary file. +If the second form is used, the return status +is that of the re-executed command, unless cmd -does not specify a valid history line, in which case +does not specify a valid history entry, in which case fc -returns failure. +returns a non-zero status.
fg [jobspec]
Resume jobspec @@ -11708,7 +12173,7 @@ in the foreground, and make it the current job. If jobspec -is not present, the shell's notion of the current job is used. +is not present, use the shell's notion of the current job. The return value is that of the command placed into the foreground, or failure if run when job control is disabled or, when run with job control enabled, if @@ -11721,7 +12186,8 @@ specifies a job that was started without job control.
getopts optstring name [arg ...]
getopts -is used by shell procedures to parse positional parameters. +is used by shell scripts and functions to parse positional parameters +and obtain options and their arguments. optstring contains the option characters to be recognized; if a character @@ -11729,6 +12195,7 @@ is followed by a colon, the option is expected to have an argument, which should be separated from it by white space. The colon and question mark characters may not be used as option characters. +
Each time it is invoked, getopts @@ -11748,13 +12215,15 @@ variable is initialized to 1 each time the shell or a shell script -is invoked. When an option requires an argument, +is invoked. +When an option requires an argument, getopts places that argument into the variable OPTARG. +
The shell does not reset OPTIND @@ -11763,10 +12232,9 @@ automatically; it must be manually reset between multiple calls to getopts -within the same shell invocation if a new set of parameters -is to be used. +within the same shell invocation to use a new set of parameters.
-When the end of options is encountered, getopts exits with a +When it reaches the end of options, getopts exits with a return value greater than zero. OPTIND @@ -11787,15 +12255,16 @@ parses those instead.
getopts -can report errors in two ways. If the first character of +can report errors in two ways. +If the first character of optstring -is a colon, +is a colon, getopts uses silent -error reporting is used. In normal operation, diagnostic messages -are printed when invalid options or missing option arguments are -encountered. +error reporting. +In normal operation, getopts prints diagnostic messages +when it encounters invalid options or missing option arguments. If the variable OPTERR @@ -11851,22 +12320,23 @@ returns true if an option, specified or unspecified, is found. It returns false if the end of options is encountered or an error occurs.
hash [-lr] [-p filename] [-dt] [name]
-Each time hash is invoked, +Each time hash is invoked, it remembers the full pathname of the command name -is determined by searching +as determined by searching the directories in -$PATH +$PATH. -and remembered. Any previously-remembered pathname is discarded. +Any previously-remembered pathname associated with name is discarded. If the -p option is supplied, hash uses filename -as the full filename of the command. +as the full pathname of the command. +
The -r @@ -11877,29 +12347,35 @@ The -d option causes the shell to forget the remembered location of each name. +
If the -t -option is supplied, the full pathname to which each name corresponds -is printed. If multiple name arguments are supplied with -t, -the name is printed before the hashed full pathname. +option is supplied, hash prints the full pathname corresponding to +each name. +If multiple name arguments are supplied with -t, +hash prints the name before the corresponding hashed +full pathname. The -l -option causes output to be displayed in a format that may be reused as input. +option displays output in a format that may be reused as input. +
If no arguments are given, or if only -l is supplied, -information about remembered commands is printed. +hash prints information about remembered commands. The -t, -d, and -p options (the options that act on the name arguments) are mutually exclusive. Only one will be active. If more than one is supplied, -t has higher priority than --p, and both are higher priority than -d. -The return status is true unless a +-p, and both have higher priority than -d. +
+The return status is zero unless a name is not found or an invalid option is supplied.
help [-dms] [pattern]
-Display helpful information about builtin commands. If +Display helpful information about builtin commands. +If pattern is specified, @@ -11908,8 +12384,8 @@ is specified, gives detailed help on all commands matching pattern; -otherwise help for all the builtins and shell control structures -is printed. +otherwise it displays a list of +all the builtins and shell compound commands.
@@ -11941,18 +12417,18 @@ The return status is 0 unless no command matches
history -p arg [arg ...]
history -s arg [arg ...]
-With no options, display the command -history list with line numbers. Lines listed -with a +With no options, display the command history list with numbers. +Entries prefixed with a * -have been modified. An argument of +have been modified. +An argument of n lists only the last n -lines. +entries. If the shell variable HISTTIMEFORMAT @@ -11962,20 +12438,28 @@ it is used as a format string for strftime(3) to display the time stamp associated with each displayed history entry. -No intervening blank is printed between the formatted time stamp -and the history line. -If filename is supplied, it is used as the -name of the history file; if not, the value of -HISTFILE +If +history + +uses +HISTTIMEFORMAT, + + +it does not print an intervening space between the formatted time stamp +and the history entry. +
+If filename is supplied, history uses it as the +name of the history file; if not, it uses the value of +HISTFILE. -is used. If filename is not supplied and HISTFILE is unset or null, the -a, -n, -r, and -w options have no effect. +
Options, if supplied, have the following meanings:
@@ -11984,6 +12468,7 @@ Options, if supplied, have the following meanings:
Clear the history list by deleting all the entries. +This can be used with the other options to replace the history list.
-d offset
Delete the history entry at position offset. If offset is negative, it is interpreted as relative to one greater @@ -12007,14 +12492,13 @@ These are history lines entered since the beginning of the current
Read the history lines not already read from the history -file into the current history list. These are lines -appended to the history file since the beginning of the +file into the current history list. +These are lines appended to the history file since the beginning of the current bash session.
-r
-Read the contents of the history file -and append them to the current history list. +Read the history file and append its contents to the current history list.
-w
@@ -12024,8 +12508,8 @@ history file's contents.
Perform history substitution on the following args and display -the result on the standard output. -Does not store the results in the history list. +the result on the standard output, +without storing the results in the history list. Each arg must be quoted to disable normal history expansion.
-s @@ -12033,45 +12517,43 @@ Each arg must be quoted to disable normal history expansion. Store the args -in the history list as a single entry. The last command in the -history list is removed before the -args +in the history list as a single entry. +The last command in the +history list is removed before adding the +args. -are added. -
-

+

+
If the HISTTIMEFORMAT -variable is set, the time stamp information -associated with each history entry is written to the history file, +variable is set, history writes the time stamp information +associated with each history entry to the history file, marked with the history comment character. When the history file is read, lines beginning with the history comment character followed immediately by a digit are interpreted as timestamps for the following history entry. +
The return value is 0 unless an invalid option is encountered, an error occurs while reading or writing the history file, an invalid offset or range is supplied as an argument to -d, or the history expansion supplied as an argument to -p fails. - -
jobs [-lnprs] [ jobspec ... ]
jobs -x command [ args ... ]
-The first form lists the active jobs. The options have the following -meanings: +The first form lists the active jobs. +The options have the following meanings:
-l
-List process IDs -in addition to the normal information. +List process IDs in addition to the normal information.
-n
@@ -12080,8 +12562,7 @@ the user was last notified of their status.
-p
-List only the process ID of the job's process group -leader. +List only the process ID of the job's process group leader.
-r
@@ -12091,20 +12572,19 @@ Display only running jobs.
Display only stopped jobs. -
-

+

+
If jobspec -is given, output is restricted to information about that job. +is supplied, jobs restricts output to information about that job. The return status is 0 unless an invalid option is encountered or an invalid jobspec is supplied. -

- +

If the -x @@ -12121,19 +12601,17 @@ or args with the corresponding process group ID, and executes -command +command, passing it args, returning its exit status. - -
kill [-s sigspec | -n signum | -sigspec] [pid | jobspec] ...
kill -l|-L [sigspec | exit_status]
-Send the signal named by +Send the signal specified by sigspec or @@ -12162,11 +12640,14 @@ is a signal number. If sigspec -is not present, then -SIGTERM +is not supplied, then +kill + +sends +SIGTERM. -is assumed. +
An argument of -l @@ -12174,8 +12655,11 @@ lists the signal names. If any arguments are supplied when -l -is given, the names of the signals corresponding to the arguments are -listed, and the return status is 0. +is given, +kill + +lists the names of the signals corresponding to the arguments, +and the return status is 0. The exit_status argument to -l @@ -12185,6 +12669,7 @@ The -L option is equivalent to -l. +
kill returns true if at least one signal was successfully sent, or false @@ -12193,7 +12678,7 @@ if an error occurs or an invalid option is encountered. Each arg -is an arithmetic expression to be evaluated (see +is evaluated as an arithmetic expression (see ARITHMETIC EVALUATION @@ -12205,12 +12690,15 @@ If the last evaluates to 0, let -returns 1; 0 is returned otherwise. +returns 1; otherwise +let + +returns 0.
local [option] [name[=value] ... | - ]
-For each argument, a local variable named +For each argument, create a local variable named name -is created, and assigned +and assign it value. The option can be any of the options accepted by declare. @@ -12221,22 +12709,25 @@ is used within a function, it causes the variable name to have a visible scope restricted to that function and its children. -If name is -, the set of shell options is made local to the function -in which local is invoked: shell options changed using the -set builtin inside the function -after the call to local -are restored to their original values -when the function returns. -The restore is effected as if a series of set commands were executed -to restore the values that were in place before the function. -With no operands, +It is an error to use local -writes a list of local variables to the standard output. It is -an error to use +when not within a function. +
+If name is -, it makes the set of shell options +local to the function in which local is invoked: +any shell options changed using the set builtin inside +the function after the call to local are restored to their +original values when the function returns. +The restore is performed as if a series of set commands were +executed to restore the values that were in place before the function. +
+With no operands, local -when not within a function. The return status is 0 unless +writes a list of local variables to the standard output. +
+The return status is 0 unless local is used outside a function, an invalid @@ -12244,24 +12735,26 @@ is used outside a function, an invalid is supplied, or name is a readonly variable. -
logout +
logout [n]
-Exit a login shell. +Exit a login shell, +returning a status of n to the shell's parent.
mapfile [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]
readarray [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]
-Read lines from the standard input into the indexed array variable -array, - +Read lines from the standard input, or from file descriptor fd if the -u -option is supplied. +option is supplied, +into the indexed array variable +array. + The variable MAPFILE @@ -12274,7 +12767,7 @@ Options, if supplied, have the following meanings:
-d
-The first character of delim is used to terminate each input line, +Use the first character of delim to terminate each input line, rather than newline. If delim is the empty string, mapfile will terminate a line when it reads a NUL character. @@ -12284,7 +12777,8 @@ when it reads a NUL character. Copy at most count -lines. If count is 0, all lines are copied. +lines. +If count is 0, copy all lines.
-O
@@ -12313,7 +12807,8 @@ Read lines from file descriptor fd instead of the standard input. Evaluate callback -each time quantum lines are read. The -c option specifies +each time quantum lines are read. +The -c option specifies quantum.
-c @@ -12323,9 +12818,9 @@ Specify the number of lines read between each call to callback. - -

+ +

If -C @@ -12338,24 +12833,20 @@ array element to be assigned and the line to be assigned to that element as additional arguments. callback is evaluated after the line is read but before the array element is assigned. -

- +

If not supplied with an explicit origin, mapfile will clear array before assigning to it. -

- -mapfile returns successfully unless an invalid option or option +

+mapfile returns zero unless an invalid option or option argument is supplied, array is invalid or unassignable, or if array is not an indexed array. - -
popd [-n] [+n] [-n]
-Removes entries from the directory stack. +Remove entries from the directory stack. The elements are numbered from 0 starting at the first directory -listed by dirs. -With no arguments, popd -removes the top directory from the stack, and -changes to the new top directory. +listed by dirs, so popd is equivalent to + +With no arguments, popd removes the top directory from the stack, +and changes to the new top directory. Arguments, if supplied, have the following meanings:
@@ -12363,10 +12854,10 @@ Arguments, if supplied, have the following meanings:
-n
-Suppresses the normal change of directory when removing directories -from the stack, so that only the stack is manipulated. +Suppress the normal change of directory when removing directories +from the stack, only manipulate the stack.
+n
-Removes the nth entry counting from the left of the list +Remove the nth entry counting from the left of the list shown by dirs, @@ -12377,7 +12868,7 @@ removes the first directory, the second.
-n
-Removes the nth entry counting from the right of the list +Remove the nth entry counting from the right of the list shown by dirs, @@ -12387,38 +12878,34 @@ removes the last directory, the next to last. -
-

+ +

If the top element of the directory stack is modified, and the -n option was not supplied, popd uses the cd builtin to change to the directory at the top of the stack. If the cd fails, popd returns a non-zero value. -

- +

Otherwise, popd -returns false if an invalid option is encountered, the directory stack -is empty, or a non-existent directory stack entry is specified. -

- +returns false if an invalid option is supplied, the directory stack +is empty, or n specifies a non-existent directory stack entry. +

If the popd command is successful, -bash runs +bash runs dirs to show the final contents of the directory stack, and the return status is 0. - -
printf [-v var] format [arguments]
Write the formatted arguments to the standard output under the control of the format. -The -v option causes the output to be assigned to the variable -var rather than being printed to the standard output. +The -v option assigns the output to the variable +var rather than printing it to the standard output.
The format is a character string which contains three types of objects: plain characters, which are simply copied to standard output, character @@ -12429,7 +12916,7 @@ In addition to the standard printf(3) format characters -csndiouxXeEfFgGaA, +cCsSndiouxXeEfFgGaA, printf interprets the following additional format specifiers:
@@ -12465,38 +12952,36 @@ causes printf to output the date-time string resulting from using The corresponding argument is an integer representing the number of seconds since the epoch. -Two special argument values may be used: -1 represents the current -time, and -2 represents the time the shell was invoked. -If no argument is specified, conversion behaves as if -1 had been given. +This format specifier recognizes two special argument values: +-1 represents the current time, +and -2 represents the time the shell was invoked. +If no argument is specified, conversion behaves as if -1 had been supplied. This is an exception to the usual printf behavior. -
-

+ +

The %b, %q, and %T format specifiers all use the field width and precision arguments from the format specification and write that many bytes from (or use that wide a field for) the expanded argument, which usually contains more characters than the original. -

- +

The %n format specifier accepts a corresponding argument that is treated as a shell variable name. -

- +

The %s and %c format specifiers accept an l (long) modifier, which forces them to convert the argument string to a wide-character string and apply any supplied field width and precision in terms of characters, not bytes. +The %S and %C format specifiers are equivalent to %ls and %lc, respectively. -

- +

Arguments to non-string format specifiers are treated as C constants, except that a leading plus or minus sign is allowed, and if the leading character is a single or double quote, the value is the numeric value of the following character, using the current locale. -

- +

The format is reused as necessary to consume all of the arguments. If the format requires more arguments than are supplied, the extra format specifications behave as if a zero value or null string, as @@ -12504,13 +12989,11 @@ appropriate, had been supplied. The return value is zero on success, non-zero if an invalid option is supplied or a write or assignment error occurs. - -
pushd [-n] [+n] [-n]
pushd [-n] [dir]
-Adds a directory to the top of the directory stack, or rotates +Add a directory to the top of the directory stack, or rotate the stack, making the new top of the stack the current working directory. With no arguments, pushd exchanges the top two elements of @@ -12522,10 +13005,10 @@ Arguments, if supplied, have the following meanings:
-n
-Suppresses the normal change of directory when rotating or -adding directories to the stack, so that only the stack is manipulated. +Suppress the normal change of directory when rotating or +adding directories to the stack, only manipulate the stack.
+n
-Rotates the stack so that the nth directory +Rotate the stack so that the nth directory (counting from the left of the list shown by dirs, @@ -12543,38 +13026,34 @@ starting with zero) is at the top. Adds dir -to the directory stack at the top +to the directory stack at the top. - -

+ +

After the stack has been modified, if the -n option was not supplied, pushd uses the cd builtin to change to the directory at the top of the stack. If the cd fails, pushd returns a non-zero value. -

- +

Otherwise, if no arguments are supplied, pushd -returns 0 unless the directory stack is empty. +returns zero unless the directory stack is empty. When rotating the directory stack, pushd -returns 0 unless the directory stack is empty or -a non-existent directory stack element is specified. -

- +returns zero unless the directory stack is empty or +n specifies a non-existent directory stack element. +

If the pushd command is successful, -bash runs +bash runs dirs to show the final contents of the directory stack. - -
pwd [-LP]
Print the absolute pathname of the current working directory. The pathname printed contains no symbolic links if the @@ -12595,14 +13074,13 @@ The return status is 0 unless an error occurs while reading the name of the current directory or an invalid option is supplied.
read [-Eers] [-a aname] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]
-One line is read from the standard input, or from the file descriptor +Read one line from the standard input, or from the file descriptor fd supplied as an argument to the -u option, -split into words as described +split it into words as described above under Word Splitting, -and the first word -is assigned to the first +and assign the first word to the first name, the second word to the second @@ -12615,17 +13093,19 @@ intervening delimiters are assigned to the last If there are fewer words read from the input stream than names, the remaining names are assigned empty values. -The characters in +The characters in the value of the IFS +variable are used to split the line into words using the same rules the shell uses for expansion (described above under Word Splitting). -The backslash character (\) may be used to remove any special -meaning for the next character read and for line continuation. +The backslash character (\) removes any special +meaning for the next character read and is used for line continuation. +
Options, if supplied, have the following meanings:
@@ -12633,8 +13113,7 @@ Options, if supplied, have the following meanings:
-a aname
-The words are assigned to sequential indices -of the array variable +The words are assigned to sequential indices of the array variable aname, starting at 0. @@ -12645,15 +13124,14 @@ Other name arguments are ignored.
-d delim
-The first character of delim is used to terminate the input line, +The first character of delim terminates the input line, rather than newline. If delim is the empty string, read will terminate a line when it reads a NUL character.
-e
-If the standard input -is coming from a terminal, +If the standard input is coming from a terminal, read uses readline @@ -12669,8 +13147,7 @@ active) editing settings, but uses readline's default filename completion.
-E
-If the standard input -is coming from a terminal, +If the standard input is coming from a terminal, read uses readline @@ -12690,23 +13167,25 @@ programmable completion. If readline -is being used to read the line, text is placed into the editing -buffer before editing begins. +is being used to read the line, read places text into +the editing buffer before editing begins.
-n nchars
read returns after reading nchars characters rather than -waiting for a complete line of input, but honors a delimiter if fewer -than nchars characters are read before the delimiter. +waiting for a complete line of input, +unless it encounters EOF or read times out, +but honors a delimiter if it reads fewer +than nchars characters before the delimiter.
-N nchars
read returns after reading exactly nchars characters rather -than waiting for a complete line of input, unless EOF is encountered or -read times out. -Delimiter characters encountered in the input are +than waiting for a complete line of input, +unless it encounters EOF or read times out. +Any delimiter characters in the input are not treated specially and do not cause read to return until -nchars characters are read. +it has read nchars characters. The result is not split on the characters in IFS; the intent is that the variable is assigned exactly the characters read (with the exception of backslash; see the -r option below). @@ -12714,8 +13193,8 @@ that the variable is assigned exactly the characters read
Display prompt on standard error, without a -trailing newline, before attempting to read any input. The prompt -is displayed only if input is coming from a terminal. +trailing newline, before attempting to read any input, but +only if input is coming from a terminal.
-r
@@ -12726,67 +13205,61 @@ continuation.
-s
-Silent mode. If input is coming from a terminal, characters are -not echoed. +Silent mode. +If input is coming from a terminal, characters are not echoed.
-t timeout
-Cause read to time out and return failure if a complete line of -input (or a specified number of characters) -is not read within timeout seconds. +Cause read to time out and return failure if it does not read +a complete line of input (or a specified number of characters) +within timeout seconds. timeout may be a decimal number with a fractional portion following the decimal point. This option is only effective if read is reading input from a terminal, pipe, or other special file; it has no effect when reading from regular files. -If read times out, read saves any partial input read into -the specified variable name. +If read times out, it saves any partial input read into +the specified variable name, and the exit status is greater than 128. If timeout is 0, read returns immediately, without trying to read any data. -The exit status is 0 if input is available on the specified file descriptor, -or the read will return EOF, -non-zero otherwise. -The exit status is greater than 128 if the timeout is exceeded. +In this case, the exit status is 0 if input is available on the specified +file descriptor, or the read will return EOF, non-zero otherwise.
-u fd
-Read input from file descriptor fd. +Read input from file descriptor fd instead of the standard input. -
-

+ +

Other than the case where delim is the empty string, read ignores any NUL characters in the input. -

- +

If no names -are supplied, the line read, +are supplied, read assigns the line read, without the ending delimiter but otherwise unmodified, -is assigned to the variable +to the variable REPLY. +
The exit status is zero, unless end-of-file is encountered, read times out (in which case the status is greater than 128), a variable assignment error (such as assigning to a readonly variable) occurs, or an invalid file descriptor is supplied as the argument to -u. - -
readonly [-aAf] [-p] [name[=word] ...]
The given names are marked readonly; the values of these names -may not be changed by subsequent assignment. +may not be changed by subsequent assignment or unset. If the -f -option is supplied, the functions corresponding to the -names are so -marked. +option is supplied, each name refers to a shell function. The -a @@ -12801,19 +13274,23 @@ takes precedence. If no name -arguments are given, or if the +arguments are supplied, or if the -p -option is supplied, a list of all readonly names is printed. +option is supplied, print a list of all readonly names. The other options may be used to restrict the output to a subset of the set of readonly names. The -p -option causes output to be displayed in a format that -may be reused as input. -If a variable name is followed by =word, the value of -the variable is set to word. +option displays output in a format that may be reused as input. +
+readonly allows the value of a variable to be set at the same time +the readonly attribute is changed by following the variable name with +=value. +This sets the value of the variable is to value while modifying +the readonly attribute. +
The return status is 0 unless an invalid option is encountered, one of the names @@ -12826,7 +13303,8 @@ is supplied with a that is not a function.
return [n]
-Causes a function to stop executing and return the value specified by +Stop executing a shell function or sourced file and return the value +specified by n to its caller. @@ -12834,17 +13312,17 @@ If n is omitted, the return status is that of the last command -executed in the function body. +executed. If return is executed by a trap handler, the last command used to determine the status is the last command executed before the trap handler. If return is executed during a DEBUG trap, the last command used to determine the status is the last command executed by the trap handler before return was invoked. -If +
+When return -is used outside a function, -but during execution of a script by the +is used to terminate execution of a script being executed by the . (source) command, it causes the shell to stop executing @@ -12855,14 +13333,15 @@ or the exit status of the last command executed within the script as the exit status of the script. If n is supplied, the return value is its least significant 8 bits. +
+Any command associated with the RETURN trap is executed +before execution resumes after the function or script. +
The return status is non-zero if return -is supplied a non-numeric argument, or -is used outside a +is supplied a non-numeric argument, or is used outside a function and not during execution of a script by . or source. -Any command associated with the RETURN trap is executed -before execution resumes after the function or script.
set [-abefhkmnptuvxBCEHPT] [-o option-name] [--] [-] [arg ...]
set [+abefhkmnptuvxBCEHPT] [+o option-name] [--] [-] [arg ...]
@@ -12899,8 +13378,9 @@ subsequent commands.
Report the status of terminated background jobs -immediately, rather than before the next primary prompt. This is -effective only when job control is enabled. +immediately, rather than before the next primary prompt or after a +foreground command terminates. +This is effective only when job control is enabled.
-e
@@ -12985,9 +13465,10 @@ those that precede the command name.
-m
-Monitor mode. Job control is enabled. This option is on -by default for interactive shells on systems that support -it (see +Monitor mode. +Job control is enabled. +This option is on by default for interactive shells on systems +that support it (see JOB CONTROL @@ -13219,7 +13700,7 @@ on the standard output. Turn on privileged -mode. In this mode, the +mode. In this mode, the shell does not read the $ENV @@ -13227,7 +13708,7 @@ and $BASH_ENV -files are not processed, shell functions are not inherited from the +files, shell functions are not inherited from the environment, and the SHELLOPTS, @@ -13289,7 +13770,7 @@ arithmetic for command, display the expanded value of followed by the command and its expanded arguments -or associated word list, to standard error. +or associated word list, to the standard error.
-B
@@ -13313,13 +13794,14 @@ does not overwrite an existing file with the and <> -redirection operators. This may be overridden when -creating output files by using the redirection operator +redirection operators. +Using the redirection operator >| instead of ->. +> +will override this and force the creation of an output file.
-E
@@ -13332,8 +13814,8 @@ The ERR trap is normally not inherited in such cases. Enable ! -style history substitution. This option is on by -default when the shell is interactive. +style history substitution. +This option is on by default when the shell is interactive.
-P
@@ -13341,8 +13823,9 @@ If set, the shell does not resolve symbolic links when executing commands such as cd -that change the current working directory. It uses the -physical directory structure instead. By default, +that change the current working directory. +It uses the physical directory structure instead. +By default, bash follows the logical chain of directories when performing commands @@ -13358,24 +13841,24 @@ in such cases.
--
-If no arguments follow this option, then the positional parameters are -unset. Otherwise, the positional parameters are set to the +If no arguments follow this option, unset the positional parameters. +Otherwise, set the positional parameters to the args, even if some of them begin with a -.
-
-Signal the end of options, cause all remaining args to be -assigned to the positional parameters. The +Signal the end of options, and assign all remaining args to +the positional parameters. +The -x and -v options are turned off. -If there are no args, -the positional parameters remain unchanged. +If there are no args, the positional parameters remain unchanged.

@@ -13387,11 +13870,11 @@ the shell. The current set of options may be found in $-. -The return status is always true unless an invalid option is encountered. +The return status is always zero unless an invalid option is encountered.

shift [n]
-The positional parameters from n+1 ... are renamed to +Rename positional parameters from n+1 ... to $1 .... @@ -13432,10 +13915,10 @@ option to the set builtin command. With no options, or with the -p -option, a list of all settable options is displayed, with +option, display a list of all settable options, with an indication of whether or not each is set; -if optnames are supplied, the output is restricted to those options. -The -p option causes output to be displayed in a form that +if any optnames are supplied, the output is restricted to those options. +The -p option displays output in a form that may be reused as input. Other options have the following meanings:
@@ -13454,7 +13937,7 @@ Disable (unset) each optname.
Suppresses normal output (quiet mode); the return status indicates whether the optname is set or unset. -If multiple optname arguments are given with +If multiple optname arguments are supplied with -q, the return status is zero if all optnames are enabled; non-zero @@ -13533,28 +14016,29 @@ value is the directory to change to.
cdspell
-If set, minor errors in the spelling of a directory component in a +If set, the cd -command will be corrected. -The errors checked for are transposed characters, -a missing character, and one character too many. -If a correction is found, the corrected filename is printed, +command attempts to correct +minor errors in the spelling of a directory component. +Minor errors include transposed characters, +a missing character, and one extra character. +If cd corrects the directory name, it prints the corrected filename, and the command proceeds. This option is only used by interactive shells.
checkhash
If set, bash checks that a command found in the hash -table exists before trying to execute it. If a hashed command no -longer exists, a normal path search is performed. +table exists before trying to execute it. +If a hashed command no longer exists, bash performs a normal path search.
checkjobs
If set, bash lists the status of any stopped and running jobs before -exiting an interactive shell. If any jobs are running, this causes -the exit to be deferred until a second exit is attempted without an -intervening command (see +exiting an interactive shell. +If any jobs are running, bash defers the exit until a second +exit is attempted without an intervening command (see JOB CONTROL @@ -13565,14 +14049,17 @@ The shell always postpones exiting if any jobs are stopped.
If set, bash checks the window size after each external (non-builtin) -command and, if necessary, updates the values of +command +and, if necessary, updates the values of LINES and -COLUMNS. +COLUMNS, +using the file descriptor associated with the standard error +if it is a terminal. This option is enabled by default.
cmdhist @@ -13581,8 +14068,8 @@ If set, bash attempts to save all lines of a multiple-line -command in the same history entry. This allows -easy re-editing of multi-line commands. +command in the same history entry. +This allows easy re-editing of multi-line commands. This option is enabled by default, but only has an effect if command history is enabled, as described @@ -13653,8 +14140,8 @@ If set, bash replaces directory names with the results of word expansion when performing -filename completion. This changes the contents of the readline editing -buffer. +filename completion. +This changes the contents of the readline editing buffer. If not set, bash @@ -13691,7 +14178,8 @@ If set, a non-interactive shell will not exit if it cannot execute the file specified as an argument to the exec -builtin command. An interactive shell does not exit if +builtin. +An interactive shell does not exit if exec fails. @@ -13709,8 +14197,7 @@ This option is enabled by default for interactive shells.
extdebug
-If set at shell invocation, -or in a shell startup file, +If set at shell invocation, or in a shell startup file, arrange to execute the debugger profile before the shell starts, identical to the --debugger option. If set after invocation, behavior intended for use by debuggers is enabled: @@ -13764,11 +14251,11 @@ subshells invoked with ( command ) inherit the
extglob
-If set, the extended pattern matching features described +If set, enable the extended pattern matching features described above under -Pathname Expansion are enabled. +Pathname Expansion.
extquote
@@ -13776,7 +14263,8 @@ If set, $'string' and $" string" quoting is performed within ${parameter} expansions -enclosed in double quotes. This option is enabled by default. +enclosed in double quotes. +This option is enabled by default.
failglob
@@ -13810,9 +14298,9 @@ If set, range expressions used in pattern matching bracket expressions (see above) -behave as if in the traditional C locale when performing -comparisons. That is, the current locale's collating sequence -is not taken into account, so +behave as if in the traditional C locale when performing comparisons. +That is, pattern matching does not take +the current locale's collating sequence into account, so b will not collate between @@ -13859,7 +14347,7 @@ variable when the shell exits, rather than overwriting the file. If set, and readline -is being used, a user is given the opportunity to re-edit a +is being used, the user is given the opportunity to re-edit a failed history substitution.
histverify @@ -13868,8 +14356,9 @@ If set, and readline is being used, the results of history substitution are not immediately -passed to the shell parser. Instead, the resulting line is loaded into -the readline editing buffer, allowing further modification. +passed to the shell parser. +Instead, the resulting line is loaded into the readline editing buffer, +allowing further modification.
hostcomplete
@@ -13904,11 +14393,10 @@ This option is enabled when posix mode is enabled.
interactive_comments
-If set, allow a word beginning with -# - -to cause that word and all remaining characters on that -line to be ignored in an interactive shell (see +In an interactive shell, a word beginning with # +causes that word and all remaining characters on that +line to be ignored, as in a non-interactive shell +(see COMMENTS @@ -13933,14 +14421,16 @@ embedded newlines rather than using semicolon separators where possible.
If set, local variables inherit the value and attributes of a variable of the same name that exists at a previous scope before any new value is -assigned. The nameref attribute is not inherited. +assigned. +The nameref attribute is not inherited.
localvar_unset
If set, calling unset on local variables in previous function scopes marks them so subsequent lookups find them unset until that function -returns. This is identical to the behavior of unsetting local variables -at the current function scope. +returns. +This is identical to the behavior of unsetting local variables at the +current function scope.
login_shell
@@ -13967,12 +14457,11 @@ If set, and is being used, bash -will not attempt to search the +does not search PATH -for possible completions when -completion is attempted on an empty line. +for possible completions when completion is attempted on an empty line.
nocaseglob
@@ -14015,8 +14504,7 @@ If set, pathname expansion patterns which match no files above) -expand to nothing and are removed, -rather than expanding to themselves. +expand to nothing and are removed, rather than expanding to themselves.
patsub_replacement
@@ -14030,18 +14518,18 @@ This option is enabled by default.
progcomp
-If set, the programmable completion facilities (see +If set, enable the programmable completion facilities (see Programmable Completion -above) -are enabled. +above). This option is enabled by default.
progcomp_alias
If set, and programmable completion is enabled, bash treats a command name that doesn't have any completions as a possible alias and attempts -alias expansion. If it has an alias, bash attempts programmable +alias expansion. +If it has an alias, bash attempts programmable completion using the command word resulting from the expanded alias.
promptvars @@ -14113,12 +14601,12 @@ Suspend the execution of this shell until it receives a SIGCONT -signal. A login shell, -or a shell without job control enabled, +signal. +A login shell, or a shell without job control enabled, cannot be suspended; the -f -option can be used to override this and force the suspension. +option will override this and force the suspension. The return status is 0 unless the shell is a login shell or job control is not enabled and @@ -14147,7 +14635,7 @@ an argument of -- as signifying the end of options. Expressions may be combined using the following operators, listed in decreasing order of precedence. The evaluation depends on the number of arguments; see below. -Operator precedence is used when there are five or more arguments. +test uses operator precedence when there are five or more arguments.
@@ -14162,7 +14650,7 @@ is false.
Returns the value of expr. -This may be used to override the normal precedence of operators. +This may be used to override normal operator precedence.
expr1 -a expr2
True if both expr1 @@ -14229,7 +14717,6 @@ Otherwise, the expression is false. The following conditions are applied in the order listed. If the first argument is !, the result is the negation of the three-argument expression composed of the remaining arguments. -the two-argument test using the second and third arguments. If the first argument is exactly ( and the fourth argument is exactly ), the result is the two-argument test of the second and third arguments. @@ -14248,19 +14735,31 @@ the < and > operators sort using the current locale. If the shell is not in posix mode, the test and [ commands sort lexicographically using ASCII ordering. -
+
+
+The historical operator-precedence parsing with 4 or more arguments can +lead to ambiguities when it encounters strings that look like primaries. +The POSIX +standard has deprecated the -a and -o +primaries and enclosing expressions within parentheses. +Scripts should no longer use them. +It's much more reliable to restrict test invocations to a single primary, +and to replace uses of -a and -o with the shell's +&& and || list operators. +
times
Print the accumulated user and system times for the shell and -for processes run from the shell. The return status is 0. -
trap [-lp] [[action] sigspec ...]
+for processes run from the shell. +The return status is 0. +
trap [-Plp] [[action] sigspec ...]
The action is a command that is read and executed when the shell receives -signal(s) +any of the signals sigspec. If @@ -14269,9 +14768,8 @@ If is absent (and there is a single sigspec) or -, -each specified signal is -reset to its original disposition (the value it had -upon entrance to the shell). +each specified sigspec is +reset to the value it had when the shell was started. If action @@ -14310,7 +14808,7 @@ associated with each sigspec argument. -P requires at least one sigspec argument. -The -P or -p options to trap may be used +The -P or -p options may be used in a subshell environment (e.g., command substitution) and, as long as they are used before trap is used to change a signal's handling, will display the state of its parent's traps. @@ -14318,7 +14816,7 @@ handling, will display the state of its parent's traps. The -l -option causes trap to print a list of signal names and +option prints a list of signal names and their corresponding numbers. Each sigspec @@ -14330,6 +14828,8 @@ Signal names are case insensitive and the prefix is optional. +If -l is supplied with no sigspec arguments, it prints a +list of valid signal names.
If a sigspec @@ -14338,7 +14838,7 @@ is EXIT -(0) the command +(0), action is executed on exit from the shell. @@ -14349,7 +14849,6 @@ is DEBUG, -the command action is executed before every simple command, for command, @@ -14362,8 +14861,13 @@ in a shell function (see above). -Refer to the description of the extdebug option to the -shopt builtin for details of its effect on the DEBUG trap. +Refer to the description of the extdebug shell option +(see +shopt + + +above) +for details of its effect on the DEBUG trap. If a sigspec @@ -14371,7 +14875,6 @@ is RETURN, -the command action is executed each time a shell function or a script executed with @@ -14384,7 +14887,6 @@ is ERR, -the command action is executed whenever @@ -14414,7 +14916,8 @@ or || list except the command following the final && or ||, -any command in a pipeline but the last, +any command in a pipeline but the last +(subject to the state of the pipefail shell option), or if the command's return value is being inverted using !. @@ -14436,11 +14939,11 @@ returns true.
true
Does nothing, returns a 0 status.
type [-aftpP] name [name ...]
-With no options, -indicate how each +Indicate how each name would be interpreted if used as a command name. +
If the -t @@ -14462,27 +14965,26 @@ or if name -is an alias, shell reserved word, function, builtin, or executable disk file, +is an alias, shell reserved word, function, builtin, or executable file, respectively. If the name -is not found, then nothing is printed, and type returns a -non-zero exit status. +is not found, type prints nothing and returns a non-zero exit status. +
If the -p option is used, type -either returns the name of the executable file +either returns the pathname of the executable file that would be found by searching $PATH -if +for name -were specified as a command name, or nothing if would not return @@ -14500,7 +15002,7 @@ search for each name, even if would not return file. -If a command is hashed, +If name is present in the table of hashed commands, -p and @@ -14511,6 +15013,7 @@ first in PATH. +
If the -a @@ -14535,6 +15038,7 @@ and only performs a search for name. +
The -f @@ -14548,13 +15052,15 @@ any are not found.
ulimit [-HS] [-bcdefiklmnpqrstuvxPRT [limit]]
Provides control over the resources available to the shell and to -processes started by it, on systems that allow such control. +processes it starts, on systems that allow such control. +
The -H and -S options specify that the hard or soft limit is set for the given resource. A hard limit cannot be increased by a non-root user once it is set; a soft limit may be increased up to the value of the hard limit. -If neither -H nor -S is specified, both the soft and hard -limits are set. +If neither -H nor -S is specified, +ulimit sets both the soft and hard limits. +
The value of limit @@ -14572,10 +15078,10 @@ no limit, respectively. If limit -is omitted, the current value of the soft limit of the resource is -printed, unless the -H option is given. When more than one -resource is specified, the limit name and unit, if appropriate, -are printed before the value. +is omitted, ulimit prints the current value of the soft limit of +the resource, unless the -H option is given. +When more than one resource is specified, the limit name and unit, +if appropriate, are printed before the value. Other options are interpreted as follows:
@@ -14583,7 +15089,7 @@ Other options are interpreted as follows:
-a
-All current limits are reported; no limits are set +Report all current limits; no limits are set
-b
@@ -14678,15 +15184,18 @@ The maximum number of threads If limit -is given, and the +is supplied, and the -a option is not used, limit is the new value of the specified resource. -If no option is given, then +If no option is supplied, then -f -is assumed. Values are in 1024-byte increments, except for +is assumed. +

+ +Values are in 1024-byte increments, except for -t, which is in seconds; @@ -14722,27 +15231,27 @@ or an error occurs while setting a new limit.

umask [-p] [-S] [mode]
-The user file-creation mask is set to +Set the user file-creation mask to mode. If mode -begins with a digit, it -is interpreted as an octal number; otherwise -it is interpreted as a symbolic mode mask similar +begins with a digit, it is interpreted as an octal number; +otherwise it is interpreted as a symbolic mode mask similar to that accepted by chmod(1). If mode -is omitted, the current value of the mask is printed. +is omitted, umask prints the current value of the mask. The -S -option causes the mask to be printed in symbolic form; the -default output is an octal number. +option without a mode argument +prints the mask in a symbolic format; +the default output is an octal number. If the -p @@ -14750,14 +15259,15 @@ option is supplied, and mode is omitted, the output is in a form that may be reused as input. -The return status is 0 if the mode was successfully changed or if -no mode argument was supplied, and false otherwise. +The return status is zero if the mode was successfully changed or +if no mode argument was supplied, and non-zero otherwise.
unalias [-a] [name ...]
-Remove each name from the list of defined aliases. If +Remove each name from the list of defined aliases. +If -a -is supplied, all alias definitions are removed. The return -value is true unless a supplied +is supplied, remove all alias definitions. +The return value is true unless a supplied name is not a defined alias. @@ -14773,7 +15283,6 @@ option is given, each name refers to a shell variable, and that variable is removed. -Read-only variables may not be unset. If -f @@ -14789,11 +15298,13 @@ option is supplied, and name is a variable with the nameref attribute, name will be unset rather than the variable it references. -n has no effect if the -f option is supplied. +Read-only variables and functions may not be unset. +When variables or functions are removed, they are also removed +from the environment passed to subsequent commands. If no options are supplied, each name refers to a variable; if there is no variable by that name, a function with that name, if any, is unset. -Each unset variable or function is removed from the environment -passed to subsequent commands. +Some shell variables may not be unset. If any of BASH_ALIASES, @@ -14848,7 +15359,8 @@ or are unset, they lose their special properties, even if they are -subsequently reset. The exit status is true unless a +subsequently reset. +The exit status is true unless a name is readonly or may not be unset. @@ -14856,7 +15368,7 @@ is readonly or may not be unset. Wait for each specified child process id and return the termination status of the last id. Each id may be a process ID or a job specification; -if a job spec is given, wait waits for all processes in the job. +if a job spec is supplied, wait waits for all processes in the job.
If no options or ids are supplied, wait waits for all running background jobs and @@ -14875,7 +15387,9 @@ the exit status is 127. If the -p option is supplied, the process or job identifier of the job for which the exit status is returned is assigned to the variable varname named by the option argument. -The variable will be unset initially, before any assignment. +The variable, +which cannot be readonly, +will be unset initially, before any assignment. This is useful only when the -n option is supplied.
Supplying the -f option, when job control is enabled, @@ -14894,7 +15408,7 @@ than 128, as described under above. Otherwise, the return status is the exit status of the last id.
-  + 

SHELL COMPATIBILITY MODE

Bash-4.0 introduced the concept of a shell compatibility level, @@ -14912,12 +15426,13 @@ There is only one current compatibility level - each option is mutually exclusive. The compatibility level is intended to allow users to select behavior from previous versions that is incompatible with newer versions -while they migrate scripts to use current features and -behavior. It's intended to be a temporary solution. +while they migrate scripts to use current features and behavior. +It's intended to be a temporary solution.

This section does not mention behavior that is standard for a particular -version (e.g., setting compat32 means that quoting the rhs of the regexp +version (e.g., setting compat32 means that quoting the right hand +side of the regexp matching operator quotes special regexp characters in the word, which is default behavior in bash-3.2 and subsequent versions).

@@ -14946,7 +15461,7 @@ corresponding to the compatNN option, like 42) determines the compatibility level.

-Starting with bash-4.4, bash has begun deprecating older compatibility +Starting with bash-4.4, bash began deprecating older compatibility levels. Eventually, the options will be removed in favor of BASH_COMPAT. @@ -14954,12 +15469,13 @@ Eventually, the options will be removed in favor of

-Bash-5.0 was the final version for which there will be an individual shopt -option for the previous version. Users should control the compatibility -level with -BASH_COMPAT. +Bash-5.0 was the final version for which there was an individual shopt +option for the previous version. +BASH_COMPAT +is the only mechanism to control the compatibility level +in versions newer than bash-5.0.

The following table describes the behavior changes controlled by each @@ -14981,8 +15497,8 @@ and it is required for bash-5.1 and later versions.

*
-quoting the rhs of the [[ command's regexp matching operator (=~) -has no special effect +Quoting the rhs of the [[ command's regexp matching operator (=~) +has no special effect.
@@ -14991,7 +15507,7 @@ has no special effect
*
-the < and > operators to the [[ command do not +The < and > operators to the [[ command do not consider the current locale when comparing strings; they use ASCII ordering.
@@ -15002,7 +15518,7 @@ ordering.
*
-the < and > operators to the [[ command do not +The < and > operators to the [[ command do not consider the current locale when comparing strings; they use ASCII ordering. Bash versions prior to bash-4.1 use ASCII collation and @@ -15019,14 +15535,14 @@ bash-4.1 and later use the current locale's collation sequence and
*
-in posix mode, time may be followed by options and still be -recognized as a reserved word (this is POSIX interpretation 267) +In posix mode, time may be followed by options and still be +recognized as a reserved word (this is POSIX interpretation 267).
*
-in posix mode, the parser requires that an even number of single +In posix mode, the parser requires that an even number of single quotes occur in the word portion of a double-quoted parameter expansion and treats them specially, so that characters within the single quotes are considered quoted -(this is POSIX interpretation 221) +(this is POSIX interpretation 221).
@@ -15035,15 +15551,15 @@ the single quotes are considered quoted
*
-the replacement string in double-quoted pattern substitution does not -undergo quote removal, as it does in versions after bash-4.2 +The replacement string in double-quoted pattern substitution does not +undergo quote removal, as it does in versions after bash-4.2.
*
-in posix mode, single quotes are considered special when expanding +In posix mode, single quotes are considered special when expanding the word portion of a double-quoted parameter expansion and can be used to quote a closing brace or other special character (this is part of POSIX interpretation 221); in later versions, single quotes -are not special within double-quoted word expansions +are not special within double-quoted word expansions.
@@ -15052,15 +15568,15 @@ are not special within double-quoted word expansions
*
-word expansion errors are considered non-fatal errors that cause the +Word expansion errors are considered non-fatal errors that cause the current command to fail, even in posix mode (the default behavior is to make them fatal errors that cause the shell -to exit) +to exit).
*
-when executing a shell function, the loop state (while/until/etc.) +When executing a shell function, the loop state (while/until/etc.) is not reset, so break or continue in that function will break -or continue loops in the calling context. Bash-4.4 and later reset -the loop state to prevent this +or continue loops in the calling context. +Bash-4.4 and later reset the loop state to prevent this.
@@ -15069,7 +15585,7 @@ the loop state to prevent this
*
-the shell sets up the values used by +The shell sets up the values used by BASH_ARGV @@ -15078,16 +15594,16 @@ and so they can expand to the shell's positional parameters even if extended -debugging mode is not enabled +debugging mode is not enabled.
*
-a subshell inherits loops from its parent context, so break +A subshell inherits loops from its parent context, so break or continue will cause the subshell to exit. Bash-5.0 and later reset the loop state to prevent the exit
*
-variable assignments preceding builtins like export and readonly +Variable assignments preceding builtins like export and readonly that set attributes continue to affect variables with the same name in the calling environment even if the shell is not in posix -mode +mode.
@@ -15100,18 +15616,19 @@ Bash-5.1 changed the way $RANDOM -is generated to introduce slightly -more randomness. If the shell compatibility level is set to 50 or +is generated to introduce slightly more randomness. +If the shell compatibility level is set to 50 or lower, it reverts to the method from bash-5.0 and previous versions, so seeding the random number generator by assigning a value to RANDOM -will produce the same sequence as in bash-5.0 +will produce the same sequence as in bash-5.0.
*
If the command hash table is empty, bash versions prior to bash-5.1 printed an informational message to that effect, even when producing -output that can be reused as input. Bash-5.1 suppresses that message +output that can be reused as input. +Bash-5.1 suppresses that message when the -l option is supplied.
@@ -15125,32 +15642,32 @@ The unset builtin treats attempts to unset array subscripts @ and * differently depending on whether the array is indexed or associative, and differently than in previous versions.
*
-arithmetic commands ( +Arithmetic commands ( ((...)) ) and the expressions in an arithmetic for -statement can be expanded more than once +statement can be expanded more than once.
*
-expressions used as arguments to arithmetic operators in the [[ -conditional command can be expanded more than once +Expressions used as arguments to arithmetic operators in the [[ +conditional command can be expanded more than once.
*
-the expressions in substring parameter brace expansion can be -expanded more than once +The expressions in substring parameter brace expansion can be +expanded more than once.
*
-the expressions in the +The expressions in the $((...)) -word expansion can be expanded more than once +word expansion can be expanded more than once.
*
-arithmetic expressions used as indexed array subscripts can be -expanded more than once +Arithmetic expressions used as indexed array subscripts can be +expanded more than once.
*
test -v, when given an argument of A[@], where A is an existing associative array, will return true if the array has any set elements. Bash-5.2 will look for and report on a key named @.
*
-the ${parameter[:]=value} word expansion will return +The ${parameter[:]=value} word expansion will return value, before any variable-specific transformations have been performed (e.g., converting to lowercase). Bash-5.2 will return the final value assigned to the variable. @@ -15188,7 +15705,7 @@ the arguments as key sequences to bind. -  + 

RESTRICTED SHELL

@@ -15204,8 +15721,7 @@ is started with the name or the -r -option is supplied at invocation, -the shell becomes restricted. +option is supplied at invocation, the shell becomes restricted. A restricted shell is used to set up an environment more controlled than the standard shell. It behaves identically to @@ -15214,9 +15730,9 @@ It behaves identically to with the exception that the following are disallowed or not performed:
*
-changing directories with cd +Changing directories with cd.
*
-setting or unsetting the values of +Setting or unsetting the values of SHELL, @@ -15230,51 +15746,56 @@ setting or unsetting the values of or -BASH_ENV +BASH_ENV.
*
-specifying command names containing -/ +Specifying command names containing +/.
*
-specifying a filename containing a +Specifying a filename containing a / as an argument to the . -builtin command +builtin command.
*
-specifying a filename containing a slash as an argument to the +Using the -p option to the +. + +builtin command to specify a search path. +
*
+Specifying a filename containing a slash as an argument to the history -builtin command +builtin command.
*
-specifying a filename containing a slash as an argument to the +Specifying a filename containing a slash as an argument to the -p option to the hash -builtin command +builtin command.
*
-importing function definitions from the shell environment at startup +Importing function definitions from the shell environment at startup.
*
-parsing the value of +Parsing the value of SHELLOPTS -from the shell environment at startup +from the shell environment at startup.
*
-redirecting output using the >, >|, <>, >&, &>, and >> redirection operators +Redirecting output using the >, >|, <>, >&, &>, and >> redirection operators.
*
-using the +Using the exec -builtin command to replace the shell with another command +builtin command to replace the shell with another command.
*
-adding or deleting builtin commands with the +Adding or deleting builtin commands with the -f and @@ -15283,19 +15804,19 @@ and options to the enable -builtin command +builtin command.
*
-using the enable builtin command to enable disabled shell builtins +Using the enable builtin command to enable disabled shell builtins.
*
-specifying the +Specifying the -p option to the command -builtin command +builtin command.
*
-turning off restricted mode with +Turning off restricted mode with set +r or shopt -u restricted_shell.

@@ -15319,7 +15840,7 @@ turns off any restrictions in the shell spawned to execute the script. -  + 

SEE ALSO

@@ -15335,7 +15856,7 @@ script.
readline(3)
-  + 

FILES

@@ -15378,7 +15899,7 @@ command history Individual readline initialization file -  + 

AUTHORS

Brian Fox, Free Software Foundation @@ -15391,7 +15912,7 @@ Chet Ramey, Case Western Reserve University
chet.ramey@case.edu -  + 

BUG REPORTS

If you find a bug in @@ -15446,7 +15967,7 @@ Comments and bug reports concerning this manual page should be directed to chet.ramey@case.edu. -  + 

BUGS

It's too big and too slow. @@ -15483,16 +16004,13 @@ bring it into the foreground.

Array variables may not (yet) be exported. -

- -There may be only one active coprocess at a time.


-
GNU Bash 5.32024 August 13BASH(1) +GNU Bash 5.32024 September 29BASH(1)

@@ -15518,87 +16036,90 @@ There may be only one active coprocess at a time.
COMMENTS
QUOTING
-
PARAMETERS
-
Positional Parameters
-
Special Parameters
-
Shell Variables
-
Arrays
+
Translating Strings
+
+
PARAMETERS
+
+
Positional Parameters
+
Special Parameters
+
Shell Variables
+
Arrays
-
EXPANSION
+
EXPANSION
-
Brace Expansion
-
Tilde Expansion
-
Parameter Expansion
-
Command Substitution
-
Arithmetic Expansion
-
Process Substitution
-
Word Splitting
-
Pathname Expansion
-
Quote Removal
+
Brace Expansion
+
Tilde Expansion
+
Parameter Expansion
+
Command Substitution
+
Arithmetic Expansion
+
Process Substitution
+
Word Splitting
+
Pathname Expansion
+
Quote Removal
-
REDIRECTION
+
REDIRECTION
-
Redirecting Input
-
Redirecting Output
-
Appending Redirected Output
-
Redirecting Standard Output and Standard Error
-
Appending Standard Output and Standard Error
-
Here Documents
-
Here Strings
-
Duplicating File Descriptors
-
Moving File Descriptors
-
Opening File Descriptors for Reading and Writing
+
Redirecting Input
+
Redirecting Output
+
Appending Redirected Output
+
Redirecting Standard Output and Standard Error
+
Appending Standard Output and Standard Error
+
Here Documents
+
Here Strings
+
Duplicating File Descriptors
+
Moving File Descriptors
+
Opening File Descriptors for Reading and Writing
-
ALIASES
-
FUNCTIONS
-
ARITHMETIC EVALUATION
-
CONDITIONAL EXPRESSIONS
-
SIMPLE COMMAND EXPANSION
-
COMMAND EXECUTION
-
COMMAND EXECUTION ENVIRONMENT
-
ENVIRONMENT
-
EXIT STATUS
-
SIGNALS
-
JOB CONTROL
-
PROMPTING
-
READLINE
+
ALIASES
+
FUNCTIONS
+
ARITHMETIC EVALUATION
+
CONDITIONAL EXPRESSIONS
+
SIMPLE COMMAND EXPANSION
+
COMMAND EXECUTION
+
COMMAND EXECUTION ENVIRONMENT
+
ENVIRONMENT
+
EXIT STATUS
+
SIGNALS
+
JOB CONTROL
+
PROMPTING
+
READLINE
-
Readline Notation
-
Readline Initialization
-
Readline Key Bindings
-
Readline Variables
-
Readline Conditional Constructs
-
Searching
-
Readline Command Names
-
Commands for Moving
-
Commands for Manipulating the History
-
Commands for Changing Text
-
Killing and Yanking
-
Numeric Arguments
-
Completing
-
Keyboard Macros
-
Miscellaneous
-
Programmable Completion
+
Readline Notation
+
Readline Initialization
+
Readline Key Bindings
+
Readline Variables
+
Readline Conditional Constructs
+
Searching
+
Readline Command Names
+
Commands for Moving
+
Commands for Manipulating the History
+
Commands for Changing Text
+
Killing and Yanking
+
Numeric Arguments
+
Completing
+
Keyboard Macros
+
Miscellaneous
+
Programmable Completion
-
HISTORY
-
HISTORY EXPANSION
+
HISTORY
+
HISTORY EXPANSION
-
Event Designators
-
Word Designators
-
Modifiers
+
Event Designators
+
Word Designators
+
Modifiers
-
SHELL BUILTIN COMMANDS
-
SHELL COMPATIBILITY MODE
-
RESTRICTED SHELL
-
SEE ALSO
-
FILES
-
AUTHORS
-
BUG REPORTS
-
BUGS
+
SHELL BUILTIN COMMANDS
+
SHELL COMPATIBILITY MODE
+
RESTRICTED SHELL
+
SEE ALSO
+
FILES
+
AUTHORS
+
BUG REPORTS
+
BUGS

-This document was created by man2html from /usr/local/src/bash/bash-20240812/doc/bash.1.
-Time: 13 August 2024 14:46:04 EDT +This document was created by man2html from /usr/local/src/bash/bash-20240927/doc/bash.1.
+Time: 07 October 2024 17:23:36 EDT diff --git a/doc/bash.info b/doc/bash.info index f0761af4..f931200a 100644 --- a/doc/bash.info +++ b/doc/bash.info @@ -1,12 +1,12 @@ This is bash.info, produced by makeinfo version 7.1 from bashref.texi. This text is a brief description of the features that are present in the -Bash shell (version 5.3, 5 September 2024). +Bash shell (version 5.3, 29 September 2024). - This is Edition 5.3, last updated 5 September 2024, of ‘The GNU Bash + This is Edition 5.3, last updated 29 September 2024, of ‘The GNU Bash Reference Manual’, for ‘Bash’, Version 5.3. - Copyright © 1988-2023 Free Software Foundation, Inc. + Copyright © 1988-2024 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, @@ -26,10 +26,10 @@ Bash Features ************* This text is a brief description of the features that are present in the -Bash shell (version 5.3, 5 September 2024). The Bash home page is +Bash shell (version 5.3, 29 September 2024). The Bash home page is . - This is Edition 5.3, last updated 5 September 2024, of ‘The GNU Bash + This is Edition 5.3, last updated 29 September 2024, of ‘The GNU Bash Reference Manual’, for ‘Bash’, Version 5.3. Bash contains features that appear in other popular shells, and some @@ -99,7 +99,7 @@ use. version of ‘csh’, Bash is the default shell. Like other GNU software, Bash is quite portable. It currently runs on nearly every version of Unix and a few other operating systems − independently-supported ports -exist for MS-DOS, OS/2, and Windows platforms. +exist for Windows and other platforms.  File: bash.info, Node: What is a shell?, Prev: What is Bash?, Up: Introduction @@ -122,7 +122,8 @@ automate their common tasks. Shells may be used interactively or non-interactively. In interactive mode, they accept input typed from the keyboard. When -executing non-interactively, shells execute commands read from a file. +executing non-interactively, shells execute commands read from a file or +a string. A shell allows execution of GNU commands, both synchronously and asynchronously. The shell waits for synchronous commands to complete @@ -357,13 +358,14 @@ as such, and to prevent parameter expansion. Each of the shell metacharacters (*note Definitions::) has special meaning to the shell and must be quoted if it is to represent itself. -When the command history expansion facilities are being used (*note + + When the command history expansion facilities are being used (*note History Interaction::), the “history expansion” character, usually ‘!’, must be quoted to prevent history expansion. *Note Bash History Facilities::, for more details concerning history expansion. - There are three quoting mechanisms: the “escape character”, single -quotes, and double quotes. + There are four quoting mechanisms: the “escape character”, single +quotes, double quotes, and dollar-single quotes.  File: bash.info, Node: Escape Character, Next: Single Quotes, Up: Quoting @@ -372,10 +374,11 @@ File: bash.info, Node: Escape Character, Next: Single Quotes, Up: Quoting ........................ A non-quoted backslash ‘\’ is the Bash escape character. It preserves -the literal value of the next character that follows, with the exception -of ‘newline’. If a ‘\newline’ pair appears, and the backslash itself is -not quoted, the ‘\newline’ is treated as a line continuation (that is, -it is removed from the input stream and effectively ignored). +the literal value of the next character that follows, removing any +special meaning it has, with the exception of ‘newline’. If a +‘\newline’ pair appears, and the backslash itself is not quoted, the +‘\newline’ is treated as a line continuation (that is, it is removed +from the input stream and effectively ignored).  File: bash.info, Node: Single Quotes, Next: Double Quotes, Prev: Escape Character, Up: Quoting @@ -403,11 +406,12 @@ characters ‘$’ and ‘`’ retain their special meaning within double quotes only when followed by one of the following characters: ‘$’, ‘`’, ‘"’, ‘\’, or ‘newline’. Within double quotes, backslashes that are followed by one of these characters are removed. Backslashes preceding -characters without a special meaning are left unmodified. A double -quote may be quoted within double quotes by preceding it with a -backslash. If enabled, history expansion will be performed unless an -‘!’ appearing in double quotes is escaped using a backslash. The -backslash preceding the ‘!’ is not removed. +characters without a special meaning are left unmodified. + + A double quote may be quoted within double quotes by preceding it +with a backslash. If enabled, history expansion will be performed +unless an ‘!’ appearing in double quotes is escaped using a backslash. +The backslash preceding the ‘!’ is not removed. The special parameters ‘*’ and ‘@’ have special meaning when in double quotes (*note Shell Parameter Expansion::). @@ -485,7 +489,8 @@ translation, using the ‘LC_MESSAGES’, ‘TEXTDOMAINDIR’, and ‘TEXTDOMAIN shell variables, as explained below. See the gettext documentation for additional details not covered here. If the current locale is ‘C’ or ‘POSIX’, if there are no translations available, or if the string is not -translated, the dollar sign is ignored. Since this is a form of double +translated, the dollar sign is ignored, and the string is treated as +double-quoted as described above. Since this is a form of double quoting, the string remains double-quoted by default, whether or not it is translated and replaced. If the ‘noexpand_translation’ option is enabled using the ‘shopt’ builtin (*note The Shopt Builtin::), @@ -590,12 +595,14 @@ File: bash.info, Node: Comments, Prev: Quoting, Up: Shell Syntax In a non-interactive shell, or an interactive shell in which the ‘interactive_comments’ option to the ‘shopt’ builtin is enabled (*note -The Shopt Builtin::), a word beginning with ‘#’ causes that word and all -remaining characters on that line to be ignored. An interactive shell -without the ‘interactive_comments’ option enabled does not allow -comments. The ‘interactive_comments’ option is on by default in -interactive shells. *Note Interactive Shells::, for a description of -what makes a shell interactive. +The Shopt Builtin::), a word beginning with ‘#’ introduces a comment. A +word begins at the beginning of a line, after unquoted whitespace, or +after an operator. The comment causes that word and all remaining +characters on that line to be ignored. An interactive shell without the +‘interactive_comments’ option enabled does not allow comments. The +‘interactive_comments’ option is enabled by default in interactive +shells. *Note Interactive Shells::, for a description of what makes a +shell interactive.  File: bash.info, Node: Shell Commands, Next: Shell Functions, Prev: Shell Syntax, Up: Basic Shell Features @@ -649,9 +656,9 @@ File: bash.info, Node: Simple Commands, Next: Pipelines, Prev: Reserved Words 3.2.2 Simple Commands --------------------- -A simple command is the kind of command encountered most often. It's -just a sequence of words separated by ‘blank’s, terminated by one of the -shell's control operators (*note Definitions::). The first word +A simple command is the kind of command that's executed most often. +It's just a sequence of words separated by ‘blank’s, terminated by one +of the shell's control operators (*note Definitions::). The first word generally specifies a command to be executed, with the rest of the words being that command's arguments. @@ -676,11 +683,12 @@ the input of the next command. That is, each command reads the previous command's output. This connection is performed before any redirections specified by COMMAND1. - If ‘|&’ is used, COMMAND1's standard error, in addition to its -standard output, is connected to COMMAND2's standard input through the -pipe; it is shorthand for ‘2>&1 |’. This implicit redirection of the -standard error to the standard output is performed after any -redirections specified by COMMAND1. + If ‘|&’ is the pipeline operator, COMMAND1's standard error, in +addition to its standard output, is connected to COMMAND2's standard +input through the pipe; it is shorthand for ‘2>&1 |’. This implicit +redirection of the standard error to the standard output is performed +after any redirections specified by COMMAND1, consistent with that +shorthand. The reserved word ‘time’ causes timing statistics to be printed for the pipeline once it finishes. The statistics currently consist of @@ -688,7 +696,7 @@ elapsed (wall-clock) time and user and system time consumed by the command's execution. The ‘-p’ option changes the output format to that specified by POSIX. When the shell is in POSIX mode (*note Bash POSIX Mode::), it does not recognize ‘time’ as a reserved word if the next -token begins with a ‘-’. The ‘TIMEFORMAT’ variable may be set to a +token begins with a ‘-’. The value of the ‘TIMEFORMAT’ variable is a format string that specifies how the timing information should be displayed. *Note Bash Variables::, for a description of the available formats. The use of ‘time’ as a reserved word permits the timing of @@ -700,15 +708,15 @@ be followed by a newline. In this case, the shell displays the total user and system time consumed by the shell and its children. The ‘TIMEFORMAT’ variable specifies the format of the time information. - If the pipeline is not executed asynchronously (*note Lists::), the + If a pipeline is not executed asynchronously (*note Lists::), the shell waits for all commands in the pipeline to complete. Each command in a multi-command pipeline, where pipes are created, is executed in its own “subshell”, which is a separate process (*note Command Execution Environment::). If the ‘lastpipe’ option is enabled -using the ‘shopt’ builtin (*note The Shopt Builtin::), the last element -of a pipeline may be run by the shell process when job control is not -active. +using the ‘shopt’ builtin (*note The Shopt Builtin::), and job control +is not active, the last element of a pipeline may be run by the shell +process. The exit status of a pipeline is the exit status of the last command in the pipeline, unless the ‘pipefail’ option is enabled (*note The Set @@ -716,8 +724,10 @@ Builtin::). If ‘pipefail’ is enabled, the pipeline's return status is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands exit successfully. If the reserved word ‘!’ precedes the pipeline, the exit status is the logical negation of -the exit status as described above. The shell waits for all commands in -the pipeline to terminate before returning a value. +the exit status as described above. If a pipeline is not executed +asynchronously (*note Lists::), the shell waits for all commands in the +pipeline to terminate before returning a value. The return status of an +asynchronous pipeline is 0.  File: bash.info, Node: Lists, Next: Compound Commands, Prev: Pipelines, Up: Shell Commands @@ -829,9 +839,9 @@ syntax, it may be replaced with one or more newlines. for NAME [ [in [WORDS ...] ] ; ] do COMMANDS; done - Expand WORDS (*note Shell Expansions::), and execute COMMANDS once - for each member in the resultant list, with NAME bound to the - current member. If ‘in WORDS’ is not present, the ‘for’ command + Expand WORDS (*note Shell Expansions::), and then execute COMMANDS + once for each word in the resultant list, with NAME bound to the + current word. If ‘in WORDS’ is not present, the ‘for’ command executes the COMMANDS once for each positional parameter that is set, as if ‘in "$@"’ had been specified (*note Special Parameters::). @@ -844,18 +854,17 @@ syntax, it may be replaced with one or more newlines. for (( EXPR1 ; EXPR2 ; EXPR3 )) ; do COMMANDS ; done - First, the arithmetic expression EXPR1 is evaluated according to - the rules described below (*note Shell Arithmetic::). The - arithmetic expression EXPR2 is then evaluated repeatedly until it - evaluates to zero. Each time EXPR2 evaluates to a non-zero value, - COMMANDS are executed and the arithmetic expression EXPR3 is - evaluated. If any expression is omitted, it behaves as if it - evaluates to 1. The return value is the exit status of the last - command in COMMANDS that is executed, or false if any of the - expressions is invalid. + First, evaluate the arithmetic expression EXPR1 according to the + rules described below (*note Shell Arithmetic::). Then, repeatedly + evaluate the arithmetic expression EXPR2 until it evaluates to + zero. Each time EXPR2 evaluates to a non-zero value, execute + COMMANDS and evaluate the arithmetic expression EXPR3. If any + expression is omitted, it behaves as if it evaluates to 1. The + return value is the exit status of the last command in COMMANDS + that is executed, or non-zero if any of the expressions is invalid. - The ‘break’ and ‘continue’ builtins (*note Bourne Shell Builtins::) -may be used to control loop execution. + Use the ‘break’ and ‘continue’ builtins (*note Bourne Shell +Builtins::) to control loop execution.  File: bash.info, Node: Conditional Constructs, Next: Command Grouping, Prev: Looping Constructs, Up: Compound Commands @@ -892,14 +901,15 @@ File: bash.info, Node: Conditional Constructs, Next: Command Grouping, Prev: esac ‘case’ will selectively execute the COMMAND-LIST corresponding to - the first PATTERN that matches WORD. The match is performed - according to the rules described below in *note Pattern Matching::. - If the ‘nocasematch’ shell option (see the description of ‘shopt’ - in *note The Shopt Builtin::) is enabled, the match is performed - without regard to the case of alphabetic characters. The ‘|’ is - used to separate multiple patterns, and the ‘)’ operator terminates - a pattern list. A list of patterns and an associated command-list - is known as a CLAUSE. + the first PATTERN that matches WORD, proceeding from the first + pattern to the last. The match is performed according to the rules + described below in *note Pattern Matching::. If the ‘nocasematch’ + shell option (see the description of ‘shopt’ in *note The Shopt + Builtin::) is enabled, the match is performed without regard to the + case of alphabetic characters. The ‘|’ is used to separate + multiple patterns in a pattern list, and the ‘)’ operator + terminates the pattern list. A pattern list and an associated + COMMAND-LIST is known as a CLAUSE. Each clause must be terminated with ‘;;’, ‘;&’, or ‘;;&’. The WORD undergoes tilde expansion, parameter expansion, command @@ -928,16 +938,16 @@ File: bash.info, Node: Conditional Constructs, Next: Command Grouping, Prev: esac echo " legs." - If the ‘;;’ operator is used, no subsequent matches are attempted - after the first pattern match. Using ‘;&’ in place of ‘;;’ causes + If the ‘;;’ operator is used, the ‘case’ command completes after + the first pattern match. Using ‘;&’ in place of ‘;;’ causes execution to continue with the COMMAND-LIST associated with the next clause, if any. Using ‘;;&’ in place of ‘;;’ causes the shell to test the patterns in the next clause, if any, and execute any - associated COMMAND-LIST on a successful match, continuing the case + associated COMMAND-LIST if the match succeeds, continuing the case statement execution as if the pattern list had not matched. - The return status is zero if no PATTERN is matched. Otherwise, the - return status is the exit status of the COMMAND-LIST executed. + The return status is zero if no PATTERN matches. Otherwise, the + return status is the exit status of the last COMMAND-LIST executed. ‘select’ @@ -946,15 +956,15 @@ File: bash.info, Node: Conditional Constructs, Next: Command Grouping, Prev: select NAME [in WORDS ...]; do COMMANDS; done - The list of words following ‘in’ is expanded, generating a list of - items, and the set of expanded words is printed on the standard - error output stream, each preceded by a number. If the ‘in WORDS’ - is omitted, the positional parameters are printed, as if ‘in "$@"’ - had been specified. ‘select’ then displays the ‘PS3’ prompt and - reads a line from the standard input. If the line consists of a - number corresponding to one of the displayed words, then the value - of NAME is set to that word. If the line is empty, the words and - prompt are displayed again. If ‘EOF’ is read, the ‘select’ command + First, expand the list of words following ‘in’, generating a list + of items, and print the set of expanded words on the standard error + stream, each preceded by a number. If the ‘in WORDS’ is omitted, + print the positional parameters, as if ‘in "$@"’ had been + specified. ‘select’ then displays the ‘PS3’ prompt and reads a + line from the standard input. If the line consists of a number + corresponding to one of the displayed words, then ‘select’ sets the + value of NAME to that word. If the line is empty, ‘select’ + displays the words and prompt again. If ‘EOF’ is read, ‘select’ completes and returns 1. Any other value read causes NAME to be set to null. The line read is saved in the variable ‘REPLY’. @@ -978,21 +988,21 @@ File: bash.info, Node: Conditional Constructs, Next: Command Grouping, Prev: described below (*note Shell Arithmetic::). The EXPRESSION undergoes the same expansions as if it were within double quotes, but double quote characters in EXPRESSION are not treated specially - are removed. If the value of the expression is non-zero, the + and are removed. If the value of the expression is non-zero, the return status is 0; otherwise the return status is 1. ‘[[...]]’ [[ EXPRESSION ]] - Return a status of 0 or 1 depending on the evaluation of the - conditional expression EXPRESSION. Expressions are composed of the - primaries described below in *note Bash Conditional Expressions::. - The words between the ‘[[’ and ‘]]’ do not undergo word splitting - and filename expansion. The shell performs tilde expansion, - parameter and variable expansion, arithmetic expansion, command - substitution, process substitution, and quote removal on those - words. Conditional operators such as ‘-f’ must be unquoted to be - recognized as primaries. + Evaluate the conditional expression EXPRESSION and return a status + of zero (true) or non-zero (false). Expressions are composed of + the primaries described below in *note Bash Conditional + Expressions::. The words between the ‘[[’ and ‘]]’ do not undergo + word splitting and filename expansion. The shell performs tilde + expansion, parameter and variable expansion, arithmetic expansion, + command substitution, process substitution, and quote removal on + those words. Conditional operators such as ‘-f’ must be unquoted + to be recognized as primaries. When used with ‘[[’, the ‘<’ and ‘>’ operators sort lexicographically using the current locale. @@ -1188,8 +1198,8 @@ list may be redirected to a single stream. { LIST; } Placing a list of commands between curly braces causes the list to - be executed in the current shell context. No subshell is created. - The semicolon (or newline) following LIST is required. + be executed in the current shell environment. No subshell is + created. The semicolon (or newline) following LIST is required. In addition to the creation of a subshell, there is a subtle difference between these two constructs due to historical reasons. The @@ -1225,7 +1235,7 @@ the default name is ‘COPROC’. coproc NAME { COMMAND; } -This form is recommended because simple commands result in the coprocess +This form is preferred because simple commands result in the coprocess always being named ‘COPROC’, and it is simpler to use and more complete than the other compound commands. @@ -1257,7 +1267,7 @@ subshells. The process ID of the shell spawned to execute the coprocess is available as the value of the variable ‘NAME_PID’. The ‘wait’ builtin -command may be used to wait for the coprocess to terminate. +may be used to wait for the coprocess to terminate. Since the coprocess is created as an asynchronous command, the ‘coproc’ command always returns success. The return status of a @@ -1293,10 +1303,10 @@ File: bash.info, Node: Shell Functions, Next: Shell Parameters, Prev: Shell C Shell functions are a way to group commands for later execution using a single name for the group. They are executed just like a "regular" -command. When the name of a shell function is used as a simple command -name, the list of commands associated with that function name is -executed. Shell functions are executed in the current shell context; no -new process is created to interpret them. +simple command. When the name of a shell function is used as a simple +command name, the shell executes the list of commands associated with +that function name. Shell functions are executed in the current shell +context; there is no new process created to interpret them. Functions are declared using this syntax: FNAME () COMPOUND-COMMAND [ REDIRECTIONS ] @@ -1311,15 +1321,15 @@ the parentheses are optional. The “body” of the function is the compound command COMPOUND-COMMAND (*note Compound Commands::). That command is usually a LIST enclosed between { and }, but may be any compound command listed above. If the ‘function’ reserved word is used, -but the parentheses are not supplied, the braces are recommended. -COMPOUND-COMMAND is executed whenever FNAME is specified as the name of -a simple command. When the shell is in POSIX mode (*note Bash POSIX -Mode::), FNAME must be a valid shell name and may not be the same as one -of the special builtins (*note Special Builtins::). In default mode, a -function name can be any unquoted shell word that does not contain ‘$’. -Any redirections (*note Redirections::) associated with the shell -function are performed when the function is executed. A function -definition may be deleted using the ‘-f’ option to the ‘unset’ builtin +but the parentheses are not supplied, the braces are recommended. When +the shell is in POSIX mode (*note Bash POSIX Mode::), FNAME must be a +valid shell name and may not be the same as one of the special builtins +(*note Special Builtins::). When not in POSIX mode, a function name can +be any unquoted shell word that does not contain ‘$’. + + Any redirections (*note Redirections::) associated with the shell +function are performed when the function is executed. Function +definitions are deleted using the ‘-f’ option to the ‘unset’ builtin (*note Bourne Shell Builtins::). The exit status of a function definition is zero unless a syntax @@ -1331,17 +1341,22 @@ last command executed in the body. braces that surround the body of the function must be separated from the body by ‘blank’s or newlines. This is because the braces are reserved words and are only recognized as such when they are separated from the -command list by whitespace or another shell metacharacter. Also, when -using the braces, the LIST must be terminated by a semicolon, a ‘&’, or -a newline. +command list by whitespace or another shell metacharacter. When using +the braces, the LIST must be terminated by a semicolon, a ‘&’, or a +newline. + + COMPOUND-COMMAND is executed whenever FNAME is specified as the name +of a simple command. Functions are executed in the context of the +calling shell; there is no new process created to interpret them +(contrast this with the execution of a shell script). When a function is executed, the arguments to the function become the positional parameters during its execution (*note Positional Parameters::). The special parameter ‘#’ that expands to the number of -positional parameters is updated to reflect the change. Special -parameter ‘0’ is unchanged. The first element of the ‘FUNCNAME’ -variable is set to the name of the function while the function is -executing. +positional parameters is updated to reflect the new set of positional +parameters. Special parameter ‘0’ is unchanged. The first element of +the ‘FUNCNAME’ variable is set to the name of the function while the +function is executing. All other aspects of the shell execution environment are identical between a function and its caller with these exceptions: the ‘DEBUG’ and @@ -1362,28 +1377,29 @@ function completes and execution resumes with the next command after the function call. Any command associated with the ‘RETURN’ trap is executed before execution resumes. When a function completes, the values of the positional parameters and the special parameter ‘#’ are -restored to the values they had prior to the function's execution. If a -numeric argument is given to ‘return’, that is the function's return +restored to the values they had prior to the function's execution. If +‘return’ is supplied a numeric argument, that is the function's return status; otherwise the function's return status is the exit status of the last command executed before the ‘return’. - Variables local to the function may be declared with the ‘local’ -builtin (“local variables”). Ordinarily, variables and their values are -shared between a function and its caller. These variables are visible -only to the function and the commands it invokes. This is particularly + Variables local to the function are declared with the ‘local’ builtin +(“local variables”). Ordinarily, variables and their values are shared +between a function and its caller. These variables are visible only to +the function and the commands it invokes. This is particularly important when a shell function calls other functions. In the following description, the “current scope” is a currently- executing function. Previous scopes consist of that function's caller and so on, back to the "global" scope, where the shell is not executing -any shell function. Consequently, a local variable at the current local -scope is a variable declared using the ‘local’ or ‘declare’ builtins in -the function that is currently executing. +any shell function. A local variable at the current local scope is a +variable declared using the ‘local’ or ‘declare’ builtins in the +function that is currently executing. Local variables "shadow" variables with the same name declared at previous scopes. For instance, a local variable declared in a function -hides a global variable of the same name: references and assignments -refer to the local variable, leaving the global variable unmodified. +hides variables with the same name declared at previous scopes, +including global variables: references and assignments refer to the +local variable, leaving the variables at previous scopes unmodified. When the function returns, the global variable is once again visible. The shell uses “dynamic scoping” to control a variable's visibility @@ -1428,20 +1444,22 @@ until the function returns. Once the function returns, any instance of the variable at a previous scope will become visible. If the unset acts on a variable at a previous scope, any instance of a variable with that name that had been shadowed will become visible (see below how -‘localvar_unset’shell option changes this behavior). +‘localvar_unset’ shell option changes this behavior). - Function names and definitions may be listed with the ‘-f’ option to -the ‘declare’ (‘typeset’) builtin command (*note Bash Builtins::). The -‘-F’ option to ‘declare’ or ‘typeset’ will list the function names only -(and optionally the source file and line number, if the ‘extdebug’ shell + The ‘-f’ option to the ‘declare’ (‘typeset’) builtin command (*note +Bash Builtins::) will list function names and definitions. The ‘-F’ +option to ‘declare’ or ‘typeset’ will list the function names only (and +optionally the source file and line number, if the ‘extdebug’ shell option is enabled). Functions may be exported so that child shell processes (those created when executing a separate shell invocation) automatically have them defined with the ‘-f’ option to the ‘export’ -builtin (*note Bourne Shell Builtins::). +builtin (*note Bourne Shell Builtins::). The ‘-f’ option to the ‘unset’ +builtin (*note Bourne Shell Builtins::) will delete a function +definition. Functions may be recursive. The ‘FUNCNEST’ variable may be used to limit the depth of the function call stack and restrict the number of -function invocations. By default, no limit is placed on the number of +function invocations. By default, Bash places no limit on the number of recursive calls.  @@ -1460,7 +1478,8 @@ number, or one of the special characters listed below. A “variable” is a parameter denoted by a ‘name’. A variable has a ‘value’ and zero or more ‘attributes’. Attributes are assigned using the ‘declare’ builtin command (see the description of the ‘declare’ builtin in *note Bash -Builtins::). +Builtins::). The ‘export’ and ‘readonly’ builtins assign specific +attributes. A parameter is set if it has been assigned a value. The null string is a valid value. Once a variable is set, it may be unset only by using @@ -1480,15 +1499,18 @@ statements may also appear as arguments to the ‘alias’, ‘declare’, (“declaration” commands). When in POSIX mode (*note Bash POSIX Mode::), these builtins may appear in a command after one or more instances of the ‘command’ builtin and retain these assignment statement properties. +For example, + command export var=value In the context where an assignment statement is assigning a value to -a shell variable or array index (*note Arrays::), the ‘+=’ operator can -be used to append to or add to the variable's previous value. This -includes arguments to builtin commands such as ‘declare’ that accept -assignment statements (declaration commands). When ‘+=’ is applied to a -variable for which the ‘integer’ attribute has been set, VALUE is -evaluated as an arithmetic expression and added to the variable's -current value, which is also evaluated. When ‘+=’ is applied to an +a shell variable or array index (*note Arrays::), the ‘+=’ operator will +append to or add to the variable's previous value. This includes +arguments to declaration commands such as ‘declare’ that accept +assignment statements. When ‘+=’ is applied to a variable for which the +‘integer’ attribute has been set, the variable's current value and VALUE +are each evaluated as arithmetic expressions, and the sum of the results +is assigned as the variable's value. The current value is usually an +integer constant, but may be an expression. When ‘+=’ is applied to an array variable using compound assignment (*note Arrays::), the variable's value is not unset (as it is when using ‘=’), and new values are appended to the array beginning at one greater than the array's @@ -1508,11 +1530,11 @@ shell functions to refer to a variable whose name is passed as an argument to the function. For instance, if a variable name is passed to a shell function as its first argument, running declare -n ref=$1 -inside the function creates a nameref variable ‘ref’ whose value is the -variable name passed as the first argument. References and assignments -to ‘ref’, and changes to its attributes, are treated as references, -assignments, and attribute modifications to the variable whose name was -passed as ‘$1’. +inside the function creates a local nameref variable ‘ref’ whose value +is the variable name passed as the first argument. References and +assignments to ‘ref’, and changes to its attributes, are treated as +references, assignments, and attribute modifications to the variable +whose name was passed as ‘$1’. If the control variable in a ‘for’ loop has the nameref attribute, the list of words can be a list of shell variables, and a name reference @@ -1541,7 +1563,9 @@ Shell Builtin Commands::). The positional parameters are temporarily replaced when a shell function is executed (*note Shell Functions::). When a positional parameter consisting of more than a single digit is -expanded, it must be enclosed in braces. +expanded, it must be enclosed in braces. Without braces, a digit +following ‘$’ can only refer to one of the first nine positional +parameters ($1\-$9) or the special parameter $0 (see below).  File: bash.info, Node: Special Parameters, Prev: Positional Parameters, Up: Shell Parameters @@ -1550,37 +1574,39 @@ File: bash.info, Node: Special Parameters, Prev: Positional Parameters, Up: S ------------------------ The shell treats several parameters specially. These parameters may -only be referenced; assignment to them is not allowed. +only be referenced; assignment to them is not allowed. Special +parameters are denoted by one of the following characters. ‘*’ ($*) Expands to the positional parameters, starting from one. When the expansion is not within double quotes, each positional - parameter expands to a separate word. In contexts where these + parameter expands to a separate word. In contexts where word expansions are performed, those words are subject to further word splitting and filename expansion. When the expansion occurs within double quotes, it expands to a single word with the value of each - parameter separated by the first character of the ‘IFS’ special - variable. That is, ‘"$*"’ is equivalent to ‘"$1C$2C..."’, where C - is the first character of the value of the ‘IFS’ variable. If - ‘IFS’ is unset, the parameters are separated by spaces. If ‘IFS’ - is null, the parameters are joined without intervening separators. + parameter separated by the first character of the ‘IFS’ variable. + That is, ‘"$*"’ is equivalent to ‘"$1C$2C..."’, where C is the + first character of the value of the ‘IFS’ variable. If ‘IFS’ is + unset, the parameters are separated by spaces. If ‘IFS’ is null, + the parameters are joined without intervening separators. ‘@’ ($@) Expands to the positional parameters, starting from one. In contexts where word splitting is performed, this expands each positional parameter to a separate word; if not within double quotes, these words are subject to word splitting. In contexts - where word splitting is not performed, this expands to a single - word with each positional parameter separated by a space. When the - expansion occurs within double quotes, and word splitting is - performed, each parameter expands to a separate word. That is, - ‘"$@"’ is equivalent to ‘"$1" "$2" ...’. If the double-quoted - expansion occurs within a word, the expansion of the first - parameter is joined with the beginning part of the original word, - and the expansion of the last parameter is joined with the last - part of the original word. When there are no positional - parameters, ‘"$@"’ and ‘$@’ expand to nothing (i.e., they are - removed). + where word splitting is not performed, such as the value portion of + an assignment statement, this expands to a single word with each + positional parameter separated by a space. When the expansion + occurs within double quotes, and word splitting is performed, each + parameter expands to a separate word. That is, ‘"$@"’ is + equivalent to ‘"$1" "$2" ...’. If the double-quoted expansion + occurs within a word, the expansion of the first parameter is + joined with the expansion of the beginning part of the original + word, and the expansion of the last parameter is joined with the + expansion of the last part of the original word. When there are no + positional parameters, ‘"$@"’ and ‘$@’ expand to nothing (i.e., + they are removed). ‘#’ ($#) Expands to the number of positional parameters in decimal. @@ -1672,15 +1698,15 @@ File: bash.info, Node: Brace Expansion, Next: Tilde Expansion, Up: Shell Expa 3.5.1 Brace Expansion --------------------- -Brace expansion is a mechanism by which arbitrary strings may be -generated. This mechanism is similar to “filename expansion” (*note -Filename Expansion::), but the filenames generated need not exist. -Patterns to be brace expanded take the form of an optional PREAMBLE, -followed by either a series of comma-separated strings or a sequence -expression between a pair of braces, followed by an optional POSTSCRIPT. -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 expansion is a mechanism to generate arbitrary strings sharing a +common prefix and suffix, either of which can be empty. This mechanism +is similar to “filename expansion” (*note Filename Expansion::), but the +filenames generated need not exist. Patterns to be brace expanded are +formed from an optional PREAMBLE, followed by either a series of +comma-separated strings or a sequence expression between a pair of +braces, followed by an optional POSTSCRIPT. The preamble is prefixed to +each string contained within the braces, and the postscript is then +appended to each resulting string, expanding left to right. Brace expansions may be nested. The results of each expanded string are not sorted; left to right order is preserved. For example, @@ -1731,14 +1757,14 @@ is no unquoted slash) are considered a “tilde-prefix”. 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 “login name”. If this login name is the null string, the tilde is replaced with the -value of the ‘HOME’ shell variable. If ‘HOME’ is unset, the home -directory of the user executing the shell is substituted instead. +value of the ‘HOME’ shell variable. If ‘HOME’ is unset, the tilde +expands to the home directory of the user executing the shell instead. Otherwise, the tilde-prefix is replaced with the home directory associated with the specified login name. If the tilde-prefix is ‘~+’, the value of the shell variable ‘PWD’ -replaces the tilde-prefix. If the tilde-prefix is ‘~-’, the value of -the shell variable ‘OLDPWD’, if it is set, is substituted. +replaces the tilde-prefix. If the tilde-prefix is ‘~-’, the shell +substitutes the value of the shell variable ‘OLDPWD’, 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 @@ -1748,24 +1774,28 @@ following tilde in the tilde-prefix as an argument (*note The Directory Stack::). If the tilde-prefix, sans the tilde, consists of a number without a leading ‘+’ or ‘-’, ‘+’ is assumed. - If the login name is invalid, or the tilde expansion fails, the word -is left unchanged. + The results of tilde expansion are treated as if they were quoted, so +the replacement is not subject to word splitting and filename expansion. + + If the login name is invalid, or the tilde expansion fails, the +tilde-prefix is left unchanged. - Each variable assignment is checked for unquoted tilde-prefixes -immediately following a ‘:’ or the first ‘=’. In these cases, tilde -expansion is also performed. Consequently, one may use filenames with + Bash checks each variable assignment for unquoted tilde-prefixes +immediately following a ‘:’ or the first ‘=’, and performs tilde +expansion in these cases. Consequently, one may use filenames with tildes in assignments to ‘PATH’, ‘MAILPATH’, and ‘CDPATH’, and the shell assigns the expanded value. The following table shows how Bash treats unquoted tilde-prefixes: ‘~’ - The value of ‘$HOME’ + The value of ‘$HOME’. ‘~/foo’ ‘$HOME/foo’ ‘~fred/foo’ - The subdirectory ‘foo’ of the home directory of the user ‘fred’ + The directory or file ‘foo’ in the home directory of the user + ‘fred’. ‘~+/foo’ ‘$PWD/foo’ @@ -1774,13 +1804,13 @@ assigns the expanded value. ‘${OLDPWD-'~-'}/foo’ ‘~N’ - The string that would be displayed by ‘dirs +N’ + The string that would be displayed by ‘dirs +N’. ‘~+N’ - The string that would be displayed by ‘dirs +N’ + The string that would be displayed by ‘dirs +N’. ‘~-N’ - The string that would be displayed by ‘dirs -N’ + The string that would be displayed by ‘dirs -N’. Bash also performs tilde expansion on words satisfying the conditions of variable assignments (*note Shell Parameters::) when they appear as @@ -1797,32 +1827,36 @@ 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 -could be interpreted as part of the name. +could be interpreted as part of the name. For example, if the first +positional parameter has the value ‘a’, then ‘${11}’ expands to the +value of the eleventh positional parameter, while ‘$11’ expands to ‘a1’. 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 embedded arithmetic expansion, command substitution, or parameter expansion. - The basic form of parameter expansion is ${PARAMETER}. The value of -PARAMETER is substituted. The PARAMETER is a shell parameter as -described above (*note Shell Parameters::) or an array reference (*note -Arrays::). The braces are required when PARAMETER is a positional -parameter with more than one digit, or when PARAMETER is followed by a -character that is not to be interpreted as part of its name. + The basic form of parameter expansion is ${PARAMETER}, which +substitutes the value of PARAMETER. The PARAMETER is a shell parameter +as described above (*note Shell Parameters::) or an array reference +(*note Arrays::). The braces are required when PARAMETER is a +positional parameter with more than one digit, or when PARAMETER is +followed by a character that is not to be interpreted as part of its +name. If the first character of PARAMETER is an exclamation point (!), and PARAMETER is not a nameref, it introduces a level of indirection. Bash uses the value formed by expanding the rest of PARAMETER as the new -PARAMETER; this is then expanded and that value is used in the rest of -the expansion, rather than the expansion of the original PARAMETER. -This is known as ‘indirect expansion’. The value is subject to tilde -expansion, parameter expansion, command substitution, and arithmetic -expansion. If PARAMETER is a nameref, this expands to the name of the -variable referenced by PARAMETER instead of performing the complete -indirect expansion. The exceptions to this are the expansions of -${!PREFIX*} and ${!NAME[@]} described below. The exclamation point must -immediately follow the left brace in order to introduce indirection. +PARAMETER; this new parameter is then expanded and that value is used in +the rest of the expansion, rather than the expansion of the original +PARAMETER. This is known as ‘indirect expansion’. The value is subject +to tilde expansion, parameter expansion, command substitution, and +arithmetic expansion. If PARAMETER is a nameref, this expands to the +name of the variable referenced by PARAMETER instead of performing the +complete indirect expansion, for compatibility. The exceptions to this +are the expansions of ${!PREFIX*} and ${!NAME[@]} described below. The +exclamation point must immediately follow the left brace in order to +introduce indirection. In each of the cases below, WORD is subject to tilde expansion, parameter expansion, command substitution, and arithmetic expansion. @@ -1847,15 +1881,21 @@ omitted, the operator tests only for existence. $ echo ${v-unset} unset $ v= + $ echo ${v-unset} + $ echo ${v:-unset-or-null} unset-or-null ‘${PARAMETER:=WORD}’ If PARAMETER is unset or null, the expansion of WORD is assigned to - PARAMETER. The value of PARAMETER is then substituted. Positional - parameters and special parameters may not be assigned to in this - way. + PARAMETER, and the result of the expansion is the final value of + PARAMETER. Positional parameters and special parameters may not be + assigned in this way. + $ unset var + $ : ${var=DEFAULT} + $ echo $var + DEFAULT $ var= $ : ${var:=DEFAULT} $ echo $var @@ -1864,8 +1904,10 @@ omitted, the operator tests only for existence. ‘${PARAMETER:?WORD}’ If PARAMETER is null or unset, the expansion of WORD (or a message to that effect if WORD is not present) is written to the standard - error and the shell, if it is not interactive, exits. Otherwise, - the value of PARAMETER is substituted. + error and the shell, if it is 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 PARAMETER is substituted. $ var= $ : ${var:?var is unset or null} @@ -1873,11 +1915,16 @@ omitted, the operator tests only for existence. ‘${PARAMETER:+WORD}’ If PARAMETER is null or unset, nothing is substituted, otherwise - the expansion of WORD is substituted. + the expansion of WORD is substituted. The value of PARAMETER is + not used. $ var=123 $ echo ${var:+var is set and not null} var is set and not null + $ var= + $ echo ${var:+var is set and not null} + + $ ‘${PARAMETER:OFFSET}’ ‘${PARAMETER:OFFSET:LENGTH}’ @@ -1896,9 +1943,10 @@ omitted, the operator tests only for existence. If LENGTH evaluates to a number less than zero, it is interpreted as an offset in characters from the end of the value of PARAMETER rather than a number of characters, and the expansion is the - characters between OFFSET 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. + characters between OFFSET 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. Here are some examples illustrating substring expansion on parameters and subscripted arrays: @@ -2031,55 +2079,57 @@ omitted, the operator tests only for existence. appears within double quotes, each key expands to a separate word. ‘${#PARAMETER}’ - The length in characters of the expanded value of PARAMETER is - substituted. If PARAMETER is ‘*’ or ‘@’, the value substituted is - the number of positional parameters. If PARAMETER is an array name - subscripted by ‘*’ or ‘@’, the value substituted is the number of - elements in the array. If PARAMETER is an indexed array name - subscripted by a negative number, that number is interpreted as - relative to one greater than the maximum index of PARAMETER, so - negative indices count back from the end of the array, and an index - of -1 references the last element. + Substitutes the length in characters of the value of PARAMETER. If + PARAMETER is ‘*’ or ‘@’, the value substituted is the number of + positional parameters. If PARAMETER is an array name subscripted + by ‘*’ or ‘@’, the value substituted is the number of elements in + the array. If PARAMETER is an indexed array name subscripted by a + negative number, that number is interpreted as relative to one + greater than the maximum index of PARAMETER, so negative indices + count back from the end of the array, and an index of -1 references + the last element. ‘${PARAMETER#WORD}’ ‘${PARAMETER##WORD}’ - The WORD is expanded to produce a pattern and matched according to - the rules described below (*note Pattern Matching::). If the - pattern matches the beginning of the expanded value of PARAMETER, - then the result of the expansion is the expanded value of PARAMETER - with the shortest matching pattern (the ‘#’ case) or the longest - matching pattern (the ‘##’ case) deleted. If PARAMETER is ‘@’ or - ‘*’, the pattern removal operation is applied to each positional - parameter in turn, and the expansion is the resultant list. If - PARAMETER 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. + The WORD is expanded to produce a pattern and matched against the + expanded value of PARAMETER according to the rules described below + (*note Pattern Matching::). If the pattern matches the beginning + of the expanded value of PARAMETER, then the result of the + expansion is the expanded value of PARAMETER with the shortest + matching pattern (the ‘#’ case) or the longest matching pattern + (the ‘##’ case) deleted. If PARAMETER is ‘@’ or ‘*’, the pattern + removal operation is applied to each positional parameter in turn, + and the expansion is the resultant list. If PARAMETER 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. ‘${PARAMETER%WORD}’ ‘${PARAMETER%%WORD}’ - The WORD is expanded to produce a pattern and matched according to - the rules described below (*note Pattern Matching::). If the - pattern matches a trailing portion of the expanded value of - PARAMETER, then the result of the expansion is the value of - PARAMETER with the shortest matching pattern (the ‘%’ case) or the - longest matching pattern (the ‘%%’ case) deleted. If PARAMETER is - ‘@’ or ‘*’, the pattern removal operation is applied to each - positional parameter in turn, and the expansion is the resultant - list. If PARAMETER 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. + The WORD is expanded to produce a pattern and matched against the + expanded value of PARAMETER according to the rules described below + (*note Pattern Matching::). If the pattern matches a trailing + portion of the expanded value of PARAMETER, then the result of the + expansion is the value of PARAMETER with the shortest matching + pattern (the ‘%’ case) or the longest matching pattern (the ‘%%’ + case) deleted. If PARAMETER is ‘@’ or ‘*’, the pattern removal + operation is applied to each positional parameter in turn, and the + expansion is the resultant list. If PARAMETER 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. ‘${PARAMETER/PATTERN/STRING}’ ‘${PARAMETER//PATTERN/STRING}’ ‘${PARAMETER/#PATTERN/STRING}’ ‘${PARAMETER/%PATTERN/STRING}’ The PATTERN is expanded to produce a pattern just as in filename - expansion. PARAMETER is expanded and the longest match of PATTERN - against its value is replaced with STRING. STRING undergoes tilde - expansion, parameter and variable expansion, arithmetic expansion, - command and process substitution, and quote removal. The match is - performed according to the rules described below (*note Pattern - Matching::). + 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. In the first form above, only the first match is replaced. If there are two slashes separating PARAMETER and PATTERN (the second @@ -2087,15 +2137,15 @@ omitted, the operator tests only for existence. PATTERN is preceded by ‘#’ (the third form above), it must match at the beginning of the expanded value of PARAMETER. If PATTERN is preceded by ‘%’ (the fourth form above), it must match at the end - of the expanded value of PARAMETER. If the expansion of STRING is - null, matches of PATTERN are deleted. If STRING is null, matches - of PATTERN are deleted and the ‘/’ following PATTERN may be - omitted. + of the expanded value of PARAMETER. + + If the expansion of STRING is null, matches of PATTERN are deleted + and the ‘/’ following PATTERN may be omitted. - If the ‘patsub_replacement’ shell option is enabled using ‘shopt’, - any unquoted instances of ‘&’ in STRING are replaced with the - matching portion of PATTERN. This is intended to duplicate a - common ‘sed’ idiom. + If the ‘patsub_replacement’ shell option is enabled using ‘shopt’ + (*note The Shopt Builtin::), any unquoted instances of ‘&’ in + STRING are replaced with the matching portion of PATTERN. This is + intended to duplicate a common ‘sed’ idiom. Quoting any part of STRING inhibits replacement in the expansion of the quoted portion, including replacement strings stored in shell @@ -2150,12 +2200,13 @@ omitted, the operator tests only for existence. If the ‘nocasematch’ shell option (see the description of ‘shopt’ in *note The Shopt Builtin::) is enabled, the match is performed - without regard to the case of alphabetic characters. If PARAMETER - is ‘@’ or ‘*’, the substitution operation is applied to each - positional parameter in turn, and the expansion is the resultant - list. If PARAMETER is an array variable subscripted with ‘@’ or - ‘*’, the substitution operation is applied to each member of the - array in turn, and the expansion is the resultant list. + without regard to the case of alphabetic characters. + + If PARAMETER is ‘@’ or ‘*’, the substitution operation is applied + to each positional parameter in turn, and the expansion is the + resultant list. If PARAMETER is an array variable subscripted with + ‘@’ or ‘*’, the substitution operation is applied to each member of + the array in turn, and the expansion is the resultant list. ‘${PARAMETER^PATTERN}’ ‘${PARAMETER^^PATTERN}’ @@ -2321,9 +2372,8 @@ File: bash.info, Node: Arithmetic Expansion, Next: Process Substitution, Prev 3.5.5 Arithmetic Expansion -------------------------- -Arithmetic expansion allows the evaluation of an arithmetic expression -and the substitution of the result. The format for arithmetic expansion -is: +Arithmetic expansion evalutes an arithmetic expression and substitutes +the result. The format for arithmetic expansion is: $(( EXPRESSION )) @@ -2336,8 +2386,9 @@ evaluated. Arithmetic expansions may be nested. The evaluation is performed according to the rules listed below (*note Shell Arithmetic::). If the expression is invalid, Bash prints a -message indicating failure to the standard error and no substitution -occurs. +message indicating failure to the standard error, does not perform the +substitution, and does not execute the command associated with the +expansion.  File: bash.info, Node: Process Substitution, Next: Word Splitting, Prev: Arithmetic Expansion, Up: Shell Expansions @@ -2352,14 +2403,16 @@ or >(LIST) The process LIST is run asynchronously, and its input or output appears as a filename. This filename is passed as an argument to the current -command as the result of the expansion. If the ‘>(LIST)’ form is used, -writing to the file will provide input for LIST. If the ‘<(LIST)’ form -is used, the file passed as an argument should be read to obtain the -output of LIST. Note that no space may appear between the ‘<’ or ‘>’ -and the left parenthesis, otherwise the construct would be interpreted -as a redirection. Process substitution is supported on systems that -support named pipes (FIFOs) or the ‘/dev/fd’ method of naming open -files. +command as the result of the expansion. + + If the ‘>(LIST)’ form is used, writing to the file will provide input +for LIST. If the ‘<(LIST)’ form is used, reading the file will obtain +the output of LIST. Note that no space may appear between the ‘<’ or +‘>’ and the left parenthesis, otherwise the construct would be +interpreted as a redirection. + + Process substitution is supported on systems that support named pipes +(FIFOs) or the ‘/dev/fd’ method of naming open files. When available, process substitution is performed simultaneously with parameter and variable expansion, command substitution, and arithmetic @@ -2382,14 +2435,14 @@ field terminators. If ‘IFS’ is unset, or its value is exactly ‘’, the default, then sequences of ‘space’, ‘tab’, and ‘newline’ at the beginning and end of the results of the previous expansions are ignored, -and any sequence of ‘IFS’ characters not at the beginning or end serves -to delimit words. If ‘IFS’ has a value other than the default, then -sequences of the whitespace characters ‘space’, ‘tab’, and ‘newline’ are -ignored at the beginning and end of the word, as long as the whitespace -character is in the value of ‘IFS’ (an ‘IFS’ whitespace character). Any -character in ‘IFS’ that is not ‘IFS’ whitespace, along with any adjacent -‘IFS’ whitespace characters, delimits a field. A sequence of ‘IFS’ -whitespace characters is also treated as a delimiter. +and any sequence of ‘IFS’ characters not at the beginning or end +delimits words. If ‘IFS’ has a value other than the default, then +sequences of the whitespace characters ‘space’, ‘tab’, and ‘newline’ +present the value of ‘IFS’ (an ‘IFS’ whitespace character) are ignored +at the beginning and end of the word. Any character in ‘IFS’ that is +not ‘IFS’ whitespace, along with any adjacent ‘IFS’ whitespace +characters, delimits a field. A sequence of ‘IFS’ whitespace characters +is also treated as a delimiter. If the value of ‘IFS’ is null, no word splitting occurs. If ‘IFS’ is unset, word splitting behaves as if it contained the default value @@ -2419,15 +2472,17 @@ File: bash.info, Node: Filename Expansion, Next: Quote Removal, Prev: Word Sp After word splitting, unless the ‘-f’ option has been set (*note The Set Builtin::), Bash scans each word for the characters ‘*’, ‘?’, and ‘[’. If one of these characters appears, and is not quoted, then the word is -regarded as a PATTERN, and replaced with an alphabetically sorted list -of filenames matching the pattern (*note Pattern Matching::). If no -matching filenames are found, and the shell option ‘nullglob’ is -disabled, the word is left unchanged. If the ‘nullglob’ option is set, -and no matches are found, the word is removed. If the ‘failglob’ shell -option is set, and no matches are found, an error message is printed and -the command is not executed. If the shell option ‘nocaseglob’ is -enabled, the match is performed without regard to the case of alphabetic -characters. +regarded as a PATTERN, and replaced with a sorted list of filenames +matching the pattern (*note Pattern Matching::), subject to the value of +the ‘GLOBSORT’ shell variable (*note Bash Variables::). + + If no matching filenames are found, and the shell option ‘nullglob’ +is disabled, the word is left unchanged. If the ‘nullglob’ option is +set, and no matches are found, the word is removed. If the ‘failglob’ +shell option is set, and no matches are found, Bash prints an error +message and does not execute the command. If the shell option +‘nocaseglob’ is enabled, the match is performed without regard to the +case of alphabetic characters. When a pattern is used for filename expansion, the character ‘.’ at the start of a filename or immediately following a slash must be matched @@ -2458,11 +2513,12 @@ non-null value has the effect of enabling the ‘dotglob’ shell option, so all other filenames beginning with a ‘.’ will match. To get the old behavior of ignoring filenames beginning with a ‘.’, make ‘.*’ one of the patterns in ‘GLOBIGNORE’. The ‘dotglob’ option is disabled when -‘GLOBIGNORE’ is unset. +‘GLOBIGNORE’ is unset. The ‘GLOBIGNORE’ pattern matching honors the +setting of the ‘extglob’ shell option. After the pattern is expanded and matched against filenames, the -value of the ‘GLOBSORT’ variable controls how the results are sorted, as -described below (*note Bash Variables::). +value of the ‘GLOBSORT’ shell variable controls how the results are +sorted, as described below (*note Bash Variables::).  File: bash.info, Node: Pattern Matching, Up: Filename Expansion @@ -2490,12 +2546,13 @@ characters must be quoted if they are to be matched literally. Matches any one of the enclosed characters. A pair of characters separated by a hyphen denotes a RANGE EXPRESSION; any character that falls between those two characters, inclusive, using the - current locale's collating sequence and character set, is matched. - If the first character following the ‘[’ is a ‘!’ or a ‘^’ then any - character not enclosed is matched. A ‘−’ may be matched by - including it as the first or last character in the set. A ‘]’ may - be matched by including it as the first character in the set. The - sorting order of characters in range expressions, and the + current locale's collating sequence and character set, matches. If + the first character following the ‘[’ is a ‘!’ or a ‘^’ then any + character not within the range matches. To match a ‘−’, include it + as the first or last character in the set. To match a ‘]’, include + it as the first character in the set. + + The sorting order of characters in range expressions, and the characters included in the range, are determined by the current locale and the values of the ‘LC_COLLATE’ and ‘LC_ALL’ shell variables, if set. @@ -2561,7 +2618,9 @@ filenames includes all files beginning with ‘.’, but the filenames ‘.’ and ‘..’ must be matched by a pattern or sub-pattern that begins with a dot; when it is disabled, the set does not include any filenames beginning with "." unless the pattern or sub-pattern begins with a ‘.’. -As above, ‘.’ only has a special meaning when matching filenames. +If the ‘globskipdots’ shell option is enabled, the filenames ‘.’ and +‘..’ never appear in the set. As above, ‘.’ only has a special meaning +when matching filenames. Complicated extended pattern matching against long strings is slow, especially when the patterns contain alternations and the strings @@ -2589,21 +2648,22 @@ Before a command is executed, its input and output may be “redirected” using a special notation interpreted by the shell. “Redirection” allows commands' file handles to be duplicated, opened, closed, made to refer to different files, and can change the files the command reads from and -writes to. Redirection may also be used to modify file handles in the -current shell execution environment. The following redirection -operators may precede or appear anywhere within a simple command or may -follow a command. Redirections are processed in the order they appear, -from left to right. +writes to. When used with the ‘exec’ builtin, redirections modify file +handles in the current shell execution environment. The following +redirection operators may precede or appear anywhere within a simple +command or may follow a command. Redirections are processed in the +order they appear, from left to right. Each redirection that may be preceded by a file descriptor number may instead be preceded by a word of the form {VARNAME}. In this case, for each redirection operator except >&- and <&-, the shell will allocate a -file descriptor greater than 10 and assign it to {VARNAME}. If >&- or -<&- is preceded by {VARNAME}, the value of VARNAME defines the file +file descriptor greater than 10 and assign it to {VARNAME}. If +{VARNAME} precedes >&- or <&-, the value of VARNAME defines the file descriptor to close. If {VARNAME} is supplied, the redirection persists -beyond the scope of the command, allowing the shell programmer to manage -the file descriptor's lifetime manually. The ‘varredir_close’ shell -option manages this behavior (*note The Shopt Builtin::). +beyond the scope of the command, which allows the shell programmer to +manage the file descriptor's lifetime manually without using the ‘exec’ +builtin. The ‘varredir_close’ shell option manages this behavior (*note +The Shopt Builtin::). In the following descriptions, if the file descriptor number is omitted, and the first character of the redirection operator is ‘<’, the @@ -2611,14 +2671,13 @@ redirection refers to the standard input (file descriptor 0). If the first character of the redirection operator is ‘>’, the redirection refers to the standard output (file descriptor 1). - The word following the redirection operator in the following + The \fIword\fP following the redirection operator in the following descriptions, unless otherwise noted, is subjected to brace expansion, -tilde expansion, parameter expansion, command substitution, arithmetic -expansion, quote removal, filename expansion, and word splitting. If it -expands to more than one word, Bash reports an error. +tilde expansion, parameter and variable expansion, command substitution, +arithmetic expansion, quote removal, filename expansion, and word +splitting. If it expands to more than one word, Bash reports an error. - Note that the order of redirections is significant. For example, the -command + The order of redirections is significant. For example, the command ls > DIRLIST 2>&1 directs both standard output (file descriptor 1) and standard error (file descriptor 2) to the file DIRLIST, while the command @@ -2634,7 +2693,7 @@ use them; otherwise it will emulate them internally with the behavior described below. ‘/dev/fd/FD’ - If FD is a valid integer, file descriptor FD is duplicated. + If FD is a valid integer, duplicate file descriptor FD. ‘/dev/stdin’ File descriptor 0 is duplicated. @@ -2664,9 +2723,9 @@ internally. 3.6.1 Redirecting Input ----------------------- -Redirection of input causes the file whose name results from the -expansion of WORD to be opened for reading on file descriptor ‘n’, or -the standard input (file descriptor 0) if ‘n’ is not specified. +Redirecting input opens the file whose name results from the expansion +of WORD for reading on file descriptor ‘n’, or the standard input (file +descriptor 0) if ‘n’ is not specified. The general format for redirecting input is: [N][|]WORD @@ -2687,16 +2745,16 @@ size. ‘set’ builtin has been enabled, the redirection will fail if the file whose name results from the expansion of WORD exists and is a regular file. If the redirection operator is ‘>|’, or the redirection operator -is ‘>’ and the ‘noclobber’ option is not enabled, the redirection is -attempted even if the file named by WORD exists. +is ‘>’ and the ‘noclobber’ option is not enabled, Bash attemps the +redirection even if the file named by WORD exists. 3.6.3 Appending Redirected Output --------------------------------- -Redirection of output in this fashion causes the file whose name results -from the expansion of WORD to be opened for appending on file descriptor -N, or the standard output (file descriptor 1) if N is not specified. If -the file does not exist it is created. +Redirecting output in this fashion opens the file whose name results +from the expansion of WORD for appending on file descriptor N, or the +standard output (file descriptor 1) if N is not specified. If the file +does not exist it is created. The general format for appending output is: [N]>>WORD @@ -2704,9 +2762,9 @@ the file does not exist it is created. 3.6.4 Redirecting Standard Output and Standard Error ---------------------------------------------------- -This construct allows both the standard output (file descriptor 1) and -the standard error output (file descriptor 2) to be redirected to the -file whose name is the expansion of WORD. +This construct redirects both the standard output (file descriptor 1) +and the standard error output (file descriptor 2) to the file whose name +is the expansion of WORD. There are two formats for redirecting standard output and standard error: @@ -2723,9 +2781,9 @@ Descriptors below) for compatibility reasons. 3.6.5 Appending Standard Output and Standard Error -------------------------------------------------- -This construct allows both the standard output (file descriptor 1) and -the standard error output (file descriptor 2) to be appended to the file -whose name is the expansion of WORD. +This construct appends both the standard output (file descriptor 1) and +the standard error output (file descriptor 2) to the file whose name is +the expansion of WORD. The format for appending standard output and standard error is: &>>WORD @@ -2738,8 +2796,8 @@ This is semantically equivalent to This type of redirection instructs the shell to read input from the current source until it reads a line containing only DELIMITER (with no -trailing blanks). All of the lines read up to that point are then used -as the standard input (or file descriptor N if N is specified) for a +trailing blanks). All of the lines read up to that point then become +the standard input (or file descriptor N if N is specified) for a command. The format of here-documents is: @@ -2747,21 +2805,29 @@ command. HERE-DOCUMENT DELIMITER - No parameter and variable expansion, command substitution, arithmetic -expansion, or filename expansion is performed on WORD. + The shell does not perform parameter and variable expansion, command +substitution, arithmetic expansion, or filename expansion on WORD. If any part of WORD is quoted, the DELIMITER is the result of quote removal on WORD, and the lines in the here-document are not expanded. -If WORD is unquoted, DELIMITER is WORD itself, all lines of the +If WORD is unquoted, DELIMITER is WORD itself, and the here-document +text is treated similarly to a double-quoted string: all lines of the here-document are subjected to parameter expansion, command substitution, and arithmetic expansion, the character sequence -‘\newline’ is ignored, and ‘\’ must be used to quote the characters ‘\’, -‘$’, and ‘`’. +‘\newline’ is treated literally, and ‘\’ must be used to quote the +characters ‘\’, ‘$’, and ‘`’; however, double quote characters have no +special meaning. + + If the redirection operator is ‘<<-’, the shell strips leading tab +characters are stripped from input lines and the line containing +DELIMITER. This allows here-documents within shell scripts to be +indented in a natural fashion. - If the redirection operator is ‘<<-’, then all leading tab characters -are stripped from input lines and the line containing DELIMITER. This -allows here-documents within shell scripts to be indented in a natural -fashion. + If the delimiter is not quoted, the ‘\’ sequence is treated +as a line continuation: the two lines are joined and the +backslash-newline is removed. This happens while reading the +here-document, before the check for the ending delimiter, so joined +lines can form the end delimiter. 3.6.7 Here Strings ------------------ @@ -2781,21 +2847,21 @@ standard input (or file descriptor N if N is specified). The redirection operator [N]<&WORD is used to duplicate input file descriptors. If WORD expands to one or -more digits, the file descriptor denoted by N is made to be a copy of -that file descriptor. If the digits in WORD do not specify a file -descriptor open for input, a redirection error occurs. If WORD -evaluates to ‘-’, file descriptor N is closed. If N is not specified, -the standard input (file descriptor 0) is used. +more digits, file descriptor N is made to be a copy of that file +descriptor. It is a redirection error if the digits in WORD do not +specify a file descriptor open for input. If WORD evaluates to ‘-’, +file descriptor N is closed. If N is not specified, this uses the +standard input (file descriptor 0). The operator [N]>&WORD is used similarly to duplicate output file descriptors. If N is not -specified, the standard output (file descriptor 1) is used. If the -digits in WORD do not specify a file descriptor open for output, a -redirection error occurs. If WORD evaluates to ‘-’, file descriptor N -is closed. As a special case, if N is omitted, and WORD does not expand -to one or more digits or ‘-’, the standard output and standard error are -redirected as described previously. +specified, this uses the standard output (file descriptor 1). It is a +redirection error if the digits in WORD do not specify a file descriptor +open for output. If WORD evaluates to ‘-’, file descriptor N is closed. +As a special case, if N is omitted, and WORD does not expand to one or +more digits or ‘-’, this redirects the standard output and standard +error as described previously. 3.6.9 Moving File Descriptors ----------------------------- @@ -2816,9 +2882,9 @@ output (file descriptor 1) if N is not specified. The redirection operator [N]<>WORD -causes the file whose name is the expansion of WORD to be opened for -both reading and writing on file descriptor N, or on file descriptor 0 -if N is not specified. If the file does not exist, it is created. +opens the file whose name is the expansion of WORD for both reading and +writing on file descriptor N, or on file descriptor 0 if N is not +specified. If the file does not exist, it is created.  File: bash.info, Node: Executing Commands, Next: Shell Scripts, Prev: Redirections, Up: Basic Shell Features @@ -2846,7 +2912,7 @@ File: bash.info, Node: Simple Command Expansion, Next: Command Search and Exec 3.7.1 Simple Command Expansion ------------------------------ -When a simple command is executed, the shell performs the following +When the shell executes a simple command, it performs the following expansions, assignments, and redirections, from left to right, in the following order. @@ -2883,8 +2949,8 @@ command to exit with a non-zero status. as described below. Otherwise, the command exits. If one of the expansions contained a command substitution, the exit status of the command is the exit status of the last command substitution performed. -If there were no command substitutions, the command exits with a status -of zero. +If there were no command substitutions, the command exits with a zero +status.  File: bash.info, Node: Command Search and Execution, Next: Command Execution Environment, Prev: Simple Command Expansion, Up: Executing Commands @@ -2909,8 +2975,8 @@ following actions. containing an executable file by that name. Bash uses a hash table to remember the full pathnames of executable files to avoid multiple ‘PATH’ searches (see the description of ‘hash’ in *note - Bourne Shell Builtins::). A full search of the directories in - ‘$PATH’ is performed only if the command is not found in the hash + Bourne Shell Builtins::). Bash performs a full search of the + directories in ‘$PATH’ only if the command is not found in the hash table. If the search is unsuccessful, the shell searches for a defined shell function named ‘command_not_found_handle’. If that function exists, it is invoked in a separate execution environment @@ -2927,8 +2993,8 @@ following actions. 5. If this execution fails because the file is not in executable format, and the file is not a directory, it is assumed to be a - “shell script” and the shell executes it as described in *note - Shell Scripts::. + “shell script”, a file containing shell commands, and the shell + executes it as described in *note Shell Scripts::. 6. If the command was not begun asynchronously, the shell waits for the command to complete and collects its exit status. @@ -2997,9 +3063,11 @@ shell's execution environment. asynchronous commands are invoked in a subshell environment that is a duplicate of the shell environment, except that traps caught by the shell are reset to the values that the shell inherited from its parent -at invocation. Builtin commands that are invoked as part of a pipeline -are also executed in a subshell environment. Changes made to the -subshell environment cannot affect the shell's execution environment. +at invocation. Builtin commands that are invoked as part of a pipeline, +except possibly in the last element depending on the value of the +‘lastpipe’ shell option (*note The Shopt Builtin::), are also executed +in a subshell environment. Changes made to the subshell environment +cannot affect the shell's execution environment. When the shell is in POSIX mode, subshells spawned to execute command substitutions inherit the value of the ‘-e’ option from the parent @@ -3026,20 +3094,23 @@ When a program is invoked it is given an array of strings called the Bash provides several ways to manipulate the environment. On invocation, the shell scans its own environment and creates a parameter for each name found, automatically marking it for ‘export’ to child -processes. Executed commands inherit the environment. The ‘export’ and -‘declare -x’ commands allow parameters and functions to be added to and -deleted from the environment. If the value of a parameter in the -environment is modified, the new value becomes part of the environment, -replacing the old. The environment inherited by any executed command -consists of the shell's initial environment, whose values may be -modified in the shell, less any pairs removed by the ‘unset’ and ‘export --n’ commands, plus any additions via the ‘export’ and ‘declare -x’ -commands. - - The environment for any simple command or function may be augmented -temporarily by prefixing it with parameter assignments, as described in -*note Shell Parameters::. These assignment statements affect only the -environment seen by that command. +processes. Executed commands inherit the environment. The ‘export’, +‘declare -x’, and ‘unset’ commands modify the environment by adding and +deleting parameters and functions. If the value of a parameter in the +environment is modified, the new value automatically becomes part of the +environment, replacing the old. The environment inherited by any +executed command consists of the shell's initial environment, whose +values may be modified in the shell, less any pairs removed by the +‘unset’ and ‘export -n’ commands, plus any additions via the ‘export’ +and ‘declare -x’ commands. + + If any parameter assignment statements, as described in *note Shell +Parameters::, appear before a simple command, the variable assignments +are part of that command's environment for as long as it executes. +These assignment statements affect only the environment seen by that +command. If these assignments precede a call to a shell function, the +variables are local to the function and exported to that function's +children. If the ‘-k’ option is set (*note The Set Builtin::), then all parameter assignments are placed in the environment for a command, not @@ -3063,11 +3134,14 @@ commands are also limited to this range. Under certain circumstances, the shell will use special values to indicate specific failure modes. For the shell's purposes, a command which exits with a zero exit -status has succeeded. A non-zero exit status indicates failure. This -seemingly counter-intuitive scheme is used so there is one well-defined -way to indicate success and a variety of ways to indicate various -failure modes. When a command terminates on a fatal signal whose number -is N, Bash uses the value 128+N as the exit status. +status has succeeded. So while an exit status of zero indicates +success, a non-zero exit status indicates failure. This seemingly +counter-intuitive scheme is used so there is one well-defined way to +indicate success and a variety of ways to indicate various failure +modes. + + When a command terminates on a fatal signal whose number is N, Bash +uses the value 128+N as the exit status. If a command is not found, the child process created to execute it returns a status of 127. If a command is found but is not executable, @@ -3089,6 +3163,11 @@ arguments. The exit status of the last command is available in the special parameter $? (*note Special Parameters::). + Bash itself returns the exit status of the last command executed, +unless a syntax error occurs, in which case it exits with a non-zero +value. See also the ‘exit’ builtin command (*note Bourne Shell +Builtins::. +  File: bash.info, Node: Signals, Prev: Exit Status, Up: Executing Commands @@ -3097,37 +3176,42 @@ File: bash.info, Node: Signals, Prev: Exit Status, Up: Executing Commands When Bash is interactive, in the absence of any traps, it ignores ‘SIGTERM’ (so that ‘kill 0’ does not kill an interactive shell), and -‘SIGINT’ is caught and handled (so that the ‘wait’ builtin is +catches and handles ‘SIGINT’ (so that the ‘wait’ builtin is interruptible). When Bash receives a ‘SIGINT’, it breaks out of any executing loops. In all cases, Bash ignores ‘SIGQUIT’. If job control is in effect (*note Job Control::), Bash ignores ‘SIGTTIN’, ‘SIGTTOU’, and ‘SIGTSTP’. - Non-builtin commands started by Bash have signal handlers set to the -values inherited by the shell from its parent. When job control is not -in effect, asynchronous commands ignore ‘SIGINT’ and ‘SIGQUIT’ in -addition to these inherited handlers. Commands run as a result of -command substitution ignore the keyboard-generated job control signals -‘SIGTTIN’, ‘SIGTTOU’, and ‘SIGTSTP’. + The ‘trap’ builtin modifies the shell's signal handling, as described +below (*note Bourne Shell Builtins::. + + Non-builtin commands Bash executes have signal handlers set to the +values inherited by the shell from its parent, unless ‘trap’ sets them +to be ignored, in which case the child process will ignore them as well. +When job control is not in effect, asynchronous commands ignore ‘SIGINT’ +and ‘SIGQUIT’ in addition to these inherited handlers. Commands run as +a result of command substitution ignore the keyboard-generated job +control signals ‘SIGTTIN’, ‘SIGTTOU’, and ‘SIGTSTP’. The shell exits by default upon receipt of a ‘SIGHUP’. Before exiting, an interactive shell resends the ‘SIGHUP’ to all jobs, running -or stopped. Stopped jobs are sent ‘SIGCONT’ to ensure that they receive -the ‘SIGHUP’. To prevent the shell from sending the ‘SIGHUP’ signal to -a particular job, it should be removed from the jobs table with the -‘disown’ builtin (*note Job Control Builtins::) or marked to not receive -‘SIGHUP’ using ‘disown -h’. - - If the ‘huponexit’ shell option has been set with ‘shopt’ (*note The +or stopped. The shell sends ‘SIGCONT’ to stopped jobs to ensure that +they receive the ‘SIGHUP’ (*Note Job Control::, for more information +about running and stopped jobs). To prevent the shell from sending the +‘SIGHUP’ signal to a particular job, remove it from the jobs table with +the ‘disown’ builtin (*note Job Control Builtins::) or mark it not to +receive ‘SIGHUP’ using ‘disown -h’. + + If the ‘huponexit’ shell option has been set using ‘shopt’ (*note The Shopt Builtin::), Bash sends a ‘SIGHUP’ to all jobs when an interactive login shell exits. If Bash is waiting for a command to complete and receives a signal for which a trap has been set, the trap will not be executed until the -command completes. When Bash is waiting for an asynchronous command via -the ‘wait’ builtin, the reception of a signal for which a trap has been -set will cause the ‘wait’ builtin to return immediately with an exit -status greater than 128, immediately after which the trap is executed. +command completes. If Bash is waiting for an asynchronous command via +the ‘wait’ builtin, and it receives a signal for which a trap has been +set, the ‘wait’ builtin will return immediately with an exit status +greater than 128, immediately after which the shell executes the trap. When job control is not enabled, and Bash is waiting for a foreground command to complete, the shell receives keyboard-generated signals such @@ -3166,9 +3250,13 @@ A shell script is a text file containing shell commands. When such a file is used as the first non-option argument when invoking Bash, and neither the ‘-c’ nor ‘-s’ option is supplied (*note Invoking Bash::), Bash reads and executes commands from the file, then exits. This mode -of operation creates a non-interactive shell. The shell first searches -for the file in the current directory, and looks in the directories in -‘$PATH’ if not found there. +of operation creates a non-interactive shell. If the filename does not +contain any slashes, the shell first searches for the file in the +current directory, and looks in the directories in ‘$PATH’ if not found +there. + + Bash tries to determine whether the file is a text file or a binary, +and will not execute files it determines to be binaries. When Bash runs a shell script, it sets the special parameter ‘0’ to the name of the file, rather than the name of the shell, and the @@ -3190,13 +3278,13 @@ invoked to interpret the script, with the exception that the locations of commands remembered by the parent (see the description of ‘hash’ in *note Bourne Shell Builtins::) are retained by the child. - Most versions of Unix make this a part of the operating system's -command execution mechanism. If the first line of a script begins with -the two characters ‘#!’, the remainder of the line specifies an -interpreter for the program and, depending on the operating system, one -or more optional arguments for that interpreter. Thus, you can specify -Bash, ‘awk’, Perl, or some other interpreter and write the rest of the -script file in that language. + The GNU operating system, and most versions of Unix, make this a part +of the operating system's command execution mechanism. If the first +line of a script begins with the two characters ‘#!’, the remainder of +the line specifies an interpreter for the program and, depending on the +operating system, one or more optional arguments for that interpreter. +Thus, you can specify Bash, ‘awk’, Perl, or some other interpreter and +write the rest of the script file in that language. The arguments to the interpreter consist of one or more optional arguments following the interpreter name on the first line of the script @@ -3281,44 +3369,52 @@ standard. ‘. (a period)’ . [-p PATH] FILENAME [ARGUMENTS] - Read and execute commands from the FILENAME argument in the current - shell context. If FILENAME does not contain a slash, ‘.’ searches - for it. If ‘-p’ is supplied, ‘.’ treats PATH as a colon-separated - list of directories in which to find FILENAME; otherwise, ‘.’ uses - the directories in ‘PATH’ to find FILENAME. FILENAME does not need - to be executable. When Bash is not in POSIX mode, it searches the + The ‘.’ command reads and execute commands from the FILENAME + argument in the current shell context. + + If FILENAME does not contain a slash, ‘.’ searches for it. If ‘-p’ + is supplied, ‘.’ treats PATH as a colon-separated list of + directories in which to find FILENAME; otherwise, ‘.’ uses the + directories in ‘PATH’ to find FILENAME. FILENAME does not need to + be executable. When Bash is not in POSIX mode, it searches the current directory if FILENAME is not found in ‘$PATH’, but does not search the current directory if ‘-p’ is supplied. If the - ‘sourcepath’ option (*note The Shopt Builtin::) is turned off ‘.’ - does not search ‘PATH’. If any ARGUMENTS are supplied, they become - the positional parameters when FILENAME is executed. Otherwise the - positional parameters are unchanged. If the ‘-T’ option is - enabled, ‘.’ inherits any trap on ‘DEBUG’; if it is not, any - ‘DEBUG’ trap string is saved and restored around the call to ‘.’, - and ‘.’ unsets the ‘DEBUG’ trap while it executes. If ‘-T’ is not - set, and the sourced file changes the ‘DEBUG’ trap, the new value - is retained when ‘.’ completes. The return status is the exit - status of the last command executed, or zero if no commands are - executed. If FILENAME is not found, or cannot be read, the return - status is non-zero. This builtin is equivalent to ‘source’. + ‘sourcepath’ option (*note The Shopt Builtin::) is turned off, ‘.’ + does not search ‘PATH’. + + If any ARGUMENTS are supplied, they become the positional + parameters when FILENAME is executed. Otherwise the positional + parameters are unchanged. + + If the ‘-T’ option is enabled, ‘.’ inherits any trap on ‘DEBUG’; if + it is not, any ‘DEBUG’ trap string is saved and restored around the + call to ‘.’, and ‘.’ unsets the ‘DEBUG’ trap while it executes. If + ‘-T’ is not set, and the sourced file changes the ‘DEBUG’ trap, the + new value persists after ‘.’ completes. The return status is the + exit status of the last command executed from FILENAME, or zero if + no commands are executed. If FILENAME is not found, or cannot be + read, the return status is non-zero. This builtin is equivalent to + ‘source’. ‘break’ break [N] Exit from a ‘for’, ‘while’, ‘until’, or ‘select’ loop. If N is - supplied, the Nth enclosing loop is exited. N must be greater than - or equal to 1. The return status is zero unless N is not greater - than or equal to 1. + supplied, ‘break’ exits the Nth enclosing loop. N must be greater + than or equal to 1. The return status is zero unless N is not + greater than or equal to 1. ‘cd’ cd [-L|[-P [-e]]] [-@] [DIRECTORY] Change the current working directory to DIRECTORY. If DIRECTORY is - not supplied, the value of the ‘HOME’ shell variable is used. If - the shell variable ‘CDPATH’ exists, ‘cd’ uses it as a search path: - ‘cd’ searches each directory name in ‘CDPATH’ for DIRECTORY, with - alternative directory names in ‘CDPATH’ separated by a colon (‘:’). - If DIRECTORY begins with a slash, ‘CDPATH’ is not used. + not supplied, the value of the ‘HOME’ shell variable is used as + DIRECTORY. If the shell variable ‘CDPATH’ exists, ‘cd’ uses it as + a search path: ‘cd’ searches each directory name in ‘CDPATH’ for + DIRECTORY, with alternative directory names in ‘CDPATH’ separated + by a colon (‘:’). A null directory name in ‘CDPATH’ means the same + thing as the current directory. If DIRECTORY begins with a slash, + ‘CDPATH’ is not used. The ‘-P’ option means to not follow symbolic links: symbolic links are resolved while ‘cd’ is traversing DIRECTORY and before @@ -3334,17 +3430,17 @@ standard. If the ‘-e’ option is supplied with ‘-P’ and the current working directory cannot be successfully determined after a successful - directory change, ‘cd’ will return an unsuccessful status. + directory change, ‘cd’ will return a non-zero status. On systems that support it, the ‘-@’ option presents the extended attributes associated with a file as a directory. - If DIRECTORY is ‘-’, it is converted to ‘$OLDPWD’ before the - directory change is attempted. + If DIRECTORY is ‘-’, it is converted to ‘$OLDPWD’ before attempting + the directory change. - If a non-empty directory name from ‘CDPATH’ is used, or if ‘-’ is - the first argument, and the directory change is successful, the - absolute pathname of the new working directory is written to the + If ‘cd’ uses a non-empty directory name from ‘CDPATH’, or if ‘-’ is + the first argument, and the directory change is successful, ‘cd’ + writes the absolute pathname of the new working directory to the standard output. If the directory change is successful, ‘cd’ sets the value of the @@ -3358,37 +3454,41 @@ standard. ‘continue’ continue [N] - Resume the next iteration of an enclosing ‘for’, ‘while’, ‘until’, - or ‘select’ loop. If N is supplied, the execution of the Nth - enclosing loop is resumed. N must be greater than or equal to 1. - The return status is zero unless N is not greater than or equal to - 1. + ‘continue’ resumes the next iteration of an enclosing ‘for’, + ‘while’, ‘until’, or ‘select’ loop. If N is supplied, Bash resumes + the execution of the Nth enclosing loop. N must be greater than or + equal to 1. The return status is zero unless N is not greater than + or equal to 1. ‘eval’ eval [ARGUMENTS] - The arguments are concatenated together into a single command, - which is then read and executed, and its exit status returned as - the exit status of ‘eval’. If there are no arguments or only empty - arguments, the return status is zero. + The ARGUMENTS are concatenated together into a single command, + separated by spaces. Bash then reads and executes this command and + returns its exit status as the exit status of ‘eval’. If there are + no arguments or only empty arguments, the return status is zero. ‘exec’ exec [-cl] [-a NAME] [COMMAND [ARGUMENTS]] If COMMAND is supplied, it replaces the shell without creating a - new process. If the ‘-l’ option is supplied, the shell places a - dash at the beginning of the zeroth argument passed to COMMAND. - This is what the ‘login’ program does. The ‘-c’ option causes - COMMAND to be executed with an empty environment. If ‘-a’ is - supplied, the shell passes NAME as the zeroth argument to COMMAND. + new process. COMMAND cannot be a shell builtin or function. The + ARGUMENTS become the arguments to COMMAND If the ‘-l’ option is + supplied, the shell places a dash at the beginning of the zeroth + argument passed to COMMAND. This is what the ‘login’ program does. + The ‘-c’ option causes COMMAND to be executed with an empty + environment. If ‘-a’ is supplied, the shell passes NAME as the + zeroth argument to COMMAND. + If COMMAND cannot be executed for some reason, a non-interactive shell exits, unless the ‘execfail’ shell option is enabled. In - that case, it returns failure. An interactive shell returns - failure if the file cannot be executed. A subshell exits - unconditionally if ‘exec’ fails. If no COMMAND is specified, - redirections may be used to affect the current shell environment. - If there are no redirection errors, the return status is zero; - otherwise the return status is non-zero. + that case, it returns a non-zero status. An interactive shell + returns a non-zero status if the file cannot be executed. A + subshell exits unconditionally if ‘exec’ fails. + + If COMMAND is not specified, redirections may be used to affect the + current shell environment. If there are no redirection errors, the + return status is zero; otherwise the return status is non-zero. ‘exit’ exit [N] @@ -3400,14 +3500,20 @@ standard. ‘export’ export [-fn] [-p] [NAME[=VALUE]] - Mark each NAME to be passed to child processes in the environment. - If the ‘-f’ option is supplied, the NAMEs refer to shell functions; - otherwise the names refer to shell variables. The ‘-n’ option - means to no longer mark each NAME for export. If no NAMEs are - supplied, or if the ‘-p’ option is given, a list of names of all - exported variables is displayed. The ‘-p’ option displays output - in a form that may be reused as input. If a variable name is - followed by =VALUE, the value of the variable is set to VALUE. + Mark each NAME to be passed to subsequently executed commands in + the environment. If the ‘-f’ option is supplied, the NAMEs refer + to shell functions; otherwise the names refer to shell variables. + + The ‘-n’ option means to unexport each name: no longer mark it for + export. If no NAMEs are supplied, or if the ‘-p’ option is given, + ‘export’ displays a list of names of all exported variables on the + standard output. The ‘-p’ option displays output in a form that + may be reused as input. + + ‘export’ allows the value of a variable to be set at the same time + it is exported or unexported by following the variable name with + =VALUE. This sets the value of the variable is to VALUE while + modifying the export attribute. The return status is zero unless an invalid option is supplied, one of the names is not a valid shell variable name, or ‘-f’ is @@ -3416,40 +3522,43 @@ standard. ‘false’ false - Does nothing, returns a non-zero status. + Does nothing; returns a non-zero status. ‘getopts’ getopts OPTSTRING NAME [ARG ...] - ‘getopts’ is used by shell scripts to parse positional parameters. - OPTSTRING contains the option characters to be recognized; if a - character is followed by a colon, the option is expected to have an - argument, which should be separated from it by whitespace. The - colon (‘:’) and question mark (‘?’) may not be used as option - characters. Each time it is invoked, ‘getopts’ places the next - option in the shell variable NAME, initializing NAME if it does not - exist, and the index of the next argument to be processed into the - variable ‘OPTIND’. ‘OPTIND’ is initialized to 1 each time the - shell or a shell script is invoked. When an option requires an - argument, ‘getopts’ places that argument into the variable - ‘OPTARG’. The shell does not reset ‘OPTIND’ automatically; it must - be manually reset between multiple calls to ‘getopts’ within the - same shell invocation if a new set of parameters is to be used. - - When the end of options is encountered, ‘getopts’ exits with a - return value greater than zero. ‘OPTIND’ is set to the index of - the first non-option argument, and NAME is set to ‘?’. + ‘getopts’ is used by shell scripts or functions to parse positional + parameters and obtain options and their arguments. OPTSTRING + contains the option characters to be recognized; if a character is + followed by a colon, the option is expected to have an argument, + which should be separated from it by whitespace. The colon (‘:’) + and question mark (‘?’) may not be used as option characters. + + Each time it is invoked, ‘getopts’ places the next option in the + shell variable NAME, initializing NAME if it does not exist, and + the index of the next argument to be processed into the variable + ‘OPTIND’. ‘OPTIND’ is initialized to 1 each time the shell or a + shell script is invoked. When an option requires an argument, + ‘getopts’ places that argument into the variable ‘OPTARG’. + + The shell does not reset ‘OPTIND’ automatically; it must be + manually reset between multiple calls to ‘getopts’ within the same + shell invocation to use a new set of parameters. + + When it reaches the end of options, ‘getopts’ exits with a return + value greater than zero. ‘OPTIND’ is set to the index of the first + non-option argument, and NAME is set to ‘?’. ‘getopts’ normally parses the positional parameters, but if more arguments are supplied as ARG values, ‘getopts’ parses those instead. ‘getopts’ can report errors in two ways. If the first character of - OPTSTRING is a colon, SILENT error reporting is used. In normal - operation, diagnostic messages are printed when invalid options or - missing option arguments are encountered. If the variable ‘OPTERR’ - is set to 0, no error messages will be displayed, even if the first - character of ‘optstring’ is not a colon. + OPTSTRING is a colon, ‘getopts’ uses SILENT error reporting. In + normal operation, ‘getopts’ prints diagnostic messages when it + encounters invalid options or missing option arguments. If the + variable ‘OPTERR’ is set to 0, no error messages will be displayed, + even if the first character of ‘optstring’ is not a colon. If ‘getopts’ detects an invalid option, it places ‘?’ into NAME and, if not silent, prints an error message and unsets ‘OPTARG’. @@ -3462,6 +3571,10 @@ standard. it sets the value of NAME to a colon (‘:’), and sets ‘OPTARG’ to the option character found. + ‘getopts’ returns true if an option, specified or unspecified, is + found. It returns false when it encounters the end of options or + if an error occurs. + ‘hash’ hash [-r] [-p FILENAME] [-dt] [NAME] @@ -3469,70 +3582,89 @@ standard. commands specified as NAME arguments, so they need not be searched for on subsequent invocations. The commands are found by searching through the directories listed in ‘$PATH’. Any - previously-remembered filename is discarded. The ‘-p’ option - inhibits the path search, and FILENAME is used as the location of - NAME. The ‘-r’ option causes the shell to forget all remembered + previously-remembered filename associated with NAME is discarded. + The ‘-p’ option inhibits the path search, and ‘hash’ uses FILENAME + as the location of NAME. + + The ‘-r’ option causes the shell to forget all remembered locations. Assigning to the ‘PATH’ variable also clears all hashed filenames. The ‘-d’ option causes the shell to forget the - remembered location of each NAME. If the ‘-t’ option is supplied, - the full pathname to which each NAME corresponds is printed. If - multiple NAME arguments are supplied with ‘-t’, the NAME is printed - before the hashed full pathname. The ‘-l’ option causes output to - be displayed in a format that may be reused as input. If no - arguments are given, or if only ‘-l’ is supplied, information about - remembered commands is printed. The ‘-t’, ‘-d’, and ‘-p’ options - (the options that act on the NAME arguments) are mutually - exclusive. Only one will be active. If more than one is supplied, - ‘-t’ has higher priority than ‘-p’, and both are higher priority - than ‘-d’. The return status is zero unless a NAME is not found or - an invalid option is supplied. + remembered location of each NAME. + + If the ‘-t’ option is supplied, ‘hash’ prints the full pathname + corresponding to each NAME. If multiple NAME arguments are + supplied with ‘-t’, ‘hash’ prints each NAME before the + corresponding hashed full path. The ‘-l’ option displays output in + a format that may be reused as input. + + If no arguments are given, or if only ‘-l’ is supplied, ‘hash’ + prints information about remembered commands. The ‘-t’, ‘-d’, and + ‘-p’ options (the options that act on the NAME arguments) are + mutually exclusive. Only one will be active. If more than one is + supplied, ‘-t’ has higher priority than ‘-p’, and both have higher + priority than ‘-d’. + + The return status is zero unless a NAME is not found or an invalid + option is supplied. ‘pwd’ pwd [-LP] Print the absolute pathname of the current working directory. If - the ‘-P’ option is supplied, the pathname printed will not contain - symbolic links. If the ‘-L’ option is supplied, the pathname - printed may contain symbolic links. The return status is zero - unless an error is encountered while determining the name of the - current directory or an invalid option is supplied. + the ‘-P’ option is supplied, or the ‘-o physical’ option to the + ‘set’ builtin (*note The Set Builtin::) is enabled, the pathname + printed will not contain symbolic links. If the ‘-L’ option is + supplied, the pathname printed may contain symbolic links. The + return status is zero unless an error is encountered while + determining the name of the current directory or an invalid option + is supplied. ‘readonly’ readonly [-aAf] [-p] [NAME[=VALUE]] ... Mark each NAME as readonly. The values of these names may not be - changed by subsequent assignment. If the ‘-f’ option is supplied, - each NAME refers to a shell function. The ‘-a’ option means each - NAME refers to an indexed array variable; the ‘-A’ option means - each NAME refers to an associative array variable. If both options - are supplied, ‘-A’ takes precedence. If no NAME arguments are - given, or if the ‘-p’ option is supplied, a list of all readonly - names is printed. The other options may be used to restrict the - output to a subset of the set of readonly names. The ‘-p’ option - causes output to be displayed in a format that may be reused as - input. If a variable name is followed by =VALUE, the value of the - variable is set to VALUE. The return status is zero unless an - invalid option is supplied, one of the NAME arguments is not a - valid shell variable or function name, or the ‘-f’ option is - supplied with a name that is not a shell function. + changed by subsequent assignment or unset. If the ‘-f’ option is + supplied, each NAME refers to a shell function. The ‘-a’ option + means each NAME refers to an indexed array variable; the ‘-A’ + option means each NAME refers to an associative array variable. If + both options are supplied, ‘-A’ takes precedence. If no NAME + arguments are supplied, or if the ‘-p’ option is supplied, print a + list of all readonly names. The other options may be used to + restrict the output to a subset of the set of readonly names. The + ‘-p’ option displays output in a format that may be reused as + input. + + ‘readonly’ allows the value of a variable to be set at the same + time the readonly attribute is changed by following the variable + name with =VALUE. This sets the value of the variable is to VALUE + while modifying the readonly attribute. + + The return status is zero unless an invalid option is supplied, one + of the NAME arguments is not a valid shell variable or function + name, or the ‘-f’ option is supplied with a name that is not a + shell function. ‘return’ return [N] - Cause a shell function to stop executing and return the value N to - its caller. If N is not supplied, the return value is the exit - status of the last command executed in the function. If ‘return’ - is executed by a trap handler, the last command used to determine - the status is the last command executed before the trap handler. - If ‘return’ is executed during a ‘DEBUG’ trap, the last command - used to determine the status is the last command executed by the - trap handler before ‘return’ was invoked. ‘return’ may also be - used to terminate execution of a script being executed with the ‘.’ - (‘source’) builtin, returning either N or the exit status of the - last command executed within the script as the exit status of the - script. If N is supplied, the return value is its least - significant 8 bits. Any command associated with the ‘RETURN’ trap - is executed before execution resumes after the function or script. + Stop executing a shell function or sourced file and return the + value N to its caller. If N is not supplied, the return value is + the exit status of the last command executed. If ‘return’ is + executed by a trap handler, the last command used to determine the + status is the last command executed before the trap handler. If + ‘return’ is executed during a ‘DEBUG’ trap, the last command used + to determine the status is the last command executed by the trap + handler before ‘return’ was invoked. + + When ‘return’ is used to terminate execution of a script being + executed with the ‘.’ (‘source’) builtin, it returns either N or + the exit status of the last command executed within the script as + the exit status of the script. If N is supplied, the return value + is its least significant 8 bits. + + Any command associated with the ‘RETURN’ trap is executed before + execution resumes after the function or script. + The return status is non-zero if ‘return’ is supplied a non-numeric argument or is used outside a function and not during the execution of a script by ‘.’ or ‘source’. @@ -3540,12 +3672,12 @@ standard. ‘shift’ shift [N] - Shift the positional parameters to the left by N. The positional + Shift the positional parameters to the left by N: the positional parameters from N+1 ... ‘$#’ are renamed to ‘$1’ ... ‘$#’-N. Parameters represented by the numbers ‘$#’ down to ‘$#’-N+1 are unset. N must be a non-negative number less than or equal to ‘$#’. - If N is zero or greater than ‘$#’, the positional parameters are - not changed. If N is not supplied, it is assumed to be 1. The + If N is not supplied, it is assumed to be 1. If N is zero or + greater than ‘$#’, the positional parameters are not changed. The return status is zero unless N is greater than ‘$#’ or less than zero, non-zero otherwise. @@ -3558,22 +3690,20 @@ standard. argument. Expressions are composed of the primaries described below in *note Bash Conditional Expressions::. ‘test’ does not accept any options, nor does it accept and ignore an argument of - ‘--’ as signifying the end of options. - - When the ‘[’ form is used, the last argument to the command must be - a ‘]’. + ‘--’ as signifying the end of options. When using the ‘[’ form, + the last argument to the command must be a ‘]’. Expressions may be combined using the following operators, listed in decreasing order of precedence. The evaluation depends on the - number of arguments; see below. Operator precedence is used when - there are five or more arguments. + number of arguments; see below. ‘test’ uses operator precedence + when there are five or more arguments. ‘! EXPR’ True if EXPR is false. ‘( EXPR )’ - Returns the value of EXPR. This may be used to override the - normal precedence of operators. + Returns the value of EXPR. This may be used to override + normal operator precedence. ‘EXPR1 -a EXPR2’ True if both EXPR1 and EXPR2 are true. @@ -3662,15 +3792,17 @@ standard. trap [-Plp] [ACTION] [SIGSPEC ...] The ACTION is a command that is read and executed when the shell - receives signal SIGSPEC. If ACTION is absent (and there is a - single SIGSPEC) or equal to ‘-’, each specified signal's - disposition is reset to the value it had when the shell was - started. If ACTION is the null string, then the signal specified - by each SIGSPEC is ignored by the shell and commands it invokes. + receives any of the signals SIGSPEC. If ACTION is absent (and + there is a single SIGSPEC) or equal to ‘-’, each specified + SIGSPEC'ss disposition is reset to the value it had when the shell + was started. If ACTION is the null string, then the signal + specified by each SIGSPEC is ignored by the shell and commands it + invokes. If no arguments are supplied, ‘trap’ prints the actions associated with each trapped signal as a set of ‘trap’ commands that can be reused as shell input to restore the current signal dispositions. + If ACTION is not present and ‘-p’ has been supplied, ‘trap’ displays the trap commands associated with each SIGSPEC, or, if no SIGSPECs are supplied, for all trapped signals, as a set of ‘trap’ @@ -3678,26 +3810,27 @@ standard. signal dispositions. The ‘-P’ option behaves similarly, but displays only the actions associated with each SIGSPEC argument. ‘-P’ requires at least one SIGSPEC argument. The ‘-P’ or ‘-p’ - options to ‘trap’ may be used in a subshell environment (e.g., - command substitution) and, as long as they are used before ‘trap’ - is used to change a signal's handling, will display the state of - its parent's traps. + options may be used in a subshell environment (e.g., command + substitution) and, as long as they are used before ‘trap’ is used + to change a signal's handling, will display the state of its + parent's traps. - The ‘-l’ option causes ‘trap’ to print a list of signal names and - their corresponding numbers. Each SIGSPEC is either a signal name - or a signal number. Signal names are case insensitive and the - ‘SIG’ prefix is optional. + The ‘-l’ option prints a list of signal names and their + corresponding numbers. Each SIGSPEC is either a signal name or a + signal number. Signal names are case insensitive and the ‘SIG’ + prefix is optional. If ‘-l’ is supplied with no SIGSPEC arguments, + it prints a list of valid signal names. If a SIGSPEC is ‘0’ or ‘EXIT’, ACTION is executed when the shell exits. If a SIGSPEC is ‘DEBUG’, ACTION is executed before every simple command, ‘for’ command, ‘case’ command, ‘select’ command, (( arithmetic command, [[ conditional command, arithmetic ‘for’ command, and before the first command executes in a shell function. - Refer to the description of the ‘extdebug’ option to the ‘shopt’ - builtin (*note The Shopt Builtin::) for details of its effect on - the ‘DEBUG’ trap. If a SIGSPEC is ‘RETURN’, ACTION is executed - each time a shell function or a script executed with the ‘.’ or - ‘source’ builtins finishes executing. + Refer to the description of the ‘extdebug’ shell option (*note The + Shopt Builtin::) for details of its effect on the ‘DEBUG’ trap. If + a SIGSPEC is ‘RETURN’, ACTION is executed each time a shell + function or a script executed with the ‘.’ or ‘source’ builtins + finishes executing. If a SIGSPEC is ‘ERR’, ACTION is executed whenever a pipeline (which may consist of a single simple command), a list, or a @@ -3707,18 +3840,19 @@ standard. ‘until’ or ‘while’ keyword, part of the test following the ‘if’ or ‘elif’ reserved words, part of a command executed in a ‘&&’ or ‘||’ list except the command following the final ‘&&’ or ‘||’, any - command in a pipeline but the last, or if the command's return - status is being inverted using ‘!’. These are the same conditions - obeyed by the ‘errexit’ (‘-e’) option. + command in a pipeline but the last, (subject to the state of the + ‘pipefail’ shell option), or if the command's return status is + being inverted using ‘!’. These are the same conditions obeyed by + the ‘errexit’ (‘-e’) option. - Signals ignored upon entry to a non-interactive shell cannot be - trapped or reset. Interactive shells permit trapping signals - ignored on entry. Trapped signals that are not being ignored are - reset to their original values in a subshell or subshell - environment when one is created. + When the shell is not interactive, signals ignored upon entry to a + non-interactive shell cannot be trapped or reset. Interactive + shells permit trapping signals ignored on entry. Trapped signals + that are not being ignored are reset to their original values in a + subshell or subshell environment when one is created. The return status is zero unless a SIGSPEC does not specify a valid - signal. + signal; non-zero otherwise. ‘true’ true @@ -3731,13 +3865,13 @@ standard. Set the shell process's file creation mask to MODE. If MODE begins with a digit, it is interpreted as an octal number; if not, it is interpreted as a symbolic mode mask similar to that accepted by the - ‘chmod’ command. If MODE is omitted, the current value of the mask - is printed. If the ‘-S’ option is supplied without a MODE - argument, the mask is printed in a symbolic format. If the ‘-p’ - option is supplied, and MODE is omitted, the output is in a form - that may be reused as input. The return status is zero if the mode - is successfully changed or if no MODE argument is supplied, and - non-zero otherwise. + ‘chmod’ command. If MODE is omitted, ‘umask’ prints the current + value of the mask. If the ‘-S’ option is supplied without a MODE + argument, ‘umask’ prints the mask in a symbolic format; the default + output is an octal number. If the ‘-p’ option is supplied, and + MODE is omitted, the output is in a form that may be reused as + input. The return status is zero if the mode is successfully + changed or if no MODE argument is supplied, and non-zero otherwise. Note that when the mode is interpreted as an octal number, each number of the umask is subtracted from ‘7’. Thus, a umask of ‘022’ @@ -3755,11 +3889,13 @@ standard. references. ‘-n’ has no effect if the ‘-f’ option is supplied. If no options are supplied, each NAME refers to a variable; if there is no variable by that name, a function with that name, if any, is - unset. Readonly variables and functions may not be unset. Some - shell variables lose their special behavior if they are unset; such - behavior is noted in the description of the individual variables. - The return status is zero unless a NAME is readonly or may not be - unset. + unset. Readonly variables and functions may not be unset. When + variables or functions are removed, they are also removed from the + environment passed to subsequent commands. Some shell variables + may not be unset. Some shell variables lose their special behavior + if they are unset; such behavior is noted in the description of the + individual variables. The return status is zero unless a NAME is + readonly or may not be unset.  File: bash.info, Node: Bash Builtins, Next: Modifying Shell Behavior, Prev: Bourne Shell Builtins, Up: Shell Builtin Commands @@ -3776,10 +3912,13 @@ standard. Without arguments or with the ‘-p’ option, ‘alias’ prints the list of aliases on the standard output in a form that allows them to be - reused as input. If arguments are supplied, an alias is defined - for each NAME whose VALUE is given. If no VALUE is given, the name - and value of the alias is printed. Aliases are described in *note - Aliases::. + reused as input. If arguments are supplied, define an alias for + each NAME whose VALUE is given. If no VALUE is given, print the + name and value of the alias NAME. A trailing space in VALUE causes + the next word to be checked for alias substitution when the alias + is expanded during command parsing. ‘alias’ returns true unless a + NAME is given (without a corresponding =VALUE) for which no alias + has been defined. Aliases are described in *note Aliases::. ‘bind’ bind [-m KEYMAP] [-lsvSVX] @@ -3793,10 +3932,16 @@ standard. Display current Readline (*note Command Line Editing::) key and function bindings, bind a key sequence to a Readline function or - macro, or set a Readline variable. Each non-option argument is a - command as it would appear in a Readline initialization file (*note - Readline Init File::), but each binding or command must be passed - as a separate argument; e.g., ‘"\C-x\C-r":re-read-init-file’. + macro or to a shell command, or set a Readline variable. Each + non-option argument is a key binding or command as it would appear + in a Readline initialization file (*note Readline Init File::), but + each binding or command must be passed as a separate argument; + e.g., ‘"\C-x\C-r":re-read-init-file’. + + In the following descriptions, options that display output in a + form available to be re-read format their output as commands that + would appear in a Readline initialization file or that would be + supplied as individual arguments to a ‘bind’ command. Options, if supplied, have the following meanings: @@ -3823,14 +3968,6 @@ standard. arguments remain after option processing, ‘bind’ treats them as readline command names and restricts output to those names. - ‘-v’ - Display Readline variable names and values in such a way that - they can be used as an argument to a subsequent ‘bind’ command - or in a Readline initialization file. - - ‘-V’ - List current Readline variable names and values. - ‘-s’ Display Readline key sequences bound to macros and the strings they output in such a way that they can be used as an argument @@ -3841,14 +3978,22 @@ standard. Display Readline key sequences bound to macros and the strings they output. + ‘-v’ + Display Readline variable names and values in such a way that + they can be used as an argument to a subsequent ‘bind’ command + or in a Readline initialization file. + + ‘-V’ + List current Readline variable names and values. + ‘-f FILENAME’ Read key bindings from FILENAME. ‘-q FUNCTION’ - Query about which keys invoke the named FUNCTION. + Display key sequences that invoke the named Readline FUNCTION. ‘-u FUNCTION’ - Unbind all keys bound to the named FUNCTION. + Unbind all key sequences bound to the named Readline FUNCTION. ‘-r KEYSEQ’ Remove any current binding for KEYSEQ. @@ -3863,8 +4008,8 @@ standard. separator is a colon, any enclosing double quotes are optional, and Readline does not expand the command string before saving it. Since the entire key binding expression - must be a single argument, it should be enclosed in quotes. - When SHELL-COMMAND is executed, the shell sets the + must be a single argument, it should be enclosed in single + quotes. When SHELL-COMMAND is executed, the shell sets thex ‘READLINE_LINE’ variable to the contents of the Readline line buffer and the ‘READLINE_POINT’ and ‘READLINE_MARK’ variables to the current location of the insertion point and the saved @@ -3887,11 +4032,11 @@ standard. ‘builtin’ builtin [SHELL-BUILTIN [ARGS]] - Run a shell builtin, passing it ARGS, and return its exit status. - This is useful when defining a shell function with the same name as - a shell builtin, retaining the functionality of the builtin within - the function. The return status is non-zero if SHELL-BUILTIN is - not a shell builtin command. + Execute the specified shell builtin SHELL-BUILTIN, passing it ARGS, + and return its exit status. This is useful when defining a shell + function with the same name as a shell builtin, retaining the + functionality of the builtin within the function. The return + status is non-zero if SHELL-BUILTIN is not a shell builtin command. ‘caller’ caller [EXPR] @@ -3913,28 +4058,28 @@ standard. ‘command’ command [-pVv] COMMAND [ARGUMENTS ...] - Runs COMMAND with ARGUMENTS ignoring any shell function named - COMMAND. Only shell builtin commands or commands found by - searching the ‘PATH’ are executed. If there is a shell function - named ‘ls’, running ‘command ls’ within the function will execute - the external command ‘ls’ instead of calling the function - recursively. The ‘-p’ option means to use a default value for - ‘PATH’ that is guaranteed to find all of the standard utilities. - The return status in this case is 127 if COMMAND cannot be found or - an error occurred, and the exit status of COMMAND otherwise. - - If either the ‘-V’ or ‘-v’ option is supplied, a description of - COMMAND is printed. The ‘-v’ option causes a single word - indicating the command or file name used to invoke COMMAND to be - displayed; the ‘-V’ option produces a more verbose description. In - this case, the return status is zero if COMMAND is found, and - non-zero if not. + The ‘command’ builtin runs COMMAND with ARGUMENTS ignoring any + shell function named COMMAND. Only shell builtin commands or + commands found by searching the ‘PATH’ are executed. If there is a + shell function named ‘ls’, running ‘command ls’ within the function + will execute the external command ‘ls’ instead of calling the + function recursively. The ‘-p’ option means to use a default value + for ‘PATH’ that is guaranteed to find all of the standard + utilities. The return status in this case is 127 if COMMAND cannot + be found or an error occurred, and the exit status of COMMAND + otherwise. + + If either the ‘-V’ or ‘-v’ option is supplied, ‘command’ prints a + description of COMMAND. The ‘-v’ option displays a single word + indicating the command or file name used to invoke COMMAND; the + ‘-V’ option produces a more verbose description. In this case, the + return status is zero if COMMAND is found, and non-zero if not. ‘declare’ declare [-aAfFgiIlnrtux] [-p] [NAME[=VALUE] ...] Declare variables and give them attributes. If no NAMEs are given, - then display the values of variables instead. + then display the values of variables or shell functions instead. The ‘-p’ option will display the attributes and values of each NAME. When ‘-p’ is used with NAME arguments, additional options, @@ -3944,8 +4089,8 @@ standard. display the attributes and values of all variables having the attributes specified by the additional options. If no other options are supplied with ‘-p’, ‘declare’ will display the - attributes and values of all shell variables. The ‘-f’ option will - restrict the display to shell functions. + attributes and values of all shell variables. The ‘-f’ option + restricts the display to shell functions. The ‘-F’ option inhibits the display of function definitions; only the function name and attributes are printed. If the ‘extdebug’ @@ -3955,7 +4100,8 @@ standard. The ‘-g’ option forces variables to be created or modified at the global scope, even when ‘declare’ is executed in a shell function. - It is ignored in all other cases. + It is ignored in when ‘declare’ is not executed in a shell + function. The ‘-I’ option causes local variables to inherit the attributes (except the ‘nameref’ attribute) and value of any existing variable @@ -3972,7 +4118,7 @@ standard. Each NAME is an associative array variable (*note Arrays::). ‘-f’ - Use function names only. + Each NAME refers to a shell function. ‘-i’ The variable is to be treated as an integer; arithmetic @@ -4011,13 +4157,14 @@ standard. Mark each NAME for export to subsequent commands via the environment. - Using ‘+’ instead of ‘-’ turns off the attribute instead, with the - exceptions that ‘+a’ and ‘+A’ may not be used to destroy array - variables and ‘+r’ will not remove the readonly attribute. When - used in a function, ‘declare’ makes each NAME local, as with the - ‘local’ command, unless the ‘-g’ option is used. If a variable - name is followed by =VALUE, the value of the variable is set to - VALUE. + Using ‘+’ instead of ‘-’ turns off the specified attribute instead, + with the exceptions that ‘+a’ and ‘+A’ may not be used to destroy + array variables and ‘+r’ will not remove the readonly attribute. + + When used in a function, ‘declare’ makes each NAME local, as with + the ‘local’ command, unless the ‘-g’ option is supplied. If a + variable name is followed by =VALUE, the value of the variable is + set to VALUE. When using ‘-a’ or ‘-A’ and the compound assignment syntax to create array variables, additional attributes do not take effect @@ -4038,14 +4185,15 @@ standard. Output the ARGs, separated by spaces, terminated with a newline. The return status is 0 unless a write error occurs. If ‘-n’ is - specified, the trailing newline is suppressed. If the ‘-e’ option - is given, interpretation of the following backslash-escaped - characters is enabled. The ‘-E’ option disables the interpretation - of these escape characters, even on systems where they are - interpreted by default. The ‘xpg_echo’ shell option may be used to - dynamically determine whether or not ‘echo’ interprets any options - and expands these escape characters by default. ‘echo’ does not - interpret ‘--’ to mean the end of options. + specified, the trailing newline is not printed. + + If the ‘-e’ option is given, ‘echo’ interprets the following + backslash-escaped characters. The ‘-E’ option disables + interpretation of these escape characters, even on systems where + they are interpreted by default. The ‘xpg_echo’ shell option + determines whether or not ‘echo’ interprets any options and expands + these escape characters. ‘echo’ does not interpret ‘--’ to mean + the end of options. ‘echo’ interprets the following escape sequences: ‘\a’ @@ -4082,36 +4230,38 @@ standard. the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value HHHHHHHH (one to eight hex digits) + ‘echo’ writes any unrecognized backslash-escaped characters + unchanged. + ‘enable’ enable [-a] [-dnps] [-f FILENAME] [NAME ...] Enable and disable builtin shell commands. Disabling a builtin - allows a disk command which has the same name as a shell builtin to - be executed without specifying a full pathname, even though the - shell normally searches for builtins before disk commands. If ‘-n’ - is used, the NAMEs become disabled. Otherwise NAMEs are enabled. - For example, to use the ‘test’ binary found via ‘$PATH’ instead of - the shell builtin version, type ‘enable -n test’. - - If the ‘-p’ option is supplied, or no NAME arguments appear, a list - of shell builtins is printed. With no other arguments, the list - consists of all enabled shell builtins. The ‘-a’ option means to - list each builtin with an indication of whether or not it is - enabled. + allows an executable file which has the same name as a shell + builtin to be executed without specifying a full pathname, even + though the shell normally searches for builtins before files. + + If ‘-n’ is supplied, the NAMEs are disabled. Otherwise NAMEs are + enabled. For example, to use the ‘test’ binary found using ‘$PATH’ + instead of the shell builtin version, type ‘enable -n test’. + + If the ‘-p’ option is supplied, or no NAME arguments are supplied, + print a list of shell builtins. With no other arguments, the list + consists of all enabled shell builtins. The ‘-n’ option means to + print only disabled builtins. The ‘-a’ option means to list each + builtin with an indication of whether or not it is enabled. The + ‘-s’ option means to restrict ‘enable’ to the POSIX special + builtins. The ‘-f’ option means to load the new builtin command NAME from shared object FILENAME, on systems that support dynamic loading. - Bash will use the value of the ‘BASH_LOADABLES_PATH’ variable as a - colon-separated list of directories in which to search for - FILENAME, if FILENAME does not contain a slash. The default is - system-dependent, and may include "." to force a search of the - current directory. The ‘-d’ option will delete a builtin loaded - with ‘-f’. - - If there are no options, a list of the shell builtins is displayed. - The ‘-s’ option restricts ‘enable’ to the POSIX special builtins. - If ‘-s’ is used with ‘-f’, the new builtin becomes a special - builtin (*note Special Builtins::). + If FILENAME does not contain a slash. Bash will use the value of + the ‘BASH_LOADABLES_PATH’ variable as a colon-separated list of + directories in which to search for FILENAME. The default for + ‘BASH_LOADABLES_PATH’ is system-dependent, and may include "." to + force a search of the current directory. The ‘-d’ option will + delete a builtin loaded with ‘-f’. If ‘-s’ is used with ‘-f’, the + new builtin becomes a special builtin (*note Special Builtins::). If no options are supplied and a NAME is not a shell builtin, ‘enable’ will attempt to load NAME from a shared object named NAME, @@ -4125,7 +4275,8 @@ standard. Display helpful information about builtin commands. If PATTERN is specified, ‘help’ gives detailed help on all commands matching - PATTERN, otherwise a list of the builtins is printed. + PATTERN, otherwise it displays a list of all builtins and shell + compound commands. Options, if supplied, have the following meanings: @@ -4143,25 +4294,34 @@ standard. let EXPRESSION [EXPRESSION ...] The ‘let’ builtin allows arithmetic to be performed on shell - variables. Each EXPRESSION is evaluated according to the rules - given below in *note Shell Arithmetic::. If the last EXPRESSION - evaluates to 0, ‘let’ returns 1; otherwise 0 is returned. + variables. Each EXPRESSION is evaluated as an arithmetic + expression according to the rules given below in *note Shell + Arithmetic::. If the last EXPRESSION evaluates to 0, ‘let’ returns + 1; otherwise ‘let’ returns 0. ‘local’ local [OPTION] NAME[=VALUE] ... - For each argument, a local variable named NAME is created, and - assigned VALUE. The OPTION can be any of the options accepted by + For each argument, create a local variable named NAME, and assign + it VALUE. The OPTION can be any of the options accepted by ‘declare’. ‘local’ can only be used within a function; it makes the variable NAME have a visible scope restricted to that function - and its children. If NAME is ‘-’, the set of shell options is made - local to the function in which ‘local’ is invoked: shell options - changed using the ‘set’ builtin inside the function after the call - to ‘local’ are restored to their original values when the function - returns. The restore is effected as if a series of ‘set’ commands + and its children. It is an error to use ‘local’ when not within a + function. + + If NAME is ‘-’, it makes the set of shell options local to the + function in which ‘local’ is invoked: any shell options changed + using the ‘set’ builtin inside the function after the call to + ‘local’ are restored to their original values when the function + returns. The restore is performed as if a series of ‘set’ commands were executed to restore the values that were in place before the - function. The return status is zero unless ‘local’ is used outside - a function, an invalid NAME is supplied, or NAME is a readonly + function. + + With no operands, ‘local’ writes a list of local variables to the + standard output. + + The return status is zero unless ‘local’ is used outside a + function, an invalid NAME is supplied, or NAME is a readonly variable. ‘logout’ @@ -4173,18 +4333,17 @@ standard. mapfile [-d DELIM] [-n COUNT] [-O ORIGIN] [-s COUNT] [-t] [-u FD] [-C CALLBACK] [-c QUANTUM] [ARRAY] - Read lines from the standard input into the indexed array variable - ARRAY, or from file descriptor FD if the ‘-u’ option is supplied. + Read lines from the standard input, or from file descriptor FD if + the ‘-u’ option is supplied, into the indexed array variable ARRAY. The variable ‘MAPFILE’ is the default ARRAY. Options, if supplied, have the following meanings: ‘-d’ - The first character of DELIM is used to terminate each input - line, rather than newline. If DELIM is the empty string, - ‘mapfile’ will terminate a line when it reads a NUL character. + Use the first character of DELIM to terminate each input line, + rather than newline. If DELIM is the empty string, ‘mapfile’ + will terminate a line when it reads a NUL character. ‘-n’ - Copy at most COUNT lines. If COUNT is 0, all lines are - copied. + Copy at most COUNT lines. If COUNT is 0, copy all lines. ‘-O’ Begin assigning to ARRAY at index ORIGIN. The default index is 0. @@ -4211,17 +4370,16 @@ standard. If not supplied with an explicit origin, ‘mapfile’ will clear ARRAY before assigning to it. - ‘mapfile’ returns successfully unless an invalid option or option - argument is supplied, ARRAY is invalid or unassignable, or ARRAY is - not an indexed array. + ‘mapfile’ returns zero unless an invalid option or option argument + is supplied, ARRAY is invalid or unassignable, or if ARRAY is not + an indexed array. ‘printf’ printf [-v VAR] FORMAT [ARGUMENTS] Write the formatted ARGUMENTS to the standard output under the - control of the FORMAT. The ‘-v’ option causes the output to be - assigned to the variable VAR rather than being printed to the - standard output. + control of the FORMAT. The ‘-v’ option assigns the output to the + variable VAR rather than printing it to the standard output. The FORMAT is a character string which contains three types of objects: plain characters, which are simply copied to standard @@ -4252,11 +4410,12 @@ standard. Causes ‘printf’ to output the date-time string resulting from using DATEFMT as a format string for ‘strftime’(3). The corresponding ARGUMENT is an integer representing the number - of seconds since the epoch. Two special argument values may - be used: -1 represents the current time, and -2 represents the - time the shell was invoked. If no argument is specified, - conversion behaves as if -1 had been given. This is an - exception to the usual ‘printf’ behavior. + of seconds since the epoch. This format specifier recognizes + Two special argument values: -1 represents the current time, + and -2 represents the time the shell was invoked. If no + argument is specified, conversion behaves as if -1 had been + supplied. This is an exception to the usual ‘printf’ + behavior. The %b, %q, and %T format specifiers all use the field width and precision arguments from the format specification and write that @@ -4289,19 +4448,19 @@ standard. read [-Eers] [-a ANAME] [-d DELIM] [-i TEXT] [-n NCHARS] [-N NCHARS] [-p PROMPT] [-t TIMEOUT] [-u FD] [NAME ...] - One line is read from the standard input, or from the file - descriptor FD supplied as an argument to the ‘-u’ option, split - into words as described above in *note Word Splitting::, and the - first word is assigned to the first NAME, the second word to the - second NAME, and so on. If there are more words than names, the - remaining words and their intervening delimiters are assigned to - the last NAME. If there are fewer words read from the input stream - than names, the remaining names are assigned empty values. The - characters in the value of the ‘IFS’ variable are used to split the - line into words using the same rules the shell uses for expansion - (described above in *note Word Splitting::). The backslash - character ‘\’ may be used to remove any special meaning for the - next character read and for line continuation. + Read one line from the standard input, or from the file descriptor + FD supplied as an argument to the ‘-u’ option, split it into words + as described above in *note Word Splitting::, and assign the first + word to the first NAME, the second word to the second NAME, and so + on. If there are more words than names, the remaining words and + their intervening delimiters are assigned to the last NAME. If + there are fewer words read from the input stream than names, the + remaining names are assigned empty values. The characters in the + value of the ‘IFS’ variable are used to split the line into words + using the same rules the shell uses for expansion (described above + in *note Word Splitting::). The backslash character ‘\’ removes + any special meaning for the next character read and is used for + line continuation. Options, if supplied, have the following meanings: @@ -4312,45 +4471,48 @@ standard. ignored. ‘-d DELIM’ - The first character of DELIM is used to terminate the input - line, rather than newline. If DELIM is the empty string, - ‘read’ will terminate a line when it reads a NUL character. + The first character of DELIM terminates the input line, rather + than newline. If DELIM is the empty string, ‘read’ will + terminate a line when it reads a NUL character. ‘-e’ - Readline (*note Command Line Editing::) is used to obtain the - line. Readline uses the current (or default, if line editing - was not previously active) editing settings, but uses - Readline's default filename completion. + If the standard input is coming from a terminal, ‘read’ uses + Readline (*note Command Line Editing::) to obtain the line. + Readline uses the current (or default, if line editing was not + previously active) editing settings, but uses Readline's + default filename completion. ‘-E’ - Readline (*note Command Line Editing::) is used to obtain the - line. Readline uses the current (or default, if line editing - was not previously active) editing settings, but uses Bash's - default completion, including programmable completion. + If the standard input is coming from a terminal, ‘read’ uses + Readline (*note Command Line Editing::) to obtain the line. + Readline uses the current (or default, if line editing was not + previously active) editing settings, but uses Bash's default + completion, including programmable completion. ‘-i TEXT’ - If Readline is being used to read the line, TEXT is placed + If Readline is being used to read the line, ‘read’ places TEXT into the editing buffer before editing begins. ‘-n NCHARS’ ‘read’ returns after reading NCHARS characters rather than - waiting for a complete line of input, but honors a delimiter - if fewer than NCHARS characters are read before the delimiter. + waiting for a complete line of input, unless it encounters EOF + or ‘read’ times out, but honors a delimiter if it reads fewer + than NCHARS characters before the delimiter. ‘-N NCHARS’ ‘read’ returns after reading exactly NCHARS characters rather - than waiting for a complete line of input, unless EOF is - encountered or ‘read’ times out. Delimiter characters - encountered in the input are not treated specially and do not - cause ‘read’ to return until NCHARS characters are read. The - result is not split on the characters in ‘IFS’; the intent is - that the variable is assigned exactly the characters read - (with the exception of backslash; see the ‘-r’ option below). + than waiting for a complete line of input, unless it + encounters EOF or ‘read’ times out. Delimiter characters in + the input are not treated specially and do not cause ‘read’ to + return until it has read NCHARS characters. The result is not + split on the characters in ‘IFS’; the intent is that the + variable is assigned exactly the characters read (with the + exception of backslash; see the ‘-r’ option below). ‘-p PROMPT’ Display PROMPT, without a trailing newline, before attempting - to read any input. The prompt is displayed only if input is - coming from a terminal. + to read any input, but only if input is coming from a + terminal. ‘-r’ If this option is given, backslash does not act as an escape @@ -4363,33 +4525,35 @@ standard. are not echoed. ‘-t TIMEOUT’ - Cause ‘read’ to time out and return failure if a complete line - of input (or a specified number of characters) is not read - within TIMEOUT seconds. TIMEOUT may be a decimal number with - a fractional portion following the decimal point. This option - is only effective if ‘read’ is reading input from a terminal, - pipe, or other special file; it has no effect when reading - from regular files. If ‘read’ times out, ‘read’ saves any - partial input read into the specified variable NAME. If - TIMEOUT is 0, ‘read’ returns immediately, without trying to - read any data. The exit status is 0 if input is available on - the specified file descriptor, or the read will return EOF, - non-zero otherwise. The exit status is greater than 128 if - the timeout is exceeded. + Cause ‘read’ to time out and return failure if it does not + read a complete line of input (or a specified number of + characters) within TIMEOUT seconds. TIMEOUT may be a decimal + number with a fractional portion following the decimal point. + This option is only effective if ‘read’ is reading input from + a terminal, pipe, or other special file; it has no effect when + reading from regular files. If ‘read’ times out, it saves any + partial input read into the specified variable NAME, and + returns a status greater than 128. If TIMEOUT is 0, ‘read’ + returns immediately, without trying to read any data. In this + case, the exit status is 0 if input is available on the + specified file descriptor, or the read will return EOF, + non-zero otherwise. ‘-u FD’ - Read input from file descriptor FD. + Read input from file descriptor FD instead of the standard + input. Other than the case where DELIM is the empty string, ‘read’ ignores any NUL characters in the input. - If no NAMEs are supplied, the line read, without the ending - delimiter but otherwise unmodified, is assigned to the variable - ‘REPLY’. The exit status is zero, unless end-of-file is - encountered, ‘read’ times out (in which case the status is greater - than 128), a variable assignment error (such as assigning to a - readonly variable) occurs, or an invalid file descriptor is - supplied as the argument to ‘-u’. + If no NAMEs are supplied, ‘read’ assigns the line read, without the + ending delimiter but otherwise unmodified, to the variable ‘REPLY’. + + The exit status is zero, unless end-of-file is encountered, ‘read’ + times out (in which case the status is greater than 128), a + variable assignment error (such as assigning to a readonly + variable) occurs, or an invalid file descriptor is supplied as the + argument to ‘-u’. ‘readarray’ readarray [-d DELIM] [-n COUNT] [-O ORIGIN] [-s COUNT] @@ -4408,19 +4572,18 @@ standard. ‘type’ type [-afptP] [NAME ...] - For each NAME, indicate how it would be interpreted if used as a - command name. + Indicate how each NAME would be interpreted if used as a command + name. If the ‘-t’ option is used, ‘type’ prints a single word which is one of ‘alias’, ‘keyword’, ‘function’, ‘builtin’, or ‘file’, if NAME is an alias, shell reserved word, shell function, shell - builtin, or executable disk file, respectively. If the NAME is not - found, then nothing is printed, and ‘type’ returns a failure - status. + builtin, or executable file, respectively. If the NAME is not + found, ‘type’ prints nothing and returns a failure status. If the ‘-p’ option is used, ‘type’ either returns the name of the - executable file that would be found by searching ‘$PATH’, or - nothing if ‘-t’ would not return ‘file’. + executable file that would be found by searching ‘$PATH’ for + ‘name’, or nothing if ‘-t’ would not return ‘file’. The ‘-P’ option forces a path search for each NAME, even if ‘-t’ would not return ‘file’. @@ -4453,9 +4616,9 @@ standard. ulimit [-HS] -a ulimit [-HS] [-bcdefiklmnpqrstuvxPRT] [LIMIT] - ‘ulimit’ provides control over the resources available to processes - started by the shell, on systems that allow such control. If an - option is given, it is interpreted as follows: + ‘ulimit’ provides control over the resources available to the shell + and to processes it starts, on systems that allow such control. If + an option is given, it is interpreted as follows: ‘-S’ Change and report the soft limit associated with a resource. @@ -4464,7 +4627,7 @@ standard. Change and report the hard limit associated with a resource. ‘-a’ - All current limits are reported; no limits are set. + Report all current limits; no limits are set. ‘-b’ The maximum socket buffer size. @@ -4534,23 +4697,25 @@ standard. ‘-T’ The maximum number of threads. - If LIMIT is given, and the ‘-a’ option is not used, LIMIT is the + If LIMIT is supplied, and the ‘-a’ option is not used, LIMIT is the new value of the specified resource. The special LIMIT values ‘hard’, ‘soft’, and ‘unlimited’ stand for the current hard limit, the current soft limit, and no limit, respectively. A hard limit cannot be increased by a non-root user once it is set; a soft limit - may be increased up to the value of the hard limit. Otherwise, the - current value of the soft limit for the specified resource is - printed, unless the ‘-H’ option is supplied. When more than one - resource is specified, the limit name and unit, if appropriate, are - printed before the value. When setting new limits, if neither ‘-H’ - nor ‘-S’ is supplied, both the hard and soft limits are set. If no - option is given, then ‘-f’ is assumed. Values are in 1024-byte - increments, except for ‘-t’, which is in seconds; ‘-R’, which is in - microseconds; ‘-p’, which is in units of 512-byte blocks; ‘-P’, - ‘-T’, ‘-b’, ‘-k’, ‘-n’ and ‘-u’, which are unscaled values; and, - when in POSIX Mode (*note Bash POSIX Mode::), ‘-c’ and ‘-f’, which - are in 512-byte increments. + may be increased up to the value of the hard limit. Otherwise, + ‘ulimit’ prints the current value of the soft limit for the + specified resource, unless the ‘-H’ option is supplied. When more + than one resource is specified, the limit name and unit, if + appropriate, are printed before the value. When setting new + limits, if neither ‘-H’ nor ‘-S’ is supplied, ‘ulimit’ sets both + the hard and soft limits. If no option is supplied, then ‘-f’ is + assumed. + + Values are in 1024-byte increments, except for ‘-t’, which is in + seconds; ‘-R’, which is in microseconds; ‘-p’, which is in units of + 512-byte blocks; ‘-P’, ‘-T’, ‘-b’, ‘-k’, ‘-n’ and ‘-u’, which are + unscaled values; and, when in POSIX Mode (*note Bash POSIX Mode::), + ‘-c’ and ‘-f’, which are in 512-byte increments. The return status is zero unless an invalid option or argument is supplied, or an error occurs while setting a new limit. @@ -4559,7 +4724,9 @@ standard. unalias [-a] [NAME ... ] Remove each NAME from the list of aliases. If ‘-a’ is supplied, - all aliases are removed. Aliases are described in *note Aliases::. + remove all aliases. The return value is true unless a supplied + NAME is not a defined alias. Aliases are described in *note + Aliases::.  File: bash.info, Node: Modifying Shell Behavior, Next: Special Builtins, Prev: Bash Builtins, Up: Shell Builtin Commands @@ -4596,7 +4763,10 @@ parameters, or to display the names and values of shell variables. variables cannot be reset. In POSIX mode, only shell variables are listed. - When options are supplied, they set or unset shell attributes. + When options are supplied, they set or unset shell attributes. Any + arguments remaining after option processing replace the positional + parameters. + Options, if specified, have the following meanings: ‘-a’ @@ -4607,7 +4777,8 @@ parameters, or to display the names and values of shell variables. ‘-b’ Cause the status of terminated background jobs to be reported immediately, rather than before printing the next primary - prompt. + prompt or, under some circumstances, when a foreground command + exits. This is effective only when job control is enabled. ‘-e’ Exit immediately if a pipeline (*note Pipelines::), which may @@ -4794,7 +4965,7 @@ parameters, or to display the names and values of shell variables. ‘-x’ Print a trace of simple commands, ‘for’ commands, ‘case’ commands, ‘select’ commands, and arithmetic ‘for’ commands and - their arguments or associated word lists to standard error + their arguments or associated word lists to the standard error after they are expanded and before they are executed. The shell prints the expanded value of the ‘PS4’ variable before the command and its expanded arguments. @@ -4805,7 +4976,9 @@ parameters, or to display the names and values of shell variables. ‘-C’ Prevent output redirection using ‘>’, ‘>&’, and ‘<>’ from - overwriting existing files. + overwriting existing files. Using the redirection operator + ‘>|’ instead of ‘>’ will override this and force the creation + of an output file. ‘-E’ If set, any trap on ‘ERR’ is inherited by shell functions, @@ -4819,11 +4992,11 @@ parameters, or to display the names and values of shell variables. shells. ‘-P’ - If set, do not resolve symbolic links when performing commands - such as ‘cd’ which change the current directory. The physical - directory is used instead. By default, Bash follows the - logical chain of directories when performing commands which - change the current directory. + If set, Bash does not resolve symbolic links when executing + commands such as ‘cd’ which change the current directory. It + uses the physical directory structure instead. By default, + Bash follows the logical chain of directories when performing + commands which change the current directory. For example, if ‘/usr/sys’ is a symbolic link to ‘/usr/local/sys’ then: @@ -4839,22 +5012,21 @@ parameters, or to display the names and values of shell variables. /usr/local ‘-T’ - If set, any trap on ‘DEBUG’ and ‘RETURN’ are inherited by + If set, any traps on ‘DEBUG’ and ‘RETURN’ are inherited by shell functions, command substitutions, and commands executed in a subshell environment. The ‘DEBUG’ and ‘RETURN’ traps are normally not inherited in such cases. ‘--’ - If no arguments follow this option, then the positional - parameters are unset. Otherwise, the positional parameters - are set to the ARGUMENTS, even if some of them begin with a - ‘-’. + If no arguments follow this option, unset the positional + parameters. Otherwise, the positional parameters are set to + the ARGUMENTS, even if some of them begin with a ‘-’. ‘-’ - Signal the end of options, cause all remaining ARGUMENTS to be - assigned to the positional parameters. The ‘-x’ and ‘-v’ - options are turned off. If there are no arguments, the - positional parameters remain unchanged. + Signal the end of options, and assign all remaining ARGUMENTS + to the positional parameters. The ‘-x’ and ‘-v’ options are + turned off. If there are no arguments, the positional + parameters remain unchanged. Using ‘+’ rather than ‘-’ causes these options to be turned off. The options can also be used upon invocation of the shell. The @@ -4873,7 +5045,7 @@ File: bash.info, Node: The Shopt Builtin, Prev: The Set Builtin, Up: Modifyin 4.3.2 The Shopt Builtin ----------------------- -This builtin allows you to change additional shell optional behavior. +This builtin allows you to change additional optional shell behavior. ‘shopt’ shopt [-pqsu] [-o] [OPTNAME ...] @@ -4882,11 +5054,11 @@ This builtin allows you to change additional shell optional behavior. The settings can be either those listed below, or, if the ‘-o’ option is used, those available with the ‘-o’ option to the ‘set’ builtin command (*note The Set Builtin::). With no options, or - with the ‘-p’ option, a list of all settable options is displayed, - with an indication of whether or not each is set; if OPTNAMEs are + with the ‘-p’ option, display a list of all settable options, with + an indication of whether or not each is set; if any OPTNAMEs are supplied, the output is restricted to those options. The ‘-p’ - option causes output to be displayed in a form that may be reused - as input. Other options have the following meanings: + option displays output in a form that may be reused as input. + Other options have the following meanings: ‘-s’ Enable (set) each OPTNAME. @@ -4897,8 +5069,8 @@ This builtin allows you to change additional shell optional behavior. ‘-q’ Suppresses normal output; the return status indicates whether the OPTNAME is set or unset. If multiple OPTNAME arguments - are given with ‘-q’, the return status is zero if all OPTNAMEs - are enabled; non-zero otherwise. + are supplied with ‘-q’, the return status is zero if all + OPTNAMEs are enabled; non-zero otherwise. ‘-o’ Restricts the values of OPTNAME to be those defined for the @@ -4942,25 +5114,24 @@ This builtin allows you to change additional shell optional behavior. whose value is the directory to change to. ‘cdspell’ - If set, minor errors in the spelling of a directory component - in a ‘cd’ command will be corrected. The errors checked for - are transposed characters, a missing character, and a - character too many. If a correction is found, the corrected - path is printed, and the command proceeds. This option is + If set, the ‘cd’ command attempts to correct minor errors in + the spelling of a directory component. Minor errors include + transposed characters, a missing character, and one extra + character. If ‘cd’ corrects the directory name, it prints the + corrected filename, and the command proceeds. This option is only used by interactive shells. ‘checkhash’ If this is set, Bash checks that a command found in the hash table exists before trying to execute it. If a hashed command - no longer exists, a normal path search is performed. + no longer exists, Bash performs a normal path search. ‘checkjobs’ If set, Bash lists the status of any stopped and running jobs before exiting an interactive shell. If any jobs are running, - this causes the exit to be deferred until a second exit is - attempted without an intervening command (*note Job - Control::). The shell always postpones exiting if any jobs - are stopped. + Bash defers the exit until a second exit is attempted without + an intervening command (*note Job Control::). The shell + always postpones exiting if any jobs are stopped. ‘checkwinsize’ If set, Bash checks the window size after each external @@ -5012,15 +5183,14 @@ This builtin allows you to change additional shell optional behavior. supplied does not exist. ‘dotglob’ - If set, Bash includes filenames beginning with a '.' in the + If set, Bash includes filenames beginning with a ‘.’ in the results of filename expansion. The filenames ‘.’ and ‘..’ must always be matched explicitly, even if ‘dotglob’ is set. ‘execfail’ If this is set, a non-interactive shell will not exit if it cannot execute the file specified as an argument to the ‘exec’ - builtin command. An interactive shell does not exit if ‘exec’ - fails. + builtin. An interactive shell does not exit if ‘exec’ fails. ‘expand_aliases’ If set, aliases are expanded as described below under Aliases, @@ -5059,8 +5229,8 @@ This builtin allows you to change additional shell optional behavior. inherit the ‘ERR’ trap. ‘extglob’ - If set, the extended pattern matching features described above - (*note Pattern Matching::) are enabled. + If set, enable the extended pattern matching features + described above (*note Pattern Matching::). ‘extquote’ If set, ‘$'STRING'’ and ‘$"STRING"’ quoting is performed @@ -5082,10 +5252,10 @@ This builtin allows you to change additional shell optional behavior. If set, range expressions used in pattern matching bracket expressions (*note Pattern Matching::) behave as if in the traditional C locale when performing comparisons. That is, - the current locale's collating sequence is not taken into - account, so ‘b’ will not collate between ‘A’ and ‘B’, and - upper-case and lower-case ASCII characters will collate - together. + pattern matching does not take the current locale's collating + sequence into account, so ‘b’ will not collate between ‘A’ and + ‘B’, and upper-case and lower-case ASCII characters will + collate together. ‘globskipdots’ If set, filename expansion will never match the filenames ‘.’ @@ -5108,7 +5278,7 @@ This builtin allows you to change additional shell optional behavior. than overwriting the file. ‘histreedit’ - If set, and Readline is being used, a user is given the + If set, and Readline is being used, the user is given the opportunity to re-edit a failed history substitution. ‘histverify’ @@ -5134,9 +5304,10 @@ This builtin allows you to change additional shell optional behavior. enabled. ‘interactive_comments’ - Allow a word beginning with ‘#’ to cause that word and all - remaining characters on that line to be ignored in an - interactive shell. This option is enabled by default. + In an interactive shell, a word beginning with ‘#’ causes that + word and all remaining characters on that line to be ignored, + as in a non-interactive shell. This option is enabled by + default. ‘lastpipe’ If set, and job control is not active, the shell runs the last @@ -5167,13 +5338,13 @@ This builtin allows you to change additional shell optional behavior. ‘mailwarn’ If set, and a file that Bash is checking for mail has been - accessed since the last time it was checked, the message ‘"The - mail in MAILFILE has been read"’ is displayed. + accessed since the last time it was checked, Bash displays the + message ‘"The mail in MAILFILE has been read"’. ‘no_empty_cmd_completion’ - If set, and Readline is being used, Bash will not attempt to - search the ‘PATH’ for possible completions when completion is - attempted on an empty line. + If set, and Readline is being used, Bash does not search the + ‘PATH’ for possible completions when completion is attempted + on an empty line. ‘nocaseglob’ If set, Bash matches filenames in a case-insensitive fashion @@ -5204,9 +5375,9 @@ This builtin allows you to change additional shell optional behavior. Expansion::). This option is enabled by default. ‘progcomp’ - If set, the programmable completion facilities (*note - Programmable Completion::) are enabled. This option is - enabled by default. + If set, enable the programmable completion facilities (*note + Programmable Completion::). This option is enabled by + default. ‘progcomp_alias’ If set, and programmable completion is enabled, Bash treats a @@ -5314,10 +5485,12 @@ In some cases, Bash assigns a default value to the variable. ‘IFS’ A list of characters that separate fields; used when the shell - splits words as part of expansion. + splits words as part of expansion and by the ‘read’ builtin to + split lines into words. *Note Word Splitting::, for a description + of word splitting. ‘MAIL’ - If this parameter is set to a filename or directory name and the + If the value is set to a filename or directory name and the ‘MAILPATH’ variable is not set, Bash informs the user of the arrival of mail in the specified file or Maildir-format directory. @@ -5333,7 +5506,7 @@ In some cases, Bash assigns a default value to the variable. builtin. ‘OPTIND’ - The index of the last option argument processed by the ‘getopts’ + The index of the next argument to be processed by the ‘getopts’ builtin. ‘PATH’ @@ -5341,6 +5514,9 @@ In some cases, Bash assigns a default value to the variable. commands. A zero-length (null) directory name in the value of ‘PATH’ 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 set by the + administrator who installs ‘bash’. A common value is + "/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin". ‘PS1’ The primary prompt string. The default value is ‘\s-\v\$ ’. *Note @@ -5365,13 +5541,14 @@ variables for controlling the job control facilities (*note Job Control Variables::). ‘_’ - ($_, an underscore.) At shell startup, set to the pathname used to - invoke the shell or shell script being executed as passed in the - environment or argument list. Subsequently, expands to the last + ($_, an underscore.) This has a number of meanings depending on + context. At shell startup, $_ set to the pathname used to invoke + the shell or shell script being executed as passed in the + environment or argument list. Subsequently, it expands to the last argument to the previous simple command executed in the foreground, - after expansion. Also set to the full pathname used to invoke each - command executed and placed in the environment exported to that - command. When checking mail, this parameter holds the name of the + after expansion. It is also set to the full pathname used to + invoke each command executed and placed in the environment exported + to that command. When checking mail, $_ expands to the name of the mail file. ‘BASH’ @@ -5382,9 +5559,9 @@ Variables::). list is a valid argument for the ‘-s’ option to the ‘shopt’ builtin 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, each shell option in the - list will be enabled before reading any startup files. This - variable is readonly. + 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. ‘BASHPID’ Expands to the process ID of the current Bash process. This @@ -5411,7 +5588,7 @@ Variables::). onto ‘BASH_ARGC’. The shell sets ‘BASH_ARGC’ only when in extended debugging mode (see *note The Shopt Builtin:: for a description of the ‘extdebug’ option to the ‘shopt’ builtin). Setting ‘extdebug’ - after the shell has started to execute a script, or referencing + after the shell has started to execute a subroutine, or referencing this variable when ‘extdebug’ is not set, may result in inconsistent values. Assignments to ‘BASH_ARGC’ have no effect, and it may not be unset. @@ -5421,37 +5598,37 @@ Variables::). Bash execution call stack. The final parameter of the last subroutine call is at the top of the stack; the first parameter of the initial call is at the bottom. When a subroutine is executed, - the parameters supplied are pushed onto ‘BASH_ARGV’. The shell - sets ‘BASH_ARGV’ only when in extended debugging mode (see *note - The Shopt Builtin:: for a description of the ‘extdebug’ option to - the ‘shopt’ builtin). Setting ‘extdebug’ after the shell has - started to execute a script, or referencing this variable when + the shell pushes the supplied parameters onto ‘BASH_ARGV’. The + shell sets ‘BASH_ARGV’ only when in extended debugging mode (see + *note The Shopt Builtin:: for a description of the ‘extdebug’ + option to the ‘shopt’ builtin). Setting ‘extdebug’ after the shell + has started to execute a script, or referencing this variable when ‘extdebug’ is not set, may result in inconsistent values. Assignments to ‘BASH_ARGV’ have no effect, and it may not be unset. ‘BASH_ARGV0’ When referenced, this variable expands to the name of the shell or shell script (identical to ‘$0’; *Note Special Parameters::, for - the description of special parameter 0). Assignment to - ‘BASH_ARGV0’ causes the value assigned to also be assigned to ‘$0’. - If ‘BASH_ARGV0’ is unset, it loses its special properties, even if - it is subsequently reset. + the description of special parameter 0). Assigning a value to + ‘BASH_ARGV0’ assigns the same value to ‘$0’. If ‘BASH_ARGV0’ is + unset, it loses its special properties, even if it is subsequently + reset. ‘BASH_CMDS’ An associative array variable whose members correspond to the internal hash table of commands as maintained by the ‘hash’ builtin - (*note Bourne Shell Builtins::). Elements added to this array - appear in the hash table; however, unsetting array elements - currently does not cause command names to be removed from the hash + (*note Bourne Shell Builtins::). 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 ‘BASH_CMDS’ is unset, it loses its special properties, even if it is subsequently reset. ‘BASH_COMMAND’ - 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 - ‘BASH_COMMAND’ is unset, it loses its special properties, even if - it is subsequently reset. + 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 ‘BASH_COMMAND’ is unset, it loses its special + properties, even if it is subsequently reset. ‘BASH_COMPAT’ The value is used to set the shell's compatibility level. *Note @@ -5472,8 +5649,8 @@ Variables::). ‘BASH_ENV’ If this variable is set when Bash is invoked to execute a shell script, its value is expanded and used as the name of a startup - file to read before executing the script. *Note Bash Startup - Files::. + file to read before executing the script. Bash does not use ‘PATH’ + to search for the resultant filename. *Note Bash Startup Files::. ‘BASH_EXECUTION_STRING’ The command argument to the ‘-c’ invocation option. @@ -5489,8 +5666,8 @@ Variables::). unset. ‘BASH_LOADABLES_PATH’ - A colon-separated list of directories in which the shell looks for - dynamically loadable builtins specified by the ‘enable’ command. + A colon-separated list of directories in which the ‘enable’ command + looks for dynamically loadable builtins. ‘BASH_MONOSECONDS’ Each time this variable is referenced, it expands to the value @@ -5551,7 +5728,8 @@ Variables::). The value of ‘MACHTYPE’. ‘BASH_VERSION’ - The version number of the current instance of Bash. + Expands to a string describing the version of this instance of Bash + (e.g., 5.2.37(3)-release). ‘BASH_XTRACEFD’ If set to an integer corresponding to a valid file descriptor, Bash @@ -5583,6 +5761,12 @@ Variables::). functions invoked by the programmable completion facilities (*note Programmable Completion::). +‘COMP_KEY’ + The key (or final key of a key sequence) used to invoke the current + completion function. This variable is available only in shell + functions and external commands invoked by the programmable + completion facilities (*note Programmable Completion::). + ‘COMP_LINE’ The current command line. This variable is available only in shell functions and external commands invoked by the programmable @@ -5597,8 +5781,8 @@ Variables::). completion facilities (*note Programmable Completion::). ‘COMP_TYPE’ - Set to an integer value corresponding to the type of completion - attempted that caused a completion function to be called: , + Set to an integer value corresponding to the type of attempted + completion that caused a completion function to be called: , for normal completion, ‘?’, for listing completions after successive tabs, ‘!’, for listing alternatives on partial word completion, ‘@’, to list completions if the word is not unmodified, @@ -5606,10 +5790,6 @@ Variables::). shell functions and external commands invoked by the programmable completion facilities (*note Programmable Completion::). -‘COMP_KEY’ - The key (or final key of a key sequence) used to invoke the current - completion function. - ‘COMP_WORDBREAKS’ The set of characters that the Readline library treats as word separators when performing word completion. If ‘COMP_WORDBREAKS’ @@ -5645,8 +5825,8 @@ Variables::). ‘EMACS’ If Bash 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. + starts, and its value is ‘t’, Bash assumes that the shell is + running in an Emacs shell buffer and disables line editing. ‘ENV’ Expanded and executed similarly to ‘BASH_ENV’ (*note Bash Startup @@ -5674,20 +5854,18 @@ Variables::). ‘EXECIGNORE’ A colon-separated list of shell patterns (*note Pattern Matching::) - defining the list of filenames to be ignored by command search - using ‘PATH’. Files whose full pathnames match one of these - patterns are not considered executable files for the purposes of - completion and command execution via ‘PATH’ lookup. This does not - affect the behavior of the ‘[’, ‘test’, and ‘[[’ commands. Full - pathnames in the command hash table are not subject to - ‘EXECIGNORE’. 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 ‘extglob’ shell - option. + defining the set of filenames to be ignored by command search using + ‘PATH’. Files whose full pathnames match one of these patterns are + not considered executable files for the purposes of completion and + command execution via ‘PATH’ lookup. This does not affect the + behavior of the ‘[’, ‘test’, and ‘[[’ commands. Full pathnames in + the command hash table are not subject to ‘EXECIGNORE’. 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 ‘extglob’ shell option. ‘FCEDIT’ - The editor used as a default by the ‘-e’ option to the ‘fc’ builtin - command. + The editor used as a default by the ‘fc’ builtin command. ‘FIGNORE’ A colon-separated list of suffixes to ignore when performing @@ -5713,9 +5891,9 @@ Variables::). information. ‘FUNCNEST’ - If set to a numeric value greater than 0, defines a maximum - function nesting level. Function invocations that exceed this - nesting level will cause the current command to abort. + A numeric value greater than 0 defines a maximum function nesting + level. Function invocations that exceed this nesting level will + cause the current command to abort. ‘GLOBIGNORE’ A colon-separated list of patterns defining the set of file names @@ -5725,7 +5903,7 @@ Variables::). matching honors the setting of the ‘extglob’ shell option. ‘GLOBSORT’ - Control how the results of filename expansion are sorted. The + Controls how the results of filename expansion are sorted. The value of this variable specifies the sort criteria and sort order for the results of filename expansion. If this variable is unset or set to the null string, filename expansion uses the historical @@ -5791,7 +5969,7 @@ Variables::). on the history list. If the list of values includes ‘ignorespace’, lines which begin with a space character are not saved in the history list. A value of ‘ignoredups’ causes lines which match the - previous history entry to not be saved. A value of ‘ignoreboth’ is + previous history entry not to be saved. A value of ‘ignoreboth’ is shorthand for ‘ignorespace’ and ‘ignoredups’. A value of ‘erasedups’ causes all previous lines matching the current line to be removed from the history list before that line is saved. Any @@ -5800,23 +5978,26 @@ Variables::). parser are saved on the history list, subject to the value of ‘HISTIGNORE’. The second and subsequent lines of a multi-line compound command are not tested, and are added to the history - regardless of the value of ‘HISTCONTROL’. + regardless of the value of ‘HISTCONTROL’ if the first line of the + command was saved. If the first line was not saved, the second and + subsequent lines of the command are not saved, either. ‘HISTFILE’ The name of the file to which the command history is saved. Bash assigns a default value of ‘~/.bash_history’. If ‘HISTFILE’ is - unset or null, the command history is not saved when a shell exits. + unset or null, the shell does not save the command history when it + exits. ‘HISTFILESIZE’ The maximum number of lines contained in the history file. When this variable is assigned a value, the history file is truncated, 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. 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 ‘HISTSIZE’ after reading any - startup files. + this size after writing it when a shell exits or by the ‘history’ + 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 + ‘HISTSIZE’ after reading any startup files. ‘HISTIGNORE’ A colon-separated list of patterns used to decide which command @@ -5831,12 +6012,14 @@ Variables::). backslash; the backslash is removed before attempting a match. The second and subsequent lines of a multi-line compound command are not tested, and are added to the history regardless of the value of - ‘HISTIGNORE’. The pattern matching honors the setting of the + ‘HISTIGNORE’, if the first line was saved. If the first line was + not saved, the second and subsequent lines of the command are not + saved, either. The pattern matching honors the setting of the ‘extglob’ shell option. - ‘HISTIGNORE’ subsumes the function of ‘HISTCONTROL’. A pattern of - ‘&’ is identical to ‘ignoredups’, and a pattern of ‘[ ]*’ is - identical to ‘ignorespace’. Combining these two patterns, + ‘HISTIGNORE’ subsumes some of the function of ‘HISTCONTROL’. A + pattern of ‘&’ is identical to ‘ignoredups’, and a pattern of ‘[ + ]*’ is identical to ‘ignorespace’. Combining these two patterns, separating them with a colon, provides the functionality of ‘ignoreboth’. @@ -5851,10 +6034,10 @@ Variables::). If this variable is set and not null, its value is used as a format string for ‘strftime’(3) to print the time stamp associated with each history entry displayed by the ‘history’ builtin. If this - variable is set, time stamps are written to the history file so - they may be preserved across shell sessions. This uses the history - comment character to distinguish timestamps from other history - lines. + variable is set, the shell writes time stamps to the history file + so they may be preserved across shell sessions. This uses the + history comment character to distinguish timestamps from other + history lines. ‘HOSTFILE’ Contains the name of a file in the same format as ‘/etc/hosts’ that @@ -5875,13 +6058,12 @@ Variables::). ‘IGNOREEOF’ Controls the action of the shell on receipt of an ‘EOF’ character - as the sole input. If set, the value denotes the number of - consecutive ‘EOF’ characters that can be read as the first - character on an input line before the shell will exit. If the - variable exists but does not have a numeric value, or has no value, - then the default is 10. If the variable does not exist, then ‘EOF’ - signifies the end of input to the shell. This is only in effect - for interactive shells. + as the sole input. If set, the value is the number of consecutive + ‘EOF’ characters that can be read as the first character on an + input line before Bash exits. If the variable is set but does not + have a numeric value, or the value is null, then the default is 10. + If the variable is unset, then ‘EOF’ signifies the end of input to + the shell. This is only in effect for interactive shells. ‘INPUTRC’ The name of the Readline initialization file, overriding the @@ -5927,8 +6109,10 @@ Variables::). ‘LINENO’ The line number in the script or shell function currently - executing. If ‘LINENO’ is unset, it loses its special properties, - even if it is subsequently reset. + executing. Line numbers start with 1. When not in a script or + function, the value is not guaranteed to be meaningful. If + ‘LINENO’ is unset, it loses its special properties, even if it is + subsequently reset. ‘LINES’ Used by the ‘select’ command to determine the column length for @@ -5957,7 +6141,8 @@ Variables::). ‘OPTERR’ If set to the value 1, Bash displays error messages generated by - the ‘getopts’ builtin command. + the ‘getopts’ builtin command. ‘OPTERR’ is initialized to 1 each + time the shell is invoked. ‘OSTYPE’ A string describing the operating system Bash is running on. @@ -6018,8 +6203,10 @@ Variables::). ‘RANDOM’ Each time this parameter is referenced, it expands to a random integer between 0 and 32767. Assigning a value to this variable - seeds the random number generator. If ‘RANDOM’ is unset, it loses - its special properties, even if it is subsequently reset. + initializes (seeds) the random number generator. Seeding the + random number generator with the same constant value will produce + the same sequence of values. If ‘RANDOM’ is unset, it loses its + special properties, even if it is subsequently reset. ‘READLINE_ARGUMENT’ Any numeric argument given to a Readline command that was defined @@ -6040,7 +6227,8 @@ Variables::). for use with ‘bind -x’ (*note Bash Builtins::). ‘REPLY’ - The default variable for the ‘read’ builtin. + The default variable for the ‘read’ builtin; set to the line read + when ‘read’ is not supplied a variable name argument. ‘SECONDS’ This variable expands to the number of seconds since the shell was @@ -6062,9 +6250,9 @@ Variables::). list is a valid argument for the ‘-o’ option to the ‘set’ builtin command (*note The Set Builtin::). The options appearing in ‘SHELLOPTS’ are those reported as ‘on’ by ‘set -o’. If this - variable is in the environment when Bash starts up, each shell - option in the list will be enabled before reading any startup - files. This variable is readonly. + 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. ‘SHLVL’ Incremented by one each time a new instance of Bash is started. @@ -6105,9 +6293,10 @@ Variables::). The optional P is a digit specifying the precision, the number of fractional digits after a decimal point. A value of 0 causes no - decimal point or fraction to be output. At most six places after - the decimal point may be specified; values of P greater than 6 are - changed to 6. If P is not specified, the value 3 is used. + decimal point or fraction to be output. ‘time’ will print at most + six digits after the decimal point; values of P greater than 6 are + changed to 6. If P is not specified, ‘time’ prints three digits + after the decimal point. The optional ‘l’ specifies a longer format, including minutes, of the form MMmSS.FFs. The value of P determines whether or not the @@ -6119,11 +6308,11 @@ Variables::). A trailing newline is added when the format string is displayed. ‘TMOUT’ - If set to a value greater than zero, ‘TMOUT’ is treated as the - default timeout for the ‘read’ builtin (*note Bash Builtins::). - The ‘select’ command (*note Conditional Constructs::) terminates if - input does not arrive after ‘TMOUT’ seconds when input is coming - from a terminal. + If set to a value greater than zero, the ‘read’ builtin uses the + value as its default timeout (*note Bash Builtins::). The ‘select’ + command (*note Conditional Constructs::) terminates if input does + not arrive after ‘TMOUT’ seconds when input is coming from a + terminal. In an interactive shell, the value is interpreted as the number of seconds to wait for a line of input after issuing the primary @@ -6191,8 +6380,8 @@ single-character options to be recognized. builtin). ‘--dump-po-strings’ - A list of all double-quoted strings preceded by ‘$’ is printed on - the standard output in the GNU ‘gettext’ PO (portable object) file + Print a list of all double-quoted strings preceded by ‘$’ on the + standard output in the GNU ‘gettext’ PO (portable object) file format. Equivalent to ‘-D’ except for the output format. ‘--dump-strings’ @@ -6259,23 +6448,23 @@ invocation which are not available with the ‘set’ builtin. Make this shell act as if it had been directly invoked by login. When the shell is interactive, this is equivalent to starting a login shell with ‘exec -l bash’. When the shell is not - interactive, the login shell startup files will be executed. ‘exec - bash -l’ or ‘exec bash --login’ will replace the current shell with - a Bash login shell. *Note Bash Startup Files::, for a description - of the special behavior of a login shell. + interactive, it will read and execute the login shell startup + files. ‘exec bash -l’ or ‘exec bash --login’ will replace the + current shell with a Bash login shell. *Note Bash Startup Files::, + for a description of the special behavior of a login shell. ‘-r’ Make the shell a restricted shell (*note The Restricted Shell::). ‘-s’ If this option is present, or if no arguments remain after option - processing, then commands are read from the standard input. This + processing, then Bash reads commands from the standard input. This option allows the positional parameters to be set when invoking an interactive shell or when reading input through a pipe. ‘-D’ - A list of all double-quoted strings preceded by ‘$’ is printed on - the standard output. These are the strings that are subject to + Print a list of all double-quoted strings preceded by ‘$’ on the + standard output. These are the strings that are subject to language translation when the current locale is not ‘C’ or ‘POSIX’ (*note Locale Translation::). This implies the ‘-n’ option; no commands will be executed. @@ -6284,8 +6473,8 @@ invocation which are not available with the ‘set’ builtin. SHOPT_OPTION is one of the shell options accepted by the ‘shopt’ builtin (*note The Shopt Builtin::). If SHOPT_OPTION is present, ‘-O’ sets the value of that option; ‘+O’ unsets it. If - SHOPT_OPTION is not supplied, the names and values of the shell - options accepted by ‘shopt’ are printed on the standard output. If + SHOPT_OPTION is not supplied, Bash prints the names and values of + the shell options accepted by ‘shopt’ on the standard output. If the invocation option is ‘+O’, the output is displayed in a format that may be reused as input. @@ -6303,9 +6492,9 @@ or one invoked with the ‘--login’ option. An _interactive_ shell is one started without non-option arguments, unless ‘-s’ is specified, without specifying the ‘-c’ option, and whose -input and output are both connected to terminals (as determined by -‘isatty(3)’), or one started with the ‘-i’ option. *Note Interactive -Shells::, for more information. +input and output (using the standard error) are both connected to +terminals (as determined by ‘isatty(3)’), or one started with the ‘-i’ +option. *Note Interactive Shells::, for more information. If arguments remain after option processing, and neither the ‘-c’ nor the ‘-s’ option has been supplied, the first argument is assumed to be @@ -6348,10 +6537,10 @@ commands from the file ‘~/.bash_logout’, if it exists. Invoked as an interactive non-login shell ......................................... -When an interactive shell that is not a login shell is started, Bash +When Bash runs as an interactive shell that is not a login shell, it reads and executes commands from ‘~/.bashrc’, if that file exists. This may be inhibited by using the ‘--norc’ option. The ‘--rcfile FILE’ -option will cause Bash to use FILE instead of ‘~/.bashrc’. +option causes Bash to use FILE instead of ‘~/.bashrc’. So, typically, your ‘~/.bash_profile’ contains the line if [ -f ~/.bashrc ]; then . ~/.bashrc; fi @@ -6366,7 +6555,7 @@ expands its value if it appears there, and uses the expanded value as the name of a file to read and execute. Bash behaves as if the following command were executed: if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi -but the value of the ‘PATH’ variable is not used to search for the +but does not the value of the ‘PATH’ variable to search for the filename. As noted above, if a non-interactive shell is invoked with the @@ -6383,14 +6572,16 @@ conforming to the POSIX standard as well. When invoked as an interactive login shell, or as a non-interactive shell with the ‘--login’ option, it first attempts to read and execute commands from ‘/etc/profile’ and ‘~/.profile’, in that order. The -‘--noprofile’ option may be used to inhibit this behavior. When invoked -as an interactive shell with the name ‘sh’, Bash looks for the variable -‘ENV’, expands its value if it is defined, and uses the expanded value -as the name of a file to read and execute. Since a shell invoked as -‘sh’ does not attempt to read and execute commands from any other -startup files, the ‘--rcfile’ option has no effect. A non-interactive -shell invoked with the name ‘sh’ does not attempt to read any other -startup files. +‘--noprofile’ option may be used to inhibit this behavior. + + When invoked as an interactive shell with the name ‘sh’, Bash looks +for the variable ‘ENV’, expands its value if it is defined, and uses the +expanded value as the name of a file to read and execute. Since a shell +invoked as ‘sh’ does not attempt to read and execute commands from any +other startup files, the ‘--rcfile’ option has no effect. + + A non-interactive shell invoked with the name ‘sh’ does not attempt +to read any other startup files. When invoked as ‘sh’, Bash enters POSIX mode after the startup files are read. @@ -6400,8 +6591,8 @@ Invoked in POSIX mode When Bash is started in POSIX mode, as with the ‘--posix’ command line option, it follows the POSIX standard for startup files. In this mode, -interactive shells expand the ‘ENV’ variable and commands are read and -executed from the file whose name is the expanded value. No other +interactive shells expand the ‘ENV’ variable and read and execute +commands from the file whose name is the expanded value. No other startup files are read. Invoked by remote shell daemon @@ -6409,14 +6600,14 @@ Invoked by remote shell daemon Bash attempts to determine when it is being run with its standard input connected to a network connection, as when executed by the historical -remote shell daemon, usually ‘rshd’, or the secure shell daemon ‘sshd’. -If Bash determines it is being run non-interactively in this fashion, it -reads and executes commands from ‘~/.bashrc’, if that file exists and is -readable. It will not do this if invoked as ‘sh’. The ‘--norc’ option -may be used to inhibit this behavior, and the ‘--rcfile’ option will -make Bash use a different file instead of ‘~/.bashrc’, but neither -‘rshd’ nor ‘sshd’ generally invoke the shell with those options or allow -them to be specified. +and rarely-seen remote shell daemon, usually ‘rshd’, or the secure shell +daemon ‘sshd’. If Bash determines it is being run non-interactively in +this fashion, it reads and executes commands from ‘~/.bashrc’, if that +file exists and is readable. It will not do this if invoked as ‘sh’. +The ‘--norc’ option may be used to inhibit this behavior, and the +‘--rcfile’ option will make Bash use a different file instead of +‘~/.bashrc’, but neither ‘rshd’ nor ‘sshd’ generally invoke the shell +with those options or allow them to be specified. Invoked with unequal effective and real UID/GIDs ................................................ @@ -6457,7 +6648,7 @@ and error output are both connected to terminals (as determined by terminal. The ‘-s’ invocation option may be used to set the positional -parameters when an interactive shell is started. +parameters when an interactive shell starts.  File: bash.info, Node: Is this Shell Interactive?, Next: Interactive Shell Behavior, Prev: What is an Interactive Shell?, Up: Interactive Shells @@ -6492,35 +6683,35 @@ File: bash.info, Node: Interactive Shell Behavior, Prev: Is this Shell Interac When the shell is running interactively, it changes its behavior in several ways. - 1. Startup files are read and executed as described in *note Bash + 1. Bash reads and executes startup files as described in *note Bash Startup Files::. 2. Job Control (*note Job Control::) is enabled by default. When job control is in effect, Bash ignores the keyboard-generated job control signals ‘SIGTTIN’, ‘SIGTTOU’, and ‘SIGTSTP’. - 3. Bash expands and displays ‘PS1’ before reading the first line of a + 3. Bash executes the values of the set elements of the + ‘PROMPT_COMMAND’ array variable as commands before printing the + primary prompt, ‘$PS1’ (*note Bash Variables::). + + 4. Bash expands and displays ‘PS1’ before reading the first line of a command, and expands and displays ‘PS2’ before reading the second and subsequent lines of a multi-line command. Bash expands and displays ‘PS0’ after it reads a command but before executing it. See *note Controlling the Prompt::, for a complete list of prompt string escape sequences. - 4. Bash executes the values of the set elements of the - ‘PROMPT_COMMAND’ array variable as commands before printing the - primary prompt, ‘$PS1’ (*note Bash Variables::). - - 5. Readline (*note Command Line Editing::) is used to read commands + 5. Bash uses Readline (*note Command Line Editing::) to read commands from the user's terminal. 6. Bash inspects the value of the ‘ignoreeof’ option to ‘set -o’ instead of exiting immediately when it receives an ‘EOF’ on its standard input when reading a command (*note The Set Builtin::). - 7. Command history (*note Bash History Facilities::) and history - expansion (*note History Interaction::) are enabled by default. - Bash will save the command history to the file named by ‘$HISTFILE’ - when a shell with history enabled exits. + 7. Bash enables Command history (*note Bash History Facilities::) and + history expansion (*note History Interaction::) by default. When a + shell with history enabled exits, Bash saves the command history to + the file named by ‘$HISTFILE’. 8. Alias expansion (*note Aliases::) is performed by default. @@ -6533,16 +6724,16 @@ several ways. 11. An interactive login shell sends a ‘SIGHUP’ to all jobs on exit if the ‘huponexit’ shell option has been enabled (*note Signals::). - 12. The ‘-n’ invocation option is ignored, and ‘set -n’ has no effect - (*note The Set Builtin::). + 12. The ‘-n’ option has no effect, whether at invocation or when using + ‘set -n’ (*note The Set Builtin::). 13. Bash will check for mail periodically, depending on the values of the ‘MAIL’, ‘MAILPATH’, and ‘MAILCHECK’ shell variables (*note Bash Variables::). - 14. Expansion errors due to references to unbound shell variables - after ‘set -u’ has been enabled will not cause the shell to exit - (*note The Set Builtin::). + 14. The shell will not exit on expansion errors due to references to + unbound shell variables after ‘set -u’ has been enabled (*note The + Set Builtin::). 15. The shell will not exit on expansion errors caused by VAR being unset or null in ‘${VAR:?WORD}’ expansions (*note Shell Parameter @@ -6581,10 +6772,12 @@ Bourne Shell Builtins::). The ‘test’ and ‘[’ commands determine their behavior based on the number of arguments; see the descriptions of those commands for any other command-specific actions. - Expressions may be unary or binary, and are formed from the following -primaries. Unary expressions are often used to examine the status of a -file. There are string operators and numeric comparison operators as -well. Bash handles several filenames specially when they are used in + Expressions may be unary or binary, and are formed from the primaries +listed below. Unary expressions are often used to examine the status of +a file or shell variable. Binary operators are used for string, +numeric, and file attribute comparisons. + + Bash handles several filenames specially when they are used in expressions. If the operating system on which Bash is running provides these special files, Bash will use them; otherwise it will emulate them internally with this behavior: If the FILE argument to one of the @@ -6655,7 +6848,8 @@ link itself. True if FILE exists and is a symbolic link. ‘-N FILE’ - True if FILE exists and has been modified since it was last read. + True if FILE exists and has been modified since it was last + accessed. ‘-O FILE’ True if FILE exists and is owned by the effective user id. @@ -6729,15 +6923,16 @@ File: bash.info, Node: Shell Arithmetic, Next: Aliases, Prev: Bash Conditiona ==================== The shell allows arithmetic expressions to be evaluated, as one of the -shell expansions or by using the ‘((’ compound command, the ‘let’ -builtin, or the ‘-i’ option to the ‘declare’ builtin. +shell expansions or by using the ‘((’ compound command, the ‘let’ and +‘declare’ builtins, the arithmetic ‘for’ command, the ‘[[’ conditional +command, or the ‘-i’ option to the ‘declare’ builtin. - Evaluation is done in fixed-width integers with no check for -overflow, though division by 0 is trapped and flagged as an error. The -operators and their precedence, associativity, and values are the same -as in the C language. The following list of operators is grouped into -levels of equal-precedence operators. The levels are listed in order of -decreasing precedence. + Evaluation is done in the largest fixed-width integers available, +with no check for overflow, though division by 0 is trapped and flagged +as an error. The operators and their precedence, associativity, and +values are the same as in the C language. The following list of +operators is grouped into levels of equal-precedence operators. The +levels are listed in order of decreasing precedence. ‘ID++ ID--’ variable post-increment and post-decrement @@ -6796,13 +6991,17 @@ decreasing precedence. Shell variables are allowed as operands; parameter expansion is performed before the expression is evaluated. Within an expression, shell variables may also be referenced by name without using the -parameter expansion syntax. A shell variable that is null or unset -evaluates to 0 when referenced by name without using the parameter -expansion syntax. The value of a variable is evaluated as an arithmetic -expression when it is referenced, or when a variable which has been -given the ‘integer’ attribute using ‘declare -i’ is assigned a value. A -null value evaluates to 0. A shell variable need not have its ‘integer’ -attribute turned on to be used in an expression. +parameter expansion syntax. This means you can use .Q x , where \fIx\fP +is a shell variable name, in an arithmetic expression, and the shell +will evaluate its value as an expression and use the result. A shell +variable that is null or unset evaluates to 0 when referenced by name in +an expression. + + The value of a variable is evaluated as an arithmetic expression when +it is referenced, or when a variable which has been given the ‘integer’ +attribute using ‘declare -i’ is assigned a value. A null value +evaluates to 0. A shell variable need not have its ‘integer’ attribute +turned on to be used in an expression. Integer constants follow the C language definition, without suffixes or character constants. Constants with a leading 0 are interpreted as @@ -6816,7 +7015,7 @@ represented by the lowercase letters, the uppercase letters, ‘@’, and uppercase letters may be used interchangeably to represent numbers between 10 and 35. - Operators are evaluated in order of precedence. Sub-expressions in + Operators are evaluated in precedence order. Sub-expressions in parentheses are evaluated first and may override the precedence rules above. @@ -6847,8 +7046,8 @@ expanded a second time. This means that one may alias ‘ls’ to ‘"ls -F"’, for instance, and Bash does not try to recursively expand the replacement text. - If the last character of the alias value is a ‘blank’, then the next -command word following the alias is also checked for alias expansion. + If the last character of the alias value is a ‘blank’, then the shell +checks the next command word following the alias for alias expansion. Aliases are created and listed with the ‘alias’ command, and removed with the ‘unalias’ command. @@ -6867,14 +7066,15 @@ all lines that make up a compound command, before executing any of the commands on that line or the compound command. Aliases are expanded when a command is read, not when it is executed. Therefore, an alias definition appearing on the same line as another command does not take -effect until the next line of input is read. The commands following the -alias definition on that line are not affected by the new alias. This -behavior is also an issue when functions are executed. Aliases are -expanded when a function definition is read, not when the function is -executed, because a function definition is itself a command. As a -consequence, aliases defined in a function are not available until after -that function is executed. To be safe, always put alias definitions on -a separate line, and do not use ‘alias’ in compound commands. +effect until the shell reads the next line of input. The commands +following the alias definition on that line are not affected by the new +alias. This behavior is also an issue when functions are executed. +Aliases are expanded when a function definition is read, not when the +function is executed, because a function definition is itself a command. +As a consequence, aliases defined in a function are not available until +after that function is executed. To be safe, always put alias +definitions on a separate line, and do not use ‘alias’ in compound +commands. For almost every purpose, shell functions are preferred over aliases. @@ -6898,7 +7098,8 @@ to using the syntax NAME[SUBSCRIPT]=VALUE The SUBSCRIPT is treated as an arithmetic expression that must evaluate -to a number. To explicitly declare an array, use +to a number greater than or equal to zero. To explicitly declare an +array, use declare -a NAME The syntax declare -a NAME[SUBSCRIPT] @@ -6911,19 +7112,21 @@ Associative arrays are created using and ‘readonly’ builtins. Each attribute applies to all members of an array. - Arrays are assigned to using compound assignments of the form + Arrays are assigned using compound assignments of the form NAME=(VALUE1 VALUE2 ... ) where each VALUE may be of the form ‘[SUBSCRIPT]=’STRING. Indexed array -assignments do not require anything but STRING. When assigning to -indexed arrays, if the optional subscript is 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. +assignments do not require anything but STRING. Each VALUE in the list undergoes the shell expansions described above (*note Shell Expansions::), but VALUEs that are valid variable assignments including 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 subscript is +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 assignment may be either assignment statements, for which the subscript is required, or a list of words that is interpreted as a sequence of @@ -6947,8 +7150,8 @@ end of the array, and an index of -1 references the last element. using the compound assignment syntax; see *note Shell Parameters:: above. - Any element of an array may be referenced using ‘${NAME[SUBSCRIPT]}’. -The braces are required to avoid conflicts with the shell's filename + An array element is referenced using ‘${NAME[SUBSCRIPT]}’. The +braces are required to avoid conflicts with the shell's filename expansion operators. If the SUBSCRIPT is ‘@’ or ‘*’, the word expands to all members of the array NAME, unless otherwise noted in the description of a builtin or word expansion. These subscripts differ @@ -6958,16 +7161,20 @@ each array member separated by the first character of the ‘IFS’ variable, and ‘${NAME[@]}’ expands each element of NAME to a separate word. When there are no array members, ‘${NAME[@]}’ 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 original -word, and the expansion of the last parameter is joined with the last -part of the original word. This is analogous to the expansion of the -special parameters ‘@’ and ‘*’. ‘${#NAME[SUBSCRIPT]}’ expands to the -length of ‘${NAME[SUBSCRIPT]}’. If SUBSCRIPT is ‘@’ or ‘*’, the -expansion is the number of elements in the array. If the SUBSCRIPT used -to reference an element of an indexed array evaluates to a number less -than zero, it is interpreted as relative to one greater than the maximum -index of the array, so negative indices count back from the end of the -array, and an index of -1 refers to the last element. +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 ‘*’. + + ‘${#NAME[SUBSCRIPT]}’ expands to the length of ‘${NAME[SUBSCRIPT]}’. +If SUBSCRIPT is ‘@’ or ‘*’, the expansion is the number of elements in +the array. + + If the SUBSCRIPT used to reference an element of an indexed array +evaluates to a number less than zero, it is interpreted as relative to +one greater than the maximum index of the array, so negative indices +count back from the end of the array, and an index of -1 refers to the +last element. Referencing an array variable without a subscript is equivalent to referencing with a subscript of 0. Any reference to a variable using a @@ -6983,21 +7190,21 @@ to the expansion of the special parameters ‘@’ and ‘*’ within double quotes. The ‘unset’ builtin is used to destroy arrays. ‘unset -NAME[SUBSCRIPT]’ destroys the array element at index SUBSCRIPT. -Negative subscripts to indexed arrays are interpreted as described -above. Unsetting the last element of an array variable does not unset -the variable. ‘unset NAME’, where NAME is an array, removes the entire +NAME[SUBSCRIPT]’ unsets the array element at index SUBSCRIPT. Negative +subscripts to indexed arrays are interpreted as described above. +Unsetting the last element of an array variable does not unset the +variable. ‘unset NAME’, where NAME is an array, removes the entire array. ‘unset NAME[SUBSCRIPT]’ behaves differently depending on the -array type when given a subscript of ‘*’ or ‘@’. When NAME is an -associative array, it removes the element with key ‘*’ or ‘@’. If NAME -is an indexed array, ‘unset’ removes all of the elements, but does not -remove the array itself. +array type when SUBSCRIPT is ‘*’ or ‘@’. When NAME is an associative +array, it removes the element with key ‘*’ or ‘@’. If NAME is an +indexed array, ‘unset’ removes all of the elements, but does not remove +the array itself. When using a variable name with a subscript as an argument to a command, such as with ‘unset’, without using the word expansion syntax -described above, the argument is subject to the shell's filename -expansion. If filename expansion is not desired, the argument should be -quoted. +described above (e.g., unset a[4]), the argument is subject to the +shell's filename expansion. Quote the argument if pathname expansion is +not desired (e.g., unset 'a[4]'). The ‘declare’, ‘local’, and ‘readonly’ builtins each accept a ‘-a’ option to specify an indexed array and a ‘-A’ option to specify an @@ -7006,7 +7213,9 @@ The ‘read’ builtin accepts a ‘-a’ option to assign a list of words read from the standard input to an array, and can read values from the standard input into individual array elements. The ‘set’ and ‘declare’ builtins display array values in a way that allows them to be reused as -input. +input. Other builtins accept array name arguments as well (e.g., +‘mapfile’); see the descriptions of individual builtins for details. +The shell provides a number of builtin array variables.  File: bash.info, Node: The Directory Stack, Next: Controlling the Prompt, Prev: Arrays, Up: Bash Features @@ -7038,10 +7247,12 @@ File: bash.info, Node: Directory Stack Builtins, Up: The Directory Stack ‘dirs’ dirs [-clpv] [+N | -N] - Display the list of currently remembered directories. Directories - are added to the list with the ‘pushd’ command; the ‘popd’ command - removes directories from the list. The current directory is always - the first directory in the stack. + Without options, display the list of currently remembered + directories. Directories are added to the list with the ‘pushd’ + command; the ‘popd’ command removes directories from the list. The + current directory is always the first directory in the stack. + + Options, if supplied, have the following meanings: ‘-c’ Clears the directory stack by deleting all of the elements. @@ -7066,7 +7277,7 @@ File: bash.info, Node: Directory Stack Builtins, Up: The Directory Stack ‘popd’ popd [-n] [+N | -N] - Removes elements from the directory stack. The elements are + Remove elements from the directory stack. The elements are numbered from 0 starting at the first directory listed by ‘dirs’; that is, ‘popd’ is equivalent to ‘popd +0’. @@ -7076,14 +7287,13 @@ File: bash.info, Node: Directory Stack Builtins, Up: The Directory Stack Arguments, if supplied, have the following meanings: ‘-n’ - Suppresses the normal change of directory when removing - directories from the stack, so that only the stack is - manipulated. + Suppress the normal change of directory when removing + directories from the stack, only manipulate the stack. ‘+N’ - Removes the Nth directory (counting from the left of the list + Remove the Nth directory (counting from the left of the list printed by ‘dirs’), starting with zero, from the stack. ‘-N’ - Removes the Nth directory (counting from the right of the list + Remove the Nth directory (counting from the right of the list printed by ‘dirs’), starting with zero, from the stack. If the top element of the directory stack is modified, and the ‘-n’ @@ -7092,8 +7302,8 @@ File: bash.info, Node: Directory Stack Builtins, Up: The Directory Stack returns a non-zero value. Otherwise, ‘popd’ returns an unsuccessful status if an invalid - option is encountered, the directory stack is empty, or a - non-existent directory stack entry is specified. + option is specified, the directory stack is empty, or N specifies a + non-existent directory stack entry. If the ‘popd’ command is successful, Bash runs ‘dirs’ to show the final contents of the directory stack, and the return status is 0. @@ -7101,7 +7311,7 @@ File: bash.info, Node: Directory Stack Builtins, Up: The Directory Stack ‘pushd’ pushd [-n] [+N | -N | DIR] - Adds a directory to the top of the directory stack, or rotates the + Add a directory to the top of the directory stack, or rotate the stack, making the new top of the stack the current working directory. With no arguments, ‘pushd’ exchanges the top two elements of the directory stack. @@ -7109,29 +7319,28 @@ File: bash.info, Node: Directory Stack Builtins, Up: The Directory Stack Arguments, if supplied, have the following meanings: ‘-n’ - Suppresses the normal change of directory when rotating or - adding directories to the stack, so that only the stack is - manipulated. + Suppress the normal change of directory when rotating or + adding directories to the stack, only manipulate the stack. ‘+N’ - Brings the Nth directory (counting from the left of the list - printed by ‘dirs’, starting with zero) to the top of the list - by rotating the stack. + Rotate the stack so that the Nth directory (counting from the + left of the list printed by ‘dirs’, starting with zero) is at + the top. ‘-N’ - Brings the Nth directory (counting from the right of the list - printed by ‘dirs’, starting with zero) to the top of the list - by rotating the stack. + Rotate the stack so that the Nth directory (counting from the + right of the list printed by ‘dirs’, starting with zero) is at + the top. ‘DIR’ - Makes DIR be the top of the stack. + Make DIR be the top of the stack. After the stack has been modified, if the ‘-n’ option was not supplied, ‘pushd’ uses the ‘cd’ builtin to change to the directory at the top of the stack. If the ‘cd’ fails, ‘pushd’ returns a non-zero value. - Otherwise, if no arguments are supplied, ‘pushd’ returns 0 unless - the directory stack is empty. When rotating the directory stack, - ‘pushd’ returns 0 unless the directory stack is empty or a - non-existent directory stack element is specified. + Otherwise, if no arguments are supplied, ‘pushd’ returns zero + unless the directory stack is empty. When rotating the directory + stack, ‘pushd’ returns zero unless the directory stack is empty or + N specifies a non-existent directory stack element. If the ‘pushd’ command is successful, Bash runs ‘dirs’ to show the final contents of the directory stack. @@ -7142,13 +7351,8 @@ File: bash.info, Node: Controlling the Prompt, Next: The Restricted Shell, Pr 6.9 Controlling the Prompt ========================== -Bash examines the value of the array variable ‘PROMPT_COMMAND’ just -before printing each primary prompt. If any elements in -‘PROMPT_COMMAND’ are set and non-null, Bash executes each value, in -numeric order, just as if it had been typed on the command line. - - In addition, the following table describes the special characters -which can appear in the prompt variables ‘PS0’, ‘PS1’, ‘PS2’, and ‘PS4’: +In addition, the following table describes the special characters which +can appear in the prompt variables ‘PS0’, ‘PS1’, ‘PS2’, and ‘PS4’: ‘\a’ A bell character. @@ -7161,19 +7365,19 @@ which can appear in the prompt variables ‘PS0’, ‘PS1’, ‘PS2’, and ‘\e’ An escape character. ‘\h’ - The hostname, up to the first '.'. + The hostname, up to the first ‘.’. ‘\H’ The hostname. ‘\j’ The number of jobs currently managed by the shell. ‘\l’ - The basename of the shell's terminal device name. + The basename of the shell's terminal device name (e.g., "ttys0"). ‘\n’ A newline. ‘\r’ A carriage return. ‘\s’ - The name of the shell, the basename of ‘$0’ (the portion following + The name of the shell: the basename of ‘$0’ (the portion following the final slash). ‘\t’ The time, in 24-hour HH:MM:SS format. @@ -7186,9 +7390,9 @@ which can appear in the prompt variables ‘PS0’, ‘PS1’, ‘PS2’, and ‘\u’ The username of the current user. ‘\v’ - The version of Bash (e.g., 2.00) + The Bash version (e.g., 2.00). ‘\V’ - The release of Bash, version + patchlevel (e.g., 2.00.0) + The Bash release, version + patchlevel (e.g., 2.00.0). ‘\w’ The value of the ‘PWD’ shell variable (‘$PWD’), with ‘$HOME’ abbreviated with a tilde (uses the ‘$PROMPT_DIRTRIM’ variable). @@ -7230,7 +7434,7 @@ File: bash.info, Node: The Restricted Shell, Next: Bash POSIX Mode, Prev: Con ========================= If Bash is started with the name ‘rbash’, or the ‘--restricted’ or ‘-r’ -option is supplied at invocation, the shell becomes restricted. A +option is supplied at invocation, the shell becomes RESTRICTED. A restricted shell is used to set up an environment more controlled than the standard shell. A restricted shell behaves identically to ‘bash’ with the exception that the following are disallowed or not performed: @@ -7241,6 +7445,8 @@ with the exception that the following are disallowed or not performed: • Specifying command names containing slashes. • Specifying a filename containing a slash as an argument to the ‘.’ builtin command. + • Using the ‘-p’ option to the ‘.’ builtin command to specify a + search path. • Specifying a filename containing a slash as an argument to the ‘history’ builtin command. • Specifying a filename containing a slash as an argument to the ‘-p’ @@ -7676,9 +7882,10 @@ migrate scripts to use current features and behavior. It's intended to be a temporary solution. This section does not mention behavior that is standard for a -particular version (e.g., setting ‘compat32’ means that quoting the rhs -of the regexp matching operator quotes special regexp characters in the -word, which is default behavior in bash-3.2 and subsequent versions). +particular version (e.g., setting ‘compat32’ means that quoting the +right hand side of the regexp matching operator quotes special regexp +characters in the word, which is default behavior in bash-3.2 and +subsequent versions). If a user enables, say, ‘compat32’, it may affect the behavior of other compatibility levels up to and including the current compatibility @@ -7697,13 +7904,14 @@ assigned to this variable (a decimal version number like 4.2, or an integer corresponding to the ‘compat’NN option, like 42) determines the compatibility level. - Starting with bash-4.4, Bash has begun deprecating older -compatibility levels. Eventually, the options will be removed in favor -of ‘BASH_COMPAT’. + Starting with bash-4.4, Bash began deprecating older compatibility +levels. Eventually, the options will be removed in favor of +‘BASH_COMPAT’. - Bash-5.0 was the final version for which there will be an individual -shopt option for the previous version. Users should control the -compatibility level with ‘BASH_COMPAT’. + Bash-5.0 was the final version for which there was an individual +shopt option for the previous version. ‘BASH_COMPAT’ is the only +mechanism to control the compatibility level in versions newer than +bash-5.0. The following table describes the behavior changes controlled by each compatibility level setting. The ‘compat’NN tag is used as shorthand @@ -7714,59 +7922,59 @@ and later versions, the ‘BASH_COMPAT’ variable is preferred, and it is required for bash-5.1 and later versions. ‘compat31’ - • quoting the rhs of the ‘[[’ command's regexp matching operator + • Quoting the rhs of the ‘[[’ command's regexp matching operator (=~) has no special effect ‘compat40’ - • the ‘<’ and ‘>’ operators to the ‘[[’ command do not consider + • The ‘<’ and ‘>’ operators to the ‘[[’ command do not consider the current locale when comparing strings; they use ASCII ordering. Bash versions prior to bash-4.1 use ASCII collation and strcmp(3); bash-4.1 and later use the current locale's collation sequence and strcoll(3). ‘compat41’ - • in posix mode, ‘time’ may be followed by options and still be + • In posix mode, ‘time’ may be followed by options and still be recognized as a reserved word (this is POSIX interpretation - 267) - • in posix mode, the parser requires that an even number of + 267). + • In posix mode, the parser requires that an even number of single quotes occur in the WORD portion of a double-quoted ${...} parameter expansion and treats them specially, so that characters within the single quotes are considered quoted - (this is POSIX interpretation 221) + (this is POSIX interpretation 221). ‘compat42’ - • the replacement string in double-quoted pattern substitution + • The replacement string in double-quoted pattern substitution does not undergo quote removal, as it does in versions after - bash-4.2 - • in posix mode, single quotes are considered special when + bash-4.2. + • In posix mode, single quotes are considered special when expanding the WORD portion of a double-quoted ${...} parameter expansion and can be used to quote a closing brace or other special character (this is part of POSIX interpretation 221); in later versions, single quotes are not special within - double-quoted word expansions + double-quoted word expansions. ‘compat43’ - • word expansion errors are considered non-fatal errors that + • Word expansion errors are considered non-fatal errors that cause the current command to fail, even in posix mode (the default behavior is to make them fatal errors that cause the - shell to exit) - • when executing a shell function, the loop state + shell to exit). + • When executing a shell function, the loop state (while/until/etc.) is not reset, so ‘break’ or ‘continue’ in that function will break or continue loops in the calling context. Bash-4.4 and later reset the loop state to prevent - this + this. ‘compat44’ - • the shell sets up the values used by ‘BASH_ARGV’ and + • The shell sets up the values used by ‘BASH_ARGV’ and ‘BASH_ARGC’ so they can expand to the shell's positional - parameters even if extended debugging mode is not enabled - • a subshell inherits loops from its parent context, so ‘break’ + parameters even if extended debugging mode is not enabled. + • A subshell inherits loops from its parent context, so ‘break’ or ‘continue’ will cause the subshell to exit. Bash-5.0 and - later reset the loop state to prevent the exit - • variable assignments preceding builtins like ‘export’ and + later reset the loop state to prevent the exit. + • Variable assignments preceding builtins like ‘export’ and ‘readonly’ that set attributes continue to affect variables with the same name in the calling environment even if the - shell is not in posix mode + shell is not in posix mode. ‘compat50 (set using BASH_COMPAT)’ • Bash-5.1 changed the way ‘$RANDOM’ is generated to introduce @@ -7774,7 +7982,7 @@ required for bash-5.1 and later versions. set to 50 or lower, it reverts to the method from bash-5.0 and previous versions, so seeding the random number generator by assigning a value to ‘RANDOM’ will produce the same sequence - as in bash-5.0 + as in bash-5.0. • If the command hash table is empty, Bash versions prior to bash-5.1 printed an informational message to that effect, even when producing output that can be reused as input. Bash-5.1 @@ -7784,21 +7992,21 @@ required for bash-5.1 and later versions. • The ‘unset’ builtin will unset the array ‘a’ given an argument like ‘a[@]’. Bash-5.2 will unset an element with key ‘@’ (associative arrays) or remove all the elements without - unsetting the array (indexed arrays) - • arithmetic commands ( ((...)) ) and the expressions in an - arithmetic for statement can be expanded more than once - • expressions used as arguments to arithmetic operators in the - ‘[[’ conditional command can be expanded more than once - • the expressions in substring parameter brace expansion can be - expanded more than once - • the expressions in the $(( ... )) word expansion can be - expanded more than once - • arithmetic expressions used as indexed array subscripts can be - expanded more than once + unsetting the array (indexed arrays). + • Arithmetic commands ( ((...)) ) and the expressions in an + arithmetic for statement can be expanded more than once. + • Expressions used as arguments to arithmetic operators in the + ‘[[’ conditional command can be expanded more than once. + • The expressions in substring parameter brace expansion can be + expanded more than once. + • The expressions in the $(( ... )) word expansion can be + expanded more than once. + • Arithmetic expressions used as indexed array subscripts can be + expanded more than once. • ‘test -v’, when given an argument of ‘A[@]’, where A is an existing associative array, will return true if the array has any set elements. Bash-5.2 will look for and report on a key - named ‘@’ + named ‘@’. • the ${PARAMETER[:]=VALUE} word expansion will return VALUE, before any variable-specific transformations have been performed (e.g., converting to lowercase). Bash-5.2 will @@ -7956,7 +8164,7 @@ File: bash.info, Node: Job Control Builtins, Next: Job Control Variables, Pre fg [JOBSPEC] Resume the job JOBSPEC in the foreground and make it the current - job. If JOBSPEC is not supplied, the current job is used. The + job. If JOBSPEC is not supplied, resume the current job. The return status is that of the command placed into the foreground, or non-zero if run when job control is disabled or, when run with job control enabled, JOBSPEC does not specify a valid job or JOBSPEC @@ -7985,8 +8193,9 @@ File: bash.info, Node: Job Control Builtins, Next: Job Control Variables, Pre ‘-s’ Display only stopped jobs. - If JOBSPEC is given, output is restricted to information about that - job. If JOBSPEC is not supplied, the status of all jobs is listed. + If JOBSPEC is supplied, ‘jobs’ restricts output to information + about that job. If JOBSPEC is not supplied, ‘jobs’ lists the + status of all jobs. If the ‘-x’ option is supplied, ‘jobs’ replaces any JOBSPEC found in COMMAND or ARGUMENTS with the corresponding process group ID, @@ -8001,23 +8210,26 @@ File: bash.info, Node: Job Control Builtins, Next: Job Control Variables, Pre by job specification JOBSPEC or process ID PID. SIGSPEC is either a case-insensitive signal name such as ‘SIGINT’ (with or without the ‘SIG’ prefix) or a signal number; SIGNUM is a signal number. - If SIGSPEC and SIGNUM are not present, ‘SIGTERM’ is used. The ‘-l’ - option lists the signal names. If any arguments are supplied when - ‘-l’ is given, the names of the signals corresponding to the - arguments are listed, and the return status is zero. EXIT_STATUS - is a number specifying a signal number or the exit status of a - process terminated by a signal. The ‘-L’ option is equivalent to - ‘-l’. The return status is zero if at least one signal was - successfully sent, or non-zero if an error occurs or an invalid - option is encountered. + If SIGSPEC and SIGNUM are not present, ‘kill’ sends ‘SIGTERM’. + + The ‘-l’ option lists the signal names. If any arguments are + supplied when ‘-l’ is supplied, the names of the signals + corresponding to the arguments are listed, and the return status is + zero. EXIT_STATUS is a number specifying a signal number or the + exit status of a process terminated by a signal. The ‘-L’ option + is equivalent to ‘-l’. + + The return status is zero if at least one signal was successfully + sent, or non-zero if an error occurs or an invalid option is + encountered. ‘wait’ wait [-fn] [-p VARNAME] [ID ...] Wait until the child process specified by each ID exits and return the exit status of the last ID. Each ID may be a PID or job - specification JOBSPEC; if a job spec is given, ‘wait’ waits for all - processes in the job. + specification JOBSPEC; if a job spec is supplied, ‘wait’ waits for + all processes in the job. If no options or IDs are supplied, ‘wait’ waits for all running background jobs and the last-executed process substitution, if its @@ -8031,9 +8243,9 @@ File: bash.info, Node: Job Control Builtins, Next: Job Control Variables, Pre If the ‘-p’ option is supplied, the process or job identifier of the job for which the exit status is returned is assigned to the - variable VARNAME named by the option argument. The variable will - be unset initially, before any assignment. This is useful only - when the ‘-n’ option is supplied. + variable VARNAME named by the option argument. The variable, which + cannot be readonly, will be unset initially, before any assignment. + This is useful only when the ‘-n’ option is supplied. Supplying the ‘-f’ option, when job control is enabled, forces ‘wait’ to wait for each ID to terminate before returning its @@ -8046,26 +8258,30 @@ File: bash.info, Node: Job Control Builtins, Next: Job Control Variables, Pre Otherwise, the return status is the exit status of the last ID. ‘disown’ - disown [-ar] [-h] [JOBSPEC ... | PID ... ] + disown [-ar] [-h] [ID ...] + + Without options, remove each ID from the table of active jobs. + Each ID may be a PID or job specification JOBSPEC; if ID is a PID, + ‘disown’ uses the job containing PID. If the ‘-h’ option is + supplied, the job is not removed from the table, but is marked so + that ‘SIGHUP’ is not sent to the job if the shell receives a + ‘SIGHUP’. If ID is not present, and neither the ‘-a’ nor the ‘-r’ + option is supplied, ‘disown’ removes the current job. + + If no ID is supplied, the ‘-a’ option means to remove or mark all + jobs; the ‘-r’ option without an ID argument restricts operation to + running jobs. - Without options, remove each JOBSPEC from the table of active jobs. - If the ‘-h’ option is given, the job is not removed from the table, - but is marked so that ‘SIGHUP’ is not sent to the job if the shell - receives a ‘SIGHUP’. If JOBSPEC is not present, and neither the - ‘-a’ nor the ‘-r’ option is supplied, the current job is used. If - no JOBSPEC is supplied, the ‘-a’ option means to remove or mark all - jobs; the ‘-r’ option without a JOBSPEC argument restricts - operation to running jobs. + The return value is 0 unless an ID does not specify a valid job. ‘suspend’ suspend [-f] Suspend the execution of this shell until it receives a ‘SIGCONT’ signal. A login shell, or a shell without job control enabled, - cannot be suspended; the ‘-f’ option can be used to override this - and force the suspension. The return status is 0 unless the shell - is a login shell or job control is not enabled and ‘-f’ is not - supplied. + cannot be suspended; the ‘-f’ option will override this and force + the suspension. The return status is 0 unless the shell is a login + shell or job control is not enabled and ‘-f’ is not supplied. When job control is not active, the ‘kill’ and ‘wait’ builtins do not accept JOBSPEC arguments. They must be supplied process IDs. @@ -8078,20 +8294,19 @@ File: bash.info, Node: Job Control Variables, Prev: Job Control Builtins, Up: ‘auto_resume’ This variable controls how the shell interacts with the user and - job control. If this variable exists then single word simple + job control. If this variable exists then single-word simple commands without redirections are treated as candidates for resumption of an existing job. There is no ambiguity allowed; if there is more than one job beginning with the string typed, then - the most recently accessed job will be selected. The name of a - stopped job, in this context, is the command line used to start it. - If this variable is set to the value ‘exact’, the string supplied - must match the name of a stopped job exactly; if set to - ‘substring’, the string supplied needs to match a substring of the - name of a stopped job. The ‘substring’ value provides - functionality analogous to the ‘%?’ job ID (*note Job Control - Basics::). If set to any other value, the supplied string must be - a prefix of a stopped job's name; this provides functionality - analogous to the ‘%’ job ID. + the most recently accessed job is selected. The name of a stopped + job, in this context, is the command line used to start it. If + this variable is set to the value ‘exact’, the string supplied must + match the name of a stopped job exactly; if set to ‘substring’, the + string supplied needs to match a substring of the name of a stopped + job. The ‘substring’ value provides functionality analogous to the + ‘%?’ job ID (*note Job Control Basics::). If set to any other + value, the supplied string must be a prefix of a stopped job's + name; this provides functionality analogous to the ‘%’ job ID.  File: bash.info, Node: Command Line Editing, Next: Using History Interactively, Prev: Job Control, Up: Top @@ -8752,6 +8967,9 @@ Variable Settings display a screenful of possible completions at a time. This variable is ‘on’ by default. + ‘prefer-visible-bell’ + See ‘bell-style’. + ‘print-completions-horizontally’ If set to ‘on’, Readline will display completions with matches sorted horizontally in alphabetical order, rather than down @@ -9838,10 +10056,10 @@ File: bash.info, Node: Programmable Completion, Next: Programmable Completion 8.6 Programmable Completion =========================== -When word completion is attempted for an argument to a command for which -a completion specification (a COMPSPEC) has been defined using the -‘complete’ builtin (*note Programmable Completion Builtins::), the -programmable completion facilities are invoked. +When the user attempts word completion for an argument to a command for +which a completion specification (a COMPSPEC) has been defined using the +‘complete’ builtin (*note Programmable Completion Builtins::), +\fBreadline\fP invokes the programmable completion facilities. First, the command name is identified. If a compspec has been defined for that command, the compspec is used to generate the list of @@ -9849,13 +10067,13 @@ possible completions for the word. If the command word is the empty string (completion attempted at the beginning of an empty line), any compspec defined with the ‘-E’ option to ‘complete’ is used. If the command word is a full pathname, a compspec for the full pathname is -searched for first. If no compspec is found for the full pathname, an -attempt is made to find a compspec for the portion following the final -slash. If those searches do not result in a compspec, any compspec -defined with the ‘-D’ option to ‘complete’ is used as the default. If -there is no default compspec, Bash attempts alias expansion on the -command word as a final resort, and attempts to find a compspec for the -command word from any successful expansion +searched for first. If no compspec is found for the full pathname, +completion attempts to find a compspec for the portion following the +final slash. If those searches do not result in a compspec, any +compspec defined with the ‘-D’ option to ‘complete’ is used as the +default. If there is no default compspec, Bash attempts alias expansion +on the command word as a final resort, and attempts to find a compspec +for the command word from any successful expansion. Once a compspec has been found, it is used to generate the list of matching words. If a compspec is not found, the default Bash completion @@ -9907,7 +10125,8 @@ generate the matches. It must put the possible completions in the Next, any command specified with the ‘-C’ option is invoked in an environment equivalent to command substitution. It should print a list of completions, one per line, to the standard output. Backslash may be -used to escape a newline, if necessary. +used to escape a newline, if necessary. These are added to the set of +possible completions. After all of the possible completions are generated, any filter specified with the ‘-X’ option is applied to the list. The filter is a @@ -9923,8 +10142,7 @@ characters. Finally, any prefix and suffix specified with the ‘-P’ and ‘-S’ options are added to each member of the completion list, and the result -is returned to the Readline completion code as the list of possible -completions. +is returned to Readline as the list of possible completions. If the previously-applied actions do not generate any matches, and the ‘-o dirnames’ option was supplied to ‘complete’ when the compspec @@ -9936,13 +10154,13 @@ matches are added to the results of the other actions. By default, if a compspec is found, whatever it generates is returned to the completion code as the full set of possible completions. The -default Bash completions are not attempted, and the Readline default of -filename completion is disabled. If the ‘-o bashdefault’ option was -supplied to ‘complete’ when the compspec was defined, the default Bash -completions are attempted if the compspec generates no matches. If the -‘-o default’ option was supplied to ‘complete’ when the compspec was -defined, Readline's default completion will be performed if the compspec -(and, if attempted, the default Bash completions) generate no matches. +default Bash completions and the Readline default of filename completion +are disabled. If the ‘-o bashdefault’ option was supplied to ‘complete’ +when the compspec was defined, if the compspec generates no matches, the +default Bash completions are attempted. If the ‘-o default’ option was +supplied to ‘complete’ when the compspec was defined, Readline's default +completion will be performed if the compspec (and, if attempted, the +default Bash completions) generate no matches. When a compspec indicates that directory name completion is desired, the programmable completion functions force Readline to append a slash @@ -10002,7 +10220,8 @@ happening. The matches will be generated in the same way as if the programmable completion code had generated them directly from a completion specification with the same flags. If WORD is - specified, only those completions matching WORD will be displayed. + specified, only those completions matching WORD will be displayed + or stored. The return value is true unless an invalid option is supplied, or no matches were generated. @@ -10085,8 +10304,8 @@ happening. ‘plusdirs’ After any matches defined by the compspec are generated, - directory name completion is attempted and any matches - are added to the results of the other actions. + attempt directory name completion and add any matches to + the results of the other actions. ‘-A ACTION’ The ACTION may be one of the following to generate a list of @@ -10184,26 +10403,30 @@ happening. command whose arguments are being completed, $2 is the word being completed, and $3 is the word preceding the word being completed, as described above (*note Programmable - Completion::). When it finishes, the possible completions are - retrieved from the value of the ‘COMPREPLY’ array variable. + Completion::). When ‘function’ finishes, the possible + completions are retrieved from the value of the ‘COMPREPLY’ + array variable. ‘-G GLOBPAT’ - The filename expansion pattern GLOBPAT is expanded to generate - the possible completions. + Expand the filename expansion pattern GLOBPAT to generate the + possible completions. ‘-P PREFIX’ - PREFIX is added at the beginning of each possible completion - after all other options have been applied. + Add PREFIX to the beginning of each possible completion after + all other options have been applied. ‘-S SUFFIX’ - SUFFIX is appended to each possible completion after all other + Append SUFFIX to each possible completion after all other options have been applied. ‘-W WORDLIST’ The WORDLIST is split using the characters in the ‘IFS’ - special variable as delimiters, and each resultant word is - expanded. The possible completions are the members of the - resultant list which match the word being completed. + special variable as delimiters, and each resulting word is + expanded. Shell quoting is honored within WORDLIST in order + to provide a mechanism for the words to contain shell + metacharacters or characters in the value of ‘IFS’. The + possible completions are the members of the resultant list + which match the word being completed. ‘-X FILTERPAT’ FILTERPAT is a pattern as used for filename expansion. It is @@ -10390,17 +10613,29 @@ shell stores each command in the history list prior to parameter and variable expansion but after history expansion is performed, subject to the values of the shell variables ‘HISTIGNORE’ and ‘HISTCONTROL’. - When the shell starts up, the history is initialized from the file -named by the ‘HISTFILE’ variable (default ‘~/.bash_history’). The file -named by the value of ‘HISTFILE’ is truncated, if necessary, to contain -no more than the number of lines specified by the value of the -‘HISTFILESIZE’ variable. When a shell with history enabled exits, the -last ‘$HISTSIZE’ lines are copied from the history list to the file -named by ‘$HISTFILE’. If the ‘histappend’ shell option is set (*note -Bash Builtins::), the lines are appended to the history file, otherwise -the history file is overwritten. If ‘HISTFILE’ is unset or null, or if -the history file is unwritable, the history is not saved. After saving -the history, the history file is truncated to contain no more than + When the shell starts up, Bash initializes the history list by +reading history entries from the file named by the ‘HISTFILE’ variable +(default ‘~/.bash_history’). This is referred to as the “history file”. +That file is truncated, if necessary, to contain no more than the number +of history entries specified by the value of the ‘HISTFILESIZE’ +variable. If ‘HISTFILESIZE’ is unset, or set to null, a non-numeric +value, or a numeric value less than zero, the history file is not +truncated. + + When the history file is read, lines beginning with the history +comment character followed immediately by a digit are interpreted as +timestamps for the following history entry. These timestamps are +optionally displayed depending on the value of the ‘HISTTIMEFORMAT’ +variable (*note Bash Variables::). When present, history timestamps +delimit history entries, making multi-line entries possible. + + When a shell with history enabled exits, Bash copies the last +‘$HISTSIZE’ entries from the history list to the file named by +‘$HISTFILE’. If the ‘histappend’ shell option is set (*note Bash +Builtins::), Bash appends the entries to the history file, otherwise the +history file is overwritten. If ‘HISTFILE’ is unset or null, or if the +history file is unwritable, the history is not saved. After saving the +history, Bash truncates the history file to contain no more than ‘$HISTFILESIZE’ lines. If ‘HISTFILESIZE’ is unset, or set to null, a non-numeric value, or a numeric value less than zero, the history file is not truncated. @@ -10409,24 +10644,25 @@ is not truncated. with each history entry is written to the history file, marked with the history comment character. When the history file is read, lines beginning with the history comment character followed immediately by a -digit are interpreted as timestamps for the following history entry. +digit are interpreted as timestamps for the following history entry. As +above, when using ‘HISTTIMEFORMAT’, the timestamps delimit multi-line +history entries. - The ‘fc’ builtin command may be used to list or edit and re-execute a -portion of the history list. The ‘history’ builtin may be used to -display or modify the history list and manipulate the history file. -When using command-line editing, search commands are available in each -editing mode that provide access to the history list (*note Commands For -History::). + The ‘fc’ builtin command will list or edit and re-execute a portion +of the history list. The ‘history’ builtin can display or modify the +history list and manipulate the history file. When using command-line +editing, search commands are available in each editing mode that provide +access to the history list (*note Commands For History::). The shell allows control over which commands are saved on the history -list. The ‘HISTCONTROL’ and ‘HISTIGNORE’ variables are used to cause -the shell to save only a subset of the commands entered. The ‘cmdhist’ -shell option, if enabled, causes the shell to attempt to save each line -of a multi-line command in the same history entry, adding semicolons -where necessary to preserve syntactic correctness. The ‘lithist’ shell -option causes the shell to save the command with embedded newlines -instead of semicolons. The ‘shopt’ builtin is used to set these -options. *Note The Shopt Builtin::, for a description of ‘shopt’. +list. The ‘HISTCONTROL’ and ‘HISTIGNORE’ variables are used to save +only a subset of the commands entered. The ‘cmdhist’ shell option, if +enabled, causes the shell to attempt to save each line of a multi-line +command in the same history entry, adding semicolons where necessary to +preserve syntactic correctness. The ‘lithist’ shell option modifies +‘cmdhist’ by saving the command with embedded newlines instead of +semicolons. The ‘shopt’ builtin is used to set these options. *Note +The Shopt Builtin::, for a description of ‘shopt’.  File: bash.info, Node: Bash History Builtins, Next: History Interaction, Prev: Bash History Facilities, Up: Using History Interactively @@ -10454,25 +10690,38 @@ history file. If LAST is not specified, it is set to FIRST. If FIRST is not specified, it is set to the previous command for editing and −16 - for listing. If the ‘-l’ flag is given, the commands are listed on - standard output. The ‘-n’ flag suppresses the command numbers when - listing. The ‘-r’ flag reverses the order of the listing. - Otherwise, the editor given by ENAME is invoked on a file - containing those commands. If ENAME is not given, the value of the - following variable expansion is used: ‘${FCEDIT:-${EDITOR:-vi}}’. - This says to use the value of the ‘FCEDIT’ variable if set, or the - value of the ‘EDITOR’ variable if that is set, or ‘vi’ if neither - is set. When editing is complete, the edited commands are echoed - and executed. - - In the second form, COMMAND is re-executed after each instance of - PAT in the selected command is replaced by REP. COMMAND is + for listing. + + If the ‘-l’ flag is supplied, the commands are listed on standard + output. The ‘-n’ flag suppresses the command numbers when listing. + The ‘-r’ flag reverses the order of the listing. + + Otherwise, ‘fc’ invokes the editor named by ENAME on a file + containing those commands. If ENAME is not supplied, ‘fc’ uses the + value of the following variable expansion: + ‘${FCEDIT:-${EDITOR:-vi}}’. This says to use the value of the + ‘FCEDIT’ variable if set, or the value of the ‘EDITOR’ variable if + that is set, or ‘vi’ if neither is set. When editing is complete, + ‘fc’ reads the file of edited commands and echoes and executes + them. + + In the second form, ‘fc’ re-executes COMMAND after replacing each + instance of PAT in the selected command with REP. COMMAND is interpreted the same as FIRST above. A useful alias to use with the ‘fc’ command is ‘r='fc -s'’, so that typing ‘r cc’ runs the last command beginning with ‘cc’ and typing ‘r’ re-executes the last command (*note Aliases::). + If the first form is used, the return value is zero unless an + invalid option is encountered or FIRST or LAST specify history + lines out of range. When editing and re-executing a file of + commands, the return value is the value of the last command + executed or failure if an error occurs with the temporary file. If + the second form is used, the return status is that of the + re-executed command, unless COMMAND does not specify a valid + history entry, in which case ‘fc’ returns a non-zero status. + ‘history’ history [N] history -c @@ -10481,19 +10730,20 @@ history file. history [-anrw] [FILENAME] history -ps ARG - With no options, display the history list with line numbers. Lines + With no options, display the history list with numbers. Entries prefixed with a ‘*’ have been modified. An argument of N lists - only the last N lines. If the shell variable ‘HISTTIMEFORMAT’ is + only the last N entries. If the shell variable ‘HISTTIMEFORMAT’ is set and not null, it is used as a format string for ‘strftime’(3) to display the time stamp associated with each displayed history - entry. No intervening blank is printed between the formatted time - stamp and the history line. + entry. If ‘history’ uses ‘HISTTIMEFORMAT’, it does not print an + intervening space between the formatted time stamp and the history + entry. Options, if supplied, have the following meanings: ‘-c’ Clear the history list. This may be combined with the other - options to replace the history list completely. + options to replace the history list. ‘-d OFFSET’ Delete the history entry at position OFFSET. If OFFSET is @@ -10510,7 +10760,7 @@ history file. and END are interpreted as described above. ‘-a’ - Append the new history lines to the history file. These are + Append the "new" history lines to the history file. These are history lines entered since the beginning of the current Bash session, but not already appended to the history file. @@ -10525,7 +10775,8 @@ history file. list. ‘-w’ - Write out the current history list to the history file. + Write the current history list to the history file, + overwriting it. ‘-p’ Perform history substitution on the ARGs and display the @@ -10533,13 +10784,21 @@ history file. the history list. ‘-s’ - The ARGs are added to the end of the history list as a single - entry. - - If a FILENAME argument is supplied when any of the ‘-w’, ‘-r’, - ‘-a’, or ‘-n’ options is used, Bash uses FILENAME as the history - file. If not, then the value of the ‘HISTFILE’ variable is used. - If ‘HISTFILE’ is unset or null, these options have no effect. + Add the ARGs to the end of the history list as a single entry. + The last command in the history list is removed before adding + the ARGs. + + If a FILENAME argument is supplied with any of the ‘-w’, ‘-r’, + ‘-a’, or ‘-n’ options, Bash uses FILENAME as the history file. If + not, it uses the value of the ‘HISTFILE’ variable. If ‘HISTFILE’ + is unset or null, these options have no effect. + + If the ‘HISTTIMEFORMAT’ variable is set, ‘history’ writes the time + stamp information associated with each history entry to the history + file, marked with the history comment character. When the history + file is read, lines beginning with the history comment character + followed immediately by a digit are interpreted as timestamps for + the following history entry. The return value is 0 unless an invalid option is encountered, an error occurs while reading or writing the history file, an invalid @@ -10552,9 +10811,15 @@ File: bash.info, Node: History Interaction, Prev: Bash History Builtins, Up: 9.3 History Expansion ===================== -The History library provides a history expansion feature that is similar -to the history expansion provided by ‘csh’. This section describes the -syntax used to manipulate the history information. +The shell provides a history expansion feature that is similar to the +history expansion provided by ‘csh’ (also referred to as history +substitution where appropriate). This section describes the syntax used +to manipulate the history information. + + History expansion is enabled by default for interactive shells, and +can be disabled using the ‘+H’ option to the ‘set’ builtin command +(*note The Set Builtin::). Non-interactive shells do not perform +history expansion by default, but it can be enabled with ‘set -H’. History expansions introduce words from the history list into the input stream, making it easy to repeat commands, insert the arguments to @@ -10567,17 +10832,17 @@ line individually. Bash attempts to inform the history expansion functions about quoting still in effect from previous lines. History expansion takes place in two parts. The first is to -determine which line from the history list should be used during -substitution. The second is to select portions of that line for -inclusion into the current one. - - The line selected from the history is called the “event”, and the -portions of that line that are acted upon are called “words”. The line -is broken into words in the same fashion that Bash does, so that several -words surrounded by quotes are considered one word. The “event -designator” selects the event, the optional “word designator” selects -words from the event, and various optional “modifiers” are available to -manipulate the selected words. +determine which entry from the history list should be used during +substitution. The second is to select portions of that entry to include +into the current one. + + The entry selected from the history is called the “event”, and the +portions of that entry that are acted upon are called “words”. The +history entry is broken into words in the same fashion that Bash does, +so that several words surrounded by quotes are considered one word. The +“event designator” selects the event, the optional “word designator” +selects words from the event, and various optional “modifiers” are +available to manipulate the selected words. History expansions are introduced by the appearance of the history expansion character, which is ‘!’ by default. History expansions may @@ -10596,26 +10861,32 @@ history expansion character, but the history expansion character is also treated as quoted if it immediately precedes the closing double quote in a double-quoted string. + Several characters inhibit history expansion if found immediately +following the history expansion character, even if it is unquoted: +space, tab, newline, carriage return, ‘=’, and the other shell +metacharacters. + There is a special abbreviation for substitution, active when the QUICK SUBSTITUTION character (default ‘^’) is the first character on the -line. It selects the previous history list entry, using an event -designator equivalent to ‘!!’, and substitutes one string for another in -that line. It is described below (*note Event Designators::). This is -the only history expansion that does not begin with the history -expansion character. +line. It selects the previous history entry, using an event designator +equivalent to ‘!!’, and substitutes one string for another in that +entry. It is described below (*note Event Designators::). This is the +only history expansion that does not begin with the history expansion +character. Several shell options settable with the ‘shopt’ builtin (*note The -Shopt Builtin::) may be used to tailor the behavior of history -expansion. If the ‘histverify’ shell option is enabled, and Readline is -being used, history substitutions are not immediately passed to the -shell parser. Instead, the expanded line is reloaded into the Readline -editing buffer for further modification. If Readline is being used, and -the ‘histreedit’ shell option is enabled, a failed history expansion -will be reloaded into the Readline editing buffer for correction. The -‘-p’ option to the ‘history’ builtin command may be used to see what a -history expansion will do before using it. The ‘-s’ option to the -‘history’ builtin may be used to add commands to the end of the history -list without actually executing them, so that they are available for +Shopt Builtin::) will modify history expansion behavior If the +‘histverify’ shell option is enabled, and Readline is being used, +history substitutions are not immediately passed to the shell parser. +Instead, the expanded line is reloaded into the Readline editing buffer +for further modification. If Readline is being used, and the +‘histreedit’ shell option is enabled, a failed history expansion is +reloaded into the Readline editing buffer for correction. + + The ‘-p’ option to the ‘history’ builtin command shows what a history +expansion will do before using it. The ‘-s’ option to the ‘history’ +builtin may be used to add commands to the end of the history list +without actually executing them, so that they are available for subsequent recall. This is most useful in conjunction with Readline. The shell allows control of the various characters used by the @@ -10635,12 +10906,12 @@ File: bash.info, Node: Event Designators, Next: Word Designators, Up: History 9.3.1 Event Designators ----------------------- -An event designator is a reference to a command line entry in the -history list. Unless the reference is absolute, events are relative to -the current position in the history list. The event designator consists -of the portion of the word beginning with the history expansion -character, and ending with the word designator if one is present, or the -end of the word. +An event designator is a reference to an entry in the history list. +Unless the reference is absolute, events are relative to the current +position in the history list. The event designator consists of the +portion of the word beginning with the history expansion character, and +ending with the word designator if one is present, or the end of the +word. ‘!’ Start a history substitution, except when followed by a space, tab, @@ -10648,10 +10919,10 @@ end of the word. defined above (*note Definitions::). ‘!N’ - Refer to command line N. + Refer to history list entry N. ‘!-N’ - Refer to the command N lines back. + Refer to the history entry N entries back. ‘!!’ Refer to the previous command. This is a synonym for ‘!-1’. @@ -10664,8 +10935,8 @@ end of the word. Refer to the most recent command preceding the current position in the history list containing STRING. The trailing ‘?’ may be omitted if the STRING is followed immediately by a newline. If - STRING is missing, the string from the most recent search is used; - it is an error if there is no previous search string. + STRING is missing, this uses the string from the most recent + search; it is an error if there is no previous search string. ‘^STRING1^STRING2^’ Quick Substitution. Repeat the last command, replacing STRING1 @@ -10712,10 +10983,11 @@ spaces. The Nth word. ‘^’ - The first argument; that is, word 1. + The first argument: word 1. ‘$’ - The last argument. + The last argument. This is usually the last argument, but will + expand to the zeroth word if there is only one word in the line. ‘%’ The first word matched by the most recent ‘?STRING?’ search, if the @@ -10730,17 +11002,17 @@ spaces. ‘*’ All of the words, except the ‘0’th. This is a synonym for ‘1-$’. It is not an error to use ‘*’ if there is just one word in the - event; the empty string is returned in that case. + event; it expands to the empty string in this case. ‘X*’ - Abbreviates ‘X-$’ + Abbreviates ‘X-$’. ‘X-’ Abbreviates ‘X-$’ like ‘X*’, but omits the last word. If ‘x’ is missing, it defaults to 0. If a word designator is supplied without an event specification, the -previous command is used as the event. +previous command is used as the event, equivalent to ‘!!’.  File: bash.info, Node: Modifiers, Prev: Word Designators, Up: History Interaction @@ -10774,18 +11046,18 @@ or edit, the word or words selected from the history event. ‘x’ Quote the substituted words as with ‘q’, but break into words at spaces, tabs, and newlines. The ‘q’ and ‘x’ modifiers are mutually - exclusive; the last one supplied is used. + exclusive; expansion uses the last one supplied. ‘s/OLD/NEW/’ Substitute NEW for the first occurrence of OLD in the event line. Any character may be used as the delimiter in place of ‘/’. The delimiter may be quoted in OLD and NEW with a single backslash. If - ‘&’ appears in NEW, it is replaced by OLD. A single backslash will - quote the ‘&’. If OLD is null, it is set to the last OLD - substituted, or, if no previous history substitutions took place, - the last STRING in a !?STRING‘[?]’ search. If NEW is null, each - matching OLD is deleted. The final delimiter is optional if it is - the last character on the input line. + ‘&’ appears in NEW, it is replaced with OLD. A single backslash + will quote the ‘&’ in OLD and NEW. If OLD is null, it is set to + the last OLD substituted, or, if no previous history substitutions + took place, the last STRING in a !?STRING‘[?]’ search. If NEW is + null, each matching OLD is deleted. The final delimiter is + optional if it is the last character on the input line. ‘&’ Repeat the previous substitution. @@ -10809,7 +11081,7 @@ This chapter provides basic instructions for installing Bash on the various supported platforms. The distribution supports the GNU operating systems, nearly every version of Unix, and several non-Unix systems such as BeOS and Interix. Other independent ports exist for -MS-DOS, OS/2, and Windows platforms. +Windows platforms. * Menu: @@ -10856,8 +11128,8 @@ These are installation instructions for Bash. files, some supplemental documentation, a number of example loadable builtin commands, and a set of header files for developing loadable builtins. You may need additional privileges to install - ‘bash’ to your desired destination, so ‘sudo make install’ might be - required. More information about controlling the locations where + ‘bash’ to your desired destination, which may require ‘sudo make + install’. More information about controlling the locations where ‘bash’ and other files are installed is below (*note Installation Names::). @@ -11083,7 +11355,7 @@ File: bash.info, Node: Optional Features, Prev: Operation Controls, Up: Insta The Bash ‘configure’ has a number of ‘--enable-FEATURE’ options, where FEATURE indicates an optional part of Bash. There are also several ‘--with-PACKAGE’ options, where PACKAGE is something like ‘bash-malloc’ -or ‘purify’. To turn off the default use of a package, use +or ‘afs’. To turn off the default use of a package, use ‘--without-PACKAGE’. To configure Bash without a feature that is enabled by default, use ‘--disable-FEATURE’. @@ -11095,18 +11367,18 @@ the Bash ‘configure’ recognizes. ‘--with-bash-malloc’ Use the Bash version of ‘malloc’ in the directory ‘lib/malloc’. - This is not the same ‘malloc’ that appears in GNU libc, but an - older version originally derived from the 4.2 BSD ‘malloc’. This - ‘malloc’ is very fast, but wastes some space on each allocation. - This option is enabled by default. The ‘NOTES’ file contains a - list of systems for which this should be turned off, and - ‘configure’ disables this option automatically for a number of - systems. + This is not the same ‘malloc’ that appears in GNU libc, but a + custom version originally derived from the 4.2 BSD ‘malloc’. This + ‘malloc’ is very fast, but wastes some space on each allocation, + though it uses several techniques to minimize the waste. This + option is enabled by default. The ‘NOTES’ file contains a list of + systems for which this should be turned off, and ‘configure’ + disables this option automatically for a number of systems. ‘--with-curses’ - Use the curses library instead of the termcap library. This should - be supplied if your system has an inadequate or incomplete termcap - database. + Use the curses library instead of the termcap library. ‘configure’ + usually chooses this automatically, since most systems include the + termcap functions in the curses library. ‘--with-gnu-malloc’ A synonym for ‘--with-bash-malloc’. @@ -11123,7 +11395,9 @@ the Bash ‘configure’ recognizes. set to any other value, ‘configure’ treats it as a directory pathname and looks for the installed version of Readline in subdirectories of that directory (include files in PREFIX/‘include’ - and the library in PREFIX/‘lib’). + and the library in PREFIX/‘lib’). The Bash default is to link with + a static library built in the ‘lib/readline’ subdirectory of the + build directory. ‘--with-libintl-prefix[=PREFIX]’ Define this to make Bash link with a locally-installed version of @@ -11131,10 +11405,11 @@ the Bash ‘configure’ recognizes. ‘--with-libiconv-prefix[=PREFIX]’ Define this to make Bash look for libiconv in PREFIX instead of the - standard system locations. There is no version included with Bash. + standard system locations. The Bash distribution does not include + this library. ‘--enable-minimal-config’ - This produces a shell with minimal features, close to the + This produces a shell with minimal features, closer to the historical Bourne shell. There are several ‘--enable-’ options that alter how Bash is @@ -11191,6 +11466,12 @@ does not provide the necessary support. Include support for ‘csh’-like history substitution (*note History Interaction::). +‘--enable-bash-source-fullpath-default’ + Set the default value of the ‘bash_source_fullpath’ shell option + described above under *note The Shopt Builtin:: to be enabled. + This controls how filenames are assigned to the ‘BASH_SOURCE’ array + variable. + ‘--enable-brace-expansion’ Include ‘csh’-like brace expansion ( ‘b{a,b}c’ ↦ ‘bac bbc’ ). See *note Brace Expansion::, for a complete description. @@ -11207,8 +11488,9 @@ does not provide the necessary support. ‘--enable-command-timing’ Include support for recognizing ‘time’ as a reserved word and for displaying timing statistics for the pipeline following ‘time’ - (*note Pipelines::). This allows pipelines as well as shell - builtins and functions to be timed. + (*note Pipelines::). This allows timing pipelines, shell compound + commands, shell builtins, and shell functions, which an external + command cannot do easily. ‘--enable-cond-command’ Include support for the ‘[[’ conditional command. (*note @@ -11311,13 +11593,13 @@ does not provide the necessary support. version of the Readline library (*note Command Line Editing::). ‘--enable-restricted’ - Include support for a “restricted shell”. If this is enabled, - Bash, when called as ‘rbash’, enters a restricted mode. See *note - The Restricted Shell::, for a description of restricted mode. + Include support for a “restricted shell”. If this is enabled, Bash + enters a restricted mode when called as ‘rbash’. See *note The + Restricted Shell::, for a description of restricted mode. ‘--enable-select’ - Include the ‘select’ compound command, which allows the generation - of simple menus (*note Conditional Constructs::). + Include the ‘select’ compound command, which allows generation of + simple menus (*note Conditional Constructs::). ‘--enable-single-help-strings’ Store the text displayed by the ‘help’ builtin as a single string @@ -11357,8 +11639,8 @@ Appendix A Reporting Bugs Please report all bugs you find in Bash. But first, you should make sure that it really is a bug, and that it appears in the latest version -of Bash. The latest version of Bash is always available for FTP from - and from +of Bash. The latest released version of Bash is always available for +FTP from and from . Once you have determined that a bug actually exists, use the @@ -12298,100 +12580,100 @@ D.1 Index of Shell Builtin Commands * .: Bourne Shell Builtins. (line 17) * [: Bourne Shell Builtins. - (line 289) + (line 333) * alias: Bash Builtins. (line 11) * bg: Job Control Builtins. (line 7) -* bind: Bash Builtins. (line 21) +* bind: Bash Builtins. (line 24) * break: Bourne Shell Builtins. - (line 41) -* builtin: Bash Builtins. (line 124) -* caller: Bash Builtins. (line 133) + (line 47) +* builtin: Bash Builtins. (line 133) +* caller: Bash Builtins. (line 142) * cd: Bourne Shell Builtins. - (line 49) -* command: Bash Builtins. (line 150) + (line 55) +* command: Bash Builtins. (line 159) * compgen: Programmable Completion Builtins. (line 12) * complete: Programmable Completion Builtins. - (line 36) + (line 37) * compopt: Programmable Completion Builtins. - (line 248) + (line 253) * continue: Bourne Shell Builtins. - (line 94) -* declare: Bash Builtins. (line 170) + (line 102) +* declare: Bash Builtins. (line 179) * dirs: Directory Stack Builtins. (line 7) * disown: Job Control Builtins. - (line 110) -* echo: Bash Builtins. (line 273) -* enable: Bash Builtins. (line 322) + (line 114) +* echo: Bash Builtins. (line 284) +* enable: Bash Builtins. (line 337) * eval: Bourne Shell Builtins. - (line 103) -* exec: Bourne Shell Builtins. (line 111) +* exec: Bourne Shell Builtins. + (line 119) * exit: Bourne Shell Builtins. - (line 129) + (line 141) * export: Bourne Shell Builtins. - (line 136) + (line 148) * false: Bourne Shell Builtins. - (line 152) + (line 170) * fc: Bash History Builtins. (line 10) * fg: Job Control Builtins. (line 17) * getopts: Bourne Shell Builtins. - (line 157) + (line 175) * hash: Bourne Shell Builtins. - (line 201) -* help: Bash Builtins. (line 360) + (line 226) +* help: Bash Builtins. (line 374) * history: Bash History Builtins. - (line 46) + (line 59) * jobs: Job Control Builtins. (line 27) * kill: Job Control Builtins. - (line 58) -* let: Bash Builtins. (line 379) -* local: Bash Builtins. (line 387) -* logout: Bash Builtins. (line 404) -* mapfile: Bash Builtins. (line 409) + (line 59) +* let: Bash Builtins. (line 394) +* local: Bash Builtins. (line 403) +* logout: Bash Builtins. (line 428) +* mapfile: Bash Builtins. (line 433) * popd: Directory Stack Builtins. - (line 35) -* printf: Bash Builtins. (line 455) + (line 37) +* printf: Bash Builtins. (line 478) * pushd: Directory Stack Builtins. - (line 69) + (line 70) * pwd: Bourne Shell Builtins. - (line 226) -* read: Bash Builtins. (line 525) -* readarray: Bash Builtins. (line 631) + (line 258) +* read: Bash Builtins. (line 548) +* readarray: Bash Builtins. (line 659) * readonly: Bourne Shell Builtins. - (line 236) + (line 270) * return: Bourne Shell Builtins. - (line 255) + (line 295) * set: The Set Builtin. (line 11) * shift: Bourne Shell Builtins. - (line 276) + (line 320) * shopt: The Shopt Builtin. (line 9) -* source: Bash Builtins. (line 640) +* source: Bash Builtins. (line 668) * suspend: Job Control Builtins. - (line 122) + (line 131) * test: Bourne Shell Builtins. - (line 289) + (line 333) * times: Bourne Shell Builtins. - (line 391) + (line 433) * trap: Bourne Shell Builtins. - (line 397) + (line 439) * true: Bourne Shell Builtins. - (line 459) -* type: Bash Builtins. (line 645) -* typeset: Bash Builtins. (line 683) -* ulimit: Bash Builtins. (line 689) + (line 505) +* type: Bash Builtins. (line 673) +* typeset: Bash Builtins. (line 710) +* ulimit: Bash Builtins. (line 716) * umask: Bourne Shell Builtins. - (line 464) -* unalias: Bash Builtins. (line 795) + (line 510) +* unalias: Bash Builtins. (line 824) * unset: Bourne Shell Builtins. - (line 482) + (line 528) * wait: Job Control Builtins. - (line 76) + (line 80)  File: bash.info, Node: Reserved Word Index, Next: Variable Index, Prev: Builtin Index, Up: Indexes @@ -12404,9 +12686,9 @@ D.2 Index of Shell Reserved Words * !: Pipelines. (line 9) * [[: Conditional Constructs. - (line 125) + (line 126) * ]]: Conditional Constructs. - (line 125) + (line 126) * {: Command Grouping. (line 21) * }: Command Grouping. (line 21) * case: Conditional Constructs. @@ -12428,7 +12710,7 @@ D.2 Index of Shell Reserved Words * in: Conditional Constructs. (line 28) * select: Conditional Constructs. - (line 83) + (line 84) * then: Conditional Constructs. (line 7) * time: Pipelines. (line 9) @@ -12445,51 +12727,51 @@ D.3 Parameter and Variable Index * Menu: * _: Bash Variables. (line 13) -* -: Special Parameters. (line 46) -* !: Special Parameters. (line 55) -* ?: Special Parameters. (line 42) -* @: Special Parameters. (line 22) -* *: Special Parameters. (line 9) -* #: Special Parameters. (line 39) -* $: Special Parameters. (line 51) +* -: Special Parameters. (line 48) +* !: Special Parameters. (line 57) +* ?: Special Parameters. (line 44) +* @: Special Parameters. (line 23) +* *: Special Parameters. (line 10) +* #: Special Parameters. (line 41) +* $: Special Parameters. (line 53) * $_: Bash Variables. (line 14) -* $-: Special Parameters. (line 47) -* $!: Special Parameters. (line 56) -* $?: Special Parameters. (line 43) -* $@: Special Parameters. (line 23) -* $*: Special Parameters. (line 10) -* $#: Special Parameters. (line 40) -* $$: Special Parameters. (line 52) -* $0: Special Parameters. (line 61) -* 0: Special Parameters. (line 60) +* $-: Special Parameters. (line 49) +* $!: Special Parameters. (line 58) +* $?: Special Parameters. (line 45) +* $@: Special Parameters. (line 24) +* $*: Special Parameters. (line 11) +* $#: Special Parameters. (line 42) +* $$: Special Parameters. (line 54) +* $0: Special Parameters. (line 63) +* 0: Special Parameters. (line 62) * active-region-end-color: Readline Init File Syntax. (line 51) * active-region-start-color: Readline Init File Syntax. (line 38) * auto_resume: Job Control Variables. (line 6) -* BASH: Bash Variables. (line 23) -* BASH_ALIASES: Bash Variables. (line 42) -* BASH_ARGC: Bash Variables. (line 51) -* BASH_ARGV: Bash Variables. (line 65) -* BASH_ARGV0: Bash Variables. (line 78) -* BASH_CMDS: Bash Variables. (line 86) -* BASH_COMMAND: Bash Variables. (line 95) -* BASH_COMPAT: Bash Variables. (line 102) -* BASH_ENV: Bash Variables. (line 118) -* BASH_EXECUTION_STRING: Bash Variables. (line 124) -* BASH_LINENO: Bash Variables. (line 127) -* BASH_LOADABLES_PATH: Bash Variables. (line 137) -* BASH_MONOSECONDS: Bash Variables. (line 141) -* BASH_REMATCH: Bash Variables. (line 148) -* BASH_SOURCE: Bash Variables. (line 156) -* BASH_SUBSHELL: Bash Variables. (line 164) -* BASH_TRAPSIG: Bash Variables. (line 170) -* BASH_VERSINFO: Bash Variables. (line 176) -* BASH_VERSION: Bash Variables. (line 199) -* BASH_XTRACEFD: Bash Variables. (line 202) -* BASHOPTS: Bash Variables. (line 26) -* BASHPID: Bash Variables. (line 35) +* 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) +* BASHOPTS: Bash Variables. (line 27) +* BASHPID: Bash Variables. (line 36) * bell-style: Readline Init File Syntax. (line 64) * bind-tty-special-chars: Readline Init File Syntax. @@ -12498,21 +12780,21 @@ D.3 Parameter and Variable Index (line 79) * CDPATH: Bourne Shell Variables. (line 9) -* CHILD_MAX: Bash Variables. (line 213) +* CHILD_MAX: Bash Variables. (line 215) * colored-completion-prefix: Readline Init File Syntax. (line 84) * colored-stats: Readline Init File Syntax. (line 94) -* COLUMNS: Bash Variables. (line 220) +* COLUMNS: Bash Variables. (line 222) * comment-begin: Readline Init File Syntax. (line 100) -* COMP_CWORD: Bash Variables. (line 226) -* COMP_KEY: Bash Variables. (line 255) -* COMP_LINE: Bash Variables. (line 232) -* COMP_POINT: Bash Variables. (line 237) -* COMP_TYPE: Bash Variables. (line 245) -* COMP_WORDBREAKS: Bash Variables. (line 259) -* COMP_WORDS: Bash Variables. (line 265) +* COMP_CWORD: Bash Variables. (line 228) +* COMP_KEY: Bash Variables. (line 234) +* COMP_LINE: Bash Variables. (line 240) +* COMP_POINT: Bash Variables. (line 245) +* COMP_TYPE: Bash Variables. (line 253) +* COMP_WORDBREAKS: Bash Variables. (line 263) +* COMP_WORDS: Bash Variables. (line 269) * completion-display-width: Readline Init File Syntax. (line 105) * completion-ignore-case: Readline Init File Syntax. @@ -12523,18 +12805,18 @@ D.3 Parameter and Variable Index (line 123) * completion-query-items: Readline Init File Syntax. (line 130) -* COMPREPLY: Bash Variables. (line 272) +* COMPREPLY: Bash Variables. (line 276) * convert-meta: Readline Init File Syntax. (line 141) -* COPROC: Bash Variables. (line 278) -* DIRSTACK: Bash Variables. (line 282) +* COPROC: Bash Variables. (line 282) +* DIRSTACK: Bash Variables. (line 286) * disable-completion: Readline Init File Syntax. (line 153) * echo-control-characters: Readline Init File Syntax. (line 158) * editing-mode: Readline Init File Syntax. (line 163) -* EMACS: Bash Variables. (line 292) +* EMACS: Bash Variables. (line 296) * emacs-mode-string: Readline Init File Syntax. (line 169) * enable-active-region: Readline Init File Syntax. @@ -12543,72 +12825,72 @@ D.3 Parameter and Variable Index (line 192) * enable-keypad: Readline Init File Syntax. (line 201) -* ENV: Bash Variables. (line 297) -* EPOCHREALTIME: Bash Variables. (line 302) -* EPOCHSECONDS: Bash Variables. (line 310) -* EUID: Bash Variables. (line 317) -* EXECIGNORE: Bash Variables. (line 321) +* ENV: Bash Variables. (line 301) +* EPOCHREALTIME: Bash Variables. (line 306) +* EPOCHSECONDS: Bash Variables. (line 314) +* EUID: Bash Variables. (line 321) +* EXECIGNORE: Bash Variables. (line 325) * expand-tilde: Readline Init File Syntax. (line 216) -* FCEDIT: Bash Variables. (line 334) -* FIGNORE: Bash Variables. (line 338) +* FCEDIT: Bash Variables. (line 337) +* FIGNORE: Bash Variables. (line 340) * force-meta-prefix: Readline Init File Syntax. (line 220) -* FUNCNAME: Bash Variables. (line 344) -* FUNCNEST: Bash Variables. (line 361) -* GLOBIGNORE: Bash Variables. (line 366) -* GLOBSORT: Bash Variables. (line 373) -* GROUPS: Bash Variables. (line 408) -* histchars: Bash Variables. (line 414) -* HISTCMD: Bash Variables. (line 429) -* HISTCONTROL: Bash Variables. (line 435) -* HISTFILE: Bash Variables. (line 451) -* HISTFILESIZE: Bash Variables. (line 456) -* HISTIGNORE: Bash Variables. (line 467) +* FUNCNAME: Bash Variables. (line 346) +* FUNCNEST: Bash Variables. (line 363) +* GLOBIGNORE: Bash Variables. (line 368) +* GLOBSORT: Bash Variables. (line 375) +* GROUPS: Bash Variables. (line 410) +* histchars: Bash Variables. (line 416) +* HISTCMD: Bash Variables. (line 431) +* HISTCONTROL: Bash Variables. (line 437) +* HISTFILE: Bash Variables. (line 455) +* HISTFILESIZE: Bash Variables. (line 461) +* HISTIGNORE: Bash Variables. (line 472) * history-preserve-point: Readline Init File Syntax. (line 233) * history-size: Readline Init File Syntax. (line 239) -* HISTSIZE: Bash Variables. (line 489) -* HISTTIMEFORMAT: Bash Variables. (line 496) +* HISTSIZE: Bash Variables. (line 496) +* HISTTIMEFORMAT: Bash Variables. (line 503) * HOME: Bourne Shell Variables. (line 13) * horizontal-scroll-mode: Readline Init File Syntax. (line 248) -* HOSTFILE: Bash Variables. (line 505) -* HOSTNAME: Bash Variables. (line 516) -* HOSTTYPE: Bash Variables. (line 519) +* HOSTFILE: Bash Variables. (line 512) +* HOSTNAME: Bash Variables. (line 523) +* HOSTTYPE: Bash Variables. (line 526) * IFS: Bourne Shell Variables. (line 18) -* IGNOREEOF: Bash Variables. (line 522) +* IGNOREEOF: Bash Variables. (line 529) * input-meta: Readline Init File Syntax. (line 257) -* INPUTRC: Bash Variables. (line 532) -* INSIDE_EMACS: Bash Variables. (line 536) +* INPUTRC: Bash Variables. (line 538) +* INSIDE_EMACS: Bash Variables. (line 542) * isearch-terminators: Readline Init File Syntax. (line 268) * keymap: Readline Init File Syntax. (line 275) * LANG: Creating Internationalized Scripts. (line 51) -* LANG <1>: Bash Variables. (line 542) -* LC_ALL: Bash Variables. (line 546) -* LC_COLLATE: Bash Variables. (line 550) -* LC_CTYPE: Bash Variables. (line 557) +* LANG <1>: Bash Variables. (line 548) +* LC_ALL: Bash Variables. (line 552) +* LC_COLLATE: Bash Variables. (line 556) +* LC_CTYPE: Bash Variables. (line 563) * LC_MESSAGES: Creating Internationalized Scripts. (line 51) -* LC_MESSAGES <1>: Bash Variables. (line 562) -* LC_NUMERIC: Bash Variables. (line 566) -* LC_TIME: Bash Variables. (line 570) -* LINENO: Bash Variables. (line 574) -* LINES: Bash Variables. (line 579) -* MACHTYPE: Bash Variables. (line 585) +* LC_MESSAGES <1>: Bash Variables. (line 568) +* LC_NUMERIC: Bash Variables. (line 572) +* LC_TIME: Bash Variables. (line 576) +* LINENO: Bash Variables. (line 580) +* LINES: Bash Variables. (line 587) +* MACHTYPE: Bash Variables. (line 593) * MAIL: Bourne Shell Variables. - (line 22) -* MAILCHECK: Bash Variables. (line 589) + (line 24) +* MAILCHECK: Bash Variables. (line 597) * MAILPATH: Bourne Shell Variables. - (line 27) -* MAPFILE: Bash Variables. (line 597) + (line 29) +* MAPFILE: Bash Variables. (line 605) * mark-modified-lines: Readline Init File Syntax. (line 305) * mark-symlinked-directories: Readline Init File Syntax. @@ -12619,69 +12901,69 @@ D.3 Parameter and Variable Index (line 322) * meta-flag: Readline Init File Syntax. (line 257) -* OLDPWD: Bash Variables. (line 601) +* OLDPWD: Bash Variables. (line 609) * OPTARG: Bourne Shell Variables. - (line 34) -* OPTERR: Bash Variables. (line 604) + (line 36) +* OPTERR: Bash Variables. (line 612) * OPTIND: Bourne Shell Variables. - (line 38) -* OSTYPE: Bash Variables. (line 608) + (line 40) +* OSTYPE: Bash Variables. (line 617) * output-meta: Readline Init File Syntax. (line 327) * page-completions: Readline Init File Syntax. (line 336) * PATH: Bourne Shell Variables. - (line 42) -* PIPESTATUS: Bash Variables. (line 611) -* POSIXLY_CORRECT: Bash Variables. (line 617) -* PPID: Bash Variables. (line 627) -* PROMPT_COMMAND: Bash Variables. (line 631) -* PROMPT_DIRTRIM: Bash Variables. (line 637) -* PS0: Bash Variables. (line 643) + (line 44) +* PIPESTATUS: Bash Variables. (line 620) +* POSIXLY_CORRECT: Bash Variables. (line 626) +* PPID: Bash Variables. (line 636) +* PROMPT_COMMAND: Bash Variables. (line 640) +* PROMPT_DIRTRIM: Bash Variables. (line 646) +* PS0: Bash Variables. (line 652) * PS1: Bourne Shell Variables. - (line 48) -* PS2: Bourne Shell Variables. (line 53) -* PS3: Bash Variables. (line 648) -* PS4: Bash Variables. (line 653) -* PWD: Bash Variables. (line 661) -* RANDOM: Bash Variables. (line 664) -* READLINE_ARGUMENT: Bash Variables. (line 670) -* READLINE_LINE: Bash Variables. (line 674) -* READLINE_MARK: Bash Variables. (line 678) -* READLINE_POINT: Bash Variables. (line 684) -* REPLY: Bash Variables. (line 688) +* PS2: Bourne Shell Variables. + (line 58) +* PS3: Bash Variables. (line 657) +* PS4: Bash Variables. (line 662) +* PWD: Bash Variables. (line 670) +* RANDOM: Bash Variables. (line 673) +* READLINE_ARGUMENT: Bash Variables. (line 681) +* READLINE_LINE: Bash Variables. (line 685) +* READLINE_MARK: Bash Variables. (line 689) +* READLINE_POINT: Bash Variables. (line 695) +* REPLY: Bash Variables. (line 699) * revert-all-at-newline: Readline Init File Syntax. - (line 346) + (line 349) * search-ignore-case: Readline Init File Syntax. - (line 353) -* SECONDS: Bash Variables. (line 691) -* SHELL: Bash Variables. (line 701) -* SHELLOPTS: Bash Variables. (line 706) -* SHLVL: Bash Variables. (line 715) + (line 356) +* SECONDS: Bash Variables. (line 703) +* SHELL: Bash Variables. (line 713) +* SHELLOPTS: Bash Variables. (line 718) +* SHLVL: Bash Variables. (line 727) * show-all-if-ambiguous: Readline Init File Syntax. - (line 358) + (line 361) * show-all-if-unmodified: Readline Init File Syntax. - (line 364) + (line 367) * show-mode-in-prompt: Readline Init File Syntax. - (line 373) + (line 376) * skip-completed-text: Readline Init File Syntax. - (line 379) -* SRANDOM: Bash Variables. (line 720) + (line 382) +* SRANDOM: Bash Variables. (line 732) * TEXTDOMAIN: Creating Internationalized Scripts. (line 51) * TEXTDOMAINDIR: Creating Internationalized Scripts. (line 51) -* TIMEFORMAT: Bash Variables. (line 729) -* TMOUT: Bash Variables. (line 767) -* TMPDIR: Bash Variables. (line 779) -* UID: Bash Variables. (line 783) +* TIMEFORMAT: Bash Variables. (line 741) +* TMOUT: Bash Variables. (line 780) +* TMPDIR: Bash Variables. (line 792) +* UID: Bash Variables. (line 796) * vi-cmd-mode-string: Readline Init File Syntax. - (line 392) + (line 395) * vi-ins-mode-string: Readline Init File Syntax. - (line 403) + (line 406) * visible-stats: Readline Init File Syntax. - (line 414) + (line 417)  File: bash.info, Node: Function Index, Next: Concept Index, Prev: Variable Index, Up: Indexes @@ -12903,14 +13185,14 @@ D.5 Concept Index * arithmetic evaluation: Shell Arithmetic. (line 6) * arithmetic expansion: Arithmetic Expansion. (line 6) -* arithmetic operators: Shell Arithmetic. (line 17) +* arithmetic operators: Shell Arithmetic. (line 18) * arithmetic, shell: Shell Arithmetic. (line 6) * arrays: Arrays. (line 6) * background: Job Control Basics. (line 6) * Bash configuration: Basic Installation. (line 6) * Bash installation: Basic Installation. (line 6) -* binary arithmetic operators: Shell Arithmetic. (line 17) -* bitwise arithmetic operators: Shell Arithmetic. (line 17) +* binary arithmetic operators: Shell Arithmetic. (line 18) +* bitwise arithmetic operators: Shell Arithmetic. (line 18) * Bourne shell: Basic Shell Features. (line 6) * brace expansion: Brace Expansion. (line 6) @@ -12944,11 +13226,12 @@ D.5 Concept Index (line 6) * completion builtins: Programmable Completion Builtins. (line 6) -* conditional arithmetic operator: Shell Arithmetic. (line 17) +* conditional arithmetic operator: Shell Arithmetic. (line 18) * configuration: Basic Installation. (line 6) * control operator: Definitions. (line 21) * coprocess: Coprocesses. (line 6) * directory stack: The Directory Stack. (line 6) +* dollar-single quote quoting: ANSI-C Quoting. (line 6) * editing command lines: Readline Bare Essentials. (line 6) * environment: Environment. (line 6) @@ -13032,7 +13315,7 @@ D.5 Concept Index * quoting: Quoting. (line 6) * quoting, ANSI: ANSI-C Quoting. (line 6) * Readline, how to use: Job Control Variables. - (line 23) + (line 22) * redirection: Redirections. (line 6) * reserved word: Definitions. (line 70) * reserved words: Reserved Words. (line 6) @@ -13055,7 +13338,7 @@ D.5 Concept Index * tilde expansion: Tilde Expansion. (line 6) * token: Definitions. (line 86) * translation, native languages: Locale Translation. (line 6) -* unary arithmetic operators: Shell Arithmetic. (line 17) +* unary arithmetic operators: Shell Arithmetic. (line 18) * variable, shell: Shell Parameters. (line 6) * variables, readline: Readline Init File Syntax. (line 37) @@ -13067,138 +13350,138 @@ D.5 Concept Index  Tag Table: -Node: Top901 -Node: Introduction2842 -Node: What is Bash?3055 -Node: What is a shell?4196 -Node: Definitions6775 -Node: Basic Shell Features9951 -Node: Shell Syntax11171 -Node: Shell Operation12198 -Node: Quoting13496 -Node: Escape Character14809 -Node: Single Quotes15307 -Node: Double Quotes15656 -Node: ANSI-C Quoting16999 -Node: Locale Translation18384 -Node: Creating Internationalized Scripts19728 -Node: Comments23926 -Node: Shell Commands24561 -Node: Reserved Words25500 -Node: Simple Commands26365 -Node: Pipelines27024 -Node: Lists30087 -Node: Compound Commands31959 -Node: Looping Constructs32968 -Node: Conditional Constructs35512 -Node: Command Grouping50373 -Node: Coprocesses51860 -Node: GNU Parallel54556 -Node: Shell Functions55474 -Node: Shell Parameters63580 -Node: Positional Parameters68113 -Node: Special Parameters69048 -Node: Shell Expansions72358 -Node: Brace Expansion74547 -Node: Tilde Expansion77210 -Node: Shell Parameter Expansion79976 -Node: Command Substitution99083 -Node: Arithmetic Expansion102616 -Node: Process Substitution103581 -Node: Word Splitting104718 -Node: Filename Expansion106859 -Node: Pattern Matching109955 -Node: Quote Removal115188 -Node: Redirections115492 -Node: Executing Commands125301 -Node: Simple Command Expansion125968 -Node: Command Search and Execution128079 -Node: Command Execution Environment130487 -Node: Environment133796 -Node: Exit Status135500 -Node: Signals137285 -Node: Shell Scripts140899 -Node: Shell Builtin Commands143991 -Node: Bourne Shell Builtins146102 -Node: Bash Builtins170872 -Node: Modifying Shell Behavior205971 -Node: The Set Builtin206313 -Node: The Shopt Builtin217896 -Node: Special Builtins234948 -Node: Shell Variables235937 -Node: Bourne Shell Variables236371 -Node: Bash Variables238564 -Node: Bash Features275759 -Node: Invoking Bash276773 -Node: Bash Startup Files283172 -Node: Interactive Shells288475 -Node: What is an Interactive Shell?288883 -Node: Is this Shell Interactive?289549 -Node: Interactive Shell Behavior290373 -Node: Bash Conditional Expressions294127 -Node: Shell Arithmetic299301 -Node: Aliases302383 -Node: Arrays305338 -Node: The Directory Stack312137 -Node: Directory Stack Builtins312934 -Node: Controlling the Prompt317383 -Node: The Restricted Shell320521 -Node: Bash POSIX Mode323308 -Node: Shell Compatibility Mode341567 -Node: Job Control350518 -Node: Job Control Basics350975 -Node: Job Control Builtins356283 -Node: Job Control Variables362227 -Node: Command Line Editing363404 -Node: Introduction and Notation365108 -Node: Readline Interaction367203 -Node: Readline Bare Essentials368391 -Node: Readline Movement Commands370209 -Node: Readline Killing Commands371206 -Node: Readline Arguments373184 -Node: Searching374241 -Node: Readline Init File376470 -Node: Readline Init File Syntax377752 -Node: Conditional Init Constructs404292 -Node: Sample Init File408657 -Node: Bindable Readline Commands411778 -Node: Commands For Moving413003 -Node: Commands For History415230 -Node: Commands For Text420435 -Node: Commands For Killing424569 -Node: Numeric Arguments427370 -Node: Commands For Completion428522 -Node: Keyboard Macros432838 -Node: Miscellaneous Commands433539 -Node: Readline vi Mode440193 -Node: Programmable Completion441145 -Node: Programmable Completion Builtins449102 -Node: A Programmable Completion Example460668 -Node: Using History Interactively466013 -Node: Bash History Facilities466694 -Node: Bash History Builtins469806 -Node: History Interaction475049 -Node: Event Designators479374 -Node: Word Designators480957 -Node: Modifiers483109 -Node: Installing Bash485018 -Node: Basic Installation486152 -Node: Compilers and Options490031 -Node: Compiling For Multiple Architectures490781 -Node: Installation Names492530 -Node: Specifying the System Type494764 -Node: Sharing Defaults495510 -Node: Operation Controls496224 -Node: Optional Features497243 -Node: Reporting Bugs509045 -Node: Major Differences From The Bourne Shell510394 -Node: GNU Free Documentation License530129 -Node: Indexes555306 -Node: Builtin Index555757 -Node: Reserved Word Index562855 -Node: Variable Index565300 -Node: Function Index582572 -Node: Concept Index596428 +Node: Top903 +Node: Introduction2846 +Node: What is Bash?3059 +Node: What is a shell?4192 +Node: Definitions6783 +Node: Basic Shell Features9959 +Node: Shell Syntax11179 +Node: Shell Operation12206 +Node: Quoting13504 +Node: Escape Character14842 +Node: Single Quotes15377 +Node: Double Quotes15726 +Node: ANSI-C Quoting17071 +Node: Locale Translation18456 +Node: Creating Internationalized Scripts19863 +Node: Comments24061 +Node: Shell Commands24828 +Node: Reserved Words25767 +Node: Simple Commands26632 +Node: Pipelines27294 +Node: Lists30521 +Node: Compound Commands32393 +Node: Looping Constructs33402 +Node: Conditional Constructs35921 +Node: Command Grouping50853 +Node: Coprocesses52345 +Node: GNU Parallel55031 +Node: Shell Functions55949 +Node: Shell Parameters64426 +Node: Positional Parameters69164 +Node: Special Parameters70254 +Node: Shell Expansions73715 +Node: Brace Expansion75904 +Node: Tilde Expansion78619 +Node: Shell Parameter Expansion81561 +Node: Command Substitution101333 +Node: Arithmetic Expansion104866 +Node: Process Substitution105879 +Node: Word Splitting106995 +Node: Filename Expansion109092 +Node: Pattern Matching112360 +Node: Quote Removal117688 +Node: Redirections117992 +Node: Executing Commands128207 +Node: Simple Command Expansion128874 +Node: Command Search and Execution130982 +Node: Command Execution Environment133426 +Node: Environment136859 +Node: Exit Status138762 +Node: Signals140820 +Node: Shell Scripts144718 +Node: Shell Builtin Commands148016 +Node: Bourne Shell Builtins150127 +Node: Bash Builtins176426 +Node: Modifying Shell Behavior212868 +Node: The Set Builtin213210 +Node: The Shopt Builtin225146 +Node: Special Builtins242192 +Node: Shell Variables243181 +Node: Bourne Shell Variables243615 +Node: Bash Variables246123 +Node: Bash Features284380 +Node: Invoking Bash285394 +Node: Bash Startup Files291820 +Node: Interactive Shells297133 +Node: What is an Interactive Shell?297541 +Node: Is this Shell Interactive?298203 +Node: Interactive Shell Behavior299027 +Node: Bash Conditional Expressions302788 +Node: Shell Arithmetic308005 +Node: Aliases311344 +Node: Arrays314306 +Node: The Directory Stack321369 +Node: Directory Stack Builtins322166 +Node: Controlling the Prompt326611 +Node: The Restricted Shell329495 +Node: Bash POSIX Mode332377 +Node: Shell Compatibility Mode350636 +Node: Job Control359647 +Node: Job Control Basics360104 +Node: Job Control Builtins365412 +Node: Job Control Variables371580 +Node: Command Line Editing372748 +Node: Introduction and Notation374452 +Node: Readline Interaction376547 +Node: Readline Bare Essentials377735 +Node: Readline Movement Commands379553 +Node: Readline Killing Commands380550 +Node: Readline Arguments382528 +Node: Searching383585 +Node: Readline Init File385814 +Node: Readline Init File Syntax387096 +Node: Conditional Init Constructs413700 +Node: Sample Init File418065 +Node: Bindable Readline Commands421186 +Node: Commands For Moving422411 +Node: Commands For History424638 +Node: Commands For Text429843 +Node: Commands For Killing433977 +Node: Numeric Arguments436778 +Node: Commands For Completion437930 +Node: Keyboard Macros442246 +Node: Miscellaneous Commands442947 +Node: Readline vi Mode449601 +Node: Programmable Completion450553 +Node: Programmable Completion Builtins458544 +Node: A Programmable Completion Example470312 +Node: Using History Interactively475657 +Node: Bash History Facilities476338 +Node: Bash History Builtins480124 +Node: History Interaction486503 +Node: Event Designators491354 +Node: Word Designators492940 +Node: Modifiers495225 +Node: Installing Bash497158 +Node: Basic Installation498274 +Node: Compilers and Options502150 +Node: Compiling For Multiple Architectures502900 +Node: Installation Names504649 +Node: Specifying the System Type506883 +Node: Sharing Defaults507629 +Node: Operation Controls508343 +Node: Optional Features509362 +Node: Reporting Bugs521742 +Node: Major Differences From The Bourne Shell523100 +Node: GNU Free Documentation License542835 +Node: Indexes568012 +Node: Builtin Index568463 +Node: Reserved Word Index575561 +Node: Variable Index578006 +Node: Function Index595278 +Node: Concept Index609134  End Tag Table diff --git a/doc/bash.pdf b/doc/bash.pdf index 177ac878..4392930f 100644 Binary files a/doc/bash.pdf and b/doc/bash.pdf differ diff --git a/doc/bashref.aux b/doc/bashref.aux index 13877bc5..c2c9febb 100644 --- a/doc/bashref.aux +++ b/doc/bashref.aux @@ -45,24 +45,24 @@ @xrdef{Reserved Words-snt}{Section@tie 3.2.1} @xrdef{Simple Commands-title}{Simple Commands} @xrdef{Simple Commands-snt}{Section@tie 3.2.2} -@xrdef{Pipelines-title}{Pipelines} -@xrdef{Pipelines-snt}{Section@tie 3.2.3} @xrdef{Comments-pg}{9} @xrdef{Shell Commands-pg}{9} @xrdef{Reserved Words-pg}{9} @xrdef{Simple Commands-pg}{9} +@xrdef{Pipelines-title}{Pipelines} +@xrdef{Pipelines-snt}{Section@tie 3.2.3} +@xrdef{Pipelines-pg}{10} @xrdef{Lists-title}{Lists of Commands} @xrdef{Lists-snt}{Section@tie 3.2.4} -@xrdef{Pipelines-pg}{10} -@xrdef{Lists-pg}{10} @xrdef{Compound Commands-title}{Compound Commands} @xrdef{Compound Commands-snt}{Section@tie 3.2.5} @xrdef{Looping Constructs-title}{Looping Constructs} @xrdef{Looping Constructs-snt}{Section@tie 3.2.5.1} +@xrdef{Lists-pg}{11} @xrdef{Compound Commands-pg}{11} -@xrdef{Looping Constructs-pg}{11} @xrdef{Conditional Constructs-title}{Conditional Constructs} @xrdef{Conditional Constructs-snt}{Section@tie 3.2.5.2} +@xrdef{Looping Constructs-pg}{12} @xrdef{Conditional Constructs-pg}{12} @xrdef{Command Grouping-title}{Grouping Commands} @xrdef{Command Grouping-snt}{Section@tie 3.2.5.3} @@ -78,7 +78,7 @@ @xrdef{Shell Functions-pg}{19} @xrdef{Shell Parameters-title}{Shell Parameters} @xrdef{Shell Parameters-snt}{Section@tie 3.4} -@xrdef{Shell Parameters-pg}{21} +@xrdef{Shell Parameters-pg}{22} @xrdef{Positional Parameters-title}{Positional Parameters} @xrdef{Positional Parameters-snt}{Section@tie 3.4.1} @xrdef{Special Parameters-title}{Special Parameters} @@ -87,103 +87,103 @@ @xrdef{Special Parameters-pg}{23} @xrdef{Shell Expansions-title}{Shell Expansions} @xrdef{Shell Expansions-snt}{Section@tie 3.5} +@xrdef{Shell Expansions-pg}{24} @xrdef{Brace Expansion-title}{Brace Expansion} @xrdef{Brace Expansion-snt}{Section@tie 3.5.1} -@xrdef{Shell Expansions-pg}{24} -@xrdef{Brace Expansion-pg}{24} +@xrdef{Brace Expansion-pg}{25} @xrdef{Tilde Expansion-title}{Tilde Expansion} @xrdef{Tilde Expansion-snt}{Section@tie 3.5.2} -@xrdef{Tilde Expansion-pg}{25} +@xrdef{Tilde Expansion-pg}{26} @xrdef{Shell Parameter Expansion-title}{Shell Parameter Expansion} @xrdef{Shell Parameter Expansion-snt}{Section@tie 3.5.3} -@xrdef{Shell Parameter Expansion-pg}{26} +@xrdef{Shell Parameter Expansion-pg}{27} @xrdef{Command Substitution-title}{Command Substitution} @xrdef{Command Substitution-snt}{Section@tie 3.5.4} -@xrdef{Command Substitution-pg}{34} +@xrdef{Command Substitution-pg}{35} @xrdef{Arithmetic Expansion-title}{Arithmetic Expansion} @xrdef{Arithmetic Expansion-snt}{Section@tie 3.5.5} @xrdef{Process Substitution-title}{Process Substitution} @xrdef{Process Substitution-snt}{Section@tie 3.5.6} -@xrdef{Arithmetic Expansion-pg}{35} -@xrdef{Process Substitution-pg}{35} +@xrdef{Arithmetic Expansion-pg}{36} +@xrdef{Process Substitution-pg}{36} @xrdef{Word Splitting-title}{Word Splitting} @xrdef{Word Splitting-snt}{Section@tie 3.5.7} @xrdef{Filename Expansion-title}{Filename Expansion} @xrdef{Filename Expansion-snt}{Section@tie 3.5.8} -@xrdef{Word Splitting-pg}{36} -@xrdef{Filename Expansion-pg}{36} +@xrdef{Word Splitting-pg}{37} +@xrdef{Filename Expansion-pg}{37} @xrdef{Pattern Matching-title}{Pattern Matching} @xrdef{Pattern Matching-snt}{Section@tie 3.5.8.1} -@xrdef{Pattern Matching-pg}{37} +@xrdef{Pattern Matching-pg}{38} @xrdef{Quote Removal-title}{Quote Removal} @xrdef{Quote Removal-snt}{Section@tie 3.5.9} @xrdef{Redirections-title}{Redirections} @xrdef{Redirections-snt}{Section@tie 3.6} -@xrdef{Quote Removal-pg}{39} -@xrdef{Redirections-pg}{39} +@xrdef{Quote Removal-pg}{40} +@xrdef{Redirections-pg}{40} @xrdef{Executing Commands-title}{Executing Commands} @xrdef{Executing Commands-snt}{Section@tie 3.7} @xrdef{Simple Command Expansion-title}{Simple Command Expansion} @xrdef{Simple Command Expansion-snt}{Section@tie 3.7.1} @xrdef{Command Search and Execution-title}{Command Search and Execution} @xrdef{Command Search and Execution-snt}{Section@tie 3.7.2} -@xrdef{Executing Commands-pg}{43} -@xrdef{Simple Command Expansion-pg}{43} -@xrdef{Command Search and Execution-pg}{43} +@xrdef{Executing Commands-pg}{44} +@xrdef{Simple Command Expansion-pg}{44} +@xrdef{Command Search and Execution-pg}{44} @xrdef{Command Execution Environment-title}{Command Execution Environment} @xrdef{Command Execution Environment-snt}{Section@tie 3.7.3} -@xrdef{Command Execution Environment-pg}{44} +@xrdef{Command Execution Environment-pg}{45} @xrdef{Environment-title}{Environment} @xrdef{Environment-snt}{Section@tie 3.7.4} +@xrdef{Environment-pg}{46} @xrdef{Exit Status-title}{Exit Status} @xrdef{Exit Status-snt}{Section@tie 3.7.5} -@xrdef{Environment-pg}{45} -@xrdef{Exit Status-pg}{45} @xrdef{Signals-title}{Signals} @xrdef{Signals-snt}{Section@tie 3.7.6} -@xrdef{Signals-pg}{46} +@xrdef{Exit Status-pg}{47} +@xrdef{Signals-pg}{47} @xrdef{Shell Scripts-title}{Shell Scripts} @xrdef{Shell Scripts-snt}{Section@tie 3.8} -@xrdef{Shell Scripts-pg}{47} +@xrdef{Shell Scripts-pg}{48} @xrdef{Shell Builtin Commands-title}{Shell Builtin Commands} @xrdef{Shell Builtin Commands-snt}{Chapter@tie 4} @xrdef{Bourne Shell Builtins-title}{Bourne Shell Builtins} @xrdef{Bourne Shell Builtins-snt}{Section@tie 4.1} -@xrdef{Shell Builtin Commands-pg}{49} -@xrdef{Bourne Shell Builtins-pg}{49} +@xrdef{Shell Builtin Commands-pg}{50} +@xrdef{Bourne Shell Builtins-pg}{50} @xrdef{Bash Builtins-title}{Bash Builtin Commands} @xrdef{Bash Builtins-snt}{Section@tie 4.2} -@xrdef{Bash Builtins-pg}{57} +@xrdef{Bash Builtins-pg}{59} @xrdef{Modifying Shell Behavior-title}{Modifying Shell Behavior} @xrdef{Modifying Shell Behavior-snt}{Section@tie 4.3} @xrdef{The Set Builtin-title}{The Set Builtin} @xrdef{The Set Builtin-snt}{Section@tie 4.3.1} -@xrdef{Modifying Shell Behavior-pg}{69} -@xrdef{The Set Builtin-pg}{69} +@xrdef{Modifying Shell Behavior-pg}{71} +@xrdef{The Set Builtin-pg}{71} @xrdef{The Shopt Builtin-title}{The Shopt Builtin} @xrdef{The Shopt Builtin-snt}{Section@tie 4.3.2} -@xrdef{The Shopt Builtin-pg}{74} +@xrdef{The Shopt Builtin-pg}{76} @xrdef{Special Builtins-title}{Special Builtins} @xrdef{Special Builtins-snt}{Section@tie 4.4} -@xrdef{Special Builtins-pg}{80} +@xrdef{Special Builtins-pg}{82} @xrdef{Shell Variables-title}{Shell Variables} @xrdef{Shell Variables-snt}{Chapter@tie 5} @xrdef{Bourne Shell Variables-title}{Bourne Shell Variables} @xrdef{Bourne Shell Variables-snt}{Section@tie 5.1} @xrdef{Bash Variables-title}{Bash Variables} @xrdef{Bash Variables-snt}{Section@tie 5.2} -@xrdef{Shell Variables-pg}{81} -@xrdef{Bourne Shell Variables-pg}{81} -@xrdef{Bash Variables-pg}{81} +@xrdef{Shell Variables-pg}{84} +@xrdef{Bourne Shell Variables-pg}{84} +@xrdef{Bash Variables-pg}{85} @xrdef{Bash Features-title}{Bash Features} @xrdef{Bash Features-snt}{Chapter@tie 6} @xrdef{Invoking Bash-title}{Invoking Bash} @xrdef{Invoking Bash-snt}{Section@tie 6.1} -@xrdef{Bash Features-pg}{94} -@xrdef{Invoking Bash-pg}{94} +@xrdef{Bash Features-pg}{98} +@xrdef{Invoking Bash-pg}{98} @xrdef{Bash Startup Files-title}{Bash Startup Files} @xrdef{Bash Startup Files-snt}{Section@tie 6.2} -@xrdef{Bash Startup Files-pg}{96} +@xrdef{Bash Startup Files-pg}{100} @xrdef{Interactive Shells-title}{Interactive Shells} @xrdef{Interactive Shells-snt}{Section@tie 6.3} @xrdef{What is an Interactive Shell?-title}{What is an Interactive Shell?} @@ -192,199 +192,199 @@ @xrdef{Is this Shell Interactive?-snt}{Section@tie 6.3.2} @xrdef{Interactive Shell Behavior-title}{Interactive Shell Behavior} @xrdef{Interactive Shell Behavior-snt}{Section@tie 6.3.3} -@xrdef{Interactive Shells-pg}{98} -@xrdef{What is an Interactive Shell?-pg}{98} -@xrdef{Is this Shell Interactive?-pg}{98} -@xrdef{Interactive Shell Behavior-pg}{98} +@xrdef{Interactive Shells-pg}{102} +@xrdef{What is an Interactive Shell?-pg}{102} +@xrdef{Is this Shell Interactive?-pg}{102} +@xrdef{Interactive Shell Behavior-pg}{102} @xrdef{Bash Conditional Expressions-title}{Bash Conditional Expressions} @xrdef{Bash Conditional Expressions-snt}{Section@tie 6.4} -@xrdef{Bash Conditional Expressions-pg}{99} +@xrdef{Bash Conditional Expressions-pg}{103} @xrdef{Shell Arithmetic-title}{Shell Arithmetic} @xrdef{Shell Arithmetic-snt}{Section@tie 6.5} -@xrdef{Shell Arithmetic-pg}{101} +@xrdef{Shell Arithmetic-pg}{105} @xrdef{Aliases-title}{Aliases} @xrdef{Aliases-snt}{Section@tie 6.6} @xrdef{Arrays-title}{Arrays} @xrdef{Arrays-snt}{Section@tie 6.7} -@xrdef{Aliases-pg}{103} -@xrdef{Arrays-pg}{103} +@xrdef{Aliases-pg}{107} +@xrdef{Arrays-pg}{108} @xrdef{The Directory Stack-title}{The Directory Stack} @xrdef{The Directory Stack-snt}{Section@tie 6.8} -@xrdef{The Directory Stack-pg}{105} @xrdef{Directory Stack Builtins-title}{Directory Stack Builtins} @xrdef{Directory Stack Builtins-snt}{Section@tie 6.8.1} -@xrdef{Directory Stack Builtins-pg}{106} +@xrdef{The Directory Stack-pg}{110} +@xrdef{Directory Stack Builtins-pg}{110} @xrdef{Controlling the Prompt-title}{Controlling the Prompt} @xrdef{Controlling the Prompt-snt}{Section@tie 6.9} -@xrdef{Controlling the Prompt-pg}{107} +@xrdef{Controlling the Prompt-pg}{111} @xrdef{The Restricted Shell-title}{The Restricted Shell} @xrdef{The Restricted Shell-snt}{Section@tie 6.10} @xrdef{Bash POSIX Mode-title}{Bash and POSIX} @xrdef{Bash POSIX Mode-snt}{Section@tie 6.11} -@xrdef{The Restricted Shell-pg}{109} -@xrdef{Bash POSIX Mode-pg}{109} +@xrdef{The Restricted Shell-pg}{113} +@xrdef{Bash POSIX Mode-pg}{114} @xrdef{Shell Compatibility Mode-title}{Shell Compatibility Mode} @xrdef{Shell Compatibility Mode-snt}{Section@tie 6.12} -@xrdef{Shell Compatibility Mode-pg}{114} +@xrdef{Shell Compatibility Mode-pg}{119} @xrdef{Job Control-title}{Job Control} @xrdef{Job Control-snt}{Chapter@tie 7} @xrdef{Job Control Basics-title}{Job Control Basics} @xrdef{Job Control Basics-snt}{Section@tie 7.1} -@xrdef{Job Control-pg}{118} -@xrdef{Job Control Basics-pg}{118} +@xrdef{Job Control-pg}{123} +@xrdef{Job Control Basics-pg}{123} @xrdef{Job Control Builtins-title}{Job Control Builtins} @xrdef{Job Control Builtins-snt}{Section@tie 7.2} -@xrdef{Job Control Builtins-pg}{119} +@xrdef{Job Control Builtins-pg}{124} @xrdef{Job Control Variables-title}{Job Control Variables} @xrdef{Job Control Variables-snt}{Section@tie 7.3} -@xrdef{Job Control Variables-pg}{121} +@xrdef{Job Control Variables-pg}{126} @xrdef{Command Line Editing-title}{Command Line Editing} @xrdef{Command Line Editing-snt}{Chapter@tie 8} @xrdef{Introduction and Notation-title}{Introduction to Line Editing} @xrdef{Introduction and Notation-snt}{Section@tie 8.1} @xrdef{Readline Interaction-title}{Readline Interaction} @xrdef{Readline Interaction-snt}{Section@tie 8.2} +@xrdef{Command Line Editing-pg}{127} +@xrdef{Introduction and Notation-pg}{127} +@xrdef{Readline Interaction-pg}{127} @xrdef{Readline Bare Essentials-title}{Readline Bare Essentials} @xrdef{Readline Bare Essentials-snt}{Section@tie 8.2.1} -@xrdef{Command Line Editing-pg}{122} -@xrdef{Introduction and Notation-pg}{122} -@xrdef{Readline Interaction-pg}{122} @xrdef{Readline Movement Commands-title}{Readline Movement Commands} @xrdef{Readline Movement Commands-snt}{Section@tie 8.2.2} @xrdef{Readline Killing Commands-title}{Readline Killing Commands} @xrdef{Readline Killing Commands-snt}{Section@tie 8.2.3} -@xrdef{Readline Bare Essentials-pg}{123} -@xrdef{Readline Movement Commands-pg}{123} +@xrdef{Readline Bare Essentials-pg}{128} +@xrdef{Readline Movement Commands-pg}{128} @xrdef{Readline Arguments-title}{Readline Arguments} @xrdef{Readline Arguments-snt}{Section@tie 8.2.4} @xrdef{Searching-title}{Searching for Commands in the History} @xrdef{Searching-snt}{Section@tie 8.2.5} -@xrdef{Readline Killing Commands-pg}{124} -@xrdef{Readline Arguments-pg}{124} -@xrdef{Searching-pg}{124} +@xrdef{Readline Killing Commands-pg}{129} +@xrdef{Readline Arguments-pg}{129} +@xrdef{Searching-pg}{129} @xrdef{Readline Init File-title}{Readline Init File} @xrdef{Readline Init File-snt}{Section@tie 8.3} @xrdef{Readline Init File Syntax-title}{Readline Init File Syntax} @xrdef{Readline Init File Syntax-snt}{Section@tie 8.3.1} -@xrdef{Readline Init File-pg}{125} -@xrdef{Readline Init File Syntax-pg}{125} +@xrdef{Readline Init File-pg}{130} +@xrdef{Readline Init File Syntax-pg}{130} @xrdef{Conditional Init Constructs-title}{Conditional Init Constructs} @xrdef{Conditional Init Constructs-snt}{Section@tie 8.3.2} -@xrdef{Conditional Init Constructs-pg}{134} +@xrdef{Conditional Init Constructs-pg}{140} @xrdef{Sample Init File-title}{Sample Init File} @xrdef{Sample Init File-snt}{Section@tie 8.3.3} -@xrdef{Sample Init File-pg}{136} +@xrdef{Sample Init File-pg}{141} @xrdef{Bindable Readline Commands-title}{Bindable Readline Commands} @xrdef{Bindable Readline Commands-snt}{Section@tie 8.4} @xrdef{Commands For Moving-title}{Commands For Moving} @xrdef{Commands For Moving-snt}{Section@tie 8.4.1} -@xrdef{Bindable Readline Commands-pg}{139} -@xrdef{Commands For Moving-pg}{139} +@xrdef{Bindable Readline Commands-pg}{144} +@xrdef{Commands For Moving-pg}{144} @xrdef{Commands For History-title}{Commands For Manipulating The History} @xrdef{Commands For History-snt}{Section@tie 8.4.2} -@xrdef{Commands For History-pg}{140} +@xrdef{Commands For History-pg}{145} @xrdef{Commands For Text-title}{Commands For Changing Text} @xrdef{Commands For Text-snt}{Section@tie 8.4.3} -@xrdef{Commands For Text-pg}{142} +@xrdef{Commands For Text-pg}{147} @xrdef{Commands For Killing-title}{Killing And Yanking} @xrdef{Commands For Killing-snt}{Section@tie 8.4.4} -@xrdef{Commands For Killing-pg}{143} +@xrdef{Commands For Killing-pg}{148} @xrdef{Numeric Arguments-title}{Specifying Numeric Arguments} @xrdef{Numeric Arguments-snt}{Section@tie 8.4.5} @xrdef{Commands For Completion-title}{Letting Readline Type For You} @xrdef{Commands For Completion-snt}{Section@tie 8.4.6} -@xrdef{Numeric Arguments-pg}{145} -@xrdef{Commands For Completion-pg}{145} +@xrdef{Numeric Arguments-pg}{150} +@xrdef{Commands For Completion-pg}{150} @xrdef{Keyboard Macros-title}{Keyboard Macros} @xrdef{Keyboard Macros-snt}{Section@tie 8.4.7} @xrdef{Miscellaneous Commands-title}{Some Miscellaneous Commands} @xrdef{Miscellaneous Commands-snt}{Section@tie 8.4.8} -@xrdef{Keyboard Macros-pg}{147} -@xrdef{Miscellaneous Commands-pg}{147} +@xrdef{Keyboard Macros-pg}{152} +@xrdef{Miscellaneous Commands-pg}{152} @xrdef{Readline vi Mode-title}{Readline vi Mode} @xrdef{Readline vi Mode-snt}{Section@tie 8.5} -@xrdef{Readline vi Mode-pg}{149} +@xrdef{Readline vi Mode-pg}{154} @xrdef{Programmable Completion-title}{Programmable Completion} @xrdef{Programmable Completion-snt}{Section@tie 8.6} -@xrdef{Programmable Completion-pg}{150} +@xrdef{Programmable Completion-pg}{155} @xrdef{Programmable Completion Builtins-title}{Programmable Completion Builtins} @xrdef{Programmable Completion Builtins-snt}{Section@tie 8.7} -@xrdef{Programmable Completion Builtins-pg}{152} +@xrdef{Programmable Completion Builtins-pg}{157} @xrdef{A Programmable Completion Example-title}{A Programmable Completion Example} @xrdef{A Programmable Completion Example-snt}{Section@tie 8.8} -@xrdef{A Programmable Completion Example-pg}{156} +@xrdef{A Programmable Completion Example-pg}{161} @xrdef{Using History Interactively-title}{Using History Interactively} @xrdef{Using History Interactively-snt}{Chapter@tie 9} @xrdef{Bash History Facilities-title}{Bash History Facilities} @xrdef{Bash History Facilities-snt}{Section@tie 9.1} +@xrdef{Using History Interactively-pg}{164} +@xrdef{Bash History Facilities-pg}{164} @xrdef{Bash History Builtins-title}{Bash History Builtins} @xrdef{Bash History Builtins-snt}{Section@tie 9.2} -@xrdef{Using History Interactively-pg}{159} -@xrdef{Bash History Facilities-pg}{159} -@xrdef{Bash History Builtins-pg}{159} +@xrdef{Bash History Builtins-pg}{165} @xrdef{History Interaction-title}{History Expansion} @xrdef{History Interaction-snt}{Section@tie 9.3} -@xrdef{History Interaction-pg}{161} +@xrdef{History Interaction-pg}{167} @xrdef{Event Designators-title}{Event Designators} @xrdef{Event Designators-snt}{Section@tie 9.3.1} -@xrdef{Event Designators-pg}{162} @xrdef{Word Designators-title}{Word Designators} @xrdef{Word Designators-snt}{Section@tie 9.3.2} -@xrdef{Word Designators-pg}{163} +@xrdef{Event Designators-pg}{168} @xrdef{Modifiers-title}{Modifiers} @xrdef{Modifiers-snt}{Section@tie 9.3.3} -@xrdef{Modifiers-pg}{164} +@xrdef{Word Designators-pg}{169} +@xrdef{Modifiers-pg}{169} @xrdef{Installing Bash-title}{Installing Bash} @xrdef{Installing Bash-snt}{Chapter@tie 10} @xrdef{Basic Installation-title}{Basic Installation} @xrdef{Basic Installation-snt}{Section@tie 10.1} -@xrdef{Installing Bash-pg}{165} -@xrdef{Basic Installation-pg}{165} +@xrdef{Installing Bash-pg}{171} +@xrdef{Basic Installation-pg}{171} @xrdef{Compilers and Options-title}{Compilers and Options} @xrdef{Compilers and Options-snt}{Section@tie 10.2} @xrdef{Compiling For Multiple Architectures-title}{Compiling For Multiple Architectures} @xrdef{Compiling For Multiple Architectures-snt}{Section@tie 10.3} @xrdef{Installation Names-title}{Installation Names} @xrdef{Installation Names-snt}{Section@tie 10.4} -@xrdef{Compilers and Options-pg}{166} -@xrdef{Compiling For Multiple Architectures-pg}{166} +@xrdef{Compilers and Options-pg}{172} +@xrdef{Compiling For Multiple Architectures-pg}{172} @xrdef{Specifying the System Type-title}{Specifying the System Type} @xrdef{Specifying the System Type-snt}{Section@tie 10.5} @xrdef{Sharing Defaults-title}{Sharing Defaults} @xrdef{Sharing Defaults-snt}{Section@tie 10.6} @xrdef{Operation Controls-title}{Operation Controls} @xrdef{Operation Controls-snt}{Section@tie 10.7} -@xrdef{Installation Names-pg}{167} -@xrdef{Specifying the System Type-pg}{167} -@xrdef{Sharing Defaults-pg}{167} +@xrdef{Installation Names-pg}{173} +@xrdef{Specifying the System Type-pg}{173} +@xrdef{Sharing Defaults-pg}{173} @xrdef{Optional Features-title}{Optional Features} @xrdef{Optional Features-snt}{Section@tie 10.8} -@xrdef{Operation Controls-pg}{168} -@xrdef{Optional Features-pg}{168} +@xrdef{Operation Controls-pg}{174} +@xrdef{Optional Features-pg}{174} @xrdef{Reporting Bugs-title}{Reporting Bugs} @xrdef{Reporting Bugs-snt}{Appendix@tie @char65{}} -@xrdef{Reporting Bugs-pg}{174} +@xrdef{Reporting Bugs-pg}{180} @xrdef{Major Differences From The Bourne Shell-title}{Major Differences From The Bourne Shell} @xrdef{Major Differences From The Bourne Shell-snt}{Appendix@tie @char66{}} -@xrdef{Major Differences From The Bourne Shell-pg}{175} +@xrdef{Major Differences From The Bourne Shell-pg}{181} @xrdef{GNU Free Documentation License-title}{GNU Free Documentation License} @xrdef{GNU Free Documentation License-snt}{Appendix@tie @char67{}} -@xrdef{GNU Free Documentation License-pg}{181} +@xrdef{GNU Free Documentation License-pg}{187} @xrdef{Indexes-title}{Indexes} @xrdef{Indexes-snt}{Appendix@tie @char68{}} @xrdef{Builtin Index-title}{Index of Shell Builtin Commands} @xrdef{Builtin Index-snt}{Section@tie @char68.1} -@xrdef{Indexes-pg}{189} -@xrdef{Builtin Index-pg}{189} +@xrdef{Indexes-pg}{195} +@xrdef{Builtin Index-pg}{195} @xrdef{Reserved Word Index-title}{Index of Shell Reserved Words} @xrdef{Reserved Word Index-snt}{Section@tie @char68.2} @xrdef{Variable Index-title}{Parameter and Variable Index} @xrdef{Variable Index-snt}{Section@tie @char68.3} -@xrdef{Reserved Word Index-pg}{190} -@xrdef{Variable Index-pg}{191} +@xrdef{Reserved Word Index-pg}{196} +@xrdef{Variable Index-pg}{197} @xrdef{Function Index-title}{Function Index} @xrdef{Function Index-snt}{Section@tie @char68.4} -@xrdef{Function Index-pg}{193} +@xrdef{Function Index-pg}{199} @xrdef{Concept Index-title}{Concept Index} @xrdef{Concept Index-snt}{Section@tie @char68.5} -@xrdef{Concept Index-pg}{195} +@xrdef{Concept Index-pg}{201} diff --git a/doc/bashref.bt b/doc/bashref.bt index c1380fc3..ca15e32f 100644 --- a/doc/bashref.bt +++ b/doc/bashref.bt @@ -1,61 +1,61 @@ -\entry{:}{49}{\code {:}} -\entry{.}{49}{\code {.}} -\entry{break}{50}{\code {break}} -\entry{cd}{50}{\code {cd}} -\entry{continue}{50}{\code {continue}} -\entry{eval}{51}{\code {eval}} -\entry{exec}{51}{\code {exec}} -\entry{exit}{51}{\code {exit}} -\entry{export}{51}{\code {export}} -\entry{false}{51}{\code {false}} -\entry{getopts}{51}{\code {getopts}} -\entry{hash}{52}{\code {hash}} -\entry{pwd}{53}{\code {pwd}} -\entry{readonly}{53}{\code {readonly}} -\entry{return}{53}{\code {return}} -\entry{shift}{53}{\code {shift}} -\entry{test}{54}{\code {test}} -\entry{[}{54}{\code {[}} -\entry{times}{55}{\code {times}} -\entry{trap}{55}{\code {trap}} -\entry{true}{56}{\code {true}} -\entry{umask}{56}{\code {umask}} -\entry{unset}{57}{\code {unset}} -\entry{alias}{57}{\code {alias}} -\entry{bind}{57}{\code {bind}} -\entry{builtin}{59}{\code {builtin}} -\entry{caller}{59}{\code {caller}} -\entry{command}{59}{\code {command}} -\entry{declare}{60}{\code {declare}} -\entry{echo}{61}{\code {echo}} -\entry{enable}{62}{\code {enable}} -\entry{help}{63}{\code {help}} -\entry{let}{63}{\code {let}} -\entry{local}{63}{\code {local}} -\entry{logout}{63}{\code {logout}} -\entry{mapfile}{63}{\code {mapfile}} -\entry{printf}{64}{\code {printf}} -\entry{read}{65}{\code {read}} -\entry{readarray}{67}{\code {readarray}} -\entry{source}{67}{\code {source}} -\entry{type}{67}{\code {type}} -\entry{typeset}{68}{\code {typeset}} -\entry{ulimit}{68}{\code {ulimit}} -\entry{unalias}{69}{\code {unalias}} -\entry{set}{69}{\code {set}} -\entry{shopt}{74}{\code {shopt}} -\entry{dirs}{106}{\code {dirs}} -\entry{popd}{106}{\code {popd}} -\entry{pushd}{106}{\code {pushd}} -\entry{bg}{119}{\code {bg}} -\entry{fg}{119}{\code {fg}} -\entry{jobs}{119}{\code {jobs}} -\entry{kill}{120}{\code {kill}} -\entry{wait}{120}{\code {wait}} -\entry{disown}{121}{\code {disown}} -\entry{suspend}{121}{\code {suspend}} -\entry{compgen}{152}{\code {compgen}} -\entry{complete}{152}{\code {complete}} -\entry{compopt}{155}{\code {compopt}} -\entry{fc}{160}{\code {fc}} -\entry{history}{160}{\code {history}} +\entry{:}{50}{\code {:}} +\entry{.}{50}{\code {.}} +\entry{break}{51}{\code {break}} +\entry{cd}{51}{\code {cd}} +\entry{continue}{52}{\code {continue}} +\entry{eval}{52}{\code {eval}} +\entry{exec}{52}{\code {exec}} +\entry{exit}{52}{\code {exit}} +\entry{export}{52}{\code {export}} +\entry{false}{53}{\code {false}} +\entry{getopts}{53}{\code {getopts}} +\entry{hash}{54}{\code {hash}} +\entry{pwd}{54}{\code {pwd}} +\entry{readonly}{54}{\code {readonly}} +\entry{return}{55}{\code {return}} +\entry{shift}{55}{\code {shift}} +\entry{test}{55}{\code {test}} +\entry{[}{55}{\code {[}} +\entry{times}{57}{\code {times}} +\entry{trap}{57}{\code {trap}} +\entry{true}{58}{\code {true}} +\entry{umask}{58}{\code {umask}} +\entry{unset}{58}{\code {unset}} +\entry{alias}{59}{\code {alias}} +\entry{bind}{59}{\code {bind}} +\entry{builtin}{61}{\code {builtin}} +\entry{caller}{61}{\code {caller}} +\entry{command}{61}{\code {command}} +\entry{declare}{62}{\code {declare}} +\entry{echo}{63}{\code {echo}} +\entry{enable}{64}{\code {enable}} +\entry{help}{65}{\code {help}} +\entry{let}{65}{\code {let}} +\entry{local}{65}{\code {local}} +\entry{logout}{65}{\code {logout}} +\entry{mapfile}{66}{\code {mapfile}} +\entry{printf}{66}{\code {printf}} +\entry{read}{67}{\code {read}} +\entry{readarray}{69}{\code {readarray}} +\entry{source}{69}{\code {source}} +\entry{type}{69}{\code {type}} +\entry{typeset}{70}{\code {typeset}} +\entry{ulimit}{70}{\code {ulimit}} +\entry{unalias}{71}{\code {unalias}} +\entry{set}{71}{\code {set}} +\entry{shopt}{76}{\code {shopt}} +\entry{dirs}{110}{\code {dirs}} +\entry{popd}{110}{\code {popd}} +\entry{pushd}{111}{\code {pushd}} +\entry{bg}{124}{\code {bg}} +\entry{fg}{124}{\code {fg}} +\entry{jobs}{124}{\code {jobs}} +\entry{kill}{125}{\code {kill}} +\entry{wait}{125}{\code {wait}} +\entry{disown}{126}{\code {disown}} +\entry{suspend}{126}{\code {suspend}} +\entry{compgen}{157}{\code {compgen}} +\entry{complete}{157}{\code {complete}} +\entry{compopt}{161}{\code {compopt}} +\entry{fc}{165}{\code {fc}} +\entry{history}{165}{\code {history}} diff --git a/doc/bashref.bts b/doc/bashref.bts index a83c18ea..254fedf7 100644 --- a/doc/bashref.bts +++ b/doc/bashref.bts @@ -1,82 +1,82 @@ \initial {.} -\entry{\code {.}}{49} +\entry{\code {.}}{50} \initial {:} -\entry{\code {:}}{49} +\entry{\code {:}}{50} \initial {[} -\entry{\code {[}}{54} +\entry{\code {[}}{55} \initial {A} -\entry{\code {alias}}{57} +\entry{\code {alias}}{59} \initial {B} -\entry{\code {bg}}{119} -\entry{\code {bind}}{57} -\entry{\code {break}}{50} -\entry{\code {builtin}}{59} +\entry{\code {bg}}{124} +\entry{\code {bind}}{59} +\entry{\code {break}}{51} +\entry{\code {builtin}}{61} \initial {C} -\entry{\code {caller}}{59} -\entry{\code {cd}}{50} -\entry{\code {command}}{59} -\entry{\code {compgen}}{152} -\entry{\code {complete}}{152} -\entry{\code {compopt}}{155} -\entry{\code {continue}}{50} +\entry{\code {caller}}{61} +\entry{\code {cd}}{51} +\entry{\code {command}}{61} +\entry{\code {compgen}}{157} +\entry{\code {complete}}{157} +\entry{\code {compopt}}{161} +\entry{\code {continue}}{52} \initial {D} -\entry{\code {declare}}{60} -\entry{\code {dirs}}{106} -\entry{\code {disown}}{121} +\entry{\code {declare}}{62} +\entry{\code {dirs}}{110} +\entry{\code {disown}}{126} \initial {E} -\entry{\code {echo}}{61} -\entry{\code {enable}}{62} -\entry{\code {eval}}{51} -\entry{\code {exec}}{51} -\entry{\code {exit}}{51} -\entry{\code {export}}{51} +\entry{\code {echo}}{63} +\entry{\code {enable}}{64} +\entry{\code {eval}}{52} +\entry{\code {exec}}{52} +\entry{\code {exit}}{52} +\entry{\code {export}}{52} \initial {F} -\entry{\code {false}}{51} -\entry{\code {fc}}{160} -\entry{\code {fg}}{119} +\entry{\code {false}}{53} +\entry{\code {fc}}{165} +\entry{\code {fg}}{124} \initial {G} -\entry{\code {getopts}}{51} +\entry{\code {getopts}}{53} \initial {H} -\entry{\code {hash}}{52} -\entry{\code {help}}{63} -\entry{\code {history}}{160} +\entry{\code {hash}}{54} +\entry{\code {help}}{65} +\entry{\code {history}}{165} \initial {J} -\entry{\code {jobs}}{119} +\entry{\code {jobs}}{124} \initial {K} -\entry{\code {kill}}{120} +\entry{\code {kill}}{125} \initial {L} -\entry{\code {let}}{63} -\entry{\code {local}}{63} -\entry{\code {logout}}{63} +\entry{\code {let}}{65} +\entry{\code {local}}{65} +\entry{\code {logout}}{65} \initial {M} -\entry{\code {mapfile}}{63} +\entry{\code {mapfile}}{66} \initial {P} -\entry{\code {popd}}{106} -\entry{\code {printf}}{64} -\entry{\code {pushd}}{106} -\entry{\code {pwd}}{53} +\entry{\code {popd}}{110} +\entry{\code {printf}}{66} +\entry{\code {pushd}}{111} +\entry{\code {pwd}}{54} \initial {R} -\entry{\code {read}}{65} -\entry{\code {readarray}}{67} -\entry{\code {readonly}}{53} -\entry{\code {return}}{53} +\entry{\code {read}}{67} +\entry{\code {readarray}}{69} +\entry{\code {readonly}}{54} +\entry{\code {return}}{55} \initial {S} -\entry{\code {set}}{69} -\entry{\code {shift}}{53} -\entry{\code {shopt}}{74} -\entry{\code {source}}{67} -\entry{\code {suspend}}{121} +\entry{\code {set}}{71} +\entry{\code {shift}}{55} +\entry{\code {shopt}}{76} +\entry{\code {source}}{69} +\entry{\code {suspend}}{126} \initial {T} -\entry{\code {test}}{54} -\entry{\code {times}}{55} -\entry{\code {trap}}{55} -\entry{\code {true}}{56} -\entry{\code {type}}{67} -\entry{\code {typeset}}{68} +\entry{\code {test}}{55} +\entry{\code {times}}{57} +\entry{\code {trap}}{57} +\entry{\code {true}}{58} +\entry{\code {type}}{69} +\entry{\code {typeset}}{70} \initial {U} -\entry{\code {ulimit}}{68} -\entry{\code {umask}}{56} -\entry{\code {unalias}}{69} -\entry{\code {unset}}{57} +\entry{\code {ulimit}}{70} +\entry{\code {umask}}{58} +\entry{\code {unalias}}{71} +\entry{\code {unset}}{58} \initial {W} -\entry{\code {wait}}{120} +\entry{\code {wait}}{125} diff --git a/doc/bashref.cp b/doc/bashref.cp index 1eeb53cc..3c0736b3 100644 --- a/doc/bashref.cp +++ b/doc/bashref.cp @@ -21,12 +21,13 @@ \entry{Bourne shell}{5}{Bourne shell} \entry{quoting}{6}{quoting} \entry{quoting, ANSI}{6}{quoting, ANSI} +\entry{dollar-single quote quoting}{6}{dollar-single quote quoting} \entry{localization}{7}{localization} \entry{internationalization}{7}{internationalization} \entry{native languages}{7}{native languages} \entry{translation, native languages}{7}{translation, native languages} -\entry{internationalized scripts}{7}{internationalized scripts} -\entry{string translations}{7}{string translations} +\entry{internationalized scripts}{8}{internationalized scripts} +\entry{string translations}{8}{string translations} \entry{comments, shell}{9}{comments, shell} \entry{commands, shell}{9}{commands, shell} \entry{reserved words}{9}{reserved words} @@ -34,96 +35,96 @@ \entry{pipeline}{10}{pipeline} \entry{commands, pipelines}{10}{commands, pipelines} \entry{command timing}{10}{command timing} -\entry{commands, lists}{10}{commands, lists} +\entry{commands, lists}{11}{commands, lists} \entry{commands, compound}{11}{commands, compound} -\entry{commands, looping}{11}{commands, looping} +\entry{commands, looping}{12}{commands, looping} \entry{commands, conditional}{12}{commands, conditional} \entry{commands, grouping}{17}{commands, grouping} \entry{coprocess}{18}{coprocess} \entry{shell function}{19}{shell function} \entry{functions, shell}{19}{functions, shell} -\entry{parameters}{21}{parameters} -\entry{variable, shell}{21}{variable, shell} -\entry{shell variable}{21}{shell variable} +\entry{parameters}{22}{parameters} +\entry{variable, shell}{22}{variable, shell} +\entry{shell variable}{22}{shell variable} \entry{parameters, positional}{23}{parameters, positional} \entry{parameters, special}{23}{parameters, special} \entry{expansion}{24}{expansion} -\entry{brace expansion}{24}{brace expansion} -\entry{expansion, brace}{24}{expansion, brace} -\entry{tilde expansion}{25}{tilde expansion} -\entry{expansion, tilde}{25}{expansion, tilde} -\entry{parameter expansion}{26}{parameter expansion} -\entry{expansion, parameter}{26}{expansion, parameter} -\entry{command substitution}{34}{command substitution} -\entry{expansion, arithmetic}{35}{expansion, arithmetic} -\entry{arithmetic expansion}{35}{arithmetic expansion} -\entry{process substitution}{35}{process substitution} -\entry{word splitting}{36}{word splitting} -\entry{expansion, filename}{36}{expansion, filename} -\entry{expansion, pathname}{36}{expansion, pathname} -\entry{filename expansion}{36}{filename expansion} -\entry{pathname expansion}{36}{pathname expansion} -\entry{pattern matching}{37}{pattern matching} -\entry{matching, pattern}{37}{matching, pattern} -\entry{redirection}{39}{redirection} -\entry{command expansion}{43}{command expansion} -\entry{command execution}{43}{command execution} -\entry{command search}{43}{command search} -\entry{execution environment}{44}{execution environment} -\entry{environment}{45}{environment} -\entry{exit status}{45}{exit status} -\entry{signal handling}{46}{signal handling} -\entry{shell script}{47}{shell script} -\entry{special builtin}{80}{special builtin} -\entry{login shell}{96}{login shell} -\entry{interactive shell}{96}{interactive shell} -\entry{startup files}{96}{startup files} -\entry{interactive shell}{98}{interactive shell} -\entry{shell, interactive}{98}{shell, interactive} -\entry{expressions, conditional}{99}{expressions, conditional} -\entry{arithmetic, shell}{101}{arithmetic, shell} -\entry{shell arithmetic}{101}{shell arithmetic} -\entry{expressions, arithmetic}{101}{expressions, arithmetic} -\entry{evaluation, arithmetic}{101}{evaluation, arithmetic} -\entry{arithmetic evaluation}{101}{arithmetic evaluation} -\entry{arithmetic operators}{101}{arithmetic operators} -\entry{unary arithmetic operators}{101}{unary arithmetic operators} -\entry{binary arithmetic operators}{101}{binary arithmetic operators} -\entry{conditional arithmetic operator}{101}{conditional arithmetic operator} -\entry{bitwise arithmetic operators}{101}{bitwise arithmetic operators} -\entry{alias expansion}{103}{alias expansion} -\entry{arrays}{103}{arrays} -\entry{directory stack}{105}{directory stack} -\entry{prompting}{107}{prompting} -\entry{restricted shell}{109}{restricted shell} -\entry{POSIX description}{109}{POSIX description} -\entry{POSIX Mode}{110}{POSIX Mode} -\entry{Compatibility Level}{114}{Compatibility Level} -\entry{Compatibility Mode}{114}{Compatibility Mode} -\entry{job control}{118}{job control} -\entry{foreground}{118}{foreground} -\entry{background}{118}{background} -\entry{suspending jobs}{118}{suspending jobs} -\entry{Readline, how to use}{121}{Readline, how to use} -\entry{interaction, readline}{122}{interaction, readline} -\entry{notation, readline}{123}{notation, readline} -\entry{command editing}{123}{command editing} -\entry{editing command lines}{123}{editing command lines} -\entry{killing text}{124}{killing text} -\entry{yanking text}{124}{yanking text} -\entry{kill ring}{124}{kill ring} -\entry{initialization file, readline}{125}{initialization file, readline} -\entry{variables, readline}{126}{variables, readline} -\entry{programmable completion}{150}{programmable completion} -\entry{completion builtins}{152}{completion builtins} -\entry{History, how to use}{158}{History, how to use} -\entry{command history}{159}{command history} -\entry{history list}{159}{history list} -\entry{history builtins}{159}{history builtins} -\entry{history expansion}{161}{history expansion} -\entry{event designators}{162}{event designators} -\entry{history events}{162}{history events} -\entry{installation}{165}{installation} -\entry{configuration}{165}{configuration} -\entry{Bash installation}{165}{Bash installation} -\entry{Bash configuration}{165}{Bash configuration} +\entry{brace expansion}{25}{brace expansion} +\entry{expansion, brace}{25}{expansion, brace} +\entry{tilde expansion}{26}{tilde expansion} +\entry{expansion, tilde}{26}{expansion, tilde} +\entry{parameter expansion}{27}{parameter expansion} +\entry{expansion, parameter}{27}{expansion, parameter} +\entry{command substitution}{35}{command substitution} +\entry{expansion, arithmetic}{36}{expansion, arithmetic} +\entry{arithmetic expansion}{36}{arithmetic expansion} +\entry{process substitution}{36}{process substitution} +\entry{word splitting}{37}{word splitting} +\entry{expansion, filename}{37}{expansion, filename} +\entry{expansion, pathname}{37}{expansion, pathname} +\entry{filename expansion}{37}{filename expansion} +\entry{pathname expansion}{37}{pathname expansion} +\entry{pattern matching}{38}{pattern matching} +\entry{matching, pattern}{38}{matching, pattern} +\entry{redirection}{40}{redirection} +\entry{command expansion}{44}{command expansion} +\entry{command execution}{44}{command execution} +\entry{command search}{44}{command search} +\entry{execution environment}{45}{execution environment} +\entry{environment}{46}{environment} +\entry{exit status}{47}{exit status} +\entry{signal handling}{47}{signal handling} +\entry{shell script}{48}{shell script} +\entry{special builtin}{82}{special builtin} +\entry{login shell}{100}{login shell} +\entry{interactive shell}{100}{interactive shell} +\entry{startup files}{100}{startup files} +\entry{interactive shell}{102}{interactive shell} +\entry{shell, interactive}{102}{shell, interactive} +\entry{expressions, conditional}{103}{expressions, conditional} +\entry{arithmetic, shell}{105}{arithmetic, shell} +\entry{shell arithmetic}{105}{shell arithmetic} +\entry{expressions, arithmetic}{105}{expressions, arithmetic} +\entry{evaluation, arithmetic}{105}{evaluation, arithmetic} +\entry{arithmetic evaluation}{105}{arithmetic evaluation} +\entry{arithmetic operators}{106}{arithmetic operators} +\entry{unary arithmetic operators}{106}{unary arithmetic operators} +\entry{binary arithmetic operators}{106}{binary arithmetic operators} +\entry{conditional arithmetic operator}{106}{conditional arithmetic operator} +\entry{bitwise arithmetic operators}{106}{bitwise arithmetic operators} +\entry{alias expansion}{107}{alias expansion} +\entry{arrays}{108}{arrays} +\entry{directory stack}{110}{directory stack} +\entry{prompting}{111}{prompting} +\entry{restricted shell}{113}{restricted shell} +\entry{POSIX description}{114}{POSIX description} +\entry{POSIX Mode}{114}{POSIX Mode} +\entry{Compatibility Level}{119}{Compatibility Level} +\entry{Compatibility Mode}{119}{Compatibility Mode} +\entry{job control}{123}{job control} +\entry{foreground}{123}{foreground} +\entry{background}{123}{background} +\entry{suspending jobs}{123}{suspending jobs} +\entry{Readline, how to use}{126}{Readline, how to use} +\entry{interaction, readline}{127}{interaction, readline} +\entry{notation, readline}{128}{notation, readline} +\entry{command editing}{128}{command editing} +\entry{editing command lines}{128}{editing command lines} +\entry{killing text}{129}{killing text} +\entry{yanking text}{129}{yanking text} +\entry{kill ring}{129}{kill ring} +\entry{initialization file, readline}{130}{initialization file, readline} +\entry{variables, readline}{131}{variables, readline} +\entry{programmable completion}{155}{programmable completion} +\entry{completion builtins}{157}{completion builtins} +\entry{History, how to use}{163}{History, how to use} +\entry{command history}{164}{command history} +\entry{history list}{164}{history list} +\entry{history builtins}{165}{history builtins} +\entry{history expansion}{167}{history expansion} +\entry{event designators}{168}{event designators} +\entry{history events}{168}{history events} +\entry{installation}{171}{installation} +\entry{configuration}{171}{configuration} +\entry{Bash installation}{171}{Bash installation} +\entry{Bash configuration}{171}{Bash configuration} diff --git a/doc/bashref.cps b/doc/bashref.cps index 2fc19310..55a8f772 100644 --- a/doc/bashref.cps +++ b/doc/bashref.cps @@ -1,148 +1,149 @@ \initial {A} -\entry{alias expansion}{103} -\entry{arithmetic evaluation}{101} -\entry{arithmetic expansion}{35} -\entry{arithmetic operators}{101} -\entry{arithmetic, shell}{101} -\entry{arrays}{103} +\entry{alias expansion}{107} +\entry{arithmetic evaluation}{105} +\entry{arithmetic expansion}{36} +\entry{arithmetic operators}{106} +\entry{arithmetic, shell}{105} +\entry{arrays}{108} \initial {B} -\entry{background}{118} -\entry{Bash configuration}{165} -\entry{Bash installation}{165} -\entry{binary arithmetic operators}{101} -\entry{bitwise arithmetic operators}{101} +\entry{background}{123} +\entry{Bash configuration}{171} +\entry{Bash installation}{171} +\entry{binary arithmetic operators}{106} +\entry{bitwise arithmetic operators}{106} \entry{Bourne shell}{5} -\entry{brace expansion}{24} +\entry{brace expansion}{25} \entry{builtin}{3} \initial {C} -\entry{command editing}{123} -\entry{command execution}{43} -\entry{command expansion}{43} -\entry{command history}{159} -\entry{command search}{43} -\entry{command substitution}{34} +\entry{command editing}{128} +\entry{command execution}{44} +\entry{command expansion}{44} +\entry{command history}{164} +\entry{command search}{44} +\entry{command substitution}{35} \entry{command timing}{10} \entry{commands, compound}{11} \entry{commands, conditional}{12} \entry{commands, grouping}{17} -\entry{commands, lists}{10} -\entry{commands, looping}{11} +\entry{commands, lists}{11} +\entry{commands, looping}{12} \entry{commands, pipelines}{10} \entry{commands, shell}{9} \entry{commands, simple}{9} \entry{comments, shell}{9} -\entry{Compatibility Level}{114} -\entry{Compatibility Mode}{114} -\entry{completion builtins}{152} -\entry{conditional arithmetic operator}{101} -\entry{configuration}{165} +\entry{Compatibility Level}{119} +\entry{Compatibility Mode}{119} +\entry{completion builtins}{157} +\entry{conditional arithmetic operator}{106} +\entry{configuration}{171} \entry{control operator}{3} \entry{coprocess}{18} \initial {D} -\entry{directory stack}{105} +\entry{directory stack}{110} +\entry{dollar-single quote quoting}{6} \initial {E} -\entry{editing command lines}{123} -\entry{environment}{45} -\entry{evaluation, arithmetic}{101} -\entry{event designators}{162} -\entry{execution environment}{44} -\entry{exit status}{3, 45} +\entry{editing command lines}{128} +\entry{environment}{46} +\entry{evaluation, arithmetic}{105} +\entry{event designators}{168} +\entry{execution environment}{45} +\entry{exit status}{3, 47} \entry{expansion}{24} -\entry{expansion, arithmetic}{35} -\entry{expansion, brace}{24} -\entry{expansion, filename}{36} -\entry{expansion, parameter}{26} -\entry{expansion, pathname}{36} -\entry{expansion, tilde}{25} -\entry{expressions, arithmetic}{101} -\entry{expressions, conditional}{99} +\entry{expansion, arithmetic}{36} +\entry{expansion, brace}{25} +\entry{expansion, filename}{37} +\entry{expansion, parameter}{27} +\entry{expansion, pathname}{37} +\entry{expansion, tilde}{26} +\entry{expressions, arithmetic}{105} +\entry{expressions, conditional}{103} \initial {F} \entry{field}{3} \entry{filename}{3} -\entry{filename expansion}{36} -\entry{foreground}{118} +\entry{filename expansion}{37} +\entry{foreground}{123} \entry{functions, shell}{19} \initial {H} -\entry{history builtins}{159} -\entry{history events}{162} -\entry{history expansion}{161} -\entry{history list}{159} -\entry{History, how to use}{158} +\entry{history builtins}{165} +\entry{history events}{168} +\entry{history expansion}{167} +\entry{history list}{164} +\entry{History, how to use}{163} \initial {I} \entry{identifier}{3} -\entry{initialization file, readline}{125} -\entry{installation}{165} -\entry{interaction, readline}{122} -\entry{interactive shell}{96, 98} +\entry{initialization file, readline}{130} +\entry{installation}{171} +\entry{interaction, readline}{127} +\entry{interactive shell}{100, 102} \entry{internationalization}{7} -\entry{internationalized scripts}{7} +\entry{internationalized scripts}{8} \initial {J} \entry{job}{3} -\entry{job control}{3, 118} +\entry{job control}{3, 123} \initial {K} -\entry{kill ring}{124} -\entry{killing text}{124} +\entry{kill ring}{129} +\entry{killing text}{129} \initial {L} \entry{localization}{7} -\entry{login shell}{96} +\entry{login shell}{100} \initial {M} -\entry{matching, pattern}{37} +\entry{matching, pattern}{38} \entry{metacharacter}{3} \initial {N} \entry{name}{3} \entry{native languages}{7} -\entry{notation, readline}{123} +\entry{notation, readline}{128} \initial {O} \entry{operator, shell}{3} \initial {P} -\entry{parameter expansion}{26} -\entry{parameters}{21} +\entry{parameter expansion}{27} +\entry{parameters}{22} \entry{parameters, positional}{23} \entry{parameters, special}{23} -\entry{pathname expansion}{36} -\entry{pattern matching}{37} +\entry{pathname expansion}{37} +\entry{pattern matching}{38} \entry{pipeline}{10} \entry{POSIX}{3} -\entry{POSIX description}{109} -\entry{POSIX Mode}{110} +\entry{POSIX description}{114} +\entry{POSIX Mode}{114} \entry{process group}{3} \entry{process group ID}{3} -\entry{process substitution}{35} -\entry{programmable completion}{150} -\entry{prompting}{107} +\entry{process substitution}{36} +\entry{programmable completion}{155} +\entry{prompting}{111} \initial {Q} \entry{quoting}{6} \entry{quoting, ANSI}{6} \initial {R} -\entry{Readline, how to use}{121} -\entry{redirection}{39} +\entry{Readline, how to use}{126} +\entry{redirection}{40} \entry{reserved word}{3} \entry{reserved words}{9} -\entry{restricted shell}{109} +\entry{restricted shell}{113} \entry{return status}{4} \initial {S} -\entry{shell arithmetic}{101} +\entry{shell arithmetic}{105} \entry{shell function}{19} -\entry{shell script}{47} -\entry{shell variable}{21} -\entry{shell, interactive}{98} +\entry{shell script}{48} +\entry{shell variable}{22} +\entry{shell, interactive}{102} \entry{signal}{4} -\entry{signal handling}{46} -\entry{special builtin}{4, 80} -\entry{startup files}{96} -\entry{string translations}{7} -\entry{suspending jobs}{118} +\entry{signal handling}{47} +\entry{special builtin}{4, 82} +\entry{startup files}{100} +\entry{string translations}{8} +\entry{suspending jobs}{123} \initial {T} -\entry{tilde expansion}{25} +\entry{tilde expansion}{26} \entry{token}{4} \entry{translation, native languages}{7} \initial {U} -\entry{unary arithmetic operators}{101} +\entry{unary arithmetic operators}{106} \initial {V} -\entry{variable, shell}{21} -\entry{variables, readline}{126} +\entry{variable, shell}{22} +\entry{variables, readline}{131} \initial {W} \entry{word}{4} -\entry{word splitting}{36} +\entry{word splitting}{37} \initial {Y} -\entry{yanking text}{124} +\entry{yanking text}{129} diff --git a/doc/bashref.fn b/doc/bashref.fn index e4083d77..8a5258c6 100644 --- a/doc/bashref.fn +++ b/doc/bashref.fn @@ -1,115 +1,115 @@ -\entry{beginning-of-line (C-a)}{139}{\code {beginning-of-line (C-a)}} -\entry{end-of-line (C-e)}{139}{\code {end-of-line (C-e)}} -\entry{forward-char (C-f)}{139}{\code {forward-char (C-f)}} -\entry{backward-char (C-b)}{139}{\code {backward-char (C-b)}} -\entry{forward-word (M-f)}{139}{\code {forward-word (M-f)}} -\entry{backward-word (M-b)}{139}{\code {backward-word (M-b)}} -\entry{shell-forward-word (M-C-f)}{139}{\code {shell-forward-word (M-C-f)}} -\entry{shell-backward-word (M-C-b)}{139}{\code {shell-backward-word (M-C-b)}} -\entry{previous-screen-line ()}{139}{\code {previous-screen-line ()}} -\entry{next-screen-line ()}{140}{\code {next-screen-line ()}} -\entry{clear-display (M-C-l)}{140}{\code {clear-display (M-C-l)}} -\entry{clear-screen (C-l)}{140}{\code {clear-screen (C-l)}} -\entry{redraw-current-line ()}{140}{\code {redraw-current-line ()}} -\entry{accept-line (Newline or Return)}{140}{\code {accept-line (Newline or Return)}} -\entry{previous-history (C-p)}{140}{\code {previous-history (C-p)}} -\entry{next-history (C-n)}{140}{\code {next-history (C-n)}} -\entry{beginning-of-history (M-<)}{140}{\code {beginning-of-history (M-<)}} -\entry{end-of-history (M->)}{140}{\code {end-of-history (M->)}} -\entry{reverse-search-history (C-r)}{140}{\code {reverse-search-history (C-r)}} -\entry{forward-search-history (C-s)}{140}{\code {forward-search-history (C-s)}} -\entry{non-incremental-reverse-search-history (M-p)}{140}{\code {non-incremental-reverse-search-history (M-p)}} -\entry{non-incremental-forward-search-history (M-n)}{141}{\code {non-incremental-forward-search-history (M-n)}} -\entry{history-search-backward ()}{141}{\code {history-search-backward ()}} -\entry{history-search-forward ()}{141}{\code {history-search-forward ()}} -\entry{history-substring-search-backward ()}{141}{\code {history-substring-search-backward ()}} -\entry{history-substring-search-forward ()}{141}{\code {history-substring-search-forward ()}} -\entry{yank-nth-arg (M-C-y)}{141}{\code {yank-nth-arg (M-C-y)}} -\entry{yank-last-arg (M-. or M-_)}{141}{\code {yank-last-arg (M-. or M-_)}} -\entry{operate-and-get-next (C-o)}{142}{\code {operate-and-get-next (C-o)}} -\entry{fetch-history ()}{142}{\code {fetch-history ()}} -\entry{end-of-file (usually C-d)}{142}{\code {\i {end-of-file} (usually C-d)}} -\entry{delete-char (C-d)}{142}{\code {delete-char (C-d)}} -\entry{backward-delete-char (Rubout)}{142}{\code {backward-delete-char (Rubout)}} -\entry{forward-backward-delete-char ()}{142}{\code {forward-backward-delete-char ()}} -\entry{quoted-insert (C-q or C-v)}{142}{\code {quoted-insert (C-q or C-v)}} -\entry{self-insert (a, b, A, 1, !, ...{})}{142}{\code {self-insert (a, b, A, 1, !, \dots {})}} -\entry{bracketed-paste-begin ()}{142}{\code {bracketed-paste-begin ()}} -\entry{transpose-chars (C-t)}{142}{\code {transpose-chars (C-t)}} -\entry{transpose-words (M-t)}{143}{\code {transpose-words (M-t)}} -\entry{shell-transpose-words (M-C-t)}{143}{\code {shell-transpose-words (M-C-t)}} -\entry{upcase-word (M-u)}{143}{\code {upcase-word (M-u)}} -\entry{downcase-word (M-l)}{143}{\code {downcase-word (M-l)}} -\entry{capitalize-word (M-c)}{143}{\code {capitalize-word (M-c)}} -\entry{overwrite-mode ()}{143}{\code {overwrite-mode ()}} -\entry{kill-line (C-k)}{143}{\code {kill-line (C-k)}} -\entry{backward-kill-line (C-x Rubout)}{143}{\code {backward-kill-line (C-x Rubout)}} -\entry{unix-line-discard (C-u)}{143}{\code {unix-line-discard (C-u)}} -\entry{kill-whole-line ()}{144}{\code {kill-whole-line ()}} -\entry{kill-word (M-d)}{144}{\code {kill-word (M-d)}} -\entry{backward-kill-word (M-DEL)}{144}{\code {backward-kill-word (M-\key {DEL})}} -\entry{shell-kill-word (M-C-d)}{144}{\code {shell-kill-word (M-C-d)}} -\entry{shell-backward-kill-word ()}{144}{\code {shell-backward-kill-word ()}} -\entry{unix-word-rubout (C-w)}{144}{\code {unix-word-rubout (C-w)}} -\entry{unix-filename-rubout ()}{144}{\code {unix-filename-rubout ()}} -\entry{delete-horizontal-space ()}{144}{\code {delete-horizontal-space ()}} -\entry{kill-region ()}{144}{\code {kill-region ()}} -\entry{copy-region-as-kill ()}{144}{\code {copy-region-as-kill ()}} -\entry{copy-backward-word ()}{144}{\code {copy-backward-word ()}} -\entry{copy-forward-word ()}{144}{\code {copy-forward-word ()}} -\entry{yank (C-y)}{144}{\code {yank (C-y)}} -\entry{yank-pop (M-y)}{144}{\code {yank-pop (M-y)}} -\entry{digit-argument (M-0, M-1, ...{} M--)}{145}{\code {digit-argument (\kbd {M-0}, \kbd {M-1}, \dots {} \kbd {M--})}} -\entry{universal-argument ()}{145}{\code {universal-argument ()}} -\entry{complete (TAB)}{145}{\code {complete (\key {TAB})}} -\entry{possible-completions (M-?)}{145}{\code {possible-completions (M-?)}} -\entry{insert-completions (M-*)}{145}{\code {insert-completions (M-*)}} -\entry{menu-complete ()}{145}{\code {menu-complete ()}} -\entry{menu-complete-backward ()}{145}{\code {menu-complete-backward ()}} -\entry{delete-char-or-list ()}{146}{\code {delete-char-or-list ()}} -\entry{complete-filename (M-/)}{146}{\code {complete-filename (M-/)}} -\entry{possible-filename-completions (C-x /)}{146}{\code {possible-filename-completions (C-x /)}} -\entry{complete-username (M-~)}{146}{\code {complete-username (M-~)}} -\entry{possible-username-completions (C-x ~)}{146}{\code {possible-username-completions (C-x ~)}} -\entry{complete-variable (M-$)}{146}{\code {complete-variable (M-$)}} -\entry{possible-variable-completions (C-x $)}{146}{\code {possible-variable-completions (C-x $)}} -\entry{complete-hostname (M-@)}{146}{\code {complete-hostname (M-@)}} -\entry{possible-hostname-completions (C-x @)}{146}{\code {possible-hostname-completions (C-x @)}} -\entry{complete-command (M-!)}{146}{\code {complete-command (M-!)}} -\entry{possible-command-completions (C-x !)}{146}{\code {possible-command-completions (C-x !)}} -\entry{dynamic-complete-history (M-TAB)}{146}{\code {dynamic-complete-history (M-\key {TAB})}} -\entry{dabbrev-expand ()}{146}{\code {dabbrev-expand ()}} -\entry{complete-into-braces (M-{\indexlbrace })}{146}{\code {complete-into-braces (M-{\tt \char 123})}} -\entry{start-kbd-macro (C-x ()}{147}{\code {start-kbd-macro (C-x ()}} -\entry{end-kbd-macro (C-x ))}{147}{\code {end-kbd-macro (C-x ))}} -\entry{call-last-kbd-macro (C-x e)}{147}{\code {call-last-kbd-macro (C-x e)}} -\entry{print-last-kbd-macro ()}{147}{\code {print-last-kbd-macro ()}} -\entry{re-read-init-file (C-x C-r)}{147}{\code {re-read-init-file (C-x C-r)}} -\entry{abort (C-g)}{147}{\code {abort (C-g)}} -\entry{do-lowercase-version (M-A, M-B, M-x, ...{})}{147}{\code {do-lowercase-version (M-A, M-B, M-\var {x}, \dots {})}} -\entry{prefix-meta (ESC)}{147}{\code {prefix-meta (\key {ESC})}} -\entry{undo (C-_ or C-x C-u)}{147}{\code {undo (C-_ or C-x C-u)}} -\entry{revert-line (M-r)}{147}{\code {revert-line (M-r)}} -\entry{tilde-expand (M-&)}{147}{\code {tilde-expand (M-&)}} -\entry{set-mark (C-@)}{147}{\code {set-mark (C-@)}} -\entry{exchange-point-and-mark (C-x C-x)}{147}{\code {exchange-point-and-mark (C-x C-x)}} -\entry{character-search (C-])}{147}{\code {character-search (C-])}} -\entry{character-search-backward (M-C-])}{148}{\code {character-search-backward (M-C-])}} -\entry{skip-csi-sequence ()}{148}{\code {skip-csi-sequence ()}} -\entry{insert-comment (M-#)}{148}{\code {insert-comment (M-#)}} -\entry{dump-functions ()}{148}{\code {dump-functions ()}} -\entry{dump-variables ()}{148}{\code {dump-variables ()}} -\entry{dump-macros ()}{148}{\code {dump-macros ()}} -\entry{spell-correct-word (C-x s)}{148}{\code {spell-correct-word (C-x s)}} -\entry{glob-complete-word (M-g)}{148}{\code {glob-complete-word (M-g)}} -\entry{glob-expand-word (C-x *)}{149}{\code {glob-expand-word (C-x *)}} -\entry{glob-list-expansions (C-x g)}{149}{\code {glob-list-expansions (C-x g)}} -\entry{display-shell-version (C-x C-v)}{149}{\code {display-shell-version (C-x C-v)}} -\entry{shell-expand-line (M-C-e)}{149}{\code {shell-expand-line (M-C-e)}} -\entry{history-expand-line (M-^)}{149}{\code {history-expand-line (M-^)}} -\entry{magic-space ()}{149}{\code {magic-space ()}} -\entry{alias-expand-line ()}{149}{\code {alias-expand-line ()}} -\entry{history-and-alias-expand-line ()}{149}{\code {history-and-alias-expand-line ()}} -\entry{insert-last-argument (M-. or M-_)}{149}{\code {insert-last-argument (M-. or M-_)}} -\entry{edit-and-execute-command (C-x C-e)}{149}{\code {edit-and-execute-command (C-x C-e)}} -\entry{execute-named-command (M-x)}{149}{\code {execute-named-command (M-x)}} +\entry{beginning-of-line (C-a)}{144}{\code {beginning-of-line (C-a)}} +\entry{end-of-line (C-e)}{144}{\code {end-of-line (C-e)}} +\entry{forward-char (C-f)}{144}{\code {forward-char (C-f)}} +\entry{backward-char (C-b)}{144}{\code {backward-char (C-b)}} +\entry{forward-word (M-f)}{144}{\code {forward-word (M-f)}} +\entry{backward-word (M-b)}{144}{\code {backward-word (M-b)}} +\entry{shell-forward-word (M-C-f)}{144}{\code {shell-forward-word (M-C-f)}} +\entry{shell-backward-word (M-C-b)}{144}{\code {shell-backward-word (M-C-b)}} +\entry{previous-screen-line ()}{144}{\code {previous-screen-line ()}} +\entry{next-screen-line ()}{145}{\code {next-screen-line ()}} +\entry{clear-display (M-C-l)}{145}{\code {clear-display (M-C-l)}} +\entry{clear-screen (C-l)}{145}{\code {clear-screen (C-l)}} +\entry{redraw-current-line ()}{145}{\code {redraw-current-line ()}} +\entry{accept-line (Newline or Return)}{145}{\code {accept-line (Newline or Return)}} +\entry{previous-history (C-p)}{145}{\code {previous-history (C-p)}} +\entry{next-history (C-n)}{145}{\code {next-history (C-n)}} +\entry{beginning-of-history (M-<)}{145}{\code {beginning-of-history (M-<)}} +\entry{end-of-history (M->)}{145}{\code {end-of-history (M->)}} +\entry{reverse-search-history (C-r)}{145}{\code {reverse-search-history (C-r)}} +\entry{forward-search-history (C-s)}{145}{\code {forward-search-history (C-s)}} +\entry{non-incremental-reverse-search-history (M-p)}{145}{\code {non-incremental-reverse-search-history (M-p)}} +\entry{non-incremental-forward-search-history (M-n)}{146}{\code {non-incremental-forward-search-history (M-n)}} +\entry{history-search-backward ()}{146}{\code {history-search-backward ()}} +\entry{history-search-forward ()}{146}{\code {history-search-forward ()}} +\entry{history-substring-search-backward ()}{146}{\code {history-substring-search-backward ()}} +\entry{history-substring-search-forward ()}{146}{\code {history-substring-search-forward ()}} +\entry{yank-nth-arg (M-C-y)}{146}{\code {yank-nth-arg (M-C-y)}} +\entry{yank-last-arg (M-. or M-_)}{146}{\code {yank-last-arg (M-. or M-_)}} +\entry{operate-and-get-next (C-o)}{147}{\code {operate-and-get-next (C-o)}} +\entry{fetch-history ()}{147}{\code {fetch-history ()}} +\entry{end-of-file (usually C-d)}{147}{\code {\i {end-of-file} (usually C-d)}} +\entry{delete-char (C-d)}{147}{\code {delete-char (C-d)}} +\entry{backward-delete-char (Rubout)}{147}{\code {backward-delete-char (Rubout)}} +\entry{forward-backward-delete-char ()}{147}{\code {forward-backward-delete-char ()}} +\entry{quoted-insert (C-q or C-v)}{147}{\code {quoted-insert (C-q or C-v)}} +\entry{self-insert (a, b, A, 1, !, ...{})}{147}{\code {self-insert (a, b, A, 1, !, \dots {})}} +\entry{bracketed-paste-begin ()}{147}{\code {bracketed-paste-begin ()}} +\entry{transpose-chars (C-t)}{147}{\code {transpose-chars (C-t)}} +\entry{transpose-words (M-t)}{148}{\code {transpose-words (M-t)}} +\entry{shell-transpose-words (M-C-t)}{148}{\code {shell-transpose-words (M-C-t)}} +\entry{upcase-word (M-u)}{148}{\code {upcase-word (M-u)}} +\entry{downcase-word (M-l)}{148}{\code {downcase-word (M-l)}} +\entry{capitalize-word (M-c)}{148}{\code {capitalize-word (M-c)}} +\entry{overwrite-mode ()}{148}{\code {overwrite-mode ()}} +\entry{kill-line (C-k)}{148}{\code {kill-line (C-k)}} +\entry{backward-kill-line (C-x Rubout)}{148}{\code {backward-kill-line (C-x Rubout)}} +\entry{unix-line-discard (C-u)}{148}{\code {unix-line-discard (C-u)}} +\entry{kill-whole-line ()}{149}{\code {kill-whole-line ()}} +\entry{kill-word (M-d)}{149}{\code {kill-word (M-d)}} +\entry{backward-kill-word (M-DEL)}{149}{\code {backward-kill-word (M-\key {DEL})}} +\entry{shell-kill-word (M-C-d)}{149}{\code {shell-kill-word (M-C-d)}} +\entry{shell-backward-kill-word ()}{149}{\code {shell-backward-kill-word ()}} +\entry{unix-word-rubout (C-w)}{149}{\code {unix-word-rubout (C-w)}} +\entry{unix-filename-rubout ()}{149}{\code {unix-filename-rubout ()}} +\entry{delete-horizontal-space ()}{149}{\code {delete-horizontal-space ()}} +\entry{kill-region ()}{149}{\code {kill-region ()}} +\entry{copy-region-as-kill ()}{149}{\code {copy-region-as-kill ()}} +\entry{copy-backward-word ()}{149}{\code {copy-backward-word ()}} +\entry{copy-forward-word ()}{149}{\code {copy-forward-word ()}} +\entry{yank (C-y)}{149}{\code {yank (C-y)}} +\entry{yank-pop (M-y)}{149}{\code {yank-pop (M-y)}} +\entry{digit-argument (M-0, M-1, ...{} M--)}{150}{\code {digit-argument (\kbd {M-0}, \kbd {M-1}, \dots {} \kbd {M--})}} +\entry{universal-argument ()}{150}{\code {universal-argument ()}} +\entry{complete (TAB)}{150}{\code {complete (\key {TAB})}} +\entry{possible-completions (M-?)}{150}{\code {possible-completions (M-?)}} +\entry{insert-completions (M-*)}{150}{\code {insert-completions (M-*)}} +\entry{menu-complete ()}{150}{\code {menu-complete ()}} +\entry{menu-complete-backward ()}{150}{\code {menu-complete-backward ()}} +\entry{delete-char-or-list ()}{151}{\code {delete-char-or-list ()}} +\entry{complete-filename (M-/)}{151}{\code {complete-filename (M-/)}} +\entry{possible-filename-completions (C-x /)}{151}{\code {possible-filename-completions (C-x /)}} +\entry{complete-username (M-~)}{151}{\code {complete-username (M-~)}} +\entry{possible-username-completions (C-x ~)}{151}{\code {possible-username-completions (C-x ~)}} +\entry{complete-variable (M-$)}{151}{\code {complete-variable (M-$)}} +\entry{possible-variable-completions (C-x $)}{151}{\code {possible-variable-completions (C-x $)}} +\entry{complete-hostname (M-@)}{151}{\code {complete-hostname (M-@)}} +\entry{possible-hostname-completions (C-x @)}{151}{\code {possible-hostname-completions (C-x @)}} +\entry{complete-command (M-!)}{151}{\code {complete-command (M-!)}} +\entry{possible-command-completions (C-x !)}{151}{\code {possible-command-completions (C-x !)}} +\entry{dynamic-complete-history (M-TAB)}{151}{\code {dynamic-complete-history (M-\key {TAB})}} +\entry{dabbrev-expand ()}{151}{\code {dabbrev-expand ()}} +\entry{complete-into-braces (M-{\indexlbrace })}{151}{\code {complete-into-braces (M-{\tt \char 123})}} +\entry{start-kbd-macro (C-x ()}{152}{\code {start-kbd-macro (C-x ()}} +\entry{end-kbd-macro (C-x ))}{152}{\code {end-kbd-macro (C-x ))}} +\entry{call-last-kbd-macro (C-x e)}{152}{\code {call-last-kbd-macro (C-x e)}} +\entry{print-last-kbd-macro ()}{152}{\code {print-last-kbd-macro ()}} +\entry{re-read-init-file (C-x C-r)}{152}{\code {re-read-init-file (C-x C-r)}} +\entry{abort (C-g)}{152}{\code {abort (C-g)}} +\entry{do-lowercase-version (M-A, M-B, M-x, ...{})}{152}{\code {do-lowercase-version (M-A, M-B, M-\var {x}, \dots {})}} +\entry{prefix-meta (ESC)}{152}{\code {prefix-meta (\key {ESC})}} +\entry{undo (C-_ or C-x C-u)}{152}{\code {undo (C-_ or C-x C-u)}} +\entry{revert-line (M-r)}{152}{\code {revert-line (M-r)}} +\entry{tilde-expand (M-&)}{152}{\code {tilde-expand (M-&)}} +\entry{set-mark (C-@)}{152}{\code {set-mark (C-@)}} +\entry{exchange-point-and-mark (C-x C-x)}{152}{\code {exchange-point-and-mark (C-x C-x)}} +\entry{character-search (C-])}{152}{\code {character-search (C-])}} +\entry{character-search-backward (M-C-])}{153}{\code {character-search-backward (M-C-])}} +\entry{skip-csi-sequence ()}{153}{\code {skip-csi-sequence ()}} +\entry{insert-comment (M-#)}{153}{\code {insert-comment (M-#)}} +\entry{dump-functions ()}{153}{\code {dump-functions ()}} +\entry{dump-variables ()}{153}{\code {dump-variables ()}} +\entry{dump-macros ()}{153}{\code {dump-macros ()}} +\entry{spell-correct-word (C-x s)}{153}{\code {spell-correct-word (C-x s)}} +\entry{glob-complete-word (M-g)}{153}{\code {glob-complete-word (M-g)}} +\entry{glob-expand-word (C-x *)}{154}{\code {glob-expand-word (C-x *)}} +\entry{glob-list-expansions (C-x g)}{154}{\code {glob-list-expansions (C-x g)}} +\entry{display-shell-version (C-x C-v)}{154}{\code {display-shell-version (C-x C-v)}} +\entry{shell-expand-line (M-C-e)}{154}{\code {shell-expand-line (M-C-e)}} +\entry{history-expand-line (M-^)}{154}{\code {history-expand-line (M-^)}} +\entry{magic-space ()}{154}{\code {magic-space ()}} +\entry{alias-expand-line ()}{154}{\code {alias-expand-line ()}} +\entry{history-and-alias-expand-line ()}{154}{\code {history-and-alias-expand-line ()}} +\entry{insert-last-argument (M-. or M-_)}{154}{\code {insert-last-argument (M-. or M-_)}} +\entry{edit-and-execute-command (C-x C-e)}{154}{\code {edit-and-execute-command (C-x C-e)}} +\entry{execute-named-command (M-x)}{154}{\code {execute-named-command (M-x)}} diff --git a/doc/bashref.fns b/doc/bashref.fns index d32b42a7..e31111f5 100644 --- a/doc/bashref.fns +++ b/doc/bashref.fns @@ -1,135 +1,135 @@ \initial {A} -\entry{\code {abort (C-g)}}{147} -\entry{\code {accept-line (Newline or Return)}}{140} -\entry{\code {alias-expand-line ()}}{149} +\entry{\code {abort (C-g)}}{152} +\entry{\code {accept-line (Newline or Return)}}{145} +\entry{\code {alias-expand-line ()}}{154} \initial {B} -\entry{\code {backward-char (C-b)}}{139} -\entry{\code {backward-delete-char (Rubout)}}{142} -\entry{\code {backward-kill-line (C-x Rubout)}}{143} -\entry{\code {backward-kill-word (M-\key {DEL})}}{144} -\entry{\code {backward-word (M-b)}}{139} -\entry{\code {beginning-of-history (M-<)}}{140} -\entry{\code {beginning-of-line (C-a)}}{139} -\entry{\code {bracketed-paste-begin ()}}{142} +\entry{\code {backward-char (C-b)}}{144} +\entry{\code {backward-delete-char (Rubout)}}{147} +\entry{\code {backward-kill-line (C-x Rubout)}}{148} +\entry{\code {backward-kill-word (M-\key {DEL})}}{149} +\entry{\code {backward-word (M-b)}}{144} +\entry{\code {beginning-of-history (M-<)}}{145} +\entry{\code {beginning-of-line (C-a)}}{144} +\entry{\code {bracketed-paste-begin ()}}{147} \initial {C} -\entry{\code {call-last-kbd-macro (C-x e)}}{147} -\entry{\code {capitalize-word (M-c)}}{143} -\entry{\code {character-search (C-])}}{147} -\entry{\code {character-search-backward (M-C-])}}{148} -\entry{\code {clear-display (M-C-l)}}{140} -\entry{\code {clear-screen (C-l)}}{140} -\entry{\code {complete (\key {TAB})}}{145} -\entry{\code {complete-command (M-!)}}{146} -\entry{\code {complete-filename (M-/)}}{146} -\entry{\code {complete-hostname (M-@)}}{146} -\entry{\code {complete-into-braces (M-{\tt \char 123})}}{146} -\entry{\code {complete-username (M-~)}}{146} -\entry{\code {complete-variable (M-$)}}{146} -\entry{\code {copy-backward-word ()}}{144} -\entry{\code {copy-forward-word ()}}{144} -\entry{\code {copy-region-as-kill ()}}{144} +\entry{\code {call-last-kbd-macro (C-x e)}}{152} +\entry{\code {capitalize-word (M-c)}}{148} +\entry{\code {character-search (C-])}}{152} +\entry{\code {character-search-backward (M-C-])}}{153} +\entry{\code {clear-display (M-C-l)}}{145} +\entry{\code {clear-screen (C-l)}}{145} +\entry{\code {complete (\key {TAB})}}{150} +\entry{\code {complete-command (M-!)}}{151} +\entry{\code {complete-filename (M-/)}}{151} +\entry{\code {complete-hostname (M-@)}}{151} +\entry{\code {complete-into-braces (M-{\tt \char 123})}}{151} +\entry{\code {complete-username (M-~)}}{151} +\entry{\code {complete-variable (M-$)}}{151} +\entry{\code {copy-backward-word ()}}{149} +\entry{\code {copy-forward-word ()}}{149} +\entry{\code {copy-region-as-kill ()}}{149} \initial {D} -\entry{\code {dabbrev-expand ()}}{146} -\entry{\code {delete-char (C-d)}}{142} -\entry{\code {delete-char-or-list ()}}{146} -\entry{\code {delete-horizontal-space ()}}{144} -\entry{\code {digit-argument (\kbd {M-0}, \kbd {M-1}, \dots {} \kbd {M--})}}{145} -\entry{\code {display-shell-version (C-x C-v)}}{149} -\entry{\code {do-lowercase-version (M-A, M-B, M-\var {x}, \dots {})}}{147} -\entry{\code {downcase-word (M-l)}}{143} -\entry{\code {dump-functions ()}}{148} -\entry{\code {dump-macros ()}}{148} -\entry{\code {dump-variables ()}}{148} -\entry{\code {dynamic-complete-history (M-\key {TAB})}}{146} +\entry{\code {dabbrev-expand ()}}{151} +\entry{\code {delete-char (C-d)}}{147} +\entry{\code {delete-char-or-list ()}}{151} +\entry{\code {delete-horizontal-space ()}}{149} +\entry{\code {digit-argument (\kbd {M-0}, \kbd {M-1}, \dots {} \kbd {M--})}}{150} +\entry{\code {display-shell-version (C-x C-v)}}{154} +\entry{\code {do-lowercase-version (M-A, M-B, M-\var {x}, \dots {})}}{152} +\entry{\code {downcase-word (M-l)}}{148} +\entry{\code {dump-functions ()}}{153} +\entry{\code {dump-macros ()}}{153} +\entry{\code {dump-variables ()}}{153} +\entry{\code {dynamic-complete-history (M-\key {TAB})}}{151} \initial {E} -\entry{\code {edit-and-execute-command (C-x C-e)}}{149} -\entry{\code {end-kbd-macro (C-x ))}}{147} -\entry{\code {\i {end-of-file} (usually C-d)}}{142} -\entry{\code {end-of-history (M->)}}{140} -\entry{\code {end-of-line (C-e)}}{139} -\entry{\code {exchange-point-and-mark (C-x C-x)}}{147} -\entry{\code {execute-named-command (M-x)}}{149} +\entry{\code {edit-and-execute-command (C-x C-e)}}{154} +\entry{\code {end-kbd-macro (C-x ))}}{152} +\entry{\code {\i {end-of-file} (usually C-d)}}{147} +\entry{\code {end-of-history (M->)}}{145} +\entry{\code {end-of-line (C-e)}}{144} +\entry{\code {exchange-point-and-mark (C-x C-x)}}{152} +\entry{\code {execute-named-command (M-x)}}{154} \initial {F} -\entry{\code {fetch-history ()}}{142} -\entry{\code {forward-backward-delete-char ()}}{142} -\entry{\code {forward-char (C-f)}}{139} -\entry{\code {forward-search-history (C-s)}}{140} -\entry{\code {forward-word (M-f)}}{139} +\entry{\code {fetch-history ()}}{147} +\entry{\code {forward-backward-delete-char ()}}{147} +\entry{\code {forward-char (C-f)}}{144} +\entry{\code {forward-search-history (C-s)}}{145} +\entry{\code {forward-word (M-f)}}{144} \initial {G} -\entry{\code {glob-complete-word (M-g)}}{148} -\entry{\code {glob-expand-word (C-x *)}}{149} -\entry{\code {glob-list-expansions (C-x g)}}{149} +\entry{\code {glob-complete-word (M-g)}}{153} +\entry{\code {glob-expand-word (C-x *)}}{154} +\entry{\code {glob-list-expansions (C-x g)}}{154} \initial {H} -\entry{\code {history-and-alias-expand-line ()}}{149} -\entry{\code {history-expand-line (M-^)}}{149} -\entry{\code {history-search-backward ()}}{141} -\entry{\code {history-search-forward ()}}{141} -\entry{\code {history-substring-search-backward ()}}{141} -\entry{\code {history-substring-search-forward ()}}{141} +\entry{\code {history-and-alias-expand-line ()}}{154} +\entry{\code {history-expand-line (M-^)}}{154} +\entry{\code {history-search-backward ()}}{146} +\entry{\code {history-search-forward ()}}{146} +\entry{\code {history-substring-search-backward ()}}{146} +\entry{\code {history-substring-search-forward ()}}{146} \initial {I} -\entry{\code {insert-comment (M-#)}}{148} -\entry{\code {insert-completions (M-*)}}{145} -\entry{\code {insert-last-argument (M-. or M-_)}}{149} +\entry{\code {insert-comment (M-#)}}{153} +\entry{\code {insert-completions (M-*)}}{150} +\entry{\code {insert-last-argument (M-. or M-_)}}{154} \initial {K} -\entry{\code {kill-line (C-k)}}{143} -\entry{\code {kill-region ()}}{144} -\entry{\code {kill-whole-line ()}}{144} -\entry{\code {kill-word (M-d)}}{144} +\entry{\code {kill-line (C-k)}}{148} +\entry{\code {kill-region ()}}{149} +\entry{\code {kill-whole-line ()}}{149} +\entry{\code {kill-word (M-d)}}{149} \initial {M} -\entry{\code {magic-space ()}}{149} -\entry{\code {menu-complete ()}}{145} -\entry{\code {menu-complete-backward ()}}{145} +\entry{\code {magic-space ()}}{154} +\entry{\code {menu-complete ()}}{150} +\entry{\code {menu-complete-backward ()}}{150} \initial {N} -\entry{\code {next-history (C-n)}}{140} -\entry{\code {next-screen-line ()}}{140} -\entry{\code {non-incremental-forward-search-history (M-n)}}{141} -\entry{\code {non-incremental-reverse-search-history (M-p)}}{140} +\entry{\code {next-history (C-n)}}{145} +\entry{\code {next-screen-line ()}}{145} +\entry{\code {non-incremental-forward-search-history (M-n)}}{146} +\entry{\code {non-incremental-reverse-search-history (M-p)}}{145} \initial {O} -\entry{\code {operate-and-get-next (C-o)}}{142} -\entry{\code {overwrite-mode ()}}{143} +\entry{\code {operate-and-get-next (C-o)}}{147} +\entry{\code {overwrite-mode ()}}{148} \initial {P} -\entry{\code {possible-command-completions (C-x !)}}{146} -\entry{\code {possible-completions (M-?)}}{145} -\entry{\code {possible-filename-completions (C-x /)}}{146} -\entry{\code {possible-hostname-completions (C-x @)}}{146} -\entry{\code {possible-username-completions (C-x ~)}}{146} -\entry{\code {possible-variable-completions (C-x $)}}{146} -\entry{\code {prefix-meta (\key {ESC})}}{147} -\entry{\code {previous-history (C-p)}}{140} -\entry{\code {previous-screen-line ()}}{139} -\entry{\code {print-last-kbd-macro ()}}{147} +\entry{\code {possible-command-completions (C-x !)}}{151} +\entry{\code {possible-completions (M-?)}}{150} +\entry{\code {possible-filename-completions (C-x /)}}{151} +\entry{\code {possible-hostname-completions (C-x @)}}{151} +\entry{\code {possible-username-completions (C-x ~)}}{151} +\entry{\code {possible-variable-completions (C-x $)}}{151} +\entry{\code {prefix-meta (\key {ESC})}}{152} +\entry{\code {previous-history (C-p)}}{145} +\entry{\code {previous-screen-line ()}}{144} +\entry{\code {print-last-kbd-macro ()}}{152} \initial {Q} -\entry{\code {quoted-insert (C-q or C-v)}}{142} +\entry{\code {quoted-insert (C-q or C-v)}}{147} \initial {R} -\entry{\code {re-read-init-file (C-x C-r)}}{147} -\entry{\code {redraw-current-line ()}}{140} -\entry{\code {reverse-search-history (C-r)}}{140} -\entry{\code {revert-line (M-r)}}{147} +\entry{\code {re-read-init-file (C-x C-r)}}{152} +\entry{\code {redraw-current-line ()}}{145} +\entry{\code {reverse-search-history (C-r)}}{145} +\entry{\code {revert-line (M-r)}}{152} \initial {S} -\entry{\code {self-insert (a, b, A, 1, !, \dots {})}}{142} -\entry{\code {set-mark (C-@)}}{147} -\entry{\code {shell-backward-kill-word ()}}{144} -\entry{\code {shell-backward-word (M-C-b)}}{139} -\entry{\code {shell-expand-line (M-C-e)}}{149} -\entry{\code {shell-forward-word (M-C-f)}}{139} -\entry{\code {shell-kill-word (M-C-d)}}{144} -\entry{\code {shell-transpose-words (M-C-t)}}{143} -\entry{\code {skip-csi-sequence ()}}{148} -\entry{\code {spell-correct-word (C-x s)}}{148} -\entry{\code {start-kbd-macro (C-x ()}}{147} +\entry{\code {self-insert (a, b, A, 1, !, \dots {})}}{147} +\entry{\code {set-mark (C-@)}}{152} +\entry{\code {shell-backward-kill-word ()}}{149} +\entry{\code {shell-backward-word (M-C-b)}}{144} +\entry{\code {shell-expand-line (M-C-e)}}{154} +\entry{\code {shell-forward-word (M-C-f)}}{144} +\entry{\code {shell-kill-word (M-C-d)}}{149} +\entry{\code {shell-transpose-words (M-C-t)}}{148} +\entry{\code {skip-csi-sequence ()}}{153} +\entry{\code {spell-correct-word (C-x s)}}{153} +\entry{\code {start-kbd-macro (C-x ()}}{152} \initial {T} -\entry{\code {tilde-expand (M-&)}}{147} -\entry{\code {transpose-chars (C-t)}}{142} -\entry{\code {transpose-words (M-t)}}{143} +\entry{\code {tilde-expand (M-&)}}{152} +\entry{\code {transpose-chars (C-t)}}{147} +\entry{\code {transpose-words (M-t)}}{148} \initial {U} -\entry{\code {undo (C-_ or C-x C-u)}}{147} -\entry{\code {universal-argument ()}}{145} -\entry{\code {unix-filename-rubout ()}}{144} -\entry{\code {unix-line-discard (C-u)}}{143} -\entry{\code {unix-word-rubout (C-w)}}{144} -\entry{\code {upcase-word (M-u)}}{143} +\entry{\code {undo (C-_ or C-x C-u)}}{152} +\entry{\code {universal-argument ()}}{150} +\entry{\code {unix-filename-rubout ()}}{149} +\entry{\code {unix-line-discard (C-u)}}{148} +\entry{\code {unix-word-rubout (C-w)}}{149} +\entry{\code {upcase-word (M-u)}}{148} \initial {Y} -\entry{\code {yank (C-y)}}{144} -\entry{\code {yank-last-arg (M-. or M-_)}}{141} -\entry{\code {yank-nth-arg (M-C-y)}}{141} -\entry{\code {yank-pop (M-y)}}{144} +\entry{\code {yank (C-y)}}{149} +\entry{\code {yank-last-arg (M-. or M-_)}}{146} +\entry{\code {yank-nth-arg (M-C-y)}}{146} +\entry{\code {yank-pop (M-y)}}{149} diff --git a/doc/bashref.info b/doc/bashref.info index 61c908d1..2b0040a1 100644 --- a/doc/bashref.info +++ b/doc/bashref.info @@ -2,12 +2,12 @@ This is bashref.info, produced by makeinfo version 7.1 from bashref.texi. This text is a brief description of the features that are present in the -Bash shell (version 5.3, 5 September 2024). +Bash shell (version 5.3, 29 September 2024). - This is Edition 5.3, last updated 5 September 2024, of ‘The GNU Bash + This is Edition 5.3, last updated 29 September 2024, of ‘The GNU Bash Reference Manual’, for ‘Bash’, Version 5.3. - Copyright © 1988-2023 Free Software Foundation, Inc. + Copyright © 1988-2024 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, @@ -27,10 +27,10 @@ Bash Features ************* This text is a brief description of the features that are present in the -Bash shell (version 5.3, 5 September 2024). The Bash home page is +Bash shell (version 5.3, 29 September 2024). The Bash home page is . - This is Edition 5.3, last updated 5 September 2024, of ‘The GNU Bash + This is Edition 5.3, last updated 29 September 2024, of ‘The GNU Bash Reference Manual’, for ‘Bash’, Version 5.3. Bash contains features that appear in other popular shells, and some @@ -100,7 +100,7 @@ use. version of ‘csh’, Bash is the default shell. Like other GNU software, Bash is quite portable. It currently runs on nearly every version of Unix and a few other operating systems − independently-supported ports -exist for MS-DOS, OS/2, and Windows platforms. +exist for Windows and other platforms.  File: bashref.info, Node: What is a shell?, Prev: What is Bash?, Up: Introduction @@ -123,7 +123,8 @@ automate their common tasks. Shells may be used interactively or non-interactively. In interactive mode, they accept input typed from the keyboard. When -executing non-interactively, shells execute commands read from a file. +executing non-interactively, shells execute commands read from a file or +a string. A shell allows execution of GNU commands, both synchronously and asynchronously. The shell waits for synchronous commands to complete @@ -358,13 +359,14 @@ as such, and to prevent parameter expansion. Each of the shell metacharacters (*note Definitions::) has special meaning to the shell and must be quoted if it is to represent itself. -When the command history expansion facilities are being used (*note + + When the command history expansion facilities are being used (*note History Interaction::), the “history expansion” character, usually ‘!’, must be quoted to prevent history expansion. *Note Bash History Facilities::, for more details concerning history expansion. - There are three quoting mechanisms: the “escape character”, single -quotes, and double quotes. + There are four quoting mechanisms: the “escape character”, single +quotes, double quotes, and dollar-single quotes.  File: bashref.info, Node: Escape Character, Next: Single Quotes, Up: Quoting @@ -373,10 +375,11 @@ File: bashref.info, Node: Escape Character, Next: Single Quotes, Up: Quoting ........................ A non-quoted backslash ‘\’ is the Bash escape character. It preserves -the literal value of the next character that follows, with the exception -of ‘newline’. If a ‘\newline’ pair appears, and the backslash itself is -not quoted, the ‘\newline’ is treated as a line continuation (that is, -it is removed from the input stream and effectively ignored). +the literal value of the next character that follows, removing any +special meaning it has, with the exception of ‘newline’. If a +‘\newline’ pair appears, and the backslash itself is not quoted, the +‘\newline’ is treated as a line continuation (that is, it is removed +from the input stream and effectively ignored).  File: bashref.info, Node: Single Quotes, Next: Double Quotes, Prev: Escape Character, Up: Quoting @@ -404,11 +407,12 @@ characters ‘$’ and ‘`’ retain their special meaning within double quotes only when followed by one of the following characters: ‘$’, ‘`’, ‘"’, ‘\’, or ‘newline’. Within double quotes, backslashes that are followed by one of these characters are removed. Backslashes preceding -characters without a special meaning are left unmodified. A double -quote may be quoted within double quotes by preceding it with a -backslash. If enabled, history expansion will be performed unless an -‘!’ appearing in double quotes is escaped using a backslash. The -backslash preceding the ‘!’ is not removed. +characters without a special meaning are left unmodified. + + A double quote may be quoted within double quotes by preceding it +with a backslash. If enabled, history expansion will be performed +unless an ‘!’ appearing in double quotes is escaped using a backslash. +The backslash preceding the ‘!’ is not removed. The special parameters ‘*’ and ‘@’ have special meaning when in double quotes (*note Shell Parameter Expansion::). @@ -486,7 +490,8 @@ translation, using the ‘LC_MESSAGES’, ‘TEXTDOMAINDIR’, and ‘TEXTDOMAIN shell variables, as explained below. See the gettext documentation for additional details not covered here. If the current locale is ‘C’ or ‘POSIX’, if there are no translations available, or if the string is not -translated, the dollar sign is ignored. Since this is a form of double +translated, the dollar sign is ignored, and the string is treated as +double-quoted as described above. Since this is a form of double quoting, the string remains double-quoted by default, whether or not it is translated and replaced. If the ‘noexpand_translation’ option is enabled using the ‘shopt’ builtin (*note The Shopt Builtin::), @@ -591,12 +596,14 @@ File: bashref.info, Node: Comments, Prev: Quoting, Up: Shell Syntax In a non-interactive shell, or an interactive shell in which the ‘interactive_comments’ option to the ‘shopt’ builtin is enabled (*note -The Shopt Builtin::), a word beginning with ‘#’ causes that word and all -remaining characters on that line to be ignored. An interactive shell -without the ‘interactive_comments’ option enabled does not allow -comments. The ‘interactive_comments’ option is on by default in -interactive shells. *Note Interactive Shells::, for a description of -what makes a shell interactive. +The Shopt Builtin::), a word beginning with ‘#’ introduces a comment. A +word begins at the beginning of a line, after unquoted whitespace, or +after an operator. The comment causes that word and all remaining +characters on that line to be ignored. An interactive shell without the +‘interactive_comments’ option enabled does not allow comments. The +‘interactive_comments’ option is enabled by default in interactive +shells. *Note Interactive Shells::, for a description of what makes a +shell interactive.  File: bashref.info, Node: Shell Commands, Next: Shell Functions, Prev: Shell Syntax, Up: Basic Shell Features @@ -650,9 +657,9 @@ File: bashref.info, Node: Simple Commands, Next: Pipelines, Prev: Reserved Wo 3.2.2 Simple Commands --------------------- -A simple command is the kind of command encountered most often. It's -just a sequence of words separated by ‘blank’s, terminated by one of the -shell's control operators (*note Definitions::). The first word +A simple command is the kind of command that's executed most often. +It's just a sequence of words separated by ‘blank’s, terminated by one +of the shell's control operators (*note Definitions::). The first word generally specifies a command to be executed, with the rest of the words being that command's arguments. @@ -677,11 +684,12 @@ the input of the next command. That is, each command reads the previous command's output. This connection is performed before any redirections specified by COMMAND1. - If ‘|&’ is used, COMMAND1's standard error, in addition to its -standard output, is connected to COMMAND2's standard input through the -pipe; it is shorthand for ‘2>&1 |’. This implicit redirection of the -standard error to the standard output is performed after any -redirections specified by COMMAND1. + If ‘|&’ is the pipeline operator, COMMAND1's standard error, in +addition to its standard output, is connected to COMMAND2's standard +input through the pipe; it is shorthand for ‘2>&1 |’. This implicit +redirection of the standard error to the standard output is performed +after any redirections specified by COMMAND1, consistent with that +shorthand. The reserved word ‘time’ causes timing statistics to be printed for the pipeline once it finishes. The statistics currently consist of @@ -689,7 +697,7 @@ elapsed (wall-clock) time and user and system time consumed by the command's execution. The ‘-p’ option changes the output format to that specified by POSIX. When the shell is in POSIX mode (*note Bash POSIX Mode::), it does not recognize ‘time’ as a reserved word if the next -token begins with a ‘-’. The ‘TIMEFORMAT’ variable may be set to a +token begins with a ‘-’. The value of the ‘TIMEFORMAT’ variable is a format string that specifies how the timing information should be displayed. *Note Bash Variables::, for a description of the available formats. The use of ‘time’ as a reserved word permits the timing of @@ -701,15 +709,15 @@ be followed by a newline. In this case, the shell displays the total user and system time consumed by the shell and its children. The ‘TIMEFORMAT’ variable specifies the format of the time information. - If the pipeline is not executed asynchronously (*note Lists::), the + If a pipeline is not executed asynchronously (*note Lists::), the shell waits for all commands in the pipeline to complete. Each command in a multi-command pipeline, where pipes are created, is executed in its own “subshell”, which is a separate process (*note Command Execution Environment::). If the ‘lastpipe’ option is enabled -using the ‘shopt’ builtin (*note The Shopt Builtin::), the last element -of a pipeline may be run by the shell process when job control is not -active. +using the ‘shopt’ builtin (*note The Shopt Builtin::), and job control +is not active, the last element of a pipeline may be run by the shell +process. The exit status of a pipeline is the exit status of the last command in the pipeline, unless the ‘pipefail’ option is enabled (*note The Set @@ -717,8 +725,10 @@ Builtin::). If ‘pipefail’ is enabled, the pipeline's return status is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands exit successfully. If the reserved word ‘!’ precedes the pipeline, the exit status is the logical negation of -the exit status as described above. The shell waits for all commands in -the pipeline to terminate before returning a value. +the exit status as described above. If a pipeline is not executed +asynchronously (*note Lists::), the shell waits for all commands in the +pipeline to terminate before returning a value. The return status of an +asynchronous pipeline is 0.  File: bashref.info, Node: Lists, Next: Compound Commands, Prev: Pipelines, Up: Shell Commands @@ -830,9 +840,9 @@ syntax, it may be replaced with one or more newlines. for NAME [ [in [WORDS ...] ] ; ] do COMMANDS; done - Expand WORDS (*note Shell Expansions::), and execute COMMANDS once - for each member in the resultant list, with NAME bound to the - current member. If ‘in WORDS’ is not present, the ‘for’ command + Expand WORDS (*note Shell Expansions::), and then execute COMMANDS + once for each word in the resultant list, with NAME bound to the + current word. If ‘in WORDS’ is not present, the ‘for’ command executes the COMMANDS once for each positional parameter that is set, as if ‘in "$@"’ had been specified (*note Special Parameters::). @@ -845,18 +855,17 @@ syntax, it may be replaced with one or more newlines. for (( EXPR1 ; EXPR2 ; EXPR3 )) ; do COMMANDS ; done - First, the arithmetic expression EXPR1 is evaluated according to - the rules described below (*note Shell Arithmetic::). The - arithmetic expression EXPR2 is then evaluated repeatedly until it - evaluates to zero. Each time EXPR2 evaluates to a non-zero value, - COMMANDS are executed and the arithmetic expression EXPR3 is - evaluated. If any expression is omitted, it behaves as if it - evaluates to 1. The return value is the exit status of the last - command in COMMANDS that is executed, or false if any of the - expressions is invalid. + First, evaluate the arithmetic expression EXPR1 according to the + rules described below (*note Shell Arithmetic::). Then, repeatedly + evaluate the arithmetic expression EXPR2 until it evaluates to + zero. Each time EXPR2 evaluates to a non-zero value, execute + COMMANDS and evaluate the arithmetic expression EXPR3. If any + expression is omitted, it behaves as if it evaluates to 1. The + return value is the exit status of the last command in COMMANDS + that is executed, or non-zero if any of the expressions is invalid. - The ‘break’ and ‘continue’ builtins (*note Bourne Shell Builtins::) -may be used to control loop execution. + Use the ‘break’ and ‘continue’ builtins (*note Bourne Shell +Builtins::) to control loop execution.  File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Prev: Looping Constructs, Up: Compound Commands @@ -893,14 +902,15 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre esac ‘case’ will selectively execute the COMMAND-LIST corresponding to - the first PATTERN that matches WORD. The match is performed - according to the rules described below in *note Pattern Matching::. - If the ‘nocasematch’ shell option (see the description of ‘shopt’ - in *note The Shopt Builtin::) is enabled, the match is performed - without regard to the case of alphabetic characters. The ‘|’ is - used to separate multiple patterns, and the ‘)’ operator terminates - a pattern list. A list of patterns and an associated command-list - is known as a CLAUSE. + the first PATTERN that matches WORD, proceeding from the first + pattern to the last. The match is performed according to the rules + described below in *note Pattern Matching::. If the ‘nocasematch’ + shell option (see the description of ‘shopt’ in *note The Shopt + Builtin::) is enabled, the match is performed without regard to the + case of alphabetic characters. The ‘|’ is used to separate + multiple patterns in a pattern list, and the ‘)’ operator + terminates the pattern list. A pattern list and an associated + COMMAND-LIST is known as a CLAUSE. Each clause must be terminated with ‘;;’, ‘;&’, or ‘;;&’. The WORD undergoes tilde expansion, parameter expansion, command @@ -929,16 +939,16 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre esac echo " legs." - If the ‘;;’ operator is used, no subsequent matches are attempted - after the first pattern match. Using ‘;&’ in place of ‘;;’ causes + If the ‘;;’ operator is used, the ‘case’ command completes after + the first pattern match. Using ‘;&’ in place of ‘;;’ causes execution to continue with the COMMAND-LIST associated with the next clause, if any. Using ‘;;&’ in place of ‘;;’ causes the shell to test the patterns in the next clause, if any, and execute any - associated COMMAND-LIST on a successful match, continuing the case + associated COMMAND-LIST if the match succeeds, continuing the case statement execution as if the pattern list had not matched. - The return status is zero if no PATTERN is matched. Otherwise, the - return status is the exit status of the COMMAND-LIST executed. + The return status is zero if no PATTERN matches. Otherwise, the + return status is the exit status of the last COMMAND-LIST executed. ‘select’ @@ -947,15 +957,15 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre select NAME [in WORDS ...]; do COMMANDS; done - The list of words following ‘in’ is expanded, generating a list of - items, and the set of expanded words is printed on the standard - error output stream, each preceded by a number. If the ‘in WORDS’ - is omitted, the positional parameters are printed, as if ‘in "$@"’ - had been specified. ‘select’ then displays the ‘PS3’ prompt and - reads a line from the standard input. If the line consists of a - number corresponding to one of the displayed words, then the value - of NAME is set to that word. If the line is empty, the words and - prompt are displayed again. If ‘EOF’ is read, the ‘select’ command + First, expand the list of words following ‘in’, generating a list + of items, and print the set of expanded words on the standard error + stream, each preceded by a number. If the ‘in WORDS’ is omitted, + print the positional parameters, as if ‘in "$@"’ had been + specified. ‘select’ then displays the ‘PS3’ prompt and reads a + line from the standard input. If the line consists of a number + corresponding to one of the displayed words, then ‘select’ sets the + value of NAME to that word. If the line is empty, ‘select’ + displays the words and prompt again. If ‘EOF’ is read, ‘select’ completes and returns 1. Any other value read causes NAME to be set to null. The line read is saved in the variable ‘REPLY’. @@ -979,21 +989,21 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre described below (*note Shell Arithmetic::). The EXPRESSION undergoes the same expansions as if it were within double quotes, but double quote characters in EXPRESSION are not treated specially - are removed. If the value of the expression is non-zero, the + and are removed. If the value of the expression is non-zero, the return status is 0; otherwise the return status is 1. ‘[[...]]’ [[ EXPRESSION ]] - Return a status of 0 or 1 depending on the evaluation of the - conditional expression EXPRESSION. Expressions are composed of the - primaries described below in *note Bash Conditional Expressions::. - The words between the ‘[[’ and ‘]]’ do not undergo word splitting - and filename expansion. The shell performs tilde expansion, - parameter and variable expansion, arithmetic expansion, command - substitution, process substitution, and quote removal on those - words. Conditional operators such as ‘-f’ must be unquoted to be - recognized as primaries. + Evaluate the conditional expression EXPRESSION and return a status + of zero (true) or non-zero (false). Expressions are composed of + the primaries described below in *note Bash Conditional + Expressions::. The words between the ‘[[’ and ‘]]’ do not undergo + word splitting and filename expansion. The shell performs tilde + expansion, parameter and variable expansion, arithmetic expansion, + command substitution, process substitution, and quote removal on + those words. Conditional operators such as ‘-f’ must be unquoted + to be recognized as primaries. When used with ‘[[’, the ‘<’ and ‘>’ operators sort lexicographically using the current locale. @@ -1189,8 +1199,8 @@ list may be redirected to a single stream. { LIST; } Placing a list of commands between curly braces causes the list to - be executed in the current shell context. No subshell is created. - The semicolon (or newline) following LIST is required. + be executed in the current shell environment. No subshell is + created. The semicolon (or newline) following LIST is required. In addition to the creation of a subshell, there is a subtle difference between these two constructs due to historical reasons. The @@ -1226,7 +1236,7 @@ the default name is ‘COPROC’. coproc NAME { COMMAND; } -This form is recommended because simple commands result in the coprocess +This form is preferred because simple commands result in the coprocess always being named ‘COPROC’, and it is simpler to use and more complete than the other compound commands. @@ -1258,7 +1268,7 @@ subshells. The process ID of the shell spawned to execute the coprocess is available as the value of the variable ‘NAME_PID’. The ‘wait’ builtin -command may be used to wait for the coprocess to terminate. +may be used to wait for the coprocess to terminate. Since the coprocess is created as an asynchronous command, the ‘coproc’ command always returns success. The return status of a @@ -1294,10 +1304,10 @@ File: bashref.info, Node: Shell Functions, Next: Shell Parameters, Prev: Shel Shell functions are a way to group commands for later execution using a single name for the group. They are executed just like a "regular" -command. When the name of a shell function is used as a simple command -name, the list of commands associated with that function name is -executed. Shell functions are executed in the current shell context; no -new process is created to interpret them. +simple command. When the name of a shell function is used as a simple +command name, the shell executes the list of commands associated with +that function name. Shell functions are executed in the current shell +context; there is no new process created to interpret them. Functions are declared using this syntax: FNAME () COMPOUND-COMMAND [ REDIRECTIONS ] @@ -1312,15 +1322,15 @@ the parentheses are optional. The “body” of the function is the compound command COMPOUND-COMMAND (*note Compound Commands::). That command is usually a LIST enclosed between { and }, but may be any compound command listed above. If the ‘function’ reserved word is used, -but the parentheses are not supplied, the braces are recommended. -COMPOUND-COMMAND is executed whenever FNAME is specified as the name of -a simple command. When the shell is in POSIX mode (*note Bash POSIX -Mode::), FNAME must be a valid shell name and may not be the same as one -of the special builtins (*note Special Builtins::). In default mode, a -function name can be any unquoted shell word that does not contain ‘$’. -Any redirections (*note Redirections::) associated with the shell -function are performed when the function is executed. A function -definition may be deleted using the ‘-f’ option to the ‘unset’ builtin +but the parentheses are not supplied, the braces are recommended. When +the shell is in POSIX mode (*note Bash POSIX Mode::), FNAME must be a +valid shell name and may not be the same as one of the special builtins +(*note Special Builtins::). When not in POSIX mode, a function name can +be any unquoted shell word that does not contain ‘$’. + + Any redirections (*note Redirections::) associated with the shell +function are performed when the function is executed. Function +definitions are deleted using the ‘-f’ option to the ‘unset’ builtin (*note Bourne Shell Builtins::). The exit status of a function definition is zero unless a syntax @@ -1332,17 +1342,22 @@ last command executed in the body. braces that surround the body of the function must be separated from the body by ‘blank’s or newlines. This is because the braces are reserved words and are only recognized as such when they are separated from the -command list by whitespace or another shell metacharacter. Also, when -using the braces, the LIST must be terminated by a semicolon, a ‘&’, or -a newline. +command list by whitespace or another shell metacharacter. When using +the braces, the LIST must be terminated by a semicolon, a ‘&’, or a +newline. + + COMPOUND-COMMAND is executed whenever FNAME is specified as the name +of a simple command. Functions are executed in the context of the +calling shell; there is no new process created to interpret them +(contrast this with the execution of a shell script). When a function is executed, the arguments to the function become the positional parameters during its execution (*note Positional Parameters::). The special parameter ‘#’ that expands to the number of -positional parameters is updated to reflect the change. Special -parameter ‘0’ is unchanged. The first element of the ‘FUNCNAME’ -variable is set to the name of the function while the function is -executing. +positional parameters is updated to reflect the new set of positional +parameters. Special parameter ‘0’ is unchanged. The first element of +the ‘FUNCNAME’ variable is set to the name of the function while the +function is executing. All other aspects of the shell execution environment are identical between a function and its caller with these exceptions: the ‘DEBUG’ and @@ -1363,28 +1378,29 @@ function completes and execution resumes with the next command after the function call. Any command associated with the ‘RETURN’ trap is executed before execution resumes. When a function completes, the values of the positional parameters and the special parameter ‘#’ are -restored to the values they had prior to the function's execution. If a -numeric argument is given to ‘return’, that is the function's return +restored to the values they had prior to the function's execution. If +‘return’ is supplied a numeric argument, that is the function's return status; otherwise the function's return status is the exit status of the last command executed before the ‘return’. - Variables local to the function may be declared with the ‘local’ -builtin (“local variables”). Ordinarily, variables and their values are -shared between a function and its caller. These variables are visible -only to the function and the commands it invokes. This is particularly + Variables local to the function are declared with the ‘local’ builtin +(“local variables”). Ordinarily, variables and their values are shared +between a function and its caller. These variables are visible only to +the function and the commands it invokes. This is particularly important when a shell function calls other functions. In the following description, the “current scope” is a currently- executing function. Previous scopes consist of that function's caller and so on, back to the "global" scope, where the shell is not executing -any shell function. Consequently, a local variable at the current local -scope is a variable declared using the ‘local’ or ‘declare’ builtins in -the function that is currently executing. +any shell function. A local variable at the current local scope is a +variable declared using the ‘local’ or ‘declare’ builtins in the +function that is currently executing. Local variables "shadow" variables with the same name declared at previous scopes. For instance, a local variable declared in a function -hides a global variable of the same name: references and assignments -refer to the local variable, leaving the global variable unmodified. +hides variables with the same name declared at previous scopes, +including global variables: references and assignments refer to the +local variable, leaving the variables at previous scopes unmodified. When the function returns, the global variable is once again visible. The shell uses “dynamic scoping” to control a variable's visibility @@ -1429,20 +1445,22 @@ until the function returns. Once the function returns, any instance of the variable at a previous scope will become visible. If the unset acts on a variable at a previous scope, any instance of a variable with that name that had been shadowed will become visible (see below how -‘localvar_unset’shell option changes this behavior). +‘localvar_unset’ shell option changes this behavior). - Function names and definitions may be listed with the ‘-f’ option to -the ‘declare’ (‘typeset’) builtin command (*note Bash Builtins::). The -‘-F’ option to ‘declare’ or ‘typeset’ will list the function names only -(and optionally the source file and line number, if the ‘extdebug’ shell + The ‘-f’ option to the ‘declare’ (‘typeset’) builtin command (*note +Bash Builtins::) will list function names and definitions. The ‘-F’ +option to ‘declare’ or ‘typeset’ will list the function names only (and +optionally the source file and line number, if the ‘extdebug’ shell option is enabled). Functions may be exported so that child shell processes (those created when executing a separate shell invocation) automatically have them defined with the ‘-f’ option to the ‘export’ -builtin (*note Bourne Shell Builtins::). +builtin (*note Bourne Shell Builtins::). The ‘-f’ option to the ‘unset’ +builtin (*note Bourne Shell Builtins::) will delete a function +definition. Functions may be recursive. The ‘FUNCNEST’ variable may be used to limit the depth of the function call stack and restrict the number of -function invocations. By default, no limit is placed on the number of +function invocations. By default, Bash places no limit on the number of recursive calls.  @@ -1461,7 +1479,8 @@ number, or one of the special characters listed below. A “variable” is a parameter denoted by a ‘name’. A variable has a ‘value’ and zero or more ‘attributes’. Attributes are assigned using the ‘declare’ builtin command (see the description of the ‘declare’ builtin in *note Bash -Builtins::). +Builtins::). The ‘export’ and ‘readonly’ builtins assign specific +attributes. A parameter is set if it has been assigned a value. The null string is a valid value. Once a variable is set, it may be unset only by using @@ -1481,15 +1500,18 @@ statements may also appear as arguments to the ‘alias’, ‘declare’, (“declaration” commands). When in POSIX mode (*note Bash POSIX Mode::), these builtins may appear in a command after one or more instances of the ‘command’ builtin and retain these assignment statement properties. +For example, + command export var=value In the context where an assignment statement is assigning a value to -a shell variable or array index (*note Arrays::), the ‘+=’ operator can -be used to append to or add to the variable's previous value. This -includes arguments to builtin commands such as ‘declare’ that accept -assignment statements (declaration commands). When ‘+=’ is applied to a -variable for which the ‘integer’ attribute has been set, VALUE is -evaluated as an arithmetic expression and added to the variable's -current value, which is also evaluated. When ‘+=’ is applied to an +a shell variable or array index (*note Arrays::), the ‘+=’ operator will +append to or add to the variable's previous value. This includes +arguments to declaration commands such as ‘declare’ that accept +assignment statements. When ‘+=’ is applied to a variable for which the +‘integer’ attribute has been set, the variable's current value and VALUE +are each evaluated as arithmetic expressions, and the sum of the results +is assigned as the variable's value. The current value is usually an +integer constant, but may be an expression. When ‘+=’ is applied to an array variable using compound assignment (*note Arrays::), the variable's value is not unset (as it is when using ‘=’), and new values are appended to the array beginning at one greater than the array's @@ -1509,11 +1531,11 @@ shell functions to refer to a variable whose name is passed as an argument to the function. For instance, if a variable name is passed to a shell function as its first argument, running declare -n ref=$1 -inside the function creates a nameref variable ‘ref’ whose value is the -variable name passed as the first argument. References and assignments -to ‘ref’, and changes to its attributes, are treated as references, -assignments, and attribute modifications to the variable whose name was -passed as ‘$1’. +inside the function creates a local nameref variable ‘ref’ whose value +is the variable name passed as the first argument. References and +assignments to ‘ref’, and changes to its attributes, are treated as +references, assignments, and attribute modifications to the variable +whose name was passed as ‘$1’. If the control variable in a ‘for’ loop has the nameref attribute, the list of words can be a list of shell variables, and a name reference @@ -1542,7 +1564,9 @@ Shell Builtin Commands::). The positional parameters are temporarily replaced when a shell function is executed (*note Shell Functions::). When a positional parameter consisting of more than a single digit is -expanded, it must be enclosed in braces. +expanded, it must be enclosed in braces. Without braces, a digit +following ‘$’ can only refer to one of the first nine positional +parameters ($1\-$9) or the special parameter $0 (see below).  File: bashref.info, Node: Special Parameters, Prev: Positional Parameters, Up: Shell Parameters @@ -1551,37 +1575,39 @@ File: bashref.info, Node: Special Parameters, Prev: Positional Parameters, Up ------------------------ The shell treats several parameters specially. These parameters may -only be referenced; assignment to them is not allowed. +only be referenced; assignment to them is not allowed. Special +parameters are denoted by one of the following characters. ‘*’ ($*) Expands to the positional parameters, starting from one. When the expansion is not within double quotes, each positional - parameter expands to a separate word. In contexts where these + parameter expands to a separate word. In contexts where word expansions are performed, those words are subject to further word splitting and filename expansion. When the expansion occurs within double quotes, it expands to a single word with the value of each - parameter separated by the first character of the ‘IFS’ special - variable. That is, ‘"$*"’ is equivalent to ‘"$1C$2C..."’, where C - is the first character of the value of the ‘IFS’ variable. If - ‘IFS’ is unset, the parameters are separated by spaces. If ‘IFS’ - is null, the parameters are joined without intervening separators. + parameter separated by the first character of the ‘IFS’ variable. + That is, ‘"$*"’ is equivalent to ‘"$1C$2C..."’, where C is the + first character of the value of the ‘IFS’ variable. If ‘IFS’ is + unset, the parameters are separated by spaces. If ‘IFS’ is null, + the parameters are joined without intervening separators. ‘@’ ($@) Expands to the positional parameters, starting from one. In contexts where word splitting is performed, this expands each positional parameter to a separate word; if not within double quotes, these words are subject to word splitting. In contexts - where word splitting is not performed, this expands to a single - word with each positional parameter separated by a space. When the - expansion occurs within double quotes, and word splitting is - performed, each parameter expands to a separate word. That is, - ‘"$@"’ is equivalent to ‘"$1" "$2" ...’. If the double-quoted - expansion occurs within a word, the expansion of the first - parameter is joined with the beginning part of the original word, - and the expansion of the last parameter is joined with the last - part of the original word. When there are no positional - parameters, ‘"$@"’ and ‘$@’ expand to nothing (i.e., they are - removed). + where word splitting is not performed, such as the value portion of + an assignment statement, this expands to a single word with each + positional parameter separated by a space. When the expansion + occurs within double quotes, and word splitting is performed, each + parameter expands to a separate word. That is, ‘"$@"’ is + equivalent to ‘"$1" "$2" ...’. If the double-quoted expansion + occurs within a word, the expansion of the first parameter is + joined with the expansion of the beginning part of the original + word, and the expansion of the last parameter is joined with the + expansion of the last part of the original word. When there are no + positional parameters, ‘"$@"’ and ‘$@’ expand to nothing (i.e., + they are removed). ‘#’ ($#) Expands to the number of positional parameters in decimal. @@ -1673,15 +1699,15 @@ File: bashref.info, Node: Brace Expansion, Next: Tilde Expansion, Up: Shell E 3.5.1 Brace Expansion --------------------- -Brace expansion is a mechanism by which arbitrary strings may be -generated. This mechanism is similar to “filename expansion” (*note -Filename Expansion::), but the filenames generated need not exist. -Patterns to be brace expanded take the form of an optional PREAMBLE, -followed by either a series of comma-separated strings or a sequence -expression between a pair of braces, followed by an optional POSTSCRIPT. -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 expansion is a mechanism to generate arbitrary strings sharing a +common prefix and suffix, either of which can be empty. This mechanism +is similar to “filename expansion” (*note Filename Expansion::), but the +filenames generated need not exist. Patterns to be brace expanded are +formed from an optional PREAMBLE, followed by either a series of +comma-separated strings or a sequence expression between a pair of +braces, followed by an optional POSTSCRIPT. The preamble is prefixed to +each string contained within the braces, and the postscript is then +appended to each resulting string, expanding left to right. Brace expansions may be nested. The results of each expanded string are not sorted; left to right order is preserved. For example, @@ -1732,14 +1758,14 @@ is no unquoted slash) are considered a “tilde-prefix”. 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 “login name”. If this login name is the null string, the tilde is replaced with the -value of the ‘HOME’ shell variable. If ‘HOME’ is unset, the home -directory of the user executing the shell is substituted instead. +value of the ‘HOME’ shell variable. If ‘HOME’ is unset, the tilde +expands to the home directory of the user executing the shell instead. Otherwise, the tilde-prefix is replaced with the home directory associated with the specified login name. If the tilde-prefix is ‘~+’, the value of the shell variable ‘PWD’ -replaces the tilde-prefix. If the tilde-prefix is ‘~-’, the value of -the shell variable ‘OLDPWD’, if it is set, is substituted. +replaces the tilde-prefix. If the tilde-prefix is ‘~-’, the shell +substitutes the value of the shell variable ‘OLDPWD’, 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 @@ -1749,24 +1775,28 @@ following tilde in the tilde-prefix as an argument (*note The Directory Stack::). If the tilde-prefix, sans the tilde, consists of a number without a leading ‘+’ or ‘-’, ‘+’ is assumed. - If the login name is invalid, or the tilde expansion fails, the word -is left unchanged. + The results of tilde expansion are treated as if they were quoted, so +the replacement is not subject to word splitting and filename expansion. + + If the login name is invalid, or the tilde expansion fails, the +tilde-prefix is left unchanged. - Each variable assignment is checked for unquoted tilde-prefixes -immediately following a ‘:’ or the first ‘=’. In these cases, tilde -expansion is also performed. Consequently, one may use filenames with + Bash checks each variable assignment for unquoted tilde-prefixes +immediately following a ‘:’ or the first ‘=’, and performs tilde +expansion in these cases. Consequently, one may use filenames with tildes in assignments to ‘PATH’, ‘MAILPATH’, and ‘CDPATH’, and the shell assigns the expanded value. The following table shows how Bash treats unquoted tilde-prefixes: ‘~’ - The value of ‘$HOME’ + The value of ‘$HOME’. ‘~/foo’ ‘$HOME/foo’ ‘~fred/foo’ - The subdirectory ‘foo’ of the home directory of the user ‘fred’ + The directory or file ‘foo’ in the home directory of the user + ‘fred’. ‘~+/foo’ ‘$PWD/foo’ @@ -1775,13 +1805,13 @@ assigns the expanded value. ‘${OLDPWD-'~-'}/foo’ ‘~N’ - The string that would be displayed by ‘dirs +N’ + The string that would be displayed by ‘dirs +N’. ‘~+N’ - The string that would be displayed by ‘dirs +N’ + The string that would be displayed by ‘dirs +N’. ‘~-N’ - The string that would be displayed by ‘dirs -N’ + The string that would be displayed by ‘dirs -N’. Bash also performs tilde expansion on words satisfying the conditions of variable assignments (*note Shell Parameters::) when they appear as @@ -1798,32 +1828,36 @@ 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 -could be interpreted as part of the name. +could be interpreted as part of the name. For example, if the first +positional parameter has the value ‘a’, then ‘${11}’ expands to the +value of the eleventh positional parameter, while ‘$11’ expands to ‘a1’. 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 embedded arithmetic expansion, command substitution, or parameter expansion. - The basic form of parameter expansion is ${PARAMETER}. The value of -PARAMETER is substituted. The PARAMETER is a shell parameter as -described above (*note Shell Parameters::) or an array reference (*note -Arrays::). The braces are required when PARAMETER is a positional -parameter with more than one digit, or when PARAMETER is followed by a -character that is not to be interpreted as part of its name. + The basic form of parameter expansion is ${PARAMETER}, which +substitutes the value of PARAMETER. The PARAMETER is a shell parameter +as described above (*note Shell Parameters::) or an array reference +(*note Arrays::). The braces are required when PARAMETER is a +positional parameter with more than one digit, or when PARAMETER is +followed by a character that is not to be interpreted as part of its +name. If the first character of PARAMETER is an exclamation point (!), and PARAMETER is not a nameref, it introduces a level of indirection. Bash uses the value formed by expanding the rest of PARAMETER as the new -PARAMETER; this is then expanded and that value is used in the rest of -the expansion, rather than the expansion of the original PARAMETER. -This is known as ‘indirect expansion’. The value is subject to tilde -expansion, parameter expansion, command substitution, and arithmetic -expansion. If PARAMETER is a nameref, this expands to the name of the -variable referenced by PARAMETER instead of performing the complete -indirect expansion. The exceptions to this are the expansions of -${!PREFIX*} and ${!NAME[@]} described below. The exclamation point must -immediately follow the left brace in order to introduce indirection. +PARAMETER; this new parameter is then expanded and that value is used in +the rest of the expansion, rather than the expansion of the original +PARAMETER. This is known as ‘indirect expansion’. The value is subject +to tilde expansion, parameter expansion, command substitution, and +arithmetic expansion. If PARAMETER is a nameref, this expands to the +name of the variable referenced by PARAMETER instead of performing the +complete indirect expansion, for compatibility. The exceptions to this +are the expansions of ${!PREFIX*} and ${!NAME[@]} described below. The +exclamation point must immediately follow the left brace in order to +introduce indirection. In each of the cases below, WORD is subject to tilde expansion, parameter expansion, command substitution, and arithmetic expansion. @@ -1848,15 +1882,21 @@ omitted, the operator tests only for existence. $ echo ${v-unset} unset $ v= + $ echo ${v-unset} + $ echo ${v:-unset-or-null} unset-or-null ‘${PARAMETER:=WORD}’ If PARAMETER is unset or null, the expansion of WORD is assigned to - PARAMETER. The value of PARAMETER is then substituted. Positional - parameters and special parameters may not be assigned to in this - way. + PARAMETER, and the result of the expansion is the final value of + PARAMETER. Positional parameters and special parameters may not be + assigned in this way. + $ unset var + $ : ${var=DEFAULT} + $ echo $var + DEFAULT $ var= $ : ${var:=DEFAULT} $ echo $var @@ -1865,8 +1905,10 @@ omitted, the operator tests only for existence. ‘${PARAMETER:?WORD}’ If PARAMETER is null or unset, the expansion of WORD (or a message to that effect if WORD is not present) is written to the standard - error and the shell, if it is not interactive, exits. Otherwise, - the value of PARAMETER is substituted. + error and the shell, if it is 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 PARAMETER is substituted. $ var= $ : ${var:?var is unset or null} @@ -1874,11 +1916,16 @@ omitted, the operator tests only for existence. ‘${PARAMETER:+WORD}’ If PARAMETER is null or unset, nothing is substituted, otherwise - the expansion of WORD is substituted. + the expansion of WORD is substituted. The value of PARAMETER is + not used. $ var=123 $ echo ${var:+var is set and not null} var is set and not null + $ var= + $ echo ${var:+var is set and not null} + + $ ‘${PARAMETER:OFFSET}’ ‘${PARAMETER:OFFSET:LENGTH}’ @@ -1897,9 +1944,10 @@ omitted, the operator tests only for existence. If LENGTH evaluates to a number less than zero, it is interpreted as an offset in characters from the end of the value of PARAMETER rather than a number of characters, and the expansion is the - characters between OFFSET 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. + characters between OFFSET 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. Here are some examples illustrating substring expansion on parameters and subscripted arrays: @@ -2032,55 +2080,57 @@ omitted, the operator tests only for existence. appears within double quotes, each key expands to a separate word. ‘${#PARAMETER}’ - The length in characters of the expanded value of PARAMETER is - substituted. If PARAMETER is ‘*’ or ‘@’, the value substituted is - the number of positional parameters. If PARAMETER is an array name - subscripted by ‘*’ or ‘@’, the value substituted is the number of - elements in the array. If PARAMETER is an indexed array name - subscripted by a negative number, that number is interpreted as - relative to one greater than the maximum index of PARAMETER, so - negative indices count back from the end of the array, and an index - of -1 references the last element. + Substitutes the length in characters of the value of PARAMETER. If + PARAMETER is ‘*’ or ‘@’, the value substituted is the number of + positional parameters. If PARAMETER is an array name subscripted + by ‘*’ or ‘@’, the value substituted is the number of elements in + the array. If PARAMETER is an indexed array name subscripted by a + negative number, that number is interpreted as relative to one + greater than the maximum index of PARAMETER, so negative indices + count back from the end of the array, and an index of -1 references + the last element. ‘${PARAMETER#WORD}’ ‘${PARAMETER##WORD}’ - The WORD is expanded to produce a pattern and matched according to - the rules described below (*note Pattern Matching::). If the - pattern matches the beginning of the expanded value of PARAMETER, - then the result of the expansion is the expanded value of PARAMETER - with the shortest matching pattern (the ‘#’ case) or the longest - matching pattern (the ‘##’ case) deleted. If PARAMETER is ‘@’ or - ‘*’, the pattern removal operation is applied to each positional - parameter in turn, and the expansion is the resultant list. If - PARAMETER 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. + The WORD is expanded to produce a pattern and matched against the + expanded value of PARAMETER according to the rules described below + (*note Pattern Matching::). If the pattern matches the beginning + of the expanded value of PARAMETER, then the result of the + expansion is the expanded value of PARAMETER with the shortest + matching pattern (the ‘#’ case) or the longest matching pattern + (the ‘##’ case) deleted. If PARAMETER is ‘@’ or ‘*’, the pattern + removal operation is applied to each positional parameter in turn, + and the expansion is the resultant list. If PARAMETER 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. ‘${PARAMETER%WORD}’ ‘${PARAMETER%%WORD}’ - The WORD is expanded to produce a pattern and matched according to - the rules described below (*note Pattern Matching::). If the - pattern matches a trailing portion of the expanded value of - PARAMETER, then the result of the expansion is the value of - PARAMETER with the shortest matching pattern (the ‘%’ case) or the - longest matching pattern (the ‘%%’ case) deleted. If PARAMETER is - ‘@’ or ‘*’, the pattern removal operation is applied to each - positional parameter in turn, and the expansion is the resultant - list. If PARAMETER 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. + The WORD is expanded to produce a pattern and matched against the + expanded value of PARAMETER according to the rules described below + (*note Pattern Matching::). If the pattern matches a trailing + portion of the expanded value of PARAMETER, then the result of the + expansion is the value of PARAMETER with the shortest matching + pattern (the ‘%’ case) or the longest matching pattern (the ‘%%’ + case) deleted. If PARAMETER is ‘@’ or ‘*’, the pattern removal + operation is applied to each positional parameter in turn, and the + expansion is the resultant list. If PARAMETER 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. ‘${PARAMETER/PATTERN/STRING}’ ‘${PARAMETER//PATTERN/STRING}’ ‘${PARAMETER/#PATTERN/STRING}’ ‘${PARAMETER/%PATTERN/STRING}’ The PATTERN is expanded to produce a pattern just as in filename - expansion. PARAMETER is expanded and the longest match of PATTERN - against its value is replaced with STRING. STRING undergoes tilde - expansion, parameter and variable expansion, arithmetic expansion, - command and process substitution, and quote removal. The match is - performed according to the rules described below (*note Pattern - Matching::). + 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. In the first form above, only the first match is replaced. If there are two slashes separating PARAMETER and PATTERN (the second @@ -2088,15 +2138,15 @@ omitted, the operator tests only for existence. PATTERN is preceded by ‘#’ (the third form above), it must match at the beginning of the expanded value of PARAMETER. If PATTERN is preceded by ‘%’ (the fourth form above), it must match at the end - of the expanded value of PARAMETER. If the expansion of STRING is - null, matches of PATTERN are deleted. If STRING is null, matches - of PATTERN are deleted and the ‘/’ following PATTERN may be - omitted. + of the expanded value of PARAMETER. + + If the expansion of STRING is null, matches of PATTERN are deleted + and the ‘/’ following PATTERN may be omitted. - If the ‘patsub_replacement’ shell option is enabled using ‘shopt’, - any unquoted instances of ‘&’ in STRING are replaced with the - matching portion of PATTERN. This is intended to duplicate a - common ‘sed’ idiom. + If the ‘patsub_replacement’ shell option is enabled using ‘shopt’ + (*note The Shopt Builtin::), any unquoted instances of ‘&’ in + STRING are replaced with the matching portion of PATTERN. This is + intended to duplicate a common ‘sed’ idiom. Quoting any part of STRING inhibits replacement in the expansion of the quoted portion, including replacement strings stored in shell @@ -2151,12 +2201,13 @@ omitted, the operator tests only for existence. If the ‘nocasematch’ shell option (see the description of ‘shopt’ in *note The Shopt Builtin::) is enabled, the match is performed - without regard to the case of alphabetic characters. If PARAMETER - is ‘@’ or ‘*’, the substitution operation is applied to each - positional parameter in turn, and the expansion is the resultant - list. If PARAMETER is an array variable subscripted with ‘@’ or - ‘*’, the substitution operation is applied to each member of the - array in turn, and the expansion is the resultant list. + without regard to the case of alphabetic characters. + + If PARAMETER is ‘@’ or ‘*’, the substitution operation is applied + to each positional parameter in turn, and the expansion is the + resultant list. If PARAMETER is an array variable subscripted with + ‘@’ or ‘*’, the substitution operation is applied to each member of + the array in turn, and the expansion is the resultant list. ‘${PARAMETER^PATTERN}’ ‘${PARAMETER^^PATTERN}’ @@ -2322,9 +2373,8 @@ File: bashref.info, Node: Arithmetic Expansion, Next: Process Substitution, P 3.5.5 Arithmetic Expansion -------------------------- -Arithmetic expansion allows the evaluation of an arithmetic expression -and the substitution of the result. The format for arithmetic expansion -is: +Arithmetic expansion evalutes an arithmetic expression and substitutes +the result. The format for arithmetic expansion is: $(( EXPRESSION )) @@ -2337,8 +2387,9 @@ evaluated. Arithmetic expansions may be nested. The evaluation is performed according to the rules listed below (*note Shell Arithmetic::). If the expression is invalid, Bash prints a -message indicating failure to the standard error and no substitution -occurs. +message indicating failure to the standard error, does not perform the +substitution, and does not execute the command associated with the +expansion.  File: bashref.info, Node: Process Substitution, Next: Word Splitting, Prev: Arithmetic Expansion, Up: Shell Expansions @@ -2353,14 +2404,16 @@ or >(LIST) The process LIST is run asynchronously, and its input or output appears as a filename. This filename is passed as an argument to the current -command as the result of the expansion. If the ‘>(LIST)’ form is used, -writing to the file will provide input for LIST. If the ‘<(LIST)’ form -is used, the file passed as an argument should be read to obtain the -output of LIST. Note that no space may appear between the ‘<’ or ‘>’ -and the left parenthesis, otherwise the construct would be interpreted -as a redirection. Process substitution is supported on systems that -support named pipes (FIFOs) or the ‘/dev/fd’ method of naming open -files. +command as the result of the expansion. + + If the ‘>(LIST)’ form is used, writing to the file will provide input +for LIST. If the ‘<(LIST)’ form is used, reading the file will obtain +the output of LIST. Note that no space may appear between the ‘<’ or +‘>’ and the left parenthesis, otherwise the construct would be +interpreted as a redirection. + + Process substitution is supported on systems that support named pipes +(FIFOs) or the ‘/dev/fd’ method of naming open files. When available, process substitution is performed simultaneously with parameter and variable expansion, command substitution, and arithmetic @@ -2383,14 +2436,14 @@ field terminators. If ‘IFS’ is unset, or its value is exactly ‘’, the default, then sequences of ‘space’, ‘tab’, and ‘newline’ at the beginning and end of the results of the previous expansions are ignored, -and any sequence of ‘IFS’ characters not at the beginning or end serves -to delimit words. If ‘IFS’ has a value other than the default, then -sequences of the whitespace characters ‘space’, ‘tab’, and ‘newline’ are -ignored at the beginning and end of the word, as long as the whitespace -character is in the value of ‘IFS’ (an ‘IFS’ whitespace character). Any -character in ‘IFS’ that is not ‘IFS’ whitespace, along with any adjacent -‘IFS’ whitespace characters, delimits a field. A sequence of ‘IFS’ -whitespace characters is also treated as a delimiter. +and any sequence of ‘IFS’ characters not at the beginning or end +delimits words. If ‘IFS’ has a value other than the default, then +sequences of the whitespace characters ‘space’, ‘tab’, and ‘newline’ +present the value of ‘IFS’ (an ‘IFS’ whitespace character) are ignored +at the beginning and end of the word. Any character in ‘IFS’ that is +not ‘IFS’ whitespace, along with any adjacent ‘IFS’ whitespace +characters, delimits a field. A sequence of ‘IFS’ whitespace characters +is also treated as a delimiter. If the value of ‘IFS’ is null, no word splitting occurs. If ‘IFS’ is unset, word splitting behaves as if it contained the default value @@ -2420,15 +2473,17 @@ File: bashref.info, Node: Filename Expansion, Next: Quote Removal, Prev: Word After word splitting, unless the ‘-f’ option has been set (*note The Set Builtin::), Bash scans each word for the characters ‘*’, ‘?’, and ‘[’. If one of these characters appears, and is not quoted, then the word is -regarded as a PATTERN, and replaced with an alphabetically sorted list -of filenames matching the pattern (*note Pattern Matching::). If no -matching filenames are found, and the shell option ‘nullglob’ is -disabled, the word is left unchanged. If the ‘nullglob’ option is set, -and no matches are found, the word is removed. If the ‘failglob’ shell -option is set, and no matches are found, an error message is printed and -the command is not executed. If the shell option ‘nocaseglob’ is -enabled, the match is performed without regard to the case of alphabetic -characters. +regarded as a PATTERN, and replaced with a sorted list of filenames +matching the pattern (*note Pattern Matching::), subject to the value of +the ‘GLOBSORT’ shell variable (*note Bash Variables::). + + If no matching filenames are found, and the shell option ‘nullglob’ +is disabled, the word is left unchanged. If the ‘nullglob’ option is +set, and no matches are found, the word is removed. If the ‘failglob’ +shell option is set, and no matches are found, Bash prints an error +message and does not execute the command. If the shell option +‘nocaseglob’ is enabled, the match is performed without regard to the +case of alphabetic characters. When a pattern is used for filename expansion, the character ‘.’ at the start of a filename or immediately following a slash must be matched @@ -2459,11 +2514,12 @@ non-null value has the effect of enabling the ‘dotglob’ shell option, so all other filenames beginning with a ‘.’ will match. To get the old behavior of ignoring filenames beginning with a ‘.’, make ‘.*’ one of the patterns in ‘GLOBIGNORE’. The ‘dotglob’ option is disabled when -‘GLOBIGNORE’ is unset. +‘GLOBIGNORE’ is unset. The ‘GLOBIGNORE’ pattern matching honors the +setting of the ‘extglob’ shell option. After the pattern is expanded and matched against filenames, the -value of the ‘GLOBSORT’ variable controls how the results are sorted, as -described below (*note Bash Variables::). +value of the ‘GLOBSORT’ shell variable controls how the results are +sorted, as described below (*note Bash Variables::).  File: bashref.info, Node: Pattern Matching, Up: Filename Expansion @@ -2491,12 +2547,13 @@ characters must be quoted if they are to be matched literally. Matches any one of the enclosed characters. A pair of characters separated by a hyphen denotes a RANGE EXPRESSION; any character that falls between those two characters, inclusive, using the - current locale's collating sequence and character set, is matched. - If the first character following the ‘[’ is a ‘!’ or a ‘^’ then any - character not enclosed is matched. A ‘−’ may be matched by - including it as the first or last character in the set. A ‘]’ may - be matched by including it as the first character in the set. The - sorting order of characters in range expressions, and the + current locale's collating sequence and character set, matches. If + the first character following the ‘[’ is a ‘!’ or a ‘^’ then any + character not within the range matches. To match a ‘−’, include it + as the first or last character in the set. To match a ‘]’, include + it as the first character in the set. + + The sorting order of characters in range expressions, and the characters included in the range, are determined by the current locale and the values of the ‘LC_COLLATE’ and ‘LC_ALL’ shell variables, if set. @@ -2562,7 +2619,9 @@ filenames includes all files beginning with ‘.’, but the filenames ‘.’ and ‘..’ must be matched by a pattern or sub-pattern that begins with a dot; when it is disabled, the set does not include any filenames beginning with "." unless the pattern or sub-pattern begins with a ‘.’. -As above, ‘.’ only has a special meaning when matching filenames. +If the ‘globskipdots’ shell option is enabled, the filenames ‘.’ and +‘..’ never appear in the set. As above, ‘.’ only has a special meaning +when matching filenames. Complicated extended pattern matching against long strings is slow, especially when the patterns contain alternations and the strings @@ -2590,21 +2649,22 @@ Before a command is executed, its input and output may be “redirected” using a special notation interpreted by the shell. “Redirection” allows commands' file handles to be duplicated, opened, closed, made to refer to different files, and can change the files the command reads from and -writes to. Redirection may also be used to modify file handles in the -current shell execution environment. The following redirection -operators may precede or appear anywhere within a simple command or may -follow a command. Redirections are processed in the order they appear, -from left to right. +writes to. When used with the ‘exec’ builtin, redirections modify file +handles in the current shell execution environment. The following +redirection operators may precede or appear anywhere within a simple +command or may follow a command. Redirections are processed in the +order they appear, from left to right. Each redirection that may be preceded by a file descriptor number may instead be preceded by a word of the form {VARNAME}. In this case, for each redirection operator except >&- and <&-, the shell will allocate a -file descriptor greater than 10 and assign it to {VARNAME}. If >&- or -<&- is preceded by {VARNAME}, the value of VARNAME defines the file +file descriptor greater than 10 and assign it to {VARNAME}. If +{VARNAME} precedes >&- or <&-, the value of VARNAME defines the file descriptor to close. If {VARNAME} is supplied, the redirection persists -beyond the scope of the command, allowing the shell programmer to manage -the file descriptor's lifetime manually. The ‘varredir_close’ shell -option manages this behavior (*note The Shopt Builtin::). +beyond the scope of the command, which allows the shell programmer to +manage the file descriptor's lifetime manually without using the ‘exec’ +builtin. The ‘varredir_close’ shell option manages this behavior (*note +The Shopt Builtin::). In the following descriptions, if the file descriptor number is omitted, and the first character of the redirection operator is ‘<’, the @@ -2612,14 +2672,13 @@ redirection refers to the standard input (file descriptor 0). If the first character of the redirection operator is ‘>’, the redirection refers to the standard output (file descriptor 1). - The word following the redirection operator in the following + The \fIword\fP following the redirection operator in the following descriptions, unless otherwise noted, is subjected to brace expansion, -tilde expansion, parameter expansion, command substitution, arithmetic -expansion, quote removal, filename expansion, and word splitting. If it -expands to more than one word, Bash reports an error. +tilde expansion, parameter and variable expansion, command substitution, +arithmetic expansion, quote removal, filename expansion, and word +splitting. If it expands to more than one word, Bash reports an error. - Note that the order of redirections is significant. For example, the -command + The order of redirections is significant. For example, the command ls > DIRLIST 2>&1 directs both standard output (file descriptor 1) and standard error (file descriptor 2) to the file DIRLIST, while the command @@ -2635,7 +2694,7 @@ use them; otherwise it will emulate them internally with the behavior described below. ‘/dev/fd/FD’ - If FD is a valid integer, file descriptor FD is duplicated. + If FD is a valid integer, duplicate file descriptor FD. ‘/dev/stdin’ File descriptor 0 is duplicated. @@ -2665,9 +2724,9 @@ internally. 3.6.1 Redirecting Input ----------------------- -Redirection of input causes the file whose name results from the -expansion of WORD to be opened for reading on file descriptor ‘n’, or -the standard input (file descriptor 0) if ‘n’ is not specified. +Redirecting input opens the file whose name results from the expansion +of WORD for reading on file descriptor ‘n’, or the standard input (file +descriptor 0) if ‘n’ is not specified. The general format for redirecting input is: [N][|]WORD @@ -2688,16 +2746,16 @@ size. ‘set’ builtin has been enabled, the redirection will fail if the file whose name results from the expansion of WORD exists and is a regular file. If the redirection operator is ‘>|’, or the redirection operator -is ‘>’ and the ‘noclobber’ option is not enabled, the redirection is -attempted even if the file named by WORD exists. +is ‘>’ and the ‘noclobber’ option is not enabled, Bash attemps the +redirection even if the file named by WORD exists. 3.6.3 Appending Redirected Output --------------------------------- -Redirection of output in this fashion causes the file whose name results -from the expansion of WORD to be opened for appending on file descriptor -N, or the standard output (file descriptor 1) if N is not specified. If -the file does not exist it is created. +Redirecting output in this fashion opens the file whose name results +from the expansion of WORD for appending on file descriptor N, or the +standard output (file descriptor 1) if N is not specified. If the file +does not exist it is created. The general format for appending output is: [N]>>WORD @@ -2705,9 +2763,9 @@ the file does not exist it is created. 3.6.4 Redirecting Standard Output and Standard Error ---------------------------------------------------- -This construct allows both the standard output (file descriptor 1) and -the standard error output (file descriptor 2) to be redirected to the -file whose name is the expansion of WORD. +This construct redirects both the standard output (file descriptor 1) +and the standard error output (file descriptor 2) to the file whose name +is the expansion of WORD. There are two formats for redirecting standard output and standard error: @@ -2724,9 +2782,9 @@ Descriptors below) for compatibility reasons. 3.6.5 Appending Standard Output and Standard Error -------------------------------------------------- -This construct allows both the standard output (file descriptor 1) and -the standard error output (file descriptor 2) to be appended to the file -whose name is the expansion of WORD. +This construct appends both the standard output (file descriptor 1) and +the standard error output (file descriptor 2) to the file whose name is +the expansion of WORD. The format for appending standard output and standard error is: &>>WORD @@ -2739,8 +2797,8 @@ This is semantically equivalent to This type of redirection instructs the shell to read input from the current source until it reads a line containing only DELIMITER (with no -trailing blanks). All of the lines read up to that point are then used -as the standard input (or file descriptor N if N is specified) for a +trailing blanks). All of the lines read up to that point then become +the standard input (or file descriptor N if N is specified) for a command. The format of here-documents is: @@ -2748,21 +2806,29 @@ command. HERE-DOCUMENT DELIMITER - No parameter and variable expansion, command substitution, arithmetic -expansion, or filename expansion is performed on WORD. + The shell does not perform parameter and variable expansion, command +substitution, arithmetic expansion, or filename expansion on WORD. If any part of WORD is quoted, the DELIMITER is the result of quote removal on WORD, and the lines in the here-document are not expanded. -If WORD is unquoted, DELIMITER is WORD itself, all lines of the +If WORD is unquoted, DELIMITER is WORD itself, and the here-document +text is treated similarly to a double-quoted string: all lines of the here-document are subjected to parameter expansion, command substitution, and arithmetic expansion, the character sequence -‘\newline’ is ignored, and ‘\’ must be used to quote the characters ‘\’, -‘$’, and ‘`’. +‘\newline’ is treated literally, and ‘\’ must be used to quote the +characters ‘\’, ‘$’, and ‘`’; however, double quote characters have no +special meaning. + + If the redirection operator is ‘<<-’, the shell strips leading tab +characters are stripped from input lines and the line containing +DELIMITER. This allows here-documents within shell scripts to be +indented in a natural fashion. - If the redirection operator is ‘<<-’, then all leading tab characters -are stripped from input lines and the line containing DELIMITER. This -allows here-documents within shell scripts to be indented in a natural -fashion. + If the delimiter is not quoted, the ‘\’ sequence is treated +as a line continuation: the two lines are joined and the +backslash-newline is removed. This happens while reading the +here-document, before the check for the ending delimiter, so joined +lines can form the end delimiter. 3.6.7 Here Strings ------------------ @@ -2782,21 +2848,21 @@ standard input (or file descriptor N if N is specified). The redirection operator [N]<&WORD is used to duplicate input file descriptors. If WORD expands to one or -more digits, the file descriptor denoted by N is made to be a copy of -that file descriptor. If the digits in WORD do not specify a file -descriptor open for input, a redirection error occurs. If WORD -evaluates to ‘-’, file descriptor N is closed. If N is not specified, -the standard input (file descriptor 0) is used. +more digits, file descriptor N is made to be a copy of that file +descriptor. It is a redirection error if the digits in WORD do not +specify a file descriptor open for input. If WORD evaluates to ‘-’, +file descriptor N is closed. If N is not specified, this uses the +standard input (file descriptor 0). The operator [N]>&WORD is used similarly to duplicate output file descriptors. If N is not -specified, the standard output (file descriptor 1) is used. If the -digits in WORD do not specify a file descriptor open for output, a -redirection error occurs. If WORD evaluates to ‘-’, file descriptor N -is closed. As a special case, if N is omitted, and WORD does not expand -to one or more digits or ‘-’, the standard output and standard error are -redirected as described previously. +specified, this uses the standard output (file descriptor 1). It is a +redirection error if the digits in WORD do not specify a file descriptor +open for output. If WORD evaluates to ‘-’, file descriptor N is closed. +As a special case, if N is omitted, and WORD does not expand to one or +more digits or ‘-’, this redirects the standard output and standard +error as described previously. 3.6.9 Moving File Descriptors ----------------------------- @@ -2817,9 +2883,9 @@ output (file descriptor 1) if N is not specified. The redirection operator [N]<>WORD -causes the file whose name is the expansion of WORD to be opened for -both reading and writing on file descriptor N, or on file descriptor 0 -if N is not specified. If the file does not exist, it is created. +opens the file whose name is the expansion of WORD for both reading and +writing on file descriptor N, or on file descriptor 0 if N is not +specified. If the file does not exist, it is created.  File: bashref.info, Node: Executing Commands, Next: Shell Scripts, Prev: Redirections, Up: Basic Shell Features @@ -2847,7 +2913,7 @@ File: bashref.info, Node: Simple Command Expansion, Next: Command Search and E 3.7.1 Simple Command Expansion ------------------------------ -When a simple command is executed, the shell performs the following +When the shell executes a simple command, it performs the following expansions, assignments, and redirections, from left to right, in the following order. @@ -2884,8 +2950,8 @@ command to exit with a non-zero status. as described below. Otherwise, the command exits. If one of the expansions contained a command substitution, the exit status of the command is the exit status of the last command substitution performed. -If there were no command substitutions, the command exits with a status -of zero. +If there were no command substitutions, the command exits with a zero +status.  File: bashref.info, Node: Command Search and Execution, Next: Command Execution Environment, Prev: Simple Command Expansion, Up: Executing Commands @@ -2910,8 +2976,8 @@ following actions. containing an executable file by that name. Bash uses a hash table to remember the full pathnames of executable files to avoid multiple ‘PATH’ searches (see the description of ‘hash’ in *note - Bourne Shell Builtins::). A full search of the directories in - ‘$PATH’ is performed only if the command is not found in the hash + Bourne Shell Builtins::). Bash performs a full search of the + directories in ‘$PATH’ only if the command is not found in the hash table. If the search is unsuccessful, the shell searches for a defined shell function named ‘command_not_found_handle’. If that function exists, it is invoked in a separate execution environment @@ -2928,8 +2994,8 @@ following actions. 5. If this execution fails because the file is not in executable format, and the file is not a directory, it is assumed to be a - “shell script” and the shell executes it as described in *note - Shell Scripts::. + “shell script”, a file containing shell commands, and the shell + executes it as described in *note Shell Scripts::. 6. If the command was not begun asynchronously, the shell waits for the command to complete and collects its exit status. @@ -2998,9 +3064,11 @@ shell's execution environment. asynchronous commands are invoked in a subshell environment that is a duplicate of the shell environment, except that traps caught by the shell are reset to the values that the shell inherited from its parent -at invocation. Builtin commands that are invoked as part of a pipeline -are also executed in a subshell environment. Changes made to the -subshell environment cannot affect the shell's execution environment. +at invocation. Builtin commands that are invoked as part of a pipeline, +except possibly in the last element depending on the value of the +‘lastpipe’ shell option (*note The Shopt Builtin::), are also executed +in a subshell environment. Changes made to the subshell environment +cannot affect the shell's execution environment. When the shell is in POSIX mode, subshells spawned to execute command substitutions inherit the value of the ‘-e’ option from the parent @@ -3027,20 +3095,23 @@ When a program is invoked it is given an array of strings called the Bash provides several ways to manipulate the environment. On invocation, the shell scans its own environment and creates a parameter for each name found, automatically marking it for ‘export’ to child -processes. Executed commands inherit the environment. The ‘export’ and -‘declare -x’ commands allow parameters and functions to be added to and -deleted from the environment. If the value of a parameter in the -environment is modified, the new value becomes part of the environment, -replacing the old. The environment inherited by any executed command -consists of the shell's initial environment, whose values may be -modified in the shell, less any pairs removed by the ‘unset’ and ‘export --n’ commands, plus any additions via the ‘export’ and ‘declare -x’ -commands. - - The environment for any simple command or function may be augmented -temporarily by prefixing it with parameter assignments, as described in -*note Shell Parameters::. These assignment statements affect only the -environment seen by that command. +processes. Executed commands inherit the environment. The ‘export’, +‘declare -x’, and ‘unset’ commands modify the environment by adding and +deleting parameters and functions. If the value of a parameter in the +environment is modified, the new value automatically becomes part of the +environment, replacing the old. The environment inherited by any +executed command consists of the shell's initial environment, whose +values may be modified in the shell, less any pairs removed by the +‘unset’ and ‘export -n’ commands, plus any additions via the ‘export’ +and ‘declare -x’ commands. + + If any parameter assignment statements, as described in *note Shell +Parameters::, appear before a simple command, the variable assignments +are part of that command's environment for as long as it executes. +These assignment statements affect only the environment seen by that +command. If these assignments precede a call to a shell function, the +variables are local to the function and exported to that function's +children. If the ‘-k’ option is set (*note The Set Builtin::), then all parameter assignments are placed in the environment for a command, not @@ -3064,11 +3135,14 @@ commands are also limited to this range. Under certain circumstances, the shell will use special values to indicate specific failure modes. For the shell's purposes, a command which exits with a zero exit -status has succeeded. A non-zero exit status indicates failure. This -seemingly counter-intuitive scheme is used so there is one well-defined -way to indicate success and a variety of ways to indicate various -failure modes. When a command terminates on a fatal signal whose number -is N, Bash uses the value 128+N as the exit status. +status has succeeded. So while an exit status of zero indicates +success, a non-zero exit status indicates failure. This seemingly +counter-intuitive scheme is used so there is one well-defined way to +indicate success and a variety of ways to indicate various failure +modes. + + When a command terminates on a fatal signal whose number is N, Bash +uses the value 128+N as the exit status. If a command is not found, the child process created to execute it returns a status of 127. If a command is found but is not executable, @@ -3090,6 +3164,11 @@ arguments. The exit status of the last command is available in the special parameter $? (*note Special Parameters::). + Bash itself returns the exit status of the last command executed, +unless a syntax error occurs, in which case it exits with a non-zero +value. See also the ‘exit’ builtin command (*note Bourne Shell +Builtins::. +  File: bashref.info, Node: Signals, Prev: Exit Status, Up: Executing Commands @@ -3098,37 +3177,42 @@ File: bashref.info, Node: Signals, Prev: Exit Status, Up: Executing Commands When Bash is interactive, in the absence of any traps, it ignores ‘SIGTERM’ (so that ‘kill 0’ does not kill an interactive shell), and -‘SIGINT’ is caught and handled (so that the ‘wait’ builtin is +catches and handles ‘SIGINT’ (so that the ‘wait’ builtin is interruptible). When Bash receives a ‘SIGINT’, it breaks out of any executing loops. In all cases, Bash ignores ‘SIGQUIT’. If job control is in effect (*note Job Control::), Bash ignores ‘SIGTTIN’, ‘SIGTTOU’, and ‘SIGTSTP’. - Non-builtin commands started by Bash have signal handlers set to the -values inherited by the shell from its parent. When job control is not -in effect, asynchronous commands ignore ‘SIGINT’ and ‘SIGQUIT’ in -addition to these inherited handlers. Commands run as a result of -command substitution ignore the keyboard-generated job control signals -‘SIGTTIN’, ‘SIGTTOU’, and ‘SIGTSTP’. + The ‘trap’ builtin modifies the shell's signal handling, as described +below (*note Bourne Shell Builtins::. + + Non-builtin commands Bash executes have signal handlers set to the +values inherited by the shell from its parent, unless ‘trap’ sets them +to be ignored, in which case the child process will ignore them as well. +When job control is not in effect, asynchronous commands ignore ‘SIGINT’ +and ‘SIGQUIT’ in addition to these inherited handlers. Commands run as +a result of command substitution ignore the keyboard-generated job +control signals ‘SIGTTIN’, ‘SIGTTOU’, and ‘SIGTSTP’. The shell exits by default upon receipt of a ‘SIGHUP’. Before exiting, an interactive shell resends the ‘SIGHUP’ to all jobs, running -or stopped. Stopped jobs are sent ‘SIGCONT’ to ensure that they receive -the ‘SIGHUP’. To prevent the shell from sending the ‘SIGHUP’ signal to -a particular job, it should be removed from the jobs table with the -‘disown’ builtin (*note Job Control Builtins::) or marked to not receive -‘SIGHUP’ using ‘disown -h’. - - If the ‘huponexit’ shell option has been set with ‘shopt’ (*note The +or stopped. The shell sends ‘SIGCONT’ to stopped jobs to ensure that +they receive the ‘SIGHUP’ (*Note Job Control::, for more information +about running and stopped jobs). To prevent the shell from sending the +‘SIGHUP’ signal to a particular job, remove it from the jobs table with +the ‘disown’ builtin (*note Job Control Builtins::) or mark it not to +receive ‘SIGHUP’ using ‘disown -h’. + + If the ‘huponexit’ shell option has been set using ‘shopt’ (*note The Shopt Builtin::), Bash sends a ‘SIGHUP’ to all jobs when an interactive login shell exits. If Bash is waiting for a command to complete and receives a signal for which a trap has been set, the trap will not be executed until the -command completes. When Bash is waiting for an asynchronous command via -the ‘wait’ builtin, the reception of a signal for which a trap has been -set will cause the ‘wait’ builtin to return immediately with an exit -status greater than 128, immediately after which the trap is executed. +command completes. If Bash is waiting for an asynchronous command via +the ‘wait’ builtin, and it receives a signal for which a trap has been +set, the ‘wait’ builtin will return immediately with an exit status +greater than 128, immediately after which the shell executes the trap. When job control is not enabled, and Bash is waiting for a foreground command to complete, the shell receives keyboard-generated signals such @@ -3167,9 +3251,13 @@ A shell script is a text file containing shell commands. When such a file is used as the first non-option argument when invoking Bash, and neither the ‘-c’ nor ‘-s’ option is supplied (*note Invoking Bash::), Bash reads and executes commands from the file, then exits. This mode -of operation creates a non-interactive shell. The shell first searches -for the file in the current directory, and looks in the directories in -‘$PATH’ if not found there. +of operation creates a non-interactive shell. If the filename does not +contain any slashes, the shell first searches for the file in the +current directory, and looks in the directories in ‘$PATH’ if not found +there. + + Bash tries to determine whether the file is a text file or a binary, +and will not execute files it determines to be binaries. When Bash runs a shell script, it sets the special parameter ‘0’ to the name of the file, rather than the name of the shell, and the @@ -3191,13 +3279,13 @@ invoked to interpret the script, with the exception that the locations of commands remembered by the parent (see the description of ‘hash’ in *note Bourne Shell Builtins::) are retained by the child. - Most versions of Unix make this a part of the operating system's -command execution mechanism. If the first line of a script begins with -the two characters ‘#!’, the remainder of the line specifies an -interpreter for the program and, depending on the operating system, one -or more optional arguments for that interpreter. Thus, you can specify -Bash, ‘awk’, Perl, or some other interpreter and write the rest of the -script file in that language. + The GNU operating system, and most versions of Unix, make this a part +of the operating system's command execution mechanism. If the first +line of a script begins with the two characters ‘#!’, the remainder of +the line specifies an interpreter for the program and, depending on the +operating system, one or more optional arguments for that interpreter. +Thus, you can specify Bash, ‘awk’, Perl, or some other interpreter and +write the rest of the script file in that language. The arguments to the interpreter consist of one or more optional arguments following the interpreter name on the first line of the script @@ -3282,44 +3370,52 @@ standard. ‘. (a period)’ . [-p PATH] FILENAME [ARGUMENTS] - Read and execute commands from the FILENAME argument in the current - shell context. If FILENAME does not contain a slash, ‘.’ searches - for it. If ‘-p’ is supplied, ‘.’ treats PATH as a colon-separated - list of directories in which to find FILENAME; otherwise, ‘.’ uses - the directories in ‘PATH’ to find FILENAME. FILENAME does not need - to be executable. When Bash is not in POSIX mode, it searches the + The ‘.’ command reads and execute commands from the FILENAME + argument in the current shell context. + + If FILENAME does not contain a slash, ‘.’ searches for it. If ‘-p’ + is supplied, ‘.’ treats PATH as a colon-separated list of + directories in which to find FILENAME; otherwise, ‘.’ uses the + directories in ‘PATH’ to find FILENAME. FILENAME does not need to + be executable. When Bash is not in POSIX mode, it searches the current directory if FILENAME is not found in ‘$PATH’, but does not search the current directory if ‘-p’ is supplied. If the - ‘sourcepath’ option (*note The Shopt Builtin::) is turned off ‘.’ - does not search ‘PATH’. If any ARGUMENTS are supplied, they become - the positional parameters when FILENAME is executed. Otherwise the - positional parameters are unchanged. If the ‘-T’ option is - enabled, ‘.’ inherits any trap on ‘DEBUG’; if it is not, any - ‘DEBUG’ trap string is saved and restored around the call to ‘.’, - and ‘.’ unsets the ‘DEBUG’ trap while it executes. If ‘-T’ is not - set, and the sourced file changes the ‘DEBUG’ trap, the new value - is retained when ‘.’ completes. The return status is the exit - status of the last command executed, or zero if no commands are - executed. If FILENAME is not found, or cannot be read, the return - status is non-zero. This builtin is equivalent to ‘source’. + ‘sourcepath’ option (*note The Shopt Builtin::) is turned off, ‘.’ + does not search ‘PATH’. + + If any ARGUMENTS are supplied, they become the positional + parameters when FILENAME is executed. Otherwise the positional + parameters are unchanged. + + If the ‘-T’ option is enabled, ‘.’ inherits any trap on ‘DEBUG’; if + it is not, any ‘DEBUG’ trap string is saved and restored around the + call to ‘.’, and ‘.’ unsets the ‘DEBUG’ trap while it executes. If + ‘-T’ is not set, and the sourced file changes the ‘DEBUG’ trap, the + new value persists after ‘.’ completes. The return status is the + exit status of the last command executed from FILENAME, or zero if + no commands are executed. If FILENAME is not found, or cannot be + read, the return status is non-zero. This builtin is equivalent to + ‘source’. ‘break’ break [N] Exit from a ‘for’, ‘while’, ‘until’, or ‘select’ loop. If N is - supplied, the Nth enclosing loop is exited. N must be greater than - or equal to 1. The return status is zero unless N is not greater - than or equal to 1. + supplied, ‘break’ exits the Nth enclosing loop. N must be greater + than or equal to 1. The return status is zero unless N is not + greater than or equal to 1. ‘cd’ cd [-L|[-P [-e]]] [-@] [DIRECTORY] Change the current working directory to DIRECTORY. If DIRECTORY is - not supplied, the value of the ‘HOME’ shell variable is used. If - the shell variable ‘CDPATH’ exists, ‘cd’ uses it as a search path: - ‘cd’ searches each directory name in ‘CDPATH’ for DIRECTORY, with - alternative directory names in ‘CDPATH’ separated by a colon (‘:’). - If DIRECTORY begins with a slash, ‘CDPATH’ is not used. + not supplied, the value of the ‘HOME’ shell variable is used as + DIRECTORY. If the shell variable ‘CDPATH’ exists, ‘cd’ uses it as + a search path: ‘cd’ searches each directory name in ‘CDPATH’ for + DIRECTORY, with alternative directory names in ‘CDPATH’ separated + by a colon (‘:’). A null directory name in ‘CDPATH’ means the same + thing as the current directory. If DIRECTORY begins with a slash, + ‘CDPATH’ is not used. The ‘-P’ option means to not follow symbolic links: symbolic links are resolved while ‘cd’ is traversing DIRECTORY and before @@ -3335,17 +3431,17 @@ standard. If the ‘-e’ option is supplied with ‘-P’ and the current working directory cannot be successfully determined after a successful - directory change, ‘cd’ will return an unsuccessful status. + directory change, ‘cd’ will return a non-zero status. On systems that support it, the ‘-@’ option presents the extended attributes associated with a file as a directory. - If DIRECTORY is ‘-’, it is converted to ‘$OLDPWD’ before the - directory change is attempted. + If DIRECTORY is ‘-’, it is converted to ‘$OLDPWD’ before attempting + the directory change. - If a non-empty directory name from ‘CDPATH’ is used, or if ‘-’ is - the first argument, and the directory change is successful, the - absolute pathname of the new working directory is written to the + If ‘cd’ uses a non-empty directory name from ‘CDPATH’, or if ‘-’ is + the first argument, and the directory change is successful, ‘cd’ + writes the absolute pathname of the new working directory to the standard output. If the directory change is successful, ‘cd’ sets the value of the @@ -3359,37 +3455,41 @@ standard. ‘continue’ continue [N] - Resume the next iteration of an enclosing ‘for’, ‘while’, ‘until’, - or ‘select’ loop. If N is supplied, the execution of the Nth - enclosing loop is resumed. N must be greater than or equal to 1. - The return status is zero unless N is not greater than or equal to - 1. + ‘continue’ resumes the next iteration of an enclosing ‘for’, + ‘while’, ‘until’, or ‘select’ loop. If N is supplied, Bash resumes + the execution of the Nth enclosing loop. N must be greater than or + equal to 1. The return status is zero unless N is not greater than + or equal to 1. ‘eval’ eval [ARGUMENTS] - The arguments are concatenated together into a single command, - which is then read and executed, and its exit status returned as - the exit status of ‘eval’. If there are no arguments or only empty - arguments, the return status is zero. + The ARGUMENTS are concatenated together into a single command, + separated by spaces. Bash then reads and executes this command and + returns its exit status as the exit status of ‘eval’. If there are + no arguments or only empty arguments, the return status is zero. ‘exec’ exec [-cl] [-a NAME] [COMMAND [ARGUMENTS]] If COMMAND is supplied, it replaces the shell without creating a - new process. If the ‘-l’ option is supplied, the shell places a - dash at the beginning of the zeroth argument passed to COMMAND. - This is what the ‘login’ program does. The ‘-c’ option causes - COMMAND to be executed with an empty environment. If ‘-a’ is - supplied, the shell passes NAME as the zeroth argument to COMMAND. + new process. COMMAND cannot be a shell builtin or function. The + ARGUMENTS become the arguments to COMMAND If the ‘-l’ option is + supplied, the shell places a dash at the beginning of the zeroth + argument passed to COMMAND. This is what the ‘login’ program does. + The ‘-c’ option causes COMMAND to be executed with an empty + environment. If ‘-a’ is supplied, the shell passes NAME as the + zeroth argument to COMMAND. + If COMMAND cannot be executed for some reason, a non-interactive shell exits, unless the ‘execfail’ shell option is enabled. In - that case, it returns failure. An interactive shell returns - failure if the file cannot be executed. A subshell exits - unconditionally if ‘exec’ fails. If no COMMAND is specified, - redirections may be used to affect the current shell environment. - If there are no redirection errors, the return status is zero; - otherwise the return status is non-zero. + that case, it returns a non-zero status. An interactive shell + returns a non-zero status if the file cannot be executed. A + subshell exits unconditionally if ‘exec’ fails. + + If COMMAND is not specified, redirections may be used to affect the + current shell environment. If there are no redirection errors, the + return status is zero; otherwise the return status is non-zero. ‘exit’ exit [N] @@ -3401,14 +3501,20 @@ standard. ‘export’ export [-fn] [-p] [NAME[=VALUE]] - Mark each NAME to be passed to child processes in the environment. - If the ‘-f’ option is supplied, the NAMEs refer to shell functions; - otherwise the names refer to shell variables. The ‘-n’ option - means to no longer mark each NAME for export. If no NAMEs are - supplied, or if the ‘-p’ option is given, a list of names of all - exported variables is displayed. The ‘-p’ option displays output - in a form that may be reused as input. If a variable name is - followed by =VALUE, the value of the variable is set to VALUE. + Mark each NAME to be passed to subsequently executed commands in + the environment. If the ‘-f’ option is supplied, the NAMEs refer + to shell functions; otherwise the names refer to shell variables. + + The ‘-n’ option means to unexport each name: no longer mark it for + export. If no NAMEs are supplied, or if the ‘-p’ option is given, + ‘export’ displays a list of names of all exported variables on the + standard output. The ‘-p’ option displays output in a form that + may be reused as input. + + ‘export’ allows the value of a variable to be set at the same time + it is exported or unexported by following the variable name with + =VALUE. This sets the value of the variable is to VALUE while + modifying the export attribute. The return status is zero unless an invalid option is supplied, one of the names is not a valid shell variable name, or ‘-f’ is @@ -3417,40 +3523,43 @@ standard. ‘false’ false - Does nothing, returns a non-zero status. + Does nothing; returns a non-zero status. ‘getopts’ getopts OPTSTRING NAME [ARG ...] - ‘getopts’ is used by shell scripts to parse positional parameters. - OPTSTRING contains the option characters to be recognized; if a - character is followed by a colon, the option is expected to have an - argument, which should be separated from it by whitespace. The - colon (‘:’) and question mark (‘?’) may not be used as option - characters. Each time it is invoked, ‘getopts’ places the next - option in the shell variable NAME, initializing NAME if it does not - exist, and the index of the next argument to be processed into the - variable ‘OPTIND’. ‘OPTIND’ is initialized to 1 each time the - shell or a shell script is invoked. When an option requires an - argument, ‘getopts’ places that argument into the variable - ‘OPTARG’. The shell does not reset ‘OPTIND’ automatically; it must - be manually reset between multiple calls to ‘getopts’ within the - same shell invocation if a new set of parameters is to be used. - - When the end of options is encountered, ‘getopts’ exits with a - return value greater than zero. ‘OPTIND’ is set to the index of - the first non-option argument, and NAME is set to ‘?’. + ‘getopts’ is used by shell scripts or functions to parse positional + parameters and obtain options and their arguments. OPTSTRING + contains the option characters to be recognized; if a character is + followed by a colon, the option is expected to have an argument, + which should be separated from it by whitespace. The colon (‘:’) + and question mark (‘?’) may not be used as option characters. + + Each time it is invoked, ‘getopts’ places the next option in the + shell variable NAME, initializing NAME if it does not exist, and + the index of the next argument to be processed into the variable + ‘OPTIND’. ‘OPTIND’ is initialized to 1 each time the shell or a + shell script is invoked. When an option requires an argument, + ‘getopts’ places that argument into the variable ‘OPTARG’. + + The shell does not reset ‘OPTIND’ automatically; it must be + manually reset between multiple calls to ‘getopts’ within the same + shell invocation to use a new set of parameters. + + When it reaches the end of options, ‘getopts’ exits with a return + value greater than zero. ‘OPTIND’ is set to the index of the first + non-option argument, and NAME is set to ‘?’. ‘getopts’ normally parses the positional parameters, but if more arguments are supplied as ARG values, ‘getopts’ parses those instead. ‘getopts’ can report errors in two ways. If the first character of - OPTSTRING is a colon, SILENT error reporting is used. In normal - operation, diagnostic messages are printed when invalid options or - missing option arguments are encountered. If the variable ‘OPTERR’ - is set to 0, no error messages will be displayed, even if the first - character of ‘optstring’ is not a colon. + OPTSTRING is a colon, ‘getopts’ uses SILENT error reporting. In + normal operation, ‘getopts’ prints diagnostic messages when it + encounters invalid options or missing option arguments. If the + variable ‘OPTERR’ is set to 0, no error messages will be displayed, + even if the first character of ‘optstring’ is not a colon. If ‘getopts’ detects an invalid option, it places ‘?’ into NAME and, if not silent, prints an error message and unsets ‘OPTARG’. @@ -3463,6 +3572,10 @@ standard. it sets the value of NAME to a colon (‘:’), and sets ‘OPTARG’ to the option character found. + ‘getopts’ returns true if an option, specified or unspecified, is + found. It returns false when it encounters the end of options or + if an error occurs. + ‘hash’ hash [-r] [-p FILENAME] [-dt] [NAME] @@ -3470,70 +3583,89 @@ standard. commands specified as NAME arguments, so they need not be searched for on subsequent invocations. The commands are found by searching through the directories listed in ‘$PATH’. Any - previously-remembered filename is discarded. The ‘-p’ option - inhibits the path search, and FILENAME is used as the location of - NAME. The ‘-r’ option causes the shell to forget all remembered + previously-remembered filename associated with NAME is discarded. + The ‘-p’ option inhibits the path search, and ‘hash’ uses FILENAME + as the location of NAME. + + The ‘-r’ option causes the shell to forget all remembered locations. Assigning to the ‘PATH’ variable also clears all hashed filenames. The ‘-d’ option causes the shell to forget the - remembered location of each NAME. If the ‘-t’ option is supplied, - the full pathname to which each NAME corresponds is printed. If - multiple NAME arguments are supplied with ‘-t’, the NAME is printed - before the hashed full pathname. The ‘-l’ option causes output to - be displayed in a format that may be reused as input. If no - arguments are given, or if only ‘-l’ is supplied, information about - remembered commands is printed. The ‘-t’, ‘-d’, and ‘-p’ options - (the options that act on the NAME arguments) are mutually - exclusive. Only one will be active. If more than one is supplied, - ‘-t’ has higher priority than ‘-p’, and both are higher priority - than ‘-d’. The return status is zero unless a NAME is not found or - an invalid option is supplied. + remembered location of each NAME. + + If the ‘-t’ option is supplied, ‘hash’ prints the full pathname + corresponding to each NAME. If multiple NAME arguments are + supplied with ‘-t’, ‘hash’ prints each NAME before the + corresponding hashed full path. The ‘-l’ option displays output in + a format that may be reused as input. + + If no arguments are given, or if only ‘-l’ is supplied, ‘hash’ + prints information about remembered commands. The ‘-t’, ‘-d’, and + ‘-p’ options (the options that act on the NAME arguments) are + mutually exclusive. Only one will be active. If more than one is + supplied, ‘-t’ has higher priority than ‘-p’, and both have higher + priority than ‘-d’. + + The return status is zero unless a NAME is not found or an invalid + option is supplied. ‘pwd’ pwd [-LP] Print the absolute pathname of the current working directory. If - the ‘-P’ option is supplied, the pathname printed will not contain - symbolic links. If the ‘-L’ option is supplied, the pathname - printed may contain symbolic links. The return status is zero - unless an error is encountered while determining the name of the - current directory or an invalid option is supplied. + the ‘-P’ option is supplied, or the ‘-o physical’ option to the + ‘set’ builtin (*note The Set Builtin::) is enabled, the pathname + printed will not contain symbolic links. If the ‘-L’ option is + supplied, the pathname printed may contain symbolic links. The + return status is zero unless an error is encountered while + determining the name of the current directory or an invalid option + is supplied. ‘readonly’ readonly [-aAf] [-p] [NAME[=VALUE]] ... Mark each NAME as readonly. The values of these names may not be - changed by subsequent assignment. If the ‘-f’ option is supplied, - each NAME refers to a shell function. The ‘-a’ option means each - NAME refers to an indexed array variable; the ‘-A’ option means - each NAME refers to an associative array variable. If both options - are supplied, ‘-A’ takes precedence. If no NAME arguments are - given, or if the ‘-p’ option is supplied, a list of all readonly - names is printed. The other options may be used to restrict the - output to a subset of the set of readonly names. The ‘-p’ option - causes output to be displayed in a format that may be reused as - input. If a variable name is followed by =VALUE, the value of the - variable is set to VALUE. The return status is zero unless an - invalid option is supplied, one of the NAME arguments is not a - valid shell variable or function name, or the ‘-f’ option is - supplied with a name that is not a shell function. + changed by subsequent assignment or unset. If the ‘-f’ option is + supplied, each NAME refers to a shell function. The ‘-a’ option + means each NAME refers to an indexed array variable; the ‘-A’ + option means each NAME refers to an associative array variable. If + both options are supplied, ‘-A’ takes precedence. If no NAME + arguments are supplied, or if the ‘-p’ option is supplied, print a + list of all readonly names. The other options may be used to + restrict the output to a subset of the set of readonly names. The + ‘-p’ option displays output in a format that may be reused as + input. + + ‘readonly’ allows the value of a variable to be set at the same + time the readonly attribute is changed by following the variable + name with =VALUE. This sets the value of the variable is to VALUE + while modifying the readonly attribute. + + The return status is zero unless an invalid option is supplied, one + of the NAME arguments is not a valid shell variable or function + name, or the ‘-f’ option is supplied with a name that is not a + shell function. ‘return’ return [N] - Cause a shell function to stop executing and return the value N to - its caller. If N is not supplied, the return value is the exit - status of the last command executed in the function. If ‘return’ - is executed by a trap handler, the last command used to determine - the status is the last command executed before the trap handler. - If ‘return’ is executed during a ‘DEBUG’ trap, the last command - used to determine the status is the last command executed by the - trap handler before ‘return’ was invoked. ‘return’ may also be - used to terminate execution of a script being executed with the ‘.’ - (‘source’) builtin, returning either N or the exit status of the - last command executed within the script as the exit status of the - script. If N is supplied, the return value is its least - significant 8 bits. Any command associated with the ‘RETURN’ trap - is executed before execution resumes after the function or script. + Stop executing a shell function or sourced file and return the + value N to its caller. If N is not supplied, the return value is + the exit status of the last command executed. If ‘return’ is + executed by a trap handler, the last command used to determine the + status is the last command executed before the trap handler. If + ‘return’ is executed during a ‘DEBUG’ trap, the last command used + to determine the status is the last command executed by the trap + handler before ‘return’ was invoked. + + When ‘return’ is used to terminate execution of a script being + executed with the ‘.’ (‘source’) builtin, it returns either N or + the exit status of the last command executed within the script as + the exit status of the script. If N is supplied, the return value + is its least significant 8 bits. + + Any command associated with the ‘RETURN’ trap is executed before + execution resumes after the function or script. + The return status is non-zero if ‘return’ is supplied a non-numeric argument or is used outside a function and not during the execution of a script by ‘.’ or ‘source’. @@ -3541,12 +3673,12 @@ standard. ‘shift’ shift [N] - Shift the positional parameters to the left by N. The positional + Shift the positional parameters to the left by N: the positional parameters from N+1 ... ‘$#’ are renamed to ‘$1’ ... ‘$#’-N. Parameters represented by the numbers ‘$#’ down to ‘$#’-N+1 are unset. N must be a non-negative number less than or equal to ‘$#’. - If N is zero or greater than ‘$#’, the positional parameters are - not changed. If N is not supplied, it is assumed to be 1. The + If N is not supplied, it is assumed to be 1. If N is zero or + greater than ‘$#’, the positional parameters are not changed. The return status is zero unless N is greater than ‘$#’ or less than zero, non-zero otherwise. @@ -3559,22 +3691,20 @@ standard. argument. Expressions are composed of the primaries described below in *note Bash Conditional Expressions::. ‘test’ does not accept any options, nor does it accept and ignore an argument of - ‘--’ as signifying the end of options. - - When the ‘[’ form is used, the last argument to the command must be - a ‘]’. + ‘--’ as signifying the end of options. When using the ‘[’ form, + the last argument to the command must be a ‘]’. Expressions may be combined using the following operators, listed in decreasing order of precedence. The evaluation depends on the - number of arguments; see below. Operator precedence is used when - there are five or more arguments. + number of arguments; see below. ‘test’ uses operator precedence + when there are five or more arguments. ‘! EXPR’ True if EXPR is false. ‘( EXPR )’ - Returns the value of EXPR. This may be used to override the - normal precedence of operators. + Returns the value of EXPR. This may be used to override + normal operator precedence. ‘EXPR1 -a EXPR2’ True if both EXPR1 and EXPR2 are true. @@ -3663,15 +3793,17 @@ standard. trap [-Plp] [ACTION] [SIGSPEC ...] The ACTION is a command that is read and executed when the shell - receives signal SIGSPEC. If ACTION is absent (and there is a - single SIGSPEC) or equal to ‘-’, each specified signal's - disposition is reset to the value it had when the shell was - started. If ACTION is the null string, then the signal specified - by each SIGSPEC is ignored by the shell and commands it invokes. + receives any of the signals SIGSPEC. If ACTION is absent (and + there is a single SIGSPEC) or equal to ‘-’, each specified + SIGSPEC'ss disposition is reset to the value it had when the shell + was started. If ACTION is the null string, then the signal + specified by each SIGSPEC is ignored by the shell and commands it + invokes. If no arguments are supplied, ‘trap’ prints the actions associated with each trapped signal as a set of ‘trap’ commands that can be reused as shell input to restore the current signal dispositions. + If ACTION is not present and ‘-p’ has been supplied, ‘trap’ displays the trap commands associated with each SIGSPEC, or, if no SIGSPECs are supplied, for all trapped signals, as a set of ‘trap’ @@ -3679,26 +3811,27 @@ standard. signal dispositions. The ‘-P’ option behaves similarly, but displays only the actions associated with each SIGSPEC argument. ‘-P’ requires at least one SIGSPEC argument. The ‘-P’ or ‘-p’ - options to ‘trap’ may be used in a subshell environment (e.g., - command substitution) and, as long as they are used before ‘trap’ - is used to change a signal's handling, will display the state of - its parent's traps. + options may be used in a subshell environment (e.g., command + substitution) and, as long as they are used before ‘trap’ is used + to change a signal's handling, will display the state of its + parent's traps. - The ‘-l’ option causes ‘trap’ to print a list of signal names and - their corresponding numbers. Each SIGSPEC is either a signal name - or a signal number. Signal names are case insensitive and the - ‘SIG’ prefix is optional. + The ‘-l’ option prints a list of signal names and their + corresponding numbers. Each SIGSPEC is either a signal name or a + signal number. Signal names are case insensitive and the ‘SIG’ + prefix is optional. If ‘-l’ is supplied with no SIGSPEC arguments, + it prints a list of valid signal names. If a SIGSPEC is ‘0’ or ‘EXIT’, ACTION is executed when the shell exits. If a SIGSPEC is ‘DEBUG’, ACTION is executed before every simple command, ‘for’ command, ‘case’ command, ‘select’ command, (( arithmetic command, [[ conditional command, arithmetic ‘for’ command, and before the first command executes in a shell function. - Refer to the description of the ‘extdebug’ option to the ‘shopt’ - builtin (*note The Shopt Builtin::) for details of its effect on - the ‘DEBUG’ trap. If a SIGSPEC is ‘RETURN’, ACTION is executed - each time a shell function or a script executed with the ‘.’ or - ‘source’ builtins finishes executing. + Refer to the description of the ‘extdebug’ shell option (*note The + Shopt Builtin::) for details of its effect on the ‘DEBUG’ trap. If + a SIGSPEC is ‘RETURN’, ACTION is executed each time a shell + function or a script executed with the ‘.’ or ‘source’ builtins + finishes executing. If a SIGSPEC is ‘ERR’, ACTION is executed whenever a pipeline (which may consist of a single simple command), a list, or a @@ -3708,18 +3841,19 @@ standard. ‘until’ or ‘while’ keyword, part of the test following the ‘if’ or ‘elif’ reserved words, part of a command executed in a ‘&&’ or ‘||’ list except the command following the final ‘&&’ or ‘||’, any - command in a pipeline but the last, or if the command's return - status is being inverted using ‘!’. These are the same conditions - obeyed by the ‘errexit’ (‘-e’) option. + command in a pipeline but the last, (subject to the state of the + ‘pipefail’ shell option), or if the command's return status is + being inverted using ‘!’. These are the same conditions obeyed by + the ‘errexit’ (‘-e’) option. - Signals ignored upon entry to a non-interactive shell cannot be - trapped or reset. Interactive shells permit trapping signals - ignored on entry. Trapped signals that are not being ignored are - reset to their original values in a subshell or subshell - environment when one is created. + When the shell is not interactive, signals ignored upon entry to a + non-interactive shell cannot be trapped or reset. Interactive + shells permit trapping signals ignored on entry. Trapped signals + that are not being ignored are reset to their original values in a + subshell or subshell environment when one is created. The return status is zero unless a SIGSPEC does not specify a valid - signal. + signal; non-zero otherwise. ‘true’ true @@ -3732,13 +3866,13 @@ standard. Set the shell process's file creation mask to MODE. If MODE begins with a digit, it is interpreted as an octal number; if not, it is interpreted as a symbolic mode mask similar to that accepted by the - ‘chmod’ command. If MODE is omitted, the current value of the mask - is printed. If the ‘-S’ option is supplied without a MODE - argument, the mask is printed in a symbolic format. If the ‘-p’ - option is supplied, and MODE is omitted, the output is in a form - that may be reused as input. The return status is zero if the mode - is successfully changed or if no MODE argument is supplied, and - non-zero otherwise. + ‘chmod’ command. If MODE is omitted, ‘umask’ prints the current + value of the mask. If the ‘-S’ option is supplied without a MODE + argument, ‘umask’ prints the mask in a symbolic format; the default + output is an octal number. If the ‘-p’ option is supplied, and + MODE is omitted, the output is in a form that may be reused as + input. The return status is zero if the mode is successfully + changed or if no MODE argument is supplied, and non-zero otherwise. Note that when the mode is interpreted as an octal number, each number of the umask is subtracted from ‘7’. Thus, a umask of ‘022’ @@ -3756,11 +3890,13 @@ standard. references. ‘-n’ has no effect if the ‘-f’ option is supplied. If no options are supplied, each NAME refers to a variable; if there is no variable by that name, a function with that name, if any, is - unset. Readonly variables and functions may not be unset. Some - shell variables lose their special behavior if they are unset; such - behavior is noted in the description of the individual variables. - The return status is zero unless a NAME is readonly or may not be - unset. + unset. Readonly variables and functions may not be unset. When + variables or functions are removed, they are also removed from the + environment passed to subsequent commands. Some shell variables + may not be unset. Some shell variables lose their special behavior + if they are unset; such behavior is noted in the description of the + individual variables. The return status is zero unless a NAME is + readonly or may not be unset.  File: bashref.info, Node: Bash Builtins, Next: Modifying Shell Behavior, Prev: Bourne Shell Builtins, Up: Shell Builtin Commands @@ -3777,10 +3913,13 @@ standard. Without arguments or with the ‘-p’ option, ‘alias’ prints the list of aliases on the standard output in a form that allows them to be - reused as input. If arguments are supplied, an alias is defined - for each NAME whose VALUE is given. If no VALUE is given, the name - and value of the alias is printed. Aliases are described in *note - Aliases::. + reused as input. If arguments are supplied, define an alias for + each NAME whose VALUE is given. If no VALUE is given, print the + name and value of the alias NAME. A trailing space in VALUE causes + the next word to be checked for alias substitution when the alias + is expanded during command parsing. ‘alias’ returns true unless a + NAME is given (without a corresponding =VALUE) for which no alias + has been defined. Aliases are described in *note Aliases::. ‘bind’ bind [-m KEYMAP] [-lsvSVX] @@ -3794,10 +3933,16 @@ standard. Display current Readline (*note Command Line Editing::) key and function bindings, bind a key sequence to a Readline function or - macro, or set a Readline variable. Each non-option argument is a - command as it would appear in a Readline initialization file (*note - Readline Init File::), but each binding or command must be passed - as a separate argument; e.g., ‘"\C-x\C-r":re-read-init-file’. + macro or to a shell command, or set a Readline variable. Each + non-option argument is a key binding or command as it would appear + in a Readline initialization file (*note Readline Init File::), but + each binding or command must be passed as a separate argument; + e.g., ‘"\C-x\C-r":re-read-init-file’. + + In the following descriptions, options that display output in a + form available to be re-read format their output as commands that + would appear in a Readline initialization file or that would be + supplied as individual arguments to a ‘bind’ command. Options, if supplied, have the following meanings: @@ -3824,14 +3969,6 @@ standard. arguments remain after option processing, ‘bind’ treats them as readline command names and restricts output to those names. - ‘-v’ - Display Readline variable names and values in such a way that - they can be used as an argument to a subsequent ‘bind’ command - or in a Readline initialization file. - - ‘-V’ - List current Readline variable names and values. - ‘-s’ Display Readline key sequences bound to macros and the strings they output in such a way that they can be used as an argument @@ -3842,14 +3979,22 @@ standard. Display Readline key sequences bound to macros and the strings they output. + ‘-v’ + Display Readline variable names and values in such a way that + they can be used as an argument to a subsequent ‘bind’ command + or in a Readline initialization file. + + ‘-V’ + List current Readline variable names and values. + ‘-f FILENAME’ Read key bindings from FILENAME. ‘-q FUNCTION’ - Query about which keys invoke the named FUNCTION. + Display key sequences that invoke the named Readline FUNCTION. ‘-u FUNCTION’ - Unbind all keys bound to the named FUNCTION. + Unbind all key sequences bound to the named Readline FUNCTION. ‘-r KEYSEQ’ Remove any current binding for KEYSEQ. @@ -3864,8 +4009,8 @@ standard. separator is a colon, any enclosing double quotes are optional, and Readline does not expand the command string before saving it. Since the entire key binding expression - must be a single argument, it should be enclosed in quotes. - When SHELL-COMMAND is executed, the shell sets the + must be a single argument, it should be enclosed in single + quotes. When SHELL-COMMAND is executed, the shell sets thex ‘READLINE_LINE’ variable to the contents of the Readline line buffer and the ‘READLINE_POINT’ and ‘READLINE_MARK’ variables to the current location of the insertion point and the saved @@ -3888,11 +4033,11 @@ standard. ‘builtin’ builtin [SHELL-BUILTIN [ARGS]] - Run a shell builtin, passing it ARGS, and return its exit status. - This is useful when defining a shell function with the same name as - a shell builtin, retaining the functionality of the builtin within - the function. The return status is non-zero if SHELL-BUILTIN is - not a shell builtin command. + Execute the specified shell builtin SHELL-BUILTIN, passing it ARGS, + and return its exit status. This is useful when defining a shell + function with the same name as a shell builtin, retaining the + functionality of the builtin within the function. The return + status is non-zero if SHELL-BUILTIN is not a shell builtin command. ‘caller’ caller [EXPR] @@ -3914,28 +4059,28 @@ standard. ‘command’ command [-pVv] COMMAND [ARGUMENTS ...] - Runs COMMAND with ARGUMENTS ignoring any shell function named - COMMAND. Only shell builtin commands or commands found by - searching the ‘PATH’ are executed. If there is a shell function - named ‘ls’, running ‘command ls’ within the function will execute - the external command ‘ls’ instead of calling the function - recursively. The ‘-p’ option means to use a default value for - ‘PATH’ that is guaranteed to find all of the standard utilities. - The return status in this case is 127 if COMMAND cannot be found or - an error occurred, and the exit status of COMMAND otherwise. - - If either the ‘-V’ or ‘-v’ option is supplied, a description of - COMMAND is printed. The ‘-v’ option causes a single word - indicating the command or file name used to invoke COMMAND to be - displayed; the ‘-V’ option produces a more verbose description. In - this case, the return status is zero if COMMAND is found, and - non-zero if not. + The ‘command’ builtin runs COMMAND with ARGUMENTS ignoring any + shell function named COMMAND. Only shell builtin commands or + commands found by searching the ‘PATH’ are executed. If there is a + shell function named ‘ls’, running ‘command ls’ within the function + will execute the external command ‘ls’ instead of calling the + function recursively. The ‘-p’ option means to use a default value + for ‘PATH’ that is guaranteed to find all of the standard + utilities. The return status in this case is 127 if COMMAND cannot + be found or an error occurred, and the exit status of COMMAND + otherwise. + + If either the ‘-V’ or ‘-v’ option is supplied, ‘command’ prints a + description of COMMAND. The ‘-v’ option displays a single word + indicating the command or file name used to invoke COMMAND; the + ‘-V’ option produces a more verbose description. In this case, the + return status is zero if COMMAND is found, and non-zero if not. ‘declare’ declare [-aAfFgiIlnrtux] [-p] [NAME[=VALUE] ...] Declare variables and give them attributes. If no NAMEs are given, - then display the values of variables instead. + then display the values of variables or shell functions instead. The ‘-p’ option will display the attributes and values of each NAME. When ‘-p’ is used with NAME arguments, additional options, @@ -3945,8 +4090,8 @@ standard. display the attributes and values of all variables having the attributes specified by the additional options. If no other options are supplied with ‘-p’, ‘declare’ will display the - attributes and values of all shell variables. The ‘-f’ option will - restrict the display to shell functions. + attributes and values of all shell variables. The ‘-f’ option + restricts the display to shell functions. The ‘-F’ option inhibits the display of function definitions; only the function name and attributes are printed. If the ‘extdebug’ @@ -3956,7 +4101,8 @@ standard. The ‘-g’ option forces variables to be created or modified at the global scope, even when ‘declare’ is executed in a shell function. - It is ignored in all other cases. + It is ignored in when ‘declare’ is not executed in a shell + function. The ‘-I’ option causes local variables to inherit the attributes (except the ‘nameref’ attribute) and value of any existing variable @@ -3973,7 +4119,7 @@ standard. Each NAME is an associative array variable (*note Arrays::). ‘-f’ - Use function names only. + Each NAME refers to a shell function. ‘-i’ The variable is to be treated as an integer; arithmetic @@ -4012,13 +4158,14 @@ standard. Mark each NAME for export to subsequent commands via the environment. - Using ‘+’ instead of ‘-’ turns off the attribute instead, with the - exceptions that ‘+a’ and ‘+A’ may not be used to destroy array - variables and ‘+r’ will not remove the readonly attribute. When - used in a function, ‘declare’ makes each NAME local, as with the - ‘local’ command, unless the ‘-g’ option is used. If a variable - name is followed by =VALUE, the value of the variable is set to - VALUE. + Using ‘+’ instead of ‘-’ turns off the specified attribute instead, + with the exceptions that ‘+a’ and ‘+A’ may not be used to destroy + array variables and ‘+r’ will not remove the readonly attribute. + + When used in a function, ‘declare’ makes each NAME local, as with + the ‘local’ command, unless the ‘-g’ option is supplied. If a + variable name is followed by =VALUE, the value of the variable is + set to VALUE. When using ‘-a’ or ‘-A’ and the compound assignment syntax to create array variables, additional attributes do not take effect @@ -4039,14 +4186,15 @@ standard. Output the ARGs, separated by spaces, terminated with a newline. The return status is 0 unless a write error occurs. If ‘-n’ is - specified, the trailing newline is suppressed. If the ‘-e’ option - is given, interpretation of the following backslash-escaped - characters is enabled. The ‘-E’ option disables the interpretation - of these escape characters, even on systems where they are - interpreted by default. The ‘xpg_echo’ shell option may be used to - dynamically determine whether or not ‘echo’ interprets any options - and expands these escape characters by default. ‘echo’ does not - interpret ‘--’ to mean the end of options. + specified, the trailing newline is not printed. + + If the ‘-e’ option is given, ‘echo’ interprets the following + backslash-escaped characters. The ‘-E’ option disables + interpretation of these escape characters, even on systems where + they are interpreted by default. The ‘xpg_echo’ shell option + determines whether or not ‘echo’ interprets any options and expands + these escape characters. ‘echo’ does not interpret ‘--’ to mean + the end of options. ‘echo’ interprets the following escape sequences: ‘\a’ @@ -4083,36 +4231,38 @@ standard. the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value HHHHHHHH (one to eight hex digits) + ‘echo’ writes any unrecognized backslash-escaped characters + unchanged. + ‘enable’ enable [-a] [-dnps] [-f FILENAME] [NAME ...] Enable and disable builtin shell commands. Disabling a builtin - allows a disk command which has the same name as a shell builtin to - be executed without specifying a full pathname, even though the - shell normally searches for builtins before disk commands. If ‘-n’ - is used, the NAMEs become disabled. Otherwise NAMEs are enabled. - For example, to use the ‘test’ binary found via ‘$PATH’ instead of - the shell builtin version, type ‘enable -n test’. - - If the ‘-p’ option is supplied, or no NAME arguments appear, a list - of shell builtins is printed. With no other arguments, the list - consists of all enabled shell builtins. The ‘-a’ option means to - list each builtin with an indication of whether or not it is - enabled. + allows an executable file which has the same name as a shell + builtin to be executed without specifying a full pathname, even + though the shell normally searches for builtins before files. + + If ‘-n’ is supplied, the NAMEs are disabled. Otherwise NAMEs are + enabled. For example, to use the ‘test’ binary found using ‘$PATH’ + instead of the shell builtin version, type ‘enable -n test’. + + If the ‘-p’ option is supplied, or no NAME arguments are supplied, + print a list of shell builtins. With no other arguments, the list + consists of all enabled shell builtins. The ‘-n’ option means to + print only disabled builtins. The ‘-a’ option means to list each + builtin with an indication of whether or not it is enabled. The + ‘-s’ option means to restrict ‘enable’ to the POSIX special + builtins. The ‘-f’ option means to load the new builtin command NAME from shared object FILENAME, on systems that support dynamic loading. - Bash will use the value of the ‘BASH_LOADABLES_PATH’ variable as a - colon-separated list of directories in which to search for - FILENAME, if FILENAME does not contain a slash. The default is - system-dependent, and may include "." to force a search of the - current directory. The ‘-d’ option will delete a builtin loaded - with ‘-f’. - - If there are no options, a list of the shell builtins is displayed. - The ‘-s’ option restricts ‘enable’ to the POSIX special builtins. - If ‘-s’ is used with ‘-f’, the new builtin becomes a special - builtin (*note Special Builtins::). + If FILENAME does not contain a slash. Bash will use the value of + the ‘BASH_LOADABLES_PATH’ variable as a colon-separated list of + directories in which to search for FILENAME. The default for + ‘BASH_LOADABLES_PATH’ is system-dependent, and may include "." to + force a search of the current directory. The ‘-d’ option will + delete a builtin loaded with ‘-f’. If ‘-s’ is used with ‘-f’, the + new builtin becomes a special builtin (*note Special Builtins::). If no options are supplied and a NAME is not a shell builtin, ‘enable’ will attempt to load NAME from a shared object named NAME, @@ -4126,7 +4276,8 @@ standard. Display helpful information about builtin commands. If PATTERN is specified, ‘help’ gives detailed help on all commands matching - PATTERN, otherwise a list of the builtins is printed. + PATTERN, otherwise it displays a list of all builtins and shell + compound commands. Options, if supplied, have the following meanings: @@ -4144,25 +4295,34 @@ standard. let EXPRESSION [EXPRESSION ...] The ‘let’ builtin allows arithmetic to be performed on shell - variables. Each EXPRESSION is evaluated according to the rules - given below in *note Shell Arithmetic::. If the last EXPRESSION - evaluates to 0, ‘let’ returns 1; otherwise 0 is returned. + variables. Each EXPRESSION is evaluated as an arithmetic + expression according to the rules given below in *note Shell + Arithmetic::. If the last EXPRESSION evaluates to 0, ‘let’ returns + 1; otherwise ‘let’ returns 0. ‘local’ local [OPTION] NAME[=VALUE] ... - For each argument, a local variable named NAME is created, and - assigned VALUE. The OPTION can be any of the options accepted by + For each argument, create a local variable named NAME, and assign + it VALUE. The OPTION can be any of the options accepted by ‘declare’. ‘local’ can only be used within a function; it makes the variable NAME have a visible scope restricted to that function - and its children. If NAME is ‘-’, the set of shell options is made - local to the function in which ‘local’ is invoked: shell options - changed using the ‘set’ builtin inside the function after the call - to ‘local’ are restored to their original values when the function - returns. The restore is effected as if a series of ‘set’ commands + and its children. It is an error to use ‘local’ when not within a + function. + + If NAME is ‘-’, it makes the set of shell options local to the + function in which ‘local’ is invoked: any shell options changed + using the ‘set’ builtin inside the function after the call to + ‘local’ are restored to their original values when the function + returns. The restore is performed as if a series of ‘set’ commands were executed to restore the values that were in place before the - function. The return status is zero unless ‘local’ is used outside - a function, an invalid NAME is supplied, or NAME is a readonly + function. + + With no operands, ‘local’ writes a list of local variables to the + standard output. + + The return status is zero unless ‘local’ is used outside a + function, an invalid NAME is supplied, or NAME is a readonly variable. ‘logout’ @@ -4174,18 +4334,17 @@ standard. mapfile [-d DELIM] [-n COUNT] [-O ORIGIN] [-s COUNT] [-t] [-u FD] [-C CALLBACK] [-c QUANTUM] [ARRAY] - Read lines from the standard input into the indexed array variable - ARRAY, or from file descriptor FD if the ‘-u’ option is supplied. + Read lines from the standard input, or from file descriptor FD if + the ‘-u’ option is supplied, into the indexed array variable ARRAY. The variable ‘MAPFILE’ is the default ARRAY. Options, if supplied, have the following meanings: ‘-d’ - The first character of DELIM is used to terminate each input - line, rather than newline. If DELIM is the empty string, - ‘mapfile’ will terminate a line when it reads a NUL character. + Use the first character of DELIM to terminate each input line, + rather than newline. If DELIM is the empty string, ‘mapfile’ + will terminate a line when it reads a NUL character. ‘-n’ - Copy at most COUNT lines. If COUNT is 0, all lines are - copied. + Copy at most COUNT lines. If COUNT is 0, copy all lines. ‘-O’ Begin assigning to ARRAY at index ORIGIN. The default index is 0. @@ -4212,17 +4371,16 @@ standard. If not supplied with an explicit origin, ‘mapfile’ will clear ARRAY before assigning to it. - ‘mapfile’ returns successfully unless an invalid option or option - argument is supplied, ARRAY is invalid or unassignable, or ARRAY is - not an indexed array. + ‘mapfile’ returns zero unless an invalid option or option argument + is supplied, ARRAY is invalid or unassignable, or if ARRAY is not + an indexed array. ‘printf’ printf [-v VAR] FORMAT [ARGUMENTS] Write the formatted ARGUMENTS to the standard output under the - control of the FORMAT. The ‘-v’ option causes the output to be - assigned to the variable VAR rather than being printed to the - standard output. + control of the FORMAT. The ‘-v’ option assigns the output to the + variable VAR rather than printing it to the standard output. The FORMAT is a character string which contains three types of objects: plain characters, which are simply copied to standard @@ -4253,11 +4411,12 @@ standard. Causes ‘printf’ to output the date-time string resulting from using DATEFMT as a format string for ‘strftime’(3). The corresponding ARGUMENT is an integer representing the number - of seconds since the epoch. Two special argument values may - be used: -1 represents the current time, and -2 represents the - time the shell was invoked. If no argument is specified, - conversion behaves as if -1 had been given. This is an - exception to the usual ‘printf’ behavior. + of seconds since the epoch. This format specifier recognizes + Two special argument values: -1 represents the current time, + and -2 represents the time the shell was invoked. If no + argument is specified, conversion behaves as if -1 had been + supplied. This is an exception to the usual ‘printf’ + behavior. The %b, %q, and %T format specifiers all use the field width and precision arguments from the format specification and write that @@ -4290,19 +4449,19 @@ standard. read [-Eers] [-a ANAME] [-d DELIM] [-i TEXT] [-n NCHARS] [-N NCHARS] [-p PROMPT] [-t TIMEOUT] [-u FD] [NAME ...] - One line is read from the standard input, or from the file - descriptor FD supplied as an argument to the ‘-u’ option, split - into words as described above in *note Word Splitting::, and the - first word is assigned to the first NAME, the second word to the - second NAME, and so on. If there are more words than names, the - remaining words and their intervening delimiters are assigned to - the last NAME. If there are fewer words read from the input stream - than names, the remaining names are assigned empty values. The - characters in the value of the ‘IFS’ variable are used to split the - line into words using the same rules the shell uses for expansion - (described above in *note Word Splitting::). The backslash - character ‘\’ may be used to remove any special meaning for the - next character read and for line continuation. + Read one line from the standard input, or from the file descriptor + FD supplied as an argument to the ‘-u’ option, split it into words + as described above in *note Word Splitting::, and assign the first + word to the first NAME, the second word to the second NAME, and so + on. If there are more words than names, the remaining words and + their intervening delimiters are assigned to the last NAME. If + there are fewer words read from the input stream than names, the + remaining names are assigned empty values. The characters in the + value of the ‘IFS’ variable are used to split the line into words + using the same rules the shell uses for expansion (described above + in *note Word Splitting::). The backslash character ‘\’ removes + any special meaning for the next character read and is used for + line continuation. Options, if supplied, have the following meanings: @@ -4313,45 +4472,48 @@ standard. ignored. ‘-d DELIM’ - The first character of DELIM is used to terminate the input - line, rather than newline. If DELIM is the empty string, - ‘read’ will terminate a line when it reads a NUL character. + The first character of DELIM terminates the input line, rather + than newline. If DELIM is the empty string, ‘read’ will + terminate a line when it reads a NUL character. ‘-e’ - Readline (*note Command Line Editing::) is used to obtain the - line. Readline uses the current (or default, if line editing - was not previously active) editing settings, but uses - Readline's default filename completion. + If the standard input is coming from a terminal, ‘read’ uses + Readline (*note Command Line Editing::) to obtain the line. + Readline uses the current (or default, if line editing was not + previously active) editing settings, but uses Readline's + default filename completion. ‘-E’ - Readline (*note Command Line Editing::) is used to obtain the - line. Readline uses the current (or default, if line editing - was not previously active) editing settings, but uses Bash's - default completion, including programmable completion. + If the standard input is coming from a terminal, ‘read’ uses + Readline (*note Command Line Editing::) to obtain the line. + Readline uses the current (or default, if line editing was not + previously active) editing settings, but uses Bash's default + completion, including programmable completion. ‘-i TEXT’ - If Readline is being used to read the line, TEXT is placed + If Readline is being used to read the line, ‘read’ places TEXT into the editing buffer before editing begins. ‘-n NCHARS’ ‘read’ returns after reading NCHARS characters rather than - waiting for a complete line of input, but honors a delimiter - if fewer than NCHARS characters are read before the delimiter. + waiting for a complete line of input, unless it encounters EOF + or ‘read’ times out, but honors a delimiter if it reads fewer + than NCHARS characters before the delimiter. ‘-N NCHARS’ ‘read’ returns after reading exactly NCHARS characters rather - than waiting for a complete line of input, unless EOF is - encountered or ‘read’ times out. Delimiter characters - encountered in the input are not treated specially and do not - cause ‘read’ to return until NCHARS characters are read. The - result is not split on the characters in ‘IFS’; the intent is - that the variable is assigned exactly the characters read - (with the exception of backslash; see the ‘-r’ option below). + than waiting for a complete line of input, unless it + encounters EOF or ‘read’ times out. Delimiter characters in + the input are not treated specially and do not cause ‘read’ to + return until it has read NCHARS characters. The result is not + split on the characters in ‘IFS’; the intent is that the + variable is assigned exactly the characters read (with the + exception of backslash; see the ‘-r’ option below). ‘-p PROMPT’ Display PROMPT, without a trailing newline, before attempting - to read any input. The prompt is displayed only if input is - coming from a terminal. + to read any input, but only if input is coming from a + terminal. ‘-r’ If this option is given, backslash does not act as an escape @@ -4364,33 +4526,35 @@ standard. are not echoed. ‘-t TIMEOUT’ - Cause ‘read’ to time out and return failure if a complete line - of input (or a specified number of characters) is not read - within TIMEOUT seconds. TIMEOUT may be a decimal number with - a fractional portion following the decimal point. This option - is only effective if ‘read’ is reading input from a terminal, - pipe, or other special file; it has no effect when reading - from regular files. If ‘read’ times out, ‘read’ saves any - partial input read into the specified variable NAME. If - TIMEOUT is 0, ‘read’ returns immediately, without trying to - read any data. The exit status is 0 if input is available on - the specified file descriptor, or the read will return EOF, - non-zero otherwise. The exit status is greater than 128 if - the timeout is exceeded. + Cause ‘read’ to time out and return failure if it does not + read a complete line of input (or a specified number of + characters) within TIMEOUT seconds. TIMEOUT may be a decimal + number with a fractional portion following the decimal point. + This option is only effective if ‘read’ is reading input from + a terminal, pipe, or other special file; it has no effect when + reading from regular files. If ‘read’ times out, it saves any + partial input read into the specified variable NAME, and + returns a status greater than 128. If TIMEOUT is 0, ‘read’ + returns immediately, without trying to read any data. In this + case, the exit status is 0 if input is available on the + specified file descriptor, or the read will return EOF, + non-zero otherwise. ‘-u FD’ - Read input from file descriptor FD. + Read input from file descriptor FD instead of the standard + input. Other than the case where DELIM is the empty string, ‘read’ ignores any NUL characters in the input. - If no NAMEs are supplied, the line read, without the ending - delimiter but otherwise unmodified, is assigned to the variable - ‘REPLY’. The exit status is zero, unless end-of-file is - encountered, ‘read’ times out (in which case the status is greater - than 128), a variable assignment error (such as assigning to a - readonly variable) occurs, or an invalid file descriptor is - supplied as the argument to ‘-u’. + If no NAMEs are supplied, ‘read’ assigns the line read, without the + ending delimiter but otherwise unmodified, to the variable ‘REPLY’. + + The exit status is zero, unless end-of-file is encountered, ‘read’ + times out (in which case the status is greater than 128), a + variable assignment error (such as assigning to a readonly + variable) occurs, or an invalid file descriptor is supplied as the + argument to ‘-u’. ‘readarray’ readarray [-d DELIM] [-n COUNT] [-O ORIGIN] [-s COUNT] @@ -4409,19 +4573,18 @@ standard. ‘type’ type [-afptP] [NAME ...] - For each NAME, indicate how it would be interpreted if used as a - command name. + Indicate how each NAME would be interpreted if used as a command + name. If the ‘-t’ option is used, ‘type’ prints a single word which is one of ‘alias’, ‘keyword’, ‘function’, ‘builtin’, or ‘file’, if NAME is an alias, shell reserved word, shell function, shell - builtin, or executable disk file, respectively. If the NAME is not - found, then nothing is printed, and ‘type’ returns a failure - status. + builtin, or executable file, respectively. If the NAME is not + found, ‘type’ prints nothing and returns a failure status. If the ‘-p’ option is used, ‘type’ either returns the name of the - executable file that would be found by searching ‘$PATH’, or - nothing if ‘-t’ would not return ‘file’. + executable file that would be found by searching ‘$PATH’ for + ‘name’, or nothing if ‘-t’ would not return ‘file’. The ‘-P’ option forces a path search for each NAME, even if ‘-t’ would not return ‘file’. @@ -4454,9 +4617,9 @@ standard. ulimit [-HS] -a ulimit [-HS] [-bcdefiklmnpqrstuvxPRT] [LIMIT] - ‘ulimit’ provides control over the resources available to processes - started by the shell, on systems that allow such control. If an - option is given, it is interpreted as follows: + ‘ulimit’ provides control over the resources available to the shell + and to processes it starts, on systems that allow such control. If + an option is given, it is interpreted as follows: ‘-S’ Change and report the soft limit associated with a resource. @@ -4465,7 +4628,7 @@ standard. Change and report the hard limit associated with a resource. ‘-a’ - All current limits are reported; no limits are set. + Report all current limits; no limits are set. ‘-b’ The maximum socket buffer size. @@ -4535,23 +4698,25 @@ standard. ‘-T’ The maximum number of threads. - If LIMIT is given, and the ‘-a’ option is not used, LIMIT is the + If LIMIT is supplied, and the ‘-a’ option is not used, LIMIT is the new value of the specified resource. The special LIMIT values ‘hard’, ‘soft’, and ‘unlimited’ stand for the current hard limit, the current soft limit, and no limit, respectively. A hard limit cannot be increased by a non-root user once it is set; a soft limit - may be increased up to the value of the hard limit. Otherwise, the - current value of the soft limit for the specified resource is - printed, unless the ‘-H’ option is supplied. When more than one - resource is specified, the limit name and unit, if appropriate, are - printed before the value. When setting new limits, if neither ‘-H’ - nor ‘-S’ is supplied, both the hard and soft limits are set. If no - option is given, then ‘-f’ is assumed. Values are in 1024-byte - increments, except for ‘-t’, which is in seconds; ‘-R’, which is in - microseconds; ‘-p’, which is in units of 512-byte blocks; ‘-P’, - ‘-T’, ‘-b’, ‘-k’, ‘-n’ and ‘-u’, which are unscaled values; and, - when in POSIX Mode (*note Bash POSIX Mode::), ‘-c’ and ‘-f’, which - are in 512-byte increments. + may be increased up to the value of the hard limit. Otherwise, + ‘ulimit’ prints the current value of the soft limit for the + specified resource, unless the ‘-H’ option is supplied. When more + than one resource is specified, the limit name and unit, if + appropriate, are printed before the value. When setting new + limits, if neither ‘-H’ nor ‘-S’ is supplied, ‘ulimit’ sets both + the hard and soft limits. If no option is supplied, then ‘-f’ is + assumed. + + Values are in 1024-byte increments, except for ‘-t’, which is in + seconds; ‘-R’, which is in microseconds; ‘-p’, which is in units of + 512-byte blocks; ‘-P’, ‘-T’, ‘-b’, ‘-k’, ‘-n’ and ‘-u’, which are + unscaled values; and, when in POSIX Mode (*note Bash POSIX Mode::), + ‘-c’ and ‘-f’, which are in 512-byte increments. The return status is zero unless an invalid option or argument is supplied, or an error occurs while setting a new limit. @@ -4560,7 +4725,9 @@ standard. unalias [-a] [NAME ... ] Remove each NAME from the list of aliases. If ‘-a’ is supplied, - all aliases are removed. Aliases are described in *note Aliases::. + remove all aliases. The return value is true unless a supplied + NAME is not a defined alias. Aliases are described in *note + Aliases::.  File: bashref.info, Node: Modifying Shell Behavior, Next: Special Builtins, Prev: Bash Builtins, Up: Shell Builtin Commands @@ -4597,7 +4764,10 @@ parameters, or to display the names and values of shell variables. variables cannot be reset. In POSIX mode, only shell variables are listed. - When options are supplied, they set or unset shell attributes. + When options are supplied, they set or unset shell attributes. Any + arguments remaining after option processing replace the positional + parameters. + Options, if specified, have the following meanings: ‘-a’ @@ -4608,7 +4778,8 @@ parameters, or to display the names and values of shell variables. ‘-b’ Cause the status of terminated background jobs to be reported immediately, rather than before printing the next primary - prompt. + prompt or, under some circumstances, when a foreground command + exits. This is effective only when job control is enabled. ‘-e’ Exit immediately if a pipeline (*note Pipelines::), which may @@ -4795,7 +4966,7 @@ parameters, or to display the names and values of shell variables. ‘-x’ Print a trace of simple commands, ‘for’ commands, ‘case’ commands, ‘select’ commands, and arithmetic ‘for’ commands and - their arguments or associated word lists to standard error + their arguments or associated word lists to the standard error after they are expanded and before they are executed. The shell prints the expanded value of the ‘PS4’ variable before the command and its expanded arguments. @@ -4806,7 +4977,9 @@ parameters, or to display the names and values of shell variables. ‘-C’ Prevent output redirection using ‘>’, ‘>&’, and ‘<>’ from - overwriting existing files. + overwriting existing files. Using the redirection operator + ‘>|’ instead of ‘>’ will override this and force the creation + of an output file. ‘-E’ If set, any trap on ‘ERR’ is inherited by shell functions, @@ -4820,11 +4993,11 @@ parameters, or to display the names and values of shell variables. shells. ‘-P’ - If set, do not resolve symbolic links when performing commands - such as ‘cd’ which change the current directory. The physical - directory is used instead. By default, Bash follows the - logical chain of directories when performing commands which - change the current directory. + If set, Bash does not resolve symbolic links when executing + commands such as ‘cd’ which change the current directory. It + uses the physical directory structure instead. By default, + Bash follows the logical chain of directories when performing + commands which change the current directory. For example, if ‘/usr/sys’ is a symbolic link to ‘/usr/local/sys’ then: @@ -4840,22 +5013,21 @@ parameters, or to display the names and values of shell variables. /usr/local ‘-T’ - If set, any trap on ‘DEBUG’ and ‘RETURN’ are inherited by + If set, any traps on ‘DEBUG’ and ‘RETURN’ are inherited by shell functions, command substitutions, and commands executed in a subshell environment. The ‘DEBUG’ and ‘RETURN’ traps are normally not inherited in such cases. ‘--’ - If no arguments follow this option, then the positional - parameters are unset. Otherwise, the positional parameters - are set to the ARGUMENTS, even if some of them begin with a - ‘-’. + If no arguments follow this option, unset the positional + parameters. Otherwise, the positional parameters are set to + the ARGUMENTS, even if some of them begin with a ‘-’. ‘-’ - Signal the end of options, cause all remaining ARGUMENTS to be - assigned to the positional parameters. The ‘-x’ and ‘-v’ - options are turned off. If there are no arguments, the - positional parameters remain unchanged. + Signal the end of options, and assign all remaining ARGUMENTS + to the positional parameters. The ‘-x’ and ‘-v’ options are + turned off. If there are no arguments, the positional + parameters remain unchanged. Using ‘+’ rather than ‘-’ causes these options to be turned off. The options can also be used upon invocation of the shell. The @@ -4874,7 +5046,7 @@ File: bashref.info, Node: The Shopt Builtin, Prev: The Set Builtin, Up: Modif 4.3.2 The Shopt Builtin ----------------------- -This builtin allows you to change additional shell optional behavior. +This builtin allows you to change additional optional shell behavior. ‘shopt’ shopt [-pqsu] [-o] [OPTNAME ...] @@ -4883,11 +5055,11 @@ This builtin allows you to change additional shell optional behavior. The settings can be either those listed below, or, if the ‘-o’ option is used, those available with the ‘-o’ option to the ‘set’ builtin command (*note The Set Builtin::). With no options, or - with the ‘-p’ option, a list of all settable options is displayed, - with an indication of whether or not each is set; if OPTNAMEs are + with the ‘-p’ option, display a list of all settable options, with + an indication of whether or not each is set; if any OPTNAMEs are supplied, the output is restricted to those options. The ‘-p’ - option causes output to be displayed in a form that may be reused - as input. Other options have the following meanings: + option displays output in a form that may be reused as input. + Other options have the following meanings: ‘-s’ Enable (set) each OPTNAME. @@ -4898,8 +5070,8 @@ This builtin allows you to change additional shell optional behavior. ‘-q’ Suppresses normal output; the return status indicates whether the OPTNAME is set or unset. If multiple OPTNAME arguments - are given with ‘-q’, the return status is zero if all OPTNAMEs - are enabled; non-zero otherwise. + are supplied with ‘-q’, the return status is zero if all + OPTNAMEs are enabled; non-zero otherwise. ‘-o’ Restricts the values of OPTNAME to be those defined for the @@ -4943,25 +5115,24 @@ This builtin allows you to change additional shell optional behavior. whose value is the directory to change to. ‘cdspell’ - If set, minor errors in the spelling of a directory component - in a ‘cd’ command will be corrected. The errors checked for - are transposed characters, a missing character, and a - character too many. If a correction is found, the corrected - path is printed, and the command proceeds. This option is + If set, the ‘cd’ command attempts to correct minor errors in + the spelling of a directory component. Minor errors include + transposed characters, a missing character, and one extra + character. If ‘cd’ corrects the directory name, it prints the + corrected filename, and the command proceeds. This option is only used by interactive shells. ‘checkhash’ If this is set, Bash checks that a command found in the hash table exists before trying to execute it. If a hashed command - no longer exists, a normal path search is performed. + no longer exists, Bash performs a normal path search. ‘checkjobs’ If set, Bash lists the status of any stopped and running jobs before exiting an interactive shell. If any jobs are running, - this causes the exit to be deferred until a second exit is - attempted without an intervening command (*note Job - Control::). The shell always postpones exiting if any jobs - are stopped. + Bash defers the exit until a second exit is attempted without + an intervening command (*note Job Control::). The shell + always postpones exiting if any jobs are stopped. ‘checkwinsize’ If set, Bash checks the window size after each external @@ -5013,15 +5184,14 @@ This builtin allows you to change additional shell optional behavior. supplied does not exist. ‘dotglob’ - If set, Bash includes filenames beginning with a '.' in the + If set, Bash includes filenames beginning with a ‘.’ in the results of filename expansion. The filenames ‘.’ and ‘..’ must always be matched explicitly, even if ‘dotglob’ is set. ‘execfail’ If this is set, a non-interactive shell will not exit if it cannot execute the file specified as an argument to the ‘exec’ - builtin command. An interactive shell does not exit if ‘exec’ - fails. + builtin. An interactive shell does not exit if ‘exec’ fails. ‘expand_aliases’ If set, aliases are expanded as described below under Aliases, @@ -5060,8 +5230,8 @@ This builtin allows you to change additional shell optional behavior. inherit the ‘ERR’ trap. ‘extglob’ - If set, the extended pattern matching features described above - (*note Pattern Matching::) are enabled. + If set, enable the extended pattern matching features + described above (*note Pattern Matching::). ‘extquote’ If set, ‘$'STRING'’ and ‘$"STRING"’ quoting is performed @@ -5083,10 +5253,10 @@ This builtin allows you to change additional shell optional behavior. If set, range expressions used in pattern matching bracket expressions (*note Pattern Matching::) behave as if in the traditional C locale when performing comparisons. That is, - the current locale's collating sequence is not taken into - account, so ‘b’ will not collate between ‘A’ and ‘B’, and - upper-case and lower-case ASCII characters will collate - together. + pattern matching does not take the current locale's collating + sequence into account, so ‘b’ will not collate between ‘A’ and + ‘B’, and upper-case and lower-case ASCII characters will + collate together. ‘globskipdots’ If set, filename expansion will never match the filenames ‘.’ @@ -5109,7 +5279,7 @@ This builtin allows you to change additional shell optional behavior. than overwriting the file. ‘histreedit’ - If set, and Readline is being used, a user is given the + If set, and Readline is being used, the user is given the opportunity to re-edit a failed history substitution. ‘histverify’ @@ -5135,9 +5305,10 @@ This builtin allows you to change additional shell optional behavior. enabled. ‘interactive_comments’ - Allow a word beginning with ‘#’ to cause that word and all - remaining characters on that line to be ignored in an - interactive shell. This option is enabled by default. + In an interactive shell, a word beginning with ‘#’ causes that + word and all remaining characters on that line to be ignored, + as in a non-interactive shell. This option is enabled by + default. ‘lastpipe’ If set, and job control is not active, the shell runs the last @@ -5168,13 +5339,13 @@ This builtin allows you to change additional shell optional behavior. ‘mailwarn’ If set, and a file that Bash is checking for mail has been - accessed since the last time it was checked, the message ‘"The - mail in MAILFILE has been read"’ is displayed. + accessed since the last time it was checked, Bash displays the + message ‘"The mail in MAILFILE has been read"’. ‘no_empty_cmd_completion’ - If set, and Readline is being used, Bash will not attempt to - search the ‘PATH’ for possible completions when completion is - attempted on an empty line. + If set, and Readline is being used, Bash does not search the + ‘PATH’ for possible completions when completion is attempted + on an empty line. ‘nocaseglob’ If set, Bash matches filenames in a case-insensitive fashion @@ -5205,9 +5376,9 @@ This builtin allows you to change additional shell optional behavior. Expansion::). This option is enabled by default. ‘progcomp’ - If set, the programmable completion facilities (*note - Programmable Completion::) are enabled. This option is - enabled by default. + If set, enable the programmable completion facilities (*note + Programmable Completion::). This option is enabled by + default. ‘progcomp_alias’ If set, and programmable completion is enabled, Bash treats a @@ -5315,10 +5486,12 @@ In some cases, Bash assigns a default value to the variable. ‘IFS’ A list of characters that separate fields; used when the shell - splits words as part of expansion. + splits words as part of expansion and by the ‘read’ builtin to + split lines into words. *Note Word Splitting::, for a description + of word splitting. ‘MAIL’ - If this parameter is set to a filename or directory name and the + If the value is set to a filename or directory name and the ‘MAILPATH’ variable is not set, Bash informs the user of the arrival of mail in the specified file or Maildir-format directory. @@ -5334,7 +5507,7 @@ In some cases, Bash assigns a default value to the variable. builtin. ‘OPTIND’ - The index of the last option argument processed by the ‘getopts’ + The index of the next argument to be processed by the ‘getopts’ builtin. ‘PATH’ @@ -5342,6 +5515,9 @@ In some cases, Bash assigns a default value to the variable. commands. A zero-length (null) directory name in the value of ‘PATH’ 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 set by the + administrator who installs ‘bash’. A common value is + "/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin". ‘PS1’ The primary prompt string. The default value is ‘\s-\v\$ ’. *Note @@ -5366,13 +5542,14 @@ variables for controlling the job control facilities (*note Job Control Variables::). ‘_’ - ($_, an underscore.) At shell startup, set to the pathname used to - invoke the shell or shell script being executed as passed in the - environment or argument list. Subsequently, expands to the last + ($_, an underscore.) This has a number of meanings depending on + context. At shell startup, $_ set to the pathname used to invoke + the shell or shell script being executed as passed in the + environment or argument list. Subsequently, it expands to the last argument to the previous simple command executed in the foreground, - after expansion. Also set to the full pathname used to invoke each - command executed and placed in the environment exported to that - command. When checking mail, this parameter holds the name of the + after expansion. It is also set to the full pathname used to + invoke each command executed and placed in the environment exported + to that command. When checking mail, $_ expands to the name of the mail file. ‘BASH’ @@ -5383,9 +5560,9 @@ Variables::). list is a valid argument for the ‘-s’ option to the ‘shopt’ builtin 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, each shell option in the - list will be enabled before reading any startup files. This - variable is readonly. + 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. ‘BASHPID’ Expands to the process ID of the current Bash process. This @@ -5412,7 +5589,7 @@ Variables::). onto ‘BASH_ARGC’. The shell sets ‘BASH_ARGC’ only when in extended debugging mode (see *note The Shopt Builtin:: for a description of the ‘extdebug’ option to the ‘shopt’ builtin). Setting ‘extdebug’ - after the shell has started to execute a script, or referencing + after the shell has started to execute a subroutine, or referencing this variable when ‘extdebug’ is not set, may result in inconsistent values. Assignments to ‘BASH_ARGC’ have no effect, and it may not be unset. @@ -5422,37 +5599,37 @@ Variables::). Bash execution call stack. The final parameter of the last subroutine call is at the top of the stack; the first parameter of the initial call is at the bottom. When a subroutine is executed, - the parameters supplied are pushed onto ‘BASH_ARGV’. The shell - sets ‘BASH_ARGV’ only when in extended debugging mode (see *note - The Shopt Builtin:: for a description of the ‘extdebug’ option to - the ‘shopt’ builtin). Setting ‘extdebug’ after the shell has - started to execute a script, or referencing this variable when + the shell pushes the supplied parameters onto ‘BASH_ARGV’. The + shell sets ‘BASH_ARGV’ only when in extended debugging mode (see + *note The Shopt Builtin:: for a description of the ‘extdebug’ + option to the ‘shopt’ builtin). Setting ‘extdebug’ after the shell + has started to execute a script, or referencing this variable when ‘extdebug’ is not set, may result in inconsistent values. Assignments to ‘BASH_ARGV’ have no effect, and it may not be unset. ‘BASH_ARGV0’ When referenced, this variable expands to the name of the shell or shell script (identical to ‘$0’; *Note Special Parameters::, for - the description of special parameter 0). Assignment to - ‘BASH_ARGV0’ causes the value assigned to also be assigned to ‘$0’. - If ‘BASH_ARGV0’ is unset, it loses its special properties, even if - it is subsequently reset. + the description of special parameter 0). Assigning a value to + ‘BASH_ARGV0’ assigns the same value to ‘$0’. If ‘BASH_ARGV0’ is + unset, it loses its special properties, even if it is subsequently + reset. ‘BASH_CMDS’ An associative array variable whose members correspond to the internal hash table of commands as maintained by the ‘hash’ builtin - (*note Bourne Shell Builtins::). Elements added to this array - appear in the hash table; however, unsetting array elements - currently does not cause command names to be removed from the hash + (*note Bourne Shell Builtins::). 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 ‘BASH_CMDS’ is unset, it loses its special properties, even if it is subsequently reset. ‘BASH_COMMAND’ - 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 - ‘BASH_COMMAND’ is unset, it loses its special properties, even if - it is subsequently reset. + 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 ‘BASH_COMMAND’ is unset, it loses its special + properties, even if it is subsequently reset. ‘BASH_COMPAT’ The value is used to set the shell's compatibility level. *Note @@ -5473,8 +5650,8 @@ Variables::). ‘BASH_ENV’ If this variable is set when Bash is invoked to execute a shell script, its value is expanded and used as the name of a startup - file to read before executing the script. *Note Bash Startup - Files::. + file to read before executing the script. Bash does not use ‘PATH’ + to search for the resultant filename. *Note Bash Startup Files::. ‘BASH_EXECUTION_STRING’ The command argument to the ‘-c’ invocation option. @@ -5490,8 +5667,8 @@ Variables::). unset. ‘BASH_LOADABLES_PATH’ - A colon-separated list of directories in which the shell looks for - dynamically loadable builtins specified by the ‘enable’ command. + A colon-separated list of directories in which the ‘enable’ command + looks for dynamically loadable builtins. ‘BASH_MONOSECONDS’ Each time this variable is referenced, it expands to the value @@ -5552,7 +5729,8 @@ Variables::). The value of ‘MACHTYPE’. ‘BASH_VERSION’ - The version number of the current instance of Bash. + Expands to a string describing the version of this instance of Bash + (e.g., 5.2.37(3)-release). ‘BASH_XTRACEFD’ If set to an integer corresponding to a valid file descriptor, Bash @@ -5584,6 +5762,12 @@ Variables::). functions invoked by the programmable completion facilities (*note Programmable Completion::). +‘COMP_KEY’ + The key (or final key of a key sequence) used to invoke the current + completion function. This variable is available only in shell + functions and external commands invoked by the programmable + completion facilities (*note Programmable Completion::). + ‘COMP_LINE’ The current command line. This variable is available only in shell functions and external commands invoked by the programmable @@ -5598,8 +5782,8 @@ Variables::). completion facilities (*note Programmable Completion::). ‘COMP_TYPE’ - Set to an integer value corresponding to the type of completion - attempted that caused a completion function to be called: , + Set to an integer value corresponding to the type of attempted + completion that caused a completion function to be called: , for normal completion, ‘?’, for listing completions after successive tabs, ‘!’, for listing alternatives on partial word completion, ‘@’, to list completions if the word is not unmodified, @@ -5607,10 +5791,6 @@ Variables::). shell functions and external commands invoked by the programmable completion facilities (*note Programmable Completion::). -‘COMP_KEY’ - The key (or final key of a key sequence) used to invoke the current - completion function. - ‘COMP_WORDBREAKS’ The set of characters that the Readline library treats as word separators when performing word completion. If ‘COMP_WORDBREAKS’ @@ -5646,8 +5826,8 @@ Variables::). ‘EMACS’ If Bash 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. + starts, and its value is ‘t’, Bash assumes that the shell is + running in an Emacs shell buffer and disables line editing. ‘ENV’ Expanded and executed similarly to ‘BASH_ENV’ (*note Bash Startup @@ -5675,20 +5855,18 @@ Variables::). ‘EXECIGNORE’ A colon-separated list of shell patterns (*note Pattern Matching::) - defining the list of filenames to be ignored by command search - using ‘PATH’. Files whose full pathnames match one of these - patterns are not considered executable files for the purposes of - completion and command execution via ‘PATH’ lookup. This does not - affect the behavior of the ‘[’, ‘test’, and ‘[[’ commands. Full - pathnames in the command hash table are not subject to - ‘EXECIGNORE’. 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 ‘extglob’ shell - option. + defining the set of filenames to be ignored by command search using + ‘PATH’. Files whose full pathnames match one of these patterns are + not considered executable files for the purposes of completion and + command execution via ‘PATH’ lookup. This does not affect the + behavior of the ‘[’, ‘test’, and ‘[[’ commands. Full pathnames in + the command hash table are not subject to ‘EXECIGNORE’. 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 ‘extglob’ shell option. ‘FCEDIT’ - The editor used as a default by the ‘-e’ option to the ‘fc’ builtin - command. + The editor used as a default by the ‘fc’ builtin command. ‘FIGNORE’ A colon-separated list of suffixes to ignore when performing @@ -5714,9 +5892,9 @@ Variables::). information. ‘FUNCNEST’ - If set to a numeric value greater than 0, defines a maximum - function nesting level. Function invocations that exceed this - nesting level will cause the current command to abort. + A numeric value greater than 0 defines a maximum function nesting + level. Function invocations that exceed this nesting level will + cause the current command to abort. ‘GLOBIGNORE’ A colon-separated list of patterns defining the set of file names @@ -5726,7 +5904,7 @@ Variables::). matching honors the setting of the ‘extglob’ shell option. ‘GLOBSORT’ - Control how the results of filename expansion are sorted. The + Controls how the results of filename expansion are sorted. The value of this variable specifies the sort criteria and sort order for the results of filename expansion. If this variable is unset or set to the null string, filename expansion uses the historical @@ -5792,7 +5970,7 @@ Variables::). on the history list. If the list of values includes ‘ignorespace’, lines which begin with a space character are not saved in the history list. A value of ‘ignoredups’ causes lines which match the - previous history entry to not be saved. A value of ‘ignoreboth’ is + previous history entry not to be saved. A value of ‘ignoreboth’ is shorthand for ‘ignorespace’ and ‘ignoredups’. A value of ‘erasedups’ causes all previous lines matching the current line to be removed from the history list before that line is saved. Any @@ -5801,23 +5979,26 @@ Variables::). parser are saved on the history list, subject to the value of ‘HISTIGNORE’. The second and subsequent lines of a multi-line compound command are not tested, and are added to the history - regardless of the value of ‘HISTCONTROL’. + regardless of the value of ‘HISTCONTROL’ if the first line of the + command was saved. If the first line was not saved, the second and + subsequent lines of the command are not saved, either. ‘HISTFILE’ The name of the file to which the command history is saved. Bash assigns a default value of ‘~/.bash_history’. If ‘HISTFILE’ is - unset or null, the command history is not saved when a shell exits. + unset or null, the shell does not save the command history when it + exits. ‘HISTFILESIZE’ The maximum number of lines contained in the history file. When this variable is assigned a value, the history file is truncated, 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. 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 ‘HISTSIZE’ after reading any - startup files. + this size after writing it when a shell exits or by the ‘history’ + 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 + ‘HISTSIZE’ after reading any startup files. ‘HISTIGNORE’ A colon-separated list of patterns used to decide which command @@ -5832,12 +6013,14 @@ Variables::). backslash; the backslash is removed before attempting a match. The second and subsequent lines of a multi-line compound command are not tested, and are added to the history regardless of the value of - ‘HISTIGNORE’. The pattern matching honors the setting of the + ‘HISTIGNORE’, if the first line was saved. If the first line was + not saved, the second and subsequent lines of the command are not + saved, either. The pattern matching honors the setting of the ‘extglob’ shell option. - ‘HISTIGNORE’ subsumes the function of ‘HISTCONTROL’. A pattern of - ‘&’ is identical to ‘ignoredups’, and a pattern of ‘[ ]*’ is - identical to ‘ignorespace’. Combining these two patterns, + ‘HISTIGNORE’ subsumes some of the function of ‘HISTCONTROL’. A + pattern of ‘&’ is identical to ‘ignoredups’, and a pattern of ‘[ + ]*’ is identical to ‘ignorespace’. Combining these two patterns, separating them with a colon, provides the functionality of ‘ignoreboth’. @@ -5852,10 +6035,10 @@ Variables::). If this variable is set and not null, its value is used as a format string for ‘strftime’(3) to print the time stamp associated with each history entry displayed by the ‘history’ builtin. If this - variable is set, time stamps are written to the history file so - they may be preserved across shell sessions. This uses the history - comment character to distinguish timestamps from other history - lines. + variable is set, the shell writes time stamps to the history file + so they may be preserved across shell sessions. This uses the + history comment character to distinguish timestamps from other + history lines. ‘HOSTFILE’ Contains the name of a file in the same format as ‘/etc/hosts’ that @@ -5876,13 +6059,12 @@ Variables::). ‘IGNOREEOF’ Controls the action of the shell on receipt of an ‘EOF’ character - as the sole input. If set, the value denotes the number of - consecutive ‘EOF’ characters that can be read as the first - character on an input line before the shell will exit. If the - variable exists but does not have a numeric value, or has no value, - then the default is 10. If the variable does not exist, then ‘EOF’ - signifies the end of input to the shell. This is only in effect - for interactive shells. + as the sole input. If set, the value is the number of consecutive + ‘EOF’ characters that can be read as the first character on an + input line before Bash exits. If the variable is set but does not + have a numeric value, or the value is null, then the default is 10. + If the variable is unset, then ‘EOF’ signifies the end of input to + the shell. This is only in effect for interactive shells. ‘INPUTRC’ The name of the Readline initialization file, overriding the @@ -5928,8 +6110,10 @@ Variables::). ‘LINENO’ The line number in the script or shell function currently - executing. If ‘LINENO’ is unset, it loses its special properties, - even if it is subsequently reset. + executing. Line numbers start with 1. When not in a script or + function, the value is not guaranteed to be meaningful. If + ‘LINENO’ is unset, it loses its special properties, even if it is + subsequently reset. ‘LINES’ Used by the ‘select’ command to determine the column length for @@ -5958,7 +6142,8 @@ Variables::). ‘OPTERR’ If set to the value 1, Bash displays error messages generated by - the ‘getopts’ builtin command. + the ‘getopts’ builtin command. ‘OPTERR’ is initialized to 1 each + time the shell is invoked. ‘OSTYPE’ A string describing the operating system Bash is running on. @@ -6019,8 +6204,10 @@ Variables::). ‘RANDOM’ Each time this parameter is referenced, it expands to a random integer between 0 and 32767. Assigning a value to this variable - seeds the random number generator. If ‘RANDOM’ is unset, it loses - its special properties, even if it is subsequently reset. + initializes (seeds) the random number generator. Seeding the + random number generator with the same constant value will produce + the same sequence of values. If ‘RANDOM’ is unset, it loses its + special properties, even if it is subsequently reset. ‘READLINE_ARGUMENT’ Any numeric argument given to a Readline command that was defined @@ -6041,7 +6228,8 @@ Variables::). for use with ‘bind -x’ (*note Bash Builtins::). ‘REPLY’ - The default variable for the ‘read’ builtin. + The default variable for the ‘read’ builtin; set to the line read + when ‘read’ is not supplied a variable name argument. ‘SECONDS’ This variable expands to the number of seconds since the shell was @@ -6063,9 +6251,9 @@ Variables::). list is a valid argument for the ‘-o’ option to the ‘set’ builtin command (*note The Set Builtin::). The options appearing in ‘SHELLOPTS’ are those reported as ‘on’ by ‘set -o’. If this - variable is in the environment when Bash starts up, each shell - option in the list will be enabled before reading any startup - files. This variable is readonly. + 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. ‘SHLVL’ Incremented by one each time a new instance of Bash is started. @@ -6106,9 +6294,10 @@ Variables::). The optional P is a digit specifying the precision, the number of fractional digits after a decimal point. A value of 0 causes no - decimal point or fraction to be output. At most six places after - the decimal point may be specified; values of P greater than 6 are - changed to 6. If P is not specified, the value 3 is used. + decimal point or fraction to be output. ‘time’ will print at most + six digits after the decimal point; values of P greater than 6 are + changed to 6. If P is not specified, ‘time’ prints three digits + after the decimal point. The optional ‘l’ specifies a longer format, including minutes, of the form MMmSS.FFs. The value of P determines whether or not the @@ -6120,11 +6309,11 @@ Variables::). A trailing newline is added when the format string is displayed. ‘TMOUT’ - If set to a value greater than zero, ‘TMOUT’ is treated as the - default timeout for the ‘read’ builtin (*note Bash Builtins::). - The ‘select’ command (*note Conditional Constructs::) terminates if - input does not arrive after ‘TMOUT’ seconds when input is coming - from a terminal. + If set to a value greater than zero, the ‘read’ builtin uses the + value as its default timeout (*note Bash Builtins::). The ‘select’ + command (*note Conditional Constructs::) terminates if input does + not arrive after ‘TMOUT’ seconds when input is coming from a + terminal. In an interactive shell, the value is interpreted as the number of seconds to wait for a line of input after issuing the primary @@ -6192,8 +6381,8 @@ single-character options to be recognized. builtin). ‘--dump-po-strings’ - A list of all double-quoted strings preceded by ‘$’ is printed on - the standard output in the GNU ‘gettext’ PO (portable object) file + Print a list of all double-quoted strings preceded by ‘$’ on the + standard output in the GNU ‘gettext’ PO (portable object) file format. Equivalent to ‘-D’ except for the output format. ‘--dump-strings’ @@ -6260,23 +6449,23 @@ invocation which are not available with the ‘set’ builtin. Make this shell act as if it had been directly invoked by login. When the shell is interactive, this is equivalent to starting a login shell with ‘exec -l bash’. When the shell is not - interactive, the login shell startup files will be executed. ‘exec - bash -l’ or ‘exec bash --login’ will replace the current shell with - a Bash login shell. *Note Bash Startup Files::, for a description - of the special behavior of a login shell. + interactive, it will read and execute the login shell startup + files. ‘exec bash -l’ or ‘exec bash --login’ will replace the + current shell with a Bash login shell. *Note Bash Startup Files::, + for a description of the special behavior of a login shell. ‘-r’ Make the shell a restricted shell (*note The Restricted Shell::). ‘-s’ If this option is present, or if no arguments remain after option - processing, then commands are read from the standard input. This + processing, then Bash reads commands from the standard input. This option allows the positional parameters to be set when invoking an interactive shell or when reading input through a pipe. ‘-D’ - A list of all double-quoted strings preceded by ‘$’ is printed on - the standard output. These are the strings that are subject to + Print a list of all double-quoted strings preceded by ‘$’ on the + standard output. These are the strings that are subject to language translation when the current locale is not ‘C’ or ‘POSIX’ (*note Locale Translation::). This implies the ‘-n’ option; no commands will be executed. @@ -6285,8 +6474,8 @@ invocation which are not available with the ‘set’ builtin. SHOPT_OPTION is one of the shell options accepted by the ‘shopt’ builtin (*note The Shopt Builtin::). If SHOPT_OPTION is present, ‘-O’ sets the value of that option; ‘+O’ unsets it. If - SHOPT_OPTION is not supplied, the names and values of the shell - options accepted by ‘shopt’ are printed on the standard output. If + SHOPT_OPTION is not supplied, Bash prints the names and values of + the shell options accepted by ‘shopt’ on the standard output. If the invocation option is ‘+O’, the output is displayed in a format that may be reused as input. @@ -6304,9 +6493,9 @@ or one invoked with the ‘--login’ option. An _interactive_ shell is one started without non-option arguments, unless ‘-s’ is specified, without specifying the ‘-c’ option, and whose -input and output are both connected to terminals (as determined by -‘isatty(3)’), or one started with the ‘-i’ option. *Note Interactive -Shells::, for more information. +input and output (using the standard error) are both connected to +terminals (as determined by ‘isatty(3)’), or one started with the ‘-i’ +option. *Note Interactive Shells::, for more information. If arguments remain after option processing, and neither the ‘-c’ nor the ‘-s’ option has been supplied, the first argument is assumed to be @@ -6349,10 +6538,10 @@ commands from the file ‘~/.bash_logout’, if it exists. Invoked as an interactive non-login shell ......................................... -When an interactive shell that is not a login shell is started, Bash +When Bash runs as an interactive shell that is not a login shell, it reads and executes commands from ‘~/.bashrc’, if that file exists. This may be inhibited by using the ‘--norc’ option. The ‘--rcfile FILE’ -option will cause Bash to use FILE instead of ‘~/.bashrc’. +option causes Bash to use FILE instead of ‘~/.bashrc’. So, typically, your ‘~/.bash_profile’ contains the line if [ -f ~/.bashrc ]; then . ~/.bashrc; fi @@ -6367,7 +6556,7 @@ expands its value if it appears there, and uses the expanded value as the name of a file to read and execute. Bash behaves as if the following command were executed: if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi -but the value of the ‘PATH’ variable is not used to search for the +but does not the value of the ‘PATH’ variable to search for the filename. As noted above, if a non-interactive shell is invoked with the @@ -6384,14 +6573,16 @@ conforming to the POSIX standard as well. When invoked as an interactive login shell, or as a non-interactive shell with the ‘--login’ option, it first attempts to read and execute commands from ‘/etc/profile’ and ‘~/.profile’, in that order. The -‘--noprofile’ option may be used to inhibit this behavior. When invoked -as an interactive shell with the name ‘sh’, Bash looks for the variable -‘ENV’, expands its value if it is defined, and uses the expanded value -as the name of a file to read and execute. Since a shell invoked as -‘sh’ does not attempt to read and execute commands from any other -startup files, the ‘--rcfile’ option has no effect. A non-interactive -shell invoked with the name ‘sh’ does not attempt to read any other -startup files. +‘--noprofile’ option may be used to inhibit this behavior. + + When invoked as an interactive shell with the name ‘sh’, Bash looks +for the variable ‘ENV’, expands its value if it is defined, and uses the +expanded value as the name of a file to read and execute. Since a shell +invoked as ‘sh’ does not attempt to read and execute commands from any +other startup files, the ‘--rcfile’ option has no effect. + + A non-interactive shell invoked with the name ‘sh’ does not attempt +to read any other startup files. When invoked as ‘sh’, Bash enters POSIX mode after the startup files are read. @@ -6401,8 +6592,8 @@ Invoked in POSIX mode When Bash is started in POSIX mode, as with the ‘--posix’ command line option, it follows the POSIX standard for startup files. In this mode, -interactive shells expand the ‘ENV’ variable and commands are read and -executed from the file whose name is the expanded value. No other +interactive shells expand the ‘ENV’ variable and read and execute +commands from the file whose name is the expanded value. No other startup files are read. Invoked by remote shell daemon @@ -6410,14 +6601,14 @@ Invoked by remote shell daemon Bash attempts to determine when it is being run with its standard input connected to a network connection, as when executed by the historical -remote shell daemon, usually ‘rshd’, or the secure shell daemon ‘sshd’. -If Bash determines it is being run non-interactively in this fashion, it -reads and executes commands from ‘~/.bashrc’, if that file exists and is -readable. It will not do this if invoked as ‘sh’. The ‘--norc’ option -may be used to inhibit this behavior, and the ‘--rcfile’ option will -make Bash use a different file instead of ‘~/.bashrc’, but neither -‘rshd’ nor ‘sshd’ generally invoke the shell with those options or allow -them to be specified. +and rarely-seen remote shell daemon, usually ‘rshd’, or the secure shell +daemon ‘sshd’. If Bash determines it is being run non-interactively in +this fashion, it reads and executes commands from ‘~/.bashrc’, if that +file exists and is readable. It will not do this if invoked as ‘sh’. +The ‘--norc’ option may be used to inhibit this behavior, and the +‘--rcfile’ option will make Bash use a different file instead of +‘~/.bashrc’, but neither ‘rshd’ nor ‘sshd’ generally invoke the shell +with those options or allow them to be specified. Invoked with unequal effective and real UID/GIDs ................................................ @@ -6458,7 +6649,7 @@ and error output are both connected to terminals (as determined by terminal. The ‘-s’ invocation option may be used to set the positional -parameters when an interactive shell is started. +parameters when an interactive shell starts.  File: bashref.info, Node: Is this Shell Interactive?, Next: Interactive Shell Behavior, Prev: What is an Interactive Shell?, Up: Interactive Shells @@ -6493,35 +6684,35 @@ File: bashref.info, Node: Interactive Shell Behavior, Prev: Is this Shell Inte When the shell is running interactively, it changes its behavior in several ways. - 1. Startup files are read and executed as described in *note Bash + 1. Bash reads and executes startup files as described in *note Bash Startup Files::. 2. Job Control (*note Job Control::) is enabled by default. When job control is in effect, Bash ignores the keyboard-generated job control signals ‘SIGTTIN’, ‘SIGTTOU’, and ‘SIGTSTP’. - 3. Bash expands and displays ‘PS1’ before reading the first line of a + 3. Bash executes the values of the set elements of the + ‘PROMPT_COMMAND’ array variable as commands before printing the + primary prompt, ‘$PS1’ (*note Bash Variables::). + + 4. Bash expands and displays ‘PS1’ before reading the first line of a command, and expands and displays ‘PS2’ before reading the second and subsequent lines of a multi-line command. Bash expands and displays ‘PS0’ after it reads a command but before executing it. See *note Controlling the Prompt::, for a complete list of prompt string escape sequences. - 4. Bash executes the values of the set elements of the - ‘PROMPT_COMMAND’ array variable as commands before printing the - primary prompt, ‘$PS1’ (*note Bash Variables::). - - 5. Readline (*note Command Line Editing::) is used to read commands + 5. Bash uses Readline (*note Command Line Editing::) to read commands from the user's terminal. 6. Bash inspects the value of the ‘ignoreeof’ option to ‘set -o’ instead of exiting immediately when it receives an ‘EOF’ on its standard input when reading a command (*note The Set Builtin::). - 7. Command history (*note Bash History Facilities::) and history - expansion (*note History Interaction::) are enabled by default. - Bash will save the command history to the file named by ‘$HISTFILE’ - when a shell with history enabled exits. + 7. Bash enables Command history (*note Bash History Facilities::) and + history expansion (*note History Interaction::) by default. When a + shell with history enabled exits, Bash saves the command history to + the file named by ‘$HISTFILE’. 8. Alias expansion (*note Aliases::) is performed by default. @@ -6534,16 +6725,16 @@ several ways. 11. An interactive login shell sends a ‘SIGHUP’ to all jobs on exit if the ‘huponexit’ shell option has been enabled (*note Signals::). - 12. The ‘-n’ invocation option is ignored, and ‘set -n’ has no effect - (*note The Set Builtin::). + 12. The ‘-n’ option has no effect, whether at invocation or when using + ‘set -n’ (*note The Set Builtin::). 13. Bash will check for mail periodically, depending on the values of the ‘MAIL’, ‘MAILPATH’, and ‘MAILCHECK’ shell variables (*note Bash Variables::). - 14. Expansion errors due to references to unbound shell variables - after ‘set -u’ has been enabled will not cause the shell to exit - (*note The Set Builtin::). + 14. The shell will not exit on expansion errors due to references to + unbound shell variables after ‘set -u’ has been enabled (*note The + Set Builtin::). 15. The shell will not exit on expansion errors caused by VAR being unset or null in ‘${VAR:?WORD}’ expansions (*note Shell Parameter @@ -6582,10 +6773,12 @@ Bourne Shell Builtins::). The ‘test’ and ‘[’ commands determine their behavior based on the number of arguments; see the descriptions of those commands for any other command-specific actions. - Expressions may be unary or binary, and are formed from the following -primaries. Unary expressions are often used to examine the status of a -file. There are string operators and numeric comparison operators as -well. Bash handles several filenames specially when they are used in + Expressions may be unary or binary, and are formed from the primaries +listed below. Unary expressions are often used to examine the status of +a file or shell variable. Binary operators are used for string, +numeric, and file attribute comparisons. + + Bash handles several filenames specially when they are used in expressions. If the operating system on which Bash is running provides these special files, Bash will use them; otherwise it will emulate them internally with this behavior: If the FILE argument to one of the @@ -6656,7 +6849,8 @@ link itself. True if FILE exists and is a symbolic link. ‘-N FILE’ - True if FILE exists and has been modified since it was last read. + True if FILE exists and has been modified since it was last + accessed. ‘-O FILE’ True if FILE exists and is owned by the effective user id. @@ -6730,15 +6924,16 @@ File: bashref.info, Node: Shell Arithmetic, Next: Aliases, Prev: Bash Conditi ==================== The shell allows arithmetic expressions to be evaluated, as one of the -shell expansions or by using the ‘((’ compound command, the ‘let’ -builtin, or the ‘-i’ option to the ‘declare’ builtin. +shell expansions or by using the ‘((’ compound command, the ‘let’ and +‘declare’ builtins, the arithmetic ‘for’ command, the ‘[[’ conditional +command, or the ‘-i’ option to the ‘declare’ builtin. - Evaluation is done in fixed-width integers with no check for -overflow, though division by 0 is trapped and flagged as an error. The -operators and their precedence, associativity, and values are the same -as in the C language. The following list of operators is grouped into -levels of equal-precedence operators. The levels are listed in order of -decreasing precedence. + Evaluation is done in the largest fixed-width integers available, +with no check for overflow, though division by 0 is trapped and flagged +as an error. The operators and their precedence, associativity, and +values are the same as in the C language. The following list of +operators is grouped into levels of equal-precedence operators. The +levels are listed in order of decreasing precedence. ‘ID++ ID--’ variable post-increment and post-decrement @@ -6797,13 +6992,17 @@ decreasing precedence. Shell variables are allowed as operands; parameter expansion is performed before the expression is evaluated. Within an expression, shell variables may also be referenced by name without using the -parameter expansion syntax. A shell variable that is null or unset -evaluates to 0 when referenced by name without using the parameter -expansion syntax. The value of a variable is evaluated as an arithmetic -expression when it is referenced, or when a variable which has been -given the ‘integer’ attribute using ‘declare -i’ is assigned a value. A -null value evaluates to 0. A shell variable need not have its ‘integer’ -attribute turned on to be used in an expression. +parameter expansion syntax. This means you can use .Q x , where \fIx\fP +is a shell variable name, in an arithmetic expression, and the shell +will evaluate its value as an expression and use the result. A shell +variable that is null or unset evaluates to 0 when referenced by name in +an expression. + + The value of a variable is evaluated as an arithmetic expression when +it is referenced, or when a variable which has been given the ‘integer’ +attribute using ‘declare -i’ is assigned a value. A null value +evaluates to 0. A shell variable need not have its ‘integer’ attribute +turned on to be used in an expression. Integer constants follow the C language definition, without suffixes or character constants. Constants with a leading 0 are interpreted as @@ -6817,7 +7016,7 @@ represented by the lowercase letters, the uppercase letters, ‘@’, and uppercase letters may be used interchangeably to represent numbers between 10 and 35. - Operators are evaluated in order of precedence. Sub-expressions in + Operators are evaluated in precedence order. Sub-expressions in parentheses are evaluated first and may override the precedence rules above. @@ -6848,8 +7047,8 @@ expanded a second time. This means that one may alias ‘ls’ to ‘"ls -F"’, for instance, and Bash does not try to recursively expand the replacement text. - If the last character of the alias value is a ‘blank’, then the next -command word following the alias is also checked for alias expansion. + If the last character of the alias value is a ‘blank’, then the shell +checks the next command word following the alias for alias expansion. Aliases are created and listed with the ‘alias’ command, and removed with the ‘unalias’ command. @@ -6868,14 +7067,15 @@ all lines that make up a compound command, before executing any of the commands on that line or the compound command. Aliases are expanded when a command is read, not when it is executed. Therefore, an alias definition appearing on the same line as another command does not take -effect until the next line of input is read. The commands following the -alias definition on that line are not affected by the new alias. This -behavior is also an issue when functions are executed. Aliases are -expanded when a function definition is read, not when the function is -executed, because a function definition is itself a command. As a -consequence, aliases defined in a function are not available until after -that function is executed. To be safe, always put alias definitions on -a separate line, and do not use ‘alias’ in compound commands. +effect until the shell reads the next line of input. The commands +following the alias definition on that line are not affected by the new +alias. This behavior is also an issue when functions are executed. +Aliases are expanded when a function definition is read, not when the +function is executed, because a function definition is itself a command. +As a consequence, aliases defined in a function are not available until +after that function is executed. To be safe, always put alias +definitions on a separate line, and do not use ‘alias’ in compound +commands. For almost every purpose, shell functions are preferred over aliases. @@ -6899,7 +7099,8 @@ to using the syntax NAME[SUBSCRIPT]=VALUE The SUBSCRIPT is treated as an arithmetic expression that must evaluate -to a number. To explicitly declare an array, use +to a number greater than or equal to zero. To explicitly declare an +array, use declare -a NAME The syntax declare -a NAME[SUBSCRIPT] @@ -6912,19 +7113,21 @@ Associative arrays are created using and ‘readonly’ builtins. Each attribute applies to all members of an array. - Arrays are assigned to using compound assignments of the form + Arrays are assigned using compound assignments of the form NAME=(VALUE1 VALUE2 ... ) where each VALUE may be of the form ‘[SUBSCRIPT]=’STRING. Indexed array -assignments do not require anything but STRING. When assigning to -indexed arrays, if the optional subscript is 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. +assignments do not require anything but STRING. Each VALUE in the list undergoes the shell expansions described above (*note Shell Expansions::), but VALUEs that are valid variable assignments including 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 subscript is +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 assignment may be either assignment statements, for which the subscript is required, or a list of words that is interpreted as a sequence of @@ -6948,8 +7151,8 @@ end of the array, and an index of -1 references the last element. using the compound assignment syntax; see *note Shell Parameters:: above. - Any element of an array may be referenced using ‘${NAME[SUBSCRIPT]}’. -The braces are required to avoid conflicts with the shell's filename + An array element is referenced using ‘${NAME[SUBSCRIPT]}’. The +braces are required to avoid conflicts with the shell's filename expansion operators. If the SUBSCRIPT is ‘@’ or ‘*’, the word expands to all members of the array NAME, unless otherwise noted in the description of a builtin or word expansion. These subscripts differ @@ -6959,16 +7162,20 @@ each array member separated by the first character of the ‘IFS’ variable, and ‘${NAME[@]}’ expands each element of NAME to a separate word. When there are no array members, ‘${NAME[@]}’ 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 original -word, and the expansion of the last parameter is joined with the last -part of the original word. This is analogous to the expansion of the -special parameters ‘@’ and ‘*’. ‘${#NAME[SUBSCRIPT]}’ expands to the -length of ‘${NAME[SUBSCRIPT]}’. If SUBSCRIPT is ‘@’ or ‘*’, the -expansion is the number of elements in the array. If the SUBSCRIPT used -to reference an element of an indexed array evaluates to a number less -than zero, it is interpreted as relative to one greater than the maximum -index of the array, so negative indices count back from the end of the -array, and an index of -1 refers to the last element. +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 ‘*’. + + ‘${#NAME[SUBSCRIPT]}’ expands to the length of ‘${NAME[SUBSCRIPT]}’. +If SUBSCRIPT is ‘@’ or ‘*’, the expansion is the number of elements in +the array. + + If the SUBSCRIPT used to reference an element of an indexed array +evaluates to a number less than zero, it is interpreted as relative to +one greater than the maximum index of the array, so negative indices +count back from the end of the array, and an index of -1 refers to the +last element. Referencing an array variable without a subscript is equivalent to referencing with a subscript of 0. Any reference to a variable using a @@ -6984,21 +7191,21 @@ to the expansion of the special parameters ‘@’ and ‘*’ within double quotes. The ‘unset’ builtin is used to destroy arrays. ‘unset -NAME[SUBSCRIPT]’ destroys the array element at index SUBSCRIPT. -Negative subscripts to indexed arrays are interpreted as described -above. Unsetting the last element of an array variable does not unset -the variable. ‘unset NAME’, where NAME is an array, removes the entire +NAME[SUBSCRIPT]’ unsets the array element at index SUBSCRIPT. Negative +subscripts to indexed arrays are interpreted as described above. +Unsetting the last element of an array variable does not unset the +variable. ‘unset NAME’, where NAME is an array, removes the entire array. ‘unset NAME[SUBSCRIPT]’ behaves differently depending on the -array type when given a subscript of ‘*’ or ‘@’. When NAME is an -associative array, it removes the element with key ‘*’ or ‘@’. If NAME -is an indexed array, ‘unset’ removes all of the elements, but does not -remove the array itself. +array type when SUBSCRIPT is ‘*’ or ‘@’. When NAME is an associative +array, it removes the element with key ‘*’ or ‘@’. If NAME is an +indexed array, ‘unset’ removes all of the elements, but does not remove +the array itself. When using a variable name with a subscript as an argument to a command, such as with ‘unset’, without using the word expansion syntax -described above, the argument is subject to the shell's filename -expansion. If filename expansion is not desired, the argument should be -quoted. +described above (e.g., unset a[4]), the argument is subject to the +shell's filename expansion. Quote the argument if pathname expansion is +not desired (e.g., unset 'a[4]'). The ‘declare’, ‘local’, and ‘readonly’ builtins each accept a ‘-a’ option to specify an indexed array and a ‘-A’ option to specify an @@ -7007,7 +7214,9 @@ The ‘read’ builtin accepts a ‘-a’ option to assign a list of words read from the standard input to an array, and can read values from the standard input into individual array elements. The ‘set’ and ‘declare’ builtins display array values in a way that allows them to be reused as -input. +input. Other builtins accept array name arguments as well (e.g., +‘mapfile’); see the descriptions of individual builtins for details. +The shell provides a number of builtin array variables.  File: bashref.info, Node: The Directory Stack, Next: Controlling the Prompt, Prev: Arrays, Up: Bash Features @@ -7039,10 +7248,12 @@ File: bashref.info, Node: Directory Stack Builtins, Up: The Directory Stack ‘dirs’ dirs [-clpv] [+N | -N] - Display the list of currently remembered directories. Directories - are added to the list with the ‘pushd’ command; the ‘popd’ command - removes directories from the list. The current directory is always - the first directory in the stack. + Without options, display the list of currently remembered + directories. Directories are added to the list with the ‘pushd’ + command; the ‘popd’ command removes directories from the list. The + current directory is always the first directory in the stack. + + Options, if supplied, have the following meanings: ‘-c’ Clears the directory stack by deleting all of the elements. @@ -7067,7 +7278,7 @@ File: bashref.info, Node: Directory Stack Builtins, Up: The Directory Stack ‘popd’ popd [-n] [+N | -N] - Removes elements from the directory stack. The elements are + Remove elements from the directory stack. The elements are numbered from 0 starting at the first directory listed by ‘dirs’; that is, ‘popd’ is equivalent to ‘popd +0’. @@ -7077,14 +7288,13 @@ File: bashref.info, Node: Directory Stack Builtins, Up: The Directory Stack Arguments, if supplied, have the following meanings: ‘-n’ - Suppresses the normal change of directory when removing - directories from the stack, so that only the stack is - manipulated. + Suppress the normal change of directory when removing + directories from the stack, only manipulate the stack. ‘+N’ - Removes the Nth directory (counting from the left of the list + Remove the Nth directory (counting from the left of the list printed by ‘dirs’), starting with zero, from the stack. ‘-N’ - Removes the Nth directory (counting from the right of the list + Remove the Nth directory (counting from the right of the list printed by ‘dirs’), starting with zero, from the stack. If the top element of the directory stack is modified, and the ‘-n’ @@ -7093,8 +7303,8 @@ File: bashref.info, Node: Directory Stack Builtins, Up: The Directory Stack returns a non-zero value. Otherwise, ‘popd’ returns an unsuccessful status if an invalid - option is encountered, the directory stack is empty, or a - non-existent directory stack entry is specified. + option is specified, the directory stack is empty, or N specifies a + non-existent directory stack entry. If the ‘popd’ command is successful, Bash runs ‘dirs’ to show the final contents of the directory stack, and the return status is 0. @@ -7102,7 +7312,7 @@ File: bashref.info, Node: Directory Stack Builtins, Up: The Directory Stack ‘pushd’ pushd [-n] [+N | -N | DIR] - Adds a directory to the top of the directory stack, or rotates the + Add a directory to the top of the directory stack, or rotate the stack, making the new top of the stack the current working directory. With no arguments, ‘pushd’ exchanges the top two elements of the directory stack. @@ -7110,29 +7320,28 @@ File: bashref.info, Node: Directory Stack Builtins, Up: The Directory Stack Arguments, if supplied, have the following meanings: ‘-n’ - Suppresses the normal change of directory when rotating or - adding directories to the stack, so that only the stack is - manipulated. + Suppress the normal change of directory when rotating or + adding directories to the stack, only manipulate the stack. ‘+N’ - Brings the Nth directory (counting from the left of the list - printed by ‘dirs’, starting with zero) to the top of the list - by rotating the stack. + Rotate the stack so that the Nth directory (counting from the + left of the list printed by ‘dirs’, starting with zero) is at + the top. ‘-N’ - Brings the Nth directory (counting from the right of the list - printed by ‘dirs’, starting with zero) to the top of the list - by rotating the stack. + Rotate the stack so that the Nth directory (counting from the + right of the list printed by ‘dirs’, starting with zero) is at + the top. ‘DIR’ - Makes DIR be the top of the stack. + Make DIR be the top of the stack. After the stack has been modified, if the ‘-n’ option was not supplied, ‘pushd’ uses the ‘cd’ builtin to change to the directory at the top of the stack. If the ‘cd’ fails, ‘pushd’ returns a non-zero value. - Otherwise, if no arguments are supplied, ‘pushd’ returns 0 unless - the directory stack is empty. When rotating the directory stack, - ‘pushd’ returns 0 unless the directory stack is empty or a - non-existent directory stack element is specified. + Otherwise, if no arguments are supplied, ‘pushd’ returns zero + unless the directory stack is empty. When rotating the directory + stack, ‘pushd’ returns zero unless the directory stack is empty or + N specifies a non-existent directory stack element. If the ‘pushd’ command is successful, Bash runs ‘dirs’ to show the final contents of the directory stack. @@ -7143,13 +7352,8 @@ File: bashref.info, Node: Controlling the Prompt, Next: The Restricted Shell, 6.9 Controlling the Prompt ========================== -Bash examines the value of the array variable ‘PROMPT_COMMAND’ just -before printing each primary prompt. If any elements in -‘PROMPT_COMMAND’ are set and non-null, Bash executes each value, in -numeric order, just as if it had been typed on the command line. - - In addition, the following table describes the special characters -which can appear in the prompt variables ‘PS0’, ‘PS1’, ‘PS2’, and ‘PS4’: +In addition, the following table describes the special characters which +can appear in the prompt variables ‘PS0’, ‘PS1’, ‘PS2’, and ‘PS4’: ‘\a’ A bell character. @@ -7162,19 +7366,19 @@ which can appear in the prompt variables ‘PS0’, ‘PS1’, ‘PS2’, and ‘\e’ An escape character. ‘\h’ - The hostname, up to the first '.'. + The hostname, up to the first ‘.’. ‘\H’ The hostname. ‘\j’ The number of jobs currently managed by the shell. ‘\l’ - The basename of the shell's terminal device name. + The basename of the shell's terminal device name (e.g., "ttys0"). ‘\n’ A newline. ‘\r’ A carriage return. ‘\s’ - The name of the shell, the basename of ‘$0’ (the portion following + The name of the shell: the basename of ‘$0’ (the portion following the final slash). ‘\t’ The time, in 24-hour HH:MM:SS format. @@ -7187,9 +7391,9 @@ which can appear in the prompt variables ‘PS0’, ‘PS1’, ‘PS2’, and ‘\u’ The username of the current user. ‘\v’ - The version of Bash (e.g., 2.00) + The Bash version (e.g., 2.00). ‘\V’ - The release of Bash, version + patchlevel (e.g., 2.00.0) + The Bash release, version + patchlevel (e.g., 2.00.0). ‘\w’ The value of the ‘PWD’ shell variable (‘$PWD’), with ‘$HOME’ abbreviated with a tilde (uses the ‘$PROMPT_DIRTRIM’ variable). @@ -7231,7 +7435,7 @@ File: bashref.info, Node: The Restricted Shell, Next: Bash POSIX Mode, Prev: ========================= If Bash is started with the name ‘rbash’, or the ‘--restricted’ or ‘-r’ -option is supplied at invocation, the shell becomes restricted. A +option is supplied at invocation, the shell becomes RESTRICTED. A restricted shell is used to set up an environment more controlled than the standard shell. A restricted shell behaves identically to ‘bash’ with the exception that the following are disallowed or not performed: @@ -7242,6 +7446,8 @@ with the exception that the following are disallowed or not performed: • Specifying command names containing slashes. • Specifying a filename containing a slash as an argument to the ‘.’ builtin command. + • Using the ‘-p’ option to the ‘.’ builtin command to specify a + search path. • Specifying a filename containing a slash as an argument to the ‘history’ builtin command. • Specifying a filename containing a slash as an argument to the ‘-p’ @@ -7677,9 +7883,10 @@ migrate scripts to use current features and behavior. It's intended to be a temporary solution. This section does not mention behavior that is standard for a -particular version (e.g., setting ‘compat32’ means that quoting the rhs -of the regexp matching operator quotes special regexp characters in the -word, which is default behavior in bash-3.2 and subsequent versions). +particular version (e.g., setting ‘compat32’ means that quoting the +right hand side of the regexp matching operator quotes special regexp +characters in the word, which is default behavior in bash-3.2 and +subsequent versions). If a user enables, say, ‘compat32’, it may affect the behavior of other compatibility levels up to and including the current compatibility @@ -7698,13 +7905,14 @@ assigned to this variable (a decimal version number like 4.2, or an integer corresponding to the ‘compat’NN option, like 42) determines the compatibility level. - Starting with bash-4.4, Bash has begun deprecating older -compatibility levels. Eventually, the options will be removed in favor -of ‘BASH_COMPAT’. + Starting with bash-4.4, Bash began deprecating older compatibility +levels. Eventually, the options will be removed in favor of +‘BASH_COMPAT’. - Bash-5.0 was the final version for which there will be an individual -shopt option for the previous version. Users should control the -compatibility level with ‘BASH_COMPAT’. + Bash-5.0 was the final version for which there was an individual +shopt option for the previous version. ‘BASH_COMPAT’ is the only +mechanism to control the compatibility level in versions newer than +bash-5.0. The following table describes the behavior changes controlled by each compatibility level setting. The ‘compat’NN tag is used as shorthand @@ -7715,59 +7923,59 @@ and later versions, the ‘BASH_COMPAT’ variable is preferred, and it is required for bash-5.1 and later versions. ‘compat31’ - • quoting the rhs of the ‘[[’ command's regexp matching operator + • Quoting the rhs of the ‘[[’ command's regexp matching operator (=~) has no special effect ‘compat40’ - • the ‘<’ and ‘>’ operators to the ‘[[’ command do not consider + • The ‘<’ and ‘>’ operators to the ‘[[’ command do not consider the current locale when comparing strings; they use ASCII ordering. Bash versions prior to bash-4.1 use ASCII collation and strcmp(3); bash-4.1 and later use the current locale's collation sequence and strcoll(3). ‘compat41’ - • in posix mode, ‘time’ may be followed by options and still be + • In posix mode, ‘time’ may be followed by options and still be recognized as a reserved word (this is POSIX interpretation - 267) - • in posix mode, the parser requires that an even number of + 267). + • In posix mode, the parser requires that an even number of single quotes occur in the WORD portion of a double-quoted ${...} parameter expansion and treats them specially, so that characters within the single quotes are considered quoted - (this is POSIX interpretation 221) + (this is POSIX interpretation 221). ‘compat42’ - • the replacement string in double-quoted pattern substitution + • The replacement string in double-quoted pattern substitution does not undergo quote removal, as it does in versions after - bash-4.2 - • in posix mode, single quotes are considered special when + bash-4.2. + • In posix mode, single quotes are considered special when expanding the WORD portion of a double-quoted ${...} parameter expansion and can be used to quote a closing brace or other special character (this is part of POSIX interpretation 221); in later versions, single quotes are not special within - double-quoted word expansions + double-quoted word expansions. ‘compat43’ - • word expansion errors are considered non-fatal errors that + • Word expansion errors are considered non-fatal errors that cause the current command to fail, even in posix mode (the default behavior is to make them fatal errors that cause the - shell to exit) - • when executing a shell function, the loop state + shell to exit). + • When executing a shell function, the loop state (while/until/etc.) is not reset, so ‘break’ or ‘continue’ in that function will break or continue loops in the calling context. Bash-4.4 and later reset the loop state to prevent - this + this. ‘compat44’ - • the shell sets up the values used by ‘BASH_ARGV’ and + • The shell sets up the values used by ‘BASH_ARGV’ and ‘BASH_ARGC’ so they can expand to the shell's positional - parameters even if extended debugging mode is not enabled - • a subshell inherits loops from its parent context, so ‘break’ + parameters even if extended debugging mode is not enabled. + • A subshell inherits loops from its parent context, so ‘break’ or ‘continue’ will cause the subshell to exit. Bash-5.0 and - later reset the loop state to prevent the exit - • variable assignments preceding builtins like ‘export’ and + later reset the loop state to prevent the exit. + • Variable assignments preceding builtins like ‘export’ and ‘readonly’ that set attributes continue to affect variables with the same name in the calling environment even if the - shell is not in posix mode + shell is not in posix mode. ‘compat50 (set using BASH_COMPAT)’ • Bash-5.1 changed the way ‘$RANDOM’ is generated to introduce @@ -7775,7 +7983,7 @@ required for bash-5.1 and later versions. set to 50 or lower, it reverts to the method from bash-5.0 and previous versions, so seeding the random number generator by assigning a value to ‘RANDOM’ will produce the same sequence - as in bash-5.0 + as in bash-5.0. • If the command hash table is empty, Bash versions prior to bash-5.1 printed an informational message to that effect, even when producing output that can be reused as input. Bash-5.1 @@ -7785,21 +7993,21 @@ required for bash-5.1 and later versions. • The ‘unset’ builtin will unset the array ‘a’ given an argument like ‘a[@]’. Bash-5.2 will unset an element with key ‘@’ (associative arrays) or remove all the elements without - unsetting the array (indexed arrays) - • arithmetic commands ( ((...)) ) and the expressions in an - arithmetic for statement can be expanded more than once - • expressions used as arguments to arithmetic operators in the - ‘[[’ conditional command can be expanded more than once - • the expressions in substring parameter brace expansion can be - expanded more than once - • the expressions in the $(( ... )) word expansion can be - expanded more than once - • arithmetic expressions used as indexed array subscripts can be - expanded more than once + unsetting the array (indexed arrays). + • Arithmetic commands ( ((...)) ) and the expressions in an + arithmetic for statement can be expanded more than once. + • Expressions used as arguments to arithmetic operators in the + ‘[[’ conditional command can be expanded more than once. + • The expressions in substring parameter brace expansion can be + expanded more than once. + • The expressions in the $(( ... )) word expansion can be + expanded more than once. + • Arithmetic expressions used as indexed array subscripts can be + expanded more than once. • ‘test -v’, when given an argument of ‘A[@]’, where A is an existing associative array, will return true if the array has any set elements. Bash-5.2 will look for and report on a key - named ‘@’ + named ‘@’. • the ${PARAMETER[:]=VALUE} word expansion will return VALUE, before any variable-specific transformations have been performed (e.g., converting to lowercase). Bash-5.2 will @@ -7957,7 +8165,7 @@ File: bashref.info, Node: Job Control Builtins, Next: Job Control Variables, fg [JOBSPEC] Resume the job JOBSPEC in the foreground and make it the current - job. If JOBSPEC is not supplied, the current job is used. The + job. If JOBSPEC is not supplied, resume the current job. The return status is that of the command placed into the foreground, or non-zero if run when job control is disabled or, when run with job control enabled, JOBSPEC does not specify a valid job or JOBSPEC @@ -7986,8 +8194,9 @@ File: bashref.info, Node: Job Control Builtins, Next: Job Control Variables, ‘-s’ Display only stopped jobs. - If JOBSPEC is given, output is restricted to information about that - job. If JOBSPEC is not supplied, the status of all jobs is listed. + If JOBSPEC is supplied, ‘jobs’ restricts output to information + about that job. If JOBSPEC is not supplied, ‘jobs’ lists the + status of all jobs. If the ‘-x’ option is supplied, ‘jobs’ replaces any JOBSPEC found in COMMAND or ARGUMENTS with the corresponding process group ID, @@ -8002,23 +8211,26 @@ File: bashref.info, Node: Job Control Builtins, Next: Job Control Variables, by job specification JOBSPEC or process ID PID. SIGSPEC is either a case-insensitive signal name such as ‘SIGINT’ (with or without the ‘SIG’ prefix) or a signal number; SIGNUM is a signal number. - If SIGSPEC and SIGNUM are not present, ‘SIGTERM’ is used. The ‘-l’ - option lists the signal names. If any arguments are supplied when - ‘-l’ is given, the names of the signals corresponding to the - arguments are listed, and the return status is zero. EXIT_STATUS - is a number specifying a signal number or the exit status of a - process terminated by a signal. The ‘-L’ option is equivalent to - ‘-l’. The return status is zero if at least one signal was - successfully sent, or non-zero if an error occurs or an invalid - option is encountered. + If SIGSPEC and SIGNUM are not present, ‘kill’ sends ‘SIGTERM’. + + The ‘-l’ option lists the signal names. If any arguments are + supplied when ‘-l’ is supplied, the names of the signals + corresponding to the arguments are listed, and the return status is + zero. EXIT_STATUS is a number specifying a signal number or the + exit status of a process terminated by a signal. The ‘-L’ option + is equivalent to ‘-l’. + + The return status is zero if at least one signal was successfully + sent, or non-zero if an error occurs or an invalid option is + encountered. ‘wait’ wait [-fn] [-p VARNAME] [ID ...] Wait until the child process specified by each ID exits and return the exit status of the last ID. Each ID may be a PID or job - specification JOBSPEC; if a job spec is given, ‘wait’ waits for all - processes in the job. + specification JOBSPEC; if a job spec is supplied, ‘wait’ waits for + all processes in the job. If no options or IDs are supplied, ‘wait’ waits for all running background jobs and the last-executed process substitution, if its @@ -8032,9 +8244,9 @@ File: bashref.info, Node: Job Control Builtins, Next: Job Control Variables, If the ‘-p’ option is supplied, the process or job identifier of the job for which the exit status is returned is assigned to the - variable VARNAME named by the option argument. The variable will - be unset initially, before any assignment. This is useful only - when the ‘-n’ option is supplied. + variable VARNAME named by the option argument. The variable, which + cannot be readonly, will be unset initially, before any assignment. + This is useful only when the ‘-n’ option is supplied. Supplying the ‘-f’ option, when job control is enabled, forces ‘wait’ to wait for each ID to terminate before returning its @@ -8047,26 +8259,30 @@ File: bashref.info, Node: Job Control Builtins, Next: Job Control Variables, Otherwise, the return status is the exit status of the last ID. ‘disown’ - disown [-ar] [-h] [JOBSPEC ... | PID ... ] + disown [-ar] [-h] [ID ...] + + Without options, remove each ID from the table of active jobs. + Each ID may be a PID or job specification JOBSPEC; if ID is a PID, + ‘disown’ uses the job containing PID. If the ‘-h’ option is + supplied, the job is not removed from the table, but is marked so + that ‘SIGHUP’ is not sent to the job if the shell receives a + ‘SIGHUP’. If ID is not present, and neither the ‘-a’ nor the ‘-r’ + option is supplied, ‘disown’ removes the current job. + + If no ID is supplied, the ‘-a’ option means to remove or mark all + jobs; the ‘-r’ option without an ID argument restricts operation to + running jobs. - Without options, remove each JOBSPEC from the table of active jobs. - If the ‘-h’ option is given, the job is not removed from the table, - but is marked so that ‘SIGHUP’ is not sent to the job if the shell - receives a ‘SIGHUP’. If JOBSPEC is not present, and neither the - ‘-a’ nor the ‘-r’ option is supplied, the current job is used. If - no JOBSPEC is supplied, the ‘-a’ option means to remove or mark all - jobs; the ‘-r’ option without a JOBSPEC argument restricts - operation to running jobs. + The return value is 0 unless an ID does not specify a valid job. ‘suspend’ suspend [-f] Suspend the execution of this shell until it receives a ‘SIGCONT’ signal. A login shell, or a shell without job control enabled, - cannot be suspended; the ‘-f’ option can be used to override this - and force the suspension. The return status is 0 unless the shell - is a login shell or job control is not enabled and ‘-f’ is not - supplied. + cannot be suspended; the ‘-f’ option will override this and force + the suspension. The return status is 0 unless the shell is a login + shell or job control is not enabled and ‘-f’ is not supplied. When job control is not active, the ‘kill’ and ‘wait’ builtins do not accept JOBSPEC arguments. They must be supplied process IDs. @@ -8079,20 +8295,19 @@ File: bashref.info, Node: Job Control Variables, Prev: Job Control Builtins, ‘auto_resume’ This variable controls how the shell interacts with the user and - job control. If this variable exists then single word simple + job control. If this variable exists then single-word simple commands without redirections are treated as candidates for resumption of an existing job. There is no ambiguity allowed; if there is more than one job beginning with the string typed, then - the most recently accessed job will be selected. The name of a - stopped job, in this context, is the command line used to start it. - If this variable is set to the value ‘exact’, the string supplied - must match the name of a stopped job exactly; if set to - ‘substring’, the string supplied needs to match a substring of the - name of a stopped job. The ‘substring’ value provides - functionality analogous to the ‘%?’ job ID (*note Job Control - Basics::). If set to any other value, the supplied string must be - a prefix of a stopped job's name; this provides functionality - analogous to the ‘%’ job ID. + the most recently accessed job is selected. The name of a stopped + job, in this context, is the command line used to start it. If + this variable is set to the value ‘exact’, the string supplied must + match the name of a stopped job exactly; if set to ‘substring’, the + string supplied needs to match a substring of the name of a stopped + job. The ‘substring’ value provides functionality analogous to the + ‘%?’ job ID (*note Job Control Basics::). If set to any other + value, the supplied string must be a prefix of a stopped job's + name; this provides functionality analogous to the ‘%’ job ID.  File: bashref.info, Node: Command Line Editing, Next: Using History Interactively, Prev: Job Control, Up: Top @@ -8753,6 +8968,9 @@ Variable Settings display a screenful of possible completions at a time. This variable is ‘on’ by default. + ‘prefer-visible-bell’ + See ‘bell-style’. + ‘print-completions-horizontally’ If set to ‘on’, Readline will display completions with matches sorted horizontally in alphabetical order, rather than down @@ -9839,10 +10057,10 @@ File: bashref.info, Node: Programmable Completion, Next: Programmable Completi 8.6 Programmable Completion =========================== -When word completion is attempted for an argument to a command for which -a completion specification (a COMPSPEC) has been defined using the -‘complete’ builtin (*note Programmable Completion Builtins::), the -programmable completion facilities are invoked. +When the user attempts word completion for an argument to a command for +which a completion specification (a COMPSPEC) has been defined using the +‘complete’ builtin (*note Programmable Completion Builtins::), +\fBreadline\fP invokes the programmable completion facilities. First, the command name is identified. If a compspec has been defined for that command, the compspec is used to generate the list of @@ -9850,13 +10068,13 @@ possible completions for the word. If the command word is the empty string (completion attempted at the beginning of an empty line), any compspec defined with the ‘-E’ option to ‘complete’ is used. If the command word is a full pathname, a compspec for the full pathname is -searched for first. If no compspec is found for the full pathname, an -attempt is made to find a compspec for the portion following the final -slash. If those searches do not result in a compspec, any compspec -defined with the ‘-D’ option to ‘complete’ is used as the default. If -there is no default compspec, Bash attempts alias expansion on the -command word as a final resort, and attempts to find a compspec for the -command word from any successful expansion +searched for first. If no compspec is found for the full pathname, +completion attempts to find a compspec for the portion following the +final slash. If those searches do not result in a compspec, any +compspec defined with the ‘-D’ option to ‘complete’ is used as the +default. If there is no default compspec, Bash attempts alias expansion +on the command word as a final resort, and attempts to find a compspec +for the command word from any successful expansion. Once a compspec has been found, it is used to generate the list of matching words. If a compspec is not found, the default Bash completion @@ -9908,7 +10126,8 @@ generate the matches. It must put the possible completions in the Next, any command specified with the ‘-C’ option is invoked in an environment equivalent to command substitution. It should print a list of completions, one per line, to the standard output. Backslash may be -used to escape a newline, if necessary. +used to escape a newline, if necessary. These are added to the set of +possible completions. After all of the possible completions are generated, any filter specified with the ‘-X’ option is applied to the list. The filter is a @@ -9924,8 +10143,7 @@ characters. Finally, any prefix and suffix specified with the ‘-P’ and ‘-S’ options are added to each member of the completion list, and the result -is returned to the Readline completion code as the list of possible -completions. +is returned to Readline as the list of possible completions. If the previously-applied actions do not generate any matches, and the ‘-o dirnames’ option was supplied to ‘complete’ when the compspec @@ -9937,13 +10155,13 @@ matches are added to the results of the other actions. By default, if a compspec is found, whatever it generates is returned to the completion code as the full set of possible completions. The -default Bash completions are not attempted, and the Readline default of -filename completion is disabled. If the ‘-o bashdefault’ option was -supplied to ‘complete’ when the compspec was defined, the default Bash -completions are attempted if the compspec generates no matches. If the -‘-o default’ option was supplied to ‘complete’ when the compspec was -defined, Readline's default completion will be performed if the compspec -(and, if attempted, the default Bash completions) generate no matches. +default Bash completions and the Readline default of filename completion +are disabled. If the ‘-o bashdefault’ option was supplied to ‘complete’ +when the compspec was defined, if the compspec generates no matches, the +default Bash completions are attempted. If the ‘-o default’ option was +supplied to ‘complete’ when the compspec was defined, Readline's default +completion will be performed if the compspec (and, if attempted, the +default Bash completions) generate no matches. When a compspec indicates that directory name completion is desired, the programmable completion functions force Readline to append a slash @@ -10003,7 +10221,8 @@ happening. The matches will be generated in the same way as if the programmable completion code had generated them directly from a completion specification with the same flags. If WORD is - specified, only those completions matching WORD will be displayed. + specified, only those completions matching WORD will be displayed + or stored. The return value is true unless an invalid option is supplied, or no matches were generated. @@ -10086,8 +10305,8 @@ happening. ‘plusdirs’ After any matches defined by the compspec are generated, - directory name completion is attempted and any matches - are added to the results of the other actions. + attempt directory name completion and add any matches to + the results of the other actions. ‘-A ACTION’ The ACTION may be one of the following to generate a list of @@ -10185,26 +10404,30 @@ happening. command whose arguments are being completed, $2 is the word being completed, and $3 is the word preceding the word being completed, as described above (*note Programmable - Completion::). When it finishes, the possible completions are - retrieved from the value of the ‘COMPREPLY’ array variable. + Completion::). When ‘function’ finishes, the possible + completions are retrieved from the value of the ‘COMPREPLY’ + array variable. ‘-G GLOBPAT’ - The filename expansion pattern GLOBPAT is expanded to generate - the possible completions. + Expand the filename expansion pattern GLOBPAT to generate the + possible completions. ‘-P PREFIX’ - PREFIX is added at the beginning of each possible completion - after all other options have been applied. + Add PREFIX to the beginning of each possible completion after + all other options have been applied. ‘-S SUFFIX’ - SUFFIX is appended to each possible completion after all other + Append SUFFIX to each possible completion after all other options have been applied. ‘-W WORDLIST’ The WORDLIST is split using the characters in the ‘IFS’ - special variable as delimiters, and each resultant word is - expanded. The possible completions are the members of the - resultant list which match the word being completed. + special variable as delimiters, and each resulting word is + expanded. Shell quoting is honored within WORDLIST in order + to provide a mechanism for the words to contain shell + metacharacters or characters in the value of ‘IFS’. The + possible completions are the members of the resultant list + which match the word being completed. ‘-X FILTERPAT’ FILTERPAT is a pattern as used for filename expansion. It is @@ -10391,17 +10614,29 @@ shell stores each command in the history list prior to parameter and variable expansion but after history expansion is performed, subject to the values of the shell variables ‘HISTIGNORE’ and ‘HISTCONTROL’. - When the shell starts up, the history is initialized from the file -named by the ‘HISTFILE’ variable (default ‘~/.bash_history’). The file -named by the value of ‘HISTFILE’ is truncated, if necessary, to contain -no more than the number of lines specified by the value of the -‘HISTFILESIZE’ variable. When a shell with history enabled exits, the -last ‘$HISTSIZE’ lines are copied from the history list to the file -named by ‘$HISTFILE’. If the ‘histappend’ shell option is set (*note -Bash Builtins::), the lines are appended to the history file, otherwise -the history file is overwritten. If ‘HISTFILE’ is unset or null, or if -the history file is unwritable, the history is not saved. After saving -the history, the history file is truncated to contain no more than + When the shell starts up, Bash initializes the history list by +reading history entries from the file named by the ‘HISTFILE’ variable +(default ‘~/.bash_history’). This is referred to as the “history file”. +That file is truncated, if necessary, to contain no more than the number +of history entries specified by the value of the ‘HISTFILESIZE’ +variable. If ‘HISTFILESIZE’ is unset, or set to null, a non-numeric +value, or a numeric value less than zero, the history file is not +truncated. + + When the history file is read, lines beginning with the history +comment character followed immediately by a digit are interpreted as +timestamps for the following history entry. These timestamps are +optionally displayed depending on the value of the ‘HISTTIMEFORMAT’ +variable (*note Bash Variables::). When present, history timestamps +delimit history entries, making multi-line entries possible. + + When a shell with history enabled exits, Bash copies the last +‘$HISTSIZE’ entries from the history list to the file named by +‘$HISTFILE’. If the ‘histappend’ shell option is set (*note Bash +Builtins::), Bash appends the entries to the history file, otherwise the +history file is overwritten. If ‘HISTFILE’ is unset or null, or if the +history file is unwritable, the history is not saved. After saving the +history, Bash truncates the history file to contain no more than ‘$HISTFILESIZE’ lines. If ‘HISTFILESIZE’ is unset, or set to null, a non-numeric value, or a numeric value less than zero, the history file is not truncated. @@ -10410,24 +10645,25 @@ is not truncated. with each history entry is written to the history file, marked with the history comment character. When the history file is read, lines beginning with the history comment character followed immediately by a -digit are interpreted as timestamps for the following history entry. +digit are interpreted as timestamps for the following history entry. As +above, when using ‘HISTTIMEFORMAT’, the timestamps delimit multi-line +history entries. - The ‘fc’ builtin command may be used to list or edit and re-execute a -portion of the history list. The ‘history’ builtin may be used to -display or modify the history list and manipulate the history file. -When using command-line editing, search commands are available in each -editing mode that provide access to the history list (*note Commands For -History::). + The ‘fc’ builtin command will list or edit and re-execute a portion +of the history list. The ‘history’ builtin can display or modify the +history list and manipulate the history file. When using command-line +editing, search commands are available in each editing mode that provide +access to the history list (*note Commands For History::). The shell allows control over which commands are saved on the history -list. The ‘HISTCONTROL’ and ‘HISTIGNORE’ variables are used to cause -the shell to save only a subset of the commands entered. The ‘cmdhist’ -shell option, if enabled, causes the shell to attempt to save each line -of a multi-line command in the same history entry, adding semicolons -where necessary to preserve syntactic correctness. The ‘lithist’ shell -option causes the shell to save the command with embedded newlines -instead of semicolons. The ‘shopt’ builtin is used to set these -options. *Note The Shopt Builtin::, for a description of ‘shopt’. +list. The ‘HISTCONTROL’ and ‘HISTIGNORE’ variables are used to save +only a subset of the commands entered. The ‘cmdhist’ shell option, if +enabled, causes the shell to attempt to save each line of a multi-line +command in the same history entry, adding semicolons where necessary to +preserve syntactic correctness. The ‘lithist’ shell option modifies +‘cmdhist’ by saving the command with embedded newlines instead of +semicolons. The ‘shopt’ builtin is used to set these options. *Note +The Shopt Builtin::, for a description of ‘shopt’.  File: bashref.info, Node: Bash History Builtins, Next: History Interaction, Prev: Bash History Facilities, Up: Using History Interactively @@ -10455,25 +10691,38 @@ history file. If LAST is not specified, it is set to FIRST. If FIRST is not specified, it is set to the previous command for editing and −16 - for listing. If the ‘-l’ flag is given, the commands are listed on - standard output. The ‘-n’ flag suppresses the command numbers when - listing. The ‘-r’ flag reverses the order of the listing. - Otherwise, the editor given by ENAME is invoked on a file - containing those commands. If ENAME is not given, the value of the - following variable expansion is used: ‘${FCEDIT:-${EDITOR:-vi}}’. - This says to use the value of the ‘FCEDIT’ variable if set, or the - value of the ‘EDITOR’ variable if that is set, or ‘vi’ if neither - is set. When editing is complete, the edited commands are echoed - and executed. - - In the second form, COMMAND is re-executed after each instance of - PAT in the selected command is replaced by REP. COMMAND is + for listing. + + If the ‘-l’ flag is supplied, the commands are listed on standard + output. The ‘-n’ flag suppresses the command numbers when listing. + The ‘-r’ flag reverses the order of the listing. + + Otherwise, ‘fc’ invokes the editor named by ENAME on a file + containing those commands. If ENAME is not supplied, ‘fc’ uses the + value of the following variable expansion: + ‘${FCEDIT:-${EDITOR:-vi}}’. This says to use the value of the + ‘FCEDIT’ variable if set, or the value of the ‘EDITOR’ variable if + that is set, or ‘vi’ if neither is set. When editing is complete, + ‘fc’ reads the file of edited commands and echoes and executes + them. + + In the second form, ‘fc’ re-executes COMMAND after replacing each + instance of PAT in the selected command with REP. COMMAND is interpreted the same as FIRST above. A useful alias to use with the ‘fc’ command is ‘r='fc -s'’, so that typing ‘r cc’ runs the last command beginning with ‘cc’ and typing ‘r’ re-executes the last command (*note Aliases::). + If the first form is used, the return value is zero unless an + invalid option is encountered or FIRST or LAST specify history + lines out of range. When editing and re-executing a file of + commands, the return value is the value of the last command + executed or failure if an error occurs with the temporary file. If + the second form is used, the return status is that of the + re-executed command, unless COMMAND does not specify a valid + history entry, in which case ‘fc’ returns a non-zero status. + ‘history’ history [N] history -c @@ -10482,19 +10731,20 @@ history file. history [-anrw] [FILENAME] history -ps ARG - With no options, display the history list with line numbers. Lines + With no options, display the history list with numbers. Entries prefixed with a ‘*’ have been modified. An argument of N lists - only the last N lines. If the shell variable ‘HISTTIMEFORMAT’ is + only the last N entries. If the shell variable ‘HISTTIMEFORMAT’ is set and not null, it is used as a format string for ‘strftime’(3) to display the time stamp associated with each displayed history - entry. No intervening blank is printed between the formatted time - stamp and the history line. + entry. If ‘history’ uses ‘HISTTIMEFORMAT’, it does not print an + intervening space between the formatted time stamp and the history + entry. Options, if supplied, have the following meanings: ‘-c’ Clear the history list. This may be combined with the other - options to replace the history list completely. + options to replace the history list. ‘-d OFFSET’ Delete the history entry at position OFFSET. If OFFSET is @@ -10511,7 +10761,7 @@ history file. and END are interpreted as described above. ‘-a’ - Append the new history lines to the history file. These are + Append the "new" history lines to the history file. These are history lines entered since the beginning of the current Bash session, but not already appended to the history file. @@ -10526,7 +10776,8 @@ history file. list. ‘-w’ - Write out the current history list to the history file. + Write the current history list to the history file, + overwriting it. ‘-p’ Perform history substitution on the ARGs and display the @@ -10534,13 +10785,21 @@ history file. the history list. ‘-s’ - The ARGs are added to the end of the history list as a single - entry. - - If a FILENAME argument is supplied when any of the ‘-w’, ‘-r’, - ‘-a’, or ‘-n’ options is used, Bash uses FILENAME as the history - file. If not, then the value of the ‘HISTFILE’ variable is used. - If ‘HISTFILE’ is unset or null, these options have no effect. + Add the ARGs to the end of the history list as a single entry. + The last command in the history list is removed before adding + the ARGs. + + If a FILENAME argument is supplied with any of the ‘-w’, ‘-r’, + ‘-a’, or ‘-n’ options, Bash uses FILENAME as the history file. If + not, it uses the value of the ‘HISTFILE’ variable. If ‘HISTFILE’ + is unset or null, these options have no effect. + + If the ‘HISTTIMEFORMAT’ variable is set, ‘history’ writes the time + stamp information associated with each history entry to the history + file, marked with the history comment character. When the history + file is read, lines beginning with the history comment character + followed immediately by a digit are interpreted as timestamps for + the following history entry. The return value is 0 unless an invalid option is encountered, an error occurs while reading or writing the history file, an invalid @@ -10553,9 +10812,15 @@ File: bashref.info, Node: History Interaction, Prev: Bash History Builtins, U 9.3 History Expansion ===================== -The History library provides a history expansion feature that is similar -to the history expansion provided by ‘csh’. This section describes the -syntax used to manipulate the history information. +The shell provides a history expansion feature that is similar to the +history expansion provided by ‘csh’ (also referred to as history +substitution where appropriate). This section describes the syntax used +to manipulate the history information. + + History expansion is enabled by default for interactive shells, and +can be disabled using the ‘+H’ option to the ‘set’ builtin command +(*note The Set Builtin::). Non-interactive shells do not perform +history expansion by default, but it can be enabled with ‘set -H’. History expansions introduce words from the history list into the input stream, making it easy to repeat commands, insert the arguments to @@ -10568,17 +10833,17 @@ line individually. Bash attempts to inform the history expansion functions about quoting still in effect from previous lines. History expansion takes place in two parts. The first is to -determine which line from the history list should be used during -substitution. The second is to select portions of that line for -inclusion into the current one. - - The line selected from the history is called the “event”, and the -portions of that line that are acted upon are called “words”. The line -is broken into words in the same fashion that Bash does, so that several -words surrounded by quotes are considered one word. The “event -designator” selects the event, the optional “word designator” selects -words from the event, and various optional “modifiers” are available to -manipulate the selected words. +determine which entry from the history list should be used during +substitution. The second is to select portions of that entry to include +into the current one. + + The entry selected from the history is called the “event”, and the +portions of that entry that are acted upon are called “words”. The +history entry is broken into words in the same fashion that Bash does, +so that several words surrounded by quotes are considered one word. The +“event designator” selects the event, the optional “word designator” +selects words from the event, and various optional “modifiers” are +available to manipulate the selected words. History expansions are introduced by the appearance of the history expansion character, which is ‘!’ by default. History expansions may @@ -10597,26 +10862,32 @@ history expansion character, but the history expansion character is also treated as quoted if it immediately precedes the closing double quote in a double-quoted string. + Several characters inhibit history expansion if found immediately +following the history expansion character, even if it is unquoted: +space, tab, newline, carriage return, ‘=’, and the other shell +metacharacters. + There is a special abbreviation for substitution, active when the QUICK SUBSTITUTION character (default ‘^’) is the first character on the -line. It selects the previous history list entry, using an event -designator equivalent to ‘!!’, and substitutes one string for another in -that line. It is described below (*note Event Designators::). This is -the only history expansion that does not begin with the history -expansion character. +line. It selects the previous history entry, using an event designator +equivalent to ‘!!’, and substitutes one string for another in that +entry. It is described below (*note Event Designators::). This is the +only history expansion that does not begin with the history expansion +character. Several shell options settable with the ‘shopt’ builtin (*note The -Shopt Builtin::) may be used to tailor the behavior of history -expansion. If the ‘histverify’ shell option is enabled, and Readline is -being used, history substitutions are not immediately passed to the -shell parser. Instead, the expanded line is reloaded into the Readline -editing buffer for further modification. If Readline is being used, and -the ‘histreedit’ shell option is enabled, a failed history expansion -will be reloaded into the Readline editing buffer for correction. The -‘-p’ option to the ‘history’ builtin command may be used to see what a -history expansion will do before using it. The ‘-s’ option to the -‘history’ builtin may be used to add commands to the end of the history -list without actually executing them, so that they are available for +Shopt Builtin::) will modify history expansion behavior If the +‘histverify’ shell option is enabled, and Readline is being used, +history substitutions are not immediately passed to the shell parser. +Instead, the expanded line is reloaded into the Readline editing buffer +for further modification. If Readline is being used, and the +‘histreedit’ shell option is enabled, a failed history expansion is +reloaded into the Readline editing buffer for correction. + + The ‘-p’ option to the ‘history’ builtin command shows what a history +expansion will do before using it. The ‘-s’ option to the ‘history’ +builtin may be used to add commands to the end of the history list +without actually executing them, so that they are available for subsequent recall. This is most useful in conjunction with Readline. The shell allows control of the various characters used by the @@ -10636,12 +10907,12 @@ File: bashref.info, Node: Event Designators, Next: Word Designators, Up: Hist 9.3.1 Event Designators ----------------------- -An event designator is a reference to a command line entry in the -history list. Unless the reference is absolute, events are relative to -the current position in the history list. The event designator consists -of the portion of the word beginning with the history expansion -character, and ending with the word designator if one is present, or the -end of the word. +An event designator is a reference to an entry in the history list. +Unless the reference is absolute, events are relative to the current +position in the history list. The event designator consists of the +portion of the word beginning with the history expansion character, and +ending with the word designator if one is present, or the end of the +word. ‘!’ Start a history substitution, except when followed by a space, tab, @@ -10649,10 +10920,10 @@ end of the word. defined above (*note Definitions::). ‘!N’ - Refer to command line N. + Refer to history list entry N. ‘!-N’ - Refer to the command N lines back. + Refer to the history entry N entries back. ‘!!’ Refer to the previous command. This is a synonym for ‘!-1’. @@ -10665,8 +10936,8 @@ end of the word. Refer to the most recent command preceding the current position in the history list containing STRING. The trailing ‘?’ may be omitted if the STRING is followed immediately by a newline. If - STRING is missing, the string from the most recent search is used; - it is an error if there is no previous search string. + STRING is missing, this uses the string from the most recent + search; it is an error if there is no previous search string. ‘^STRING1^STRING2^’ Quick Substitution. Repeat the last command, replacing STRING1 @@ -10713,10 +10984,11 @@ spaces. The Nth word. ‘^’ - The first argument; that is, word 1. + The first argument: word 1. ‘$’ - The last argument. + The last argument. This is usually the last argument, but will + expand to the zeroth word if there is only one word in the line. ‘%’ The first word matched by the most recent ‘?STRING?’ search, if the @@ -10731,17 +11003,17 @@ spaces. ‘*’ All of the words, except the ‘0’th. This is a synonym for ‘1-$’. It is not an error to use ‘*’ if there is just one word in the - event; the empty string is returned in that case. + event; it expands to the empty string in this case. ‘X*’ - Abbreviates ‘X-$’ + Abbreviates ‘X-$’. ‘X-’ Abbreviates ‘X-$’ like ‘X*’, but omits the last word. If ‘x’ is missing, it defaults to 0. If a word designator is supplied without an event specification, the -previous command is used as the event. +previous command is used as the event, equivalent to ‘!!’.  File: bashref.info, Node: Modifiers, Prev: Word Designators, Up: History Interaction @@ -10775,18 +11047,18 @@ or edit, the word or words selected from the history event. ‘x’ Quote the substituted words as with ‘q’, but break into words at spaces, tabs, and newlines. The ‘q’ and ‘x’ modifiers are mutually - exclusive; the last one supplied is used. + exclusive; expansion uses the last one supplied. ‘s/OLD/NEW/’ Substitute NEW for the first occurrence of OLD in the event line. Any character may be used as the delimiter in place of ‘/’. The delimiter may be quoted in OLD and NEW with a single backslash. If - ‘&’ appears in NEW, it is replaced by OLD. A single backslash will - quote the ‘&’. If OLD is null, it is set to the last OLD - substituted, or, if no previous history substitutions took place, - the last STRING in a !?STRING‘[?]’ search. If NEW is null, each - matching OLD is deleted. The final delimiter is optional if it is - the last character on the input line. + ‘&’ appears in NEW, it is replaced with OLD. A single backslash + will quote the ‘&’ in OLD and NEW. If OLD is null, it is set to + the last OLD substituted, or, if no previous history substitutions + took place, the last STRING in a !?STRING‘[?]’ search. If NEW is + null, each matching OLD is deleted. The final delimiter is + optional if it is the last character on the input line. ‘&’ Repeat the previous substitution. @@ -10810,7 +11082,7 @@ This chapter provides basic instructions for installing Bash on the various supported platforms. The distribution supports the GNU operating systems, nearly every version of Unix, and several non-Unix systems such as BeOS and Interix. Other independent ports exist for -MS-DOS, OS/2, and Windows platforms. +Windows platforms. * Menu: @@ -10857,8 +11129,8 @@ These are installation instructions for Bash. files, some supplemental documentation, a number of example loadable builtin commands, and a set of header files for developing loadable builtins. You may need additional privileges to install - ‘bash’ to your desired destination, so ‘sudo make install’ might be - required. More information about controlling the locations where + ‘bash’ to your desired destination, which may require ‘sudo make + install’. More information about controlling the locations where ‘bash’ and other files are installed is below (*note Installation Names::). @@ -11084,7 +11356,7 @@ File: bashref.info, Node: Optional Features, Prev: Operation Controls, Up: In The Bash ‘configure’ has a number of ‘--enable-FEATURE’ options, where FEATURE indicates an optional part of Bash. There are also several ‘--with-PACKAGE’ options, where PACKAGE is something like ‘bash-malloc’ -or ‘purify’. To turn off the default use of a package, use +or ‘afs’. To turn off the default use of a package, use ‘--without-PACKAGE’. To configure Bash without a feature that is enabled by default, use ‘--disable-FEATURE’. @@ -11096,18 +11368,18 @@ the Bash ‘configure’ recognizes. ‘--with-bash-malloc’ Use the Bash version of ‘malloc’ in the directory ‘lib/malloc’. - This is not the same ‘malloc’ that appears in GNU libc, but an - older version originally derived from the 4.2 BSD ‘malloc’. This - ‘malloc’ is very fast, but wastes some space on each allocation. - This option is enabled by default. The ‘NOTES’ file contains a - list of systems for which this should be turned off, and - ‘configure’ disables this option automatically for a number of - systems. + This is not the same ‘malloc’ that appears in GNU libc, but a + custom version originally derived from the 4.2 BSD ‘malloc’. This + ‘malloc’ is very fast, but wastes some space on each allocation, + though it uses several techniques to minimize the waste. This + option is enabled by default. The ‘NOTES’ file contains a list of + systems for which this should be turned off, and ‘configure’ + disables this option automatically for a number of systems. ‘--with-curses’ - Use the curses library instead of the termcap library. This should - be supplied if your system has an inadequate or incomplete termcap - database. + Use the curses library instead of the termcap library. ‘configure’ + usually chooses this automatically, since most systems include the + termcap functions in the curses library. ‘--with-gnu-malloc’ A synonym for ‘--with-bash-malloc’. @@ -11124,7 +11396,9 @@ the Bash ‘configure’ recognizes. set to any other value, ‘configure’ treats it as a directory pathname and looks for the installed version of Readline in subdirectories of that directory (include files in PREFIX/‘include’ - and the library in PREFIX/‘lib’). + and the library in PREFIX/‘lib’). The Bash default is to link with + a static library built in the ‘lib/readline’ subdirectory of the + build directory. ‘--with-libintl-prefix[=PREFIX]’ Define this to make Bash link with a locally-installed version of @@ -11132,10 +11406,11 @@ the Bash ‘configure’ recognizes. ‘--with-libiconv-prefix[=PREFIX]’ Define this to make Bash look for libiconv in PREFIX instead of the - standard system locations. There is no version included with Bash. + standard system locations. The Bash distribution does not include + this library. ‘--enable-minimal-config’ - This produces a shell with minimal features, close to the + This produces a shell with minimal features, closer to the historical Bourne shell. There are several ‘--enable-’ options that alter how Bash is @@ -11192,6 +11467,12 @@ does not provide the necessary support. Include support for ‘csh’-like history substitution (*note History Interaction::). +‘--enable-bash-source-fullpath-default’ + Set the default value of the ‘bash_source_fullpath’ shell option + described above under *note The Shopt Builtin:: to be enabled. + This controls how filenames are assigned to the ‘BASH_SOURCE’ array + variable. + ‘--enable-brace-expansion’ Include ‘csh’-like brace expansion ( ‘b{a,b}c’ ↦ ‘bac bbc’ ). See *note Brace Expansion::, for a complete description. @@ -11208,8 +11489,9 @@ does not provide the necessary support. ‘--enable-command-timing’ Include support for recognizing ‘time’ as a reserved word and for displaying timing statistics for the pipeline following ‘time’ - (*note Pipelines::). This allows pipelines as well as shell - builtins and functions to be timed. + (*note Pipelines::). This allows timing pipelines, shell compound + commands, shell builtins, and shell functions, which an external + command cannot do easily. ‘--enable-cond-command’ Include support for the ‘[[’ conditional command. (*note @@ -11312,13 +11594,13 @@ does not provide the necessary support. version of the Readline library (*note Command Line Editing::). ‘--enable-restricted’ - Include support for a “restricted shell”. If this is enabled, - Bash, when called as ‘rbash’, enters a restricted mode. See *note - The Restricted Shell::, for a description of restricted mode. + Include support for a “restricted shell”. If this is enabled, Bash + enters a restricted mode when called as ‘rbash’. See *note The + Restricted Shell::, for a description of restricted mode. ‘--enable-select’ - Include the ‘select’ compound command, which allows the generation - of simple menus (*note Conditional Constructs::). + Include the ‘select’ compound command, which allows generation of + simple menus (*note Conditional Constructs::). ‘--enable-single-help-strings’ Store the text displayed by the ‘help’ builtin as a single string @@ -11358,8 +11640,8 @@ Appendix A Reporting Bugs Please report all bugs you find in Bash. But first, you should make sure that it really is a bug, and that it appears in the latest version -of Bash. The latest version of Bash is always available for FTP from - and from +of Bash. The latest released version of Bash is always available for +FTP from and from . Once you have determined that a bug actually exists, use the @@ -12299,100 +12581,100 @@ D.1 Index of Shell Builtin Commands * .: Bourne Shell Builtins. (line 17) * [: Bourne Shell Builtins. - (line 289) + (line 333) * alias: Bash Builtins. (line 11) * bg: Job Control Builtins. (line 7) -* bind: Bash Builtins. (line 21) +* bind: Bash Builtins. (line 24) * break: Bourne Shell Builtins. - (line 41) -* builtin: Bash Builtins. (line 124) -* caller: Bash Builtins. (line 133) + (line 47) +* builtin: Bash Builtins. (line 133) +* caller: Bash Builtins. (line 142) * cd: Bourne Shell Builtins. - (line 49) -* command: Bash Builtins. (line 150) + (line 55) +* command: Bash Builtins. (line 159) * compgen: Programmable Completion Builtins. (line 12) * complete: Programmable Completion Builtins. - (line 36) + (line 37) * compopt: Programmable Completion Builtins. - (line 248) + (line 253) * continue: Bourne Shell Builtins. - (line 94) -* declare: Bash Builtins. (line 170) + (line 102) +* declare: Bash Builtins. (line 179) * dirs: Directory Stack Builtins. (line 7) * disown: Job Control Builtins. - (line 110) -* echo: Bash Builtins. (line 273) -* enable: Bash Builtins. (line 322) + (line 114) +* echo: Bash Builtins. (line 284) +* enable: Bash Builtins. (line 337) * eval: Bourne Shell Builtins. - (line 103) -* exec: Bourne Shell Builtins. (line 111) +* exec: Bourne Shell Builtins. + (line 119) * exit: Bourne Shell Builtins. - (line 129) + (line 141) * export: Bourne Shell Builtins. - (line 136) + (line 148) * false: Bourne Shell Builtins. - (line 152) + (line 170) * fc: Bash History Builtins. (line 10) * fg: Job Control Builtins. (line 17) * getopts: Bourne Shell Builtins. - (line 157) + (line 175) * hash: Bourne Shell Builtins. - (line 201) -* help: Bash Builtins. (line 360) + (line 226) +* help: Bash Builtins. (line 374) * history: Bash History Builtins. - (line 46) + (line 59) * jobs: Job Control Builtins. (line 27) * kill: Job Control Builtins. - (line 58) -* let: Bash Builtins. (line 379) -* local: Bash Builtins. (line 387) -* logout: Bash Builtins. (line 404) -* mapfile: Bash Builtins. (line 409) + (line 59) +* let: Bash Builtins. (line 394) +* local: Bash Builtins. (line 403) +* logout: Bash Builtins. (line 428) +* mapfile: Bash Builtins. (line 433) * popd: Directory Stack Builtins. - (line 35) -* printf: Bash Builtins. (line 455) + (line 37) +* printf: Bash Builtins. (line 478) * pushd: Directory Stack Builtins. - (line 69) + (line 70) * pwd: Bourne Shell Builtins. - (line 226) -* read: Bash Builtins. (line 525) -* readarray: Bash Builtins. (line 631) + (line 258) +* read: Bash Builtins. (line 548) +* readarray: Bash Builtins. (line 659) * readonly: Bourne Shell Builtins. - (line 236) + (line 270) * return: Bourne Shell Builtins. - (line 255) + (line 295) * set: The Set Builtin. (line 11) * shift: Bourne Shell Builtins. - (line 276) + (line 320) * shopt: The Shopt Builtin. (line 9) -* source: Bash Builtins. (line 640) +* source: Bash Builtins. (line 668) * suspend: Job Control Builtins. - (line 122) + (line 131) * test: Bourne Shell Builtins. - (line 289) + (line 333) * times: Bourne Shell Builtins. - (line 391) + (line 433) * trap: Bourne Shell Builtins. - (line 397) + (line 439) * true: Bourne Shell Builtins. - (line 459) -* type: Bash Builtins. (line 645) -* typeset: Bash Builtins. (line 683) -* ulimit: Bash Builtins. (line 689) + (line 505) +* type: Bash Builtins. (line 673) +* typeset: Bash Builtins. (line 710) +* ulimit: Bash Builtins. (line 716) * umask: Bourne Shell Builtins. - (line 464) -* unalias: Bash Builtins. (line 795) + (line 510) +* unalias: Bash Builtins. (line 824) * unset: Bourne Shell Builtins. - (line 482) + (line 528) * wait: Job Control Builtins. - (line 76) + (line 80)  File: bashref.info, Node: Reserved Word Index, Next: Variable Index, Prev: Builtin Index, Up: Indexes @@ -12405,9 +12687,9 @@ D.2 Index of Shell Reserved Words * !: Pipelines. (line 9) * [[: Conditional Constructs. - (line 125) + (line 126) * ]]: Conditional Constructs. - (line 125) + (line 126) * {: Command Grouping. (line 21) * }: Command Grouping. (line 21) * case: Conditional Constructs. @@ -12429,7 +12711,7 @@ D.2 Index of Shell Reserved Words * in: Conditional Constructs. (line 28) * select: Conditional Constructs. - (line 83) + (line 84) * then: Conditional Constructs. (line 7) * time: Pipelines. (line 9) @@ -12446,51 +12728,51 @@ D.3 Parameter and Variable Index * Menu: * _: Bash Variables. (line 13) -* -: Special Parameters. (line 46) -* !: Special Parameters. (line 55) -* ?: Special Parameters. (line 42) -* @: Special Parameters. (line 22) -* *: Special Parameters. (line 9) -* #: Special Parameters. (line 39) -* $: Special Parameters. (line 51) +* -: Special Parameters. (line 48) +* !: Special Parameters. (line 57) +* ?: Special Parameters. (line 44) +* @: Special Parameters. (line 23) +* *: Special Parameters. (line 10) +* #: Special Parameters. (line 41) +* $: Special Parameters. (line 53) * $_: Bash Variables. (line 14) -* $-: Special Parameters. (line 47) -* $!: Special Parameters. (line 56) -* $?: Special Parameters. (line 43) -* $@: Special Parameters. (line 23) -* $*: Special Parameters. (line 10) -* $#: Special Parameters. (line 40) -* $$: Special Parameters. (line 52) -* $0: Special Parameters. (line 61) -* 0: Special Parameters. (line 60) +* $-: Special Parameters. (line 49) +* $!: Special Parameters. (line 58) +* $?: Special Parameters. (line 45) +* $@: Special Parameters. (line 24) +* $*: Special Parameters. (line 11) +* $#: Special Parameters. (line 42) +* $$: Special Parameters. (line 54) +* $0: Special Parameters. (line 63) +* 0: Special Parameters. (line 62) * active-region-end-color: Readline Init File Syntax. (line 51) * active-region-start-color: Readline Init File Syntax. (line 38) * auto_resume: Job Control Variables. (line 6) -* BASH: Bash Variables. (line 23) -* BASH_ALIASES: Bash Variables. (line 42) -* BASH_ARGC: Bash Variables. (line 51) -* BASH_ARGV: Bash Variables. (line 65) -* BASH_ARGV0: Bash Variables. (line 78) -* BASH_CMDS: Bash Variables. (line 86) -* BASH_COMMAND: Bash Variables. (line 95) -* BASH_COMPAT: Bash Variables. (line 102) -* BASH_ENV: Bash Variables. (line 118) -* BASH_EXECUTION_STRING: Bash Variables. (line 124) -* BASH_LINENO: Bash Variables. (line 127) -* BASH_LOADABLES_PATH: Bash Variables. (line 137) -* BASH_MONOSECONDS: Bash Variables. (line 141) -* BASH_REMATCH: Bash Variables. (line 148) -* BASH_SOURCE: Bash Variables. (line 156) -* BASH_SUBSHELL: Bash Variables. (line 164) -* BASH_TRAPSIG: Bash Variables. (line 170) -* BASH_VERSINFO: Bash Variables. (line 176) -* BASH_VERSION: Bash Variables. (line 199) -* BASH_XTRACEFD: Bash Variables. (line 202) -* BASHOPTS: Bash Variables. (line 26) -* BASHPID: Bash Variables. (line 35) +* 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) +* BASHOPTS: Bash Variables. (line 27) +* BASHPID: Bash Variables. (line 36) * bell-style: Readline Init File Syntax. (line 64) * bind-tty-special-chars: Readline Init File Syntax. @@ -12499,21 +12781,21 @@ D.3 Parameter and Variable Index (line 79) * CDPATH: Bourne Shell Variables. (line 9) -* CHILD_MAX: Bash Variables. (line 213) +* CHILD_MAX: Bash Variables. (line 215) * colored-completion-prefix: Readline Init File Syntax. (line 84) * colored-stats: Readline Init File Syntax. (line 94) -* COLUMNS: Bash Variables. (line 220) +* COLUMNS: Bash Variables. (line 222) * comment-begin: Readline Init File Syntax. (line 100) -* COMP_CWORD: Bash Variables. (line 226) -* COMP_KEY: Bash Variables. (line 255) -* COMP_LINE: Bash Variables. (line 232) -* COMP_POINT: Bash Variables. (line 237) -* COMP_TYPE: Bash Variables. (line 245) -* COMP_WORDBREAKS: Bash Variables. (line 259) -* COMP_WORDS: Bash Variables. (line 265) +* COMP_CWORD: Bash Variables. (line 228) +* COMP_KEY: Bash Variables. (line 234) +* COMP_LINE: Bash Variables. (line 240) +* COMP_POINT: Bash Variables. (line 245) +* COMP_TYPE: Bash Variables. (line 253) +* COMP_WORDBREAKS: Bash Variables. (line 263) +* COMP_WORDS: Bash Variables. (line 269) * completion-display-width: Readline Init File Syntax. (line 105) * completion-ignore-case: Readline Init File Syntax. @@ -12524,18 +12806,18 @@ D.3 Parameter and Variable Index (line 123) * completion-query-items: Readline Init File Syntax. (line 130) -* COMPREPLY: Bash Variables. (line 272) +* COMPREPLY: Bash Variables. (line 276) * convert-meta: Readline Init File Syntax. (line 141) -* COPROC: Bash Variables. (line 278) -* DIRSTACK: Bash Variables. (line 282) +* COPROC: Bash Variables. (line 282) +* DIRSTACK: Bash Variables. (line 286) * disable-completion: Readline Init File Syntax. (line 153) * echo-control-characters: Readline Init File Syntax. (line 158) * editing-mode: Readline Init File Syntax. (line 163) -* EMACS: Bash Variables. (line 292) +* EMACS: Bash Variables. (line 296) * emacs-mode-string: Readline Init File Syntax. (line 169) * enable-active-region: Readline Init File Syntax. @@ -12544,72 +12826,72 @@ D.3 Parameter and Variable Index (line 192) * enable-keypad: Readline Init File Syntax. (line 201) -* ENV: Bash Variables. (line 297) -* EPOCHREALTIME: Bash Variables. (line 302) -* EPOCHSECONDS: Bash Variables. (line 310) -* EUID: Bash Variables. (line 317) -* EXECIGNORE: Bash Variables. (line 321) +* ENV: Bash Variables. (line 301) +* EPOCHREALTIME: Bash Variables. (line 306) +* EPOCHSECONDS: Bash Variables. (line 314) +* EUID: Bash Variables. (line 321) +* EXECIGNORE: Bash Variables. (line 325) * expand-tilde: Readline Init File Syntax. (line 216) -* FCEDIT: Bash Variables. (line 334) -* FIGNORE: Bash Variables. (line 338) +* FCEDIT: Bash Variables. (line 337) +* FIGNORE: Bash Variables. (line 340) * force-meta-prefix: Readline Init File Syntax. (line 220) -* FUNCNAME: Bash Variables. (line 344) -* FUNCNEST: Bash Variables. (line 361) -* GLOBIGNORE: Bash Variables. (line 366) -* GLOBSORT: Bash Variables. (line 373) -* GROUPS: Bash Variables. (line 408) -* histchars: Bash Variables. (line 414) -* HISTCMD: Bash Variables. (line 429) -* HISTCONTROL: Bash Variables. (line 435) -* HISTFILE: Bash Variables. (line 451) -* HISTFILESIZE: Bash Variables. (line 456) -* HISTIGNORE: Bash Variables. (line 467) +* FUNCNAME: Bash Variables. (line 346) +* FUNCNEST: Bash Variables. (line 363) +* GLOBIGNORE: Bash Variables. (line 368) +* GLOBSORT: Bash Variables. (line 375) +* GROUPS: Bash Variables. (line 410) +* histchars: Bash Variables. (line 416) +* HISTCMD: Bash Variables. (line 431) +* HISTCONTROL: Bash Variables. (line 437) +* HISTFILE: Bash Variables. (line 455) +* HISTFILESIZE: Bash Variables. (line 461) +* HISTIGNORE: Bash Variables. (line 472) * history-preserve-point: Readline Init File Syntax. (line 233) * history-size: Readline Init File Syntax. (line 239) -* HISTSIZE: Bash Variables. (line 489) -* HISTTIMEFORMAT: Bash Variables. (line 496) +* HISTSIZE: Bash Variables. (line 496) +* HISTTIMEFORMAT: Bash Variables. (line 503) * HOME: Bourne Shell Variables. (line 13) * horizontal-scroll-mode: Readline Init File Syntax. (line 248) -* HOSTFILE: Bash Variables. (line 505) -* HOSTNAME: Bash Variables. (line 516) -* HOSTTYPE: Bash Variables. (line 519) +* HOSTFILE: Bash Variables. (line 512) +* HOSTNAME: Bash Variables. (line 523) +* HOSTTYPE: Bash Variables. (line 526) * IFS: Bourne Shell Variables. (line 18) -* IGNOREEOF: Bash Variables. (line 522) +* IGNOREEOF: Bash Variables. (line 529) * input-meta: Readline Init File Syntax. (line 257) -* INPUTRC: Bash Variables. (line 532) -* INSIDE_EMACS: Bash Variables. (line 536) +* INPUTRC: Bash Variables. (line 538) +* INSIDE_EMACS: Bash Variables. (line 542) * isearch-terminators: Readline Init File Syntax. (line 268) * keymap: Readline Init File Syntax. (line 275) * LANG: Creating Internationalized Scripts. (line 51) -* LANG <1>: Bash Variables. (line 542) -* LC_ALL: Bash Variables. (line 546) -* LC_COLLATE: Bash Variables. (line 550) -* LC_CTYPE: Bash Variables. (line 557) +* LANG <1>: Bash Variables. (line 548) +* LC_ALL: Bash Variables. (line 552) +* LC_COLLATE: Bash Variables. (line 556) +* LC_CTYPE: Bash Variables. (line 563) * LC_MESSAGES: Creating Internationalized Scripts. (line 51) -* LC_MESSAGES <1>: Bash Variables. (line 562) -* LC_NUMERIC: Bash Variables. (line 566) -* LC_TIME: Bash Variables. (line 570) -* LINENO: Bash Variables. (line 574) -* LINES: Bash Variables. (line 579) -* MACHTYPE: Bash Variables. (line 585) +* LC_MESSAGES <1>: Bash Variables. (line 568) +* LC_NUMERIC: Bash Variables. (line 572) +* LC_TIME: Bash Variables. (line 576) +* LINENO: Bash Variables. (line 580) +* LINES: Bash Variables. (line 587) +* MACHTYPE: Bash Variables. (line 593) * MAIL: Bourne Shell Variables. - (line 22) -* MAILCHECK: Bash Variables. (line 589) + (line 24) +* MAILCHECK: Bash Variables. (line 597) * MAILPATH: Bourne Shell Variables. - (line 27) -* MAPFILE: Bash Variables. (line 597) + (line 29) +* MAPFILE: Bash Variables. (line 605) * mark-modified-lines: Readline Init File Syntax. (line 305) * mark-symlinked-directories: Readline Init File Syntax. @@ -12620,69 +12902,69 @@ D.3 Parameter and Variable Index (line 322) * meta-flag: Readline Init File Syntax. (line 257) -* OLDPWD: Bash Variables. (line 601) +* OLDPWD: Bash Variables. (line 609) * OPTARG: Bourne Shell Variables. - (line 34) -* OPTERR: Bash Variables. (line 604) + (line 36) +* OPTERR: Bash Variables. (line 612) * OPTIND: Bourne Shell Variables. - (line 38) -* OSTYPE: Bash Variables. (line 608) + (line 40) +* OSTYPE: Bash Variables. (line 617) * output-meta: Readline Init File Syntax. (line 327) * page-completions: Readline Init File Syntax. (line 336) * PATH: Bourne Shell Variables. - (line 42) -* PIPESTATUS: Bash Variables. (line 611) -* POSIXLY_CORRECT: Bash Variables. (line 617) -* PPID: Bash Variables. (line 627) -* PROMPT_COMMAND: Bash Variables. (line 631) -* PROMPT_DIRTRIM: Bash Variables. (line 637) -* PS0: Bash Variables. (line 643) + (line 44) +* PIPESTATUS: Bash Variables. (line 620) +* POSIXLY_CORRECT: Bash Variables. (line 626) +* PPID: Bash Variables. (line 636) +* PROMPT_COMMAND: Bash Variables. (line 640) +* PROMPT_DIRTRIM: Bash Variables. (line 646) +* PS0: Bash Variables. (line 652) * PS1: Bourne Shell Variables. - (line 48) -* PS2: Bourne Shell Variables. (line 53) -* PS3: Bash Variables. (line 648) -* PS4: Bash Variables. (line 653) -* PWD: Bash Variables. (line 661) -* RANDOM: Bash Variables. (line 664) -* READLINE_ARGUMENT: Bash Variables. (line 670) -* READLINE_LINE: Bash Variables. (line 674) -* READLINE_MARK: Bash Variables. (line 678) -* READLINE_POINT: Bash Variables. (line 684) -* REPLY: Bash Variables. (line 688) +* PS2: Bourne Shell Variables. + (line 58) +* PS3: Bash Variables. (line 657) +* PS4: Bash Variables. (line 662) +* PWD: Bash Variables. (line 670) +* RANDOM: Bash Variables. (line 673) +* READLINE_ARGUMENT: Bash Variables. (line 681) +* READLINE_LINE: Bash Variables. (line 685) +* READLINE_MARK: Bash Variables. (line 689) +* READLINE_POINT: Bash Variables. (line 695) +* REPLY: Bash Variables. (line 699) * revert-all-at-newline: Readline Init File Syntax. - (line 346) + (line 349) * search-ignore-case: Readline Init File Syntax. - (line 353) -* SECONDS: Bash Variables. (line 691) -* SHELL: Bash Variables. (line 701) -* SHELLOPTS: Bash Variables. (line 706) -* SHLVL: Bash Variables. (line 715) + (line 356) +* SECONDS: Bash Variables. (line 703) +* SHELL: Bash Variables. (line 713) +* SHELLOPTS: Bash Variables. (line 718) +* SHLVL: Bash Variables. (line 727) * show-all-if-ambiguous: Readline Init File Syntax. - (line 358) + (line 361) * show-all-if-unmodified: Readline Init File Syntax. - (line 364) + (line 367) * show-mode-in-prompt: Readline Init File Syntax. - (line 373) + (line 376) * skip-completed-text: Readline Init File Syntax. - (line 379) -* SRANDOM: Bash Variables. (line 720) + (line 382) +* SRANDOM: Bash Variables. (line 732) * TEXTDOMAIN: Creating Internationalized Scripts. (line 51) * TEXTDOMAINDIR: Creating Internationalized Scripts. (line 51) -* TIMEFORMAT: Bash Variables. (line 729) -* TMOUT: Bash Variables. (line 767) -* TMPDIR: Bash Variables. (line 779) -* UID: Bash Variables. (line 783) +* TIMEFORMAT: Bash Variables. (line 741) +* TMOUT: Bash Variables. (line 780) +* TMPDIR: Bash Variables. (line 792) +* UID: Bash Variables. (line 796) * vi-cmd-mode-string: Readline Init File Syntax. - (line 392) + (line 395) * vi-ins-mode-string: Readline Init File Syntax. - (line 403) + (line 406) * visible-stats: Readline Init File Syntax. - (line 414) + (line 417)  File: bashref.info, Node: Function Index, Next: Concept Index, Prev: Variable Index, Up: Indexes @@ -12904,14 +13186,14 @@ D.5 Concept Index * arithmetic evaluation: Shell Arithmetic. (line 6) * arithmetic expansion: Arithmetic Expansion. (line 6) -* arithmetic operators: Shell Arithmetic. (line 17) +* arithmetic operators: Shell Arithmetic. (line 18) * arithmetic, shell: Shell Arithmetic. (line 6) * arrays: Arrays. (line 6) * background: Job Control Basics. (line 6) * Bash configuration: Basic Installation. (line 6) * Bash installation: Basic Installation. (line 6) -* binary arithmetic operators: Shell Arithmetic. (line 17) -* bitwise arithmetic operators: Shell Arithmetic. (line 17) +* binary arithmetic operators: Shell Arithmetic. (line 18) +* bitwise arithmetic operators: Shell Arithmetic. (line 18) * Bourne shell: Basic Shell Features. (line 6) * brace expansion: Brace Expansion. (line 6) @@ -12945,11 +13227,12 @@ D.5 Concept Index (line 6) * completion builtins: Programmable Completion Builtins. (line 6) -* conditional arithmetic operator: Shell Arithmetic. (line 17) +* conditional arithmetic operator: Shell Arithmetic. (line 18) * configuration: Basic Installation. (line 6) * control operator: Definitions. (line 21) * coprocess: Coprocesses. (line 6) * directory stack: The Directory Stack. (line 6) +* dollar-single quote quoting: ANSI-C Quoting. (line 6) * editing command lines: Readline Bare Essentials. (line 6) * environment: Environment. (line 6) @@ -13033,7 +13316,7 @@ D.5 Concept Index * quoting: Quoting. (line 6) * quoting, ANSI: ANSI-C Quoting. (line 6) * Readline, how to use: Job Control Variables. - (line 23) + (line 22) * redirection: Redirections. (line 6) * reserved word: Definitions. (line 70) * reserved words: Reserved Words. (line 6) @@ -13056,7 +13339,7 @@ D.5 Concept Index * tilde expansion: Tilde Expansion. (line 6) * token: Definitions. (line 86) * translation, native languages: Locale Translation. (line 6) -* unary arithmetic operators: Shell Arithmetic. (line 17) +* unary arithmetic operators: Shell Arithmetic. (line 18) * variable, shell: Shell Parameters. (line 6) * variables, readline: Readline Init File Syntax. (line 37) @@ -13068,138 +13351,138 @@ D.5 Concept Index  Tag Table: -Node: Top904 -Node: Introduction2848 -Node: What is Bash?3064 -Node: What is a shell?4208 -Node: Definitions6790 -Node: Basic Shell Features9969 -Node: Shell Syntax11192 -Node: Shell Operation12222 -Node: Quoting13523 -Node: Escape Character14839 -Node: Single Quotes15340 -Node: Double Quotes15692 -Node: ANSI-C Quoting17038 -Node: Locale Translation18426 -Node: Creating Internationalized Scripts19773 -Node: Comments23974 -Node: Shell Commands24612 -Node: Reserved Words25554 -Node: Simple Commands26422 -Node: Pipelines27084 -Node: Lists30150 -Node: Compound Commands32025 -Node: Looping Constructs33037 -Node: Conditional Constructs35584 -Node: Command Grouping50448 -Node: Coprocesses51938 -Node: GNU Parallel54637 -Node: Shell Functions55558 -Node: Shell Parameters63667 -Node: Positional Parameters68203 -Node: Special Parameters69141 -Node: Shell Expansions72454 -Node: Brace Expansion74646 -Node: Tilde Expansion77312 -Node: Shell Parameter Expansion80081 -Node: Command Substitution99191 -Node: Arithmetic Expansion102727 -Node: Process Substitution103695 -Node: Word Splitting104835 -Node: Filename Expansion106979 -Node: Pattern Matching110078 -Node: Quote Removal115314 -Node: Redirections115621 -Node: Executing Commands125433 -Node: Simple Command Expansion126103 -Node: Command Search and Execution128217 -Node: Command Execution Environment130628 -Node: Environment133940 -Node: Exit Status135647 -Node: Signals137435 -Node: Shell Scripts141052 -Node: Shell Builtin Commands144147 -Node: Bourne Shell Builtins146261 -Node: Bash Builtins171034 -Node: Modifying Shell Behavior206136 -Node: The Set Builtin206481 -Node: The Shopt Builtin218067 -Node: Special Builtins235122 -Node: Shell Variables236114 -Node: Bourne Shell Variables236551 -Node: Bash Variables238747 -Node: Bash Features275945 -Node: Invoking Bash276962 -Node: Bash Startup Files283364 -Node: Interactive Shells288670 -Node: What is an Interactive Shell?289081 -Node: Is this Shell Interactive?289750 -Node: Interactive Shell Behavior290577 -Node: Bash Conditional Expressions294334 -Node: Shell Arithmetic299511 -Node: Aliases302596 -Node: Arrays305554 -Node: The Directory Stack312356 -Node: Directory Stack Builtins313156 -Node: Controlling the Prompt317608 -Node: The Restricted Shell320749 -Node: Bash POSIX Mode323539 -Node: Shell Compatibility Mode341801 -Node: Job Control350755 -Node: Job Control Basics351215 -Node: Job Control Builtins356526 -Node: Job Control Variables362473 -Node: Command Line Editing363653 -Node: Introduction and Notation365360 -Node: Readline Interaction367458 -Node: Readline Bare Essentials368649 -Node: Readline Movement Commands370470 -Node: Readline Killing Commands371470 -Node: Readline Arguments373451 -Node: Searching374511 -Node: Readline Init File376743 -Node: Readline Init File Syntax378028 -Node: Conditional Init Constructs404571 -Node: Sample Init File408939 -Node: Bindable Readline Commands412063 -Node: Commands For Moving413291 -Node: Commands For History415521 -Node: Commands For Text420729 -Node: Commands For Killing424866 -Node: Numeric Arguments427670 -Node: Commands For Completion428825 -Node: Keyboard Macros433144 -Node: Miscellaneous Commands433848 -Node: Readline vi Mode440505 -Node: Programmable Completion441460 -Node: Programmable Completion Builtins449420 -Node: A Programmable Completion Example460989 -Node: Using History Interactively466337 -Node: Bash History Facilities467021 -Node: Bash History Builtins470136 -Node: History Interaction475382 -Node: Event Designators479710 -Node: Word Designators481296 -Node: Modifiers483451 -Node: Installing Bash485363 -Node: Basic Installation486500 -Node: Compilers and Options490382 -Node: Compiling For Multiple Architectures491135 -Node: Installation Names492887 -Node: Specifying the System Type495124 -Node: Sharing Defaults495873 -Node: Operation Controls496590 -Node: Optional Features497612 -Node: Reporting Bugs509417 -Node: Major Differences From The Bourne Shell510769 -Node: GNU Free Documentation License530507 -Node: Indexes555687 -Node: Builtin Index556141 -Node: Reserved Word Index563242 -Node: Variable Index565690 -Node: Function Index582965 -Node: Concept Index596824 +Node: Top906 +Node: Introduction2852 +Node: What is Bash?3068 +Node: What is a shell?4204 +Node: Definitions6798 +Node: Basic Shell Features9977 +Node: Shell Syntax11200 +Node: Shell Operation12230 +Node: Quoting13531 +Node: Escape Character14872 +Node: Single Quotes15410 +Node: Double Quotes15762 +Node: ANSI-C Quoting17110 +Node: Locale Translation18498 +Node: Creating Internationalized Scripts19908 +Node: Comments24109 +Node: Shell Commands24879 +Node: Reserved Words25821 +Node: Simple Commands26689 +Node: Pipelines27354 +Node: Lists30584 +Node: Compound Commands32459 +Node: Looping Constructs33471 +Node: Conditional Constructs35993 +Node: Command Grouping50928 +Node: Coprocesses52423 +Node: GNU Parallel55112 +Node: Shell Functions56033 +Node: Shell Parameters64513 +Node: Positional Parameters69254 +Node: Special Parameters70347 +Node: Shell Expansions73811 +Node: Brace Expansion76003 +Node: Tilde Expansion78721 +Node: Shell Parameter Expansion81666 +Node: Command Substitution101441 +Node: Arithmetic Expansion104977 +Node: Process Substitution105993 +Node: Word Splitting107112 +Node: Filename Expansion109212 +Node: Pattern Matching112483 +Node: Quote Removal117814 +Node: Redirections118121 +Node: Executing Commands128339 +Node: Simple Command Expansion129009 +Node: Command Search and Execution131120 +Node: Command Execution Environment133567 +Node: Environment137003 +Node: Exit Status138909 +Node: Signals140970 +Node: Shell Scripts144871 +Node: Shell Builtin Commands148172 +Node: Bourne Shell Builtins150286 +Node: Bash Builtins176588 +Node: Modifying Shell Behavior213033 +Node: The Set Builtin213378 +Node: The Shopt Builtin225317 +Node: Special Builtins242366 +Node: Shell Variables243358 +Node: Bourne Shell Variables243795 +Node: Bash Variables246306 +Node: Bash Features284566 +Node: Invoking Bash285583 +Node: Bash Startup Files292012 +Node: Interactive Shells297328 +Node: What is an Interactive Shell?297739 +Node: Is this Shell Interactive?298404 +Node: Interactive Shell Behavior299231 +Node: Bash Conditional Expressions302995 +Node: Shell Arithmetic308215 +Node: Aliases311557 +Node: Arrays314522 +Node: The Directory Stack321588 +Node: Directory Stack Builtins322388 +Node: Controlling the Prompt326836 +Node: The Restricted Shell329723 +Node: Bash POSIX Mode332608 +Node: Shell Compatibility Mode350870 +Node: Job Control359884 +Node: Job Control Basics360344 +Node: Job Control Builtins365655 +Node: Job Control Variables371826 +Node: Command Line Editing372997 +Node: Introduction and Notation374704 +Node: Readline Interaction376802 +Node: Readline Bare Essentials377993 +Node: Readline Movement Commands379814 +Node: Readline Killing Commands380814 +Node: Readline Arguments382795 +Node: Searching383855 +Node: Readline Init File386087 +Node: Readline Init File Syntax387372 +Node: Conditional Init Constructs413979 +Node: Sample Init File418347 +Node: Bindable Readline Commands421471 +Node: Commands For Moving422699 +Node: Commands For History424929 +Node: Commands For Text430137 +Node: Commands For Killing434274 +Node: Numeric Arguments437078 +Node: Commands For Completion438233 +Node: Keyboard Macros442552 +Node: Miscellaneous Commands443256 +Node: Readline vi Mode449913 +Node: Programmable Completion450868 +Node: Programmable Completion Builtins458862 +Node: A Programmable Completion Example470633 +Node: Using History Interactively475981 +Node: Bash History Facilities476665 +Node: Bash History Builtins480454 +Node: History Interaction486836 +Node: Event Designators491690 +Node: Word Designators493279 +Node: Modifiers495567 +Node: Installing Bash497503 +Node: Basic Installation498622 +Node: Compilers and Options502501 +Node: Compiling For Multiple Architectures503254 +Node: Installation Names505006 +Node: Specifying the System Type507243 +Node: Sharing Defaults507992 +Node: Operation Controls508709 +Node: Optional Features509731 +Node: Reporting Bugs522114 +Node: Major Differences From The Bourne Shell523475 +Node: GNU Free Documentation License543213 +Node: Indexes568393 +Node: Builtin Index568847 +Node: Reserved Word Index575948 +Node: Variable Index578396 +Node: Function Index595671 +Node: Concept Index609530  End Tag Table diff --git a/doc/bashref.log b/doc/bashref.log index 700ffa7b..8af76dd5 100644 --- a/doc/bashref.log +++ b/doc/bashref.log @@ -1,12 +1,12 @@ -This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024/MacPorts 2024.70613_0) (preloaded format=pdfetex 2024.4.9) 16 AUG 2024 17:10 +This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024/MacPorts 2024.70613_0) (preloaded format=pdfetex 2024.4.9) 7 OCT 2024 17:23 entering extended mode restricted \write18 enabled. file:line:error style messages enabled. %&-line parsing enabled. -**\input /usr/local/src/bash/bash-20240812/doc/bashref.texi \input /usr/local/s -rc/bash/bash-20240812/doc/bashref.texi -(/usr/local/src/bash/bash-20240812/doc/bashref.texi -(/usr/local/src/bash/bash-20240812/doc/texinfo.tex +**\input /usr/local/src/bash/bash-20240927/doc/bashref.texi \input /usr/local/s +rc/bash/bash-20240927/doc/bashref.texi +(/usr/local/src/bash/bash-20240927/doc/bashref.texi +(/usr/local/src/bash/bash-20240927/doc/texinfo.tex Loading texinfo [version 2015-11-22.14]: \outerhsize=\dimen16 \outervsize=\dimen17 @@ -162,15 +162,15 @@ This is `epsf.tex' v2.7.4 <14 February 2011> texinfo.tex: doing @include of version.texi -(/usr/local/src/bash/bash-20240812/doc/version.texi) [1{/opt/local/var/db/texmf +(/usr/local/src/bash/bash-20240927/doc/version.texi) [1{/opt/local/var/db/texmf /fonts/map/pdftex/updmap/pdftex.map}] [2] -(/usr/local/build/bash/bash-20240812/doc/bashref.toc [-1] [-2] [-3]) [-4] -(/usr/local/build/bash/bash-20240812/doc/bashref.toc) -(/usr/local/build/bash/bash-20240812/doc/bashref.toc) Chapter 1 +(/usr/local/build/bash/bash-20240927/doc/bashref.toc [-1] [-2] [-3]) [-4] +(/usr/local/build/bash/bash-20240927/doc/bashref.toc) +(/usr/local/build/bash/bash-20240927/doc/bashref.toc) Chapter 1 \openout0 = `bashref.toc'. -(/usr/local/build/bash/bash-20240812/doc/bashref.aux) +(/usr/local/build/bash/bash-20240927/doc/bashref.aux) \openout1 = `bashref.aux'. Chapter 2 [1] [2] @@ -183,7 +183,7 @@ texinfo.tex: doing @include of version.texi \openout3 = `bashref.vr'. [8] -Overfull \hbox (3.12749pt too wide) in paragraph at lines 723--724 +Overfull \hbox (3.12749pt too wide) in paragraph at lines 736--737 @texttt coproc[]| @hbox(9.34993+3.85005)x43.36464 @@ -195,7 +195,7 @@ Overfull \hbox (3.12749pt too wide) in paragraph at lines 723--724 .etc. -Overfull \hbox (3.12749pt too wide) in paragraph at lines 724--724 +Overfull \hbox (3.12749pt too wide) in paragraph at lines 737--737 @texttt select[]| @hbox(9.34993+3.85005)x43.36464 @@ -207,7 +207,7 @@ Overfull \hbox (3.12749pt too wide) in paragraph at lines 724--724 .etc. -Overfull \hbox (5.95723pt too wide) in paragraph at lines 724--725 +Overfull \hbox (5.95723pt too wide) in paragraph at lines 737--738 @texttt function[]| @hbox(9.34993+3.85005)x52.03227 @@ -218,20 +218,21 @@ Overfull \hbox (5.95723pt too wide) in paragraph at lines 724--725 .@texttt c .etc. +[9] @rwindfile=@write4 \openout4 = `bashref.rw'. -[9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19{/opt/local/share/texmf-tex -live/fonts/enc/dvips/cm-super/cm-super-t1.enc}] [20] [21] [22] [23] [24] + [10] [11] [12] [13] [14] [15] [16] [17] [18] [19{/opt/local/share/texmf-texliv +e/fonts/enc/dvips/cm-super/cm-super-t1.enc}] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] -[40] [41] [42] [43] [44] [45] [46] [47] Chapter 4 [48] +[40] [41] [42] [43] [44] [45] [46] [47] [48] Chapter 4 [49] @btindfile=@write5 \openout5 = `bashref.bt'. - [49] [50] [51] [52] + [50] [51] [52] [53] [54] [55] [56] [57] [58] [59] [60] [61] [62] [63] [64] [65] [66] [67] -[68] -Overfull \hbox (38.26585pt too wide) in paragraph at lines 5447--5447 +[68] [69] [70] +Overfull \hbox (38.26585pt too wide) in paragraph at lines 5703--5703 []@texttt set [-abefhkmnptuvxBCEHPT] [-o @textttsl option-name@texttt ] [--] [ -] [@textttsl ar-gu-ment []@texttt ][] @@ -244,7 +245,7 @@ Overfull \hbox (38.26585pt too wide) in paragraph at lines 5447--5447 .etc. -Overfull \hbox (38.26585pt too wide) in paragraph at lines 5448--5448 +Overfull \hbox (38.26585pt too wide) in paragraph at lines 5704--5704 []@texttt set [+abefhkmnptuvxBCEHPT] [+o @textttsl option-name@texttt ] [--] [ -] [@textttsl ar-gu-ment []@texttt ][] @@ -256,17 +257,17 @@ Overfull \hbox (38.26585pt too wide) in paragraph at lines 5448--5448 .@texttt t .etc. -[69] [70] [71] [72] [73] [74] [75] [76] [77] [78] [79] Chapter 5 [80] [81] -[82] [83] [84] [85] [86] [87] [88] [89] [90] [91] [92] Chapter 6 [93] [94] -[95] [96] [97] [98] [99] [100] [101] [102] [103] [104] [105] [106] [107] -[108] [109] [110] [111] [112] [113] [114] [115] [116] Chapter 7 [117] [118] -[119] [120] +[71] [72] [73] [74] [75] [76] [77] [78] [79] [80] [81] [82] Chapter 5 [83] +[84] [85] [86] [87] [88] [89] [90] [91] [92] [93] [94] [95] [96] Chapter 6 +[97] [98] [99] [100] [101] [102] [103] [104] [105] [106] [107] [108] [109] +[110] [111] [112] [113] [114] [115] [116] [117] [118] [119] [120] [121] +Chapter 7 [122] [123] [124] [125] texinfo.tex: doing @include of rluser.texi - (/usr/local/src/bash/bash-20240812/lib/readline/doc/rluser.texi -Chapter 8 [121] [122] [123] [124] [125] [126] [127] [128] [129] [130] [131] -[132] -Underfull \hbox (badness 7540) in paragraph at lines 882--888 + +(/usr/local/src/bash/bash-20240927/lib/readline/doc/rluser.texi Chapter 8 +[126] [127] [128] [129] [130] [131] [132] [133] [134] [135] [136] [137] +Underfull \hbox (badness 7540) in paragraph at lines 919--925 []@textrm In the ex-am-ple above, @textttsl C-u[] @textrm is bound to the func -tion @@ -279,7 +280,7 @@ Underfull \hbox (badness 7540) in paragraph at lines 882--888 .etc. -Underfull \hbox (badness 10000) in paragraph at lines 882--888 +Underfull \hbox (badness 10000) in paragraph at lines 919--925 @texttt universal-argument[]@textrm , @textttsl M-DEL[] @textrm is bound to th e func-tion @@ -291,8 +292,8 @@ e func-tion .@texttt v .etc. -[133] [134] [135] [136] -Overfull \hbox (26.43913pt too wide) in paragraph at lines 1116--1116 +[138] [139] [140] [141] +Overfull \hbox (26.43913pt too wide) in paragraph at lines 1155--1155 []@texttt Meta-Control-h: backward-kill-word Text after the function name is i gnored[] @@ -304,19 +305,19 @@ gnored[] .@texttt t .etc. -[137] [138] +[142] [143] @fnindfile=@write6 \openout6 = `bashref.fn'. - [139] [140] [141] [142] [143] [144] [145] [146] [147] [148] -[149] [150] [151] [152] [153] [154] [155] [156] [157]) + [144] [145] [146] [147] [148] [149] [150] [151] [152] [153] +[154] [155] [156] [157] [158] [159] [160] [161] [162]) texinfo.tex: doing @include of hsuser.texi -(/usr/local/src/bash/bash-20240812/lib/readline/doc/hsuser.texi Chapter 9 -[158] [159] [160] [161] [162] [163]) Chapter 10 [164] [165] [166] [167] -[168] -Underfull \hbox (badness 10000) in paragraph at lines 9853--9862 +(/usr/local/src/bash/bash-20240927/lib/readline/doc/hsuser.texi Chapter 9 +[163] [164] [165] [166] [167] [168] [169]) Chapter 10 [170] [171] [172] +[173] [174] +Underfull \hbox (badness 10000) in paragraph at lines 10261--10270 []@textrm All of the fol-low-ing op-tions ex-cept for `@texttt alt-array-implem entation[]@textrm '[], @@ -329,7 +330,7 @@ entation[]@textrm '[], .etc. -Underfull \hbox (badness 10000) in paragraph at lines 9853--9862 +Underfull \hbox (badness 10000) in paragraph at lines 10261--10270 @textrm `@texttt disabled-builtins[]@textrm '[], `@texttt direxpand-default[]@t extrm '[], `@texttt strict-posix-default[]@textrm '[], and @@ -341,17 +342,17 @@ extrm '[], `@texttt strict-posix-default[]@textrm '[], and .@texttt a .etc. -[169] [170] [171] [172] Appendix A [173] Appendix B [174] [175] [176] [177] -[178] [179] Appendix C [180] +[175] [176] [177] [178] Appendix A [179] Appendix B [180] [181] [182] [183] +[184] [185] Appendix C [186] texinfo.tex: doing @include of fdl.texi - (/usr/local/src/bash/bash-20240812/doc/fdl.texi -[181] [182] [183] [184] [185] [186] [187]) Appendix D [188] [189] [190] -[191] [192] [193] [194] [195] [196] [197] ) + (/usr/local/src/bash/bash-20240927/doc/fdl.texi +[187] [188] [189] [190] [191] [192] [193]) Appendix D [194] [195] [196] +[197] [198] [199] [200] [201] [202] [203] ) Here is how much of TeX's memory you used: - 4105 strings out of 495840 - 47629 string characters out of 6171739 - 143211 words of memory out of 5000000 + 4111 strings out of 495840 + 47647 string characters out of 6171739 + 143369 words of memory out of 5000000 5048 multiletter control sequences out of 15000+600000 34315 words of font info for 116 fonts, out of 8000000 for 9000 701 hyphenation exceptions out of 8191 @@ -372,10 +373,10 @@ texmf-texlive/fonts/type1/public/amsfonts/cm/cmtt12.pfb> -Output written on bashref.pdf (203 pages, 821096 bytes). +Output written on bashref.pdf (209 pages, 838618 bytes). PDF statistics: - 2835 PDF objects out of 2984 (max. 8388607) - 2585 compressed objects within 26 object streams - 331 named destinations out of 1000 (max. 500000) + 2885 PDF objects out of 2984 (max. 8388607) + 2628 compressed objects within 27 object streams + 337 named destinations out of 1000 (max. 500000) 1157 words of extra memory for PDF output out of 10000 (max. 10000000) diff --git a/doc/bashref.pdf b/doc/bashref.pdf index 9f9acd1e..0b069191 100644 Binary files a/doc/bashref.pdf and b/doc/bashref.pdf differ diff --git a/doc/bashref.rw b/doc/bashref.rw index 6a221125..f88fb686 100644 --- a/doc/bashref.rw +++ b/doc/bashref.rw @@ -1,8 +1,8 @@ \entry{time}{10}{\code {time}} \entry{!}{10}{\code {!}} -\entry{until}{11}{\code {until}} -\entry{do}{11}{\code {do}} -\entry{done}{11}{\code {done}} +\entry{until}{12}{\code {until}} +\entry{do}{12}{\code {do}} +\entry{done}{12}{\code {done}} \entry{while}{12}{\code {while}} \entry{for}{12}{\code {for}} \entry{if}{12}{\code {if}} @@ -13,9 +13,9 @@ \entry{case}{13}{\code {case}} \entry{in}{13}{\code {in}} \entry{esac}{13}{\code {esac}} -\entry{select}{13}{\code {select}} +\entry{select}{14}{\code {select}} \entry{[[}{14}{\code {[[}} \entry{]]}{14}{\code {]]}} -\entry{{\indexlbrace }}{17}{\code {{\tt \char 123}}} -\entry{{\indexrbrace }}{17}{\code {{\tt \char 125}}} +\entry{{\indexlbrace }}{18}{\code {{\tt \char 123}}} +\entry{{\indexrbrace }}{18}{\code {{\tt \char 125}}} \entry{function}{19}{\code {function}} diff --git a/doc/bashref.rws b/doc/bashref.rws index 195abeb5..b739da8e 100644 --- a/doc/bashref.rws +++ b/doc/bashref.rws @@ -5,14 +5,14 @@ \initial {]} \entry{\code {]]}}{14} \initial {{\indexlbrace }} -\entry{\code {{\tt \char 123}}}{17} +\entry{\code {{\tt \char 123}}}{18} \initial {{\indexrbrace }} -\entry{\code {{\tt \char 125}}}{17} +\entry{\code {{\tt \char 125}}}{18} \initial {C} \entry{\code {case}}{13} \initial {D} -\entry{\code {do}}{11} -\entry{\code {done}}{11} +\entry{\code {do}}{12} +\entry{\code {done}}{12} \initial {E} \entry{\code {elif}}{12} \entry{\code {else}}{12} @@ -25,11 +25,11 @@ \entry{\code {if}}{12} \entry{\code {in}}{13} \initial {S} -\entry{\code {select}}{13} +\entry{\code {select}}{14} \initial {T} \entry{\code {then}}{12} \entry{\code {time}}{10} \initial {U} -\entry{\code {until}}{11} +\entry{\code {until}}{12} \initial {W} \entry{\code {while}}{12} diff --git a/doc/bashref.texi b/doc/bashref.texi index 342d706d..e8757324 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -14,7 +14,7 @@ This is Edition @value{EDITION}, last updated @value{UPDATED}, of @cite{The GNU Bash Reference Manual}, for @code{Bash}, Version @value{VERSION}. -Copyright @copyright{} 1988--2023 Free Software Foundation, Inc. +Copyright @copyright{} 1988--2024 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -130,22 +130,22 @@ While the @sc{gnu} operating system provides other shells, including a version of @code{csh}, Bash is the default shell. Like other @sc{gnu} software, Bash is quite portable. It currently runs on nearly every version of Unix and a few other operating systems @minus{} -independently-supported ports exist for @sc{ms-dos}, @sc{os/2}, -and Windows platforms. +independently-supported ports exist for Windows and other platforms. @node What is a shell? @section What is a shell? -At its base, a shell is simply a macro processor that executes -commands. The term macro processor means functionality where text +At its base, a shell is simply a macro processor that executes commands. +The term macro processor means functionality where text and symbols are expanded to create larger expressions. -A Unix shell is both a command interpreter and a programming -language. As a command interpreter, the shell provides the user +A Unix shell is both a command interpreter and a programming language. +As a command interpreter, the shell provides the user interface to the rich set of @sc{gnu} utilities. The programming language features allow these utilities to be combined. Files containing commands can be created, and become -commands themselves. These new commands have the same status as +commands themselves. +These new commands have the same status as system commands in directories such as @file{/bin}, allowing users or groups to establish custom environments to automate their common tasks. @@ -153,7 +153,7 @@ tasks. Shells may be used interactively or non-interactively. In interactive mode, they accept input typed from the keyboard. When executing non-interactively, shells execute commands read -from a file. +from a file or a string. A shell allows execution of @sc{gnu} commands, both synchronously and asynchronously. @@ -174,19 +174,18 @@ they directly manipulate the shell itself. The @code{history}, @code{getopts}, @code{kill}, or @code{pwd} builtins, among others, could be implemented in separate utilities, but they are more convenient to use as builtin commands. -All of the shell builtins are described in -subsequent sections. +All of the shell builtins are described in subsequent sections. While executing commands is essential, most of the power (and -complexity) of shells is due to their embedded programming -languages. Like any high-level language, the shell provides -variables, flow control constructs, quoting, and functions. +complexity) of shells is due to their embedded programming languages. +Like any high-level language, the shell provides variables, +flow control constructs, quoting, and functions. Shells offer features geared specifically for interactive use rather than to augment the programming language. These interactive features include job control, command line -editing, command history and aliases. Each of these features is -described in this manual. +editing, command history and aliases. +Each of these features is described in this manual. @node Definitions @chapter Definitions @@ -210,8 +209,8 @@ than by an executable program somewhere in the file system. @item control operator @cindex control operator -A @code{token} that performs a control function. It is a @code{newline} -or one of the following: +A @code{token} that performs a control function. +It is a @code{newline} or one of the following: @samp{||}, @samp{&&}, @samp{&}, @samp{;}, @samp{;;}, @samp{;&}, @samp{;;&}, @samp{|}, @samp{|&}, @samp{(}, or @samp{)}. @@ -222,9 +221,9 @@ to eight bits, so the maximum value is 255. @item field @cindex field -A unit of text that is the result of one of the shell expansions. After -expansion, when executing a command, the resulting fields are used as -the command name and arguments. +A unit of text that is the result of one of the shell expansions. +After expansion, when executing a command, the resulting fields are +used as the command name and arguments. @item filename @cindex filename @@ -242,8 +241,9 @@ A mechanism by which users can selectively stop (suspend) and restart @item metacharacter @cindex metacharacter -A character that, when unquoted, separates words. A metacharacter is -a @code{space}, @code{tab}, @code{newline}, or one of the following characters: +A character that, when unquoted, separates words. +A metacharacter is a @code{space}, @code{tab}, @code{newline}, +or one of the following characters: @samp{|}, @samp{&}, @samp{;}, @samp{(}, @samp{)}, @samp{<}, or @samp{>}. @@ -251,8 +251,8 @@ a @code{space}, @code{tab}, @code{newline}, or one of the following characters: @cindex name @cindex identifier A @code{word} consisting solely of letters, numbers, and underscores, -and beginning with a letter or underscore. @code{Name}s are used as -shell variable and function names. +and beginning with a letter or underscore. +@code{Name}s are used as shell variable and function names. Also referred to as an @code{identifier}. @item operator @@ -273,9 +273,9 @@ during its lifetime. @item reserved word @cindex reserved word -A @code{word} that has a special meaning to the shell. Most reserved -words introduce shell flow control constructs, such as @code{for} and -@code{while}. +A @code{word} that has a special meaning to the shell. +Most reserved words introduce shell flow control constructs, such as +@code{for} and @code{while}. @item return status @cindex return status @@ -410,7 +410,8 @@ status (@pxref{Exit Status}). @end menu Quoting is used to remove the special meaning of certain -characters or words to the shell. Quoting can be used to +characters or words to the shell. +Quoting can be used to disable special treatment for special characters, to prevent reserved words from being recognized as such, and to prevent parameter expansion. @@ -418,29 +419,34 @@ parameter expansion. Each of the shell metacharacters (@pxref{Definitions}) has special meaning to the shell and must be quoted if it is to represent itself. + When the command history expansion facilities are being used (@pxref{History Interaction}), the @dfn{history expansion} character, usually @samp{!}, must be quoted -to prevent history expansion. @xref{Bash History Facilities}, for -more details concerning history expansion. +to prevent history expansion. +@xref{Bash History Facilities}, for more details concerning history +expansion. -There are three quoting mechanisms: the -@dfn{escape character}, single quotes, and double quotes. +There are four quoting mechanisms: the +@dfn{escape character}, single quotes, double quotes, +and dollar-single quotes. @node Escape Character @subsubsection Escape Character A non-quoted backslash @samp{\} is the Bash escape character. It preserves the literal value of the next character that follows, -with the exception of @code{newline}. If a @code{\newline} pair -appears, and the backslash itself is not quoted, the @code{\newline} -is treated as a line continuation (that is, it is removed from -the input stream and effectively ignored). +removing any special meaning it has, +with the exception of @code{newline}. +If a @code{\newline} pair appears, and the backslash itself is not quoted, +the @code{\newline} is treated as a line continuation (that is, it is +removed from the input stream and effectively ignored). @node Single Quotes @subsubsection Single Quotes Enclosing characters in single quotes (@samp{'}) preserves the literal value -of each character within the quotes. A single quote may not occur +of each character within the quotes. +A single quote may not occur between single quotes, even when preceded by a backslash. @node Double Quotes @@ -460,8 +466,10 @@ The backslash retains its special meaning only when followed by one of the following characters: @samp{$}, @samp{`}, @samp{"}, @samp{\}, or @code{newline}. Within double quotes, backslashes that are followed by one of these -characters are removed. Backslashes preceding characters without a +characters are removed. +Backslashes preceding characters without a special meaning are left unmodified. + A double quote may be quoted within double quotes by preceding it with a backslash. If enabled, history expansion will be performed unless an @samp{!} @@ -474,6 +482,7 @@ when in double quotes (@pxref{Shell Parameter Expansion}). @node ANSI-C Quoting @subsubsection ANSI-C Quoting @cindex quoting, ANSI +@cindex dollar-single quote quoting Character sequences of the form @code{$'@var{string}'} are treated as a special kind of single quotes. @@ -547,8 +556,8 @@ and @code{TEXTDOMAIN} shell variables, as explained below. See the gettext documentation for additional details not covered here. If the current locale is @code{C} or @code{POSIX}, if there are no translations available, -or if the string is not translated, -the dollar sign is ignored. +or if the string is not translated, the dollar sign is ignored, +and the string is treated as double-quoted as described above. Since this is a form of double quoting, the string remains double-quoted by default, whether or not it is translated and replaced. If the @code{noexpand_translation} option is enabled @@ -674,11 +683,15 @@ in any of the supported languages by setting the @env{LANG} or In a non-interactive shell, or an interactive shell in which the @code{interactive_comments} option to the @code{shopt} builtin is enabled (@pxref{The Shopt Builtin}), -a word beginning with @samp{#} -causes that word and all remaining characters on that line to -be ignored. An interactive shell without the @code{interactive_comments} -option enabled does not allow comments. The @code{interactive_comments} -option is on by default in interactive shells. +a word beginning with @samp{#} introduces a comment. +A word begins at the beginning of a line, after unquoted whitespace, or +after an operator. +The comment causes that word and all remaining characters on that line to +be ignored. +An interactive shell without the @code{interactive_comments} +option enabled does not allow comments. +The @code{interactive_comments} +option is enabled by default in interactive shells. @xref{Interactive Shells}, for a description of what makes a shell interactive. @@ -735,10 +748,10 @@ words if they are the third word in a @code{for} command. @subsection Simple Commands @cindex commands, simple -A simple command is the kind of command encountered most often. +A simple command is the kind of command that's executed most often. It's just a sequence of words separated by @code{blank}s, terminated -by one of the shell's control operators (@pxref{Definitions}). The -first word generally specifies a command to be executed, with the +by one of the shell's control operators (@pxref{Definitions}). +The first word generally specifies a command to be executed, with the rest of the words being that command's arguments. The return status (@pxref{Exit Status}) of a simple command is @@ -765,16 +778,18 @@ The format for a pipeline is @noindent The output of each command in the pipeline is connected via a pipe to the input of the next command. -That is, each command reads the previous command's output. This -connection is performed before any redirections specified by +That is, each command reads the previous command's output. +This connection is performed before any redirections specified by @var{command1}. -If @samp{|&} is used, @var{command1}'s standard error, in addition to +If @samp{|&} is the pipeline operator, +@var{command1}'s standard error, in addition to its standard output, is connected to @var{command2}'s standard input through the pipe; it is shorthand for @code{2>&1 |}. This implicit redirection of the standard error to the standard output is -performed after any redirections specified by @var{command1}. +performed after any redirections specified by @var{command1}, +consistent with that shorthand. The reserved word @code{time} causes timing statistics to be printed for the pipeline once it finishes. @@ -785,19 +800,20 @@ by @sc{posix}. When the shell is in @sc{posix} mode (@pxref{Bash POSIX Mode}), it does not recognize @code{time} as a reserved word if the next token begins with a @samp{-}. -The @env{TIMEFORMAT} variable may be set to a format string that +The value of the @env{TIMEFORMAT} variable is a format string that specifies how the timing information should be displayed. @xref{Bash Variables}, for a description of the available formats. The use of @code{time} as a reserved word permits the timing of -shell builtins, shell functions, and pipelines. An external -@code{time} command cannot time these easily. +shell builtins, shell functions, and pipelines. +An external @code{time} command cannot time these easily. When the shell is in @sc{posix} mode (@pxref{Bash POSIX Mode}), @code{time} -may be followed by a newline. In this case, the shell displays the +may be followed by a newline. +In this case, the shell displays the total user and system time consumed by the shell and its children. The @env{TIMEFORMAT} variable specifies the format of the time information. -If the pipeline is not executed asynchronously (@pxref{Lists}), the +If a pipeline is not executed asynchronously (@pxref{Lists}), the shell waits for all commands in the pipeline to complete. Each command in a multi-command pipeline, @@ -806,8 +822,8 @@ is executed in its own @dfn{subshell}, which is a separate process (@pxref{Command Execution Environment}). If the @code{lastpipe} option is enabled using the @code{shopt} builtin (@pxref{The Shopt Builtin}), -the last element of a pipeline may be run by the shell process -when job control is not active. +and job control is not active, +the last element of a pipeline may be run by the shell process. The exit status of a pipeline is the exit status of the last command in the @@ -819,8 +835,10 @@ or zero if all commands exit successfully. If the reserved word @samp{!} precedes the pipeline, the exit status is the logical negation of the exit status as described above. -The shell waits for all commands in the pipeline to terminate before +If a pipeline is not executed asynchronously (@pxref{Lists}), the +shell waits for all commands in the pipeline to terminate before returning a value. +The return status of an asynchronous pipeline is 0. @node Lists @subsection Lists of Commands @@ -854,8 +872,8 @@ The return status is the exit status of the last command executed. @sc{and} and @sc{or} lists are sequences of one or more pipelines separated by the control operators @samp{&&} and @samp{||}, -respectively. @sc{and} and @sc{or} lists are executed with left -associativity. +respectively. +@sc{and} and @sc{or} lists are executed with left associativity. An @sc{and} list has the form @example @@ -948,9 +966,9 @@ The syntax of the @code{for} command is: for @var{name} [ [in [@var{words} @dots{}] ] ; ] do @var{commands}; done @end example -Expand @var{words} (@pxref{Shell Expansions}), and execute @var{commands} -once for each member -in the resultant list, with @var{name} bound to the current member. +Expand @var{words} (@pxref{Shell Expansions}), and then +execute @var{commands} once for each word +in the resultant list, with @var{name} bound to the current word. If @samp{in @var{words}} is not present, the @code{for} command executes the @var{commands} once for each positional parameter that is set, as if @samp{in "$@@"} had been specified @@ -966,19 +984,20 @@ An alternate form of the @code{for} command is also supported: for (( @var{expr1} ; @var{expr2} ; @var{expr3} )) ; do @var{commands} ; done @end example -First, the arithmetic expression @var{expr1} is evaluated according +First, evaluate the arithmetic expression @var{expr1} according to the rules described below (@pxref{Shell Arithmetic}). -The arithmetic expression @var{expr2} is then evaluated repeatedly +Then, repeatedly evaluate the arithmetic expression @var{expr2} until it evaluates to zero. -Each time @var{expr2} evaluates to a non-zero value, @var{commands} are -executed and the arithmetic expression @var{expr3} is evaluated. +Each time @var{expr2} evaluates to a non-zero value, execute @var{commands} +and evaluate the arithmetic expression @var{expr3}. If any expression is omitted, it behaves as if it evaluates to 1. The return value is the exit status of the last command in @var{commands} -that is executed, or false if any of the expressions is invalid. +that is executed, or non-zero if any of the expressions is invalid. @end table -The @code{break} and @code{continue} builtins (@pxref{Bourne Shell Builtins}) -may be used to control loop execution. +Use the @code{break} and @code{continue} builtins +(@pxref{Bourne Shell Builtins}) +to control loop execution. @node Conditional Constructs @subsubsection Conditional Constructs @@ -1027,16 +1046,17 @@ esac @end example @code{case} will selectively execute the @var{command-list} corresponding to -the first @var{pattern} that matches @var{word}. +the first @var{pattern} that matches @var{word}, +proceeding from the first pattern to the last. The match is performed according to the rules described below in @ref{Pattern Matching}. If the @code{nocasematch} shell option (see the description of @code{shopt} in @ref{The Shopt Builtin}) is enabled, the match is performed without regard to the case of alphabetic characters. -The @samp{|} is used to separate multiple patterns, and the @samp{)} -operator terminates a pattern list. -A list of patterns and an associated command-list is known +The @samp{|} is used to separate multiple patterns in a pattern list, +and the @samp{)} operator terminates the pattern list. +A pattern list and an associated @var{command-list} is known as a @var{clause}. Each clause must be terminated with @samp{;;}, @samp{;&}, or @samp{;;&}. @@ -1072,17 +1092,18 @@ echo " legs." @noindent -If the @samp{;;} operator is used, no subsequent matches are attempted after -the first pattern match. +If the @samp{;;} operator is used, the @code{case} command completes +after the first pattern match. Using @samp{;&} in place of @samp{;;} causes execution to continue with the @var{command-list} associated with the next clause, if any. Using @samp{;;&} in place of @samp{;;} causes the shell to test the patterns in the next clause, if any, and execute any associated @var{command-list} -on a successful match, +if the match succeeds, continuing the case statement execution as if the pattern list had not matched. -The return status is zero if no @var{pattern} is matched. Otherwise, the -return status is the exit status of the @var{command-list} executed. +The return status is zero if no @var{pattern} matches. +Otherwise, the return status is the exit status of the +last @var{command-list} executed. @item select @rwindex select @@ -1094,17 +1115,17 @@ It has almost the same syntax as the @code{for} command: select @var{name} [in @var{words} @dots{}]; do @var{commands}; done @end example -The list of words following @code{in} is expanded, generating a list -of items, and the set of expanded words is printed on the standard -error output stream, each preceded by a number. If the -@samp{in @var{words}} is omitted, the positional parameters are printed, +First, expand the list of words following @code{in}, generating a list +of items, and print the set of expanded words on the standard +error stream, each preceded by a number. +If the @samp{in @var{words}} is omitted, print the positional parameters, as if @samp{in "$@@"} had been specified. @code{select} then displays the @env{PS3} prompt and reads a line from the standard input. If the line consists of a number corresponding to one of the displayed -words, then the value of @var{name} is set to that word. -If the line is empty, the words and prompt are displayed again. -If @code{EOF} is read, the @code{select} command completes and returns 1. +words, then @code{select} sets the value of @var{name} to that word. +If the line is empty, @code{select} displays the words and prompt again. +If @code{EOF} is read, @code{select} completes and returns 1. Any other value read causes @var{name} to be set to null. The line read is saved in the variable @env{REPLY}. @@ -1134,11 +1155,10 @@ described below (@pxref{Shell Arithmetic}). The @var{expression} undergoes the same expansions as if it were within double quotes, but double quote characters in @var{expression} are not treated specially -are removed. +and are removed. If the value of the expression is non-zero, the return status is 0; otherwise the return status is 1. - @item [[@dots{}]] @rwindex [[ @rwindex ]] @@ -1146,8 +1166,8 @@ otherwise the return status is 1. [[ @var{expression} ]] @end example -Return a status of 0 or 1 depending on the evaluation of -the conditional expression @var{expression}. +Evaluate the conditional expression @var{expression} and +return a status of zero (true) or non-zero (false). Expressions are composed of the primaries described below in @ref{Bash Conditional Expressions}. The words between the @code{[[} and @code{]]} do not undergo word splitting @@ -1292,7 +1312,8 @@ pattern='\.' The first two matches will succeed, but the second two will not, because in the second two the backslash will be part of the pattern to be matched. In the first two examples, the pattern passed to the regular expression -parser is @samp{\.}. The backslash removes the special meaning from +parser is @samp{\.}. +The backslash removes the special meaning from @samp{.}, so the literal @samp{.} matches. In the second two examples, the pattern passed to the regular expression parser has the backslash quoted (e.g., @samp{\\\.}), which will not match @@ -1391,7 +1412,8 @@ remain in effect after the subshell completes. @end example Placing a list of commands between curly braces causes the list to -be executed in the current shell context. No subshell is created. +be executed in the current shell environment. +No subshell is created. The semicolon (or newline) following @var{list} is required. @end table @@ -1436,7 +1458,7 @@ coproc @var{NAME} @{ @var{command}; @} @end example @noindent -This form is recommended because simple commands result in the coprocess +This form is preferred because simple commands result in the coprocess always being named @code{COPROC}, and it is simpler to use and more complete than the other compound commands. @@ -1476,7 +1498,7 @@ the file descriptors are not available in subshells. The process ID of the shell spawned to execute the coprocess is available as the value of the variable @env{@var{NAME}_PID}. The @code{wait} -builtin command may be used to wait for the coprocess to terminate. +builtin may be used to wait for the coprocess to terminate. Since the coprocess is created as an asynchronous command, the @code{coproc} command always returns success. @@ -1506,12 +1528,13 @@ is available at @cindex functions, shell Shell functions are a way to group commands for later execution -using a single name for the group. They are executed just like -a "regular" command. +using a single name for the group. +They are executed just like a "regular" simple command. When the name of a shell function is used as a simple command name, -the list of commands associated with that function name is executed. +the shell executes +the list of commands associated with that function name. Shell functions are executed in the current -shell context; no new process is created to interpret them. +shell context; there is no new process created to interpret them. Functions are declared using this syntax: @rwindex function @@ -1525,27 +1548,26 @@ or function @var{fname} [()] @var{compound-command} [ @var{redirections} ] @end example -This defines a shell function named @var{fname}. The reserved -word @code{function} is optional. -If the @code{function} reserved -word is supplied, the parentheses are optional. +This defines a shell function named @var{fname}. +The reserved word @code{function} is optional. +If the @code{function} reserved word is supplied, the parentheses are optional. The @dfn{body} of the function is the compound command @var{compound-command} (@pxref{Compound Commands}). That command is usually a @var{list} enclosed between @{ and @}, but may be any compound command listed above. If the @code{function} reserved word is used, but the parentheses are not supplied, the braces are recommended. -@var{compound-command} is executed whenever @var{fname} is specified as the -name of a simple command. When the shell is in @sc{posix} mode (@pxref{Bash POSIX Mode}), @var{fname} must be a valid shell name and may not be the same as one of the special builtins (@pxref{Special Builtins}). -In default mode, a function name can be any unquoted shell word that does +When not in @sc{posix} mode, +a function name can be any unquoted shell word that does not contain @samp{$}. + Any redirections (@pxref{Redirections}) associated with the shell function are performed when the function is executed. -A function definition may be deleted using the @option{-f} option to the +Function definitions are deleted using the @option{-f} option to the @code{unset} builtin (@pxref{Bourne Shell Builtins}). The exit status of a function definition is zero unless a syntax error @@ -1559,14 +1581,21 @@ that surround the body of the function must be separated from the body by This is because the braces are reserved words and are only recognized as such when they are separated from the command list by whitespace or another shell metacharacter. -Also, when using the braces, the @var{list} must be terminated by a semicolon, +When using the braces, the @var{list} must be terminated by a semicolon, a @samp{&}, or a newline. +@var{compound-command} is executed whenever @var{fname} is specified +as the name of a simple command. +Functions are executed in the context of the +calling shell; there is no new process created to interpret +them (contrast this with the execution of a shell script). + When a function is executed, the arguments to the function become the positional parameters during its execution (@pxref{Positional Parameters}). The special parameter @samp{#} that expands to the number of -positional parameters is updated to reflect the change. +positional parameters +is updated to reflect the new set of positional parameters. Special parameter @code{0} is unchanged. The first element of the @env{FUNCNAME} variable is set to the name of the function while the function is executing. @@ -1599,17 +1628,19 @@ before execution resumes. When a function completes, the values of the positional parameters and the special parameter @samp{#} are restored to the values they had prior to the function's -execution. If a numeric argument is given to @code{return}, +execution. +If @code{return} is supplied a numeric argument, that is the function's return status; otherwise the function's return status is the exit status of the last command executed before the @code{return}. -Variables local to the function may be declared with the +Variables local to the function are declared with the @code{local} builtin (@dfn{local variables}). Ordinarily, variables and their values are shared between a function and its caller. These variables are visible only to -the function and the commands it invokes. This is particularly +the function and the commands it invokes. +This is particularly important when a shell function calls other functions. In the following description, the @dfn{current scope} is a currently- @@ -1617,14 +1648,17 @@ executing function. Previous scopes consist of that function's caller and so on, back to the "global" scope, where the shell is not executing any shell function. -Consequently, a local variable at the current local scope is a variable +A local variable at the current local scope is a variable declared using the @code{local} or @code{declare} builtins in the function that is currently executing. -Local variables "shadow" variables with the same name declared at -previous scopes. For instance, a local variable declared in a function -hides a global variable of the same name: references and assignments -refer to the local variable, leaving the global variable unmodified. +Local variables "shadow" +variables with the same name declared at previous scopes. +For instance, a local variable declared in a function +hides variables with the same name declared at previous scopes, +including global variables: references and assignments +refer to the local variable, leaving the variables +at previous scopes unmodified. When the function returns, the global variable is once again visible. The shell uses @dfn{dynamic scoping} to control a variable's visibility @@ -1679,11 +1713,11 @@ Once the function returns, any instance of the variable at a previous scope will become visible. If the unset acts on a variable at a previous scope, any instance of a variable with that name that had been shadowed will become visible -(see below how @code{localvar_unset}shell option changes this behavior). +(see below how @code{localvar_unset} shell option changes this behavior). -Function names and definitions may be listed with the -@option{-f} option to the @code{declare} (@code{typeset}) -builtin command (@pxref{Bash Builtins}). +The @option{-f} option to the @code{declare} (@code{typeset}) +builtin command (@pxref{Bash Builtins}) +will list function names and definitions. The @option{-F} option to @code{declare} or @code{typeset} will list the function names only (and optionally the source file and line number, if the @code{extdebug} @@ -1693,11 +1727,15 @@ Functions may be exported so that child shell processes automatically have them defined with the @option{-f} option to the @code{export} builtin (@pxref{Bourne Shell Builtins}). +The @option{-f} option to +the @code{unset} builtin +(@pxref{Bourne Shell Builtins}) +will delete a function definition. Functions may be recursive. The @code{FUNCNEST} variable may be used to limit the depth of the function call stack and restrict the number of function invocations. -By default, no limit is placed on the number of recursive calls. +By default, Bash places no limit on the number of recursive calls. @node Shell Parameters @section Shell Parameters @@ -1717,9 +1755,11 @@ A @dfn{variable} is a parameter denoted by a @code{name}. A variable has a @code{value} and zero or more @code{attributes}. Attributes are assigned using the @code{declare} builtin command (see the description of the @code{declare} builtin in @ref{Bash Builtins}). +The @code{export} and @code{readonly} builtins assign specific attributes. -A parameter is set if it has been assigned a value. The null string is -a valid value. Once a variable is set, it may be unset only by using +A parameter is set if it has been assigned a value. +The null string is a valid value. +Once a variable is set, it may be unset only by using the @code{unset} builtin command. A variable may be assigned to by a statement of the form @@ -1727,9 +1767,8 @@ A variable may be assigned to by a statement of the form @var{name}=[@var{value}] @end example @noindent -If @var{value} -is not given, the variable is assigned the null string. All -@var{value}s undergo tilde expansion, parameter and variable expansion, +If @var{value} is not given, the variable is assigned the null string. +All @var{value}s undergo tilde expansion, parameter and variable expansion, command substitution, arithmetic expansion, and quote removal (@pxref{Shell Parameter Expansion}). If the variable has its @code{integer} @@ -1744,16 +1783,22 @@ and @code{local} builtin commands (@dfn{declaration} commands). When in @sc{posix} mode (@pxref{Bash POSIX Mode}), these builtins may appear in a command after one or more instances of the @code{command} builtin and retain these assignment statement properties. +For example, +@example +command export var=value +@end example In the context where an assignment statement is assigning a value to a shell variable or array index (@pxref{Arrays}), the @samp{+=} -operator can be used to -append to or add to the variable's previous value. -This includes arguments to builtin commands such as @code{declare} that -accept assignment statements (declaration commands). +operator will append to or add to the variable's previous value. +This includes arguments to declaration commands such as @code{declare} +that accept assignment statements. When @samp{+=} is applied to a variable for which the @code{integer} attribute -has been set, @var{value} is evaluated as an arithmetic expression and -added to the variable's current value, which is also evaluated. +has been set, +the variable's current value and @var{value} are each evaluated as +arithmetic expressions, +and the sum of the results is assigned as the variable's value. +The current value is usually an integer constant, but may be an expression. When @samp{+=} is applied to an array variable using compound assignment (@pxref{Arrays}), the variable's value is not unset (as it is when using @samp{=}), and new @@ -1781,8 +1826,8 @@ argument, running declare -n ref=$1 @end example @noindent -inside the function creates a nameref variable @env{ref} whose value is -the variable name passed as the first argument. +inside the function creates a local nameref variable @env{ref} whose value +is the variable name passed as the first argument. References and assignments to @env{ref}, and changes to its attributes, are treated as references, assignments, and attribute modifications to the variable whose name was passed as @code{$1}. @@ -1804,7 +1849,8 @@ as an argument, the variable referenced by the nameref variable will be unset. @cindex parameters, positional A @dfn{positional parameter} is a parameter denoted by one or more -digits, other than the single digit @code{0}. Positional parameters are +digits, other than the single digit @code{0}. +Positional parameters are assigned from the shell's arguments when it is invoked, and may be reassigned using the @code{set} builtin command. Positional parameter @code{N} may be referenced as @code{$@{N@}}, or @@ -1818,6 +1864,9 @@ temporarily replaced when a shell function is executed When a positional parameter consisting of more than a single digit is expanded, it must be enclosed in braces. +Without braces, a digit following @samp{$} can only refer to +one of the first nine positional parameters ($1\-$9) or the +special parameter $0 (see below). @node Special Parameters @subsection Special Parameters @@ -1825,6 +1874,7 @@ digit is expanded, it must be enclosed in braces. The shell treats several parameters specially. These parameters may only be referenced; assignment to them is not allowed. +Special parameters are denoted by one of the following characters. @vtable @code @@ -1833,11 +1883,12 @@ only be referenced; assignment to them is not allowed. ($*) Expands to the positional parameters, starting from one. When the expansion is not within double quotes, each positional parameter expands to a separate word. -In contexts where these expansions are performed, those words +In contexts where word expansions are performed, those words are subject to further word splitting and filename expansion. When the expansion occurs within double quotes, it expands to a single word with the value of each parameter separated by the first character of the -@env{IFS} special variable. That is, @code{"$*"} is equivalent +@env{IFS} variable. +That is, @code{"$*"} is equivalent to @code{"$1@var{c}$2@var{c}@dots{}"}, where @var{c} is the first character of the value of the @code{IFS} variable. @@ -1852,17 +1903,19 @@ In contexts where word splitting is performed, this expands each positional parameter to a separate word; if not within double quotes, these words are subject to word splitting. In contexts where word splitting is not performed, +such as the value portion of an assignment statement, this expands to a single word with each positional parameter separated by a space. -When the -expansion occurs within double quotes, and word splitting is performed, -each parameter expands to a -separate word. That is, @code{"$@@"} is equivalent to +When the expansion occurs within double quotes, +and word splitting is performed, +each parameter expands to a separate word. +That is, @code{"$@@"} is equivalent to @code{"$1" "$2" @dots{}}. If the double-quoted expansion occurs within a word, the expansion of -the first parameter is joined with the beginning part of the original -word, and the expansion of the last parameter is joined with the last -part of the original word. +the first parameter is joined with the expansion of the +beginning part of the original +word, and the expansion of the last parameter is joined with the +expansion of the last part of the original word. When there are no positional parameters, @code{"$@@"} and @code{$@@} expand to nothing (i.e., they are removed). @@ -1884,8 +1937,9 @@ builtin command, or those set by the shell itself @item $ @vindex $$ -($$) Expands to the process @sc{id} of the shell. In a subshell, it -expands to the process @sc{id} of the invoking shell, not the subshell. +($$) Expands to the process @sc{id} of the shell. +In a subshell, it expands to the process @sc{id} of the invoking shell, +not the subshell. @item ! @vindex $! @@ -1895,13 +1949,15 @@ the @code{bg} builtin (@pxref{Job Control Builtins}). @item 0 @vindex $0 -($0) Expands to the name of the shell or shell script. This is set at -shell initialization. If Bash is invoked with a file of commands -(@pxref{Shell Scripts}), @code{$0} is set to the name of that file. +($0) Expands to the name of the shell or shell script. +This is set at shell initialization. +If Bash is invoked with a file of commands (@pxref{Shell Scripts}), +@code{$0} is set to the name of that file. If Bash is started with the @option{-c} option (@pxref{Invoking Bash}), then @code{$0} is set to the first argument after the string to be -executed, if one is present. Otherwise, it is set -to the filename used to invoke Bash, as given by argument zero. +executed, if one is present. +Otherwise, it is set to the filename used to invoke Bash, as given by +argument zero. @end vtable @node Shell Expansions @@ -1971,11 +2027,12 @@ The only exceptions to this are the expansions of @cindex brace expansion @cindex expansion, brace -Brace expansion is a mechanism by which arbitrary strings may be generated. +Brace expansion is a mechanism to generate arbitrary strings +sharing a common prefix and suffix, either of which can be empty. This mechanism is similar to @dfn{filename expansion} (@pxref{Filename Expansion}), but the filenames generated need not exist. -Patterns to be brace expanded take the form of an optional @var{preamble}, +Patterns to be brace expanded are formed from an optional @var{preamble}, followed by either a series of comma-separated strings or a sequence expression between a pair of braces, followed by an optional @var{postscript}. @@ -2006,13 +2063,15 @@ using the default C locale. Note that both @var{x} and @var{y} must be of the same type (integer or letter). When the increment is supplied, it is used as the difference between -each term. The default increment is 1 or -1 as appropriate. +each term. +The default increment is 1 or -1 as appropriate. Brace expansion is performed before any other expansions, and any characters special to other expansions are preserved -in the result. It is strictly textual. Bash -does not apply any syntactic interpretation to the context of the -expansion or the text between the braces. +in the result. +It is strictly textual. +Bash 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 closing braces, and at least one unquoted comma or a valid @@ -2049,15 +2108,16 @@ characters in the tilde-prefix following the tilde are treated as a possible @dfn{login name}. If this login name is the null string, the tilde is replaced with the value of the @env{HOME} shell variable. -If @env{HOME} is unset, the home directory of the user executing the -shell is substituted instead. +If @env{HOME} is unset, the tilde expands to +the home directory of the user executing the shell instead. Otherwise, the tilde-prefix is replaced with the home directory associated with the specified login name. If the tilde-prefix is @samp{~+}, the value of the shell variable @env{PWD} replaces the tilde-prefix. -If the tilde-prefix is @samp{~-}, the value of the shell variable -@env{OLDPWD}, if it is set, is substituted. +If the tilde-prefix is @samp{~-}, the shell substitutes +the value of the shell variable +@env{OLDPWD}, if it is set. If the characters following the tilde in the tilde-prefix consist of a number @var{N}, optionally prefixed by a @samp{+} or a @samp{-}, @@ -2068,12 +2128,16 @@ in the tilde-prefix as an argument (@pxref{The Directory Stack}). If the tilde-prefix, sans the tilde, consists of a number without a leading @samp{+} or @samp{-}, @samp{+} is assumed. -If the login name is invalid, or the tilde expansion fails, the word is -left unchanged. +The results of tilde expansion are treated as if they were quoted, so +the replacement is not subject to word splitting and filename expansion. -Each variable assignment is checked for unquoted tilde-prefixes immediately -following a @samp{:} or the first @samp{=}. -In these cases, tilde expansion is also performed. +If the login name is invalid, or the tilde expansion fails, the +tilde-prefix is left unchanged. + +Bash checks each variable assignment +for unquoted tilde-prefixes immediately +following a @samp{:} or the first @samp{=}, +and performs tilde expansion in these cases. Consequently, one may use filenames with tildes in assignments to @env{PATH}, @env{MAILPATH}, and @env{CDPATH}, and the shell assigns the expanded value. @@ -2082,13 +2146,13 @@ The following table shows how Bash treats unquoted tilde-prefixes: @table @code @item ~ -The value of @code{$HOME} +The value of @code{$HOME}. @item ~/foo @file{$HOME/foo} @item ~fred/foo -The subdirectory @code{foo} of the home directory of the user -@code{fred} +The directory or file @code{foo} in the home directory of the user +@code{fred}. @item ~+/foo @file{$PWD/foo} @@ -2097,13 +2161,13 @@ The subdirectory @code{foo} of the home directory of the user @file{$@{OLDPWD-'~-'@}/foo} @item ~@var{N} -The string that would be displayed by @samp{dirs +@var{N}} +The string that would be displayed by @samp{dirs +@var{N}}. @item ~+@var{N} -The string that would be displayed by @samp{dirs +@var{N}} +The string that would be displayed by @samp{dirs +@var{N}}. @item ~-@var{N} -The string that would be displayed by @samp{dirs -@var{N}} +The string that would be displayed by @samp{dirs -@var{N}}. @end table Bash also performs tilde expansion on words satisfying the conditions of @@ -2118,19 +2182,23 @@ above, when in @sc{posix} mode. @cindex expansion, parameter The @samp{$} character introduces parameter expansion, -command substitution, or arithmetic expansion. The parameter name +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 could be interpreted as part of the name. +For example, if the first positional parameter has the value @samp{a}, +then @code{$@{11@}} expands to the value of the eleventh positional +parameter, while @code{$11} expands to @samp{a1}. When braces are used, the matching ending brace is the first @samp{@}} not escaped by a backslash or within a quoted string, and not within an embedded arithmetic expansion, command substitution, or parameter expansion. -The basic form of parameter expansion is $@{@var{parameter}@}. -The value of @var{parameter} is substituted. +The basic form of parameter expansion is $@{@var{parameter}@}, +which substitutes the value of @var{parameter}. The @var{parameter} is a shell parameter as described above (@pxref{Shell Parameters}) or an array reference (@pxref{Arrays}). The braces are required when @var{parameter} @@ -2142,7 +2210,8 @@ If the first character of @var{parameter} is an exclamation point (!), and @var{parameter} is not a nameref, it introduces a level of indirection. Bash uses the value formed by expanding the rest of -@var{parameter} as the new @var{parameter}; this is then +@var{parameter} as the new @var{parameter}; +this new parameter is then expanded and that value is used in the rest of the expansion, rather than the expansion of the original @var{parameter}. This is known as @code{indirect expansion}. @@ -2150,7 +2219,7 @@ The value is subject to tilde expansion, parameter expansion, command substitution, and arithmetic expansion. If @var{parameter} is a nameref, this expands to the name of the variable referenced by @var{parameter} instead of performing the -complete indirect expansion. +complete indirect expansion, for compatibility. The exceptions to this are the expansions of $@{!@var{prefix}*@} and $@{!@var{name}[@@]@} described below. @@ -2171,8 +2240,8 @@ is not null; if the colon is omitted, the operator tests only for existence. @item $@{@var{parameter}:@minus{}@var{word}@} If @var{parameter} is unset or null, the expansion of -@var{word} is substituted. Otherwise, the value of -@var{parameter} is substituted. +@var{word} is substituted. +Otherwise, the value of @var{parameter} is substituted. @example $ v=123 @@ -2184,19 +2253,25 @@ $ unset v $ echo $@{v-unset@} unset $ v= +$ echo $@{v-unset@} + $ echo $@{v:-unset-or-null@} unset-or-null @end example @item $@{@var{parameter}:=@var{word}@} -If @var{parameter} -is unset or null, the expansion of @var{word} -is assigned to @var{parameter}. -The value of @var{parameter} is then substituted. -Positional parameters and special parameters may not be assigned to +If @var{parameter} is unset or null, the expansion of @var{word} +is assigned to @var{parameter}, +and the result of the expansion +is the final value of @var{parameter}. +Positional parameters and special parameters may not be assigned in this way. @example +$ unset var +$ : $@{var=DEFAULT@} +$ echo $var +DEFAULT $ var= $ : $@{var:=DEFAULT@} $ echo $var @@ -2208,8 +2283,10 @@ If @var{parameter} is null or unset, the expansion of @var{word} (or a message to that effect if @var{word} is not present) is written to the standard error and the shell, if it -is not interactive, exits. Otherwise, the value of @var{parameter} is -substituted. +is 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 @var{parameter} is substituted. @example $ var= @@ -2221,11 +2298,16 @@ bash: var: var is unset or null If @var{parameter} is null or unset, nothing is substituted, otherwise the expansion of @var{word} is substituted. +The value of @var{parameter} is not used. @example $ var=123 $ echo $@{var:+var is set and not null@} var is set and not null +$ var= +$ echo $@{var:+var is set and not null@} + +$ @end example @item $@{@var{parameter}:@var{offset}@} @@ -2250,6 +2332,7 @@ it is interpreted as an offset in characters from the end of the value of @var{parameter} rather than a number of characters, and the expansion is the characters between @var{offset} 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 @samp{:-} expansion. @@ -2393,8 +2476,7 @@ When @samp{@@} is used and the expansion appears within double quotes, each key expands to a separate word. @item $@{#@var{parameter}@} -The length in characters of the expanded value of @var{parameter} is -substituted. +Substitutes the length in characters of the value of @var{parameter}. If @var{parameter} is @samp{*} or @samp{@@}, the value substituted is the number of positional parameters. If @var{parameter} is an array name subscripted by @samp{*} or @samp{@@}, @@ -2408,8 +2490,11 @@ array, and an index of -1 references the last element. @item $@{@var{parameter}#@var{word}@} @itemx $@{@var{parameter}##@var{word}@} The @var{word} -is expanded to produce a pattern and matched according to the rules -described below (@pxref{Pattern Matching}). If the pattern matches +is expanded to produce a pattern and matched +against the expanded value of @var{parameter} +according to the rules +described below (@pxref{Pattern Matching}). +If the pattern matches the beginning of the expanded value of @var{parameter}, then the result of the expansion is the expanded value of @var{parameter} with the shortest matching pattern (the @samp{#} case) or the @@ -2425,7 +2510,9 @@ array in turn, and the expansion is the resultant list. @item $@{@var{parameter}%@var{word}@} @itemx $@{@var{parameter}%%@var{word}@} The @var{word} -is expanded to produce a pattern and matched according to the rules +is expanded to produce a pattern and matched +against the expanded value of @var{parameter} +according to the rules described below (@pxref{Pattern Matching}). If the pattern matches a trailing portion of the expanded value of @var{parameter}, then the result of the expansion is the value of @@ -2444,13 +2531,14 @@ array in turn, and the expansion is the resultant list. @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. -@var{Parameter} is expanded and the longest match of @var{pattern} -against its value is replaced with @var{string}. +filename expansion and matched +against the expanded value of @var{parameter} +according to the rules +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, arithmetic expansion, command and process substitution, and quote removal. -The match is performed according to the rules described below -(@pxref{Pattern Matching}). In the first form above, only the first match is replaced. If there are two slashes separating @var{parameter} and @var{pattern} @@ -2460,13 +2548,13 @@ If @var{pattern} is preceded by @samp{#} (the third form above), it must match at the beginning of the expanded value of @var{parameter}. If @var{pattern} is preceded by @samp{%} (the fourth form above), it must match at the end of the expanded value of @var{parameter}. + If the expansion of @var{string} is null, -matches of @var{pattern} are deleted. -If @var{string} is null, matches of @var{pattern} are deleted and the @samp{/} following @var{pattern} may be omitted. -If the @code{patsub_replacement} shell option is enabled using @code{shopt}, +If the @code{patsub_replacement} shell option is enabled using @code{shopt} +(@pxref{The Shopt Builtin}), any unquoted instances of @samp{&} in @var{string} are replaced with the matching portion of @var{pattern}. This is intended to duplicate a common @code{sed} idiom. @@ -2538,6 +2626,7 @@ If the @code{nocasematch} shell option (see the description of @code{shopt} in @ref{The Shopt Builtin}) is enabled, the match is performed without regard to the case of alphabetic characters. + If @var{parameter} is @samp{@@} or @samp{*}, the substitution operation is applied to each positional parameter in turn, and the expansion is the resultant list. @@ -2735,8 +2824,9 @@ word splitting and filename expansion on the results. @cindex expansion, arithmetic @cindex arithmetic expansion -Arithmetic expansion allows the evaluation of an arithmetic expression -and the substitution of the result. The format for arithmetic expansion is: +Arithmetic expansion evalutes an arithmetic expression +and substitutes the result. +The format for arithmetic expansion is: @example $(( @var{expression} )) @@ -2754,7 +2844,9 @@ Arithmetic expansions may be nested. The evaluation is performed according to the rules listed below (@pxref{Shell Arithmetic}). If the expression is invalid, Bash prints a message indicating -failure to the standard error and no substitution occurs. +failure to the standard error, +does not perform the substitution, +and does not execute the command associated with the expansion. @node Process Substitution @subsection Process Substitution @@ -2777,13 +2869,16 @@ appears as a filename. This filename is passed as an argument to the current command as the result of the expansion. + If the @code{>(@var{list})} form is used, writing to -the file will provide input for @var{list}. If the -@code{<(@var{list})} form is used, the file passed as an -argument should be read to obtain the output of @var{list}. +the file will provide input for @var{list}. +If the +@code{<(@var{list})} form is used, reading the file +will obtain the output of @var{list}. Note that no space may appear between the @code{<} or @code{>} and the left parenthesis, otherwise the construct would be interpreted as a redirection. + Process substitution is supported on systems that support named pipes (@sc{fifo}s) or the @file{/dev/fd} method of naming open files. @@ -2808,12 +2903,11 @@ the default, then sequences of @code{space}, @code{tab}, and @code{newline} at the beginning and end of the results of the previous expansions are ignored, and any sequence of @env{IFS} -characters not at the beginning or end serves to delimit words. +characters not at the beginning or end delimits words. If @env{IFS} has a value other than the default, then sequences of the whitespace characters @code{space}, @code{tab}, and @code{newline} -are ignored at the beginning and end of the -word, as long as the whitespace character is in the -value of @env{IFS} (an @env{IFS} whitespace character). +present the value of @env{IFS} (an @env{IFS} whitespace character) +are ignored at the beginning and end of the word. Any character in @env{IFS} that is not @env{IFS} whitespace, along with any adjacent @env{IFS} whitespace characters, delimits a field. A sequence of @env{IFS} @@ -2836,8 +2930,7 @@ That is, the word @code{-d''} becomes @code{-d} after word splitting and null argument removal. -Note that if no expansion occurs, no splitting -is performed. +Note that if no expansion occurs, no splitting is performed. @node Filename Expansion @subsection Filename Expansion @@ -2854,15 +2947,18 @@ After word splitting, unless the @option{-f} option has been set @samp{*}, @samp{?}, and @samp{[}. If one of these characters appears, and is not quoted, then the word is regarded as a @var{pattern}, -and replaced with an alphabetically sorted list of -filenames matching the pattern (@pxref{Pattern Matching}). +and replaced with a sorted list of filenames matching the pattern +(@pxref{Pattern Matching}), +subject to the value of the @code{GLOBSORT} shell variable +(@pxref{Bash Variables}). + If no matching filenames are found, and the shell option @code{nullglob} is disabled, the word is left unchanged. If the @code{nullglob} option is set, and no matches are found, the word is removed. If the @code{failglob} shell option is set, and no matches are found, -an error message is printed and the command is not executed. +Bash prints an error message and does not execute the command. If the shell option @code{nocaseglob} is enabled, the match is performed without regard to the case of alphabetic characters. @@ -2889,7 +2985,8 @@ for a description of the @code{nocaseglob}, @code{nullglob}, The @env{GLOBIGNORE} shell variable may be used to restrict the set of file names matching a -pattern. If @env{GLOBIGNORE} +pattern. +If @env{GLOBIGNORE} is set, each matching file name that also matches one of the patterns in @env{GLOBIGNORE} is removed from the list of matches. If the @code{nocaseglob} option is set, the matching against the patterns in @@ -2906,9 +3003,13 @@ To get the old behavior of ignoring filenames beginning with a @samp{.}, make @samp{.*} one of the patterns in @env{GLOBIGNORE}. The @code{dotglob} option is disabled when @env{GLOBIGNORE} is unset. +The @code{GLOBIGNORE} +pattern matching honors the setting of the @code{extglob} shell +option. After the pattern is expanded and matched against filenames, the value of the -@env{GLOBSORT} variable controls how the results are sorted, as described +@env{GLOBSORT} shell +variable controls how the results are sorted, as described below (@pxref{Bash Variables}). @node Pattern Matching @@ -2940,23 +3041,26 @@ Matches any single character. Matches any one of the enclosed characters. A pair of characters separated by a hyphen denotes a @var{range expression}; any character that falls between those two characters, inclusive, -using the current locale's collating sequence and character set, -is matched. If the first character following the +using the current locale's collating sequence and character set, matches. +If the first character following the @samp{[} is a @samp{!} or a @samp{^} -then any character not enclosed is matched. A @samp{@minus{}} -may be matched by including it as the first or last character -in the set. A @samp{]} may be matched by including it as the first +then any character not within the range matches. +To match a @samp{@minus{}}, include it as the first +or last character in the set. +To match a @samp{]}, include it as the first character in the set. + The sorting order of characters in range expressions, and the characters included in the range, -are determined by -the current locale and the values of the +are determined by the current locale and the values of the @env{LC_COLLATE} and @env{LC_ALL} shell variables, if set. For example, in the default C locale, @samp{[a-dx-z]} is equivalent to -@samp{[abcdxyz]}. Many locales sort characters in dictionary order, and in -these locales @samp{[a-dx-z]} is typically not equivalent to @samp{[abcdxyz]}; -it might be equivalent to @samp{[aBbCcDdxYyZz]}, for example. To obtain +@samp{[abcdxyz]}. +Many locales sort characters in dictionary order, and in these locales +@samp{[a-dx-z]} is typically not equivalent to @samp{[abcdxyz]}; +it might be equivalent to @samp{[aBbCcDdxYyZz]}, for example. +To obtain the traditional interpretation of ranges in bracket expressions, you can force the use of the C locale by setting the @env{LC_COLLATE} or @env{LC_ALL} environment variable to the value @samp{C}, or enable the @@ -3025,6 +3129,10 @@ pattern or sub-pattern that begins with a dot; when it is disabled, the set does not include any filenames beginning with ``.'' unless the pattern or sub-pattern begins with a @samp{.}. +If the @code{globskipdots} +shell option is enabled, the filenames +@samp{.} and @samp{..} +never appear in the set. As above, @samp{.} only has a special meaning when matching filenames. Complicated extended pattern matching against long strings is slow, @@ -3048,11 +3156,11 @@ Before a command is executed, its input and output may be @dfn{redirected} using a special notation interpreted by the shell. @dfn{Redirection} allows commands' file handles to be -duplicated, opened, closed, -made to refer to different files, +duplicated, opened, closed, made to refer to different files, and can change the files the command reads from and writes to. -Redirection may also be used to modify file handles in the -current shell execution environment. The following redirection +When used with the @code{exec} builtin, +redirections modify file handles in the current shell execution environment. +The following redirection operators may precede or appear anywhere within a simple command or may follow a command. Redirections are processed in the order they appear, from @@ -3062,29 +3170,39 @@ Each redirection that may be preceded by a file descriptor number may instead be preceded by a word of the form @{@var{varname}@}. In this case, for each redirection operator except >&- and <&-, the shell will allocate a file descriptor greater -than 10 and assign it to @{@var{varname}@}. If >&- or <&- is preceded -by @{@var{varname}@}, the value of @var{varname} defines the file +than 10 and assign it to @{@var{varname}@}. +If @{@var{varname}@} precedes >&- or <&-, +the value of @var{varname} defines the file descriptor to close. If @{@var{varname}@} is supplied, the redirection persists beyond -the scope of the command, allowing the shell programmer to manage -the file descriptor's lifetime manually. +the scope of the command, which allows the shell programmer to manage +the file descriptor's lifetime manually without using +the @code{exec} builtin. The @code{varredir_close} shell option manages this behavior (@pxref{The Shopt Builtin}). In the following descriptions, if the file descriptor number is omitted, and the first character of the redirection operator is @samp{<}, the redirection refers to the standard input (file -descriptor 0). If the first character of the redirection operator +descriptor 0). +If the first character of the redirection operator is @samp{>}, the redirection refers to the standard output (file descriptor 1). -The word following the redirection operator in the following -descriptions, unless otherwise noted, is subjected to brace expansion, -tilde expansion, parameter expansion, command substitution, arithmetic -expansion, quote removal, filename expansion, and word splitting. +The \fIword\fP following the redirection operator in the following +descriptions, unless otherwise noted, is subjected to +brace expansion, +tilde expansion, +parameter and variable expansion, +command substitution, +arithmetic expansion, +quote removal, +filename expansion, +and word splitting. If it expands to more than one word, Bash reports an error. -Note that the order of redirections is significant. For example, +The order of redirections is significant. +For example, the command @example ls > @var{dirlist} 2>&1 @@ -3108,7 +3226,7 @@ internally with the behavior described below. @table @code @item /dev/fd/@var{fd} -If @var{fd} is a valid integer, file descriptor @var{fd} is duplicated. +If @var{fd} is a valid integer, duplicate file descriptor @var{fd}. @item /dev/stdin File descriptor 0 is duplicated. @@ -3137,9 +3255,8 @@ care, as they may conflict with file descriptors the shell uses internally. @subsection Redirecting Input -Redirection of input causes the file whose name results from -the expansion of @var{word} -to be opened for reading on file descriptor @code{n}, +Redirecting input opens the file whose name results from +the expansion of @var{word} for reading on file descriptor @code{n}, or the standard input (file descriptor 0) if @code{n} is not specified. @@ -3149,11 +3266,12 @@ The general format for redirecting input is: @end example @subsection Redirecting Output -Redirection of output causes the file whose name results from +Redirecting output opens the file whose name results from the expansion of @var{word} -to be opened for writing on file descriptor @var{n}, +for writing on file descriptor @var{n}, or the standard output (file descriptor 1) if @var{n} -is not specified. If the file does not exist it is created; +is not specified. +If the file does not exist it is created; if it does exist it is truncated to zero size. The general format for redirecting output is: @@ -3166,16 +3284,17 @@ option to the @code{set} builtin has been enabled, the redirection will fail if the file whose name results from the expansion of @var{word} exists and is a regular file. If the redirection operator is @samp{>|}, or the redirection operator is -@samp{>} and the @code{noclobber} option is not enabled, the redirection -is attempted even if the file named by @var{word} exists. +@samp{>} and the @code{noclobber} option is not enabled, +Bash attemps the redirection +even if the file named by @var{word} exists. @subsection Appending Redirected Output -Redirection of output in this fashion -causes the file whose name results from -the expansion of @var{word} -to be opened for appending on file descriptor @var{n}, +Redirecting output in this fashion opens +the file whose name results from the expansion of @var{word} +for appending on file descriptor @var{n}, or the standard output (file descriptor 1) if @var{n} -is not specified. If the file does not exist it is created. +is not specified. +If the file does not exist it is created. The general format for appending output is: @example @@ -3183,11 +3302,10 @@ The general format for appending output is: @end example @subsection Redirecting Standard Output and Standard Error -This construct allows both the +This construct redirects both the standard output (file descriptor 1) and the standard error output (file descriptor 2) -to be redirected to the file whose name is the -expansion of @var{word}. +to the file whose name is the expansion of @var{word}. There are two formats for redirecting standard output and standard error: @@ -3206,15 +3324,15 @@ This is semantically equivalent to >@var{word} 2>&1 @end example When using the second form, @var{word} may not expand to a number or -@samp{-}. If it does, other redirection operators apply +@samp{-}. +If it does, other redirection operators apply (see Duplicating File Descriptors below) for compatibility reasons. @subsection Appending Standard Output and Standard Error -This construct allows both the +This construct appends both the standard output (file descriptor 1) and the standard error output (file descriptor 2) -to be appended to the file whose name is the -expansion of @var{word}. +to the file whose name is the expansion of @var{word}. The format for appending standard output and standard error is: @example @@ -3231,7 +3349,7 @@ This is semantically equivalent to This type of redirection instructs the shell to read input from the current source until it reads a line containing only @var{delimiter} (with no trailing blanks). -All of the lines read up to that point are then used as the standard +All of the lines read up to that point then become the standard input (or file descriptor @var{n} if @var{n} is specified) for a command. The format of here-documents is: @@ -3241,8 +3359,9 @@ The format of here-documents is: @var{delimiter} @end example -No parameter and variable expansion, command substitution, -arithmetic expansion, or filename expansion is performed on +The shell does not perform +parameter and variable expansion, command substitution, +arithmetic expansion, or filename expansion on @var{word}. If any part of @var{word} is quoted, the @@ -3250,18 +3369,27 @@ If any part of @var{word} is quoted, the and the lines in the here-document are not expanded. If @var{word} is unquoted, @var{delimiter} is @var{word} itself, +and the here-document text is treated similarly to a double-quoted string: all lines of the here-document are subjected to parameter expansion, command substitution, and arithmetic expansion, -the character sequence @code{\newline} is ignored, and @samp{\} -must be used to quote the characters -@samp{\}, @samp{$}, and @samp{`}. +the character sequence @code{\newline} is treated literally, +and @samp{\} must be used to quote the characters +@samp{\}, @samp{$}, and @samp{`}; +however, double quote characters have no special meaning. If the redirection operator is @samp{<<-}, -then all leading tab characters are stripped from input lines and the -line containing @var{delimiter}. +the shell strips leading tab characters are stripped from input lines +and the line containing @var{delimiter}. This allows here-documents within shell scripts to be indented in a natural fashion. +If the delimiter is not quoted, the +@code{\} +sequence is treated as a line continuation: the two lines are joined +and the backslash-newline is removed. +This happens while reading the here-document, before the check for +the ending delimiter, so joined lines can form the end delimiter. + @subsection Here Strings A variant of here documents, the format is: @example @@ -3272,8 +3400,7 @@ The @var{word} undergoes tilde expansion, parameter and variable expansion, command substitution, arithmetic expansion, and quote removal. Filename expansion and word splitting are not performed. -The result is supplied as a single string, -with a newline appended, +The result is supplied as a single string, with a newline appended, to the command on its standard input (or file descriptor @var{n} if @var{n} is specified). @@ -3285,28 +3412,29 @@ The redirection operator @noindent is used to duplicate input file descriptors. If @var{word} -expands to one or more digits, the file descriptor denoted by @var{n} +expands to one or more digits, file descriptor @var{n} is made to be a copy of that file descriptor. -If the digits in @var{word} do not specify a file descriptor open for -input, a redirection error occurs. +It is a redirection error if the digits in +@var{word} do not specify a file descriptor open for input. If @var{word} evaluates to @samp{-}, file descriptor @var{n} is closed. -If @var{n} is not specified, the standard input (file descriptor 0) is used. +If @var{n} is not specified, this uses the standard input (file descriptor 0). The operator @example [@var{n}]>&@var{word} @end example @noindent -is used similarly to duplicate output file descriptors. If -@var{n} is not specified, the standard output (file descriptor 1) is used. -If the digits in @var{word} do not specify a file descriptor open for -output, a redirection error occurs. +is used similarly to duplicate output file descriptors. +If @var{n} is not specified, this uses the standard output (file descriptor 1). +It is a redirection error if the digits in +@var{word} do not specify a file descriptor open for output. If @var{word} evaluates to @samp{-}, file descriptor @var{n} is closed. -As a special case, if @var{n} is omitted, and @var{word} does not -expand to one or more digits or @samp{-}, the standard output and standard -error are redirected as described previously. +As a special case, if @var{n} is omitted, and +@var{word} does not expand to one or more digits or @samp{-}, +this redirects the standard output and standard error as described +previously. @subsection Moving File Descriptors The redirection operator @@ -3332,10 +3460,11 @@ The redirection operator [@var{n}]<>@var{word} @end example @noindent -causes the file whose name is the expansion of @var{word} -to be opened for both reading and writing on file descriptor +opens the file whose name is the expansion of @var{word} +for both reading and writing on file descriptor @var{n}, or on file descriptor 0 if @var{n} -is not specified. If the file does not exist, it is created. +is not specified. +If the file does not exist, it is created. @node Executing Commands @section Executing Commands @@ -3358,7 +3487,7 @@ is not specified. If the file does not exist, it is created. @subsection Simple Command Expansion @cindex command expansion -When a simple command is executed, the shell performs the following +When the shell executes a simple command, it performs the following expansions, assignments, and redirections, from left to right, in the following order. @@ -3395,14 +3524,17 @@ If any of the assignments attempts to assign a value to a readonly variable, an error occurs, and the command exits with a non-zero status. If no command name results, redirections are performed, but do not -affect the current shell environment. A redirection error causes the -command to exit with a non-zero status. +affect the current shell environment. +A redirection error causes the command to exit with a non-zero status. If there is a command name left after expansion, execution proceeds as -described below. Otherwise, the command exits. If one of the expansions -contained a command substitution, the exit status of the command is -the exit status of the last command substitution performed. If there -were no command substitutions, the command exits with a status of zero. +described below. +Otherwise, the command exits. +If one of the expansions contained a command substitution, +the exit status of the command is the exit status of +the last command substitution performed. +If there were no command substitutions, +the command exits with a zero status. @node Command Search and Execution @subsection Command Search and Execution @@ -3416,23 +3548,25 @@ the following actions. @enumerate @item If the command name contains no slashes, the shell attempts to -locate it. If there exists a shell function by that name, that +locate it. +If there exists a shell function by that name, that function is invoked as described in @ref{Shell Functions}. @item If the name does not match a function, the shell searches for -it in the list of shell builtins. If a match is found, that -builtin is invoked. +it in the list of shell builtins. +If a match is found, that builtin is invoked. @item If the name is neither a shell function nor a builtin, and contains no slashes, Bash searches each element of @env{$PATH} for a directory containing an executable file -by that name. Bash uses a hash table to remember the full +by that name. +Bash uses a hash table to remember the full pathnames of executable files to avoid multiple @env{PATH} searches (see the description of @code{hash} in @ref{Bourne Shell Builtins}). -A full search of the directories in @env{$PATH} -is performed only if the command is not found in the hash table. +Bash performs a full search of the directories in @env{$PATH} +only if the command is not found in the hash table. If the search is unsuccessful, the shell searches for a defined shell function named @code{command_not_found_handle}. If that function exists, it is invoked in a separate execution environment @@ -3452,8 +3586,9 @@ to the command are set to the arguments supplied, if any. @item If this execution fails because the file is not in executable format, and the file is not a directory, it is assumed to be a -@dfn{shell script} and the shell executes it as described in -@ref{Shell Scripts}. +@dfn{shell script}, +a file containing shell commands, +and the shell executes it as described in @ref{Shell Scripts}. @item If the command was not begun asynchronously, the shell waits for @@ -3512,8 +3647,8 @@ various process @sc{id}s, including those of background jobs When a simple command other than a builtin or shell function is to be executed, it is invoked in a separate execution environment that consists of -the following. Unless otherwise noted, the values are inherited -from the shell. +the following. +Unless otherwise noted, the values are inherited from the shell. @itemize @bullet @item @@ -3545,9 +3680,12 @@ Command substitution, commands grouped with parentheses, and asynchronous commands are invoked in a subshell environment that is a duplicate of the shell environment, except that traps caught by the shell are reset to the values -that the shell inherited from its parent at invocation. Builtin -commands that are invoked as part of a pipeline are also executed -in a subshell environment. Changes made to the subshell environment +that the shell inherited from its parent at invocation. +Builtin commands that are invoked as part of a pipeline, +except possibly in the last element depending on the value of the +@code{lastpipe} shell option (@pxref{The Shopt Builtin}), +are also executed in a subshell environment. +Changes made to the subshell environment cannot affect the shell's execution environment. When the shell is in @sc{posix} mode, @@ -3575,24 +3713,30 @@ This is a list of name-value pairs, of the form @code{name=value}. Bash provides several ways to manipulate the environment. On invocation, the shell scans its own environment and creates a parameter for each name found, automatically marking -it for @code{export} -to child processes. Executed commands inherit the environment. -The @code{export} and @samp{declare -x} -commands allow parameters and functions to be added to and -deleted from the environment. If the value of a parameter -in the environment is modified, the new value becomes part -of the environment, replacing the old. The environment +it for @code{export} to child processes. +Executed commands inherit the environment. +The @code{export}, @samp{declare -x}, and @code{unset} +commands modify the environment by +adding and deleting parameters and functions. +If the value of a parameter in the environment is modified, +the new value automatically becomes part +of the environment, replacing the old. +The environment inherited by any executed command consists of the shell's initial environment, whose values may be modified in the shell, less any pairs removed by the @code{unset} and @samp{export -n} commands, plus any additions via the @code{export} and @samp{declare -x} commands. -The environment for any simple command -or function may be augmented temporarily by prefixing it with -parameter assignments, as described in @ref{Shell Parameters}. +If any parameter assignment statements, +as described in @ref{Shell Parameters}, +appear before a simple command, +the variable assignments are part of that command's environment +for as long as it executes. These assignment statements affect only the environment seen by that command. +If these assignments precede a call to a shell function, the variables +are local to the function and exported to that function's children. If the @option{-k} option is set (@pxref{The Set Builtin}), then all parameter assignments are placed in the environment for a command, @@ -3607,25 +3751,28 @@ command in its environment. @cindex exit status The exit status of an executed command is the value returned by the -@code{waitpid} system call or equivalent function. Exit statuses -fall between 0 and 255, though, as explained below, the shell may -use values above 125 specially. Exit statuses from shell builtins and -compound commands are also limited to this range. Under certain -circumstances, the shell will use special values to indicate specific -failure modes. +@code{waitpid} system call or equivalent function. +Exit statuses fall between 0 and 255, though, as explained below, +the shell may use values above 125 specially. +Exit statuses from shell builtins and compound commands are also limited +to this range. +Under certain circumstances, the shell will use special values to +indicate specific failure modes. For the shell's purposes, a command which exits with a zero exit status has succeeded. -A non-zero exit status indicates failure. +So while an exit status of zero indicates success, a non-zero +exit status indicates failure. This seemingly counter-intuitive scheme is used so there is one well-defined way to indicate success and a variety of ways to indicate various failure modes. + When a command terminates on a fatal signal whose number is @var{N}, Bash uses the value 128+@var{N} as the exit status. If a command is not found, the child process created to -execute it returns a status of 127. If a command is found -but is not executable, the return status is 126. +execute it returns a status of 127. +If a command is found but is not executable, the return status is 126. If a command fails because of an error during expansion or redirection, the exit status is greater than zero. @@ -3643,21 +3790,32 @@ generally invalid options or missing arguments. The exit status of the last command is available in the special parameter $? (@pxref{Special Parameters}). +Bash itself returns the exit status of the last command +executed, unless a syntax error occurs, in which case it exits +with a non-zero value. +See also the @code{exit} builtin command (@pxref{Bourne Shell Builtins}. + @node Signals @subsection Signals @cindex signal handling -When Bash is interactive, in the absence of any traps, it ignores -@code{SIGTERM} (so that @samp{kill 0} does not kill an interactive shell), -and @code{SIGINT} -is caught and handled (so that the @code{wait} builtin is interruptible). +When Bash is interactive, in the absence of any traps, +it ignores @code{SIGTERM} +(so that @samp{kill 0} does not kill an interactive shell), +and catches and handles @code{SIGINT} +(so that the @code{wait} builtin is interruptible). When Bash receives a @code{SIGINT}, it breaks out of any executing loops. In all cases, Bash ignores @code{SIGQUIT}. If job control is in effect (@pxref{Job Control}), Bash ignores @code{SIGTTIN}, @code{SIGTTOU}, and @code{SIGTSTP}. -Non-builtin commands started by Bash have signal handlers set to the -values inherited by the shell from its parent. +The @code{trap} builtin modifies the shell's signal handling, as +described below (@pxref{Bourne Shell Builtins}. + +Non-builtin commands Bash executes have signal handlers set to the +values inherited by the shell from its parent, +unless @code{trap} sets them to be ignored, in which case the child +process will ignore them as well. When job control is not in effect, asynchronous commands ignore @code{SIGINT} and @code{SIGQUIT} in addition to these inherited handlers. @@ -3668,26 +3826,25 @@ command substitution ignore the keyboard-generated job control signals The shell exits by default upon receipt of a @code{SIGHUP}. Before exiting, an interactive shell resends the @code{SIGHUP} to all jobs, running or stopped. -Stopped jobs are sent @code{SIGCONT} to ensure that they receive -the @code{SIGHUP}. +The shell sends @code{SIGCONT} to stopped jobs to ensure that they +receive the @code{SIGHUP} +(@xref{Job Control}, for more information about running and stopped jobs). To prevent the shell from sending the @code{SIGHUP} signal to a -particular job, it should be removed -from the jobs table with the @code{disown} -builtin (@pxref{Job Control Builtins}) or marked -to not receive @code{SIGHUP} using @code{disown -h}. +particular job, remove it from the jobs table with the @code{disown} +builtin (@pxref{Job Control Builtins}) or mark it +not to receive @code{SIGHUP} using @code{disown -h}. -If the @code{huponexit} shell option has been set with @code{shopt} +If the @code{huponexit} shell option has been set using @code{shopt} (@pxref{The Shopt Builtin}), Bash sends a @code{SIGHUP} to all jobs when an interactive login shell exits. If Bash is waiting for a command to complete and receives a signal for which a trap has been set, the trap will not be executed until the command completes. -When Bash is waiting for an asynchronous -command via the @code{wait} builtin, the reception of a signal for -which a trap has been set will cause the @code{wait} builtin to return -immediately with an exit status greater than 128, immediately after -which the trap is executed. +If Bash is waiting for an asynchronous command via the @code{wait} builtin, +and it receives a signal for which a trap has been set, +the @code{wait} builtin will return immediately with an exit status +greater than 128, immediately after which the shell executes the trap. When job control is not enabled, and Bash is waiting for a foreground command to complete, the shell receives keyboard-generated signals @@ -3714,7 +3871,8 @@ handled the @code{SIGINT} itself and did not treat it as a fatal signal. In that case, Bash does not treat @code{SIGINT} as a fatal signal, either, instead assuming that the @code{SIGINT} was used as part of the program's normal operation (e.g., @command{emacs} uses it to abort editing -commands) or deliberately discarded. However, Bash will run any +commands) or deliberately discarded. +However, Bash will run any trap set on @code{SIGINT}, as it does with any other trapped signal it receives while it is waiting for the foreground command to complete, for compatibility. @@ -3724,14 +3882,18 @@ complete, for compatibility. @section Shell Scripts @cindex shell script -A shell script is a text file containing shell commands. When such -a file is used as the first non-option argument when invoking Bash, -and neither the @option{-c} nor @option{-s} option is supplied -(@pxref{Invoking Bash}), -Bash reads and executes commands from the file, then exits. This -mode of operation creates a non-interactive shell. The shell first -searches for the file in the current directory, and looks in the -directories in @env{$PATH} if not found there. +A shell script is a text file containing shell commands. +When such a file is used as the first non-option argument when +invoking Bash, and neither the @option{-c} nor @option{-s} option +is supplied (@pxref{Invoking Bash}), +Bash reads and executes commands from the file, then exits. +This mode of operation creates a non-interactive shell. +If the filename does not contain any slashes, the shell first searches +for the file in the current directory, and looks in the directories in +@env{$PATH} if not found there. + +Bash tries to determine whether the file is a text file or a binary, +and will not execute files it determines to be binaries. When Bash runs a shell script, it sets the special parameter @code{0} to the name @@ -3741,10 +3903,9 @@ If no additional arguments are supplied, the positional parameters are unset. A shell script may be made executable by using the @code{chmod} command -to turn on the execute bit. When Bash finds such a file while -searching the @env{$PATH} for a command, it creates a -new instance of itself -to execute it. +to turn on the execute bit. +When Bash finds such a file while searching the @env{$PATH} for a command, +it creates a new instance of itself to execute it. In other words, executing @example filename @var{arguments} @@ -3763,8 +3924,10 @@ exception that the locations of commands remembered by the parent (see the description of @code{hash} in @ref{Bourne Shell Builtins}) are retained by the child. -Most versions of Unix make this a part of the operating system's command -execution mechanism. If the first line of a script begins with +The @sc{gnu} operating system, +and most versions of Unix, +make this a part of the operating system's command execution mechanism. +If the first line of a script begins with the two characters @samp{#!}, the remainder of the line specifies an interpreter for the program and, depending on the operating system, one or more optional arguments for that interpreter. @@ -3787,7 +3950,8 @@ portable to assume that using more than one argument will work. Bash scripts often begin with @code{#! /bin/bash} (assuming that Bash has been installed in @file{/bin}), since this ensures that Bash will be used to interpret the script, even if it is executed -under another shell. It's a common idiom to use @code{env} to find +under another shell. +It's a common idiom to use @code{env} to find @code{bash} even if it's been installed in another directory: @code{#!/usr/bin/env bash} will find the first occurrence of @code{bash} in @env{$PATH}. @@ -3860,8 +4024,9 @@ The return status is zero. . [-p @var{path}] @var{filename} [@var{arguments}] @end example -Read and execute commands from the @var{filename} argument in the -current shell context. +The @code{.} command reads and execute commands from the @var{filename} +argument in the current shell context. + If @var{filename} does not contain a slash, @code{.} searches for it. If @option{-p} is supplied, @code{.} treats @var{path} as a colon-separated list of directories in which to find @var{filename}; @@ -3870,20 +4035,24 @@ otherwise, @code{.} uses the directories in @env{PATH} to find @var{filename}. When Bash is not in @sc{posix} mode, it searches the current directory if @var{filename} is not found in @env{$PATH}, but does not search the current directory if @option{-p} is supplied. -If the @code{sourcepath} option (@pxref{The Shopt Builtin}) is turned off +If the @code{sourcepath} option (@pxref{The Shopt Builtin}) is turned off, @code{.} does not search @env{PATH}. + If any @var{arguments} are supplied, they become the positional parameters when @var{filename} is executed. Otherwise the positional parameters are unchanged. + If the @option{-T} option is enabled, @code{.} inherits any trap on @code{DEBUG}; if it is not, any @code{DEBUG} trap string is saved and restored around the call to @code{.}, and @code{.} unsets the @code{DEBUG} trap while it executes. If @option{-T} is not set, and the sourced file changes -the @code{DEBUG} trap, the new value is retained when @code{.} completes. -The return status is the exit status of the last command executed, or -zero if no commands are executed. If @var{filename} is not found, or -cannot be read, the return status is non-zero. +the @code{DEBUG} trap, the new value persists after @code{.} completes. +The return status is the exit status of the last command executed +from @var{filename}, or +zero if no commands are executed. +If @var{filename} is not found, or cannot be read, +the return status is non-zero. This builtin is equivalent to @code{source}. @item break @@ -3893,7 +4062,7 @@ break [@var{n}] @end example Exit from a @code{for}, @code{while}, @code{until}, or @code{select} loop. -If @var{n} is supplied, the @var{n}th enclosing loop is exited. +If @var{n} is supplied, @code{break} exits the @var{n}th enclosing loop. @var{n} must be greater than or equal to 1. The return status is zero unless @var{n} is not greater than or equal to 1. @@ -3905,12 +4074,14 @@ cd [-L|[-P [-e]]] [-@@] [@var{directory}] Change the current working directory to @var{directory}. If @var{directory} is not supplied, the value of the @env{HOME} -shell variable is used. +shell variable is used as @var{directory}. If the shell variable @env{CDPATH} exists, @code{cd} uses it as a search path: @code{cd} searches each directory name in @env{CDPATH} for @var{directory}, with alternative directory names in @env{CDPATH} separated by a colon (@samp{:}). +A null directory name in @env{CDPATH} means the same thing as the +current directory. If @var{directory} begins with a slash, @env{CDPATH} is not used. The @option{-P} option means to not follow symbolic links: symbolic links @@ -3927,19 +4098,19 @@ of @var{directory}. If the @option{-e} option is supplied with @option{-P} and the current working directory cannot be successfully determined -after a successful directory change, @code{cd} will return an unsuccessful +after a successful directory change, @code{cd} will return a non-zero status. On systems that support it, the @option{-@@} option presents the extended attributes associated with a file as a directory. If @var{directory} is @samp{-}, it is converted to @env{$OLDPWD} -before the directory change is attempted. +before attempting the directory change. -If a non-empty directory name from @env{CDPATH} is used, or if +If @code{cd} uses a non-empty directory name from @env{CDPATH}, or if @samp{-} is the first argument, and the directory change is -successful, the absolute pathname of the new working directory is -written to the standard output. +successful, @code{cd} writes the absolute pathname of the new +working directory to the standard output. If the directory change is successful, @code{cd} sets the value of the @env{PWD} environment variable to the new directory name, and sets the @@ -3955,10 +4126,10 @@ non-zero otherwise. continue [@var{n}] @end example -Resume the next iteration of an enclosing @code{for}, @code{while}, -@code{until}, or @code{select} loop. -If @var{n} is supplied, the execution of the @var{n}th enclosing loop -is resumed. +@code{continue} resumes the next iteration of an enclosing @code{for}, +@code{while}, @code{until}, or @code{select} loop. +If @var{n} is supplied, Bash resumes the execution of the @var{n}th +enclosing loop. @var{n} must be greater than or equal to 1. The return status is zero unless @var{n} is not greater than or equal to 1. @@ -3968,9 +4139,10 @@ The return status is zero unless @var{n} is not greater than or equal to 1. eval [@var{arguments}] @end example -The arguments are concatenated together into a single command, which is -then read and executed, and its exit status returned as the exit status -of @code{eval}. +The @var{arguments} are concatenated together into a single command, +separated by spaces. +Bash then reads and executes this command and returns its exit status +as the exit status of @code{eval}. If there are no arguments or only empty arguments, the return status is zero. @@ -3982,6 +4154,8 @@ exec [-cl] [-a @var{name}] [@var{command} [@var{arguments}]] If @var{command} is supplied, it replaces the shell without creating a new process. +@var{command} cannot be a shell builtin or function. +The @var{arguments} become the arguments to @var{command} If the @option{-l} option is supplied, the shell places a dash at the beginning of the zeroth argument passed to @var{command}. This is what the @code{login} program does. @@ -3989,15 +4163,18 @@ The @option{-c} option causes @var{command} to be executed with an empty environment. If @option{-a} is supplied, the shell passes @var{name} as the zeroth argument to @var{command}. + If @var{command} cannot be executed for some reason, a non-interactive shell exits, -unless the @code{execfail} shell option -is enabled. In that case, it returns failure. -An interactive shell returns failure if the file cannot be executed. +unless the @code{execfail} shell option is enabled. +In that case, it returns a non-zero status. +An interactive shell returns a non-zero status if the file cannot be executed. A subshell exits unconditionally if @code{exec} fails. -If no @var{command} is specified, redirections may be used to affect -the current shell environment. If there are no redirection errors, the -return status is zero; otherwise the return status is non-zero. + +If @var{command} is not specified, redirections may be used to affect +the current shell environment. +If there are no redirection errors, the return status is zero; +otherwise the return status is non-zero. @item exit @btindex exit @@ -4015,15 +4192,23 @@ Any trap on @code{EXIT} is executed before the shell terminates. export [-fn] [-p] [@var{name}[=@var{value}]] @end example -Mark each @var{name} to be passed to child processes -in the environment. If the @option{-f} option is supplied, the @var{name}s +Mark each @var{name} to be passed to subsequently executed commands in the +environment. +If the @option{-f} option is supplied, the @var{name}s refer to shell functions; otherwise the names refer to shell variables. -The @option{-n} option means to no longer mark each @var{name} for export. -If no @var{name}s are supplied, or if the @option{-p} option is given, a -list of names of all exported variables is displayed. + +The @option{-n} option means to unexport each name: no longer mark +it for export. +If no @var{name}s are supplied, or if the @option{-p} option is given, +@code{export} displays a list of names of all exported variables on the +standard output. The @option{-p} option displays output in a form that may be reused as input. -If a variable name is followed by =@var{value}, the value of -the variable is set to @var{value}. + +@code{export} allows the value of a variable to be set at the same time +it is exported or unexported by following the variable name with +=@var{value}. +This sets the value of the variable is to @var{value} while modifying +the export attribute. The return status is zero unless an invalid option is supplied, one of the names is not a valid shell variable name, or @option{-f} is supplied @@ -4035,7 +4220,7 @@ with a name that is not a shell function. false @end example -Does nothing, returns a non-zero status. +Does nothing; returns a non-zero status. @item getopts @btindex getopts @@ -4043,12 +4228,14 @@ Does nothing, returns a non-zero status. getopts @var{optstring} @var{name} [@var{arg} @dots{}] @end example -@code{getopts} is used by shell scripts to parse positional parameters. +@code{getopts} is used by shell scripts or functions to parse positional +parameters and obtain options and their arguments. @var{optstring} contains the option characters to be recognized; if a character is followed by a colon, the option is expected to have an argument, which should be separated from it by whitespace. The colon (@samp{:}) and question mark (@samp{?}) may not be used as option characters. + Each time it is invoked, @code{getopts} places the next option in the shell variable @var{name}, initializing @var{name} if it does not exist, @@ -4058,11 +4245,12 @@ variable @env{OPTIND}. is invoked. When an option requires an argument, @code{getopts} places that argument into the variable @env{OPTARG}. + The shell does not reset @env{OPTIND} automatically; it must be manually reset between multiple calls to @code{getopts} within the same shell -invocation if a new set of parameters is to be used. +invocation to use a new set of parameters. -When the end of options is encountered, @code{getopts} exits with a +When it reaches the end of options, @code{getopts} exits with a return value greater than zero. @env{OPTIND} is set to the index of the first non-option argument, and @var{name} is set to @samp{?}. @@ -4071,11 +4259,12 @@ and @var{name} is set to @samp{?}. normally parses the positional parameters, but if more arguments are supplied as @var{arg} values, @code{getopts} parses those instead. -@code{getopts} can report errors in two ways. If the first character of -@var{optstring} is a colon, @var{silent} -error reporting is used. In normal operation, diagnostic messages -are printed when invalid options or missing option arguments are -encountered. +@code{getopts} can report errors in two ways. +If the first character of +@var{optstring} is a colon, @code{getopts} uses @var{silent} +error reporting. +In normal operation, @code{getopts} prints diagnostic messages +when it encounters invalid options or missing option arguments. If the variable @env{OPTERR} is set to 0, no error messages will be displayed, even if the first character of @code{optstring} is not a colon. @@ -4094,6 +4283,10 @@ If @code{getopts} is silent, it sets the value of @var{name} to a colon (@samp{:}), and sets @env{OPTARG} to the option character found. +@code{getopts} returns true if an option, specified or unspecified, +is found. +It returns false when it encounters the end of options or if an error occurs. + @item hash @btindex hash @example @@ -4105,26 +4298,30 @@ commands specified as @var{name} arguments, so they need not be searched for on subsequent invocations. The commands are found by searching through the directories listed in @env{$PATH}. -Any previously-remembered filename is discarded. -The @option{-p} option inhibits the path search, and @var{filename} is -used as the location of @var{name}. +Any previously-remembered filename associated with @var{name} is discarded. +The @option{-p} option inhibits the path search, and @code{hash} uses +@var{filename} as the location of @var{name}. + The @option{-r} option causes the shell to forget all remembered locations. Assigning to the @env{PATH} variable also clears all hashed filenames. The @option{-d} option causes the shell to forget the remembered location of each @var{name}. -If the @option{-t} option is supplied, the full pathname to which each -@var{name} corresponds is printed. If multiple @var{name} arguments are -supplied with @option{-t}, the @var{name} is printed before the hashed -full pathname. -The @option{-l} option causes output to be displayed in a format -that may be reused as input. + +If the @option{-t} option is supplied, @code{hash} prints the full pathname +corresponding to each @var{name}. +If multiple @var{name} arguments are +supplied with @option{-t}, @code{hash} prints each @var{name} +before the corresponding hashed full path. +The @option{-l} option displays output in a format that may be reused as input. + If no arguments are given, or if only @option{-l} is supplied, -information about remembered commands is printed. +@code{hash} prints information about remembered commands. The @option{-t}, @option{-d}, and @option{-p} options (the options that act on the @var{name} arguments) are mutually exclusive. Only one will be active. If more than one is supplied, @option{-t} has higher priority than -@option{-p}, and both are higher priority than @option{-d}. +@option{-p}, and both have higher priority than @option{-d}. + The return status is zero unless a @var{name} is not found or an invalid option is supplied. @@ -4135,7 +4332,10 @@ pwd [-LP] @end example Print the absolute pathname of the current working directory. -If the @option{-P} option is supplied, the pathname printed will not +If the @option{-P} option is supplied, +or the @option{-o physical} option to the @code{set} builtin +(@pxref{The Set Builtin}) is enabled, +the pathname printed will not contain symbolic links. If the @option{-L} option is supplied, the pathname printed may contain symbolic links. @@ -4150,21 +4350,27 @@ readonly [-aAf] [-p] [@var{name}[=@var{value}]] @dots{} @end example Mark each @var{name} as readonly. -The values of these names may not be changed by subsequent assignment. +The values of these names may not be changed by subsequent assignment +or unset. If the @option{-f} option is supplied, each @var{name} refers to a shell function. The @option{-a} option means each @var{name} refers to an indexed array variable; the @option{-A} option means each @var{name} refers to an associative array variable. If both options are supplied, @option{-A} takes precedence. -If no @var{name} arguments are given, or if the @option{-p} -option is supplied, a list of all readonly names is printed. +If no @var{name} arguments are supplied, or if the @option{-p} +option is supplied, print a list of all readonly names. The other options may be used to restrict the output to a subset of the set of readonly names. -The @option{-p} option causes output to be displayed in a format that -may be reused as input. -If a variable name is followed by =@var{value}, the value of -the variable is set to @var{value}. +The @option{-p} +option displays output in a format that may be reused as input. + +@code{readonly} allows the value of a variable to be set at the same time +the readonly attribute is changed by following the variable name with +=@var{value}. +This sets the value of the variable is to @var{value} while modifying +the readonly attribute. + The return status is zero unless an invalid option is supplied, one of the @var{name} arguments is not a valid shell variable or function name, or the @option{-f} option is supplied with a name that is not a shell function. @@ -4175,24 +4381,27 @@ or the @option{-f} option is supplied with a name that is not a shell function. return [@var{n}] @end example -Cause a shell function to stop executing and return the value @var{n} +Stop executing a shell function or sourced file and return the value @var{n} to its caller. If @var{n} is not supplied, the return value is the exit status of the -last command executed in the function. +last command executed. If @code{return} is executed by a trap handler, the last command used to determine the status is the last command executed before the trap handler. If @code{return} is executed during a @code{DEBUG} trap, the last command used to determine the status is the last command executed by the trap handler before @code{return} was invoked. -@code{return} may also be used to terminate execution of a script -being executed with the @code{.} (@code{source}) builtin, -returning either @var{n} or + +When @code{return} is used to terminate execution of a script +being executed with the @code{.} (@code{source}) builtin, it +returns either @var{n} or the exit status of the last command executed within the script as the exit status of the script. If @var{n} is supplied, the return value is its least significant 8 bits. + Any command associated with the @code{RETURN} trap is executed before execution resumes after the function or script. + The return status is non-zero if @code{return} is supplied a non-numeric argument or is used outside a function and not during the execution of a script by @code{.} or @code{source}. @@ -4203,15 +4412,15 @@ and not during the execution of a script by @code{.} or @code{source}. shift [@var{n}] @end example -Shift the positional parameters to the left by @var{n}. -The positional parameters from @var{n}+1 @dots{} @code{$#} are +Shift the positional parameters to the left by @var{n}: +the positional parameters from @var{n}+1 @dots{} @code{$#} are renamed to @code{$1} @dots{} @code{$#}-@var{n}. Parameters represented by the numbers @code{$#} down to @code{$#}-@var{n}+1 are unset. @var{n} must be a non-negative number less than or equal to @code{$#}. +If @var{n} is not supplied, it is assumed to be 1. If @var{n} is zero or greater than @code{$#}, the positional parameters are not changed. -If @var{n} is not supplied, it is assumed to be 1. The return status is zero unless @var{n} is greater than @code{$#} or less than zero, non-zero otherwise. @@ -4223,21 +4432,20 @@ less than zero, non-zero otherwise. test @var{expr} @end example -Evaluate a conditional expression @var{expr} and return a status of 0 -(true) or 1 (false). +Evaluate a conditional expression @var{expr} and return a status of +0 (true) or 1 (false). Each operator and operand must be a separate argument. Expressions are composed of the primaries described below in @ref{Bash Conditional Expressions}. -@code{test} does not accept any options, nor does it accept and ignore -an argument of @option{--} as signifying the end of options. - -When the @code{[} form is used, the last argument to the command must +@code{test} does not accept any options, nor does it accept and +ignore an argument of @option{--} as signifying the end of options. +When using the @code{[} form, the last argument to the command must be a @code{]}. Expressions may be combined using the following operators, listed in decreasing order of precedence. The evaluation depends on the number of arguments; see below. -Operator precedence is used when there are five or more arguments. +@code{test} uses operator precedence when there are five or more arguments. @table @code @item ! @var{expr} @@ -4245,7 +4453,7 @@ True if @var{expr} is false. @item ( @var{expr} ) Returns the value of @var{expr}. -This may be used to override the normal precedence of operators. +This may be used to override normal operator precedence. @item @var{expr1} -a @var{expr2} True if both @var{expr1} and @var{expr2} are true. @@ -4319,9 +4527,8 @@ using the rules listed above. If the shell is in @sc{posix} mode, or if the expression is part of the @code{[[} command, the @samp{<} and @samp{>} operators sort using the current locale. -If the shell is not in @sc{posix} mode, -the @code{test} and @samp{[} commands -sort lexicographically using ASCII ordering. +If the shell is not in @sc{posix} mode, the @code{test} and @samp{[} +commands sort lexicographically using ASCII ordering. The historical operator-precedence parsing with 4 or more arguments can lead to ambiguities when it encounters strings that look like primaries. @@ -4359,9 +4566,10 @@ trap [-Plp] [@var{action}] [@var{sigspec} @dots{}] @end example The @var{action} is a command that is read and executed when the -shell receives signal @var{sigspec}. If @var{action} is absent (and +shell receives any of the signals @var{sigspec}. +If @var{action} is absent (and there is a single @var{sigspec}) or -equal to @samp{-}, each specified signal's disposition is reset +equal to @samp{-}, each specified @var{sigspec}'ss disposition is reset to the value it had when the shell was started. If @var{action} is the null string, then the signal specified by each @var{sigspec} is ignored by the shell and commands it invokes. @@ -4370,6 +4578,7 @@ If no arguments are supplied, @code{trap} prints the actions associated with each trapped signal as a set of @code{trap} commands that can be reused as shell input to restore the current signal dispositions. + If @var{action} is not present and @option{-p} has been supplied, @code{trap} displays the trap commands associated with each @var{sigspec}, or, if no @var{sigspec}s are supplied, for all trapped signals, @@ -4378,15 +4587,17 @@ restore the current signal dispositions. The @option{-P} option behaves similarly, but displays only the actions associated with each @var{sigspec} argument. @option{-P} requires at least one @var{sigspec} argument. -The @option{-P} or @option{-p} options to @code{trap} may be +The @option{-P} or @option{-p} options may be used in a subshell environment (e.g., command substitution) and, as long as they are used before @code{trap} is used to change a signal's handling, will display the state of its parent's traps. -The @option{-l} option causes @code{trap} to print a list of signal names +The @option{-l} option prints a list of signal names and their corresponding numbers. Each @var{sigspec} is either a signal name or a signal number. Signal names are case insensitive and the @code{SIG} prefix is optional. +If @option{-l} is supplied with no @var{sigspec} arguments, it prints a +list of valid signal names. If a @var{sigspec} is @code{0} or @code{EXIT}, @var{action} is executed when the shell exits. @@ -4395,8 +4606,8 @@ before every simple command, @code{for} command, @code{case} command, @code{select} command, (( arithmetic command, [[ conditional command, arithmetic @code{for} command, and before the first command executes in a shell function. -Refer to the description of the @code{extdebug} option to the -@code{shopt} builtin (@pxref{The Shopt Builtin}) for details of its +Refer to the description of the @code{extdebug} shell option +(@pxref{The Shopt Builtin}) for details of its effect on the @code{DEBUG} trap. If a @var{sigspec} is @code{RETURN}, @var{action} is executed each time a shell function or a script executed with the @code{.} or @@ -4414,19 +4625,21 @@ part of the test following the @code{if} or @code{elif} reserved words, part of a command executed in a @code{&&} or @code{||} list except the command following the final @code{&&} or @code{||}, any command in a pipeline but the last, +(subject to the state of the @code{pipefail} shell option), or if the command's return status is being inverted using @code{!}. These are the same conditions obeyed by the @code{errexit} (@option{-e}) option. -Signals ignored upon entry to a non-interactive shell cannot be trapped or +When the shell is not interactive, +signals ignored upon entry to a non-interactive shell cannot be trapped or reset. Interactive shells permit trapping signals ignored on entry. Trapped signals that are not being ignored are reset to their original values in a subshell or subshell environment when one is created. The return status is zero unless a @var{sigspec} does not specify a -valid signal. +valid signal; non-zero otherwise. @item true @btindex true @@ -4442,13 +4655,15 @@ Does nothing, returns a 0 status. umask [-p] [-S] [@var{mode}] @end example -Set the shell process's file creation mask to @var{mode}. If -@var{mode} begins with a digit, it is interpreted as an octal number; +Set the shell process's file creation mask to @var{mode}. +If @var{mode} begins with a digit, it is interpreted as an octal number; if not, it is interpreted as a symbolic mode mask similar -to that accepted by the @code{chmod} command. If @var{mode} is -omitted, the current value of the mask is printed. If the @option{-S} -option is supplied without a @var{mode} argument, the mask is printed -in a symbolic format. +to that accepted by the @code{chmod} command. +If @var{mode} is omitted, @code{umask} prints the current value of the mask. +If the @option{-S} +option is supplied without a @var{mode} argument, @code{umask} +prints the mask in a symbolic format; +the default output is an octal number. If the @option{-p} option is supplied, and @var{mode} is omitted, the output is in a form that may be reused as input. The return status is zero if the mode is successfully changed or if @@ -4477,6 +4692,9 @@ If no options are supplied, each @var{name} refers to a variable; if there is no variable by that name, a function with that name, if any, is unset. Readonly variables and functions may not be unset. +When variables or functions are removed, they are also removed +from the environment passed to subsequent commands. +Some shell variables may not be unset. Some shell variables lose their special behavior if they are unset; such behavior is noted in the description of the individual variables. The return status is zero unless a @var{name} is readonly or may not be unset. @@ -4500,9 +4718,15 @@ alias [-p] [@var{name}[=@var{value}] @dots{}] Without arguments or with the @option{-p} option, @code{alias} prints the list of aliases on the standard output in a form that allows them to be reused as input. -If arguments are supplied, an alias is defined for each @var{name} -whose @var{value} is given. If no @var{value} is given, the name -and value of the alias is printed. +If arguments are supplied, define an alias for each @var{name} +whose @var{value} is given. +If no @var{value} is given, print the name and value of the alias @var{name}. +A trailing space in @var{value} causes the next word to be +checked for alias substitution when the alias is expanded +during command parsing. +@code{alias} returns true unless a @var{name} is given +(without a corresponding =@var{value}) +for which no alias has been defined. Aliases are described in @ref{Aliases}. @item bind @@ -4520,13 +4744,19 @@ bind @var{readline-command-line} Display current Readline (@pxref{Command Line Editing}) key and function bindings, -bind a key sequence to a Readline function or macro, +bind a key sequence to a Readline function or macro +or to a shell command, or set a Readline variable. -Each non-option argument is a command as it would appear in a +Each non-option argument is a key binding or command as it would appear in a Readline initialization file (@pxref{Readline Init File}), but each binding or command must be passed as a separate argument; e.g., @samp{"\C-x\C-r":re-read-init-file}. +In the following descriptions, options that display output in a form +available to be re-read format their output +as commands that would appear in a Readline initialization file or +that would be supplied as individual arguments to a @code{bind} command. + Options, if supplied, have the following meanings: @table @code @@ -4542,17 +4772,17 @@ names are @code{vi-move}, @code{vi-command}, and @code{vi-insert}. -@code{vi} is equivalent to @code{vi-command} (@code{vi-move} is also a -synonym); @code{emacs} is equivalent to @code{emacs-standard}. +@code{vi} is equivalent to @code{vi-command} +(@code{vi-move} is also a synonym); +@code{emacs} is equivalent to @code{emacs-standard}. @item -l List the names of all Readline functions. @item -p Display Readline function names and bindings -in such a way that they can be used as -an argument to a subsequent @code{bind} command -or in a Readline initialization file. +in such a way that they can be used as an argument to a subsequent +@code{bind} command or in a Readline initialization file. If arguments remain after option processing, @code{bind} treats them as readline command names and restricts output to those names. @@ -4561,32 +4791,32 @@ List current Readline function names and bindings. If arguments remain after option processing, @code{bind} treats them as readline command names and restricts output to those names. -@item -v -Display Readline variable names and values -in such a way that they can be used as +@item -s +Display Readline key sequences bound to macros and the strings +they output in such a way that they can be used as an argument to a subsequent @code{bind} command or in a Readline initialization file. -@item -V -List current Readline variable names and values. +@item -S +Display Readline key sequences bound to macros and the strings they output. -@item -s -Display Readline key sequences bound to macros and the strings they output +@item -v +Display Readline variable names and values in such a way that they can be used as an argument to a subsequent @code{bind} command or in a Readline initialization file. -@item -S -Display Readline key sequences bound to macros and the strings they output. +@item -V +List current Readline variable names and values. @item -f @var{filename} Read key bindings from @var{filename}. @item -q @var{function} -Query about which keys invoke the named @var{function}. +Display key sequences that invoke the named Readline @var{function}. @item -u @var{function} -Unbind all keys bound to the named @var{function}. +Unbind all key sequences bound to the named Readline @var{function}. @item -r @var{keyseq} Remove any current binding for @var{keyseq}. @@ -4602,18 +4832,20 @@ special backslash-escapes in @var{shell-command} before saving it. If the separator is a colon, any enclosing double quotes are optional, and Readline does not expand the command string before saving it. Since the entire key binding expression must be a single argument, it -should be enclosed in quotes. -When @var{shell-command} is executed, the shell sets the +should be enclosed in single quotes. +When @var{shell-command} is executed, the shell sets thex @code{READLINE_LINE} variable to the contents of the Readline line -buffer and the @code{READLINE_POINT} and @code{READLINE_MARK} variables -to the current location of the insertion point and the saved insertion -point (the @var{mark}), respectively. +buffer +and the +@code{READLINE_POINT} and @code{READLINE_MARK} +variables to the current location of the insertion point and the saved +insertion point (the @var{mark}), respectively. The shell assigns any numeric argument the user supplied to the @code{READLINE_ARGUMENT} variable. If there was no argument, that variable is not set. -If the executed command changes the value of any of @code{READLINE_LINE}, -@code{READLINE_POINT}, or @code{READLINE_MARK}, those new values will be -reflected in the editing state. +If the executed command changes the value of any of +@code{READLINE_LINE}, @code{READLINE_POINT}, or @code{READLINE_MARK}, +those new values will be reflected in the editing state. @item -X List all key sequences bound to shell commands and the associated commands @@ -4631,10 +4863,11 @@ error occurs. builtin [@var{shell-builtin} [@var{args}]] @end example -Run a shell builtin, passing it @var{args}, and return its exit status. +Execute the specified shell builtin @var{shell-builtin}, +passing it @var{args}, and return its exit status. This is useful when defining a shell function with the same -name as a shell builtin, retaining the functionality of the builtin within -the function. +name as a shell builtin, +retaining the functionality of the builtin within the function. The return status is non-zero if @var{shell-builtin} is not a shell builtin command. @@ -4651,9 +4884,9 @@ Without @var{expr}, @code{caller} displays the line number and source filename of the current subroutine call. If a non-negative integer is supplied as @var{expr}, @code{caller} displays the line number, subroutine name, and source file corresponding -to that position in the current execution call stack. This extra -information may be used, for example, to print a stack trace. The -current frame is frame 0. +to that position in the current execution call stack. +This extra information may be used, for example, to print a stack trace. +The current frame is frame 0. The return value is 0 unless the shell is not executing a subroutine call or @var{expr} does not correspond to a valid position in the @@ -4665,8 +4898,8 @@ call stack. command [-pVv] @var{command} [@var{arguments} @dots{}] @end example -Runs @var{command} with @var{arguments} ignoring any shell function -named @var{command}. +The @code{command} builtin runs @var{command} with @var{arguments} +ignoring any shell function named @var{command}. Only shell builtin commands or commands found by searching the @env{PATH} are executed. If there is a shell function named @code{ls}, running @samp{command ls} @@ -4678,11 +4911,13 @@ The return status in this case is 127 if @var{command} cannot be found or an error occurred, and the exit status of @var{command} otherwise. -If either the @option{-V} or @option{-v} option is supplied, a -description of @var{command} is printed. The @option{-v} option -causes a single word indicating the command or file name used to -invoke @var{command} to be displayed; the @option{-V} option produces -a more verbose description. In this case, the return status is +If either the @option{-V} or @option{-v} option is supplied, @code{command} +prints a description of @var{command}. +The @option{-v} option +displays a single word indicating the command or file name used to +invoke @var{command}; +the @option{-V} option produces a more verbose description. +In this case, the return status is zero if @var{command} is found, and non-zero if not. @item declare @@ -4691,20 +4926,21 @@ zero if @var{command} is found, and non-zero if not. declare [-aAfFgiIlnrtux] [-p] [@var{name}[=@var{value}] @dots{}] @end example -Declare variables and give them attributes. If no @var{name}s -are given, then display the values of variables instead. +Declare variables and give them attributes. +If no @var{name}s are given, then display the values of variables or +shell functions instead. The @option{-p} option will display the attributes and values of each @var{name}. When @option{-p} is used with @var{name} arguments, additional options, other than @option{-f} and @option{-F}, are ignored. -When @option{-p} is supplied without @var{name} arguments, @code{declare} -will display the attributes and values of all variables having the -attributes specified by the additional options. +When @option{-p} is supplied without @var{name} arguments, +@code{declare} will display the attributes and values +of all variables having the attributes specified by the additional options. If no other options are supplied with @option{-p}, @code{declare} will -display the attributes and values of all shell variables. The @option{-f} -option will restrict the display to shell functions. +display the attributes and values of all shell variables. +The @option{-f} option restricts the display to shell functions. The @option{-F} option inhibits the display of function definitions; only the function name and attributes are printed. @@ -4715,7 +4951,7 @@ each @var{name} is defined are displayed as well. The @option{-g} option forces variables to be created or modified at the global scope, even when @code{declare} is executed in a shell function. -It is ignored in all other cases. +It is ignored in when @code{declare} is not executed in a shell function. The @option{-I} option causes local variables to inherit the attributes (except the @code{nameref} attribute) @@ -4734,11 +4970,11 @@ Each @var{name} is an indexed array variable (@pxref{Arrays}). Each @var{name} is an associative array variable (@pxref{Arrays}). @item -f -Use function names only. +Each @var{name} refers to a shell function. @item -i -The variable is to be treated as -an integer; arithmetic evaluation (@pxref{Shell Arithmetic}) is +The variable is to be treated as an integer; +arithmetic evaluation (@pxref{Shell Arithmetic}) is performed when the variable is assigned a value. @item -l @@ -4757,7 +4993,8 @@ to @var{name}, except for those using or changing the The nameref attribute cannot be applied to array variables. @item -r -Make @var{name}s readonly. These names cannot then be assigned values +Make @var{name}s readonly. +These names cannot then be assigned values by subsequent assignment statements or unset. @item -t @@ -4776,12 +5013,13 @@ Mark each @var{name} for export to subsequent commands via the environment. @end table -Using @samp{+} instead of @samp{-} turns off the attribute instead, -with the exceptions that @samp{+a} and @samp{+A} +Using @samp{+} instead of @samp{-} turns off the specified +attribute instead, with the exceptions that @samp{+a} and @samp{+A} may not be used to destroy array variables and @samp{+r} will not remove the readonly attribute. + When used in a function, @code{declare} makes each @var{name} local, -as with the @code{local} command, unless the @option{-g} option is used. +as with the @code{local} command, unless the @option{-g} option is supplied. If a variable name is followed by =@var{value}, the value of the variable is set to @var{value}. @@ -4808,15 +5046,15 @@ echo [-neE] [@var{arg} @dots{}] Output the @var{arg}s, separated by spaces, terminated with a newline. The return status is 0 unless a write error occurs. -If @option{-n} is specified, the trailing newline is suppressed. -If the @option{-e} option is given, interpretation of the following -backslash-escaped characters is enabled. -The @option{-E} option disables the interpretation of these escape characters, +If @option{-n} is specified, the trailing newline is not printed. + +If the @option{-e} option is given, @code{echo} interprets the following +backslash-escaped characters. +The @option{-E} option disables interpretation of these escape characters, even on systems where they are interpreted by default. -The @code{xpg_echo} shell option may be used to -dynamically determine whether or not @code{echo} -interprets any options and -expands these escape characters by default. +The @code{xpg_echo} shell option determines +whether or not @code{echo} interprets any options and +expands these escape characters. @code{echo} does not interpret @option{--} to mean the end of options. @code{echo} interprets the following escape sequences: @@ -4856,6 +5094,8 @@ the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value @var{HHHHHHHH} (one to eight hex digits) @end table +@code{echo} writes any unrecognized backslash-escaped characters unchanged. + @item enable @btindex enable @example @@ -4863,32 +5103,34 @@ enable [-a] [-dnps] [-f @var{filename}] [@var{name} @dots{}] @end example Enable and disable builtin shell commands. -Disabling a builtin allows a disk command which has the same name +Disabling a builtin allows an executable file which has the same name as a shell builtin to be executed without specifying a full pathname, -even though the shell normally searches for builtins before disk commands. -If @option{-n} is used, the @var{name}s become disabled. Otherwise -@var{name}s are enabled. For example, to use the @code{test} binary -found via @env{$PATH} instead of the shell builtin version, type +even though the shell normally searches for builtins before files. + +If @option{-n} is supplied, the @var{name}s are disabled. +Otherwise @var{name}s are enabled. +For example, to use the @code{test} binary +found using @env{$PATH} instead of the shell builtin version, type @samp{enable -n test}. -If the @option{-p} option is supplied, or no @var{name} arguments appear, -a list of shell builtins is printed. With no other arguments, the list -consists of all enabled shell builtins. +If the @option{-p} option is supplied, or no @var{name} arguments are +supplied, print a list of shell builtins. +With no other arguments, the list consists of all enabled shell builtins. +The @option{-n} option means to print only disabled builtins. The @option{-a} option means to list each builtin with an indication of whether or not it is enabled. +The @option{-s} option means to +restrict @code{enable} to the @sc{posix} special builtins. The @option{-f} option means to load the new builtin command @var{name} from shared object @var{filename}, on systems that support dynamic loading. +If @var{filename} does not contain a slash. Bash will use the value of the @env{BASH_LOADABLES_PATH} variable as a -colon-separated list of directories in which to search for @var{filename}, -if @var{filename} does not contain a slash. -The default is system-dependent, +colon-separated list of directories in which to search for @var{filename}. +The default for @env{BASH_LOADABLES_PATH} is system-dependent, and may include "." to force a search of the current directory. The @option{-d} option will delete a builtin loaded with @option{-f}. - -If there are no options, a list of the shell builtins is displayed. -The @option{-s} option restricts @code{enable} to the @sc{posix} special -builtins. If @option{-s} is used with @option{-f}, the new builtin becomes +If @option{-s} is used with @option{-f}, the new builtin becomes a special builtin (@pxref{Special Builtins}). If no options are supplied and a @var{name} is not a shell builtin, @@ -4907,8 +5149,8 @@ help [-dms] [@var{pattern}] Display helpful information about builtin commands. If @var{pattern} is specified, @code{help} gives detailed help -on all commands matching @var{pattern}, otherwise a list of -the builtins is printed. +on all commands matching @var{pattern}, otherwise it displays +a list of all builtins and shell compound commands. Options, if supplied, have the following meanings: @@ -4929,11 +5171,12 @@ The return status is zero unless no command matches @var{pattern}. let @var{expression} [@var{expression} @dots{}] @end example -The @code{let} builtin allows arithmetic to be performed on shell -variables. Each @var{expression} is evaluated according to the -rules given below in @ref{Shell Arithmetic}. If the -last @var{expression} evaluates to 0, @code{let} returns 1; -otherwise 0 is returned. +The @code{let} builtin allows arithmetic to be performed on shell variables. +Each @var{expression} is evaluated as an arithmetic expression +according to the rules given below in @ref{Shell Arithmetic}. +If the last @var{expression} evaluates to 0, +@code{let} returns 1; +otherwise @code{let} returns 0. @item local @btindex local @@ -4941,20 +5184,25 @@ otherwise 0 is returned. local [@var{option}] @var{name}[=@var{value}] @dots{} @end example -For each argument, a local variable named @var{name} is created, -and assigned @var{value}. +For each argument, create a local variable named @var{name}, +and assign it @var{value}. The @var{option} can be any of the options accepted by @code{declare}. @code{local} can only be used within a function; it makes the variable @var{name} have a visible scope restricted to that function and its children. -If @var{name} is @samp{-}, the set of shell options is made local to the -function in which @code{local} is invoked: shell options changed using -the @code{set} builtin inside the function -after the call to @code{local} -are restored to their original -values when the function returns. -The restore is effected as if a series of @code{set} commands were executed -to restore the values that were in place before the function. +It is an error to use @code{local} when not within a function. + +If @var{name} is @samp{-}, it makes the set of shell options +local to the function in which @code{local} is invoked: +any shell options changed using the @code{set} builtin inside +the function after the call to @code{local} are restored to their +original values when the function returns. +The restore is performed as if a series of @code{set} commands were +executed to restore the values that were in place before the function. + +With no operands, @code{local} +writes a list of local variables to the standard output. + The return status is zero unless @code{local} is used outside a function, an invalid @var{name} is supplied, or @var{name} is a readonly variable. @@ -4975,21 +5223,22 @@ mapfile [-d @var{delim}] [-n @var{count}] [-O @var{origin}] [-s @var{count}] [-t] [-u @var{fd}] [-C @var{callback}] [-c @var{quantum}] [@var{array}] @end example -Read lines from the standard input into the indexed array variable @var{array}, -or from file descriptor @var{fd} -if the @option{-u} option is supplied. +Read lines from the standard input, +or from file descriptor @var{fd} if the @option{-u} option is supplied, +into the indexed array variable @var{array}. The variable @code{MAPFILE} is the default @var{array}. Options, if supplied, have the following meanings: @table @code @item -d -The first character of @var{delim} is used to terminate each input line, +Use the first character of @var{delim} to terminate each input line, rather than newline. If @var{delim} is the empty string, @code{mapfile} will terminate a line when it reads a NUL character. @item -n -Copy at most @var{count} lines. If @var{count} is 0, all lines are copied. +Copy at most @var{count} lines. +If @var{count} is 0, copy all lines. @item -O Begin assigning to @var{array} at index @var{origin}. The default index is 0. @@ -5017,9 +5266,9 @@ array element is assigned. If not supplied with an explicit origin, @code{mapfile} will clear @var{array} before assigning to it. -@code{mapfile} returns successfully unless an invalid option or option -argument is supplied, @var{array} is invalid or unassignable, or @var{array} -is not an indexed array. +@code{mapfile} returns zero unless an invalid option or option +argument is supplied, @var{array} is invalid or unassignable, or if +@var{array} is not an indexed array. @item printf @btindex printf @@ -5029,8 +5278,8 @@ printf [-v @var{var}] @var{format} [@var{arguments}] Write the formatted @var{arguments} to the standard output under the control of the @var{format}. -The @option{-v} option causes the output to be assigned to the variable -@var{var} rather than being printed to the standard output. +The @option{-v} option assigns the output to the variable +@var{var} rather than printing it to the standard output. The @var{format} is a character string which contains three types of objects: plain characters, which are simply copied to standard output, character @@ -5064,9 +5313,10 @@ Causes @code{printf} to output the date-time string resulting from using @var{datefmt} as a format string for @code{strftime}(3). The corresponding @var{argument} is an integer representing the number of seconds since the epoch. -Two special argument values may be used: -1 represents the current -time, and -2 represents the time the shell was invoked. -If no argument is specified, conversion behaves as if -1 had been given. +This format specifier recognizes Two special argument values: +-1 represents the current time, +and -2 represents the time the shell was invoked. +If no argument is specified, conversion behaves as if -1 had been supplied. This is an exception to the usual @code{printf} behavior. @end table @@ -5109,12 +5359,11 @@ read [-Eers] [-a @var{aname}] [-d @var{delim}] [-i @var{text}] [-n @var{nchars}] [-N @var{nchars}] [-p @var{prompt}] [-t @var{timeout}] [-u @var{fd}] [@var{name} @dots{}] @end example -One line is read from the standard input, or from the file descriptor +Read one line from the standard input, or from the file descriptor @var{fd} supplied as an argument to the @option{-u} option, -split into words as described above in @ref{Word Splitting}, -and the first word -is assigned to the first @var{name}, the second word to the second @var{name}, -and so on. +split it into words as described above in @ref{Word Splitting}, +and assign the first word to the first @var{name}, +the second word to the second @var{name}, and so on. If there are more words than names, the remaining words and their intervening delimiters are assigned to the last @var{name}. @@ -5123,59 +5372,66 @@ the remaining names are assigned empty values. The characters in the value of the @env{IFS} variable are used to split the line into words using the same rules the shell uses for expansion (described above in @ref{Word Splitting}). -The backslash character @samp{\} may be used to remove any special -meaning for the next character read and for line continuation. +The backslash character @samp{\} removes any special +meaning for the next character read and is used for line continuation. Options, if supplied, have the following meanings: @table @code @item -a @var{aname} The words are assigned to sequential indices of the array variable -@var{aname}, starting at 0. +@var{aname}, +starting at 0. All elements are removed from @var{aname} before the assignment. Other @var{name} arguments are ignored. @item -d @var{delim} -The first character of @var{delim} is used to terminate the input line, +The first character of @var{delim} terminates the input line, rather than newline. If @var{delim} is the empty string, @code{read} will terminate a line when it reads a NUL character. @item -e -Readline (@pxref{Command Line Editing}) is used to obtain the line. +If the standard input is coming from a terminal, +@code{read} uses +Readline (@pxref{Command Line Editing}) +to obtain the line. Readline uses the current (or default, if line editing was not previously active) editing settings, but uses Readline's default filename completion. @item -E -Readline (@pxref{Command Line Editing}) is used to obtain the line. +If the standard input is coming from a terminal, +@code{read} uses +Readline (@pxref{Command Line Editing}) to obtain the line. Readline uses the current (or default, if line editing was not previously active) editing settings, but uses Bash's default completion, including programmable completion. @item -i @var{text} -If Readline is being used to read the line, @var{text} is placed into +If Readline is being used to read the line, @code{read} places @var{text} into the editing buffer before editing begins. @item -n @var{nchars} @code{read} returns after reading @var{nchars} characters rather than -waiting for a complete line of input, but honors a delimiter if fewer -than @var{nchars} characters are read before the delimiter. +waiting for a complete line of input, +unless it encounters EOF or @code{read} times out, +but honors a delimiter if it reads fewer +than @var{nchars} characters before the delimiter. @item -N @var{nchars} @code{read} returns after reading exactly @var{nchars} characters rather -than waiting for a complete line of input, unless EOF is encountered or -@code{read} times out. -Delimiter characters encountered in the input are +than waiting for a complete line of input, +unless it encounters EOF or @code{read} times out. +Delimiter characters in the input are not treated specially and do not cause @code{read} to return until -@var{nchars} characters are read. +it has read @var{nchars} characters. The result is not split on the characters in @code{IFS}; the intent is that the variable is assigned exactly the characters read (with the exception of backslash; see the @option{-r} option below). @item -p @var{prompt} Display @var{prompt}, without a trailing newline, before attempting -to read any input. -The prompt is displayed only if input is coming from a terminal. +to read any input, but only if input is coming from a terminal. @item -r If this option is given, backslash does not act as an escape character. @@ -5184,38 +5440,36 @@ In particular, a backslash-newline pair may not then be used as a line continuation. @item -s -Silent mode. If input is coming from a terminal, characters are -not echoed. +Silent mode. +If input is coming from a terminal, characters are not echoed. @item -t @var{timeout} -Cause @code{read} to time out and return failure if a complete line of -input (or a specified number of characters) -is not read within @var{timeout} seconds. +Cause @code{read} to time out and return failure if it does not read +a complete line of input (or a specified number of characters) +within @var{timeout} seconds. @var{timeout} may be a decimal number with a fractional portion following the decimal point. This option is only effective if @code{read} is reading input from a terminal, pipe, or other special file; it has no effect when reading from regular files. -If @code{read} times out, @code{read} saves any partial input read into -the specified variable @var{name}. +If @code{read} times out, it saves any partial input read into +the specified variable @var{name}, and returns a status greater than 128. If @var{timeout} is 0, @code{read} returns immediately, without trying to read any data. -The exit status is 0 if input is available on the specified file descriptor, -or the read will return EOF, -non-zero otherwise. -The exit status is greater than 128 if the timeout is exceeded. +In this case, the exit status is 0 if input is available on the specified +file descriptor, or the read will return EOF, non-zero otherwise. @item -u @var{fd} -Read input from file descriptor @var{fd}. +Read input from file descriptor @var{fd} instead of the standard input. @end table Other than the case where @var{delim} is the empty string, @code{read} ignores any NUL characters in the input. -If no @var{name}s are supplied, the line read, +If no @var{name}s are supplied, @code{read} assigns the line read, without the ending delimiter but otherwise unmodified, -is assigned to the -variable @env{REPLY}. +to the variable @env{REPLY}. + The exit status is zero, unless end-of-file is encountered, @code{read} times out (in which case the status is greater than 128), a variable assignment error (such as assigning to a readonly variable) occurs, @@ -5248,19 +5502,20 @@ A synonym for @code{.} (@pxref{Bourne Shell Builtins}). type [-afptP] [@var{name} @dots{}] @end example -For each @var{name}, indicate how it would be interpreted if used as a -command name. +Indicate how each @var{name} would be interpreted if used as a command +name. If the @option{-t} option is used, @code{type} prints a single word which is one of @samp{alias}, @samp{keyword}, @samp{function}, @samp{builtin}, or @samp{file}, if @var{name} is an alias, shell reserved word, shell function, -shell builtin, or executable disk file, respectively. -If the @var{name} is not found, then nothing is printed, and -@code{type} returns a failure status. +shell builtin, or executable file, respectively. +If the @var{name} is not found, @code{type} prints nothing and +returns a failure status. If the @option{-p} option is used, @code{type} either returns the name -of the executable file that would be found by searching @code{$PATH}, +of the executable file that would be found by searching @code{$PATH} +for @code{name}, or nothing if @option{-t} would not return @samp{file}. The @option{-P} option forces a path search for each @var{name}, even if @@ -5302,9 +5557,9 @@ ulimit [-HS] -a ulimit [-HS] [-bcdefiklmnpqrstuvxPRT] [@var{limit}] @end example -@code{ulimit} provides control over the resources available to processes -started by the shell, on systems that allow such control. If an -option is given, it is interpreted as follows: +@code{ulimit} provides control over the resources available to the +shell and to processes it starts, on systems that allow such control. +If an option is given, it is interpreted as follows: @table @code @item -S @@ -5314,7 +5569,7 @@ Change and report the soft limit associated with a resource. Change and report the hard limit associated with a resource. @item -a -All current limits are reported; no limits are set. +Report all current limits; no limits are set. @item -b The maximum socket buffer size. @@ -5382,22 +5637,23 @@ The maximum time a real-time process can run before blocking, in microseconds. The maximum number of threads. @end table -If @var{limit} is given, and the @option{-a} option is not used, +If @var{limit} is supplied, and the @option{-a} option is not used, @var{limit} is the new value of the specified resource. The special @var{limit} values @code{hard}, @code{soft}, and @code{unlimited} stand for the current hard limit, the current soft limit, and no limit, respectively. A hard limit cannot be increased by a non-root user once it is set; a soft limit may be increased up to the value of the hard limit. -Otherwise, the current value of the soft limit for the specified resource -is printed, unless the @option{-H} option is supplied. +Otherwise, @code{ulimit} prints the current value of the soft limit +for the specified resource, unless the @option{-H} option is supplied. When more than one resource is specified, the limit name and unit, if appropriate, are printed before the value. When setting new limits, if neither @option{-H} nor @option{-S} is supplied, -both the hard and soft limits are set. -If no option is given, then @option{-f} is assumed. Values are in 1024-byte -increments, except for +@code{ulimit} sets both the hard and soft limits. +If no option is supplied, then @option{-f} is assumed. + +Values are in 1024-byte increments, except for @option{-t}, which is in seconds; @option{-R}, which is in microseconds; @option{-p}, which is in units of 512-byte blocks; @@ -5418,8 +5674,9 @@ or an error occurs while setting a new limit. unalias [-a] [@var{name} @dots{} ] @end example -Remove each @var{name} from the list of aliases. If @option{-a} is -supplied, all aliases are removed. +Remove each @var{name} from the list of aliases. +If @option{-a} is supplied, remove all aliases. +The return value is true unless a supplied @var{name} is not a defined alias. Aliases are described in @ref{Aliases}. @end table @@ -5457,6 +5714,9 @@ Read-only variables cannot be reset. In @sc{posix} mode, only shell variables are listed. When options are supplied, they set or unset shell attributes. +Any arguments remaining after option processing replace the +positional parameters. + Options, if specified, have the following meanings: @table @code @@ -5467,7 +5727,9 @@ subsequent commands. @item -b Cause the status of terminated background jobs to be reported -immediately, rather than before printing the next primary prompt. +immediately, rather than before printing the next primary prompt +or, under some circumstances, when a foreground command exits. +This is effective only when job control is enabled. @item -e Exit immediately if @@ -5663,7 +5925,7 @@ Print shell input lines as they are read. @item -x Print a trace of simple commands, @code{for} commands, @code{case} commands, @code{select} commands, and arithmetic @code{for} commands -and their arguments or associated word lists to standard error +and their arguments or associated word lists to the standard error after they are expanded and before they are executed. The shell prints the expanded value of the @env{PS4} variable before the command and its expanded arguments. @@ -5675,6 +5937,8 @@ This option is on by default. @item -C Prevent output redirection using @samp{>}, @samp{>&}, and @samp{<>} from overwriting existing files. +Using the redirection operator @samp{>|} instead of @samp{>} +will override this and force the creation of an output file. @item -E If set, any trap on @code{ERR} is inherited by shell functions, command @@ -5686,9 +5950,10 @@ Enable @samp{!} style history substitution (@pxref{History Interaction}). This option is on by default for interactive shells. @item -P -If set, do not resolve symbolic links when performing commands such as -@code{cd} which change the current directory. The physical directory -is used instead. By default, Bash follows +If set, Bash does not resolve symbolic links when executing commands +such as @code{cd} which change the current directory. +It uses the physical directory structure instead. +By default, Bash follows the logical chain of directories when performing commands which change the current directory. @@ -5711,27 +5976,28 @@ $ cd ..; pwd @end example @item -T -If set, any trap on @code{DEBUG} and @code{RETURN} are inherited by +If set, any traps on @code{DEBUG} and @code{RETURN} are inherited by shell functions, command substitutions, and commands executed in a subshell environment. The @code{DEBUG} and @code{RETURN} traps are normally not inherited in such cases. @item -- -If no arguments follow this option, then the positional parameters are -unset. Otherwise, the positional parameters are set to the +If no arguments follow this option, unset the positional parameters. +Otherwise, the positional parameters are set to the @var{arguments}, even if some of them begin with a @samp{-}. @item - -Signal the end of options, cause all remaining @var{arguments} -to be assigned to the positional parameters. The @option{-x} -and @option{-v} options are turned off. +Signal the end of options, and assign all remaining @var{arguments} +to the positional parameters. +The @option{-x} and @option{-v} options are turned off. If there are no arguments, the positional parameters remain unchanged. @end table Using @samp{+} rather than @samp{-} causes these options to be -turned off. The options can also be used upon invocation of the -shell. The current set of options may be found in @code{$-}. +turned off. +The options can also be used upon invocation of the shell. +The current set of options may be found in @code{$-}. The remaining N @var{arguments} are positional parameters and are assigned, in order, to @code{$1}, @code{$2}, @dots{} @code{$N}. @@ -5743,7 +6009,7 @@ The return status is always zero unless an invalid option is supplied. @node The Shopt Builtin @subsection The Shopt Builtin -This builtin allows you to change additional shell optional behavior. +This builtin allows you to change additional optional shell behavior. @table @code @@ -5757,10 +6023,10 @@ Toggle the values of settings controlling optional shell behavior. The settings can be either those listed below, or, if the @option{-o} option is used, those available with the @option{-o} option to the @code{set} builtin command (@pxref{The Set Builtin}). -With no options, or with the @option{-p} option, a list of all settable -options is displayed, with an indication of whether or not each is set; -if @var{optname}s are supplied, the output is restricted to those options. -The @option{-p} option causes output to be displayed in a form that +With no options, or with the @option{-p} option, display a list of all +settable options, with an indication of whether or not each is set; +if any @var{optname}s are supplied, the output is restricted to those options. +The @option{-p} option displays output in a form that may be reused as input. Other options have the following meanings: @@ -5774,7 +6040,7 @@ Disable (unset) each @var{optname}. @item -q Suppresses normal output; the return status indicates whether the @var{optname} is set or unset. -If multiple @var{optname} arguments are given with @option{-q}, +If multiple @var{optname} arguments are supplied with @option{-q}, the return status is zero if all @var{optname}s are enabled; non-zero otherwise. @@ -5824,23 +6090,25 @@ is not a directory is assumed to be the name of a variable whose value is the directory to change to. @item cdspell -If set, minor errors in the spelling of a directory component in a -@code{cd} command will be corrected. -The errors checked for are transposed characters, -a missing character, and a character too many. -If a correction is found, the corrected path is printed, +If set, the @code{cd} command +attempts to correct +minor errors in the spelling of a directory component. +Minor errors include transposed characters, +a missing character, and one extra character. +If @code{cd} corrects the directory name, it prints the corrected filename, and the command proceeds. This option is only used by interactive shells. @item checkhash If this is set, Bash checks that a command found in the hash -table exists before trying to execute it. If a hashed command no -longer exists, a normal path search is performed. +table exists before trying to execute it. +If a hashed command no longer exists, Bash performs a normal path search. @item checkjobs If set, Bash lists the status of any stopped and running jobs before -exiting an interactive shell. If any jobs are running, this causes -the exit to be deferred until a second exit is attempted without an +exiting an interactive shell. +If any jobs are running, Bash defers +the exit until a second exit is attempted without an intervening command (@pxref{Job Control}). The shell always postpones exiting if any jobs are stopped. @@ -5854,8 +6122,8 @@ This option is enabled by default. @item cmdhist If set, Bash attempts to save all lines of a multiple-line -command in the same history entry. This allows -easy re-editing of multi-line commands. +command in the same history entry. +This allows easy re-editing of multi-line commands. This option is enabled by default, but only has an effect if command history is enabled (@pxref{Bash History Facilities}). @@ -5889,8 +6157,8 @@ versions through 4.2. @item direxpand If set, Bash replaces directory names with the results of word expansion when performing -filename completion. This changes the contents of the Readline editing -buffer. +filename completion. +This changes the contents of the Readline editing buffer. If not set, Bash attempts to preserve what the user typed. @item dirspell @@ -5899,7 +6167,7 @@ attempts spelling correction on directory names during word completion if the directory name initially supplied does not exist. @item dotglob -If set, Bash includes filenames beginning with a `.' in +If set, Bash includes filenames beginning with a @samp{.} in the results of filename expansion. The filenames @samp{.} and @samp{..} must always be matched explicitly, even if @code{dotglob} is set. @@ -5907,8 +6175,8 @@ even if @code{dotglob} is set. @item execfail If this is set, a non-interactive shell will not exit if it cannot execute the file specified as an argument to the @code{exec} -builtin command. An interactive shell does not exit if @code{exec} -fails. +builtin. +An interactive shell does not exit if @code{exec} fails. @item expand_aliases If set, aliases are expanded as described below under Aliases, @@ -5916,8 +6184,7 @@ If set, aliases are expanded as described below under Aliases, This option is enabled by default for interactive shells. @item extdebug -If set at shell invocation, -or in a shell startup file, +If set at shell invocation, or in a shell startup file, arrange to execute the debugger profile before the shell starts, identical to the @option{--debugger} option. If set after invocation, behavior intended for use by debuggers is enabled: @@ -5954,13 +6221,14 @@ subshells invoked with @code{( @var{command} )} inherit the @end enumerate @item extglob -If set, the extended pattern matching features described above -(@pxref{Pattern Matching}) are enabled. +If set, enable the extended pattern matching features described above +(@pxref{Pattern Matching}). @item extquote If set, @code{$'@var{string}'} and @code{$"@var{string}"} quoting is performed within @code{$@{@var{parameter}@}} expansions -enclosed in double quotes. This option is enabled by default. +enclosed in double quotes. +This option is enabled by default. @item failglob If set, patterns which fail to match filenames during filename expansion @@ -5977,15 +6245,15 @@ This option is enabled by default. If set, range expressions used in pattern matching bracket expressions (@pxref{Pattern Matching}) behave as if in the traditional C locale when performing -comparisons. That is, the current locale's collating sequence -is not taken into account, so -@samp{b} will not collate between @samp{A} and @samp{B}, +comparisons. +That is, pattern matching does not take +the current locale's collating sequence into account, +so @samp{b} will not collate between @samp{A} and @samp{B}, and upper-case and lower-case ASCII characters will collate together. @item globskipdots If set, filename expansion will never match the filenames -@samp{.} and @samp{..}, -even if the pattern begins with a @samp{.}. +@samp{.} and @samp{..}, even if the pattern begins with a @samp{.}. This option is enabled by default. @item globstar @@ -6004,21 +6272,21 @@ of the @env{HISTFILE} variable when the shell exits, rather than overwriting the file. @item histreedit -If set, and Readline -is being used, a user is given the opportunity to re-edit a -failed history substitution. +If set, and Readline is being used, +the user is given the opportunity to re-edit a failed history substitution. @item histverify If set, and Readline is being used, the results of history substitution are not immediately -passed to the shell parser. Instead, the resulting line is loaded into -the Readline editing buffer, allowing further modification. +passed to the shell parser. +Instead, the resulting line is loaded into the Readline editing buffer, +allowing further modification. @item hostcomplete If set, and Readline is being used, Bash will attempt to perform hostname completion when a word containing a @samp{@@} is being -completed (@pxref{Commands For Completion}). This option is enabled -by default. +completed (@pxref{Commands For Completion}). +This option is enabled by default. @item huponexit If set, Bash will send @code{SIGHUP} to all jobs when an interactive @@ -6030,9 +6298,9 @@ instead of unsetting it in the subshell environment. This option is enabled when @sc{posix} mode is enabled. @item interactive_comments -Allow a word beginning with @samp{#} -to cause that word and all remaining characters on that -line to be ignored in an interactive shell. +In an interactive shell, a word beginning with @samp{#} +causes that word and all remaining characters on that +line to be ignored, as in a non-interactive shell. This option is enabled by default. @item lastpipe @@ -6052,8 +6320,9 @@ assigned. The @code{nameref} attribute is not inherited. @item localvar_unset If set, calling @code{unset} on local variables in previous function scopes marks them so subsequent lookups find them unset until that function -returns. This is identical to the behavior of unsetting local variables -at the current function scope. +returns. +This is identical to the behavior of unsetting local variables at the +current function scope. @item login_shell The shell sets this option if it is started as a login shell @@ -6062,13 +6331,13 @@ The value may not be changed. @item mailwarn If set, and a file that Bash is checking for mail has been -accessed since the last time it was checked, the message -@code{"The mail in @var{mailfile} has been read"} is displayed. +accessed since the last time it was checked, Bash displays the message +@code{"The mail in @var{mailfile} has been read"}. @item no_empty_cmd_completion -If set, and Readline is being used, Bash will not attempt to search -the @env{PATH} for possible completions when completion is attempted -on an empty line. +If set, and Readline is being used, Bash does not search +the @env{PATH} +for possible completions when completion is attempted on an empty line. @item nocaseglob If set, Bash matches filenames in a case-insensitive fashion when @@ -6090,8 +6359,7 @@ If the string is not translated, this has no effect. @item nullglob If set, filename expansion patterns which match no files (@pxref{Filename Expansion}) -expand to nothing and are removed, -rather than expanding to themselves. +expand to nothing and are removed, rather than expanding to themselves. @item patsub_replacement If set, Bash @@ -6101,14 +6369,15 @@ above (@pxref{Shell Parameter Expansion}). This option is enabled by default. @item progcomp -If set, the programmable completion facilities -(@pxref{Programmable Completion}) are enabled. +If set, enable the programmable completion facilities +(@pxref{Programmable Completion}). This option is enabled by default. @item progcomp_alias If set, and programmable completion is enabled, Bash treats a command name that doesn't have any completions as a possible alias and attempts -alias expansion. If it has an alias, Bash attempts programmable +alias expansion. +If it has an alias, Bash attempts programmable completion using the command word resulting from the expanded alias. @item promptvars @@ -6145,8 +6414,7 @@ leaving them open when the command completes. If set, the @code{echo} builtin expands backslash-escape sequences by default. If the @code{posix} shell option (@pxref{The Set Builtin}) is also enabled, -@code{echo} does not -interpret any options. +@code{echo} does not interpret any options. @end table @end table @@ -6214,10 +6482,12 @@ The value of this variable is also used by tilde expansion @item IFS A list of characters that separate fields; used when the shell splits -words as part of expansion. +words as part of expansion and by the @code{read} builtin to split +lines into words. +@xref{Word Splitting}, for a description of word splitting. @item MAIL -If this parameter is set to a filename or directory name +If the value is set to a filename or directory name and the @env{MAILPATH} variable is not set, Bash informs the user of the arrival of mail in the specified file or Maildir-format directory. @@ -6235,7 +6505,7 @@ the current mail file. The value of the last option argument processed by the @code{getopts} builtin. @item OPTIND -The index of the last option argument processed by the @code{getopts} builtin. +The index of the next argument to be processed by the @code{getopts} builtin. @item PATH A colon-separated list of directories in which the shell looks for @@ -6244,14 +6514,20 @@ A zero-length (null) directory name in the value of @code{PATH} 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 set by the administrator +who installs @code{bash}. +A common value is +"/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin". @item PS1 -The primary prompt string. The default value is @samp{\s-\v\$ }. +The primary prompt string. +The default value is @samp{\s-\v\$ }. @xref{Controlling the Prompt}, for the complete list of escape sequences that are expanded before @env{PS1} is displayed. @item PS2 -The secondary prompt string. The default value is @samp{> }. +The secondary prompt string. +The default value is @samp{> }. @env{PS2} is expanded in the same way as @env{PS1} before being displayed. @@ -6272,30 +6548,32 @@ variables for controlling the job control facilities @item _ @vindex $_ ($_, an underscore.) -At shell startup, set to the pathname used to invoke the +This has a number of meanings depending on context. +At shell startup, $_ set to the pathname used to invoke the shell or shell script being executed as passed in the environment or argument list. -Subsequently, expands to the last argument to the previous simple +Subsequently, it expands to the last argument to the previous simple command executed in the foreground, after expansion. -Also set to the full pathname used to invoke each command executed +It is also set to the full pathname used to invoke each command executed and placed in the environment exported to that command. -When checking mail, this parameter holds the name of the mail file. +When checking mail, $_ expands to the name of the mail file. @item BASH The full pathname used to execute the current instance of Bash. @item BASHOPTS -A colon-separated list of enabled shell options. Each word in -the list is a valid argument for the @option{-s} option to the -@code{shopt} builtin command (@pxref{The Shopt Builtin}). +A colon-separated list of enabled shell options. +Each word in the list is a valid argument for the @option{-s} option +to the @code{shopt} builtin command (@pxref{The Shopt Builtin}). The options appearing in @env{BASHOPTS} are those reported as @samp{on} by @samp{shopt}. If this variable is in the environment when Bash -starts up, each shell option in the list will be enabled before -reading any startup files. This variable is readonly. +starts up, the shell enables each option in the list before +reading any startup files. +This variable is readonly. @item BASHPID -Expands to the process ID of the current Bash process. +Expands to the process @sc{id} of the current Bash process. This differs from @code{$$} under certain circumstances, such as subshells that do not require Bash to be re-initialized. Assignments to @env{BASHPID} have no effect. @@ -6316,26 +6594,28 @@ subsequently reset. @item BASH_ARGC An array variable whose values are the number of parameters in each -frame of the current Bash execution call stack. The number of -parameters to the current subroutine (shell function or script executed -with @code{.} or @code{source}) is at the top of the stack. When a +frame of the current Bash execution call stack. +The number of parameters to the current subroutine (shell function or +script executed with @code{.} or @code{source}) is at the top of the stack. +When a subroutine is executed, the number of parameters passed is pushed onto @code{BASH_ARGC}. The shell sets @code{BASH_ARGC} only when in extended debugging mode (see @ref{The Shopt Builtin} for a description of the @code{extdebug} option to the @code{shopt} builtin). -Setting @code{extdebug} after the shell has started to execute a script, +Setting @code{extdebug} after the shell has started to execute a subroutine, or referencing this variable when @code{extdebug} is not set, may result in inconsistent values. Assignments to @env{BASH_ARGC} have no effect, and it may not be unset. @item BASH_ARGV An array variable containing all of the parameters in the current Bash -execution call stack. The final parameter of the last subroutine call -is at the top of the stack; the first parameter of the initial call is -at the bottom. When a subroutine is executed, the parameters supplied -are pushed onto @code{BASH_ARGV}. +execution call stack. +The final parameter of the last subroutine call is at the top of the stack; +the first parameter of the initial call is at the bottom. +When a subroutine is executed, the shell pushes the supplied parameters +onto @code{BASH_ARGV}. The shell sets @code{BASH_ARGV} only when in extended debugging mode (see @ref{The Shopt Builtin} for a description of the @code{extdebug} option to the @code{shopt} @@ -6349,8 +6629,8 @@ Assignments to @env{BASH_ARGV} have no effect, and it may not be unset. When referenced, this variable expands to the name of the shell or shell script (identical to @code{$0}; @xref{Special Parameters}, for the description of special parameter 0). -Assignment to @code{BASH_ARGV0} -causes the value assigned to also be assigned to @code{$0}. +Assigning a value to @code{BASH_ARGV0} +assigns the same value to @code{$0}. If @env{BASH_ARGV0} is unset, it loses its special properties, even if it is subsequently reset. @@ -6359,16 +6639,16 @@ subsequently reset. An associative array variable whose members correspond to the internal hash table of commands as maintained by the @code{hash} builtin (@pxref{Bourne Shell Builtins}). -Elements added to this array appear in the hash table; however, -unsetting array elements currently does not cause command names to be removed +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 @env{BASH_CMDS} is unset, it loses its special properties, even if it is subsequently reset. @item BASH_COMMAND -The command currently being executed or about to be executed, unless the -shell is executing a command as the result of a trap, +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 @env{BASH_COMMAND} is unset, it loses its special properties, even if it is @@ -6395,7 +6675,9 @@ The current version is also a valid value. @item BASH_ENV If this variable is set when Bash is invoked to execute a shell script, its value is expanded and used as the name of a startup file -to read before executing the script. @xref{Bash Startup Files}. +to read before executing the script. +Bash does not use @env{PATH} to search for the resultant filename. +@xref{Bash Startup Files}. @item BASH_EXECUTION_STRING The command argument to the @option{-c} invocation option. @@ -6411,9 +6693,8 @@ Use @code{LINENO} to obtain the current line number. Assignments to @env{BASH_LINENO} have no effect, and it may not be unset. @item BASH_LOADABLES_PATH -A colon-separated list of directories in which the shell looks for -dynamically loadable builtins specified by the -@code{enable} command. +A colon-separated list of directories in which the @code{enable} +command looks for dynamically loadable builtins. @item BASH_MONOSECONDS Each time this variable is referenced, it expands to the value returned @@ -6482,7 +6763,8 @@ The value of @env{MACHTYPE}. @end table @item BASH_VERSION -The version number of the current instance of Bash. +Expands to a string describing the version of this instance of +Bash (e.g., 5.2.37(3)-release). @item BASH_XTRACEFD If set to an integer corresponding to a valid file descriptor, Bash @@ -6518,6 +6800,13 @@ cursor position. This variable is available only in shell functions invoked by the programmable completion facilities (@pxref{Programmable Completion}). +@item COMP_KEY +The key (or final key of a key sequence) used to invoke the current +completion function. +This variable is available only in shell functions and external +commands invoked by the +programmable completion facilities (@pxref{Programmable Completion}). + @item COMP_LINE The current command line. This variable is available only in shell functions and external @@ -6534,7 +6823,7 @@ commands invoked by the programmable completion facilities (@pxref{Programmable Completion}). @item COMP_TYPE -Set to an integer value corresponding to the type of completion attempted +Set to an integer value corresponding to the type of attempted completion that caused a completion function to be called: @key{TAB}, for normal completion, @samp{?}, for listing completions after successive tabs, @@ -6546,10 +6835,6 @@ This variable is available only in shell functions and external commands invoked by the programmable completion facilities (@pxref{Programmable Completion}). -@item COMP_KEY -The key (or final key of a key sequence) used to invoke the current -completion function. - @item COMP_WORDBREAKS The set of characters that the Readline library treats as word separators when performing word completion. @@ -6589,8 +6874,8 @@ it is subsequently reset. @item EMACS If Bash finds this variable in the environment when the shell -starts with value @samp{t}, it assumes that the shell is running in an -Emacs shell buffer and disables line editing. +starts, and its value is @samp{t}, Bash assumes that the shell is +running in an Emacs shell buffer and disables line editing. @item ENV Expanded and executed similarly to @code{BASH_ENV} @@ -6618,12 +6903,12 @@ is unset, it loses its special properties, even if it is subsequently reset. @item EUID -The numeric effective user id of the current user. This variable -is readonly. +The numeric effective user id of the current user. +This variable is readonly. @item EXECIGNORE A colon-separated list of shell patterns (@pxref{Pattern Matching}) -defining the list of filenames to be ignored by command search using +defining the set of filenames to be ignored by command search using @code{PATH}. Files whose full pathnames match one of these patterns are not considered executable files for the purposes of completion and command execution @@ -6637,8 +6922,7 @@ The pattern matching honors the setting of the @code{extglob} shell option. @item FCEDIT -The editor used as a default by the @option{-e} option to the @code{fc} -builtin command. +The editor used as a default by the @code{fc} builtin command. @item FIGNORE A colon-separated list of suffixes to ignore when performing @@ -6670,8 +6954,8 @@ The @code{caller} builtin displays the current call stack using this information. @item FUNCNEST -If set to a numeric value greater than 0, defines a maximum function -nesting level. Function invocations that exceed this nesting level +A numeric value greater than 0 defines a maximum function nesting level. +Function invocations that exceed this nesting level will cause the current command to abort. @item GLOBIGNORE @@ -6684,7 +6968,7 @@ The pattern matching honors the setting of the @code{extglob} shell option. @item GLOBSORT -Control how the results of filename expansion are sorted. +Controls how the results of filename expansion are sorted. The value of this variable specifies the sort criteria and sort order for the results of filename expansion. If this variable is unset or set to the null string, filename expansion @@ -6701,7 +6985,8 @@ The valid sort specifiers are @samp{ctime}, and @samp{blocks}, -which sort the files on name, names in numeric rather than lexicographic order, +which sort the files on name, +names in numeric rather than lexicographic order, file size, modification time, access time, inode change time, and number of blocks, respectively. If any of the non-name keys compare as equal (e.g., if two files are @@ -6766,7 +7051,7 @@ the history list. If the list of values includes @samp{ignorespace}, lines which begin with a space character are not saved in the history list. A value of @samp{ignoredups} causes lines which match the previous -history entry to not be saved. +history entry not to be saved. A value of @samp{ignoreboth} is shorthand for @samp{ignorespace} and @samp{ignoredups}. A value of @samp{erasedups} causes all previous lines matching the @@ -6778,13 +7063,15 @@ all lines read by the shell parser are saved on the history list, subject to the value of @env{HISTIGNORE}. The second and subsequent lines of a multi-line compound command are not tested, and are added to the history regardless of the value of -@env{HISTCONTROL}. +@env{HISTCONTROL} if the first line of the command was saved. +If the first line was not saved, the second and subsequent lines of +the command are not saved, either. @item HISTFILE The name of the file to which the command history is saved. Bash assigns a default value of @file{~/.bash_history}. If @env{HISTFILE} is unset or null, -the command history is not saved when a shell exits. +the shell does not save the command history when it exits. @item HISTFILESIZE The maximum number of lines contained in the history file. @@ -6792,7 +7079,7 @@ When this variable is assigned a value, the history file is truncated, 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. +writing it when a shell exits or by the @code{history} 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 @env{HISTSIZE} @@ -6808,18 +7095,21 @@ anchored at the beginning of the line and must match the complete line (Bash will not implicitly append a @samp{*}). Each pattern is tested against the line after the checks specified by @env{HISTCONTROL} -are applied. In addition to the normal shell pattern matching -characters, @samp{&} matches the previous history line. @samp{&} -may be escaped using a backslash; the backslash is removed +are applied. +In addition to the normal shell pattern matching characters, @samp{&} +matches the previous history line. +@samp{&} may be escaped using a backslash; the backslash is removed before attempting a match. The second and subsequent lines of a multi-line compound command are not tested, and are added to the history regardless of the value of -@env{HISTIGNORE}. +@env{HISTIGNORE}, if the first line was saved. +If the first line was not saved, the second and subsequent lines of +the command are not saved, either. The pattern matching honors the setting of the @code{extglob} shell option. -@env{HISTIGNORE} subsumes the function of @env{HISTCONTROL}. A -pattern of @samp{&} is identical to @code{ignoredups}, and a +@env{HISTIGNORE} subsumes some of the function of @env{HISTCONTROL}. +A pattern of @samp{&} is identical to @code{ignoredups}, and a pattern of @samp{[ ]*} is identical to @code{ignorespace}. Combining these two patterns, separating them with a colon, provides the functionality of @code{ignoreboth}. @@ -6835,7 +7125,7 @@ The shell sets the default value to 500 after reading any startup files. If this variable is set and not null, its value is used as a format string for @code{strftime}(3) to print the time stamp associated with each history entry displayed by the @code{history} builtin. -If this variable is set, time stamps are written to the history file so +If this variable is set, the shell writes time stamps to the history file so they may be preserved across shell sessions. This uses the history comment character to distinguish timestamps from other history lines. @@ -6861,13 +7151,15 @@ A string describing the machine Bash is running on. @item IGNOREEOF Controls the action of the shell on receipt of an @code{EOF} character -as the sole input. If set, the value denotes the number +as the sole input. +If set, the value is the number of consecutive @code{EOF} characters that can be read as the -first character on an input line -before the shell will exit. If the variable exists but does not -have a numeric value, or has no value, then the default is 10. -If the variable does not exist, then @code{EOF} signifies the end of -input to the shell. This is only in effect for interactive shells. +first character on an input line before Bash exits. +If the variable is set but does not have a numeric value, +or the value is null, then the default is 10. +If the variable is unset, then @code{EOF} signifies the end of +input to the shell. +This is only in effect for interactive shells. @item INPUTRC The name of the Readline initialization file, overriding the default @@ -6911,6 +7203,9 @@ formatting. @item LINENO The line number in the script or shell function currently executing. +Line numbers start with 1. +When not in a script or function, the value is not +guaranteed to be meaningful. If @env{LINENO} is unset, it loses its special properties, even if it is subsequently reset. @@ -6944,6 +7239,8 @@ The previous working directory as set by the @code{cd} builtin. @item OPTERR If set to the value 1, Bash displays error messages generated by the @code{getopts} builtin command. +@env{OPTERR} +is initialized to 1 each time the shell is invoked. @item OSTYPE A string describing the operating system Bash is running on. @@ -6970,8 +7267,8 @@ When the shell enters @sc{posix} mode, it sets this variable if it was not already set. @item PPID -The process @sc{id} of the shell's parent process. This variable -is readonly. +The process @sc{id} of the shell's parent process. +This variable is readonly. @item PROMPT_COMMAND If this variable is set, and is an array, @@ -7010,7 +7307,9 @@ The current working directory as set by the @code{cd} builtin. @item RANDOM Each time this parameter is referenced, it expands to a random integer between 0 and 32767. Assigning a value to this -variable seeds the random number generator. +variable initializes (seeds) the random number generator. +Seeding the random number generator with the same constant value will +produce the same sequence of values. If @env{RANDOM} is unset, it loses its special properties, even if it is subsequently reset. @@ -7036,7 +7335,9 @@ The position of the insertion point in the Readline line buffer, for use with @samp{bind -x} (@pxref{Bash Builtins}). @item REPLY -The default variable for the @code{read} builtin. +The default variable for the @code{read} builtin; +set to the line read when @code{read} is not supplied a variable name +argument. @item SECONDS This variable expands to the number of seconds since the shell was started. @@ -7055,22 +7356,24 @@ If it is not set when the shell starts, Bash assigns to it the full pathname of the current user's login shell. @item SHELLOPTS -A colon-separated list of enabled shell options. Each word in -the list is a valid argument for the @option{-o} option to the -@code{set} builtin command (@pxref{The Set Builtin}). +A colon-separated list of enabled shell options. +Each word in the list is a valid argument for the @option{-o} option +to the @code{set} builtin command (@pxref{The Set Builtin}). The options appearing in @env{SHELLOPTS} are those reported as @samp{on} by @samp{set -o}. If this variable is in the environment when Bash -starts up, each shell option in the list will be enabled before -reading any startup files. This variable is readonly. +starts up, the shell enables each option in the list before +reading any startup files. +This variable is readonly. @item SHLVL -Incremented by one each time a new instance of Bash is started. This is -intended to be a count of how deeply your Bash shells are nested. +Incremented by one each time a new instance of Bash is started. +This is intended to be a count of how deeply your Bash shells are nested. @item SRANDOM This variable expands to a 32-bit pseudo-random number each time it is -referenced. The random number generator is not linear on systems that +referenced. +The random number generator is not linear on systems that support @file{/dev/urandom} or @code{arc4random}, so each returned number has no relationship to the numbers preceding it. The random number generator cannot be seeded, so assignments to this @@ -7110,9 +7413,10 @@ The CPU percentage, computed as (%U + %S) / %R. The optional @var{p} is a digit specifying the precision, the number of fractional digits after a decimal point. A value of 0 causes no decimal point or fraction to be output. -At most six places after the decimal point may be specified; +@code{time} will print at most six digits after the decimal point; values of @var{p} greater than 6 are changed to 6. -If @var{p} is not specified, the value 3 is used. +If @var{p} is not specified, +@code{time} prints three digits after the decimal point. The optional @code{l} specifies a longer format, including minutes, of the form @var{MM}m@var{SS}.@var{FF}s. @@ -7126,8 +7430,9 @@ If the value is null, Bash does not display any timing information. A trailing newline is added when the format string is displayed. @item TMOUT -If set to a value greater than zero, @code{TMOUT} is treated as the -default timeout for the @code{read} builtin (@pxref{Bash Builtins}). +If set to a value greater than zero, the @code{read} builtin uses the +value as its +default timeout (@pxref{Bash Builtins}). The @code{select} command (@pxref{Conditional Constructs}) terminates if input does not arrive after @code{TMOUT} seconds when input is coming from a terminal. @@ -7135,9 +7440,8 @@ from a terminal. In an interactive shell, the value is interpreted as the number of seconds to wait for a line of input after issuing the primary prompt. -Bash -terminates after waiting for that number of seconds if a complete -line of input does not arrive. +Bash terminates after waiting for that number of seconds if a +complete line of input does not arrive. @item TMPDIR If set, Bash uses its value as the name of a directory in which @@ -7187,19 +7491,20 @@ bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o @var{option}] All of the single-character options used with the @code{set} builtin (@pxref{The Set Builtin}) can be used as options when the shell is invoked. In addition, there are several multi-character -options that you can use. These options must appear on the command +options that you can use. +These options must appear on the command line before the single-character options to be recognized. @table @code @item --debugger -Arrange for the debugger profile to be executed before the shell -starts. Turns on extended debugging mode (see @ref{The Shopt Builtin} +Arrange for the debugger profile to be executed before the shell starts. +Turns on extended debugging mode (see @ref{The Shopt Builtin} for a description of the @code{extdebug} option to the @code{shopt} builtin). @item --dump-po-strings -A list of all double-quoted strings preceded by @samp{$} -is printed on the standard output +Print a list of all double-quoted strings preceded by @samp{$} +on the standard output in the @sc{gnu} @code{gettext} PO (portable object) file format. Equivalent to @option{-D} except for the output format. @@ -7229,22 +7534,23 @@ when Bash is invoked as a login shell. @item --norc Don't read the @file{~/.bashrc} initialization file in an -interactive shell. This is on by default if the shell is -invoked as @code{sh}. +interactive shell. +This is on by default if the shell is invoked as @code{sh}. @item --posix Change the behavior of Bash where the default operation differs -from the @sc{posix} standard to match the standard. This -is intended to make Bash behave as a strict superset of that -standard. @xref{Bash POSIX Mode}, for a description of the Bash -@sc{posix} mode. +from the @sc{posix} standard to match the standard. +This is intended to make Bash behave as a strict superset of that +standard. +@xref{Bash POSIX Mode}, for a description of the Bash @sc{posix} mode. @item --restricted Equivalent to @option{-r}. Make the shell a restricted shell (@pxref{The Restricted Shell}). @item --verbose -Equivalent to @option{-v}. Print shell input lines as they're read. +Equivalent to @option{-v}. +Print shell input lines as they're read. @item --version Show version information for this instance of @@ -7265,15 +7571,15 @@ The assignment to @code{$0} sets the name of the shell, which is used in warning and error messages. @item -i -Force the shell to run interactively. Interactive shells are -described in @ref{Interactive Shells}. +Force the shell to run interactively. +Interactive shells are described in @ref{Interactive Shells}. @item -l Make this shell act as if it had been directly invoked by login. When the shell is interactive, this is equivalent to starting a login shell with @samp{exec -l bash}. -When the shell is not interactive, the login shell startup files will -be executed. +When the shell is not interactive, it will read and execute the login +shell startup files. @samp{exec bash -l} or @samp{exec bash --login} will replace the current shell with a Bash login shell. @xref{Bash Startup Files}, for a description of the special behavior @@ -7284,14 +7590,14 @@ Make the shell a restricted shell (@pxref{The Restricted Shell}). @item -s If this option is present, or if no arguments remain after option -processing, then commands are read from the standard input. +processing, then Bash reads commands from the standard input. This option allows the positional parameters to be set when invoking an interactive shell or when reading input through a pipe. @item -D -A list of all double-quoted strings preceded by @samp{$} -is printed on the standard output. +Print a list of all double-quoted strings preceded by @samp{$} +on the standard output. These are the strings that are subject to language translation when the current locale is not @code{C} or @code{POSIX} (@pxref{Locale Translation}). @@ -7302,8 +7608,9 @@ This implies the @option{-n} option; no commands will be executed. @code{shopt} builtin (@pxref{The Shopt Builtin}). If @var{shopt_option} is present, @option{-O} sets the value of that option; @option{+O} unsets it. -If @var{shopt_option} is not supplied, the names and values of the shell -options accepted by @code{shopt} are printed on the standard output. +If @var{shopt_option} is not supplied, Bash +prints the names and values of the shell +options accepted by @code{shopt} on the standard output. If the invocation option is @option{+O}, the output is displayed in a format that may be reused as input. @@ -7325,11 +7632,11 @@ A @emph{login} shell is one whose first character of argument zero is @cindex interactive shell An @emph{interactive} shell is one started without non-option arguments, -unless @option{-s} is specified, -without specifying the @option{-c} option, and whose input and output are both +unless @option{-s} is specified, without specifying the @option{-c} option, +and whose input and output (using the standard error) are both connected to terminals (as determined by @code{isatty(3)}), or one -started with the @option{-i} option. @xref{Interactive Shells}, for more -information. +started with the @option{-i} option. +@xref{Interactive Shells}, for more information. If arguments remain after option processing, and neither the @option{-c} nor the @option{-s} @@ -7340,7 +7647,8 @@ is set to the name of the file, and the positional parameters are set to the remaining arguments. Bash reads and executes commands from this file, then exits. Bash's exit status is the exit status of the last command executed -in the script. If no commands are executed, the exit status is 0. +in the script. +If no commands are executed, the exit status is 0. @node Bash Startup Files @section Bash Startup Files @@ -7371,11 +7679,11 @@ the file @file{~/.bash_logout}, if it exists. @subsubheading Invoked as an interactive non-login shell -When an interactive shell that is not a login shell is started, Bash +When Bash runs as an interactive shell that is not a login shell, it reads and executes commands from @file{~/.bashrc}, if that file exists. This may be inhibited by using the @option{--norc} option. -The @option{--rcfile @var{file}} option will -cause Bash to +The @option{--rcfile @var{file}} option +causes Bash to use @var{file} instead of @file{~/.bashrc}. So, typically, your @file{~/.bash_profile} contains the line @@ -7390,13 +7698,13 @@ after (or before) any login-specific initializations. When Bash is started non-interactively, to run a shell script, for example, it looks for the variable @env{BASH_ENV} in the environment, expands its value if it appears there, and uses the expanded value as -the name of a file to read and execute. Bash behaves as if the -following command were executed: +the name of a file to read and execute. +Bash behaves as if the following command were executed: @example @code{if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi} @end example @noindent -but the value of the @env{PATH} variable is not used to search for the +but does not the value of the @env{PATH} variable to search for the filename. As noted above, if a non-interactive shell is invoked with the @@ -7414,12 +7722,14 @@ shell with the @option{--login} option, it first attempts to read and execute commands from @file{/etc/profile} and @file{~/.profile}, in that order. The @option{--noprofile} option may be used to inhibit this behavior. + When invoked as an interactive shell with the name @code{sh}, Bash looks for the variable @env{ENV}, expands its value if it is defined, and uses the expanded value as the name of a file to read and execute. Since a shell invoked as @code{sh} does not attempt to read and execute commands from any other startup files, the @option{--rcfile} option has no effect. + A non-interactive shell invoked with the name @code{sh} does not attempt to read any other startup files. @@ -7432,7 +7742,7 @@ When Bash is started in @sc{posix} mode, as with the @option{--posix} command line option, it follows the @sc{posix} standard for startup files. In this mode, interactive shells expand the @env{ENV} variable -and commands are read and executed from the file whose name is the +and read and execute commands from the file whose name is the expanded value. No other startup files are read. @@ -7440,7 +7750,7 @@ No other startup files are read. Bash attempts to determine when it is being run with its standard input connected to a network connection, as when executed by -the historical remote shell daemon, usually @code{rshd}, +the historical and rarely-seen remote shell daemon, usually @code{rshd}, or the secure shell daemon @code{sshd}. If Bash determines it is being run non-interactively in this fashion, @@ -7491,7 +7801,7 @@ An interactive shell generally reads from and writes to a user's terminal. The @option{-s} invocation option may be used to set the positional parameters -when an interactive shell is started. +when an interactive shell starts. @node Is this Shell Interactive? @subsection Is this Shell Interactive? @@ -7499,7 +7809,8 @@ when an interactive shell is started. To determine within a startup script whether or not Bash is running interactively, test the value of the @samp{-} special parameter. -It contains @code{i} when the shell is interactive. For example: +It contains @code{i} when the shell is interactive. +For example: @example case "$-" in @@ -7510,7 +7821,8 @@ esac Alternatively, startup scripts may examine the variable @env{PS1}; it is unset in non-interactive shells, and set in -interactive shells. Thus: +interactive shells. +Thus: @example if [ -z "$PS1" ]; then @@ -7528,12 +7840,17 @@ several ways. @enumerate @item -Startup files are read and executed as described in @ref{Bash Startup Files}. +Bash reads and executes startup files as described in @ref{Bash Startup Files}. + +@item +Job Control (@pxref{Job Control}) is enabled by default. +When job control is in effect, Bash ignores the keyboard-generated +job control signals @code{SIGTTIN}, @code{SIGTTOU}, and @code{SIGTSTP}. @item -Job Control (@pxref{Job Control}) is enabled by default. When job -control is in effect, Bash ignores the keyboard-generated job control -signals @code{SIGTTIN}, @code{SIGTTOU}, and @code{SIGTSTP}. +Bash executes the values of the set elements of the @env{PROMPT_COMMAND} +array variable as commands before printing the primary prompt, @env{$PS1} +(@pxref{Bash Variables}). @item Bash expands and displays @env{PS1} before reading the first line @@ -7545,12 +7862,7 @@ See @ref{Controlling the Prompt}, for a complete list of prompt string escape sequences. @item -Bash executes the values of the set elements of the @env{PROMPT_COMMAND} -array variable as commands before printing the primary prompt, @env{$PS1} -(@pxref{Bash Variables}). - -@item -Readline (@pxref{Command Line Editing}) is used to read commands from +Bash uses Readline (@pxref{Command Line Editing}) to read commands from the user's terminal. @item @@ -7559,11 +7871,11 @@ instead of exiting immediately when it receives an @code{EOF} on its standard input when reading a command (@pxref{The Set Builtin}). @item -Command history (@pxref{Bash History Facilities}) +Bash enables Command history (@pxref{Bash History Facilities}) and history expansion (@pxref{History Interaction}) -are enabled by default. -Bash will save the command history to the file named by @env{$HISTFILE} -when a shell with history enabled exits. +by default. +When a shell with history enabled exits, +Bash saves the command history to the file named by @env{$HISTFILE}. @item Alias expansion (@pxref{Aliases}) is performed by default. @@ -7582,8 +7894,8 @@ An interactive login shell sends a @code{SIGHUP} to all jobs on exit if the @code{huponexit} shell option has been enabled (@pxref{Signals}). @item -The @option{-n} invocation option is ignored, and @samp{set -n} has -no effect (@pxref{The Set Builtin}). +The @option{-n} option has no effect, whether at invocation or when +using @samp{set -n} (@pxref{The Set Builtin}). @item Bash will check for mail periodically, depending on the values of the @@ -7591,13 +7903,14 @@ Bash will check for mail periodically, depending on the values of the (@pxref{Bash Variables}). @item -Expansion errors due to references to unbound shell variables after -@samp{set -u} has been enabled will not cause the shell to exit -(@pxref{The Set Builtin}). +The shell will not exit on +expansion errors due to references to unbound shell variables after +@samp{set -u} has been enabled (@pxref{The Set Builtin}). @item -The shell will not exit on expansion errors caused by @var{var} being unset -or null in @code{$@{@var{var}:?@var{word}@}} expansions +The shell will not exit on +expansion errors caused by @var{var} being unset or null in +@code{$@{@var{var}:?@var{word}@}} expansions (@pxref{Shell Parameter Expansion}). @item @@ -7643,9 +7956,12 @@ of arguments; see the descriptions of those commands for any other command-specific actions. Expressions may be unary or binary, -and are formed from the following primaries. -Unary expressions are often used to examine the status of a file. -There are string operators and numeric comparison operators as well. +and are formed from the primaries listed below. +Unary expressions are often used to examine the status of a file +or shell variable. +Binary operators are used for string, numeric, and file attribute +comparisons. + Bash handles several filenames specially when they are used in expressions. If the operating system on which Bash is running provides these @@ -7720,7 +8036,8 @@ True if @var{file} exists and is owned by the effective group id. True if @var{file} exists and is a symbolic link. @item -N @var{file} -True if @var{file} exists and has been modified since it was last read. +True if @var{file} exists and has been modified since it was last +accessed. @item -O @var{file} True if @var{file} exists and is owned by the effective user id. @@ -7789,7 +8106,7 @@ is equal to, not equal to, less than, less than or equal to, greater than, or greater than or equal to @var{arg2}, respectively. @var{Arg1} and @var{arg2} may be positive or negative integers. -When used with the @code{[[} command, @var{Arg1} and @var{Arg2} +When used with the @code{[[} command, @var{arg1} and @var{arg2} are evaluated as arithmetic expressions (@pxref{Shell Arithmetic}). @end table @@ -7802,10 +8119,14 @@ are evaluated as arithmetic expressions (@pxref{Shell Arithmetic}). @cindex arithmetic evaluation The shell allows arithmetic expressions to be evaluated, as one of -the shell expansions or by using the @code{((} compound command, the -@code{let} builtin, or the @option{-i} option to the @code{declare} builtin. - -Evaluation is done in fixed-width integers with no check for overflow, +the shell expansions or by using the @code{((} compound command, +the @code{let} and @code{declare} builtins, +the arithmetic @code{for} command, +the @code{[[} conditional command, +or the @option{-i} option to the @code{declare} builtin. + +Evaluation is done in the largest fixed-width integers available, +with no check for overflow, though division by 0 is trapped and flagged as an error. The operators and their precedence, associativity, and values are the same as in the C language. @@ -7879,8 +8200,14 @@ Shell variables are allowed as operands; parameter expansion is performed before the expression is evaluated. Within an expression, shell variables may also be referenced by name without using the parameter expansion syntax. +This means you can use +.Q x , +where \fIx\fP is a shell variable name, in an arithmetic expression, +and the shell will evaluate its value as an expression and use the +result. A shell variable that is null or unset evaluates to 0 when referenced -by name without using the parameter expansion syntax. +by name in an expression. + The value of a variable is evaluated as an arithmetic expression when it is referenced, or when a variable which has been given the @code{integer} attribute using @samp{declare -i} is assigned a value. @@ -7904,9 +8231,9 @@ If @var{base} is less than or equal to 36, lowercase and uppercase letters may be used interchangeably to represent numbers between 10 and 35. -Operators are evaluated in order of precedence. Sub-expressions in -parentheses are evaluated first and may override the precedence -rules above. +Operators are evaluated in precedence order. +Sub-expressions in parentheses are evaluated first +and may override the precedence rules above. @node Aliases @section Aliases @@ -7920,7 +8247,8 @@ and unset using the @code{alias} and @code{unalias} builtin commands (@pxref{Shell Builtin Commands}). If the shell reads an unquoted word in the right position, it checks -the word to see if it matches an alias name. If it matches, the shell +the word to see if it matches an alias name. +If it matches, the shell replaces the word with the alias value, and reads that value as if it had been read instead of the word. The shell doesn't look at any characters following the word before @@ -7939,8 +8267,8 @@ for instance, and Bash does not try to recursively expand the replacement text. If the last character of the alias value is a -@code{blank}, then the next command word following the -alias is also checked for alias expansion. +@code{blank}, then the shell checks +the next command word following the alias for alias expansion. Aliases are created and listed with the @code{alias} command, and removed with the @code{unalias} command. @@ -7955,20 +8283,21 @@ unless the @code{expand_aliases} shell option is set using @code{shopt} (@pxref{The Shopt Builtin}). The rules concerning the definition and use of aliases are -somewhat confusing. Bash -always reads at least one complete line of input, +somewhat confusing. +Bash always reads at least one complete line of input, and all lines that make up a compound command, before executing any of the commands on that line or the compound command. -Aliases are expanded when a -command is read, not when it is executed. Therefore, an +Aliases are expanded when a command is read, not when it is executed. +Therefore, an alias definition appearing on the same line as another -command does not take effect until the next line of input is read. +command does not take effect until the shell reads the next line of input. The commands following the alias definition on that line are not affected by the new alias. This behavior is also an issue when functions are executed. Aliases are expanded when a function definition is read, not when the function is executed, because a function definition -is itself a command. As a consequence, aliases +is itself a command. +As a consequence, aliases defined in a function are not available until after that function is executed. To be safe, always put alias definitions on a separate line, and do not use @code{alias} @@ -7999,7 +8328,8 @@ using the syntax @noindent The @var{subscript} -is treated as an arithmetic expression that must evaluate to a number. +is treated as an arithmetic expression that must evaluate to a number +greater than or equal to zero. To explicitly declare an array, use @example declare -a @var{name} @@ -8020,10 +8350,10 @@ declare -A @var{name} Attributes may be specified for an array variable using the @code{declare} and -@code{readonly} builtins. Each attribute applies to all members of -an array. +@code{readonly} builtins. +Each attribute applies to all members of an array. -Arrays are assigned to using compound assignments of the form +Arrays are assigned using compound assignments of the form @example @var{name}=(@var{value1} @var{value2} @dots{} ) @end example @@ -8031,10 +8361,6 @@ Arrays are assigned to using compound assignments of the form where each @var{value} may be of the form @code{[@var{subscript}]=}@var{string}. Indexed array assignments do not require anything but @var{string}. -When assigning to indexed arrays, if -the optional subscript is 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. Each @var{value} in the list undergoes the shell expansions described above (@pxref{Shell Expansions}), @@ -8043,6 +8369,12 @@ including 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 subscript is 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 assignment may be either assignment statements, for which the subscript is required, or a list of words that is interpreted as a sequence of alternating keys @@ -8056,7 +8388,8 @@ 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 @code{declare} -builtin. Individual array elements may be assigned to using the +builtin. +Individual array elements may be assigned to using the @code{@var{name}[@var{subscript}]=@var{value}} syntax introduced above. When assigning to an indexed array, if @var{name} @@ -8068,11 +8401,12 @@ array, and an index of -1 references the last element. The @samp{+=} operator will append to an array variable when assigning using the compound assignment syntax; see @ref{Shell Parameters} above. -Any element of an array may be referenced using +An array element is referenced using @code{$@{@var{name}[@var{subscript}]@}}. The braces are required to avoid -conflicts with the shell's filename expansion operators. If the -@var{subscript} is @samp{@@} or @samp{*}, the word expands to all members +conflicts with the shell's filename expansion operators. +If the @var{subscript} is @samp{@@} or @samp{*}, +the word expands to all members of the array @var{name}, unless otherwise noted in the description of a builtin or word expansion. These subscripts differ only when the word @@ -8081,18 +8415,22 @@ If the word is double-quoted, @code{$@{@var{name}[*]@}} expands to a single word with the value of each array member separated by the first character of the @env{IFS} variable, and @code{$@{@var{name}[@@]@}} expands each element of -@var{name} to a separate word. When there are no array members, -@code{$@{@var{name}[@@]@}} 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 original -word, and the expansion of the last parameter is joined with the last -part of the original word. +@var{name} to a separate word. +When there are no array members, @code{$@{@var{name}[@@]@}} 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 @samp{@@} and @samp{*}. + @code{$@{#@var{name}[@var{subscript}]@}} expands to the length of @code{$@{@var{name}[@var{subscript}]@}}. -If @var{subscript} is @samp{@@} or -@samp{*}, the expansion is the number of elements in the array. +If @var{subscript} is @samp{@@} or @samp{*}, +the expansion is the number of elements in the array. + If the @var{subscript} used to reference an element of an indexed array evaluates to a number less than zero, it is @@ -8106,7 +8444,8 @@ Any reference to a variable using a valid subscript is valid, and Bash will create an array if necessary. An array variable is considered set if a subscript has been assigned a -value. The null string is a valid value. +value. +The null string is a valid value. It is possible to obtain the keys (indices) of an array as well as the values. $@{!@var{name}[@@]@} and $@{!@var{name}[*]@} expand to the indices @@ -8116,14 +8455,14 @@ special parameters @samp{@@} and @samp{*} within double quotes. The @code{unset} builtin is used to destroy arrays. @code{unset @var{name}[@var{subscript}]} -destroys the array element at index @var{subscript}. +unsets the array element at index @var{subscript}. Negative subscripts to indexed arrays are interpreted as described above. Unsetting the last element of an array variable does not unset the variable. @code{unset @var{name}}, where @var{name} is an array, removes the entire array. @code{unset @var{name}[@var{subscript}]} behaves differently -depending on the array type when given a -subscript of @samp{*} or @samp{@@}. +depending on the array type when +@var{subscript} is @samp{*} or @samp{@@}. When @var{name} is an associative array, it removes the element with key @samp{*} or @samp{@@}. If @var{name} is an indexed array, @code{unset} removes all of the elements, @@ -8131,8 +8470,10 @@ but does not remove the array itself. When using a variable name with a subscript as an argument to a command, such as with @code{unset}, without using the word expansion syntax -described above, the argument is subject to the shell's filename expansion. -If filename expansion is not desired, the argument should be quoted. +described above (e.g., unset a[4]), +the argument is subject to the shell's filename expansion. +Quote the argument if pathname expansion is not desired +(e.g., unset 'a[4]'). The @code{declare}, @code{local}, and @code{readonly} builtins each accept a @option{-a} option to specify an indexed @@ -8144,6 +8485,10 @@ to an array, and can read values from the standard input into individual array elements. The @code{set} and @code{declare} builtins display array values in a way that allows them to be reused as input. +Other builtins accept array name arguments as well +(e.g., @code{mapfile}); see the descriptions +of individual builtins for details. +The shell provides a number of builtin array variables. @node The Directory Stack @section The Directory Stack @@ -8176,11 +8521,13 @@ as the value of the @env{DIRSTACK} shell variable. dirs [-clpv] [+@var{N} | -@var{N}] @end example -Display the list of currently remembered directories. Directories -are added to the list with the @code{pushd} command; the -@code{popd} command removes directories from the list. +Without options, display the list of currently remembered directories. +Directories are added to the list with the @code{pushd} command; +the @code{popd} command removes directories from the list. The current directory is always the first directory in the stack. +Options, if supplied, have the following meanings: + @table @code @item -c Clears the directory stack by deleting all of the elements. @@ -8209,26 +8556,25 @@ with zero. popd [-n] [+@var{N} | -@var{N}] @end example -Removes elements from the directory stack. +Remove elements from the directory stack. The elements are numbered from 0 starting at the first directory listed by @code{dirs}; that is, @code{popd} is equivalent to @code{popd +0}. -When no arguments are given, @code{popd} -removes the top directory from the stack and changes to -the new top directory. +When no arguments are given, @code{popd} removes the top directory +from the stack and changes to the new top directory. Arguments, if supplied, have the following meanings: @table @code @item -n -Suppresses the normal change of directory when removing directories -from the stack, so that only the stack is manipulated. +Suppress the normal change of directory when removing directories +from the stack, only manipulate the stack. @item +@var{N} -Removes the @var{N}th directory (counting from the left of the +Remove the @var{N}th directory (counting from the left of the list printed by @code{dirs}), starting with zero, from the stack. @item -@var{N} -Removes the @var{N}th directory (counting from the right of the +Remove the @var{N}th directory (counting from the right of the list printed by @code{dirs}), starting with zero, from the stack. @end table @@ -8238,8 +8584,8 @@ builtin to change to the directory at the top of the stack. If the @code{cd} fails, @code{popd} returns a non-zero value. Otherwise, @code{popd} returns an unsuccessful status if -an invalid option is encountered, the directory stack -is empty, or a non-existent directory stack entry is specified. +an invalid option is specified, the directory stack +is empty, or @var{N} specifies a non-existent directory stack entry. If the @code{popd} command is successful, Bash runs @code{dirs} to show the final contents of the directory stack, @@ -8251,7 +8597,7 @@ and the return status is 0. pushd [-n] [@var{+N} | @var{-N} | @var{dir}] @end example -Adds a directory to the top of the directory stack, or rotates +Add a directory to the top of the directory stack, or rotate the stack, making the new top of the stack the current working directory. With no arguments, @code{pushd} exchanges the top two elements @@ -8261,18 +8607,18 @@ Arguments, if supplied, have the following meanings: @table @code @item -n -Suppresses the normal change of directory when rotating or -adding directories to the stack, so that only the stack is manipulated. +Suppress the normal change of directory when rotating or +adding directories to the stack, only manipulate the stack. @item +@var{N} -Brings the @var{N}th directory (counting from the left of the -list printed by @code{dirs}, starting with zero) to the top of -the list by rotating the stack. +Rotate the stack so that +the @var{N}th directory (counting from the left of the +list printed by @code{dirs}, starting with zero) is at the top. @item -@var{N} -Brings the @var{N}th directory (counting from the right of the -list printed by @code{dirs}, starting with zero) to the top of -the list by rotating the stack. +Rotate the stack so that +the @var{N}th directory (counting from the right of the +list printed by @code{dirs}, starting with zero) is at the top. @item @var{dir} -Makes @var{dir} be the top of the stack. +Make @var{dir} be the top of the stack. @end table After the stack has been modified, if the @option{-n} option was not @@ -8280,11 +8626,11 @@ supplied, @code{pushd} uses the @code{cd} builtin to change to the directory at the top of the stack. If the @code{cd} fails, @code{pushd} returns a non-zero value. -Otherwise, if no arguments are supplied, @code{pushd} returns 0 unless the -directory stack is empty. -When rotating the directory stack, @code{pushd} returns 0 unless -the directory stack is empty or a non-existent directory stack element -is specified. +Otherwise, if no arguments are supplied, @code{pushd} returns zero +unless the directory stack is empty. +When rotating the directory stack, @code{pushd} returns zero unless +the directory stack is empty or @var{N} specifies a non-existent +directory stack element. If the @code{pushd} command is successful, Bash runs @code{dirs} to show the final contents of the directory stack. @@ -8295,12 +8641,6 @@ Bash runs @code{dirs} to show the final contents of the directory stack. @section Controlling the Prompt @cindex prompting -Bash examines the value of the array variable @env{PROMPT_COMMAND} just before -printing each primary prompt. -If any elements in @env{PROMPT_COMMAND} are set and non-null, Bash -executes each value, in numeric order, -just as if it had been typed on the command line. - In addition, the following table describes the special characters which can appear in the prompt variables @env{PS0}, @env{PS1}, @env{PS2}, and @env{PS4}: @@ -8313,23 +8653,24 @@ The date, in "Weekday Month Date" format (e.g., "Tue May 26"). @item \D@{@var{format}@} The @var{format} is passed to @code{strftime}(3) and the result is inserted into the prompt string; an empty @var{format} results in a locale-specific -time representation. The braces are required. +time representation. +The braces are required. @item \e An escape character. @item \h -The hostname, up to the first `.'. +The hostname, up to the first @samp{.}. @item \H The hostname. @item \j The number of jobs currently managed by the shell. @item \l -The basename of the shell's terminal device name. +The basename of the shell's terminal device name (e.g., "ttys0"). @item \n A newline. @item \r A carriage return. @item \s -The name of the shell, the basename of @code{$0} (the portion +The name of the shell: the basename of @code{$0} (the portion following the final slash). @item \t The time, in 24-hour HH:MM:SS format. @@ -8342,9 +8683,9 @@ The time, in 24-hour HH:MM format. @item \u The username of the current user. @item \v -The version of Bash (e.g., 2.00) +The Bash version (e.g., 2.00). @item \V -The release of Bash, version + patchlevel (e.g., 2.00.0) +The Bash release, version + patchlevel (e.g., 2.00.0). @item \w The value of the @code{PWD} shell variable (@env{$PWD}), with @env{$HOME} abbreviated with a tilde @@ -8391,7 +8732,7 @@ If Bash is started with the name @code{rbash}, or the @option{--restricted} or @option{-r} -option is supplied at invocation, the shell becomes restricted. +option is supplied at invocation, the shell becomes @var{restricted}. A restricted shell is used to set up an environment more controlled than the standard shell. A restricted shell behaves identically to @code{bash} @@ -8410,6 +8751,9 @@ Specifying command names containing slashes. Specifying a filename containing a slash as an argument to the @code{.} builtin command. @item +Using the @option{-p} option to the @code{.} builtin command +to specify a search path. +@item Specifying a filename containing a slash as an argument to the @code{history} builtin command. @item @@ -8944,11 +9288,12 @@ There is only one current compatibility level -- each option is mutually exclusive. The compatibility level is intended to allow users to select behavior from previous versions that is incompatible with newer versions -while they migrate scripts to use current features and -behavior. It's intended to be a temporary solution. +while they migrate scripts to use current features and behavior. +It's intended to be a temporary solution. This section does not mention behavior that is standard for a particular -version (e.g., setting @code{compat32} means that quoting the rhs of the regexp +version (e.g., setting @code{compat32} means that quoting the right hand +side of the regexp matching operator quotes special regexp characters in the word, which is default behavior in bash-3.2 and subsequent versions). @@ -8971,13 +9316,14 @@ to this variable (a decimal version number like 4.2, or an integer corresponding to the @code{compat}@var{NN} option, like 42) determines the compatibility level. -Starting with bash-4.4, Bash has begun deprecating older compatibility +Starting with bash-4.4, Bash began deprecating older compatibility levels. Eventually, the options will be removed in favor of @env{BASH_COMPAT}. -Bash-5.0 was the final version for which there will be an individual shopt +Bash-5.0 was the final version for which there was an individual shopt option for the previous version. -Users should control the compatibility level with @env{BASH_COMPAT}. +@env{BASH_COMPAT} is the only mechanism to control the compatibility level +in versions newer than bash-5.0. The following table describes the behavior changes controlled by each compatibility level setting. @@ -8993,14 +9339,14 @@ and it is required for bash-5.1 and later versions. @item compat31 @itemize @bullet @item -quoting the rhs of the @code{[[} command's regexp matching operator (=~) +Quoting the rhs of the @code{[[} command's regexp matching operator (=~) has no special effect @end itemize @item compat40 @itemize @bullet @item -the @samp{<} and @samp{>} operators to the @code{[[} command do not +The @samp{<} and @samp{>} operators to the @code{[[} command do not consider the current locale when comparing strings; they use ASCII ordering. Bash versions prior to bash-4.1 use ASCII collation and strcmp(3); @@ -9011,74 +9357,75 @@ strcoll(3). @item compat41 @itemize @bullet @item -in posix mode, @code{time} may be followed by options and still be -recognized as a reserved word (this is @sc{posix} interpretation 267) +In posix mode, @code{time} may be followed by options and still be +recognized as a reserved word (this is @sc{posix} interpretation 267). @item -in posix mode, the parser requires that an even number of single +In posix mode, the parser requires that an even number of single quotes occur in the @var{word} portion of a double-quoted $@{@dots{}@} parameter expansion and treats them specially, so that characters within the single quotes are considered quoted -(this is @sc{posix} interpretation 221) +(this is @sc{posix} interpretation 221). @end itemize @item compat42 @itemize @bullet @item -the replacement string in double-quoted pattern substitution does not -undergo quote removal, as it does in versions after bash-4.2 +The replacement string in double-quoted pattern substitution does not +undergo quote removal, as it does in versions after bash-4.2. @item -in posix mode, single quotes are considered special when expanding +In posix mode, single quotes are considered special when expanding the @var{word} portion of a double-quoted $@{@dots{}@} parameter expansion and can be used to quote a closing brace or other special character (this is part of @sc{posix} interpretation 221); in later versions, single quotes -are not special within double-quoted word expansions +are not special within double-quoted word expansions. @end itemize @item compat43 @itemize @bullet @item -word expansion errors are considered non-fatal errors that cause the +Word expansion errors are considered non-fatal errors that cause the current command to fail, even in posix mode (the default behavior is to make them fatal errors that cause the shell -to exit) +to exit). @item -when executing a shell function, the loop state (while/until/etc.) +When executing a shell function, the loop state (while/until/etc.) is not reset, so @code{break} or @code{continue} in that function will break -or continue loops in the calling context. Bash-4.4 and later reset -the loop state to prevent this +or continue loops in the calling context. +Bash-4.4 and later reset the loop state to prevent this. @end itemize @item compat44 @itemize @bullet @item -the shell sets up the values used by @env{BASH_ARGV} and @env{BASH_ARGC} +The shell sets up the values used by @env{BASH_ARGV} and @env{BASH_ARGC} so they can expand to the shell's positional parameters even if extended -debugging mode is not enabled +debugging mode is not enabled. @item -a subshell inherits loops from its parent context, so @code{break} +A subshell inherits loops from its parent context, so @code{break} or @code{continue} will cause the subshell to exit. -Bash-5.0 and later reset the loop state to prevent the exit +Bash-5.0 and later reset the loop state to prevent the exit. @item -variable assignments preceding builtins like @code{export} and @code{readonly} +Variable assignments preceding builtins like @code{export} and @code{readonly} that set attributes continue to affect variables with the same name in the calling environment even if the shell is not in posix -mode +mode. @end itemize @item compat50 (set using BASH_COMPAT) @itemize @bullet @item Bash-5.1 changed the way @code{$RANDOM} is generated to introduce slightly -more randomness. If the shell compatibility level is set to 50 or -lower, it reverts to the method from bash-5.0 and previous versions, +more randomness. +If the shell compatibility level is set to 50 or lower, it reverts to +the method from bash-5.0 and previous versions, so seeding the random number generator by assigning a value to -@env{RANDOM} will produce the same sequence as in bash-5.0 +@env{RANDOM} will produce the same sequence as in bash-5.0. @item If the command hash table is empty, Bash versions prior to bash-5.1 printed an informational message to that effect, even when producing -output that can be reused as input. Bash-5.1 suppresses that message -when the @option{-l} option is supplied. +output that can be reused as input. +Bash-5.1 suppresses that message when the @option{-l} option is supplied. @end itemize @item compat51 (set using BASH_COMPAT) @@ -9087,27 +9434,27 @@ when the @option{-l} option is supplied. The @code{unset} builtin will unset the array @code{a} given an argument like @samp{a[@@]}. Bash-5.2 will unset an element with key @samp{@@} (associative arrays) -or remove all the elements without unsetting the array (indexed arrays) +or remove all the elements without unsetting the array (indexed arrays). @item -arithmetic commands ( ((...)) ) and the expressions in an arithmetic for -statement can be expanded more than once +Arithmetic commands ( ((...)) ) and the expressions in an arithmetic for +statement can be expanded more than once. @item -expressions used as arguments to arithmetic operators in the @code{[[} -conditional command can be expanded more than once +Expressions used as arguments to arithmetic operators in the @code{[[} +conditional command can be expanded more than once. @item -the expressions in substring parameter brace expansion can be -expanded more than once +The expressions in substring parameter brace expansion can be +expanded more than once. @item -the expressions in the $(( ... )) word expansion can be expanded -more than once +The expressions in the $(( ... )) word expansion can be expanded +more than once. @item -arithmetic expressions used as indexed array subscripts can be -expanded more than once +Arithmetic expressions used as indexed array subscripts can be +expanded more than once. @item @code{test -v}, when given an argument of @samp{A[@@]}, where @var{A} is an existing associative array, will return true if the array has any set elements. -Bash-5.2 will look for and report on a key named @samp{@@} +Bash-5.2 will look for and report on a key named @samp{@@}. @item the $@{@var{parameter}[:]=@var{value}@} word expansion will return @var{value}, before any variable-specific transformations have been @@ -9297,7 +9644,7 @@ fg [@var{jobspec}] @end example Resume the job @var{jobspec} in the foreground and make it the current job. -If @var{jobspec} is not supplied, the current job is used. +If @var{jobspec} is not supplied, resume the current job. The return status is that of the command placed into the foreground, or non-zero if run when job control is disabled or, when run with job control enabled, @var{jobspec} does not specify a valid job or @@ -9310,8 +9657,8 @@ jobs [-lnprs] [@var{jobspec}] jobs -x @var{command} [@var{arguments}] @end example -The first form lists the active jobs. The options have the -following meanings: +The first form lists the active jobs. +The options have the following meanings: @table @code @item -l @@ -9331,10 +9678,9 @@ Display only running jobs. Display only stopped jobs. @end table -If @var{jobspec} is given, -output is restricted to information about that job. -If @var{jobspec} is not supplied, the status of all jobs is -listed. +If @var{jobspec} is supplied, +@code{jobs} restricts output to information about that job. +If @var{jobspec} is not supplied, @code{jobs} lists the status of all jobs. If the @option{-x} option is supplied, @code{jobs} replaces any @var{jobspec} found in @var{command} or @var{arguments} with the @@ -9353,14 +9699,17 @@ named by job specification @var{jobspec} or process @sc{id} @var{pid}. @var{sigspec} is either a case-insensitive signal name such as @code{SIGINT} (with or without the @code{SIG} prefix) or a signal number; @var{signum} is a signal number. -If @var{sigspec} and @var{signum} are not present, @code{SIGTERM} is used. +If @var{sigspec} and @var{signum} are not present, @code{kill} +sends @code{SIGTERM}. + The @option{-l} option lists the signal names. -If any arguments are supplied when @option{-l} is given, the names of the +If any arguments are supplied when @option{-l} is supplied, the names of the signals corresponding to the arguments are listed, and the return status is zero. @var{exit_status} is a number specifying a signal number or the exit status of a process terminated by a signal. The @option{-L} option is equivalent to @option{-l}. + The return status is zero if at least one signal was successfully sent, or non-zero if an error occurs or an invalid option is encountered. @@ -9373,7 +9722,7 @@ wait [-fn] [-p @var{varname}] [@var{id} @dots{}] Wait until the child process specified by each @var{id} exits and return the exit status of the last @var{id}. Each @var{id} may be a @var{pid} or job specification @var{jobspec}; -if a job spec is given, @code{wait} waits for all processes in the job. +if a job spec is supplied, @code{wait} waits for all processes in the job. If no options or @var{id}s are supplied, @code{wait} waits for all running background jobs and @@ -9392,7 +9741,9 @@ the exit status is 127. If the @option{-p} option is supplied, the process or job identifier of the job for which the exit status is returned is assigned to the variable @var{varname} named by the option argument. -The variable will be unset initially, before any assignment. +The variable, +which cannot be readonly, +will be unset initially, before any assignment. This is useful only when the @option{-n} option is supplied. Supplying the @option{-f} option, when job control is enabled, @@ -9410,20 +9761,27 @@ Otherwise, the return status is the exit status of the last @var{id}. @item disown @btindex disown @example -disown [-ar] [-h] [@var{jobspec} @dots{} | @var{pid} @dots{} ] +disown [-ar] [-h] [@var{id} @dots{}] @end example -Without options, remove each @var{jobspec} from the table of +Without options, remove each @var{id} from the table of active jobs. -If the @option{-h} option is given, the job is not removed from the table, +Each @var{id} may be a @var{pid} or job specification @var{jobspec}; +if @var{id} is a @var{pid}, +@code{disown} uses the job containing @var{pid}. +If the @option{-h} option is supplied, the job is not removed from the table, but is marked so that @code{SIGHUP} is not sent to the job if the shell receives a @code{SIGHUP}. -If @var{jobspec} is not present, and neither the @option{-a} nor the -@option{-r} option is supplied, the current job is used. -If no @var{jobspec} is supplied, the @option{-a} option means to remove or -mark all jobs; the @option{-r} option without a @var{jobspec} +If @var{id} is not present, and neither the @option{-a} nor the +@option{-r} option is supplied, @code{disown} removes the current job. + +If no @var{id} is supplied, the @option{-a} option means to remove or +mark all jobs; the @option{-r} option without an @var{id} argument restricts operation to running jobs. +The return value is 0 unless an @var{id} +does not specify a valid job. + @item suspend @btindex suspend @example @@ -9432,10 +9790,9 @@ suspend [-f] Suspend the execution of this shell until it receives a @code{SIGCONT} signal. -A login shell, -or a shell without job control enabled, +A login shell, or a shell without job control enabled, cannot be suspended; the @option{-f} -option can be used to override this and force the suspension. +option will override this and force the suspension. The return status is 0 unless the shell is a login shell or job control is not enabled and @@ -9455,17 +9812,21 @@ supplied process @sc{id}s. @item auto_resume This variable controls how the shell interacts with the user and -job control. If this variable exists then single word simple +job control. +If this variable exists then single-word simple commands without redirections are treated as candidates for resumption -of an existing job. There is no ambiguity allowed; if there is -more than one job beginning with the string typed, then -the most recently accessed job will be selected. +of an existing job. +There is no ambiguity allowed; if there is more than one job +beginning with the string typed, then +the most recently accessed job is selected. The name of a stopped job, in this context, is the command line -used to start it. If this variable is set to the value @samp{exact}, +used to start it. +If this variable is set to the value @samp{exact}, the string supplied must match the name of a stopped job exactly; if set to @samp{substring}, the string supplied needs to match a substring of the name of a -stopped job. The @samp{substring} value provides functionality +stopped job. +The @samp{substring} value provides functionality analogous to the @samp{%?} job @sc{id} (@pxref{Job Control Basics}). If set to any other value, the supplied string must be a prefix of a stopped job's name; this provides functionality @@ -9486,11 +9847,11 @@ analogous to the @samp{%} job @sc{id}. @chapter Installing Bash This chapter provides basic instructions for installing Bash on -the various supported platforms. The distribution supports the +the various supported platforms. +The distribution supports the @sc{gnu} operating systems, nearly every version of Unix, and several non-Unix systems such as BeOS and Interix. -Other independent ports exist for -@sc{ms-dos}, @sc{os/2}, and Windows platforms. +Other independent ports exist for Windows platforms. @menu * Basic Installation:: Installation instructions. @@ -9522,10 +9883,10 @@ The simplest way to compile Bash is: @enumerate @item @code{cd} to the directory containing the source code and type -@samp{./configure} to configure Bash for your system. If you're -using @code{csh} on an old version of System V, you might need to -type @samp{sh ./configure} instead to prevent @code{csh} from trying -to execute @code{configure} itself. +@samp{./configure} to configure Bash for your system. +If you're using @code{csh} on an old version of System V, you might +need to type @samp{sh ./configure} instead to prevent @code{csh} +from trying to execute @code{configure} itself. Running @code{configure} takes some time. While running, it prints messages telling which features it is @@ -9545,18 +9906,19 @@ files, some supplemental documentation, a number of example loadable builtin commands, and a set of header files for developing loadable builtins. You may need additional privileges to install @code{bash} to your -desired destination, so @samp{sudo make install} might be required. +desired destination, which may require @samp{sudo make install}. More information about controlling the locations where @code{bash} and other files are installed is below (@pxref{Installation Names}). @end enumerate The @code{configure} shell script attempts to guess correct -values for various system-dependent variables used during -compilation. It uses those values to create a @file{Makefile} in +values for various system-dependent variables used during compilation. +It uses those values to create a @file{Makefile} in each directory of the package (the top directory, the @file{builtins}, @file{doc}, @file{po}, and @file{support} directories, -each directory under @file{lib}, and several others). It also creates a +each directory under @file{lib}, and several others). +It also creates a @file{config.h} file containing system-dependent definitions. Finally, it creates a shell script named @code{config.status} that you can run in the future to recreate the current configuration, a @@ -9579,7 +9941,8 @@ at the Bash prompt in your Bash source directory. If you want to build Bash in a directory separate from the source directory -- to build for multiple architectures, for example -- -just use the full path to the configure script. The following commands +just use the full path to the configure script. +The following commands will build Bash in a directory under @file{/usr/local/build} from the source code in @file{/usr/local/src/bash-4.4}: @@ -9607,7 +9970,8 @@ If you do this, make sure you are using Autoconf version 2.69 or newer. You can remove the program binaries and object files from the -source code directory by typing @samp{make clean}. To also remove the +source code directory by typing @samp{make clean}. +To also remove the files that @code{configure} created (so you can compile Bash for a different kind of computer), type @samp{make distclean}. @@ -9615,10 +9979,11 @@ a different kind of computer), type @samp{make distclean}. @section Compilers and Options Some systems require unusual options for compilation or linking -that the @code{configure} script does not know about. You can -give @code{configure} initial values for variables by setting -them in the environment. Using a Bourne-compatible shell, you -can do that on the command line like this: +that the @code{configure} script does not know about. +You can give @code{configure} initial values for variables by setting +them in the environment. +Using a Bourne-compatible shell, you can do that on the command line +like this: @example CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure @@ -9638,26 +10003,30 @@ is available. You can compile Bash for more than one kind of computer at the same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of @code{make} that +own directory. +To do this, you must use a version of @code{make} that supports the @code{VPATH} variable, such as GNU @code{make}. @code{cd} to the directory where you want the object files and executables to go and run the @code{configure} script from the source directory (@pxref{Basic Installation}). You may need to -supply the @option{--srcdir=PATH} argument to tell @code{configure} where the -source files are. @code{configure} automatically checks for the +supply the @option{--srcdir=PATH} argument to tell @code{configure} +where the source files are. +@code{configure} automatically checks for the source code in the directory that @code{configure} is in and in `..'. If you have to use a @code{make} that does not support the @code{VPATH} variable, you can compile Bash for one architecture at a -time in the source code directory. After you have installed +time in the source code directory. +After you have installed Bash for one architecture, use @samp{make distclean} before reconfiguring for another architecture. Alternatively, if your system supports symbolic links, you can use the @file{support/mkclone} script to create a build tree which has -symbolic links back to each file in the source directory. Here's an +symbolic links back to each file in the source directory. +Here's an example that creates a build directory in the current directory from a source directory @file{/usr/gnu/src/bash-2.0}: @@ -9698,9 +10067,10 @@ you can specify these variables as arguments to @code{make}: If you want to see the files Bash will install and where it will install them without changing anything on your system, specify the variable -@env{DESTDIR} as an argument to @code{make}. Its value should be the -absolute directory path you'd like to use as the root of your sample -installation tree. For example, +@env{DESTDIR} as an argument to @code{make}. +Its value should be the absolute directory path you'd like to use as the +root of your sample installation tree. +For example, @example mkdir /fs1/bash-install @@ -9723,9 +10093,11 @@ variables and their effects. There may be some features @code{configure} can not figure out automatically, but needs to determine by the type of host Bash -will run on. Usually @code{configure} can figure that +will run on. +Usually @code{configure} can figure that out, but if it prints a message saying it can not guess the host -type, give it the @option{--host=TYPE} option. @samp{TYPE} can +type, give it the @option{--host=TYPE} option. +@samp{TYPE} can either be a short name for the system type, such as @samp{sun4}, or a canonical name with three fields: @samp{CPU-COMPANY-SYSTEM} (e.g., @samp{i386-unknown-freebsd4.2}). @@ -9739,11 +10111,14 @@ values of each field. If you want to set default values for @code{configure} scripts to share, you can create a site shell script called @code{config.site} that gives default values for variables like -@code{CC}, @code{cache_file}, and @code{prefix}. @code{configure} +@code{CC}, @code{cache_file}, and @code{prefix}. +@code{configure} looks for @file{PREFIX/share/config.site} if it exists, then -@file{PREFIX/etc/config.site} if it exists. Or, you can set the +@file{PREFIX/etc/config.site} if it exists. +Or, you can set the @code{CONFIG_SITE} environment variable to the location of the site -script. A warning: the Bash @code{configure} looks for a site script, +script. +A warning: the Bash @code{configure} looks for a site script, but not all @code{configure} scripts do. @node Operation Controls @@ -9756,9 +10131,9 @@ operates. @item --cache-file=@var{file} Use and save the results of the tests in -@var{file} instead of @file{./config.cache}. Set @var{file} to -@file{/dev/null} to disable caching, for debugging -@code{configure}. +@var{file} instead of @file{./config.cache}. +Set @var{file} to @file{/dev/null} to disable caching, +for debugging @code{configure}. @item --help Print a summary of the options to @code{configure}, and exit. @@ -9769,8 +10144,8 @@ Print a summary of the options to @code{configure}, and exit. Do not print messages saying which checks are being made. @item --srcdir=@var{dir} -Look for the Bash source code in directory @var{dir}. Usually -@code{configure} can determine that directory automatically. +Look for the Bash source code in directory @var{dir}. +Usually @code{configure} can determine that directory automatically. @item --version Print the version of Autoconf used to generate the @code{configure} @@ -9778,7 +10153,8 @@ script, and exit. @end table @code{configure} also accepts some other, not widely used, boilerplate -options. @samp{configure --help} prints the complete list. +options. +@samp{configure --help} prints the complete list. @node Optional Features @section Optional Features @@ -9786,13 +10162,14 @@ options. @samp{configure --help} prints the complete list. The Bash @code{configure} has a number of @option{--enable-@var{feature}} options, where @var{feature} indicates an optional part of Bash. There are also several @option{--with-@var{package}} options, -where @var{package} is something like @samp{bash-malloc} or @samp{purify}. +where @var{package} is something like @samp{bash-malloc} or @samp{afs}. To turn off the default use of a package, use -@option{--without-@var{package}}. To configure Bash without a feature +@option{--without-@var{package}}. +To configure Bash without a feature that is enabled by default, use @option{--disable-@var{feature}}. -Here is a complete list of the @option{--enable-} and -@option{--with-} options that the Bash @code{configure} recognizes. +Here is a complete list of the @option{--enable-} and @option{--with-} +options that the Bash @code{configure} recognizes. @table @code @item --with-afs @@ -9800,27 +10177,30 @@ Define if you are using the Andrew File System from Transarc. @item --with-bash-malloc Use the Bash version of -@code{malloc} in the directory @file{lib/malloc}. This is not the same -@code{malloc} that appears in @sc{gnu} libc, but an older version -originally derived from the 4.2 @sc{bsd} @code{malloc}. This @code{malloc} -is very fast, but wastes some space on each allocation. +@code{malloc} in the directory @file{lib/malloc}. +This is not the same +@code{malloc} that appears in @sc{gnu} libc, but a custom version +originally derived from the 4.2 @sc{bsd} @code{malloc}. +This @code{malloc} is very fast, but wastes some space on each allocation, +though it uses several techniques to minimize the waste. This option is enabled by default. The @file{NOTES} file contains a list of systems for which this should be turned off, and @code{configure} disables this option automatically for a number of systems. @item --with-curses -Use the curses library instead of the termcap library. This should -be supplied if your system has an inadequate or incomplete termcap -database. +Use the curses library instead of the termcap library. +@code{configure} usually chooses this automatically, since most systems +include the termcap functions in the curses library. @item --with-gnu-malloc A synonym for @code{--with-bash-malloc}. @item --with-installed-readline[=@var{PREFIX}] Define this to make Bash link with a locally-installed version of Readline -rather than the version in @file{lib/readline}. This works only with -Readline 5.0 and later versions. If @var{PREFIX} is @code{yes} or not +rather than the version in @file{lib/readline}. +This works only with Readline 5.0 and later versions. +If @var{PREFIX} is @code{yes} or not supplied, @code{configure} uses the values of the make variables @code{includedir} and @code{libdir}, which are subdirectories of @code{prefix} by default, to find the installed version of Readline if it is not in @@ -9832,6 +10212,8 @@ a directory pathname and looks for the installed version of Readline in subdirectories of that directory (include files in @var{PREFIX}/@code{include} and the library in @var{PREFIX}/@code{lib}). +The Bash default is to link with a static library built in the +@file{lib/readline} subdirectory of the build directory. @item --with-libintl-prefix[=@var{PREFIX}] Define this to make Bash link with a locally-installed version of the @@ -9839,10 +10221,11 @@ libintl library instead of the version in @file{lib/intl}. @item --with-libiconv-prefix[=@var{PREFIX}] Define this to make Bash look for libiconv in @var{PREFIX} instead of the -standard system locations. There is no version included with Bash. +standard system locations. +The Bash distribution does not include this library. @item --enable-minimal-config -This produces a shell with minimal features, close to the historical +This produces a shell with minimal features, closer to the historical Bourne shell. @end table @@ -9853,7 +10236,8 @@ compiled, linked, and installed, rather than changing run-time features. @item --enable-largefile Enable support for @url{http://www.unix.org/version2/whatsnew/lfs20mar.html, large files} if the operating system requires special compiler options -to build programs which can access large files. This is enabled by +to build programs which can access large files. +This is enabled by default, if the operating system provides large file support. @item --enable-profiling @@ -9908,8 +10292,8 @@ Include support for @code{csh}-like history substitution (@pxref{History Interaction}). @item --enable-bash-source-fullpath-default -Set the default value of the @code{bash_source_fullpath} shell option described -above under @ref{The Shopt Builtin} to be enabled. +Set the default value of the @code{bash_source_fullpath} shell option +described above under @ref{The Shopt Builtin} to be enabled. This controls how filenames are assigned to the @code{BASH_SOURCE} array variable. @@ -9920,7 +10304,8 @@ See @ref{Brace Expansion}, for a complete description. @item --enable-casemod-attributes Include support for case-modifying attributes in the @code{declare} builtin -and assignment statements. Variables with the @code{uppercase} attribute, +and assignment statements. +Variables with the @code{uppercase} attribute, for example, will have their values converted to uppercase upon assignment. @item --enable-casemod-expansion @@ -9930,7 +10315,8 @@ Include support for case-modifying word expansions. Include support for recognizing @code{time} as a reserved word and for displaying timing statistics for the pipeline following @code{time} (@pxref{Pipelines}). -This allows pipelines as well as shell builtins and functions to be timed. +This allows timing pipelines, shell compound commands, shell builtins, +and shell functions, which an external command cannot do easily. @item --enable-cond-command Include support for the @code{[[} conditional command. @@ -9984,8 +10370,8 @@ above under @ref{The Shopt Builtin} to be enabled. @item --enable-function-import Include support for importing function definitions exported by another -instance of the shell from the environment. This option is enabled by -default. +instance of the shell from the environment. +This option is enabled by default. @item --enable-glob-asciiranges-default Set the default value of the @code{globasciiranges} shell option described @@ -10027,7 +10413,8 @@ If Readline is not enabled, this option has no effect. @item --enable-prompt-string-decoding Turn on the interpretation of a number of backslash-escaped characters in the @env{$PS0}, @env{$PS1}, @env{$PS2}, and @env{$PS4} prompt -strings. See @ref{Controlling the Prompt}, for a complete list of prompt +strings. +See @ref{Controlling the Prompt}, for a complete list of prompt string escape sequences. @item --enable-readline @@ -10035,17 +10422,19 @@ Include support for command-line editing and history with the Bash version of the Readline library (@pxref{Command Line Editing}). @item --enable-restricted -Include support for a @dfn{restricted shell}. If this is enabled, Bash, -when called as @code{rbash}, enters a restricted mode. See -@ref{The Restricted Shell}, for a description of restricted mode. +Include support for a @dfn{restricted shell}. +If this is enabled, +Bash enters a restricted mode when called as @code{rbash}. +See @ref{The Restricted Shell}, for a description of restricted mode. @item --enable-select -Include the @code{select} compound command, which allows the generation of +Include the @code{select} compound command, which allows generation of simple menus (@pxref{Conditional Constructs}). @item --enable-single-help-strings Store the text displayed by the @code{help} builtin as a single string for -each help topic. This aids in translating the text to different languages. +each help topic. +This aids in translating the text to different languages. You may need to disable this if your compiler cannot handle very long string literals. @@ -10084,7 +10473,7 @@ Please report all bugs you find in Bash. But first, you should make sure that it really is a bug, and that it appears in the latest version of Bash. -The latest version of Bash is always available for FTP from +The latest released version of Bash is always available for FTP from @uref{ftp://ftp.gnu.org/pub/gnu/bash/} and from @uref{http://git.savannah.gnu.org/cgit/bash.git/snapshot/bash-master.tar.gz}. @@ -10573,7 +10962,6 @@ The SVR4.2 @code{sh} uses a @env{TIMEOUT} variable like Bash uses @noindent More features unique to Bash may be found in @ref{Bash Features}. - @appendixsec Implementation Differences From The SVR4.2 Shell Since Bash is a completely new implementation, it does not suffer from diff --git a/doc/bashref.toc b/doc/bashref.toc index 5212e8ce..aac5ea89 100644 --- a/doc/bashref.toc +++ b/doc/bashref.toc @@ -16,128 +16,128 @@ @numsubsecentry{Reserved Words}{3.2.1}{Reserved Words}{9} @numsubsecentry{Simple Commands}{3.2.2}{Simple Commands}{9} @numsubsecentry{Pipelines}{3.2.3}{Pipelines}{10} -@numsubsecentry{Lists of Commands}{3.2.4}{Lists}{10} +@numsubsecentry{Lists of Commands}{3.2.4}{Lists}{11} @numsubsecentry{Compound Commands}{3.2.5}{Compound Commands}{11} -@numsubsubsecentry{Looping Constructs}{3.2.5.1}{Looping Constructs}{11} +@numsubsubsecentry{Looping Constructs}{3.2.5.1}{Looping Constructs}{12} @numsubsubsecentry{Conditional Constructs}{3.2.5.2}{Conditional Constructs}{12} @numsubsubsecentry{Grouping Commands}{3.2.5.3}{Command Grouping}{17} @numsubsecentry{Coprocesses}{3.2.6}{Coprocesses}{18} @numsubsecentry{GNU Parallel}{3.2.7}{GNU Parallel}{19} @numsecentry{Shell Functions}{3.3}{Shell Functions}{19} -@numsecentry{Shell Parameters}{3.4}{Shell Parameters}{21} +@numsecentry{Shell Parameters}{3.4}{Shell Parameters}{22} @numsubsecentry{Positional Parameters}{3.4.1}{Positional Parameters}{23} @numsubsecentry{Special Parameters}{3.4.2}{Special Parameters}{23} @numsecentry{Shell Expansions}{3.5}{Shell Expansions}{24} -@numsubsecentry{Brace Expansion}{3.5.1}{Brace Expansion}{24} -@numsubsecentry{Tilde Expansion}{3.5.2}{Tilde Expansion}{25} -@numsubsecentry{Shell Parameter Expansion}{3.5.3}{Shell Parameter Expansion}{26} -@numsubsecentry{Command Substitution}{3.5.4}{Command Substitution}{34} -@numsubsecentry{Arithmetic Expansion}{3.5.5}{Arithmetic Expansion}{35} -@numsubsecentry{Process Substitution}{3.5.6}{Process Substitution}{35} -@numsubsecentry{Word Splitting}{3.5.7}{Word Splitting}{36} -@numsubsecentry{Filename Expansion}{3.5.8}{Filename Expansion}{36} -@numsubsubsecentry{Pattern Matching}{3.5.8.1}{Pattern Matching}{37} -@numsubsecentry{Quote Removal}{3.5.9}{Quote Removal}{39} -@numsecentry{Redirections}{3.6}{Redirections}{39} -@numsubsecentry{Redirecting Input}{3.6.1}{}{40} -@numsubsecentry{Redirecting Output}{3.6.2}{}{40} -@numsubsecentry{Appending Redirected Output}{3.6.3}{}{40} -@numsubsecentry{Redirecting Standard Output and Standard Error}{3.6.4}{}{41} -@numsubsecentry{Appending Standard Output and Standard Error}{3.6.5}{}{41} -@numsubsecentry{Here Documents}{3.6.6}{}{41} -@numsubsecentry{Here Strings}{3.6.7}{}{42} -@numsubsecentry{Duplicating File Descriptors}{3.6.8}{}{42} -@numsubsecentry{Moving File Descriptors}{3.6.9}{}{42} -@numsubsecentry{Opening File Descriptors for Reading and Writing}{3.6.10}{}{42} -@numsecentry{Executing Commands}{3.7}{Executing Commands}{43} -@numsubsecentry{Simple Command Expansion}{3.7.1}{Simple Command Expansion}{43} -@numsubsecentry{Command Search and Execution}{3.7.2}{Command Search and Execution}{43} -@numsubsecentry{Command Execution Environment}{3.7.3}{Command Execution Environment}{44} -@numsubsecentry{Environment}{3.7.4}{Environment}{45} -@numsubsecentry{Exit Status}{3.7.5}{Exit Status}{45} -@numsubsecentry{Signals}{3.7.6}{Signals}{46} -@numsecentry{Shell Scripts}{3.8}{Shell Scripts}{47} -@numchapentry{Shell Builtin Commands}{4}{Shell Builtin Commands}{49} -@numsecentry{Bourne Shell Builtins}{4.1}{Bourne Shell Builtins}{49} -@numsecentry{Bash Builtin Commands}{4.2}{Bash Builtins}{57} -@numsecentry{Modifying Shell Behavior}{4.3}{Modifying Shell Behavior}{69} -@numsubsecentry{The Set Builtin}{4.3.1}{The Set Builtin}{69} -@numsubsecentry{The Shopt Builtin}{4.3.2}{The Shopt Builtin}{74} -@numsecentry{Special Builtins}{4.4}{Special Builtins}{80} -@numchapentry{Shell Variables}{5}{Shell Variables}{81} -@numsecentry{Bourne Shell Variables}{5.1}{Bourne Shell Variables}{81} -@numsecentry{Bash Variables}{5.2}{Bash Variables}{81} -@numchapentry{Bash Features}{6}{Bash Features}{94} -@numsecentry{Invoking Bash}{6.1}{Invoking Bash}{94} -@numsecentry{Bash Startup Files}{6.2}{Bash Startup Files}{96} -@numsecentry{Interactive Shells}{6.3}{Interactive Shells}{98} -@numsubsecentry{What is an Interactive Shell?}{6.3.1}{What is an Interactive Shell?}{98} -@numsubsecentry{Is this Shell Interactive?}{6.3.2}{Is this Shell Interactive?}{98} -@numsubsecentry{Interactive Shell Behavior}{6.3.3}{Interactive Shell Behavior}{98} -@numsecentry{Bash Conditional Expressions}{6.4}{Bash Conditional Expressions}{99} -@numsecentry{Shell Arithmetic}{6.5}{Shell Arithmetic}{101} -@numsecentry{Aliases}{6.6}{Aliases}{103} -@numsecentry{Arrays}{6.7}{Arrays}{103} -@numsecentry{The Directory Stack}{6.8}{The Directory Stack}{105} -@numsubsecentry{Directory Stack Builtins}{6.8.1}{Directory Stack Builtins}{106} -@numsecentry{Controlling the Prompt}{6.9}{Controlling the Prompt}{107} -@numsecentry{The Restricted Shell}{6.10}{The Restricted Shell}{109} -@numsecentry{Bash and POSIX}{6.11}{Bash POSIX Mode}{109} -@numsubsecentry{What is POSIX?}{6.11.1}{}{109} -@numsubsecentry{Bash POSIX Mode}{6.11.2}{}{110} -@numsecentry{Shell Compatibility Mode}{6.12}{Shell Compatibility Mode}{114} -@numchapentry{Job Control}{7}{Job Control}{118} -@numsecentry{Job Control Basics}{7.1}{Job Control Basics}{118} -@numsecentry{Job Control Builtins}{7.2}{Job Control Builtins}{119} -@numsecentry{Job Control Variables}{7.3}{Job Control Variables}{121} -@numchapentry{Command Line Editing}{8}{Command Line Editing}{122} -@numsecentry{Introduction to Line Editing}{8.1}{Introduction and Notation}{122} -@numsecentry{Readline Interaction}{8.2}{Readline Interaction}{122} -@numsubsecentry{Readline Bare Essentials}{8.2.1}{Readline Bare Essentials}{123} -@numsubsecentry{Readline Movement Commands}{8.2.2}{Readline Movement Commands}{123} -@numsubsecentry{Readline Killing Commands}{8.2.3}{Readline Killing Commands}{124} -@numsubsecentry{Readline Arguments}{8.2.4}{Readline Arguments}{124} -@numsubsecentry{Searching for Commands in the History}{8.2.5}{Searching}{124} -@numsecentry{Readline Init File}{8.3}{Readline Init File}{125} -@numsubsecentry{Readline Init File Syntax}{8.3.1}{Readline Init File Syntax}{125} -@numsubsecentry{Conditional Init Constructs}{8.3.2}{Conditional Init Constructs}{134} -@numsubsecentry{Sample Init File}{8.3.3}{Sample Init File}{136} -@numsecentry{Bindable Readline Commands}{8.4}{Bindable Readline Commands}{139} -@numsubsecentry{Commands For Moving}{8.4.1}{Commands For Moving}{139} -@numsubsecentry{Commands For Manipulating The History}{8.4.2}{Commands For History}{140} -@numsubsecentry{Commands For Changing Text}{8.4.3}{Commands For Text}{142} -@numsubsecentry{Killing And Yanking}{8.4.4}{Commands For Killing}{143} -@numsubsecentry{Specifying Numeric Arguments}{8.4.5}{Numeric Arguments}{145} -@numsubsecentry{Letting Readline Type For You}{8.4.6}{Commands For Completion}{145} -@numsubsecentry{Keyboard Macros}{8.4.7}{Keyboard Macros}{147} -@numsubsecentry{Some Miscellaneous Commands}{8.4.8}{Miscellaneous Commands}{147} -@numsecentry{Readline vi Mode}{8.5}{Readline vi Mode}{149} -@numsecentry{Programmable Completion}{8.6}{Programmable Completion}{150} -@numsecentry{Programmable Completion Builtins}{8.7}{Programmable Completion Builtins}{152} -@numsecentry{A Programmable Completion Example}{8.8}{A Programmable Completion Example}{156} -@numchapentry{Using History Interactively}{9}{Using History Interactively}{159} -@numsecentry{Bash History Facilities}{9.1}{Bash History Facilities}{159} -@numsecentry{Bash History Builtins}{9.2}{Bash History Builtins}{159} -@numsecentry{History Expansion}{9.3}{History Interaction}{161} -@numsubsecentry{Event Designators}{9.3.1}{Event Designators}{162} -@numsubsecentry{Word Designators}{9.3.2}{Word Designators}{163} -@numsubsecentry{Modifiers}{9.3.3}{Modifiers}{164} -@numchapentry{Installing Bash}{10}{Installing Bash}{165} -@numsecentry{Basic Installation}{10.1}{Basic Installation}{165} -@numsecentry{Compilers and Options}{10.2}{Compilers and Options}{166} -@numsecentry{Compiling For Multiple Architectures}{10.3}{Compiling For Multiple Architectures}{166} -@numsecentry{Installation Names}{10.4}{Installation Names}{167} -@numsecentry{Specifying the System Type}{10.5}{Specifying the System Type}{167} -@numsecentry{Sharing Defaults}{10.6}{Sharing Defaults}{167} -@numsecentry{Operation Controls}{10.7}{Operation Controls}{168} -@numsecentry{Optional Features}{10.8}{Optional Features}{168} -@appentry{Reporting Bugs}{A}{Reporting Bugs}{174} -@appentry{Major Differences From The Bourne Shell}{B}{Major Differences From The Bourne Shell}{175} -@appsecentry{Implementation Differences From The SVR4.2 Shell}{B.1}{}{180} -@appentry{GNU Free Documentation License}{C}{GNU Free Documentation License}{181} -@appentry{Indexes}{D}{Indexes}{189} -@appsecentry{Index of Shell Builtin Commands}{D.1}{Builtin Index}{189} -@appsecentry{Index of Shell Reserved Words}{D.2}{Reserved Word Index}{190} -@appsecentry{Parameter and Variable Index}{D.3}{Variable Index}{191} -@appsecentry{Function Index}{D.4}{Function Index}{193} -@appsecentry{Concept Index}{D.5}{Concept Index}{195} +@numsubsecentry{Brace Expansion}{3.5.1}{Brace Expansion}{25} +@numsubsecentry{Tilde Expansion}{3.5.2}{Tilde Expansion}{26} +@numsubsecentry{Shell Parameter Expansion}{3.5.3}{Shell Parameter Expansion}{27} +@numsubsecentry{Command Substitution}{3.5.4}{Command Substitution}{35} +@numsubsecentry{Arithmetic Expansion}{3.5.5}{Arithmetic Expansion}{36} +@numsubsecentry{Process Substitution}{3.5.6}{Process Substitution}{36} +@numsubsecentry{Word Splitting}{3.5.7}{Word Splitting}{37} +@numsubsecentry{Filename Expansion}{3.5.8}{Filename Expansion}{37} +@numsubsubsecentry{Pattern Matching}{3.5.8.1}{Pattern Matching}{38} +@numsubsecentry{Quote Removal}{3.5.9}{Quote Removal}{40} +@numsecentry{Redirections}{3.6}{Redirections}{40} +@numsubsecentry{Redirecting Input}{3.6.1}{}{41} +@numsubsecentry{Redirecting Output}{3.6.2}{}{41} +@numsubsecentry{Appending Redirected Output}{3.6.3}{}{42} +@numsubsecentry{Redirecting Standard Output and Standard Error}{3.6.4}{}{42} +@numsubsecentry{Appending Standard Output and Standard Error}{3.6.5}{}{42} +@numsubsecentry{Here Documents}{3.6.6}{}{42} +@numsubsecentry{Here Strings}{3.6.7}{}{43} +@numsubsecentry{Duplicating File Descriptors}{3.6.8}{}{43} +@numsubsecentry{Moving File Descriptors}{3.6.9}{}{43} +@numsubsecentry{Opening File Descriptors for Reading and Writing}{3.6.10}{}{44} +@numsecentry{Executing Commands}{3.7}{Executing Commands}{44} +@numsubsecentry{Simple Command Expansion}{3.7.1}{Simple Command Expansion}{44} +@numsubsecentry{Command Search and Execution}{3.7.2}{Command Search and Execution}{44} +@numsubsecentry{Command Execution Environment}{3.7.3}{Command Execution Environment}{45} +@numsubsecentry{Environment}{3.7.4}{Environment}{46} +@numsubsecentry{Exit Status}{3.7.5}{Exit Status}{47} +@numsubsecentry{Signals}{3.7.6}{Signals}{47} +@numsecentry{Shell Scripts}{3.8}{Shell Scripts}{48} +@numchapentry{Shell Builtin Commands}{4}{Shell Builtin Commands}{50} +@numsecentry{Bourne Shell Builtins}{4.1}{Bourne Shell Builtins}{50} +@numsecentry{Bash Builtin Commands}{4.2}{Bash Builtins}{59} +@numsecentry{Modifying Shell Behavior}{4.3}{Modifying Shell Behavior}{71} +@numsubsecentry{The Set Builtin}{4.3.1}{The Set Builtin}{71} +@numsubsecentry{The Shopt Builtin}{4.3.2}{The Shopt Builtin}{76} +@numsecentry{Special Builtins}{4.4}{Special Builtins}{82} +@numchapentry{Shell Variables}{5}{Shell Variables}{84} +@numsecentry{Bourne Shell Variables}{5.1}{Bourne Shell Variables}{84} +@numsecentry{Bash Variables}{5.2}{Bash Variables}{85} +@numchapentry{Bash Features}{6}{Bash Features}{98} +@numsecentry{Invoking Bash}{6.1}{Invoking Bash}{98} +@numsecentry{Bash Startup Files}{6.2}{Bash Startup Files}{100} +@numsecentry{Interactive Shells}{6.3}{Interactive Shells}{102} +@numsubsecentry{What is an Interactive Shell?}{6.3.1}{What is an Interactive Shell?}{102} +@numsubsecentry{Is this Shell Interactive?}{6.3.2}{Is this Shell Interactive?}{102} +@numsubsecentry{Interactive Shell Behavior}{6.3.3}{Interactive Shell Behavior}{102} +@numsecentry{Bash Conditional Expressions}{6.4}{Bash Conditional Expressions}{103} +@numsecentry{Shell Arithmetic}{6.5}{Shell Arithmetic}{105} +@numsecentry{Aliases}{6.6}{Aliases}{107} +@numsecentry{Arrays}{6.7}{Arrays}{108} +@numsecentry{The Directory Stack}{6.8}{The Directory Stack}{110} +@numsubsecentry{Directory Stack Builtins}{6.8.1}{Directory Stack Builtins}{110} +@numsecentry{Controlling the Prompt}{6.9}{Controlling the Prompt}{111} +@numsecentry{The Restricted Shell}{6.10}{The Restricted Shell}{113} +@numsecentry{Bash and POSIX}{6.11}{Bash POSIX Mode}{114} +@numsubsecentry{What is POSIX?}{6.11.1}{}{114} +@numsubsecentry{Bash POSIX Mode}{6.11.2}{}{114} +@numsecentry{Shell Compatibility Mode}{6.12}{Shell Compatibility Mode}{119} +@numchapentry{Job Control}{7}{Job Control}{123} +@numsecentry{Job Control Basics}{7.1}{Job Control Basics}{123} +@numsecentry{Job Control Builtins}{7.2}{Job Control Builtins}{124} +@numsecentry{Job Control Variables}{7.3}{Job Control Variables}{126} +@numchapentry{Command Line Editing}{8}{Command Line Editing}{127} +@numsecentry{Introduction to Line Editing}{8.1}{Introduction and Notation}{127} +@numsecentry{Readline Interaction}{8.2}{Readline Interaction}{127} +@numsubsecentry{Readline Bare Essentials}{8.2.1}{Readline Bare Essentials}{128} +@numsubsecentry{Readline Movement Commands}{8.2.2}{Readline Movement Commands}{128} +@numsubsecentry{Readline Killing Commands}{8.2.3}{Readline Killing Commands}{129} +@numsubsecentry{Readline Arguments}{8.2.4}{Readline Arguments}{129} +@numsubsecentry{Searching for Commands in the History}{8.2.5}{Searching}{129} +@numsecentry{Readline Init File}{8.3}{Readline Init File}{130} +@numsubsecentry{Readline Init File Syntax}{8.3.1}{Readline Init File Syntax}{130} +@numsubsecentry{Conditional Init Constructs}{8.3.2}{Conditional Init Constructs}{140} +@numsubsecentry{Sample Init File}{8.3.3}{Sample Init File}{141} +@numsecentry{Bindable Readline Commands}{8.4}{Bindable Readline Commands}{144} +@numsubsecentry{Commands For Moving}{8.4.1}{Commands For Moving}{144} +@numsubsecentry{Commands For Manipulating The History}{8.4.2}{Commands For History}{145} +@numsubsecentry{Commands For Changing Text}{8.4.3}{Commands For Text}{147} +@numsubsecentry{Killing And Yanking}{8.4.4}{Commands For Killing}{148} +@numsubsecentry{Specifying Numeric Arguments}{8.4.5}{Numeric Arguments}{150} +@numsubsecentry{Letting Readline Type For You}{8.4.6}{Commands For Completion}{150} +@numsubsecentry{Keyboard Macros}{8.4.7}{Keyboard Macros}{152} +@numsubsecentry{Some Miscellaneous Commands}{8.4.8}{Miscellaneous Commands}{152} +@numsecentry{Readline vi Mode}{8.5}{Readline vi Mode}{154} +@numsecentry{Programmable Completion}{8.6}{Programmable Completion}{155} +@numsecentry{Programmable Completion Builtins}{8.7}{Programmable Completion Builtins}{157} +@numsecentry{A Programmable Completion Example}{8.8}{A Programmable Completion Example}{161} +@numchapentry{Using History Interactively}{9}{Using History Interactively}{164} +@numsecentry{Bash History Facilities}{9.1}{Bash History Facilities}{164} +@numsecentry{Bash History Builtins}{9.2}{Bash History Builtins}{165} +@numsecentry{History Expansion}{9.3}{History Interaction}{167} +@numsubsecentry{Event Designators}{9.3.1}{Event Designators}{168} +@numsubsecentry{Word Designators}{9.3.2}{Word Designators}{169} +@numsubsecentry{Modifiers}{9.3.3}{Modifiers}{169} +@numchapentry{Installing Bash}{10}{Installing Bash}{171} +@numsecentry{Basic Installation}{10.1}{Basic Installation}{171} +@numsecentry{Compilers and Options}{10.2}{Compilers and Options}{172} +@numsecentry{Compiling For Multiple Architectures}{10.3}{Compiling For Multiple Architectures}{172} +@numsecentry{Installation Names}{10.4}{Installation Names}{173} +@numsecentry{Specifying the System Type}{10.5}{Specifying the System Type}{173} +@numsecentry{Sharing Defaults}{10.6}{Sharing Defaults}{173} +@numsecentry{Operation Controls}{10.7}{Operation Controls}{174} +@numsecentry{Optional Features}{10.8}{Optional Features}{174} +@appentry{Reporting Bugs}{A}{Reporting Bugs}{180} +@appentry{Major Differences From The Bourne Shell}{B}{Major Differences From The Bourne Shell}{181} +@appsecentry{Implementation Differences From The SVR4.2 Shell}{B.1}{}{186} +@appentry{GNU Free Documentation License}{C}{GNU Free Documentation License}{187} +@appentry{Indexes}{D}{Indexes}{195} +@appsecentry{Index of Shell Builtin Commands}{D.1}{Builtin Index}{195} +@appsecentry{Index of Shell Reserved Words}{D.2}{Reserved Word Index}{196} +@appsecentry{Parameter and Variable Index}{D.3}{Variable Index}{197} +@appsecentry{Function Index}{D.4}{Function Index}{199} +@appsecentry{Concept Index}{D.5}{Concept Index}{201} diff --git a/doc/bashref.vr b/doc/bashref.vr index ae3b87e1..0d2150c3 100644 --- a/doc/bashref.vr +++ b/doc/bashref.vr @@ -4,174 +4,175 @@ \entry{TEXTDOMAINDIR}{8}{\code {TEXTDOMAINDIR}} \entry{*}{23}{\code {*}} \entry{$*}{23}{\code {$*}} -\entry{@}{23}{\code {@}} -\entry{$@}{23}{\code {$@}} -\entry{#}{23}{\code {#}} -\entry{$#}{23}{\code {$#}} -\entry{?}{23}{\code {?}} -\entry{$?}{23}{\code {$?}} -\entry{-}{23}{\code {-}} -\entry{$-}{23}{\code {$-}} -\entry{$}{23}{\code {$}} -\entry{$$}{23}{\code {$$}} +\entry{@}{24}{\code {@}} +\entry{$@}{24}{\code {$@}} +\entry{#}{24}{\code {#}} +\entry{$#}{24}{\code {$#}} +\entry{?}{24}{\code {?}} +\entry{$?}{24}{\code {$?}} +\entry{-}{24}{\code {-}} +\entry{$-}{24}{\code {$-}} +\entry{$}{24}{\code {$}} +\entry{$$}{24}{\code {$$}} \entry{!}{24}{\code {!}} \entry{$!}{24}{\code {$!}} \entry{0}{24}{\code {0}} \entry{$0}{24}{\code {$0}} -\entry{CDPATH}{81}{\code {CDPATH}} -\entry{HOME}{81}{\code {HOME}} -\entry{IFS}{81}{\code {IFS}} -\entry{MAIL}{81}{\code {MAIL}} -\entry{MAILPATH}{81}{\code {MAILPATH}} -\entry{OPTARG}{81}{\code {OPTARG}} -\entry{OPTIND}{81}{\code {OPTIND}} -\entry{PATH}{81}{\code {PATH}} -\entry{PS1}{81}{\code {PS1}} -\entry{PS2}{81}{\code {PS2}} -\entry{_}{81}{\code {_}} -\entry{$_}{81}{\code {$_}} -\entry{BASH}{82}{\code {BASH}} -\entry{BASHOPTS}{82}{\code {BASHOPTS}} -\entry{BASHPID}{82}{\code {BASHPID}} -\entry{BASH_ALIASES}{82}{\code {BASH_ALIASES}} -\entry{BASH_ARGC}{82}{\code {BASH_ARGC}} -\entry{BASH_ARGV}{82}{\code {BASH_ARGV}} -\entry{BASH_ARGV0}{83}{\code {BASH_ARGV0}} -\entry{BASH_CMDS}{83}{\code {BASH_CMDS}} -\entry{BASH_COMMAND}{83}{\code {BASH_COMMAND}} -\entry{BASH_COMPAT}{83}{\code {BASH_COMPAT}} -\entry{BASH_ENV}{83}{\code {BASH_ENV}} -\entry{BASH_EXECUTION_STRING}{83}{\code {BASH_EXECUTION_STRING}} -\entry{BASH_LINENO}{83}{\code {BASH_LINENO}} -\entry{BASH_LOADABLES_PATH}{84}{\code {BASH_LOADABLES_PATH}} -\entry{BASH_MONOSECONDS}{84}{\code {BASH_MONOSECONDS}} -\entry{BASH_REMATCH}{84}{\code {BASH_REMATCH}} -\entry{BASH_SOURCE}{84}{\code {BASH_SOURCE}} -\entry{BASH_SUBSHELL}{84}{\code {BASH_SUBSHELL}} -\entry{BASH_TRAPSIG}{84}{\code {BASH_TRAPSIG}} -\entry{BASH_VERSINFO}{84}{\code {BASH_VERSINFO}} -\entry{BASH_VERSION}{85}{\code {BASH_VERSION}} -\entry{BASH_XTRACEFD}{85}{\code {BASH_XTRACEFD}} -\entry{CHILD_MAX}{85}{\code {CHILD_MAX}} -\entry{COLUMNS}{85}{\code {COLUMNS}} -\entry{COMP_CWORD}{85}{\code {COMP_CWORD}} -\entry{COMP_LINE}{85}{\code {COMP_LINE}} -\entry{COMP_POINT}{85}{\code {COMP_POINT}} -\entry{COMP_TYPE}{85}{\code {COMP_TYPE}} -\entry{COMP_KEY}{86}{\code {COMP_KEY}} -\entry{COMP_WORDBREAKS}{86}{\code {COMP_WORDBREAKS}} -\entry{COMP_WORDS}{86}{\code {COMP_WORDS}} -\entry{COMPREPLY}{86}{\code {COMPREPLY}} -\entry{COPROC}{86}{\code {COPROC}} -\entry{DIRSTACK}{86}{\code {DIRSTACK}} -\entry{EMACS}{86}{\code {EMACS}} -\entry{ENV}{86}{\code {ENV}} -\entry{EPOCHREALTIME}{86}{\code {EPOCHREALTIME}} -\entry{EPOCHSECONDS}{86}{\code {EPOCHSECONDS}} -\entry{EUID}{87}{\code {EUID}} -\entry{EXECIGNORE}{87}{\code {EXECIGNORE}} -\entry{FCEDIT}{87}{\code {FCEDIT}} -\entry{FIGNORE}{87}{\code {FIGNORE}} -\entry{FUNCNAME}{87}{\code {FUNCNAME}} -\entry{FUNCNEST}{87}{\code {FUNCNEST}} -\entry{GLOBIGNORE}{87}{\code {GLOBIGNORE}} -\entry{GLOBSORT}{87}{\code {GLOBSORT}} -\entry{GROUPS}{88}{\code {GROUPS}} -\entry{histchars}{88}{\code {histchars}} -\entry{HISTCMD}{88}{\code {HISTCMD}} -\entry{HISTCONTROL}{88}{\code {HISTCONTROL}} -\entry{HISTFILE}{89}{\code {HISTFILE}} -\entry{HISTFILESIZE}{89}{\code {HISTFILESIZE}} -\entry{HISTIGNORE}{89}{\code {HISTIGNORE}} -\entry{HISTSIZE}{89}{\code {HISTSIZE}} -\entry{HISTTIMEFORMAT}{89}{\code {HISTTIMEFORMAT}} -\entry{HOSTFILE}{89}{\code {HOSTFILE}} -\entry{HOSTNAME}{90}{\code {HOSTNAME}} -\entry{HOSTTYPE}{90}{\code {HOSTTYPE}} -\entry{IGNOREEOF}{90}{\code {IGNOREEOF}} -\entry{INPUTRC}{90}{\code {INPUTRC}} -\entry{INSIDE_EMACS}{90}{\code {INSIDE_EMACS}} -\entry{LANG}{90}{\code {LANG}} -\entry{LC_ALL}{90}{\code {LC_ALL}} -\entry{LC_COLLATE}{90}{\code {LC_COLLATE}} -\entry{LC_CTYPE}{90}{\code {LC_CTYPE}} -\entry{LC_MESSAGES}{90}{\code {LC_MESSAGES}} -\entry{LC_NUMERIC}{90}{\code {LC_NUMERIC}} -\entry{LC_TIME}{90}{\code {LC_TIME}} -\entry{LINENO}{90}{\code {LINENO}} -\entry{LINES}{90}{\code {LINES}} -\entry{MACHTYPE}{91}{\code {MACHTYPE}} -\entry{MAILCHECK}{91}{\code {MAILCHECK}} -\entry{MAPFILE}{91}{\code {MAPFILE}} -\entry{OLDPWD}{91}{\code {OLDPWD}} -\entry{OPTERR}{91}{\code {OPTERR}} -\entry{OSTYPE}{91}{\code {OSTYPE}} -\entry{PIPESTATUS}{91}{\code {PIPESTATUS}} -\entry{POSIXLY_CORRECT}{91}{\code {POSIXLY_CORRECT}} -\entry{PPID}{91}{\code {PPID}} -\entry{PROMPT_COMMAND}{91}{\code {PROMPT_COMMAND}} -\entry{PROMPT_DIRTRIM}{91}{\code {PROMPT_DIRTRIM}} -\entry{PS0}{91}{\code {PS0}} -\entry{PS3}{91}{\code {PS3}} -\entry{PS4}{92}{\code {PS4}} -\entry{PWD}{92}{\code {PWD}} -\entry{RANDOM}{92}{\code {RANDOM}} -\entry{READLINE_ARGUMENT}{92}{\code {READLINE_ARGUMENT}} -\entry{READLINE_LINE}{92}{\code {READLINE_LINE}} -\entry{READLINE_MARK}{92}{\code {READLINE_MARK}} -\entry{READLINE_POINT}{92}{\code {READLINE_POINT}} -\entry{REPLY}{92}{\code {REPLY}} -\entry{SECONDS}{92}{\code {SECONDS}} -\entry{SHELL}{92}{\code {SHELL}} -\entry{SHELLOPTS}{92}{\code {SHELLOPTS}} -\entry{SHLVL}{92}{\code {SHLVL}} -\entry{SRANDOM}{93}{\code {SRANDOM}} -\entry{TIMEFORMAT}{93}{\code {TIMEFORMAT}} -\entry{TMOUT}{93}{\code {TMOUT}} -\entry{TMPDIR}{93}{\code {TMPDIR}} -\entry{UID}{93}{\code {UID}} -\entry{auto_resume}{121}{\code {auto_resume}} -\entry{active-region-start-color}{126}{\code {active-region-start-color}} -\entry{active-region-end-color}{126}{\code {active-region-end-color}} -\entry{bell-style}{126}{\code {bell-style}} -\entry{bind-tty-special-chars}{126}{\code {bind-tty-special-chars}} -\entry{blink-matching-paren}{127}{\code {blink-matching-paren}} -\entry{colored-completion-prefix}{127}{\code {colored-completion-prefix}} -\entry{colored-stats}{127}{\code {colored-stats}} -\entry{comment-begin}{127}{\code {comment-begin}} -\entry{completion-display-width}{127}{\code {completion-display-width}} -\entry{completion-ignore-case}{127}{\code {completion-ignore-case}} -\entry{completion-map-case}{127}{\code {completion-map-case}} -\entry{completion-prefix-display-length}{127}{\code {completion-prefix-display-length}} -\entry{completion-query-items}{127}{\code {completion-query-items}} -\entry{convert-meta}{128}{\code {convert-meta}} -\entry{disable-completion}{128}{\code {disable-completion}} -\entry{echo-control-characters}{128}{\code {echo-control-characters}} -\entry{editing-mode}{128}{\code {editing-mode}} -\entry{emacs-mode-string}{128}{\code {emacs-mode-string}} -\entry{enable-active-region}{128}{\code {enable-active-region}} -\entry{enable-bracketed-paste}{129}{\code {enable-bracketed-paste}} -\entry{enable-keypad}{129}{\code {enable-keypad}} -\entry{expand-tilde}{129}{\code {expand-tilde}} -\entry{history-preserve-point}{129}{\code {history-preserve-point}} -\entry{history-size}{129}{\code {history-size}} -\entry{horizontal-scroll-mode}{129}{\code {horizontal-scroll-mode}} -\entry{input-meta}{130}{\code {input-meta}} -\entry{meta-flag}{130}{\code {meta-flag}} -\entry{isearch-terminators}{130}{\code {isearch-terminators}} -\entry{keymap}{130}{\code {keymap}} -\entry{mark-modified-lines}{130}{\code {mark-modified-lines}} -\entry{mark-symlinked-directories}{130}{\code {mark-symlinked-directories}} -\entry{match-hidden-files}{131}{\code {match-hidden-files}} -\entry{menu-complete-display-prefix}{131}{\code {menu-complete-display-prefix}} -\entry{output-meta}{131}{\code {output-meta}} -\entry{page-completions}{131}{\code {page-completions}} -\entry{revert-all-at-newline}{131}{\code {revert-all-at-newline}} -\entry{search-ignore-case}{131}{\code {search-ignore-case}} -\entry{show-all-if-ambiguous}{131}{\code {show-all-if-ambiguous}} -\entry{show-all-if-unmodified}{131}{\code {show-all-if-unmodified}} -\entry{show-mode-in-prompt}{132}{\code {show-mode-in-prompt}} -\entry{skip-completed-text}{132}{\code {skip-completed-text}} -\entry{vi-cmd-mode-string}{132}{\code {vi-cmd-mode-string}} -\entry{vi-ins-mode-string}{132}{\code {vi-ins-mode-string}} -\entry{visible-stats}{132}{\code {visible-stats}} +\entry{CDPATH}{84}{\code {CDPATH}} +\entry{HOME}{84}{\code {HOME}} +\entry{IFS}{84}{\code {IFS}} +\entry{MAIL}{84}{\code {MAIL}} +\entry{MAILPATH}{84}{\code {MAILPATH}} +\entry{OPTARG}{84}{\code {OPTARG}} +\entry{OPTIND}{84}{\code {OPTIND}} +\entry{PATH}{84}{\code {PATH}} +\entry{PS1}{84}{\code {PS1}} +\entry{PS2}{84}{\code {PS2}} +\entry{_}{85}{\code {_}} +\entry{$_}{85}{\code {$_}} +\entry{BASH}{85}{\code {BASH}} +\entry{BASHOPTS}{85}{\code {BASHOPTS}} +\entry{BASHPID}{85}{\code {BASHPID}} +\entry{BASH_ALIASES}{85}{\code {BASH_ALIASES}} +\entry{BASH_ARGC}{85}{\code {BASH_ARGC}} +\entry{BASH_ARGV}{85}{\code {BASH_ARGV}} +\entry{BASH_ARGV0}{86}{\code {BASH_ARGV0}} +\entry{BASH_CMDS}{86}{\code {BASH_CMDS}} +\entry{BASH_COMMAND}{86}{\code {BASH_COMMAND}} +\entry{BASH_COMPAT}{86}{\code {BASH_COMPAT}} +\entry{BASH_ENV}{86}{\code {BASH_ENV}} +\entry{BASH_EXECUTION_STRING}{86}{\code {BASH_EXECUTION_STRING}} +\entry{BASH_LINENO}{87}{\code {BASH_LINENO}} +\entry{BASH_LOADABLES_PATH}{87}{\code {BASH_LOADABLES_PATH}} +\entry{BASH_MONOSECONDS}{87}{\code {BASH_MONOSECONDS}} +\entry{BASH_REMATCH}{87}{\code {BASH_REMATCH}} +\entry{BASH_SOURCE}{87}{\code {BASH_SOURCE}} +\entry{BASH_SUBSHELL}{87}{\code {BASH_SUBSHELL}} +\entry{BASH_TRAPSIG}{87}{\code {BASH_TRAPSIG}} +\entry{BASH_VERSINFO}{87}{\code {BASH_VERSINFO}} +\entry{BASH_VERSION}{88}{\code {BASH_VERSION}} +\entry{BASH_XTRACEFD}{88}{\code {BASH_XTRACEFD}} +\entry{CHILD_MAX}{88}{\code {CHILD_MAX}} +\entry{COLUMNS}{88}{\code {COLUMNS}} +\entry{COMP_CWORD}{88}{\code {COMP_CWORD}} +\entry{COMP_KEY}{88}{\code {COMP_KEY}} +\entry{COMP_LINE}{88}{\code {COMP_LINE}} +\entry{COMP_POINT}{89}{\code {COMP_POINT}} +\entry{COMP_TYPE}{89}{\code {COMP_TYPE}} +\entry{COMP_WORDBREAKS}{89}{\code {COMP_WORDBREAKS}} +\entry{COMP_WORDS}{89}{\code {COMP_WORDS}} +\entry{COMPREPLY}{89}{\code {COMPREPLY}} +\entry{COPROC}{89}{\code {COPROC}} +\entry{DIRSTACK}{89}{\code {DIRSTACK}} +\entry{EMACS}{89}{\code {EMACS}} +\entry{ENV}{89}{\code {ENV}} +\entry{EPOCHREALTIME}{90}{\code {EPOCHREALTIME}} +\entry{EPOCHSECONDS}{90}{\code {EPOCHSECONDS}} +\entry{EUID}{90}{\code {EUID}} +\entry{EXECIGNORE}{90}{\code {EXECIGNORE}} +\entry{FCEDIT}{90}{\code {FCEDIT}} +\entry{FIGNORE}{90}{\code {FIGNORE}} +\entry{FUNCNAME}{90}{\code {FUNCNAME}} +\entry{FUNCNEST}{90}{\code {FUNCNEST}} +\entry{GLOBIGNORE}{90}{\code {GLOBIGNORE}} +\entry{GLOBSORT}{91}{\code {GLOBSORT}} +\entry{GROUPS}{91}{\code {GROUPS}} +\entry{histchars}{91}{\code {histchars}} +\entry{HISTCMD}{91}{\code {HISTCMD}} +\entry{HISTCONTROL}{91}{\code {HISTCONTROL}} +\entry{HISTFILE}{92}{\code {HISTFILE}} +\entry{HISTFILESIZE}{92}{\code {HISTFILESIZE}} +\entry{HISTIGNORE}{92}{\code {HISTIGNORE}} +\entry{HISTSIZE}{92}{\code {HISTSIZE}} +\entry{HISTTIMEFORMAT}{93}{\code {HISTTIMEFORMAT}} +\entry{HOSTFILE}{93}{\code {HOSTFILE}} +\entry{HOSTNAME}{93}{\code {HOSTNAME}} +\entry{HOSTTYPE}{93}{\code {HOSTTYPE}} +\entry{IGNOREEOF}{93}{\code {IGNOREEOF}} +\entry{INPUTRC}{93}{\code {INPUTRC}} +\entry{INSIDE_EMACS}{93}{\code {INSIDE_EMACS}} +\entry{LANG}{93}{\code {LANG}} +\entry{LC_ALL}{93}{\code {LC_ALL}} +\entry{LC_COLLATE}{93}{\code {LC_COLLATE}} +\entry{LC_CTYPE}{93}{\code {LC_CTYPE}} +\entry{LC_MESSAGES}{94}{\code {LC_MESSAGES}} +\entry{LC_NUMERIC}{94}{\code {LC_NUMERIC}} +\entry{LC_TIME}{94}{\code {LC_TIME}} +\entry{LINENO}{94}{\code {LINENO}} +\entry{LINES}{94}{\code {LINES}} +\entry{MACHTYPE}{94}{\code {MACHTYPE}} +\entry{MAILCHECK}{94}{\code {MAILCHECK}} +\entry{MAPFILE}{94}{\code {MAPFILE}} +\entry{OLDPWD}{94}{\code {OLDPWD}} +\entry{OPTERR}{94}{\code {OPTERR}} +\entry{OSTYPE}{94}{\code {OSTYPE}} +\entry{PIPESTATUS}{94}{\code {PIPESTATUS}} +\entry{POSIXLY_CORRECT}{94}{\code {POSIXLY_CORRECT}} +\entry{PPID}{95}{\code {PPID}} +\entry{PROMPT_COMMAND}{95}{\code {PROMPT_COMMAND}} +\entry{PROMPT_DIRTRIM}{95}{\code {PROMPT_DIRTRIM}} +\entry{PS0}{95}{\code {PS0}} +\entry{PS3}{95}{\code {PS3}} +\entry{PS4}{95}{\code {PS4}} +\entry{PWD}{95}{\code {PWD}} +\entry{RANDOM}{95}{\code {RANDOM}} +\entry{READLINE_ARGUMENT}{95}{\code {READLINE_ARGUMENT}} +\entry{READLINE_LINE}{95}{\code {READLINE_LINE}} +\entry{READLINE_MARK}{95}{\code {READLINE_MARK}} +\entry{READLINE_POINT}{95}{\code {READLINE_POINT}} +\entry{REPLY}{95}{\code {REPLY}} +\entry{SECONDS}{95}{\code {SECONDS}} +\entry{SHELL}{96}{\code {SHELL}} +\entry{SHELLOPTS}{96}{\code {SHELLOPTS}} +\entry{SHLVL}{96}{\code {SHLVL}} +\entry{SRANDOM}{96}{\code {SRANDOM}} +\entry{TIMEFORMAT}{96}{\code {TIMEFORMAT}} +\entry{TMOUT}{97}{\code {TMOUT}} +\entry{TMPDIR}{97}{\code {TMPDIR}} +\entry{UID}{97}{\code {UID}} +\entry{auto_resume}{126}{\code {auto_resume}} +\entry{active-region-start-color}{131}{\code {active-region-start-color}} +\entry{active-region-end-color}{131}{\code {active-region-end-color}} +\entry{bell-style}{131}{\code {bell-style}} +\entry{bind-tty-special-chars}{131}{\code {bind-tty-special-chars}} +\entry{blink-matching-paren}{132}{\code {blink-matching-paren}} +\entry{colored-completion-prefix}{132}{\code {colored-completion-prefix}} +\entry{colored-stats}{132}{\code {colored-stats}} +\entry{comment-begin}{132}{\code {comment-begin}} +\entry{completion-display-width}{132}{\code {completion-display-width}} +\entry{completion-ignore-case}{132}{\code {completion-ignore-case}} +\entry{completion-map-case}{132}{\code {completion-map-case}} +\entry{completion-prefix-display-length}{132}{\code {completion-prefix-display-length}} +\entry{completion-query-items}{132}{\code {completion-query-items}} +\entry{convert-meta}{133}{\code {convert-meta}} +\entry{disable-completion}{133}{\code {disable-completion}} +\entry{echo-control-characters}{133}{\code {echo-control-characters}} +\entry{editing-mode}{133}{\code {editing-mode}} +\entry{emacs-mode-string}{133}{\code {emacs-mode-string}} +\entry{enable-active-region}{133}{\code {enable-active-region}} +\entry{enable-bracketed-paste}{134}{\code {enable-bracketed-paste}} +\entry{enable-keypad}{134}{\code {enable-keypad}} +\entry{expand-tilde}{134}{\code {expand-tilde}} +\entry{force-meta-prefix}{134}{\code {force-meta-prefix}} +\entry{history-preserve-point}{134}{\code {history-preserve-point}} +\entry{history-size}{135}{\code {history-size}} +\entry{horizontal-scroll-mode}{135}{\code {horizontal-scroll-mode}} +\entry{input-meta}{135}{\code {input-meta}} +\entry{meta-flag}{135}{\code {meta-flag}} +\entry{isearch-terminators}{135}{\code {isearch-terminators}} +\entry{keymap}{135}{\code {keymap}} +\entry{mark-modified-lines}{136}{\code {mark-modified-lines}} +\entry{mark-symlinked-directories}{136}{\code {mark-symlinked-directories}} +\entry{match-hidden-files}{136}{\code {match-hidden-files}} +\entry{menu-complete-display-prefix}{136}{\code {menu-complete-display-prefix}} +\entry{output-meta}{136}{\code {output-meta}} +\entry{page-completions}{136}{\code {page-completions}} +\entry{revert-all-at-newline}{137}{\code {revert-all-at-newline}} +\entry{search-ignore-case}{137}{\code {search-ignore-case}} +\entry{show-all-if-ambiguous}{137}{\code {show-all-if-ambiguous}} +\entry{show-all-if-unmodified}{137}{\code {show-all-if-unmodified}} +\entry{show-mode-in-prompt}{137}{\code {show-mode-in-prompt}} +\entry{skip-completed-text}{137}{\code {skip-completed-text}} +\entry{vi-cmd-mode-string}{137}{\code {vi-cmd-mode-string}} +\entry{vi-ins-mode-string}{138}{\code {vi-ins-mode-string}} +\entry{visible-stats}{138}{\code {visible-stats}} diff --git a/doc/bashref.vrs b/doc/bashref.vrs index cce96799..01af45eb 100644 --- a/doc/bashref.vrs +++ b/doc/bashref.vrs @@ -1,203 +1,204 @@ \initial {!} \entry{\code {!}}{24} \initial {#} -\entry{\code {#}}{23} +\entry{\code {#}}{24} \initial {$} -\entry{\code {$}}{23} +\entry{\code {$}}{24} \entry{\code {$!}}{24} -\entry{\code {$#}}{23} -\entry{\code {$$}}{23} +\entry{\code {$#}}{24} +\entry{\code {$$}}{24} \entry{\code {$*}}{23} -\entry{\code {$-}}{23} -\entry{\code {$?}}{23} -\entry{\code {$@}}{23} -\entry{\code {$_}}{81} +\entry{\code {$-}}{24} +\entry{\code {$?}}{24} +\entry{\code {$@}}{24} +\entry{\code {$_}}{85} \entry{\code {$0}}{24} \initial {*} \entry{\code {*}}{23} \initial {-} -\entry{\code {-}}{23} +\entry{\code {-}}{24} \initial {?} -\entry{\code {?}}{23} +\entry{\code {?}}{24} \initial {@} -\entry{\code {@}}{23} +\entry{\code {@}}{24} \initial {_} -\entry{\code {_}}{81} +\entry{\code {_}}{85} \initial {0} \entry{\code {0}}{24} \initial {A} -\entry{\code {active-region-end-color}}{126} -\entry{\code {active-region-start-color}}{126} -\entry{\code {auto_resume}}{121} +\entry{\code {active-region-end-color}}{131} +\entry{\code {active-region-start-color}}{131} +\entry{\code {auto_resume}}{126} \initial {B} -\entry{\code {BASH}}{82} -\entry{\code {BASH_ALIASES}}{82} -\entry{\code {BASH_ARGC}}{82} -\entry{\code {BASH_ARGV}}{82} -\entry{\code {BASH_ARGV0}}{83} -\entry{\code {BASH_CMDS}}{83} -\entry{\code {BASH_COMMAND}}{83} -\entry{\code {BASH_COMPAT}}{83} -\entry{\code {BASH_ENV}}{83} -\entry{\code {BASH_EXECUTION_STRING}}{83} -\entry{\code {BASH_LINENO}}{83} -\entry{\code {BASH_LOADABLES_PATH}}{84} -\entry{\code {BASH_MONOSECONDS}}{84} -\entry{\code {BASH_REMATCH}}{84} -\entry{\code {BASH_SOURCE}}{84} -\entry{\code {BASH_SUBSHELL}}{84} -\entry{\code {BASH_TRAPSIG}}{84} -\entry{\code {BASH_VERSINFO}}{84} -\entry{\code {BASH_VERSION}}{85} -\entry{\code {BASH_XTRACEFD}}{85} -\entry{\code {BASHOPTS}}{82} -\entry{\code {BASHPID}}{82} -\entry{\code {bell-style}}{126} -\entry{\code {bind-tty-special-chars}}{126} -\entry{\code {blink-matching-paren}}{127} +\entry{\code {BASH}}{85} +\entry{\code {BASH_ALIASES}}{85} +\entry{\code {BASH_ARGC}}{85} +\entry{\code {BASH_ARGV}}{85} +\entry{\code {BASH_ARGV0}}{86} +\entry{\code {BASH_CMDS}}{86} +\entry{\code {BASH_COMMAND}}{86} +\entry{\code {BASH_COMPAT}}{86} +\entry{\code {BASH_ENV}}{86} +\entry{\code {BASH_EXECUTION_STRING}}{86} +\entry{\code {BASH_LINENO}}{87} +\entry{\code {BASH_LOADABLES_PATH}}{87} +\entry{\code {BASH_MONOSECONDS}}{87} +\entry{\code {BASH_REMATCH}}{87} +\entry{\code {BASH_SOURCE}}{87} +\entry{\code {BASH_SUBSHELL}}{87} +\entry{\code {BASH_TRAPSIG}}{87} +\entry{\code {BASH_VERSINFO}}{87} +\entry{\code {BASH_VERSION}}{88} +\entry{\code {BASH_XTRACEFD}}{88} +\entry{\code {BASHOPTS}}{85} +\entry{\code {BASHPID}}{85} +\entry{\code {bell-style}}{131} +\entry{\code {bind-tty-special-chars}}{131} +\entry{\code {blink-matching-paren}}{132} \initial {C} -\entry{\code {CDPATH}}{81} -\entry{\code {CHILD_MAX}}{85} -\entry{\code {colored-completion-prefix}}{127} -\entry{\code {colored-stats}}{127} -\entry{\code {COLUMNS}}{85} -\entry{\code {comment-begin}}{127} -\entry{\code {COMP_CWORD}}{85} -\entry{\code {COMP_KEY}}{86} -\entry{\code {COMP_LINE}}{85} -\entry{\code {COMP_POINT}}{85} -\entry{\code {COMP_TYPE}}{85} -\entry{\code {COMP_WORDBREAKS}}{86} -\entry{\code {COMP_WORDS}}{86} -\entry{\code {completion-display-width}}{127} -\entry{\code {completion-ignore-case}}{127} -\entry{\code {completion-map-case}}{127} -\entry{\code {completion-prefix-display-length}}{127} -\entry{\code {completion-query-items}}{127} -\entry{\code {COMPREPLY}}{86} -\entry{\code {convert-meta}}{128} -\entry{\code {COPROC}}{86} +\entry{\code {CDPATH}}{84} +\entry{\code {CHILD_MAX}}{88} +\entry{\code {colored-completion-prefix}}{132} +\entry{\code {colored-stats}}{132} +\entry{\code {COLUMNS}}{88} +\entry{\code {comment-begin}}{132} +\entry{\code {COMP_CWORD}}{88} +\entry{\code {COMP_KEY}}{88} +\entry{\code {COMP_LINE}}{88} +\entry{\code {COMP_POINT}}{89} +\entry{\code {COMP_TYPE}}{89} +\entry{\code {COMP_WORDBREAKS}}{89} +\entry{\code {COMP_WORDS}}{89} +\entry{\code {completion-display-width}}{132} +\entry{\code {completion-ignore-case}}{132} +\entry{\code {completion-map-case}}{132} +\entry{\code {completion-prefix-display-length}}{132} +\entry{\code {completion-query-items}}{132} +\entry{\code {COMPREPLY}}{89} +\entry{\code {convert-meta}}{133} +\entry{\code {COPROC}}{89} \initial {D} -\entry{\code {DIRSTACK}}{86} -\entry{\code {disable-completion}}{128} +\entry{\code {DIRSTACK}}{89} +\entry{\code {disable-completion}}{133} \initial {E} -\entry{\code {echo-control-characters}}{128} -\entry{\code {editing-mode}}{128} -\entry{\code {emacs-mode-string}}{128} -\entry{\code {EMACS}}{86} -\entry{\code {enable-active-region}}{128} -\entry{\code {enable-bracketed-paste}}{129} -\entry{\code {enable-keypad}}{129} -\entry{\code {ENV}}{86} -\entry{\code {EPOCHREALTIME}}{86} -\entry{\code {EPOCHSECONDS}}{86} -\entry{\code {EUID}}{87} -\entry{\code {EXECIGNORE}}{87} -\entry{\code {expand-tilde}}{129} +\entry{\code {echo-control-characters}}{133} +\entry{\code {editing-mode}}{133} +\entry{\code {emacs-mode-string}}{133} +\entry{\code {EMACS}}{89} +\entry{\code {enable-active-region}}{133} +\entry{\code {enable-bracketed-paste}}{134} +\entry{\code {enable-keypad}}{134} +\entry{\code {ENV}}{89} +\entry{\code {EPOCHREALTIME}}{90} +\entry{\code {EPOCHSECONDS}}{90} +\entry{\code {EUID}}{90} +\entry{\code {EXECIGNORE}}{90} +\entry{\code {expand-tilde}}{134} \initial {F} -\entry{\code {FCEDIT}}{87} -\entry{\code {FIGNORE}}{87} -\entry{\code {FUNCNAME}}{87} -\entry{\code {FUNCNEST}}{87} +\entry{\code {FCEDIT}}{90} +\entry{\code {FIGNORE}}{90} +\entry{\code {force-meta-prefix}}{134} +\entry{\code {FUNCNAME}}{90} +\entry{\code {FUNCNEST}}{90} \initial {G} -\entry{\code {GLOBIGNORE}}{87} -\entry{\code {GLOBSORT}}{87} -\entry{\code {GROUPS}}{88} +\entry{\code {GLOBIGNORE}}{90} +\entry{\code {GLOBSORT}}{91} +\entry{\code {GROUPS}}{91} \initial {H} -\entry{\code {histchars}}{88} -\entry{\code {HISTCMD}}{88} -\entry{\code {HISTCONTROL}}{88} -\entry{\code {HISTFILE}}{89} -\entry{\code {HISTFILESIZE}}{89} -\entry{\code {HISTIGNORE}}{89} -\entry{\code {history-preserve-point}}{129} -\entry{\code {history-size}}{129} -\entry{\code {HISTSIZE}}{89} -\entry{\code {HISTTIMEFORMAT}}{89} -\entry{\code {HOME}}{81} -\entry{\code {horizontal-scroll-mode}}{129} -\entry{\code {HOSTFILE}}{89} -\entry{\code {HOSTNAME}}{90} -\entry{\code {HOSTTYPE}}{90} +\entry{\code {histchars}}{91} +\entry{\code {HISTCMD}}{91} +\entry{\code {HISTCONTROL}}{91} +\entry{\code {HISTFILE}}{92} +\entry{\code {HISTFILESIZE}}{92} +\entry{\code {HISTIGNORE}}{92} +\entry{\code {history-preserve-point}}{134} +\entry{\code {history-size}}{135} +\entry{\code {HISTSIZE}}{92} +\entry{\code {HISTTIMEFORMAT}}{93} +\entry{\code {HOME}}{84} +\entry{\code {horizontal-scroll-mode}}{135} +\entry{\code {HOSTFILE}}{93} +\entry{\code {HOSTNAME}}{93} +\entry{\code {HOSTTYPE}}{93} \initial {I} -\entry{\code {IFS}}{81} -\entry{\code {IGNOREEOF}}{90} -\entry{\code {input-meta}}{130} -\entry{\code {INPUTRC}}{90} -\entry{\code {INSIDE_EMACS}}{90} -\entry{\code {isearch-terminators}}{130} +\entry{\code {IFS}}{84} +\entry{\code {IGNOREEOF}}{93} +\entry{\code {input-meta}}{135} +\entry{\code {INPUTRC}}{93} +\entry{\code {INSIDE_EMACS}}{93} +\entry{\code {isearch-terminators}}{135} \initial {K} -\entry{\code {keymap}}{130} +\entry{\code {keymap}}{135} \initial {L} -\entry{\code {LANG}}{8, 90} -\entry{\code {LC_ALL}}{90} -\entry{\code {LC_COLLATE}}{90} -\entry{\code {LC_CTYPE}}{90} -\entry{\code {LC_MESSAGES}}{8, 90} -\entry{\code {LC_NUMERIC}}{90} -\entry{\code {LC_TIME}}{90} -\entry{\code {LINENO}}{90} -\entry{\code {LINES}}{90} +\entry{\code {LANG}}{8, 93} +\entry{\code {LC_ALL}}{93} +\entry{\code {LC_COLLATE}}{93} +\entry{\code {LC_CTYPE}}{93} +\entry{\code {LC_MESSAGES}}{8, 94} +\entry{\code {LC_NUMERIC}}{94} +\entry{\code {LC_TIME}}{94} +\entry{\code {LINENO}}{94} +\entry{\code {LINES}}{94} \initial {M} -\entry{\code {MACHTYPE}}{91} -\entry{\code {MAIL}}{81} -\entry{\code {MAILCHECK}}{91} -\entry{\code {MAILPATH}}{81} -\entry{\code {MAPFILE}}{91} -\entry{\code {mark-modified-lines}}{130} -\entry{\code {mark-symlinked-directories}}{130} -\entry{\code {match-hidden-files}}{131} -\entry{\code {menu-complete-display-prefix}}{131} -\entry{\code {meta-flag}}{130} +\entry{\code {MACHTYPE}}{94} +\entry{\code {MAIL}}{84} +\entry{\code {MAILCHECK}}{94} +\entry{\code {MAILPATH}}{84} +\entry{\code {MAPFILE}}{94} +\entry{\code {mark-modified-lines}}{136} +\entry{\code {mark-symlinked-directories}}{136} +\entry{\code {match-hidden-files}}{136} +\entry{\code {menu-complete-display-prefix}}{136} +\entry{\code {meta-flag}}{135} \initial {O} -\entry{\code {OLDPWD}}{91} -\entry{\code {OPTARG}}{81} -\entry{\code {OPTERR}}{91} -\entry{\code {OPTIND}}{81} -\entry{\code {OSTYPE}}{91} -\entry{\code {output-meta}}{131} +\entry{\code {OLDPWD}}{94} +\entry{\code {OPTARG}}{84} +\entry{\code {OPTERR}}{94} +\entry{\code {OPTIND}}{84} +\entry{\code {OSTYPE}}{94} +\entry{\code {output-meta}}{136} \initial {P} -\entry{\code {page-completions}}{131} -\entry{\code {PATH}}{81} -\entry{\code {PIPESTATUS}}{91} -\entry{\code {POSIXLY_CORRECT}}{91} -\entry{\code {PPID}}{91} -\entry{\code {PROMPT_COMMAND}}{91} -\entry{\code {PROMPT_DIRTRIM}}{91} -\entry{\code {PS0}}{91} -\entry{\code {PS1}}{81} -\entry{\code {PS2}}{81} -\entry{\code {PS3}}{91} -\entry{\code {PS4}}{92} -\entry{\code {PWD}}{92} +\entry{\code {page-completions}}{136} +\entry{\code {PATH}}{84} +\entry{\code {PIPESTATUS}}{94} +\entry{\code {POSIXLY_CORRECT}}{94} +\entry{\code {PPID}}{95} +\entry{\code {PROMPT_COMMAND}}{95} +\entry{\code {PROMPT_DIRTRIM}}{95} +\entry{\code {PS0}}{95} +\entry{\code {PS1}}{84} +\entry{\code {PS2}}{84} +\entry{\code {PS3}}{95} +\entry{\code {PS4}}{95} +\entry{\code {PWD}}{95} \initial {R} -\entry{\code {RANDOM}}{92} -\entry{\code {READLINE_ARGUMENT}}{92} -\entry{\code {READLINE_LINE}}{92} -\entry{\code {READLINE_MARK}}{92} -\entry{\code {READLINE_POINT}}{92} -\entry{\code {REPLY}}{92} -\entry{\code {revert-all-at-newline}}{131} +\entry{\code {RANDOM}}{95} +\entry{\code {READLINE_ARGUMENT}}{95} +\entry{\code {READLINE_LINE}}{95} +\entry{\code {READLINE_MARK}}{95} +\entry{\code {READLINE_POINT}}{95} +\entry{\code {REPLY}}{95} +\entry{\code {revert-all-at-newline}}{137} \initial {S} -\entry{\code {search-ignore-case}}{131} -\entry{\code {SECONDS}}{92} -\entry{\code {SHELL}}{92} -\entry{\code {SHELLOPTS}}{92} -\entry{\code {SHLVL}}{92} -\entry{\code {show-all-if-ambiguous}}{131} -\entry{\code {show-all-if-unmodified}}{131} -\entry{\code {show-mode-in-prompt}}{132} -\entry{\code {skip-completed-text}}{132} -\entry{\code {SRANDOM}}{93} +\entry{\code {search-ignore-case}}{137} +\entry{\code {SECONDS}}{95} +\entry{\code {SHELL}}{96} +\entry{\code {SHELLOPTS}}{96} +\entry{\code {SHLVL}}{96} +\entry{\code {show-all-if-ambiguous}}{137} +\entry{\code {show-all-if-unmodified}}{137} +\entry{\code {show-mode-in-prompt}}{137} +\entry{\code {skip-completed-text}}{137} +\entry{\code {SRANDOM}}{96} \initial {T} \entry{\code {TEXTDOMAIN}}{8} \entry{\code {TEXTDOMAINDIR}}{8} -\entry{\code {TIMEFORMAT}}{93} -\entry{\code {TMOUT}}{93} -\entry{\code {TMPDIR}}{93} +\entry{\code {TIMEFORMAT}}{96} +\entry{\code {TMOUT}}{97} +\entry{\code {TMPDIR}}{97} \initial {U} -\entry{\code {UID}}{93} +\entry{\code {UID}}{97} \initial {V} -\entry{\code {vi-cmd-mode-string}}{132} -\entry{\code {vi-ins-mode-string}}{132} -\entry{\code {visible-stats}}{132} +\entry{\code {vi-cmd-mode-string}}{137} +\entry{\code {vi-ins-mode-string}}{138} +\entry{\code {visible-stats}}{138} diff --git a/doc/builtins.0 b/doc/builtins.0 index 6800cdc7..632eecce 100644 --- a/doc/builtins.0 +++ b/doc/builtins.0 @@ -29,37 +29,41 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS ssoouurrccee [--pp _p_a_t_h] _f_i_l_e_n_a_m_e [_a_r_g_u_m_e_n_t_s] The .. command (ssoouurrccee) reads and execute commands from _f_i_l_e_n_a_m_e in the current shell environment and returns the exit status of - the last command executed from _f_i_l_e_n_a_m_e. If _f_i_l_e_n_a_m_e does not - contain a slash, .. searchs for it. If the --pp option is sup- - plied, .. treats _p_a_t_h as a colon-separated list of directories - in which to find _f_i_l_e_n_a_m_e; otherwise, .. uses the entries in - PPAATTHH to find the directory containing _f_i_l_e_n_a_m_e. _f_i_l_e_n_a_m_e does - not need to be executable. When bbaasshh is not in _p_o_s_i_x _m_o_d_e, it - searches the current directory if no file is found in PPAATTHH, but - does not search the current directory if --pp is supplied. If the - ssoouurrcceeppaatthh option to the sshhoopptt builtin command is turned off, .. - does not search PPAATTHH. If any _a_r_g_u_m_e_n_t_s are supplied, they be- - come the positional parameters when _f_i_l_e_n_a_m_e is executed. Oth- - erwise the positional parameters are unchanged. If the --TT op- - tion is enabled, .. inherits any trap on DDEEBBUUGG; if it is not, any - DDEEBBUUGG trap string is saved and restored around the call to .., - and .. unsets the DDEEBBUUGG trap while it executes. If --TT is not - set, and the sourced file changes the DDEEBBUUGG trap, the new value - is retained when .. completes. The return status is the status - of the last command exited within the script (0 if no commands - are executed), and false if _f_i_l_e_n_a_m_e is not found or cannot be - read. + the last command executed from _f_i_l_e_n_a_m_e. + + If _f_i_l_e_n_a_m_e does not contain a slash, .. searchs for it. If the + --pp option is supplied, .. treats _p_a_t_h as a colon-separated list + of directories in which to find _f_i_l_e_n_a_m_e; otherwise, .. uses the + entries in PPAATTHH to find the directory containing _f_i_l_e_n_a_m_e. + _f_i_l_e_n_a_m_e does not need to be executable. When bbaasshh is not in + _p_o_s_i_x _m_o_d_e, it searches the current directory if _f_i_l_e_n_a_m_e is not + found in PPAATTHH, but does not search the current directory if --pp + is supplied. If the ssoouurrcceeppaatthh option to the sshhoopptt builtin com- + mand is turned off, .. does not search PPAATTHH. + + If any _a_r_g_u_m_e_n_t_s are supplied, they become the positional para- + meters when _f_i_l_e_n_a_m_e is executed. Otherwise the positional pa- + rameters are unchanged. + + If the --TT option is enabled, .. inherits any trap on DDEEBBUUGG; if it + is not, any DDEEBBUUGG trap string is saved and restored around the + call to .., and .. unsets the DDEEBBUUGG trap while it executes. If --TT + is not set, and the sourced file changes the DDEEBBUUGG trap, the new + value persists after .. completes. The return status is the sta- + tus of the last command executed from _f_i_l_e_n_a_m_e (0 if no commands + are executed), and non-zero if _f_i_l_e_n_a_m_e is not found or cannot + be read. aalliiaass [--pp] [_n_a_m_e[=_v_a_l_u_e] ...] - AAlliiaass with no arguments or with the --pp option prints the list of - aliases in the form aalliiaass _n_a_m_e=_v_a_l_u_e on standard output. When - arguments are supplied, an alias is defined for each _n_a_m_e whose - _v_a_l_u_e is given. A trailing space in _v_a_l_u_e causes the next word - to be checked for alias substitution when the alias is expanded. - For each _n_a_m_e in the argument list for which no _v_a_l_u_e is sup- - plied, the name and value of the alias is printed. AAlliiaass re- - turns true unless a _n_a_m_e is given for which no alias has been - defined. + With no arguments or with the --pp option,aalliiaass prints the list of + aliases in the form aalliiaass _n_a_m_e=_v_a_l_u_e on standard output. When + arguments are supplied, define an alias for each _n_a_m_e whose + _v_a_l_u_e is given. A trailing space in _v_a_l_u_e causes the next word + to be checked for alias substitution when the alias is expanded + during command parsing. For each _n_a_m_e in the argument list for + which no _v_a_l_u_e is supplied, print the name and value of the + alias _n_a_m_e. aalliiaass returns true unless a _n_a_m_e is given (without + a corresponding =_v_a_l_u_e) for which no alias has been defined. bbgg [_j_o_b_s_p_e_c ...] Resume each suspended job _j_o_b_s_p_e_c in the background, as if it @@ -78,15 +82,16 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS bbiinndd [--mm _k_e_y_m_a_p] _k_e_y_s_e_q:_r_e_a_d_l_i_n_e_-_c_o_m_m_a_n_d bbiinndd _r_e_a_d_l_i_n_e_-_c_o_m_m_a_n_d_-_l_i_n_e Display current rreeaaddlliinnee key and function bindings, bind a key - sequence to a rreeaaddlliinnee function or macro, or set a rreeaaddlliinnee - variable. Each non-option argument is a command as it would ap- - pear in a rreeaaddlliinnee initialization file such as _._i_n_p_u_t_r_c, but - each binding or command must be passed as a separate argument; - e.g., \C-x\C-r: re-read-init-file. In the following descrip- - tions, output available to be re-read is formatted as commands - that would appear in a rreeaaddlliinnee initialization file or that - would be supplied as individual arguments to a bbiinndd command. - Options, if supplied, have the following meanings: + sequence to a rreeaaddlliinnee function or macro or to a shell command, + or set a rreeaaddlliinnee variable. Each non-option argument is a key + binding or command as it would appear in a rreeaaddlliinnee initializa- + tion file such as _._i_n_p_u_t_r_c, but each binding or command must be + passed as a separate argument; e.g., \C-x\C-r: + re-read-init-file. In the following descriptions, output avail- + able to be re-read is formatted as commands that would appear in + a rreeaaddlliinnee initialization file or that would be supplied as in- + dividual arguments to a bbiinndd command. Options, if supplied, + have the following meanings: --mm _k_e_y_m_a_p Use _k_e_y_m_a_p as the keymap to be affected by the subsequent bindings. Acceptable _k_e_y_m_a_p names are _e_m_a_c_s_, _e_m_a_c_s_-_s_t_a_n_- @@ -96,27 +101,33 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS _d_a_r_d. --ll List the names of all rreeaaddlliinnee functions. --pp Display rreeaaddlliinnee function names and bindings in such a - way that they can be re-read. If arguments remain after - option processing, bbiinndd treats them as readline command - names and restricts output to those names. + way that they can be used as an argument to a subsequent + bbiinndd command or in a rreeaaddlliinnee initialization file. If + arguments remain after option processing, bbiinndd treats + them as readline command names and restricts output to + those names. --PP List current rreeaaddlliinnee function names and bindings. If arguments remain after option processing, bbiinndd treats them as readline command names and restricts output to those names. --ss Display rreeaaddlliinnee key sequences bound to macros and the - strings they output in such a way that they can be re- - read. + strings they output in such a way that they can be used + as an argument to a subsequent bbiinndd command or in a rreeaadd-- + lliinnee initialization file. --SS Display rreeaaddlliinnee key sequences bound to macros and the strings they output. --vv Display rreeaaddlliinnee variable names and values in such a way - that they can be re-read. + that they can be used as an argument to a subsequent bbiinndd + command or in a rreeaaddlliinnee initialization file. --VV List current rreeaaddlliinnee variable names and values. --ff _f_i_l_e_n_a_m_e Read key bindings from _f_i_l_e_n_a_m_e. --qq _f_u_n_c_t_i_o_n - Query about which keys invoke the named _f_u_n_c_t_i_o_n. + Display key sequences that invoke the named rreeaaddlliinnee + _f_u_n_c_t_i_o_n. --uu _f_u_n_c_t_i_o_n - Unbind all keys bound to the named _f_u_n_c_t_i_o_n. + Unbind all key sequences bound to the named rreeaaddlliinnee + _f_u_n_c_t_i_o_n. --rr _k_e_y_s_e_q Remove any current binding for _k_e_y_s_e_q. --xx _k_e_y_s_e_q[[:: ]]_s_h_e_l_l_-_c_o_m_m_a_n_d @@ -130,113 +141,137 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS enclosing double quotes are optional, and rreeaaddlliinnee does not expand the command string before saving it. Since the entire key binding expression must be a single argu- - ment, it should be enclosed in quotes. When _s_h_e_l_l_-_c_o_m_- - _m_a_n_d is executed, the shell sets the RREEAADDLLIINNEE__LLIINNEE vari- - able to the contents of the rreeaaddlliinnee line buffer and the - RREEAADDLLIINNEE__PPOOIINNTT and RREEAADDLLIINNEE__MMAARRKK variables to the current - location of the insertion point and the saved insertion - point (the mark), respectively. The shell assigns any - numeric argument the user supplied to the RREEAADDLLIINNEE__AARRGGUU-- - MMEENNTT variable. If there was no argument, that variable - is not set. If the executed command changes the value of - any of RREEAADDLLIINNEE__LLIINNEE, RREEAADDLLIINNEE__PPOOIINNTT, or RREEAADDLLIINNEE__MMAARRKK, - those new values will be reflected in the editing state. + ment, it should be enclosed in single quotes. When + _s_h_e_l_l_-_c_o_m_m_a_n_d is executed, the shell sets the RREEAADD-- + LLIINNEE__LLIINNEE variable to the contents of the rreeaaddlliinnee line + buffer and the RREEAADDLLIINNEE__PPOOIINNTT and RREEAADDLLIINNEE__MMAARRKK variables + to the current location of the insertion point and the + saved insertion point (the mark), respectively. The + shell assigns any numeric argument the user supplied to + the RREEAADDLLIINNEE__AARRGGUUMMEENNTT variable. If there was no argu- + ment, that variable is not set. If the executed command + changes the value of any of RREEAADDLLIINNEE__LLIINNEE, RREEAADD-- + LLIINNEE__PPOOIINNTT, or RREEAADDLLIINNEE__MMAARRKK, those new values will be + reflected in the editing state. --XX List all key sequences bound to shell commands and the - associated commands in a format that can be reused as in- - put. + associated commands in a format that can be reused as an + argument to a subsequent @code{bind} command. - The return value is 0 unless an unrecognized option is given or - an error occurred. + The return value is 0 unless an unrecognized option is supplied + or an error occurred. bbrreeaakk [_n] - Exit from within a ffoorr, wwhhiillee, uunnttiill, or sseelleecctt loop. If _n is - specified, break _n levels. _n must be >= 1. If _n is greater - than the number of enclosing loops, all enclosing loops are ex- - ited. The return value is 0 unless _n is not greater than or - equal to 1. + Exit from within a ffoorr, wwhhiillee, uunnttiill, or sseelleecctt loop. If _n is + specified, bbrreeaakk exits _n enclosing loops. _n must be >= 1. If _n + is greater than the number of enclosing loops, all enclosing + loops are exited. The return value is 0 unless _n is not greater + than or equal to 1. bbuuiillttiinn _s_h_e_l_l_-_b_u_i_l_t_i_n [_a_r_g_u_m_e_n_t_s] - Execute the specified shell builtin, passing it _a_r_g_u_m_e_n_t_s, and - return its exit status. This is useful when defining a function - whose name is the same as a shell builtin, retaining the func- - tionality of the builtin within the function. The ccdd builtin is - commonly redefined this way. The return status is false if - _s_h_e_l_l_-_b_u_i_l_t_i_n is not a shell builtin command. + Execute the specified shell builtin _s_h_e_l_l_-_b_u_i_l_t_i_n, passing it + _a_r_g_u_m_e_n_t_s, and return its exit status. This is useful when + defining a function whose name is the same as a shell builtin, + retaining the functionality of the builtin within the function. + The ccdd builtin is commonly redefined this way. The return sta- + tus is false if _s_h_e_l_l_-_b_u_i_l_t_i_n is not a shell builtin command. ccaalllleerr [_e_x_p_r] Returns the context of any active subroutine call (a shell func- - tion or a script executed with the .. or ssoouurrccee builtins). With- - out _e_x_p_r, ccaalllleerr displays the line number and source filename of - the current subroutine call. If a non-negative integer is sup- - plied as _e_x_p_r, ccaalllleerr displays the line number, subroutine name, - and source file corresponding to that position in the current - execution call stack. This extra information may be used, for - example, to print a stack trace. The current frame is frame 0. + tion or a script executed with the .. or ssoouurrccee builtins). + + Without _e_x_p_r, ccaalllleerr displays the line number and source file- + name of the current subroutine call. If a non-negative integer + is supplied as _e_x_p_r, ccaalllleerr displays the line number, subroutine + name, and source file corresponding to that position in the cur- + rent execution call stack. This extra information may be used, + for example, to print a stack trace. The current frame is frame + 0. + The return value is 0 unless the shell is not executing a sub- routine call or _e_x_p_r does not correspond to a valid position in the call stack. ccdd [--LL|[--PP [--ee]]] [-@] [_d_i_r] Change the current directory to _d_i_r. if _d_i_r is not supplied, - the value of the HHOOMMEE shell variable is the default. The vari- - able CCDDPPAATTHH defines the search path for the directory containing - _d_i_r: the shell searches each directory name in CCDDPPAATTHH for _d_i_r. - Alternative directory names in CCDDPPAATTHH are separated by a colon - (:). A null directory name in CCDDPPAATTHH is the same as the current - directory, i.e., If _d_i_r begins with a slash (/), then CCDDPPAATTHH is - not used. The --PP option causes ccdd to use the physical directory - structure by resolving symbolic links while traversing _d_i_r and - before processing instances of _._. in _d_i_r (see also the --PP option - to the sseett builtin command); the --LL option forces symbolic links - to be followed by resolving the link after processing instances - of _._. in _d_i_r. If _._. appears in _d_i_r, it is processed by removing - the immediately previous pathname component from _d_i_r, back to a - slash or the beginning of _d_i_r. If the --ee option is supplied - with --PP, and the current working directory cannot be success- - fully determined after a successful directory change, ccdd will - return an unsuccessful status. On systems that support it, the - --@@ option presents the extended attributes associated with a - file as a directory. An argument of -- is converted to $$OOLLDDPPWWDD - before the directory change is attempted. If a non-empty direc- - tory name from CCDDPPAATTHH is used, or if -- is the first argument, - and the directory change is successful, the absolute pathname of - the new working directory is written to the standard output. If - the directory change is successful, ccdd sets the value of the PPWWDD - environment variable to the new directory name, and sets the + the value of the HHOOMMEE shell variable is used as _d_i_r. The vari- + able CCDDPPAATTHH exists, ccdd uses it as a search path: the shell + searches each directory name in CCDDPPAATTHH for _d_i_r. Alternative di- + rectory names in CCDDPPAATTHH are separated by a colon (:). A null + directory name in CCDDPPAATTHH is the same as the current directory, + i.e., If _d_i_r begins with a slash (/), then CCDDPPAATTHH is not used. + + The --PP option causes ccdd to use the physical directory structure + by resolving symbolic links while traversing _d_i_r and before pro- + cessing instances of _._. in _d_i_r (see also the --PP option to the + sseett builtin command). + + The --LL option forces symbolic links to be followed by resolving + the link after processing instances of _._. in _d_i_r. If _._. appears + in _d_i_r, it is processed by removing the immediately previous + pathname component from _d_i_r, back to a slash or the beginning of + _d_i_r. + + If the --ee option is supplied with --PP, and the current working + directory cannot be successfully determined after a successful + directory change, ccdd will return a non-zero status. + + On systems that support it, the --@@ option presents the extended + attributes associated with a file as a directory. + + An argument of -- is converted to $$OOLLDDPPWWDD before attempting the + directory change. + + If ccdd uses a non-empty directory name from CCDDPPAATTHH,, or if -- is + the first argument, and the directory change is successful, ccdd + writes the absolute pathname of the new working directory to the + standard output. + + If the directory change is successful, ccdd sets the value of the + PPWWDD environment variable to the new directory name, and sets the OOLLDDPPWWDD environment variable to the value of the current working - directory before the change. The return value is true if the - directory was successfully changed; false otherwise. + directory before the change. + + The return value is true if the directory was successfully + changed; false otherwise. ccoommmmaanndd [--ppVVvv] _c_o_m_m_a_n_d [_a_r_g ...] - Run _c_o_m_m_a_n_d with _a_r_g_s suppressing the normal shell function - lookup. Only builtin commands or commands found in the PPAATTHH are - executed. If the --pp option is given, the search for _c_o_m_m_a_n_d is - performed using a default value for PPAATTHH that is guaranteed to - find all of the standard utilities. If either the --VV or --vv op- - tion is supplied, a description of _c_o_m_m_a_n_d is printed. The --vv - option causes a single word indicating the command or filename - used to invoke _c_o_m_m_a_n_d to be displayed; the --VV option produces a - more verbose description. If the --VV or --vv option is supplied, - the exit status is 0 if _c_o_m_m_a_n_d was found, and 1 if not. If - neither option is supplied and an error occurred or _c_o_m_m_a_n_d can- - not be found, the exit status is 127. Otherwise, the exit sta- - tus of the ccoommmmaanndd builtin is the exit status of _c_o_m_m_a_n_d. + The ccoommmmaanndd builtin runs _c_o_m_m_a_n_d with _a_r_g_s suppressing the nor- + mal shell function lookup for _c_o_m_m_a_n_d. Only builtin commands or + commands found in the PPAATTHH named _c_o_m_m_a_n_d are executed. If the + --pp option is supplied, the search for _c_o_m_m_a_n_d is performed using + a default value for PPAATTHH that is guaranteed to find all of the + standard utilities. + + If either the --VV or --vv option is supplied, ccoommmmaanndd prints a de- + scription of _c_o_m_m_a_n_d. The --vv option displays a single word in- + dicating the command or filename used to invoke _c_o_m_m_a_n_d; the --VV + option produces a more verbose description. + + If the --VV or --vv option is supplied, the exit status is zero if + _c_o_m_m_a_n_d was found, and non-zero if not. If neither option is + supplied and an error occurred or _c_o_m_m_a_n_d cannot be found, the + exit status is 127. Otherwise, the exit status of the ccoommmmaanndd + builtin is the exit status of _c_o_m_m_a_n_d. ccoommppggeenn [--VV _v_a_r_n_a_m_e] [_o_p_t_i_o_n] [_w_o_r_d] - Generate possible completion matches for _w_o_r_d according to the - _o_p_t_i_o_ns, which may be any option accepted by the ccoommpplleettee + Generate possible completion matches for _w_o_r_d according to the + _o_p_t_i_o_ns, which may be any option accepted by the ccoommpplleettee builtin with the exceptions of --pp, --rr, --DD, --EE, and --II, and write - the matches to the standard output. If the --VV option is sup- - plied, ccoommppggeenn stores the generated completions into the indexed - array variable _v_a_r_n_a_m_e instead of writing them to the standard - output. When using the --FF or --CC options, the various shell - variables set by the programmable completion facilities, while - available, will not have useful values. + the matches to the standard output. + + If the --VV option is supplied, ccoommppggeenn stores the generated com- + pletions into the indexed array variable _v_a_r_n_a_m_e instead of + writing them to the standard output. + + When using the --FF or --CC options, the various shell variables set + by the programmable completion facilities, while available, will + not have useful values. The matches will be generated in the same way as if the program- mable completion code had generated them directly from a comple- - tion specification with the same flags. If _w_o_r_d is specified, - only those completions matching _w_o_r_d will be displayed. + tion specification with the same flags. If _w_o_r_d is specified, + only those completions matching _w_o_r_d will be displayed or + stored. The return value is true unless an invalid option is supplied, or no matches were generated. @@ -305,9 +340,9 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS line. pplluussddiirrss After any matches defined by the compspec are - generated, directory name completion is at- - tempted and any matches are added to the results - of the other actions. + generated, attempt directory name completion and + add any matches to the results of the other ac- + tions. --AA _a_c_t_i_o_n The _a_c_t_i_o_n may be one of the following to generate a list of possible completions: @@ -361,21 +396,21 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS guments are being completed, the second argument ($$22) is the word being completed, and the third argument ($$33) is the word preceding the word being completed on the cur- - rent command line. When it finishes, the possible com- - pletions are retrieved from the value of the CCOOMMPPRREEPPLLYY - array variable. + rent command line. When _f_u_n_c_t_i_o_n finishes, the possible + completions are retrieved from the value of the CCOOMMPPRREE-- + PPLLYY array variable. --GG _g_l_o_b_p_a_t - The pathname expansion pattern _g_l_o_b_p_a_t is expanded to - generate the possible completions. + Expand the pathname expansion pattern _g_l_o_b_p_a_t to gener- + ate the possible completions. --PP _p_r_e_f_i_x - _p_r_e_f_i_x is added at the beginning of each possible com- - pletion after all other options have been applied. + Add _p_r_e_f_i_x to the beginning of each possible completion + after all other options have been applied. --SS _s_u_f_f_i_x - _s_u_f_f_i_x is appended to each possible completion after all + Append _s_u_f_f_i_x to each possible completion after all other options have been applied. --WW _w_o_r_d_l_i_s_t The _w_o_r_d_l_i_s_t is split using the characters in the IIFFSS - special variable as delimiters, and each resultant word + special variable as delimiters, and each resulting word is expanded. Shell quoting is honored within _w_o_r_d_l_i_s_t, in order to provide a mechanism for the words to contain shell metacharacters or characters in the value of IIFFSS. @@ -398,8 +433,8 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS ccoommppoopptt [--oo _o_p_t_i_o_n] [--DDEEII] [++oo _o_p_t_i_o_n] [_n_a_m_e] Modify completion options for each _n_a_m_e according to the _o_p_- _t_i_o_ns, or for the currently-executing completion if no _n_a_m_es are - supplied. If no _o_p_t_i_o_ns are given, display the completion op- - tions for each _n_a_m_e or the current completion. The possible + supplied. If no _o_p_t_i_o_ns are supplied, display the completion + options for each _n_a_m_e or the current completion. The possible values of _o_p_t_i_o_n are those valid for the ccoommpplleettee builtin de- scribed above. The --DD option indicates that other supplied op- tions should apply to the command completion; that is, comple- @@ -411,138 +446,160 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS assignment word on the line, or after a command delimiter such as ;; or ||, which is usually command name completion. + If multiple options are supplied, the --DD option takes precedence + over --EE, and both take precedence over --II. + The return value is true unless an invalid option is supplied, an attempt is made to modify the options for a _n_a_m_e for which no completion specification exists, or an output error occurs. ccoonnttiinnuuee [_n] - Resume the next iteration of the enclosing ffoorr, wwhhiillee, uunnttiill, or - sseelleecctt loop. If _n is specified, resume at the _nth enclosing - loop. _n must be >= 1. If _n is greater than the number of en- - closing loops, the shell resumes the last enclosing loop (the - loop). The return value is 0 unless _n is not greater than or - equal to 1. + ccoonnttiinnuuee resumes the next iteration of the enclosing ffoorr, wwhhiillee, + uunnttiill, or sseelleecctt loop. If _n is specified, bbaasshh resumes the _nth + enclosing loop. _n must be >= 1. If _n is greater than the num- + ber of enclosing loops, the shell resumes the last enclosing + loop (the loop). The return value is 0 unless _n is not greater + than or equal to 1. ddeeccllaarree [--aaAAffFFggiiIIllnnrrttuuxx] [--pp] [_n_a_m_e[=_v_a_l_u_e] ...] ttyyppeesseett [--aaAAffFFggiiIIllnnrrttuuxx] [--pp] [_n_a_m_e[=_v_a_l_u_e] ...] Declare variables and/or give them attributes. If no _n_a_m_es are - given then display the values of variables. The --pp option will - display the attributes and values of each _n_a_m_e. When --pp is used - with _n_a_m_e arguments, additional options, other than --ff and --FF, - are ignored. When --pp is supplied without _n_a_m_e arguments, it - will display the attributes and values of all variables having - the attributes specified by the additional options. If no other - options are supplied with --pp, ddeeccllaarree will display the attrib- - utes and values of all shell variables. The --ff option will re- - strict the display to shell functions. The --FF option inhibits - the display of function definitions; only the function name and - attributes are printed. If the eexxttddeebbuugg shell option is enabled - using sshhoopptt, the source file name and line number where each - _n_a_m_e is defined are displayed as well. The --FF option implies - --ff. The --gg option forces variables to be created or modified at - the global scope, even when ddeeccllaarree is executed in a shell func- - tion. It is ignored in all other cases. The --II option causes - local variables to inherit the attributes (except the _n_a_m_e_r_e_f - attribute) and value of any existing variable with the same _n_a_m_e - at a surrounding scope. If there is no existing variable, the - local variable is initially unset. The following options can be - used to restrict output to variables with the specified at- - tribute or to give variables attributes: - --aa Each _n_a_m_e is an indexed array variable (see AArrrraayyss in + given then display the values of variables or functions. The --pp + option will display the attributes and values of each _n_a_m_e. + When --pp is used with _n_a_m_e arguments, additional options, other + than --ff and --FF, are ignored. + + When --pp is supplied without _n_a_m_e arguments, ddeeccllaarree will display + the attributes and values of all variables having the attributes + specified by the additional options. If no other options are + supplied with --pp, ddeeccllaarree will display the attributes and values + of all shell variables. The --ff option restricts the display to + shell functions. + + The --FF option inhibits the display of function definitions; only + the function name and attributes are printed. If the eexxttddeebbuugg + shell option is enabled using sshhoopptt, the source file name and + line number where each _n_a_m_e is defined are displayed as well. + The --FF option implies --ff. + + The --gg option forces variables to be created or modified at the + global scope, even when ddeeccllaarree is executed in a shell function. + It is ignored when ddeeccllaarree is not executed in a shell function. + + The --II option causes local variables to inherit the attributes + (except the _n_a_m_e_r_e_f attribute) and value of any existing vari- + able with the same _n_a_m_e at a surrounding scope. If there is no + existing variable, the local variable is initially unset. + + The following options can be used to restrict output to vari- + ables with the specified attribute or to give variables attrib- + utes: + --aa Each _n_a_m_e is an indexed array variable (see AArrrraayyss in _b_a_s_h(1)). --AA Each _n_a_m_e is an associative array variable (see AArrrraayyss in _b_a_s_h(1)). - --ff Use function names only. + --ff Each _n_a_m_e refers to a shell function. --ii The variable is treated as an integer; arithmetic evalua- - tion (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN in _b_a_s_h(1)) is performed + tion (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN in _b_a_s_h(1)) is performed when the variable is assigned a value. - --ll When the variable is assigned a value, all upper-case - characters are converted to lower-case. The upper-case + --ll When the variable is assigned a value, all upper-case + characters are converted to lower-case. The upper-case attribute is disabled. - --nn Give each _n_a_m_e the _n_a_m_e_r_e_f attribute, making it a name - reference to another variable. That other variable is - defined by the value of _n_a_m_e. All references, assign- - ments, and attribute modifications to _n_a_m_e, except those - using or changing the --nn attribute itself, are performed - on the variable referenced by _n_a_m_e's value. The nameref + --nn Give each _n_a_m_e the _n_a_m_e_r_e_f attribute, making it a name + reference to another variable. That other variable is + defined by the value of _n_a_m_e. All references, assign- + ments, and attribute modifications to _n_a_m_e, except those + using or changing the --nn attribute itself, are performed + on the variable referenced by _n_a_m_e's value. The nameref attribute cannot be applied to array variables. --rr Make _n_a_m_es readonly. These names cannot then be assigned values by subsequent assignment statements or unset. --tt Give each _n_a_m_e the _t_r_a_c_e attribute. Traced functions in- - herit the DDEEBBUUGG and RREETTUURRNN traps from the calling shell. + herit the DDEEBBUUGG and RREETTUURRNN traps from the calling shell. The trace attribute has no special meaning for variables. - --uu When the variable is assigned a value, all lower-case - characters are converted to upper-case. The lower-case + --uu When the variable is assigned a value, all lower-case + characters are converted to upper-case. The lower-case attribute is disabled. - --xx Mark _n_a_m_es for export to subsequent commands via the en- - vironment. - - Using instead of turns off the attribute instead, with the ex- - ceptions that ++aa and ++AA may not be used to destroy array vari- - ables and ++rr will not remove the readonly attribute. When used - in a function, ddeeccllaarree and ttyyppeesseett make each _n_a_m_e local, as with - the llooccaall command, unless the --gg option is supplied. If a vari- - able name is followed by =_v_a_l_u_e, the value of the variable is - set to _v_a_l_u_e. When using --aa or --AA and the compound assignment - syntax to create array variables, additional attributes do not - take effect until subsequent assignments. The return value is 0 - unless an invalid option is encountered, an attempt is made to - define a function using an attempt is made to assign a value to - a readonly variable, an attempt is made to assign a value to an - array variable without using the compound assignment syntax (see - AArrrraayyss in _b_a_s_h(1)), one of the _n_a_m_e_s is not a valid shell vari- - able name, an attempt is made to turn off readonly status for a - readonly variable, an attempt is made to turn off array status - for an array variable, or an attempt is made to display a non- - existent function with --ff. + --xx Mark each _n_a_m_e for export to subsequent commands via the + environment. + + Using instead of turns off the specified attribute instead, with + the exceptions that ++aa and ++AA may not be used to destroy array + variables and ++rr will not remove the readonly attribute. + + When used in a function, ddeeccllaarree and ttyyppeesseett make each _n_a_m_e lo- + cal, as with the llooccaall command, unless the --gg option is sup- + plied. If a variable name is followed by =_v_a_l_u_e, the value of + the variable is set to _v_a_l_u_e. When using --aa or --AA and the com- + pound assignment syntax to create array variables, additional + attributes do not take effect until subsequent assignments. + + The return value is 0 unless an invalid option is encountered, + an attempt is made to define a function using an attempt is made + to assign a value to a readonly variable, an attempt is made to + assign a value to an array variable without using the compound + assignment syntax (see AArrrraayyss in _b_a_s_h(1)), one of the _n_a_m_e_s is + not a valid shell variable name, an attempt is made to turn off + readonly status for a readonly variable, an attempt is made to + turn off array status for an array variable, or an attempt is + made to display a non-existent function with --ff. ddiirrss [[--ccllppvv]] [[++_n]] [[--_n]] - Without options, displays the list of currently remembered di- - rectories. The default display is on a single line with direc- - tory names separated by spaces. Directories are added to the - list with the ppuusshhdd command; the ppooppdd command removes entries - from the list. The current directory is always the first direc- - tory in the stack. - --cc Clears the directory stack by deleting all of the en- + Without options, display the list of currently remembered direc- + tories. The default display is on a single line with directory + names separated by spaces. Directories are added to the list + with the ppuusshhdd command; the ppooppdd command removes entries from + the list. The current directory is always the first directory + in the stack. + + Options, if supplied, have the following meanings: + --cc Clears the directory stack by deleting all of the en- tries. - --ll Produces a listing using full pathnames; the default + --ll Produces a listing using full pathnames; the default listing format uses a tilde to denote the home directory. --pp Print the directory stack with one entry per line. - --vv Print the directory stack with one entry per line, pre- + --vv Print the directory stack with one entry per line, pre- fixing each entry with its index in the stack. ++_n Displays the _nth entry counting from the left of the list shown by ddiirrss when invoked without options, starting with zero. - --_n Displays the _nth entry counting from the right of the + --_n Displays the _nth entry counting from the right of the list shown by ddiirrss when invoked without options, starting with zero. - The return value is 0 unless an invalid option is supplied or _n + The return value is 0 unless an invalid option is supplied or _n indexes beyond the end of the directory stack. - ddiissoowwnn [--aarr] [--hh] [_j_o_b_s_p_e_c ... | _p_i_d ... ] - Without options, remove each _j_o_b_s_p_e_c from the table of active - jobs. If _j_o_b_s_p_e_c is not present, and neither the --aa nor the --rr - option is supplied, the _c_u_r_r_e_n_t _j_o_b is used. If the --hh option - is given, each _j_o_b_s_p_e_c is not removed from the table, but is - marked so that SSIIGGHHUUPP is not sent to the job if the shell re- - ceives a SSIIGGHHUUPP. If no _j_o_b_s_p_e_c is supplied, the --aa option means - to remove or mark all jobs; the --rr option without a _j_o_b_s_p_e_c ar- - gument restricts operation to running jobs. The return value is - 0 unless a _j_o_b_s_p_e_c does not specify a valid job. + ddiissoowwnn [--aarr] [--hh] [_i_d ...] + Without options, remove each _i_d from the table of active jobs. + Each _i_d may be a job specification _j_o_b_s_p_e_c or a process ID _p_i_d; + if _i_d is a _p_i_d, ddiissoowwnn uses the job containing _p_i_d as _j_o_b_s_p_e_c. + If _i_d is not present, and neither the --aa nor the --rr option is + supplied, ddiissoowwnn removes the _c_u_r_r_e_n_t _j_o_b. If the --hh option is + supplied, the job corresponding to each _i_d is not removed from + the table, but is marked so that SSIIGGHHUUPP is not sent to the job + if the shell receives a SSIIGGHHUUPP. + + If no _i_d is supplied, the --aa option means to remove or mark all + jobs; the --rr option without an _i_d argument restricts operation + to running jobs. + + The return value is 0 unless an _i_d does not specify a valid job. eecchhoo [--nneeEE] [_a_r_g ...] Output the _a_r_gs, separated by spaces, followed by a newline. The return status is 0 unless a write error occurs. If --nn is - specified, the trailing newline is suppressed. If the --ee option - is given, interpretation of the following backslash-escaped - characters is enabled. The --EE option disables the interpreta- - tion of these escape characters, even on systems where they are - interpreted by default. The xxppgg__eecchhoo shell option may be used - to dynamically determine whether or not eecchhoo interprets any op- - tions and expands these escape characters by default. eecchhoo does - not interpret ---- to mean the end of options. eecchhoo interprets - the following escape sequences: + specified, the trailing newline is not printed. + + If the --ee option is given, eecchhoo interprets the following back- + slash-escaped characters. The --EE option disables interpretation + of these escape characters, even on systems where they are in- + terpreted by default. The xxppgg__eecchhoo shell option determines + whether or not eecchhoo interprets any options and expands these es- + cape characters. eecchhoo does not interpret ---- to mean the end of + options. + + eecchhoo interprets the following escape sequences: \\aa alert (bell) \\bb backspace \\cc suppress further output @@ -564,198 +621,232 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value _H_H_H_H_H_H_H_H (one to eight hex digits) + eecchhoo writes any unrecognized backslash-escaped characters un- + changed. + eennaabbllee [--aa] [--ddnnppss] [--ff _f_i_l_e_n_a_m_e] [_n_a_m_e ...] - Enable and disable builtin shell commands. Disabling a builtin - allows a disk command which has the same name as a shell builtin - to be executed without specifying a full pathname, even though - the shell normally searches for builtins before disk commands. - If --nn is used, each _n_a_m_e is disabled; otherwise, _n_a_m_e_s are en- - abled. For example, to use the tteesstt binary found via the PPAATTHH - instead of the shell builtin version, run The --ff option means to - load the new builtin command _n_a_m_e from shared object _f_i_l_e_n_a_m_e, - on systems that support dynamic loading. BBaasshh will use the - value of the BBAASSHH__LLOOAADDAABBLLEESS__PPAATTHH variable as a colon-separated - list of directories in which to search for _f_i_l_e_n_a_m_e, if _f_i_l_e_n_a_m_e - does not contain a slash. The default is system-dependent, and - may include to force a search of the current directory. The --dd - option will delete a builtin previously loaded with --ff. If no - _n_a_m_e arguments are given, or if the --pp option is supplied, a - list of shell builtins is printed. With no other option argu- - ments, the list consists of all enabled shell builtins. If --nn - is supplied, only disabled builtins are printed. If --aa is sup- - plied, the list printed includes all builtins, with an indica- - tion of whether or not each is enabled. If --ss is supplied, the - output is restricted to the POSIX _s_p_e_c_i_a_l builtins. If no op- - tions are supplied and a _n_a_m_e is not a shell builtin, eennaabbllee - will attempt to load _n_a_m_e from a shared object named _n_a_m_e, as if - the command were The return value is 0 unless a _n_a_m_e is not a - shell builtin or there is an error loading a new builtin from a - shared object. + Enable and disable builtin shell commands. Disabling a builtin + allows an executable file which has the same name as a shell + builtin to be executed without specifying a full pathname, even + 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 + instead of the shell builtin version, run + + If no _n_a_m_e arguments are supplied, or if the --pp option is sup- + plied, print a list of shell builtins. With no other option ar- + guments, the list consists of all enabled shell builtins. If --nn + is supplied, print only disabled builtins. If --aa is supplied, + the list printed includes all builtins, with an indication of + whether or not each is enabled. The --ss option means to restrict + the output to the POSIX _s_p_e_c_i_a_l builtins. + + The --ff option means to load the new builtin command _n_a_m_e from + shared object _f_i_l_e_n_a_m_e, on systems that support dynamic loading. + If _f_i_l_e_n_a_m_e does not contain a slash, BBaasshh will use the value of + the BBAASSHH__LLOOAADDAABBLLEESS__PPAATTHH variable as a colon-separated list of + directories in which to search for _f_i_l_e_n_a_m_e. The default for + BBAASSHH__LLOOAADDAABBLLEESS__PPAATTHH is system-dependent, and may include to + force a search of the current directory. The --dd option will + delete a builtin previously loaded with --ff. If _-_s is used with + _-_f, the new builtin becomes a POSIX special builtin. + + If no options are supplied and a _n_a_m_e is not a shell builtin, + eennaabbllee will attempt to load _n_a_m_e from a shared object named + _n_a_m_e, as if the command were + + The return value is 0 unless a _n_a_m_e is not a shell builtin or + there is an error loading a new builtin from a shared object. eevvaall [_a_r_g ...] - The _a_r_gs are read and concatenated together into a single com- - mand. This command is then read and executed by the shell, and - its exit status is returned as the value of eevvaall. If there are - no _a_r_g_s, or only null arguments, eevvaall returns 0. + Concatenate the _a_r_gs together into a single command, separating + them with spaces. BBaasshh then reads and execute this command, and + returns its exit status as the return status of eevvaall. If there + are no _a_r_g_s, or only null arguments, eevvaall returns 0. eexxeecc [--ccll] [--aa _n_a_m_e] [_c_o_m_m_a_n_d [_a_r_g_u_m_e_n_t_s]] - If _c_o_m_m_a_n_d is specified, it replaces the shell. No new process - is created. The _a_r_g_u_m_e_n_t_s become the arguments to _c_o_m_m_a_n_d. If - the --ll option is supplied, the shell places a dash at the begin- - ning of the zeroth argument passed to _c_o_m_m_a_n_d. This is what _l_o_- - _g_i_n(1) does. The --cc option causes _c_o_m_m_a_n_d to be executed with - an empty environment. If --aa is supplied, the shell passes _n_a_m_e - as the zeroth argument to the executed command. If _c_o_m_m_a_n_d can- - not be executed for some reason, a non-interactive shell exits, - unless the eexxeeccffaaiill shell option is enabled. In that case, it - returns failure. An interactive shell returns failure if the - file cannot be executed. A subshell exits unconditionally if - eexxeecc fails. If _c_o_m_m_a_n_d is not specified, any redirections take - effect in the current shell, and the return status is 0. If - there is a redirection error, the return status is 1. + If _c_o_m_m_a_n_d is specified, it replaces the shell without creating + a new process. _c_o_m_m_a_n_d cannot be a shell builtin or function. + The _a_r_g_u_m_e_n_t_s become the arguments to _c_o_m_m_a_n_d. If the --ll option + is supplied, the shell places a dash at the beginning of the ze- + roth argument passed to _c_o_m_m_a_n_d. This is what _l_o_g_i_n(1) does. + The --cc option causes _c_o_m_m_a_n_d to be executed with an empty envi- + ronment. If --aa is supplied, the shell passes _n_a_m_e as the zeroth + argument to the executed command. + + If _c_o_m_m_a_n_d cannot be executed for some reason, a non-interactive + shell exits, unless the eexxeeccffaaiill shell option is enabled. In + that case, it returns a non-zero status. An interactive shell + returns a non-zero status if the file cannot be executed. A + subshell exits unconditionally if eexxeecc fails. + + If _c_o_m_m_a_n_d is not specified, any redirections take effect in the + current shell, and the return status is 0. If there is a redi- + rection error, the return status is 1. eexxiitt [_n] Cause the shell to exit with a status of _n. If _n is omitted, - the exit status is that of the last command executed. A trap on - EEXXIITT is executed before the shell terminates. + the exit status is that of the last command executed. Any trap + on EEXXIITT is executed before the shell terminates. - eexxppoorrtt [--ffnn] [_n_a_m_e[=_w_o_r_d]] ... + eexxppoorrtt [--ffnn] [_n_a_m_e[=_v_a_l_u_e]] ... eexxppoorrtt --pp - The supplied _n_a_m_e_s are marked for automatic export to the envi- - ronment of subsequently executed commands. If the --ff option is - given, the _n_a_m_e_s refer to functions. If no _n_a_m_e_s are given, or - if the --pp option is supplied, a list of names of all exported - variables is printed. The --nn option causes the export property - to be removed from each _n_a_m_e. If a variable name is followed by - =_w_o_r_d, the value of the variable is set to _w_o_r_d. eexxppoorrtt returns - an exit status of 0 unless an invalid option is encountered, one - of the _n_a_m_e_s is not a valid shell variable name, or --ff is sup- - plied with a _n_a_m_e that is not a function. - - ffaallssee Does nothing, returns a non-zero status. + The supplied _n_a_m_e_s are marked for automatic export to the envi- + ronment of subsequently executed commands. If the --ff option is + given, the _n_a_m_e_s refer to functions. + + The --nn option unexports, or removes the export attribute, from + each _n_a_m_e. If no _n_a_m_e_s are given, or if the --pp option is sup- + plied, eexxppoorrtt prints a list of names of all exported variables + on the standard output. + + eexxppoorrtt allows the value of a variable to be set when it is ex- + ported or unexported by following the variable name with =_v_a_l_u_e. + This sets the value of the variable to _v_a_l_u_e while modifying the + export attribute. eexxppoorrtt returns an exit status of 0 unless an + invalid option is encountered, one of the _n_a_m_e_s is not a valid + shell variable name, or --ff is supplied with a _n_a_m_e that is not a + function. + + ffaallssee Does nothing; returns a non-zero status. ffcc [--ee _e_n_a_m_e] [--llnnrr] [_f_i_r_s_t] [_l_a_s_t] ffcc --ss [_p_a_t=_r_e_p] [_c_m_d] - The first form selects a range of commands from _f_i_r_s_t to _l_a_s_t - from the history list and displays or edits and re-executes - them. _F_i_r_s_t and _l_a_s_t may be specified as a string (to locate - the last command beginning with that string) or as a number (an - index into the history list, where a negative number is used as - an offset from the current command number). When listing, a - _f_i_r_s_t or _l_a_s_t of 0 is equivalent to -1 and -0 is equivalent to - the current command (usually the ffcc command); otherwise 0 is - equivalent to -1 and -0 is invalid. If _l_a_s_t is not specified, - it is set to the current command for listing (so that prints the - last 10 commands) and to _f_i_r_s_t otherwise. If _f_i_r_s_t is not spec- - ified, it is set to the previous command for editing and -16 for - listing. - - The --nn option suppresses the command numbers when listing. The - --rr option reverses the order of the commands. If the --ll option - is given, the commands are listed on standard output. Other- - wise, the editor given by _e_n_a_m_e is invoked on a file containing - those commands. If _e_n_a_m_e is not given, the value of the FFCCEEDDIITT - variable is used, and the value of EEDDIITTOORR if FFCCEEDDIITT is not set. - If neither variable is set, _v_i is used. When editing is com- - plete, the edited commands are echoed and executed. - - In the second form, _c_o_m_m_a_n_d is re-executed after each instance - of _p_a_t is replaced by _r_e_p. _C_o_m_m_a_n_d is interpreted the same as - _f_i_r_s_t above. A useful alias to use with this is so that typing - runs the last command beginning with and typing re-executes the - last command. - - If the first form is used, the return value is 0 unless an in- - valid option is encountered or _f_i_r_s_t or _l_a_s_t specify history - lines out of range. If the --ee option is supplied, the return - value is the value of the last command executed or failure if an - error occurs with the temporary file of commands. If the second - form is used, the return status is that of the command re-exe- - cuted, unless _c_m_d does not specify a valid history line, in - which case ffcc returns failure. + The first form selects a range of commands from _f_i_r_s_t to _l_a_s_t + from the history list and displays or edits and re-executes + them. _F_i_r_s_t and _l_a_s_t may be specified as a string (to locate + the last command beginning with that string) or as a number (an + index into the history list, where a negative number is used as + an offset from the current command number). + + When listing, a _f_i_r_s_t or _l_a_s_t of 0 is equivalent to -1 and -0 is + equivalent to the current command (usually the ffcc command); oth- + erwise 0 is equivalent to -1 and -0 is invalid. If _l_a_s_t is not + specified, it is set to the current command for listing (so that + prints the last 10 commands) and to _f_i_r_s_t otherwise. If _f_i_r_s_t + is not specified, it is set to the previous command for editing + and -16 for listing. + + If the --ll option is supplied, the commands are listed on the + standard output. The --nn option suppresses the command numbers + when listing. The --rr option reverses the order of the commands. + + Otherwise, ffcc invokes the editor named by _e_n_a_m_e on a file con- + taining those commands. If _e_n_a_m_e is not supplied, ffcc uses the + value of the FFCCEEDDIITT variable, and the value of EEDDIITTOORR if FFCCEEDDIITT + is not set. If neither variable is set, ffcc uses _v_i_. When edit- + ing is complete, ffcc reads the file containing the edited com- + mands and echoes and executes them. + + In the second form, ffcc re-executes _c_o_m_m_a_n_d after replacing each + instance of _p_a_t with _r_e_p. _C_o_m_m_a_n_d is interpreted the same as + _f_i_r_s_t above. + + A useful alias to use with ffcc is so that typing runs the last + command beginning with and typing re-executes the last command. + + If the first form is used, the return value is zero unless an + invalid option is encountered or _f_i_r_s_t or _l_a_s_t specify history + lines out of range. When editing and re-executing a file of + commands, the return value is the value of the last command exe- + cuted or failure if an error occurs with the temporary file. If + the second form is used, the return status is that of the re-ex- + ecuted command, unless _c_m_d does not specify a valid history en- + try, in which case ffcc returns a non-zero status. ffgg [_j_o_b_s_p_e_c] Resume _j_o_b_s_p_e_c in the foreground, and make it the current job. - If _j_o_b_s_p_e_c is not present, the shell's notion of the _c_u_r_r_e_n_t _j_o_b - is used. The return value is that of the command placed into - the foreground, or failure if run when job control is disabled - or, when run with job control enabled, if _j_o_b_s_p_e_c does not spec- - ify a valid job or _j_o_b_s_p_e_c specifies a job that was started - without job control. + If _j_o_b_s_p_e_c is not present, use the shell's notion of the _c_u_r_r_e_n_t + _j_o_b. The return value is that of the command placed into the + foreground, or failure if run when job control is disabled or, + when run with job control enabled, if _j_o_b_s_p_e_c does not specify a + valid job or _j_o_b_s_p_e_c specifies a job that was started without + job control. ggeettooppttss _o_p_t_s_t_r_i_n_g _n_a_m_e [_a_r_g ...] - ggeettooppttss is used by shell procedures to parse positional parame- - ters. _o_p_t_s_t_r_i_n_g contains the option characters to be recog- - nized; if a character is followed by a colon, the option is ex- - pected to have an argument, which should be separated from it by - white space. The colon and question mark characters may not be - used as option characters. Each time it is invoked, ggeettooppttss - places the next option in the shell variable _n_a_m_e, initializing - _n_a_m_e if it does not exist, and the index of the next argument to - be processed into the variable OOPPTTIINNDD. OOPPTTIINNDD is initialized to - 1 each time the shell or a shell script is invoked. When an op- - tion requires an argument, ggeettooppttss places that argument into the - variable OOPPTTAARRGG. The shell does not reset OOPPTTIINNDD automatically; - it must be manually reset between multiple calls to ggeettooppttss - within the same shell invocation if a new set of parameters is - to be used. - - When the end of options is encountered, ggeettooppttss exits with a re- - turn value greater than zero. OOPPTTIINNDD is set to the index of the + ggeettooppttss is used by shell scripts and functions to parse posi- + tional parameters and obtain options and their arguments. _o_p_t_- + _s_t_r_i_n_g contains the option characters to be recognized; if a + character is followed by a colon, the option is expected to have + an argument, which should be separated from it by white space. + The colon and question mark characters may not be used as option + characters. + + Each time it is invoked, ggeettooppttss places the next option in the + shell variable _n_a_m_e, initializing _n_a_m_e if it does not exist, and + the index of the next argument to be processed into the variable + OOPPTTIINNDD. OOPPTTIINNDD is initialized to 1 each time the shell or a + shell script is invoked. When an option requires an argument, + ggeettooppttss places that argument into the variable OOPPTTAARRGG. + + The shell does not reset OOPPTTIINNDD automatically; it must be manu- + ally reset between multiple calls to ggeettooppttss within the same + shell invocation to use a new set of parameters. + + When it reaches the end of options, ggeettooppttss exits with a return + value greater than zero. OOPPTTIINNDD is set to the index of the first non-option argument, and _n_a_m_e is set to ?. - ggeettooppttss normally parses the positional parameters, but if more - arguments are supplied as _a_r_g values, ggeettooppttss parses those in- + ggeettooppttss normally parses the positional parameters, but if more + arguments are supplied as _a_r_g values, ggeettooppttss parses those in- stead. - ggeettooppttss can report errors in two ways. If the first character - of _o_p_t_s_t_r_i_n_g is a colon, _s_i_l_e_n_t error reporting is used. In - normal operation, diagnostic messages are printed when invalid - options or missing option arguments are encountered. If the - variable OOPPTTEERRRR is set to 0, no error messages will be dis- + ggeettooppttss can report errors in two ways. If the first character + of _o_p_t_s_t_r_i_n_g is a colon, ggeettooppttss uses _s_i_l_e_n_t error reporting. + In normal operation, ggeettooppttss prints diagnostic messages when it + encounters invalid options or missing option arguments. If the + variable OOPPTTEERRRR is set to 0, no error messages will be dis- played, even if the first character of _o_p_t_s_t_r_i_n_g is not a colon. If ggeettooppttss detects an invalid option, it places ? into _n_a_m_e and, - if not silent, prints an error message and unsets OOPPTTAARRGG. If - ggeettooppttss is silent, it assigns the option character found to OOPP-- + if not silent, prints an error message and unsets OOPPTTAARRGG. If + ggeettooppttss is silent, it assigns the option character found to OOPP-- TTAARRGG and does not print a diagnostic message. - If a required argument is not found, and ggeettooppttss is not silent, + If a required argument is not found, and ggeettooppttss is not silent, it sets the value of _n_a_m_e to a question mark (??), unsets OOPPTTAARRGG, - and prints a diagnostic message. If ggeettooppttss is silent, it sets - the value of _n_a_m_e to a colon (::) and sets OOPPTTAARRGG to the option + and prints a diagnostic message. If ggeettooppttss is silent, it sets + the value of _n_a_m_e to a colon (::) and sets OOPPTTAARRGG to the option character found. - ggeettooppttss returns true if an option, specified or unspecified, is + ggeettooppttss returns true if an option, specified or unspecified, is found. It returns false if the end of options is encountered or an error occurs. hhaasshh [--llrr] [--pp _f_i_l_e_n_a_m_e] [--ddtt] [_n_a_m_e] - Each time hhaasshh is invoked, the full pathname of the command _n_a_m_e - is determined by searching the directories in $$PPAATTHH and remem- - bered. Any previously-remembered pathname is discarded. If the - --pp option is supplied, hhaasshh uses _f_i_l_e_n_a_m_e as the full filename - of the command. The --rr option causes the shell to forget all - remembered locations. Assigning to the PPAATTHH variable also - clears all hashed filenames. The --dd option causes the shell to - forget the remembered location of each _n_a_m_e. If the --tt option - is supplied, the full pathname to which each _n_a_m_e corresponds is - printed. If multiple _n_a_m_e arguments are supplied with --tt, the - _n_a_m_e is printed before the hashed full pathname. The --ll option - causes output to be displayed in a format that may be reused as - input. If no arguments are given, or if only --ll is supplied, - information about remembered commands is printed. The --tt, --dd, - and --pp options (the options that act on the _n_a_m_e arguments) are - mutually exclusive. Only one will be active. If more than one - is supplied, --tt has higher priority than --pp, and both are higher - priority than --dd. The return status is true unless a _n_a_m_e is - not found or an invalid option is supplied. + Each time hhaasshh is invoked, it remembers the full pathname of the + command _n_a_m_e as determined by searching the directories in + $$PPAATTHH. Any previously-remembered pathname associated with _n_a_m_e + is discarded. If the --pp option is supplied, hhaasshh uses _f_i_l_e_n_a_m_e + as the full pathname of the command. + + The --rr option causes the shell to forget all remembered loca- + tions. Assigning to the PPAATTHH variable also clears all hashed + filenames. The --dd option causes the shell to forget the remem- + bered location of each _n_a_m_e. + + If the --tt option is supplied, hhaasshh prints the full pathname cor- + responding to each _n_a_m_e. If multiple _n_a_m_e arguments are sup- + plied with --tt, hhaasshh prints the _n_a_m_e before the corresponding + hashed full pathname. The --ll option displays output in a format + that may be reused as input. + + If no arguments are given, or if only --ll is supplied, hhaasshh + prints information about remembered commands. The --tt, --dd, and + --pp options (the options that act on the _n_a_m_e arguments) are mu- + tually exclusive. Only one will be active. If more than one is + supplied, --tt has higher priority than --pp, and both have higher + priority than --dd. + + The return status is zero unless a _n_a_m_e is not found or an in- + valid option is supplied. hheellpp [--ddmmss] [_p_a_t_t_e_r_n] Display helpful information about builtin commands. If _p_a_t_t_e_r_n is specified, hheellpp gives detailed help on all commands matching - _p_a_t_t_e_r_n; otherwise help for all the builtins and shell control - structures is printed. + _p_a_t_t_e_r_n; otherwise it displays a list of all the builtins and + shell compound commands. --dd Display a short description of each _p_a_t_t_e_r_n --mm Display the description of each _p_a_t_t_e_r_n in a manpage-like format @@ -770,171 +861,185 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS hhiissttoorryy --aannrrww [_f_i_l_e_n_a_m_e] hhiissttoorryy --pp _a_r_g [_a_r_g ...] hhiissttoorryy --ss _a_r_g [_a_r_g ...] - With no options, display the command history list with line num- - bers. Lines listed with a ** have been modified. An argument of - _n lists only the last _n lines. If the shell variable HHIISSTTTTIIMMEE-- + With no options, display the command history list with numbers. + Entries prefixed with a ** have been modified. An argument of _n + lists only the last _n entries. If the shell variable HHIISSTTTTIIMMEE-- FFOORRMMAATT is set and not null, it is used as a format string for _s_t_r_f_t_i_m_e(3) to display the time stamp associated with each dis- - played history entry. No intervening blank is printed between - the formatted time stamp and the history line. If _f_i_l_e_n_a_m_e is - supplied, it is used as the name of the history file; if not, - the value of HHIISSTTFFIILLEE is used. If _f_i_l_e_n_a_m_e is not supplied and - HHIISSTTFFIILLEE is unset or null, the --aa,, --nn,, --rr,, and --ww options have - no effect. Options, if supplied, have the following meanings: - --cc Clear the history list by deleting all the entries. + played history entry. If hhiissttoorryy uses HHIISSTTTTIIMMEEFFOORRMMAATT, it does + not print an intervening space between the formatted time stamp + and the history entry. + + If _f_i_l_e_n_a_m_e is supplied, hhiissttoorryy uses it as the name of the his- + tory file; if not, it uses the value of HHIISSTTFFIILLEE. If _f_i_l_e_n_a_m_e + is not supplied and HHIISSTTFFIILLEE is unset or null, the --aa,, --nn,, --rr,, + and --ww options have no effect. + + Options, if supplied, have the following meanings: + --cc Clear the history list by deleting all the entries. This + can be used with the other options to replace the history + list. --dd _o_f_f_s_e_t - Delete the history entry at position _o_f_f_s_e_t. If _o_f_f_s_e_t + Delete the history entry at position _o_f_f_s_e_t. If _o_f_f_s_e_t is negative, it is interpreted as relative to one greater than the last history position, so negative indices count - back from the end of the history, and an index of -1 + back from the end of the history, and an index of -1 refers to the current hhiissttoorryy --dd command. --dd _s_t_a_r_t-_e_n_d - Delete the range of history entries between positions - _s_t_a_r_t and _e_n_d, inclusive. Positive and negative values + Delete the range of history entries between positions + _s_t_a_r_t and _e_n_d, inclusive. Positive and negative values for _s_t_a_r_t and _e_n_d are interpreted as described above. - --aa Append the history lines to the history file. These are - history lines entered since the beginning of the current - bbaasshh session, but not already appended to the history + --aa Append the history lines to the history file. These are + history lines entered since the beginning of the current + bbaasshh session, but not already appended to the history file. - --nn Read the history lines not already read from the history - file into the current history list. These are lines ap- - pended to the history file since the beginning of the + --nn Read the history lines not already read from the history + file into the current history list. These are lines ap- + pended to the history file since the beginning of the current bbaasshh session. - --rr Read the contents of the history file and append them to - the current history list. + --rr Read the history file and append its contents to the cur- + rent history list. --ww Write the current history list to the history file, over- writing the history file's contents. --pp Perform history substitution on the following _a_r_g_s and - display the result on the standard output. Does not - store the results in the history list. Each _a_r_g must be + display the result on the standard output, without stor- + ing the results in the history list. Each _a_r_g must be quoted to disable normal history expansion. --ss Store the _a_r_g_s in the history list as a single entry. The last command in the history list is removed before - the _a_r_g_s are added. - - If the HHIISSTTTTIIMMEEFFOORRMMAATT variable is set, the time stamp informa- - tion associated with each history entry is written to the his- - tory file, marked with the history comment character. When the - history file is read, lines beginning with the history comment - character followed immediately by a digit are interpreted as - timestamps for the following history entry. The return value is - 0 unless an invalid option is encountered, an error occurs while - reading or writing the history file, an invalid _o_f_f_s_e_t or range - is supplied as an argument to --dd, or the history expansion sup- - plied as an argument to --pp fails. + adding the _a_r_g_s. + + If the HHIISSTTTTIIMMEEFFOORRMMAATT variable is set, hhiissttoorryy writes the time + stamp information associated with each history entry to the his- + tory file, marked with the history comment character. When the + history file is read, lines beginning with the history comment + character followed immediately by a digit are interpreted as + timestamps for the following history entry. + + The return value is 0 unless an invalid option is encountered, + an error occurs while reading or writing the history file, an + invalid _o_f_f_s_e_t or range is supplied as an argument to --dd, or the + history expansion supplied as an argument to --pp fails. jjoobbss [--llnnpprrss] [ _j_o_b_s_p_e_c ... ] jjoobbss --xx _c_o_m_m_a_n_d [ _a_r_g_s ... ] The first form lists the active jobs. The options have the fol- lowing meanings: --ll List process IDs in addition to the normal information. - --nn Display information only about jobs that have changed + --nn Display information only about jobs that have changed status since the user was last notified of their status. - --pp List only the process ID of the job's process group + --pp List only the process ID of the job's process group leader. --rr Display only running jobs. --ss Display only stopped jobs. - If _j_o_b_s_p_e_c is given, output is restricted to information about - that job. The return status is 0 unless an invalid option is - encountered or an invalid _j_o_b_s_p_e_c is supplied. + If _j_o_b_s_p_e_c is supplied, jjoobbss restricts output to information + about that job. The return status is 0 unless an invalid option + is encountered or an invalid _j_o_b_s_p_e_c is supplied. If the --xx option is supplied, jjoobbss replaces any _j_o_b_s_p_e_c found in _c_o_m_m_a_n_d or _a_r_g_s with the corresponding process group ID, and ex- - ecutes _c_o_m_m_a_n_d passing it _a_r_g_s, returning its exit status. + ecutes _c_o_m_m_a_n_d, passing it _a_r_g_s, returning its exit status. kkiillll [--ss _s_i_g_s_p_e_c | --nn _s_i_g_n_u_m | --_s_i_g_s_p_e_c] [_p_i_d | _j_o_b_s_p_e_c] ... kkiillll --ll|--LL [_s_i_g_s_p_e_c | _e_x_i_t___s_t_a_t_u_s] - Send the signal named by _s_i_g_s_p_e_c or _s_i_g_n_u_m to the processes + Send the signal specified by _s_i_g_s_p_e_c or _s_i_g_n_u_m to the processes named by _p_i_d or _j_o_b_s_p_e_c. _s_i_g_s_p_e_c is either a case-insensitive signal name such as SSIIGGKKIILLLL (with or without the SSIIGG prefix) or a signal number; _s_i_g_n_u_m is a signal number. If _s_i_g_s_p_e_c is not - present, then SSIIGGTTEERRMM is assumed. An argument of --ll lists the - signal names. If any arguments are supplied when --ll is given, - the names of the signals corresponding to the arguments are - listed, and the return status is 0. The _e_x_i_t___s_t_a_t_u_s argument to - --ll is a number specifying either a signal number or the exit - status of a process terminated by a signal. The --LL option is - equivalent to --ll. kkiillll returns true if at least one signal was - successfully sent, or false if an error occurs or an invalid op- - tion is encountered. + supplied, then kkiillll sends SSIIGGTTEERRMM. + + An argument of --ll lists the signal names. If any arguments are + supplied when --ll is given, kkiillll lists the names of the signals + corresponding to the arguments, and the return status is 0. The + _e_x_i_t___s_t_a_t_u_s argument to --ll is a number specifying either a sig- + nal number or the exit status of a process terminated by a sig- + nal. The --LL option is equivalent to --ll. + + kkiillll returns true if at least one signal was successfully sent, + or false if an error occurs or an invalid option is encountered. lleett _a_r_g [_a_r_g ...] - Each _a_r_g is an arithmetic expression to be evaluated (see AARRIITTHH-- + Each _a_r_g is evaluated as an arithmetic expression (see AARRIITTHH-- MMEETTIICC EEVVAALLUUAATTIIOONN in _b_a_s_h(1)). If the last _a_r_g evaluates to 0, - lleett returns 1; 0 is returned otherwise. + lleett returns 1; otherwise lleett returns 0. llooccaall [_o_p_t_i_o_n] [_n_a_m_e[=_v_a_l_u_e] ... | - ] - For each argument, a local variable named _n_a_m_e is created, and - assigned _v_a_l_u_e. The _o_p_t_i_o_n can be any of the options accepted - by ddeeccllaarree. When llooccaall is used within a function, it causes the + For each argument, create a local variable named _n_a_m_e and assign + it _v_a_l_u_e. The _o_p_t_i_o_n can be any of the options accepted by ddee-- + ccllaarree. When llooccaall is used within a function, it causes the variable _n_a_m_e to have a visible scope restricted to that func- - tion and its children. If _n_a_m_e is -, the set of shell options - is made local to the function in which llooccaall is invoked: shell - options changed using the sseett builtin inside the function after - the call to llooccaall are restored to their original values when the - function returns. The restore is effected as if a series of sseett - commands were executed to restore the values that were in place - before the function. With no operands, llooccaall writes a list of - local variables to the standard output. It is an error to use - llooccaall when not within a function. The return status is 0 unless - llooccaall is used outside a function, an invalid _n_a_m_e is supplied, - or _n_a_m_e is a readonly variable. - - llooggoouutt Exit a login shell. + tion and its children. It is an error to use llooccaall when not + within a function. + + If _n_a_m_e is -, it makes the set of shell options local to the + function in which llooccaall is invoked: any shell options changed + using the sseett builtin inside the function after the call to lloo-- + ccaall are restored to their original values when the function re- + turns. The restore is performed as if a series of sseett commands + were executed to restore the values that were in place before + the function. + + With no operands, llooccaall writes a list of local variables to the + standard output. + + The return status is 0 unless llooccaall is used outside a function, + an invalid _n_a_m_e is supplied, or _n_a_m_e is a readonly variable. + + llooggoouutt [[_n]] + Exit a login shell, returning a status of _n to the shell's par- + ent. mmaappffiillee [--dd _d_e_l_i_m] [--nn _c_o_u_n_t] [--OO _o_r_i_g_i_n] [--ss _c_o_u_n_t] [--tt] [--uu _f_d] [--CC _c_a_l_l_b_a_c_k] [--cc _q_u_a_n_t_u_m] [_a_r_r_a_y] rreeaaddaarrrraayy [--dd _d_e_l_i_m] [--nn _c_o_u_n_t] [--OO _o_r_i_g_i_n] [--ss _c_o_u_n_t] [--tt] [--uu _f_d] [--CC _c_a_l_l_b_a_c_k] [--cc _q_u_a_n_t_u_m] [_a_r_r_a_y] - Read lines from the standard input into the indexed array vari- - able _a_r_r_a_y, or from file descriptor _f_d if the --uu option is sup- - plied. The variable MMAAPPFFIILLEE is the default _a_r_r_a_y. Options, if + Read lines from the standard input, or from file descriptor _f_d + if the --uu option is supplied, into the indexed array variable + _a_r_r_a_y. The variable MMAAPPFFIILLEE is the default _a_r_r_a_y. Options, if supplied, have the following meanings: - --dd The first character of _d_e_l_i_m is used to terminate each - input line, rather than newline. If _d_e_l_i_m is the empty - string, mmaappffiillee will terminate a line when it reads a NUL - character. - --nn Copy at most _c_o_u_n_t lines. If _c_o_u_n_t is 0, all lines are - copied. - --OO Begin assigning to _a_r_r_a_y at index _o_r_i_g_i_n. The default + --dd Use the first character of _d_e_l_i_m to terminate each input + line, rather than newline. If _d_e_l_i_m is the empty string, + mmaappffiillee will terminate a line when it reads a NUL charac- + ter. + --nn Copy at most _c_o_u_n_t lines. If _c_o_u_n_t is 0, copy all lines. + --OO Begin assigning to _a_r_r_a_y at index _o_r_i_g_i_n. The default index is 0. --ss Discard the first _c_o_u_n_t lines read. - --tt Remove a trailing _d_e_l_i_m (default newline) from each line + --tt Remove a trailing _d_e_l_i_m (default newline) from each line read. - --uu Read lines from file descriptor _f_d instead of the stan- + --uu Read lines from file descriptor _f_d instead of the stan- dard input. - --CC Evaluate _c_a_l_l_b_a_c_k each time _q_u_a_n_t_u_m lines are read. The + --CC Evaluate _c_a_l_l_b_a_c_k each time _q_u_a_n_t_u_m lines are read. The --cc option specifies _q_u_a_n_t_u_m. - --cc Specify the number of lines read between each call to + --cc Specify the number of lines read between each call to _c_a_l_l_b_a_c_k. - If --CC is specified without --cc, the default quantum is 5000. + If --CC is specified without --cc, the default quantum is 5000. When _c_a_l_l_b_a_c_k is evaluated, it is supplied the index of the next array element to be assigned and the line to be assigned to that - element as additional arguments. _c_a_l_l_b_a_c_k is evaluated after + element as additional arguments. _c_a_l_l_b_a_c_k is evaluated after the line is read but before the array element is assigned. - If not supplied with an explicit origin, mmaappffiillee will clear _a_r_- + If not supplied with an explicit origin, mmaappffiillee will clear _a_r_- _r_a_y before assigning to it. - mmaappffiillee returns successfully unless an invalid option or option - argument is supplied, _a_r_r_a_y is invalid or unassignable, or if - _a_r_r_a_y is not an indexed array. + mmaappffiillee returns zero unless an invalid option or option argument + is supplied, _a_r_r_a_y is invalid or unassignable, or if _a_r_r_a_y is + not an indexed array. ppooppdd [-nn] [+_n] [-_n] - Removes entries from the directory stack. The elements are num- - bered from 0 starting at the first directory listed by ddiirrss. - With no arguments, ppooppdd removes the top directory from the - stack, and changes to the new top directory. Arguments, if sup- - plied, have the following meanings: - --nn Suppresses the normal change of directory when removing - directories from the stack, so that only the stack is ma- - nipulated. - ++_n Removes the _nth entry counting from the left of the list - shown by ddiirrss, starting with zero, from the stack. For + Remove entries from the directory stack. The elements are num- + bered from 0 starting at the first directory listed by ddiirrss, so + ppooppdd is equivalent to With no arguments, ppooppdd removes the top + directory from the stack, and changes to the new top directory. + Arguments, if supplied, have the following meanings: + --nn Suppress the normal change of directory when removing di- + rectories from the stack, only manipulate the stack. + ++_n Remove the _nth entry counting from the left of the list + shown by ddiirrss, starting with zero, from the stack. For example: removes the first directory, the second. - --_n Removes the _nth entry counting from the right of the list + --_n Remove the _nth entry counting from the right of the list shown by ddiirrss, starting with zero. For example: removes the last directory, the next to last. @@ -943,19 +1048,18 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS to the directory at the top of the stack. If the ccdd fails, ppooppdd returns a non-zero value. - Otherwise, ppooppdd returns false if an invalid option is encoun- - tered, the directory stack is empty, or a non-existent directory - stack entry is specified. + Otherwise, ppooppdd returns false if an invalid option is supplied, + the directory stack is empty, or _n specifies a non-existent di- + rectory stack entry. - If the ppooppdd command is successful, bash runs ddiirrss to show the - final contents of the directory stack, and the return status is + If the ppooppdd command is successful, bbaasshh runs ddiirrss to show the + final contents of the directory stack, and the return status is 0. pprriinnttff [--vv _v_a_r] _f_o_r_m_a_t [_a_r_g_u_m_e_n_t_s] - Write the formatted _a_r_g_u_m_e_n_t_s to the standard output under the - control of the _f_o_r_m_a_t. The --vv option causes the output to be - assigned to the variable _v_a_r rather than being printed to the - standard output. + Write the formatted _a_r_g_u_m_e_n_t_s to the standard output under the + control of the _f_o_r_m_a_t. The --vv option assigns the output to the + variable _v_a_r rather than printing it to the standard output. The _f_o_r_m_a_t is a character string which contains three types of objects: plain characters, which are simply copied to standard @@ -980,12 +1084,12 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS causes pprriinnttff to output the date-time string resulting from using _d_a_t_e_f_m_t as a format string for _s_t_r_f_t_i_m_e(3). The corresponding _a_r_g_u_m_e_n_t is an integer representing the - number of seconds since the epoch. Two special argument - values may be used: -1 represents the current time, and - -2 represents the time the shell was invoked. If no ar- - gument is specified, conversion behaves as if -1 had been - given. This is an exception to the usual pprriinnttff behav- - ior. + number of seconds since the epoch. This format specifier + recognizes two special argument values: -1 represents the + current time, and -2 represents the time the shell was + invoked. If no argument is specified, conversion behaves + as if -1 had been supplied. This is an exception to the + usual pprriinnttff behavior. The %b, %q, and %T format specifiers all use the field width and precision arguments from the format specification and write that @@ -1017,70 +1121,70 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS ppuusshhdd [--nn] [+_n] [-_n] ppuusshhdd [--nn] [_d_i_r] - Adds a directory to the top of the directory stack, or rotates - the stack, making the new top of the stack the current working - directory. With no arguments, ppuusshhdd exchanges the top two ele- - ments of the directory stack. Arguments, if supplied, have the + Add a directory to the top of the directory stack, or rotate the + stack, making the new top of the stack the current working di- + rectory. With no arguments, ppuusshhdd exchanges the top two ele- + ments of the directory stack. Arguments, if supplied, have the following meanings: - --nn Suppresses the normal change of directory when rotating - or adding directories to the stack, so that only the - stack is manipulated. - ++_n Rotates the stack so that the _nth directory (counting - from the left of the list shown by ddiirrss, starting with - zero) is at the top. + --nn Suppress the normal change of directory when rotating or + adding directories to the stack, only manipulate the + stack. + ++_n Rotate the stack so that the _nth directory (counting from + the left of the list shown by ddiirrss, starting with zero) + is at the top. --_n Rotates the stack so that the _nth directory (counting from the right of the list shown by ddiirrss, starting with zero) is at the top. - _d_i_r Adds _d_i_r to the directory stack at the top + _d_i_r Adds _d_i_r to the directory stack at the top. After the stack has been modified, if the --nn option was not sup- plied, ppuusshhdd uses the ccdd builtin to change to the directory at the top of the stack. If the ccdd fails, ppuusshhdd returns a non-zero value. - Otherwise, if no arguments are supplied, ppuusshhdd returns 0 unless - the directory stack is empty. When rotating the directory - stack, ppuusshhdd returns 0 unless the directory stack is empty or a - non-existent directory stack element is specified. + Otherwise, if no arguments are supplied, ppuusshhdd returns zero un- + less the directory stack is empty. When rotating the directory + stack, ppuusshhdd returns zero unless the directory stack is empty or + _n specifies a non-existent directory stack element. - If the ppuusshhdd command is successful, bash runs ddiirrss to show the + If the ppuusshhdd command is successful, bbaasshh runs ddiirrss to show the final contents of the directory stack. ppwwdd [--LLPP] - Print the absolute pathname of the current working directory. + Print the absolute pathname of the current working directory. The pathname printed contains no symbolic links if the --PP option is supplied or the --oo pphhyyssiiccaall option to the sseett builtin command - is enabled. If the --LL option is used, the pathname printed may - contain symbolic links. The return status is 0 unless an error + is enabled. If the --LL option is used, the pathname printed may + contain symbolic links. The return status is 0 unless an error occurs while reading the name of the current directory or an in- valid option is supplied. rreeaadd [--EEeerrss] [--aa _a_n_a_m_e] [--dd _d_e_l_i_m] [--ii _t_e_x_t] [--nn _n_c_h_a_r_s] [--NN _n_c_h_a_r_s] [--pp _p_r_o_m_p_t] [--tt _t_i_m_e_o_u_t] [--uu _f_d] [_n_a_m_e ...] - One line is read from the standard input, or from the file de- - scriptor _f_d supplied as an argument to the --uu option, split into - words as described in _b_a_s_h (1) under WWoorrdd SSpplliittttiinngg, and the - first word is assigned to the first _n_a_m_e, the second word to the - second _n_a_m_e, and so on. If there are more words than names, the - remaining words and their intervening delimiters are assigned to + Read one line from the standard input, or from the file descrip- + tor _f_d supplied as an argument to the --uu option, split it into + words as described in _b_a_s_h (1) under WWoorrdd SSpplliittttiinngg, and assign + the first word to the first _n_a_m_e, the second word to the second + _n_a_m_e, and so on. If there are more words than names, the re- + maining words and their intervening delimiters are assigned to the last _n_a_m_e. If there are fewer words read from the input stream than names, the remaining names are assigned empty val- - ues. The characters in IIFFSS are used to split the line into - words using the same rules the shell uses for expansion (de- - scribed in _b_a_s_h (1) under WWoorrdd SSpplliittttiinngg). The backslash char- - acter (\\) may be used to remove any special meaning for the next - character read and for line continuation. Options, if supplied, - have the following meanings: + ues. The characters in the value of the IIFFSS variable are used + to split the line into words using the same rules the shell uses + for expansion (described in _b_a_s_h (1) under WWoorrdd SSpplliittttiinngg). The + backslash character (\\) removes any special meaning for the next + character read and is used for line continuation. + + Options, if supplied, have the following meanings: --aa _a_n_a_m_e The words are assigned to sequential indices of the array variable _a_n_a_m_e, starting at 0. _a_n_a_m_e is unset before any new values are assigned. Other _n_a_m_e arguments are ig- nored. --dd _d_e_l_i_m - The first character of _d_e_l_i_m is used to terminate the in- - put line, rather than newline. If _d_e_l_i_m is the empty - string, rreeaadd will terminate a line when it reads a NUL - character. + The first character of _d_e_l_i_m terminates the input line, + rather than newline. If _d_e_l_i_m is the empty string, rreeaadd + will terminate a line when it reads a NUL character. --ee If the standard input is coming from a terminal, rreeaadd uses rreeaaddlliinnee (see RREEAADDLLIINNEE in _b_a_s_h(1)) to obtain the line. Readline uses the current (or default, if line @@ -1093,117 +1197,129 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS uses bash's default completion, including programmable completion. --ii _t_e_x_t - If rreeaaddlliinnee is being used to read the line, _t_e_x_t is - placed into the editing buffer before editing begins. + If rreeaaddlliinnee is being used to read the line, rreeaadd places + _t_e_x_t into the editing buffer before editing begins. --nn _n_c_h_a_r_s rreeaadd returns after reading _n_c_h_a_r_s characters rather than - waiting for a complete line of input, but honors a delim- - iter if fewer than _n_c_h_a_r_s characters are read before the - delimiter. + waiting for a complete line of input, unless it encoun- + ters EOF or rreeaadd times out, but honors a delimiter if it + reads fewer than _n_c_h_a_r_s characters before the delimiter. --NN _n_c_h_a_r_s - rreeaadd returns after reading exactly _n_c_h_a_r_s characters - rather than waiting for a complete line of input, unless - EOF is encountered or rreeaadd times out. Delimiter charac- - ters encountered in the input are not treated specially - and do not cause rreeaadd to return until _n_c_h_a_r_s characters - are read. The result is not split on the characters in - IIFFSS; the intent is that the variable is assigned exactly - the characters read (with the exception of backslash; see - the --rr option below). + rreeaadd returns after reading exactly _n_c_h_a_r_s characters + rather than waiting for a complete line of input, unless + it encounters EOF or rreeaadd times out. Any delimiter char- + acters in the input are not treated specially and do not + cause rreeaadd to return until it has read _n_c_h_a_r_s characters. + The result is not split on the characters in IIFFSS; the in- + tent is that the variable is assigned exactly the charac- + ters read (with the exception of backslash; see the --rr + option below). --pp _p_r_o_m_p_t Display _p_r_o_m_p_t on standard error, without a trailing new- - line, before attempting to read any input. The prompt is - displayed only if input is coming from a terminal. + line, before attempting to read any input, but only if + input is coming from a terminal. --rr Backslash does not act as an escape character. The back- - slash is considered to be part of the line. In particu- - lar, a backslash-newline pair may not then be used as a + slash is considered to be part of the line. In particu- + lar, a backslash-newline pair may not then be used as a line continuation. --ss Silent mode. If input is coming from a terminal, charac- ters are not echoed. --tt _t_i_m_e_o_u_t - Cause rreeaadd to time out and return failure if a complete - line of input (or a specified number of characters) is - not read within _t_i_m_e_o_u_t seconds. _t_i_m_e_o_u_t may be a deci- - mal number with a fractional portion following the deci- - mal point. This option is only effective if rreeaadd is - reading input from a terminal, pipe, or other special - file; it has no effect when reading from regular files. - If rreeaadd times out, rreeaadd saves any partial input read into - the specified variable _n_a_m_e. If _t_i_m_e_o_u_t is 0, rreeaadd re- - turns immediately, without trying to read any data. The - exit status is 0 if input is available on the specified - file descriptor, or the read will return EOF, non-zero - otherwise. The exit status is greater than 128 if the - timeout is exceeded. - --uu _f_d Read input from file descriptor _f_d. - - Other than the case where _d_e_l_i_m is the empty string, rreeaadd ig- + Cause rreeaadd to time out and return failure if it does not + read a complete line of input (or a specified number of + characters) within _t_i_m_e_o_u_t seconds. _t_i_m_e_o_u_t may be a + decimal number with a fractional portion following the + decimal point. This option is only effective if rreeaadd is + reading input from a terminal, pipe, or other special + file; it has no effect when reading from regular files. + If rreeaadd times out, it saves any partial input read into + the specified variable _n_a_m_e, and the exit status is + greater than 128. If _t_i_m_e_o_u_t is 0, rreeaadd returns immedi- + ately, without trying to read any data. In this case, + the exit status is 0 if input is available on the speci- + fied file descriptor, or the read will return EOF, non- + zero otherwise. + --uu _f_d Read input from file descriptor _f_d instead of the stan- + dard input. + + Other than the case where _d_e_l_i_m is the empty string, rreeaadd ig- nores any NUL characters in the input. - If no _n_a_m_e_s are supplied, the line read, without the ending de- - limiter but otherwise unmodified, is assigned to the variable - RREEPPLLYY. The exit status is zero, unless end-of-file is encoun- - tered, rreeaadd times out (in which case the status is greater than - 128), a variable assignment error (such as assigning to a read- - only variable) occurs, or an invalid file descriptor is supplied - as the argument to --uu. + If no _n_a_m_e_s are supplied, rreeaadd assigns the line read, without + the ending delimiter but otherwise unmodified, to the variable + RREEPPLLYY. + + The exit status is zero, unless end-of-file is encountered, rreeaadd + times out (in which case the status is greater than 128), a + variable assignment error (such as assigning to a readonly vari- + able) occurs, or an invalid file descriptor is supplied as the + argument to --uu. rreeaaddoonnllyy [--aaAAff] [--pp] [_n_a_m_e[=_w_o_r_d] ...] The given _n_a_m_e_s are marked readonly; the values of these _n_a_m_e_s - may not be changed by subsequent assignment. If the --ff option - is supplied, the functions corresponding to the _n_a_m_e_s are so - marked. The --aa option restricts the variables to indexed ar- - rays; the --AA option restricts the variables to associative ar- - rays. If both options are supplied, --AA takes precedence. If no - _n_a_m_e arguments are given, or if the --pp option is supplied, a - list of all readonly names is printed. The other options may be - used to restrict the output to a subset of the set of readonly - names. The --pp option causes output to be displayed in a format - that may be reused as input. If a variable name is followed by - =_w_o_r_d, the value of the variable is set to _w_o_r_d. The return - status is 0 unless an invalid option is encountered, one of the - _n_a_m_e_s is not a valid shell variable name, or --ff is supplied with - a _n_a_m_e that is not a function. + may not be changed by subsequent assignment or unset. If the --ff + option is supplied, each _n_a_m_e refers to a shell function. The + --aa option restricts the variables to indexed arrays; the --AA op- + tion restricts the variables to associative arrays. If both op- + tions are supplied, --AA takes precedence. If no _n_a_m_e arguments + are supplied, or if the --pp option is supplied, print a list of + all readonly names. The other options may be used to restrict + the output to a subset of the set of readonly names. The --pp op- + tion displays output in a format that may be reused as input. + + rreeaaddoonnllyy allows the value of a variable to be set at the same + time the readonly attribute is changed by following the variable + name with =_v_a_l_u_e. This sets the value of the variable is to + _v_a_l_u_e while modifying the readonly attribute. + + The return status is 0 unless an invalid option is encountered, + one of the _n_a_m_e_s is not a valid shell variable name, or --ff is + supplied with a _n_a_m_e that is not a function. rreettuurrnn [_n] - Causes a function to stop executing and return the value speci- - fied by _n to its caller. If _n is omitted, the return status is - that of the last command executed in the function body. If rree-- - ttuurrnn is executed by a trap handler, the last command used to de- - termine the status is the last command executed before the trap - handler. If rreettuurrnn is executed during a DDEEBBUUGG trap, the last - command used to determine the status is the last command exe- - cuted by the trap handler before rreettuurrnn was invoked. If rreettuurrnn - is used outside a function, but during execution of a script by - the .. (ssoouurrccee) command, it causes the shell to stop executing - that script and return either _n or the exit status of the last - command executed within the script as the exit status of the - script. If _n is supplied, the return value is its least signif- - icant 8 bits. The return status is non-zero if rreettuurrnn is sup- - plied a non-numeric argument, or is used outside a function and - not during execution of a script by .. or ssoouurrccee. Any command - associated with the RREETTUURRNN trap is executed before execution re- - sumes after the function or script. + Stop executing a shell function or sourced file and return the + value specified by _n to its caller. If _n is omitted, the return + status is that of the last command executed. If rreettuurrnn is exe- + cuted by a trap handler, the last command used to determine the + status is the last command executed before the trap handler. If + rreettuurrnn is executed during a DDEEBBUUGG trap, the last command used to + determine the status is the last command executed by the trap + handler before rreettuurrnn was invoked. + + When rreettuurrnn is used to terminate execution of a script being ex- + ecuted by the .. (ssoouurrccee) command, it causes the shell to stop + executing that script and return either _n or the exit status of + the last command executed within the script as the exit status + of the script. If _n is supplied, the return value is its least + significant 8 bits. + + Any command associated with the RREETTUURRNN trap is executed before + execution resumes after the function or script. + + The return status is non-zero if rreettuurrnn is supplied a non-nu- + meric argument, or is used outside a function and not during ex- + ecution of a script by .. or ssoouurrccee. sseett [--aabbeeffhhkkmmnnppttuuvvxxBBCCEEHHPPTT] [--oo _o_p_t_i_o_n_-_n_a_m_e] [----] [--] [_a_r_g ...] sseett [++aabbeeffhhkkmmnnppttuuvvxxBBCCEEHHPPTT] [++oo _o_p_t_i_o_n_-_n_a_m_e] [----] [--] [_a_r_g ...] sseett --oo - sseett ++oo Without options, display the name and value of each shell vari- - able in a format that can be reused as input for setting or re- + sseett ++oo Without options, display the name and value of each shell vari- + able in a format that can be reused as input for setting or re- setting the currently-set variables. Read-only variables cannot - be reset. In _p_o_s_i_x _m_o_d_e, only shell variables are listed. The - output is sorted according to the current locale. When options - are specified, they set or unset shell attributes. Any argu- - ments remaining after option processing are treated as values + be reset. In _p_o_s_i_x _m_o_d_e, only shell variables are listed. The + output is sorted according to the current locale. When options + are specified, they set or unset shell attributes. Any argu- + ments remaining after option processing are treated as values for the positional parameters and are assigned, in order, to $$11, - $$22, ..., $$_n. Options, if specified, have the following mean- + $$22, ..., $$_n. Options, if specified, have the following mean- ings: --aa Each variable or function that is created or modified is - given the export attribute and marked for export to the + given the export attribute and marked for export to the environment of subsequent commands. - --bb Report the status of terminated background jobs immedi- - ately, rather than before the next primary prompt. This - is effective only when job control is enabled. + --bb Report the status of terminated background jobs immedi- + ately, rather than before the next primary prompt or af- + ter a foreground command terminates. This is effective + only when job control is enabled. --ee Exit immediately if a _p_i_p_e_l_i_n_e (which may consist of a single _s_i_m_p_l_e _c_o_m_m_a_n_d), a _l_i_s_t, or a _c_o_m_p_o_u_n_d _c_o_m_m_a_n_d (see SSHHEELLLL GGRRAAMMMMAARR in _b_a_s_h(1)), exits with a non-zero @@ -1308,39 +1424,39 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS no _o_p_t_i_o_n_-_n_a_m_e, sseett prints a series of sseett commands to recreate the current option settings on the standard output. - --pp Turn on _p_r_i_v_i_l_e_g_e_d mode. In this mode, the $$EENNVV and - $$BBAASSHH__EENNVV files are not processed, shell functions are - not inherited from the environment, and the SSHHEELLLLOOPPTTSS, - BBAASSHHOOPPTTSS, CCDDPPAATTHH, and GGLLOOBBIIGGNNOORREE variables, if they ap- - pear in the environment, are ignored. If the shell is - started with the effective user (group) id not equal to - the real user (group) id, and the --pp option is not sup- - plied, these actions are taken and the effective user id - is set to the real user id. If the --pp option is sup- - plied at startup, the effective user id is not reset. - Turning this option off causes the effective user and + --pp Turn on _p_r_i_v_i_l_e_g_e_d mode. In this mode, the shell does + not read the $$EENNVV and $$BBAASSHH__EENNVV files, shell functions + are not inherited from the environment, and the SSHHEELL-- + LLOOPPTTSS, BBAASSHHOOPPTTSS, CCDDPPAATTHH, and GGLLOOBBIIGGNNOORREE variables, if + they appear in the environment, are ignored. If the + shell is started with the effective user (group) id not + equal to the real user (group) id, and the --pp option is + not supplied, these actions are taken and the effective + user id is set to the real user id. If the --pp option is + supplied at startup, the effective user id is not reset. + Turning this option off causes the effective user and group ids to be set to the real user and group ids. --rr Enable restricted shell mode. This option cannot be un- set once it has been set. --tt Exit after reading and executing one command. --uu Treat unset variables and parameters other than the spe- - cial parameters and or array variables subscripted with - or as an error when performing parameter expansion. If - expansion is attempted on an unset variable or parame- - ter, the shell prints an error message, and, if not in- + cial parameters and or array variables subscripted with + or as an error when performing parameter expansion. If + expansion is attempted on an unset variable or parame- + ter, the shell prints an error message, and, if not in- teractive, exits with a non-zero status. --vv Print shell input lines as they are read. - --xx After expanding each _s_i_m_p_l_e _c_o_m_m_a_n_d, ffoorr command, ccaassee + --xx After expanding each _s_i_m_p_l_e _c_o_m_m_a_n_d, ffoorr command, ccaassee command, sseelleecctt command, or arithmetic ffoorr command, dis- - play the expanded value of PPSS44, followed by the command - and its expanded arguments or associated word list, to - standard error. - --BB The shell performs brace expansion (see BBrraaccee EExxppaannssiioonn + play the expanded value of PPSS44, followed by the command + and its expanded arguments or associated word list, to + the standard error. + --BB The shell performs brace expansion (see BBrraaccee EExxppaannssiioonn in _b_a_s_h(1)). This is on by default. - --CC If set, bbaasshh does not overwrite an existing file with - the >>, >>&&, and <<>> redirection operators. This may be - overridden when creating output files by using the redi- - rection operator >>|| instead of >>. + --CC If set, bbaasshh does not overwrite an existing file with + the >>, >>&&, and <<>> redirection operators. Using the + redirection operator >>|| instead of >> will override this + and force the creation of an output file. --EE If set, any trap on EERRRR is inherited by shell functions, command substitutions, and commands executed in a sub- shell environment. The EERRRR trap is normally not inher- @@ -1357,48 +1473,47 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS shell functions, command substitutions, and commands ex- ecuted in a subshell environment. The DDEEBBUUGG and RREETTUURRNN traps are normally not inherited in such cases. - ---- If no arguments follow this option, then the positional - parameters are unset. Otherwise, the positional parame- - ters are set to the _a_r_gs, even if some of them begin - with a --. - -- Signal the end of options, cause all remaining _a_r_gs to - be assigned to the positional parameters. The --xx and --vv - options are turned off. If there are no _a_r_gs, the posi- - tional parameters remain unchanged. + ---- If no arguments follow this option, unset the positional + parameters. Otherwise, set the positional parameters to + the _a_r_gs, even if some of them begin with a --. + -- Signal the end of options, and assign all remaining _a_r_gs + to the positional parameters. The --xx and --vv options are + turned off. If there are no _a_r_gs, the positional para- + meters remain unchanged. The options are off by default unless otherwise noted. Using + rather than - causes these options to be turned off. The op- tions can also be specified as arguments to an invocation of the shell. The current set of options may be found in $$--. The re- - turn status is always true unless an invalid option is encoun- + turn status is always zero unless an invalid option is encoun- tered. sshhiifftt [_n] - The positional parameters from _n+1 ... are renamed to $$11 ........ - Parameters represented by the numbers $$## down to $$##-_n+1 are un- - set. _n must be a non-negative number less than or equal to $$##. - If _n is 0, no parameters are changed. If _n is not given, it is - assumed to be 1. If _n is greater than $$##, the positional para- - meters are not changed. The return status is greater than zero - if _n is greater than $$## or less than zero; otherwise 0. + Rename positional parameters from _n+1 ... to $$11 ........ Parameters + represented by the numbers $$## down to $$##-_n+1 are unset. _n must + be a non-negative number less than or equal to $$##. If _n is 0, + no parameters are changed. If _n is not given, it is assumed to + be 1. If _n is greater than $$##, the positional parameters are + not changed. The return status is greater than zero if _n is + greater than $$## or less than zero; otherwise 0. sshhoopptt [--ppqqssuu] [--oo] [_o_p_t_n_a_m_e ...] - Toggle the values of settings controlling optional shell behav- - ior. The settings can be either those listed below, or, if the + Toggle the values of settings controlling optional shell behav- + ior. The settings can be either those listed below, or, if the --oo option is used, those available with the --oo option to the sseett - builtin command. With no options, or with the --pp option, a list - of all settable options is displayed, with an indication of - whether or not each is set; if _o_p_t_n_a_m_e_s are supplied, the output - is restricted to those options. The --pp option causes output to - be displayed in a form that may be reused as input. Other op- - tions have the following meanings: + builtin command. With no options, or with the --pp option, dis- + play a list of all settable options, with an indication of + whether or not each is set; if any _o_p_t_n_a_m_e_s are supplied, the + output is restricted to those options. The --pp option displays + output in a form that may be reused as input. Other options + have the following meanings: --ss Enable (set) each _o_p_t_n_a_m_e. --uu Disable (unset) each _o_p_t_n_a_m_e. - --qq Suppresses normal output (quiet mode); the return status + --qq Suppresses normal output (quiet mode); the return status indicates whether the _o_p_t_n_a_m_e is set or unset. If multi- - ple _o_p_t_n_a_m_e arguments are given with --qq, the return sta- - tus is zero if all _o_p_t_n_a_m_e_s are enabled; non-zero other- - wise. + ple _o_p_t_n_a_m_e arguments are supplied with --qq, the return + status is zero if all _o_p_t_n_a_m_e_s are enabled; non-zero oth- + erwise. --oo Restricts the values of _o_p_t_n_a_m_e to be those defined for the --oo option to the sseett builtin. @@ -1433,30 +1548,30 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS If set, an argument to the ccdd builtin command that is not a directory is assumed to be the name of a variable whose value is the directory to change to. - ccddssppeellll If set, minor errors in the spelling of a directory com- - ponent in a ccdd command will be corrected. The errors - checked for are transposed characters, a missing charac- - ter, and one character too many. If a correction is - found, the corrected filename is printed, and the com- - mand proceeds. This option is only used by interactive - shells. + ccddssppeellll If set, the ccdd command attempts to correct minor errors + in the spelling of a directory component. Minor errors + include transposed characters, a missing character, and + one extra character. If ccdd corrects the directory name, + it prints the corrected filename, and the command pro- + ceeds. This option is only used by interactive shells. cchheecckkhhaasshh If set, bbaasshh checks that a command found in the hash ta- ble exists before trying to execute it. If a hashed - command no longer exists, a normal path search is per- - formed. + command no longer exists, bbaasshh performs a normal path + search. cchheecckkjjoobbss If set, bbaasshh lists the status of any stopped and running jobs before exiting an interactive shell. If any jobs - are running, this causes the exit to be deferred until a - second exit is attempted without an intervening command - (see JJOOBB CCOONNTTRROOLL in _b_a_s_h(1)). The shell always post- - pones exiting if any jobs are stopped. + are running, bbaasshh defers the exit until a second exit is + attempted without an intervening command (see JJOOBB CCOONN-- + TTRROOLL in _b_a_s_h(1)). The shell always postpones exiting if + any jobs are stopped. cchheecckkwwiinnssiizzee - If set, bbaasshh checks the window size after each external - (non-builtin) command and, if necessary, updates the - values of LLIINNEESS and CCOOLLUUMMNNSS. This option is enabled by - default. + If set, bbaasshh checks the window size after each external + (non-builtin) command and, if necessary, updates the + values of LLIINNEESS and CCOOLLUUMMNNSS, using the file descriptor + associated with the standard error if it is a terminal. + This option is enabled by default. ccmmddhhiisstt If set, bbaasshh attempts to save all lines of a multiple- line command in the same history entry. This allows easy re-editing of multi-line commands. This option is @@ -1508,8 +1623,8 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS eexxeeccffaaiill If set, a non-interactive shell will not exit if it can- not execute the file specified as an argument to the - eexxeecc builtin command. An interactive shell does not - exit if eexxeecc fails. + eexxeecc builtin. An interactive shell does not exit if + eexxeecc fails. eexxppaanndd__aalliiaasseess If set, aliases are expanded as described in _b_a_s_h(1) un- @@ -1548,34 +1663,34 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS shell functions, and subshells invoked with (( _c_o_m_m_a_n_d )) inherit the EERRRR trap. - eexxttgglloobb If set, the extended pattern matching features described - in _b_a_s_h(1) under PPaatthhnnaammee EExxppaannssiioonn are enabled. + eexxttgglloobb If set, enable the extended pattern matching features + described in _b_a_s_h(1) under PPaatthhnnaammee EExxppaannssiioonn. eexxttqquuoottee - If set, $$_s_t_r_i_n_g and $$_s_t_r_i_n_g quoting is performed within + If set, $$_s_t_r_i_n_g and $$_s_t_r_i_n_g quoting is performed within $${{_p_a_r_a_m_e_t_e_r}} expansions enclosed in double quotes. This option is enabled by default. ffaaiillgglloobb - If set, patterns which fail to match filenames during + If set, patterns which fail to match filenames during pathname expansion result in an expansion error. ffoorrccee__ffiiggnnoorree - If set, the suffixes specified by the FFIIGGNNOORREE shell - variable cause words to be ignored when performing word + If set, the suffixes specified by the FFIIGGNNOORREE shell + variable cause words to be ignored when performing word completion even if the ignored words are the only possi- - ble completions. See SSHHEELLLL VVAARRIIAABBLLEESS in _b_a_s_h(1) for a - description of FFIIGGNNOORREE. This option is enabled by de- + ble completions. See SSHHEELLLL VVAARRIIAABBLLEESS in _b_a_s_h(1) for a + description of FFIIGGNNOORREE. This option is enabled by de- fault. gglloobbaasscciiiirraannggeess - If set, range expressions used in pattern matching - bracket expressions (see PPaatttteerrnn MMaattcchhiinngg in _b_a_s_h(1)) + If set, range expressions used in pattern matching + bracket expressions (see PPaatttteerrnn MMaattcchhiinngg in _b_a_s_h(1)) behave as if in the traditional C locale when performing - comparisons. That is, the current locale's collating - sequence is not taken into account, so bb will not col- - late between AA and BB, and upper-case and lower-case - ASCII characters will collate together. + comparisons. That is, pattern matching does not take + the current locale's collating sequence into account, so + bb will not collate between AA and BB, and upper-case and + lower-case ASCII characters will collate together. gglloobbsskkiippddoottss If set, pathname expansion will never match the file- @@ -1598,20 +1713,21 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS its, rather than overwriting the file. hhiissttrreeeeddiitt - If set, and rreeaaddlliinnee is being used, a user is given the - opportunity to re-edit a failed history substitution. + If set, and rreeaaddlliinnee is being used, the user is given + the opportunity to re-edit a failed history substitu- + tion. hhiissttvveerriiffyy - If set, and rreeaaddlliinnee is being used, the results of his- - tory substitution are not immediately passed to the - shell parser. Instead, the resulting line is loaded + If set, and rreeaaddlliinnee is being used, the results of his- + tory substitution are not immediately passed to the + shell parser. Instead, the resulting line is loaded into the rreeaaddlliinnee editing buffer, allowing further modi- fication. hhoossttccoommpplleettee If set, and rreeaaddlliinnee is being used, bbaasshh will attempt to - perform hostname completion when a word containing a @@ - is being completed (see CCoommpplleettiinngg under RREEAADDLLIINNEE in + perform hostname completion when a word containing a @@ + is being completed (see CCoommpplleettiinngg under RREEAADDLLIINNEE in _b_a_s_h(1)). This is enabled by default. hhuuppoonneexxiitt @@ -1619,23 +1735,23 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS active login shell exits. iinnhheerriitt__eerrrreexxiitt - If set, command substitution inherits the value of the - eerrrreexxiitt option, instead of unsetting it in the subshell - environment. This option is enabled when _p_o_s_i_x _m_o_d_e is + If set, command substitution inherits the value of the + eerrrreexxiitt option, instead of unsetting it in the subshell + environment. This option is enabled when _p_o_s_i_x _m_o_d_e is enabled. iinntteerraaccttiivvee__ccoommmmeennttss - If set, allow a word beginning with ## to cause that word - and all remaining characters on that line to be ignored - in an interactive shell (see CCOOMMMMEENNTTSS in _b_a_s_h(1)). This - option is enabled by default. + In an interactive shell, a word beginning with ## causes + that word and all remaining characters on that line to + be ignored, as in a non-interactive shell (see CCOOMMMMEENNTTSS + in _b_a_s_h(1)). This option is enabled by default. llaassttppiippee - If set, and job control is not active, the shell runs + If set, and job control is not active, the shell runs the last command of a pipeline not executed in the back- ground in the current shell environment. - lliitthhiisstt If set, and the ccmmddhhiisstt option is enabled, multi-line + lliitthhiisstt If set, and the ccmmddhhiisstt option is enabled, multi-line commands are saved to the history with embedded newlines rather than using semicolon separators where possible. @@ -1646,9 +1762,9 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS tribute is not inherited. llooccaallvvaarr__uunnsseett - If set, calling uunnsseett on local variables in previous - function scopes marks them so subsequent lookups find - them unset until that function returns. This is identi- + If set, calling uunnsseett on local variables in previous + function scopes marks them so subsequent lookups find + them unset until that function returns. This is identi- cal to the behavior of unsetting local variables at the current function scope. @@ -1663,110 +1779,110 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS displays the message nnoo__eemmppttyy__ccmmdd__ccoommpplleettiioonn - If set, and rreeaaddlliinnee is being used, bbaasshh will not at- - tempt to search the PPAATTHH for possible completions when - completion is attempted on an empty line. + If set, and rreeaaddlliinnee is being used, bbaasshh does not search + PPAATTHH for possible completions when completion is at- + tempted on an empty line. nnooccaasseegglloobb - If set, bbaasshh matches filenames in a case-insensitive + If set, bbaasshh matches filenames in a case-insensitive fashion when performing pathname expansion (see PPaatthhnnaammee EExxppaannssiioonn in _b_a_s_h(1)). nnooccaasseemmaattcchh - If set, bbaasshh matches patterns in a case-insensitive + If set, bbaasshh matches patterns in a case-insensitive fashion when performing matching while executing ccaassee or [[[[ conditional commands, when performing pattern substi- - tution word expansions, or when filtering possible com- + tution word expansions, or when filtering possible com- pletions as part of programmable completion. nnooeexxppaanndd__ttrraannssllaattiioonn - If set, bbaasshh encloses the translated results of $$... - quoting in single quotes instead of double quotes. If + If set, bbaasshh encloses the translated results of $$... + quoting in single quotes instead of double quotes. If the string is not translated, this has no effect. nnuullllgglloobb If set, pathname expansion patterns which match no files - (see PPaatthhnnaammee EExxppaannssiioonn in _b_a_s_h(1)) expand to nothing + (see PPaatthhnnaammee EExxppaannssiioonn in _b_a_s_h(1)) expand to nothing and are removed, rather than expanding to themselves. ppaattssuubb__rreeppllaacceemmeenntt If set, bbaasshh expands occurrences of && in the replacement - string of pattern substitution to the text matched by - the pattern, as described under PPaarraammeetteerr EExxppaannssiioonn in + string of pattern substitution to the text matched by + the pattern, as described under PPaarraammeetteerr EExxppaannssiioonn in _b_a_s_h(1). This option is enabled by default. pprrooggccoommpp - If set, the programmable completion facilities (see PPrroo-- - ggrraammmmaabbllee CCoommpplleettiioonn in _b_a_s_h(1)) are enabled. This op- - tion is enabled by default. + If set, enable the programmable completion facilities + (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn in _b_a_s_h(1)). This option + is enabled by default. pprrooggccoommpp__aalliiaass If set, and programmable completion is enabled, bbaasshh treats a command name that doesn't have any completions - as a possible alias and attempts alias expansion. If it - has an alias, bbaasshh attempts programmable completion us- + as a possible alias and attempts alias expansion. If it + has an alias, bbaasshh attempts programmable completion us- ing the command word resulting from the expanded alias. pprroommppttvvaarrss If set, prompt strings undergo parameter expansion, com- - mand substitution, arithmetic expansion, and quote re- - moval after being expanded as described in PPRROOMMPPTTIINNGG in + mand substitution, arithmetic expansion, and quote re- + moval after being expanded as described in PPRROOMMPPTTIINNGG in _b_a_s_h(1). This option is enabled by default. rreessttrriicctteedd__sshheellll - The shell sets this option if it is started in re- - stricted mode (see RREESSTTRRIICCTTEEDD SSHHEELLLL in _b_a_s_h(1)). The - value may not be changed. This is not reset when the - startup files are executed, allowing the startup files + The shell sets this option if it is started in re- + stricted mode (see RREESSTTRRIICCTTEEDD SSHHEELLLL in _b_a_s_h(1)). The + value may not be changed. This is not reset when the + startup files are executed, allowing the startup files to discover whether or not a shell is restricted. sshhiifftt__vveerrbboossee - If set, the sshhiifftt builtin prints an error message when + If set, the sshhiifftt builtin prints an error message when the shift count exceeds the number of positional parame- ters. ssoouurrcceeppaatthh If set, the .. (ssoouurrccee) builtin uses the value of PPAATTHH to - find the directory containing the file supplied as an - argument when the --pp option is not supplied. This op- + find the directory containing the file supplied as an + argument when the --pp option is not supplied. This op- tion is enabled by default. vvaarrrreeddiirr__cclloossee - If set, the shell automatically closes file descriptors - assigned using the _{_v_a_r_n_a_m_e_} redirection syntax (see - RREEDDIIRREECCTTIIOONN in _b_a_s_h(1)) instead of leaving them open + If set, the shell automatically closes file descriptors + assigned using the _{_v_a_r_n_a_m_e_} redirection syntax (see + RREEDDIIRREECCTTIIOONN in _b_a_s_h(1)) instead of leaving them open when the command completes. xxppgg__eecchhoo - If set, the eecchhoo builtin expands backslash-escape se- - quences by default. If the ppoossiixx shell option is also + If set, the eecchhoo builtin expands backslash-escape se- + quences by default. If the ppoossiixx shell option is also enabled, eecchhoo does not interpret any options. ssuussppeenndd [--ff] - Suspend the execution of this shell until it receives a SSIIGGCCOONNTT - signal. A login shell, or a shell without job control enabled, - cannot be suspended; the --ff option can be used to override this - and force the suspension. The return status is 0 unless the - shell is a login shell or job control is not enabled and --ff is - not supplied. + Suspend the execution of this shell until it receives a SSIIGGCCOONNTT + signal. A login shell, or a shell without job control enabled, + cannot be suspended; the --ff option will override this and force + the suspension. The return status is 0 unless the shell is a + login shell or job control is not enabled and --ff is not sup- + plied. tteesstt _e_x_p_r [[ _e_x_p_r ]] Return a status of 0 (true) or 1 (false) depending on the evalu- - ation of the conditional expression _e_x_p_r. Each operator and - operand must be a separate argument. Expressions are composed - of the primaries described in _b_a_s_h(1) under CCOONNDDIITTIIOONNAALL EEXXPPRREESS-- + ation of the conditional expression _e_x_p_r. Each operator and + operand must be a separate argument. Expressions are composed + of the primaries described in _b_a_s_h(1) under CCOONNDDIITTIIOONNAALL EEXXPPRREESS-- SSIIOONNSS. tteesstt does not accept any options, nor does it accept and ignore an argument of ---- as signifying the end of options. - Expressions may be combined using the following operators, - listed in decreasing order of precedence. The evaluation de- - pends on the number of arguments; see below. Operator prece- - dence is used when there are five or more arguments. + Expressions may be combined using the following operators, + listed in decreasing order of precedence. The evaluation de- + pends on the number of arguments; see below. tteesstt uses operator + precedence when there are five or more arguments. !! _e_x_p_r True if _e_x_p_r is false. (( _e_x_p_r )) Returns the value of _e_x_p_r. This may be used to override - the normal precedence of operators. + normal operator precedence. _e_x_p_r_1 -aa _e_x_p_r_2 True if both _e_x_p_r_1 and _e_x_p_r_2 are true. _e_x_p_r_1 -oo _e_x_p_r_2 @@ -1805,138 +1921,151 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS The following conditions are applied in the order listed. If the first argument is !!, the result is the negation of the three-argument expression composed of the remaining - arguments. the two-argument test using the second and - third arguments. If the first argument is exactly (( and - the fourth argument is exactly )), the result is the two- - argument test of the second and third arguments. Other- - wise, the expression is parsed and evaluated according to + arguments. If the first argument is exactly (( and the + fourth argument is exactly )), the result is the two-argu- + ment test of the second and third arguments. Otherwise, + the expression is parsed and evaluated according to precedence using the rules listed above. 5 or more arguments - The expression is parsed and evaluated according to + The expression is parsed and evaluated according to precedence using the rules listed above. When the shell is in _p_o_s_i_x _m_o_d_e, or if the expression is part of the [[[[ command, the << and >> operators sort using the current lo- - cale. If the shell is not in _p_o_s_i_x _m_o_d_e, the tteesstt and [[ com- + cale. If the shell is not in _p_o_s_i_x _m_o_d_e, the tteesstt and [[ com- mands sort lexicographically using ASCII ordering. + The historical operator-precedence parsing with 4 or more + arguments can lead to ambiguities when it encounters + strings that look like primaries. The POSIX standard has + deprecated the --aa and --oo primaries and enclosing expres- + sions within parentheses. Scripts should no longer use + them. It's much more reliable to restrict test invoca- + tions to a single primary, and to replace uses of --aa and + --oo with the shell's &&&& and |||| list operators. + ttiimmeess Print the accumulated user and system times for the shell and for processes run from the shell. The return status is 0. - ttrraapp [--llpp] [[_a_c_t_i_o_n] _s_i_g_s_p_e_c ...] + ttrraapp [--PPllpp] [[_a_c_t_i_o_n] _s_i_g_s_p_e_c ...] The _a_c_t_i_o_n is a command that is read and executed when the shell - receives signal(s) _s_i_g_s_p_e_c. If _a_c_t_i_o_n is absent (and there is a - single _s_i_g_s_p_e_c) or --, each specified signal is reset to its - original disposition (the value it had upon entrance to the - shell). If _a_c_t_i_o_n is the null string the signal specified by - each _s_i_g_s_p_e_c is ignored by the shell and by the commands it in- - vokes. - - If no arguments are supplied, ttrraapp displays the actions associ- + receives any of the signals _s_i_g_s_p_e_c. If _a_c_t_i_o_n is absent (and + there is a single _s_i_g_s_p_e_c) or --, each specified _s_i_g_s_p_e_c is reset + to the value it had when the shell was started. If _a_c_t_i_o_n is + the null string the signal specified by each _s_i_g_s_p_e_c is ignored + by the shell and by the commands it invokes. + + If no arguments are supplied, ttrraapp displays the actions associ- ated with each trapped signal as a set of ttrraapp commands that can - be reused as shell input to restore the current signal disposi- - tions. If --pp is given, and _a_c_t_i_o_n is not present, then ttrraapp - displays the actions associated with each _s_i_g_s_p_e_c or, if none + be reused as shell input to restore the current signal disposi- + tions. If --pp is given, and _a_c_t_i_o_n is not present, then ttrraapp + displays the actions associated with each _s_i_g_s_p_e_c or, if none are supplied, for all trapped signals, as a set of ttrraapp commands - that can be reused as shell input to restore the current signal - dispositions. The --PP option behaves similarly, but displays - only the actions associated with each _s_i_g_s_p_e_c argument. --PP re- - quires at least one _s_i_g_s_p_e_c argument. The --PP or --pp options to - ttrraapp may be used in a subshell environment (e.g., command sub- - stitution) and, as long as they are used before ttrraapp is used to - change a signal's handling, will display the state of its par- - ent's traps. - - The --ll option causes ttrraapp to print a list of signal names and - their corresponding numbers. Each _s_i_g_s_p_e_c is either a signal - name defined in <_s_i_g_n_a_l_._h>, or a signal number. Signal names - are case insensitive and the SSIIGG prefix is optional. - - If a _s_i_g_s_p_e_c is EEXXIITT (0) the command _a_c_t_i_o_n is executed on exit - from the shell. If a _s_i_g_s_p_e_c is DDEEBBUUGG, the command _a_c_t_i_o_n is - executed before every _s_i_m_p_l_e _c_o_m_m_a_n_d, _f_o_r command, _c_a_s_e command, - _s_e_l_e_c_t command, (( arithmetic command, [[ conditional command, - arithmetic _f_o_r command, and before the first command executes in - a shell function (see SSHHEELLLL GGRRAAMMMMAARR in _b_a_s_h(1)). Refer to the - description of the eexxttddeebbuugg option to the sshhoopptt builtin for de- - tails of its effect on the DDEEBBUUGG trap. If a _s_i_g_s_p_e_c is RREETTUURRNN, - the command _a_c_t_i_o_n is executed each time a shell function or a - script executed with the .. or ssoouurrccee builtins finishes execut- - ing. - - If a _s_i_g_s_p_e_c is EERRRR, the command _a_c_t_i_o_n is executed whenever a - pipeline (which may consist of a single simple command), a list, - or a compound command returns a non-zero exit status, subject to - the following conditions. The EERRRR trap is not executed if the + that can be reused as shell input to restore the current signal + dispositions. The --PP option behaves similarly, but displays + only the actions associated with each _s_i_g_s_p_e_c argument. --PP re- + quires at least one _s_i_g_s_p_e_c argument. The --PP or --pp options may + be used in a subshell environment (e.g., command substitution) + and, as long as they are used before ttrraapp is used to change a + signal's handling, will display the state of its parent's traps. + + The --ll option prints a list of signal names and their corre- + sponding numbers. Each _s_i_g_s_p_e_c is either a signal name defined + in <_s_i_g_n_a_l_._h>, or a signal number. Signal names are case insen- + sitive and the SSIIGG prefix is optional. If --ll is supplied with + no _s_i_g_s_p_e_c arguments, it prints a list of valid signal names. + + If a _s_i_g_s_p_e_c is EEXXIITT (0), _a_c_t_i_o_n is executed on exit from the + shell. If a _s_i_g_s_p_e_c is DDEEBBUUGG, _a_c_t_i_o_n is executed before every + _s_i_m_p_l_e _c_o_m_m_a_n_d, _f_o_r command, _c_a_s_e command, _s_e_l_e_c_t command, (( + arithmetic command, [[ conditional command, arithmetic _f_o_r com- + mand, and before the first command executes in a shell function + (see SSHHEELLLL GGRRAAMMMMAARR in _b_a_s_h(1)). Refer to the description of the + eexxttddeebbuugg shell option (see sshhoopptt in _b_a_s_h(1)) for details of its + effect on the DDEEBBUUGG trap. If a _s_i_g_s_p_e_c is RREETTUURRNN, _a_c_t_i_o_n is ex- + ecuted each time a shell function or a script executed with the + .. or ssoouurrccee builtins finishes executing. + + If a _s_i_g_s_p_e_c is EERRRR, _a_c_t_i_o_n is executed whenever a pipeline + (which may consist of a single simple command), a list, or a + compound command returns a non-zero exit status, subject to the + following conditions. The EERRRR trap is not executed if the failed command is part of the command list immediately following - a wwhhiillee or uunnttiill keyword, part of the test in an _i_f statement, + a wwhhiillee or uunnttiill keyword, part of the test in an _i_f statement, part of a command executed in a &&&& or |||| list except the command - following the final &&&& or ||||, any command in a pipeline but the - last, or if the command's return value is being inverted using - !!. These are the same conditions obeyed by the eerrrreexxiitt (--ee) op- - tion. + following the final &&&& or ||||, any command in a pipeline but the + last (subject to the state of the ppiippeeffaaiill shell option), or if + the command's return value is being inverted using !!. These are + the same conditions obeyed by the eerrrreexxiitt (--ee) option. When the shell is not interactive, signals ignored upon entry to the shell cannot be trapped or reset. Interactive shells permit trapping signals ignored on entry. Trapped signals that are not - being ignored are reset to their original values in a subshell - or subshell environment when one is created. The return status + being ignored are reset to their original values in a subshell + or subshell environment when one is created. The return status is false if any _s_i_g_s_p_e_c is invalid; otherwise ttrraapp returns true. ttrruuee Does nothing, returns a 0 status. ttyyppee [--aaffttppPP] _n_a_m_e [_n_a_m_e ...] - With no options, indicate how each _n_a_m_e would be interpreted if - used as a command name. If the --tt option is used, ttyyppee prints a - string which is one of _a_l_i_a_s, _k_e_y_w_o_r_d, _f_u_n_c_t_i_o_n, _b_u_i_l_t_i_n, or - _f_i_l_e if _n_a_m_e is an alias, shell reserved word, function, - builtin, or executable disk file, respectively. If the _n_a_m_e is - not found, then nothing is printed, and ttyyppee returns a non-zero - exit status. If the --pp option is used, ttyyppee either returns the - name of the executable file that would be found by searching - $$PPAATTHH if _n_a_m_e were specified as a command name, or nothing if - would not return _f_i_l_e. The --PP option forces a PPAATTHH search for - each _n_a_m_e, even if would not return _f_i_l_e. If a command is - hashed, --pp and --PP print the hashed value, which is not necessar- - ily the file that appears first in PPAATTHH. If the --aa option is - used, ttyyppee prints all of the places that contain a command named - _n_a_m_e. This includes aliases, reserved words, functions, and - builtins, but the path search options (--pp and --PP) can be sup- - plied to restrict the output to executable files. ttyyppee does not - consult the table of hashed commands when using --aa with --pp, and - only performs a PPAATTHH search for _n_a_m_e. The --ff option suppresses - shell function lookup, as with the ccoommmmaanndd builtin. ttyyppee re- - turns true if all of the arguments are found, false if any are - not found. + Indicate how each _n_a_m_e would be interpreted if used as a command + name. + + If the --tt option is used, ttyyppee prints a string which is one of + _a_l_i_a_s, _k_e_y_w_o_r_d, _f_u_n_c_t_i_o_n, _b_u_i_l_t_i_n, or _f_i_l_e if _n_a_m_e is an alias, + shell reserved word, function, builtin, or executable file, re- + spectively. If the _n_a_m_e is not found, ttyyppee prints nothing and + returns a non-zero exit status. + + If the --pp option is used, ttyyppee either returns the pathname of + the executable file that would be found by searching $$PPAATTHH for + _n_a_m_e or nothing if would not return _f_i_l_e. The --PP option forces + a PPAATTHH search for each _n_a_m_e, even if would not return _f_i_l_e. If + _n_a_m_e is present in the table of hashed commands, --pp and --PP print + the hashed value, which is not necessarily the file that appears + first in PPAATTHH. + + If the --aa option is used, ttyyppee prints all of the places that + contain a command named _n_a_m_e. This includes aliases, reserved + words, functions, and builtins, but the path search options (--pp + and --PP) can be supplied to restrict the output to executable + files. ttyyppee does not consult the table of hashed commands when + using --aa with --pp, and only performs a PPAATTHH search for _n_a_m_e. + + The --ff option suppresses shell function lookup, as with the ccoomm-- + mmaanndd builtin. ttyyppee returns true if all of the arguments are + found, false if any are not found. uulliimmiitt [--HHSS] --aa uulliimmiitt [--HHSS] [--bbccddeeffiikkllmmnnppqqrrssttuuvvxxPPRRTT [_l_i_m_i_t]] Provides control over the resources available to the shell and - to processes started by it, on systems that allow such control. + to processes it starts, on systems that allow such control. + The --HH and --SS options specify that the hard or soft limit is set - for the given resource. A hard limit cannot be increased by a - non-root user once it is set; a soft limit may be increased up - to the value of the hard limit. If neither --HH nor --SS is speci- - fied, both the soft and hard limits are set. The value of _l_i_m_i_t - can be a number in the unit specified for the resource or one of - the special values hhaarrdd, ssoofftt, or uunnlliimmiitteedd, which stand for the - current hard limit, the current soft limit, and no limit, re- - spectively. If _l_i_m_i_t is omitted, the current value of the soft - limit of the resource is printed, unless the --HH option is given. - When more than one resource is specified, the limit name and - unit, if appropriate, are printed before the value. Other op- - tions are interpreted as follows: - --aa All current limits are reported; no limits are set + for the given resource. A hard limit cannot be increased by a + non-root user once it is set; a soft limit may be increased up + to the value of the hard limit. If neither --HH nor --SS is speci- + fied, uulliimmiitt sets both the soft and hard limits. + + The value of _l_i_m_i_t can be a number in the unit specified for the + resource or one of the special values hhaarrdd, ssoofftt, or uunnlliimmiitteedd, + which stand for the current hard limit, the current soft limit, + and no limit, respectively. If _l_i_m_i_t is omitted, uulliimmiitt prints + the current value of the soft limit of the resource, unless the + --HH option is given. When more than one resource is specified, + the limit name and unit, if appropriate, are printed before the + value. Other options are interpreted as follows: + --aa Report all current limits; no limits are set --bb The maximum socket buffer size --cc The maximum size of core files created --dd The maximum size of a process's data segment --ee The maximum scheduling priority ( - --ff The maximum size of files written by the shell and its + --ff The maximum size of files written by the shell and its children --ii The maximum number of pending signals --kk The maximum number of kqueues that may be allocated --ll The maximum size that may be locked into memory - --mm The maximum resident set size (many systems do not honor + --mm The maximum resident set size (many systems do not honor this limit) --nn The maximum number of open file descriptors (most systems do not allow this value to be set) @@ -1945,67 +2074,70 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS --rr The maximum real-time scheduling priority --ss The maximum stack size --tt The maximum amount of cpu time in seconds - --uu The maximum number of processes available to a single + --uu The maximum number of processes available to a single user - --vv The maximum amount of virtual memory available to the + --vv The maximum amount of virtual memory available to the shell and, on some systems, to its children --xx The maximum number of file locks --PP The maximum number of pseudoterminals - --RR The maximum time a real-time process can run before + --RR The maximum time a real-time process can run before blocking, in microseconds --TT The maximum number of threads - If _l_i_m_i_t is given, and the --aa option is not used, _l_i_m_i_t is the - new value of the specified resource. If no option is given, - then --ff is assumed. Values are in 1024-byte increments, except - for --tt, which is in seconds; --RR, which is in microseconds; --pp, - which is in units of 512-byte blocks; --PP, --TT, --bb, --kk, --nn, and - --uu, which are unscaled values; and, when in posix mode, --cc and - --ff, which are in 512-byte increments. The return status is 0 - unless an invalid option or argument is supplied, or an error - occurs while setting a new limit. + If _l_i_m_i_t is supplied, and the --aa option is not used, _l_i_m_i_t is + the new value of the specified resource. If no option is sup- + plied, then --ff is assumed. + + Values are in 1024-byte increments, except for --tt, which is in + seconds; --RR, which is in microseconds; --pp, which is in units of + 512-byte blocks; --PP, --TT, --bb, --kk, --nn, and --uu, which are unscaled + values; and, when in posix mode, --cc and --ff, which are in + 512-byte increments. The return status is 0 unless an invalid + option or argument is supplied, or an error occurs while setting + a new limit. uummaasskk [--pp] [--SS] [_m_o_d_e] - The user file-creation mask is set to _m_o_d_e. If _m_o_d_e begins with - a digit, it is interpreted as an octal number; otherwise it is - interpreted as a symbolic mode mask similar to that accepted by - _c_h_m_o_d(1). If _m_o_d_e is omitted, the current value of the mask is - printed. The --SS option causes the mask to be printed in sym- - bolic form; the default output is an octal number. If the --pp - option is supplied, and _m_o_d_e is omitted, the output is in a form - that may be reused as input. The return status is 0 if the mode - was successfully changed or if no _m_o_d_e argument was supplied, - and false otherwise. + Set the user file-creation mask to _m_o_d_e. If _m_o_d_e begins with a + digit, it is interpreted as an octal number; otherwise it is in- + terpreted as a symbolic mode mask similar to that accepted by + _c_h_m_o_d(1). If _m_o_d_e is omitted, uummaasskk prints the current value of + the mask. The --SS option without a _m_o_d_e argument prints the mask + in a symbolic format; the default output is an octal number. If + the --pp option is supplied, and _m_o_d_e is omitted, the output is in + a form that may be reused as input. The return status is zero + if the mode was successfully changed or if no _m_o_d_e argument was + supplied, and non-zero otherwise. uunnaalliiaass [-aa] [_n_a_m_e ...] Remove each _n_a_m_e from the list of defined aliases. If --aa is - supplied, all alias definitions are removed. The return value - is true unless a supplied _n_a_m_e is not a defined alias. + supplied, remove all alias definitions. The return value is + true unless a supplied _n_a_m_e is not a defined alias. uunnsseett [-ffvv] [-nn] [_n_a_m_e ...] For each _n_a_m_e, remove the corresponding variable or function. If the --vv option is given, each _n_a_m_e refers to a shell variable, - and that variable is removed. Read-only variables may not be - unset. If --ff is specified, each _n_a_m_e refers to a shell func- - tion, and the function definition is removed. If the --nn option - is supplied, and _n_a_m_e is a variable with the _n_a_m_e_r_e_f attribute, - _n_a_m_e will be unset rather than the variable it references. --nn - has no effect if the --ff option is supplied. If no options are - supplied, each _n_a_m_e refers to a variable; if there is no vari- - able by that name, a function with that name, if any, is unset. - Each unset variable or function is removed from the environment - passed to subsequent commands. If any of BBAASSHH__AALLIIAASSEESS, - BBAASSHH__AARRGGVV00, BBAASSHH__CCMMDDSS, BBAASSHH__CCOOMMMMAANNDD, BBAASSHH__SSUUBBSSHHEELLLL, BBAASSHHPPIIDD, - CCOOMMPP__WWOORRDDBBRREEAAKKSS, DDIIRRSSTTAACCKK, EEPPOOCCHHRREEAALLTTIIMMEE, EEPPOOCCHHSSEECCOONNDDSS, FFUUNNCC-- - NNAAMMEE, GGRROOUUPPSS, HHIISSTTCCMMDD, LLIINNEENNOO, RRAANNDDOOMM, SSEECCOONNDDSS, or SSRRAANNDDOOMM are - unset, they lose their special properties, even if they are sub- - sequently reset. The exit status is true unless a _n_a_m_e is read- - only or may not be unset. + and that variable is removed. If --ff is specified, each _n_a_m_e + refers to a shell function, and the function definition is re- + moved. If the --nn option is supplied, and _n_a_m_e is a variable + with the _n_a_m_e_r_e_f attribute, _n_a_m_e will be unset rather than the + variable it references. --nn has no effect if the --ff option is + supplied. Read-only variables and functions may not be unset. + When variables or functions are removed, they are also removed + from the environment passed to subsequent commands. If no op- + tions are supplied, each _n_a_m_e refers to a variable; if there is + no variable by that name, a function with that name, if any, is + unset. Some shell variables may not be unset. If any of + BBAASSHH__AALLIIAASSEESS, BBAASSHH__AARRGGVV00, BBAASSHH__CCMMDDSS, BBAASSHH__CCOOMMMMAANNDD, BBAASSHH__SSUUBB-- + SSHHEELLLL, BBAASSHHPPIIDD, CCOOMMPP__WWOORRDDBBRREEAAKKSS, DDIIRRSSTTAACCKK, EEPPOOCCHHRREEAALLTTIIMMEE, + EEPPOOCCHHSSEECCOONNDDSS, FFUUNNCCNNAAMMEE, GGRROOUUPPSS, HHIISSTTCCMMDD, LLIINNEENNOO, RRAANNDDOOMM, SSEECC-- + OONNDDSS, or SSRRAANNDDOOMM are unset, they lose their special properties, + even if they are subsequently reset. The exit status is true + unless a _n_a_m_e is readonly or may not be unset. wwaaiitt [--ffnn] [--pp _v_a_r_n_a_m_e] [_i_d ...] Wait for each specified child process _i_d and return the termina- - tion status of the last _i_d. Each _i_d may be a process ID or a - job specification; if a job spec is given, wwaaiitt waits for all + tion status of the last _i_d. Each _i_d may be a process ID or a + job specification; if a job spec is supplied, wwaaiitt waits for all processes in the job. If no options or _i_ds are supplied, wwaaiitt waits for all running @@ -2021,9 +2153,9 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS If the --pp option is supplied, the process or job identifier of the job for which the exit status is returned is assigned to the - variable _v_a_r_n_a_m_e named by the option argument. The variable - will be unset initially, before any assignment. This is useful - only when the --nn option is supplied. + variable _v_a_r_n_a_m_e named by the option argument. The variable, + which cannot be readonly, will be unset initially, before any + assignment. This is useful only when the --nn option is supplied. Supplying the --ff option, when job control is enabled, forces wwaaiitt to wait for each _i_d to terminate before returning its sta- @@ -2042,38 +2174,38 @@ SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE level -- each option is mutually exclusive. The compatibility level is intended to allow users to select behavior from previous versions that is incompatible with newer versions while they migrate scripts to use - current features and behavior. It's intended to be a temporary solu- + current features and behavior. It's intended to be a temporary solu- tion. This section does not mention behavior that is standard for a particu- - lar version (e.g., setting ccoommppaatt3322 means that quoting the rhs of the - regexp matching operator quotes special regexp characters in the word, - which is default behavior in bash-3.2 and subsequent versions). - - If a user enables, say, ccoommppaatt3322, it may affect the behavior of other - compatibility levels up to and including the current compatibility - level. The idea is that each compatibility level controls behavior - that changed in that version of bbaasshh, but that behavior may have been - present in earlier versions. For instance, the change to use locale- - based comparisons with the [[[[ command came in bash-4.1, and earlier + lar version (e.g., setting ccoommppaatt3322 means that quoting the right hand + side of the regexp matching operator quotes special regexp characters + in the word, which is default behavior in bash-3.2 and subsequent ver- + sions). + + If a user enables, say, ccoommppaatt3322, it may affect the behavior of other + compatibility levels up to and including the current compatibility + level. The idea is that each compatibility level controls behavior + that changed in that version of bbaasshh, but that behavior may have been + present in earlier versions. For instance, the change to use locale- + based comparisons with the [[[[ command came in bash-4.1, and earlier versions used ASCII-based comparisons, so enabling ccoommppaatt3322 will enable - ASCII-based comparisons as well. That granularity may not be suffi- - cient for all uses, and as a result users should employ compatibility - levels carefully. Read the documentation for a particular feature to + ASCII-based comparisons as well. That granularity may not be suffi- + cient for all uses, and as a result users should employ compatibility + levels carefully. Read the documentation for a particular feature to find out the current behavior. - Bash-4.3 introduced a new shell variable: BBAASSHH__CCOOMMPPAATT. The value as- + Bash-4.3 introduced a new shell variable: BBAASSHH__CCOOMMPPAATT. The value as- signed to this variable (a decimal version number like 4.2, or an inte- - ger corresponding to the ccoommppaatt_N_N option, like 42) determines the com- + ger corresponding to the ccoommppaatt_N_N option, like 42) determines the com- patibility level. - Starting with bash-4.4, bbaasshh has begun deprecating older compatibility - levels. Eventually, the options will be removed in favor of BBAASSHH__CCOOMM-- - PPAATT. + Starting with bash-4.4, bbaasshh began deprecating older compatibility lev- + els. Eventually, the options will be removed in favor of BBAASSHH__CCOOMMPPAATT. - Bash-5.0 was the final version for which there will be an individual - shopt option for the previous version. Users should control the compat- - ibility level with BBAASSHH__CCOOMMPPAATT. + Bash-5.0 was the final version for which there was an individual shopt + option for the previous version. BBAASSHH__CCOOMMPPAATT is the only mechanism to + control the compatibility level in versions newer than bash-5.0. The following table describes the behavior changes controlled by each compatibility level setting. The ccoommppaatt_N_N tag is used as shorthand for @@ -2084,77 +2216,78 @@ SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE quired for bash-5.1 and later versions. ccoommppaatt3311 - +o quoting the rhs of the [[[[ command's regexp matching oper- - ator (=) has no special effect + +o Quoting the rhs of the [[[[ command's regexp matching oper- + ator (=) has no special effect. ccoommppaatt3322 - +o the << and >> operators to the [[[[ command do not consider + +o The << and >> operators to the [[[[ command do not consider the current locale when comparing strings; they use ASCII ordering. ccoommppaatt4400 - +o the << and >> operators to the [[[[ command do not consider + +o The << and >> operators to the [[[[ command do not consider the current locale when comparing strings; they use ASCII ordering. BBaasshh versions prior to bash-4.1 use ASCII col- lation and _s_t_r_c_m_p(3); bash-4.1 and later use the current locale's collation sequence and _s_t_r_c_o_l_l(3). ccoommppaatt4411 - +o in _p_o_s_i_x mode, ttiimmee may be followed by options and still + +o In _p_o_s_i_x mode, ttiimmee may be followed by options and still be recognized as a reserved word (this is POSIX interpre- - tation 267) - +o in _p_o_s_i_x mode, the parser requires that an even number of + tation 267). + +o In _p_o_s_i_x mode, the parser requires that an even number of single quotes occur in the _w_o_r_d portion of a double- quoted parameter expansion and treats them specially, so that characters within the single quotes are considered - quoted (this is POSIX interpretation 221) + quoted (this is POSIX interpretation 221). ccoommppaatt4422 - +o the replacement string in double-quoted pattern substitu- + +o The replacement string in double-quoted pattern substitu- tion does not undergo quote removal, as it does in ver- - sions after bash-4.2 - +o in posix mode, single quotes are considered special when + sions after bash-4.2. + +o In posix mode, single quotes are considered special when expanding the _w_o_r_d portion of a double-quoted parameter expansion and can be used to quote a closing brace or other special character (this is part of POSIX interpre- tation 221); in later versions, single quotes are not - special within double-quoted word expansions + special within double-quoted word expansions. ccoommppaatt4433 - +o word expansion errors are considered non-fatal errors + +o Word expansion errors are considered non-fatal errors that cause the current command to fail, even in posix mode (the default behavior is to make them fatal errors - that cause the shell to exit) - +o when executing a shell function, the loop state + that cause the shell to exit). + +o When executing a shell function, the loop state (while/until/etc.) is not reset, so bbrreeaakk or ccoonnttiinnuuee in that function will break or continue loops in the calling context. Bash-4.4 and later reset the loop state to pre- - vent this + vent this. ccoommppaatt4444 - +o the shell sets up the values used by BBAASSHH__AARRGGVV and - BBAASSHH__AARRGGCC so they can expand to the shell's positional - parameters even if extended debugging mode is not enabled - +o a subshell inherits loops from its parent context, so + +o The shell sets up the values used by BBAASSHH__AARRGGVV and + BBAASSHH__AARRGGCC so they can expand to the shell's positional + parameters even if extended debugging mode is not en- + abled. + +o A subshell inherits loops from its parent context, so bbrreeaakk or ccoonnttiinnuuee will cause the subshell to exit. Bash-5.0 and later reset the loop state to prevent the exit - +o variable assignments preceding builtins like eexxppoorrtt and + +o Variable assignments preceding builtins like eexxppoorrtt and rreeaaddoonnllyy that set attributes continue to affect variables with the same name in the calling environment even if the - shell is not in posix mode + shell is not in posix mode. ccoommppaatt5500 +o Bash-5.1 changed the way $$RRAANNDDOOMM is generated to intro- - duce slightly more randomness. If the shell compatibility - level is set to 50 or lower, it reverts to the method + duce slightly more randomness. If the shell compatibil- + ity level is set to 50 or lower, it reverts to the method from bash-5.0 and previous versions, so seeding the ran- dom number generator by assigning a value to RRAANNDDOOMM will - produce the same sequence as in bash-5.0 + produce the same sequence as in bash-5.0. +o If the command hash table is empty, bash versions prior to bash-5.1 printed an informational message to that ef- fect, even when producing output that can be reused as - input. Bash-5.1 suppresses that message when the --ll op- + input. Bash-5.1 suppresses that message when the --ll op- tion is supplied. ccoommppaatt5511 @@ -2162,42 +2295,43 @@ SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE scripts @@ and ** differently depending on whether the ar- ray is indexed or associative, and differently than in previous versions. - +o arithmetic commands ( ((((...)))) ) and the expressions in an - arithmetic for statement can be expanded more than once - +o expressions used as arguments to arithmetic operators in - the [[[[ conditional command can be expanded more than once - +o the expressions in substring parameter brace expansion - can be expanded more than once - +o the expressions in the $$((((...)))) word expansion can be ex- - panded more than once - +o arithmetic expressions used as indexed array subscripts - can be expanded more than once - +o tteesstt --vv, when given an argument of AA[[@@]], where AA is an + +o Arithmetic commands ( ((((...)))) ) and the expressions in an + arithmetic for statement can be expanded more than once. + +o Expressions used as arguments to arithmetic operators in + the [[[[ conditional command can be expanded more than + once. + +o The expressions in substring parameter brace expansion + can be expanded more than once. + +o The expressions in the $$((((...)))) word expansion can be ex- + panded more than once. + +o Arithmetic expressions used as indexed array subscripts + can be expanded more than once. + +o tteesstt --vv, when given an argument of AA[[@@]], where AA is an existing associative array, will return true if the array - has any set elements. Bash-5.2 will look for and report + has any set elements. Bash-5.2 will look for and report on a key named @@. - +o the ${_p_a_r_a_m_e_t_e_r[[::]]==_v_a_l_u_e} word expansion will return - _v_a_l_u_e, before any variable-specific transformations have + +o The ${_p_a_r_a_m_e_t_e_r[[::]]==_v_a_l_u_e} word expansion will return + _v_a_l_u_e, before any variable-specific transformations have been performed (e.g., converting to lowercase). Bash-5.2 will return the final value assigned to the variable. - +o Parsing command substitutions will behave as if extended + +o Parsing command substitutions will behave as if extended globbing (see the description of the sshhoopptt builtin above) - is enabled, so that parsing a command substitution con- + is enabled, so that parsing a command substitution con- taining an extglob pattern (say, as part of a shell func- - tion) will not fail. This assumes the intent is to en- - able extglob before the command is executed and word ex- - pansions are performed. It will fail at word expansion - time if extglob hasn't been enabled by the time the com- + tion) will not fail. This assumes the intent is to en- + able extglob before the command is executed and word ex- + pansions are performed. It will fail at word expansion + time if extglob hasn't been enabled by the time the com- mand is executed. ccoommppaatt5522 - +o The tteesstt builtin uses its historical algorithm to parse - parenthesized subexpressions when given five or more ar- + +o The tteesstt builtin uses its historical algorithm to parse + parenthesized subexpressions when given five or more ar- guments. - +o If the --pp or --PP option is supplied to the bbiinndd builtin, + +o If the --pp or --PP option is supplied to the bbiinndd builtin, bbiinndd treats any arguments remaining after option process- - ing as bindable command names, and displays any key se- - quences bound to those commands, instead of treating the + ing as bindable command names, and displays any key se- + quences bound to those commands, instead of treating the arguments as key sequences to bind. SSEEEE AALLSSOO diff --git a/doc/rbash.0 b/doc/rbash.0 index 230b358b..36a5ad11 100644 --- a/doc/rbash.0 +++ b/doc/rbash.0 @@ -5,53 +5,56 @@ NNAAMMEE RREESSTTRRIICCTTEEDD SSHHEELLLL If bbaasshh is started with the name rrbbaasshh, or the --rr option is supplied at - invocation, the shell becomes restricted. A restricted shell is used + invocation, the shell becomes _r_e_s_t_r_i_c_t_e_d. A restricted shell is used to set up an environment more controlled than the standard shell. It behaves identically to bbaasshh with the exception that the following are disallowed or not performed: - +o changing directories with ccdd + +o Changing directories with ccdd. - +o setting or unsetting the values of SSHHEELLLL, PPAATTHH, HHIISSTTFFIILLEE, EENNVV, - or BBAASSHH__EENNVV + +o Setting or unsetting the values of SSHHEELLLL, PPAATTHH, HHIISSTTFFIILLEE, EENNVV, + or BBAASSHH__EENNVV. - +o specifying command names containing // + +o Specifying command names containing //. - +o specifying a filename containing a // as an argument to the .. - builtin command + +o Specifying a filename containing a // as an argument to the .. + builtin command. - +o specifying a filename containing a slash as an argument to the - hhiissttoorryy builtin command + +o Using the --pp option to the .. builtin command to specify a + search path. - +o specifying a filename containing a slash as an argument to the - --pp option to the hhaasshh builtin command + +o Specifying a filename containing a slash as an argument to the + hhiissttoorryy builtin command. - +o importing function definitions from the shell environment at - startup + +o Specifying a filename containing a slash as an argument to the + --pp option to the hhaasshh builtin command. - +o parsing the value of SSHHEELLLLOOPPTTSS from the shell environment at - startup + +o Importing function definitions from the shell environment at + startup. - +o redirecting output using the >, >|, <>, >&, &>, and >> redirec- - tion operators + +o Parsing the value of SSHHEELLLLOOPPTTSS from the shell environment at + startup. - +o using the eexxeecc builtin command to replace the shell with another - command + +o Redirecting output using the >, >|, <>, >&, &>, and >> redirec- + tion operators. - +o adding or deleting builtin commands with the --ff and --dd options - to the eennaabbllee builtin command + +o Using the eexxeecc builtin command to replace the shell with another + command. - +o using the eennaabbllee builtin command to enable disabled shell - builtins + +o Adding or deleting builtin commands with the --ff and --dd options + to the eennaabbllee builtin command. - +o specifying the --pp option to the ccoommmmaanndd builtin command + +o Using the eennaabbllee builtin command to enable disabled shell + builtins. - +o turning off restricted mode with sseett ++rr or sshhoopptt --uu rree-- + +o Specifying the --pp option to the ccoommmmaanndd builtin command. + + +o Turning off restricted mode with sseett ++rr or sshhoopptt --uu rree-- ssttrriicctteedd__sshheellll. These restrictions are enforced after any startup files are read. - When a command that is found to be a shell script is executed, rrbbaasshh + When a command that is found to be a shell script is executed, rrbbaasshh turns off any restrictions in the shell spawned to execute the script. SSEEEE AALLSSOO diff --git a/doc/version.texi b/doc/version.texi index 47e55504..03372468 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -2,10 +2,10 @@ Copyright (C) 1988-2024 Free Software Foundation, Inc. @end ignore -@set LASTCHANGE Thu Sep 5 15:41:56 EDT 2024 +@set LASTCHANGE Sun Sep 29 22:28:43 EDT 2024 @set EDITION 5.3 @set VERSION 5.3 -@set UPDATED 5 September 2024 +@set UPDATED 29 September 2024 @set UPDATED-MONTH September 2024 diff --git a/expr.c b/expr.c index f547ba35..30014aa2 100644 --- a/expr.c +++ b/expr.c @@ -26,8 +26,8 @@ order of decreasing precedence. "id++", "id--" [post-increment and post-decrement] - "-", "+" [(unary operators)] "++id", "--id" [pre-increment and pre-decrement] + "-", "+" [(unary operators)] "!", "~" "**" [(exponentiation)] "*", "/", "%" diff --git a/lib/readline/doc/hsuser.texi b/lib/readline/doc/hsuser.texi index 106c369b..4c99bc36 100644 --- a/lib/readline/doc/hsuser.texi +++ b/lib/readline/doc/hsuser.texi @@ -1,7 +1,7 @@ @ignore This file documents the user interface to the GNU History library. -Copyright (C) 1988--2022 Free Software Foundation, Inc. +Copyright (C) 1988--2024 Free Software Foundation, Inc. Authored by Brian Fox and Chet Ramey. Permission is granted to make and distribute verbatim copies of this manual @@ -38,9 +38,10 @@ For information on using the @sc{gnu} History Library in other programs, see the @sc{gnu} Readline Library Manual. @end ifset @ifclear BashFeatures -This chapter describes how to use the @sc{gnu} History Library interactively, -from a user's standpoint. It should be considered a user's guide. For -information on using the @sc{gnu} History Library in your own programs, +This chapter describes how to use the @sc{gnu} History Library +interactively, from a user's standpoint. +It should be considered a user's guide. +For information on using the @sc{gnu} History Library in your own programs, @pxref{Programming with GNU History}. @end ifclear @@ -79,20 +80,33 @@ but after history expansion is performed, subject to the values of the shell variables @env{HISTIGNORE} and @env{HISTCONTROL}. -When the shell starts up, the history is initialized from the +When the shell starts up, Bash initializes the history list +by reading history entries from the file named by the @env{HISTFILE} variable (default @file{~/.bash_history}). -The file named by the value of @env{HISTFILE} is truncated, if -necessary, to contain no more than the number of lines specified by +This is referred to as the @dfn{history file}. +That file is truncated, if necessary, +to contain no more than the number of history entries specified by the value of the @env{HISTFILESIZE} variable. -When a shell with history enabled exits, the last -@env{$HISTSIZE} lines are copied from the history list to the file +If @env{HISTFILESIZE} is unset, or set to null, a non-numeric value, +or a numeric value less than zero, the history file is not truncated. + +When the history file is read, +lines beginning with the history comment character followed immediately +by a digit are interpreted as timestamps for the following history entry. +These timestamps are optionally displayed depending on the value of the +@env{HISTTIMEFORMAT} variable (@pxref{Bash Variables}). +When present, history timestamps delimit history entries, making +multi-line entries possible. + +When a shell with history enabled exits, Bash copies the last +@env{$HISTSIZE} entries from the history list to the file named by @env{$HISTFILE}. If the @code{histappend} shell option is set (@pxref{Bash Builtins}), -the lines are appended to the history file, +Bash appends the entries to the history file, otherwise the history file is overwritten. If @env{HISTFILE} is unset or null, or if the history file is unwritable, the history is not saved. -After saving the history, the history file is truncated +After saving the history, Bash truncates the history file to contain no more than @env{$HISTFILESIZE} lines. If @env{HISTFILESIZE} is unset, or set to null, a non-numeric value, or a numeric value less than zero, the history file is not truncated. @@ -103,27 +117,27 @@ marked with the history comment character. When the history file is read, lines beginning with the history comment character followed immediately by a digit are interpreted as timestamps for the following history entry. +As above, when using @env{HISTTIMEFORMAT}, +the timestamps delimit multi-line history entries. -The @code{fc} builtin command may be used to list or edit and re-execute +The @code{fc} builtin command will list or edit and re-execute a portion of the history list. -The @code{history} builtin may be used to display or modify the history +The @code{history} builtin can display or modify the history list and manipulate the history file. When using command-line editing, search commands are available in each editing mode that provide access to the history list (@pxref{Commands For History}). -The shell allows control over which commands are saved on the history -list. +The shell allows control over which commands are saved on the history list. The @env{HISTCONTROL} and @env{HISTIGNORE} -variables are used to cause the shell to save only a subset of the -commands entered. +variables are used to save only a subset of the commands entered. The @code{cmdhist} shell option, if enabled, causes the shell to attempt to save each line of a multi-line command in the same history entry, adding semicolons where necessary to preserve syntactic correctness. The @code{lithist} -shell option causes the shell to save the command with embedded newlines -instead of semicolons. +shell option modifies @code{cmdhist} by saving +the command with embedded newlines instead of semicolons. The @code{shopt} builtin is used to set these options. @xref{The Shopt Builtin}, for a description of @code{shopt}. @@ -157,27 +171,44 @@ and -0 is equivalent to the current command (usually the @code{fc} command); otherwise 0 is equivalent to -1 and -0 is invalid. -If @var{last} is not specified, it is set to -@var{first}. If @var{first} is not specified, it is set to the previous -command for editing and @minus{}16 for listing. If the @option{-l} flag is -given, the commands are listed on standard output. The @option{-n} flag -suppresses the command numbers when listing. The @option{-r} flag -reverses the order of the listing. Otherwise, the editor given by -@var{ename} is invoked on a file containing those commands. If -@var{ename} is not given, the value of the following variable expansion -is used: @code{$@{FCEDIT:-$@{EDITOR:-vi@}@}}. This says to use the +If @var{last} is not specified, it is set to @var{first}. +If @var{first} is not specified, it is set to the previous +command for editing and @minus{}16 for listing. + +If the @option{-l} flag is supplied, +the commands are listed on standard output. +The @option{-n} flag suppresses the command numbers when listing. +The @option{-r} flag reverses the order of the listing. + +Otherwise, @code{fc} invokes the editor named by +@var{ename} on a file containing those commands. +If @var{ename} is not supplied, @code{fc} uses the value of the following +variable expansion: @code{$@{FCEDIT:-$@{EDITOR:-vi@}@}}. +This says to use the value of the @env{FCEDIT} variable if set, or the value of the @env{EDITOR} variable if that is set, or @code{vi} if neither is set. -When editing is complete, the edited commands are echoed and executed. +When editing is complete, @code{fc} reads the file of edited commands +and echoes and executes them. -In the second form, @var{command} is re-executed after each instance -of @var{pat} in the selected command is replaced by @var{rep}. +In the second form, @code{fc} re-executes @var{command} after +replacing each instance of @var{pat} in the selected command with @var{rep}. @var{command} is interpreted the same as @var{first} above. A useful alias to use with the @code{fc} command is @code{r='fc -s'}, so that typing @samp{r cc} runs the last command beginning with @code{cc} and typing @samp{r} re-executes the last command (@pxref{Aliases}). +If the first form is used, the return value is zero unless an invalid +option is encountered or @var{first} or @var{last} +specify history lines out of range. +When editing and re-executing a file of commands, +the return value is the value of the last command executed +or failure if an error occurs with the temporary file. +If the second form is used, the return status +is that of the re-executed command, unless +@var{command} does not specify a valid history entry, in which case +@code{fc} returns a non-zero status. + @item history @btindex history @example @@ -189,21 +220,22 @@ history [-anrw] [@var{filename}] history -ps @var{arg} @end example -With no options, display the history list with line numbers. -Lines prefixed with a @samp{*} have been modified. -An argument of @var{n} lists only the last @var{n} lines. +With no options, display the history list with numbers. +Entries prefixed with a @samp{*} have been modified. +An argument of @var{n} lists only the last @var{n} entries. If the shell variable @env{HISTTIMEFORMAT} is set and not null, it is used as a format string for @code{strftime}(3) to display the time stamp associated with each displayed history entry. -No intervening blank is printed between the formatted time stamp -and the history line. +If @code{history} uses @env{HISTTIMEFORMAT}, it does not print an +intervening space between the formatted time stamp and the history entry. Options, if supplied, have the following meanings: @table @code @item -c -Clear the history list. This may be combined -with the other options to replace the history list completely. +Clear the history list. +This may be combined +with the other options to replace the history list. @item -d @var{offset} Delete the history entry at position @var{offset}. @@ -221,38 +253,46 @@ Positive and negative values for @var{start} and @var{end} are interpreted as described above. @item -a -Append the new history lines to the history file. +Append the "new" history lines to the history file. These are history lines entered since the beginning of the current Bash session, but not already appended to the history file. @item -n Append the history lines not already read from the history file -to the current history list. These are lines appended to the history +to the current history list. +These are lines appended to the history file since the beginning of the current Bash session. @item -r -Read the history file and append its contents to -the history list. +Read the history file and append its contents to the history list. @item -w -Write out the current history list to the history file. +Write the current history list to the history file, overwriting it. @item -p Perform history substitution on the @var{arg}s and display the result on the standard output, without storing the results in the history list. @item -s -The @var{arg}s are added to the end of -the history list as a single entry. +Add the @var{arg}s to the end of the history list as a single entry. +The last command in the history list is removed before adding the @var{arg}s. @end table If a @var{filename} argument is supplied -when any of the @option{-w}, @option{-r}, @option{-a}, or @option{-n} options -is used, Bash uses @var{filename} as the history file. -If not, then the value of the @env{HISTFILE} variable is used. +with any of the @option{-w}, @option{-r}, @option{-a}, or @option{-n} +options, Bash uses @var{filename} as the history file. +If not, it uses the value of the @env{HISTFILE} variable. If @env{HISTFILE} is unset or null, these options have no effect. +If the @env{HISTTIMEFORMAT} +variable is set, @code{history} writes the time stamp information +associated with each history entry to the history file, +marked with the history comment character. +When the history file is read, lines beginning with the history +comment character followed immediately by a digit are interpreted +as timestamps for the following history entry. + The return value is 0 unless an invalid option is encountered, an error occurs while reading or writing the history file, an invalid @var{offset} or range is supplied as an argument to @option{-d}, or the @@ -265,9 +305,25 @@ history expansion supplied as an argument to @option{-p} fails. @section History Expansion @cindex history expansion -The History library provides a history expansion feature that is similar -to the history expansion provided by @code{csh}. This section -describes the syntax used to manipulate the history information. +@ifset BashFeatures +The shell +@end ifset +@ifclear BashFeatures +The History library +@end ifclear +provides a history expansion feature that is similar +to the history expansion provided by @code{csh} +(also referred to as history substitution where appropriate). +This section describes the syntax used to manipulate the +history information. + +@ifset BashFeatures +History expansion is enabled by default for interactive shells, +and can be disabled using the @option{+H} option to the @code{set} +builtin command (@pxref{The Set Builtin}). +Non-interactive shells do not perform history expansion by default, +but it can be enabled with @code{set -H}. +@end ifset History expansions introduce words from the history list into the input stream, making it easy to repeat commands, insert the @@ -277,18 +333,20 @@ fix errors in previous commands quickly. @ifset BashFeatures History expansion is performed immediately after a complete line is read, before the shell breaks it into words, and is performed -on each line individually. Bash attempts to inform the history +on each line individually. +Bash attempts to inform the history expansion functions about quoting still in effect from previous lines. @end ifset -History expansion takes place in two parts. The first is to determine -which line from the history list should be used during substitution. -The second is to select portions of that line for inclusion into the +History expansion takes place in two parts. +The first is to determine +which entry from the history list should be used during substitution. +The second is to select portions of that entry to include into the current one. -The line selected from the history is called the @dfn{event}, -and the portions of that line that are acted upon are called @dfn{words}. -The line is broken into words in the same fashion +The entry selected from the history is called the @dfn{event}, +and the portions of that entry that are acted upon are called @dfn{words}. +The history entry is broken into words in the same fashion that Bash does, so that several words surrounded by quotes are considered one word. The @dfn{event designator} selects the event, the optional @@ -314,32 +372,38 @@ When using the shell, only @samp{\} and @samp{'} may be used to escape the history expansion character, but the history expansion character is also treated as quoted if it immediately precedes the closing double quote in a double-quoted string. + +Several characters inhibit history expansion if found immediately +following the history expansion character, even if it is unquoted: +space, tab, newline, carriage return, @samp{=}, +and the other shell metacharacters. @end ifset There is a special abbreviation for substitution, active when the @var{quick substitution} character (default @samp{^}) is the first character on the line. -It selects the previous history list entry, using an event designator +It selects the previous history entry, using an event designator equivalent to @code{!!}, -and substitutes one string for another in that line. +and substitutes one string for another in that entry. It is described below (@pxref{Event Designators}). This is the only history expansion that does not begin with the history expansion character. @ifset BashFeatures Several shell options settable with the @code{shopt} -builtin (@pxref{The Shopt Builtin}) may be used to tailor -the behavior of history expansion. If the -@code{histverify} shell option is enabled, and Readline +builtin (@pxref{The Shopt Builtin}) +will modify history expansion behavior +If the @code{histverify} shell option is enabled, and Readline is being used, history substitutions are not immediately passed to the shell parser. Instead, the expanded line is reloaded into the Readline editing buffer for further modification. If Readline is being used, and the @code{histreedit} -shell option is enabled, a failed history expansion will be +shell option is enabled, a failed history expansion is reloaded into the Readline editing buffer for correction. + The @option{-p} option to the @code{history} builtin command -may be used to see what a history expansion will do before using it. +shows what a history expansion will do before using it. The @option{-s} option to the @code{history} builtin may be used to add commands to the end of the history list without actually executing them, so that they are available for subsequent recall. @@ -347,9 +411,9 @@ This is most useful in conjunction with Readline. The shell allows control of the various characters used by the history expansion mechanism with the @code{histchars} variable, -as explained above (@pxref{Bash Variables}). The shell uses -the history comment character to mark history timestamps when -writing the history file. +as explained above (@pxref{Bash Variables}). +The shell uses the history comment character to mark history +timestamps when writing the history file. @end ifset @menu @@ -362,8 +426,7 @@ writing the history file. @subsection Event Designators @cindex event designators -An event designator is a reference to a command line entry in the -history list. +An event designator is a reference to an entry in the history list. Unless the reference is absolute, events are relative to the current position in the history list. The event designator consists of the portion of the word beginning @@ -386,13 +449,14 @@ the end of the line, or @samp{=}. @end ifclear @item @code{!@var{n}} -Refer to command line @var{n}. +Refer to history list entry @var{n}. @item @code{!-@var{n}} -Refer to the command @var{n} lines back. +Refer to the history entry @var{n} entries back. @item @code{!!} -Refer to the previous command. This is a synonym for @samp{!-1}. +Refer to the previous command. +This is a synonym for @samp{!-1}. @item @code{!@var{string}} Refer to the most recent command @@ -406,13 +470,14 @@ containing @var{string}. The trailing @samp{?} may be omitted if the @var{string} is followed immediately by a newline. -If @var{string} is missing, the string from the most recent search is used; +If @var{string} is missing, this uses +the string from the most recent search; it is an error if there is no previous search string. @item @code{^@var{string1}^@var{string2}^} -Quick Substitution. Repeat the last command, replacing @var{string1} -with @var{string2}. Equivalent to -@code{!!:s^@var{string1}^@var{string2}^}. +Quick Substitution. +Repeat the last command, replacing @var{string1} with @var{string2}. +Equivalent to @code{!!:s^@var{string1}^@var{string2}^}. @item @code{!#} The entire command line typed so far. @@ -425,23 +490,24 @@ The entire command line typed so far. Word designators are used to select desired words from the event. They are optional; if the word designator isn't supplied, the history expansion uses the entire event. -A @samp{:} separates the event specification from the word designator. 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). Words are -inserted into the current line separated by single spaces. +A @samp{:} separates the event specification from the word designator. +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). +Words are inserted into the current line separated by single spaces. @need 0.75 For example, @table @code @item !! -designates the preceding command. When you type this, the preceding -command is repeated in toto. +designates the preceding command. +When you type this, the preceding command is repeated in toto. @item !!:$ -designates the last argument of the preceding command. This may be -shortened to @code{!$}. +designates the last argument of the preceding command. +This may be shortened to @code{!$}. @item !fi:2 designates the second argument of the most recent command starting with @@ -450,20 +516,23 @@ the letters @code{fi}. @need 0.75 Here are the word designators: - + @table @code @item 0 (zero) -The @code{0}th word. For many applications, this is the command word. +The @code{0}th word. +For many applications, this is the command word. @item @var{n} The @var{n}th word. @item ^ -The first argument; that is, word 1. +The first argument: word 1. @item $ The last argument. +This is usually the last argument, but will expand to the +zeroth word if there is only one word in the line. @item % The first word matched by the most recent @samp{?@var{string}?} search, @@ -476,12 +545,13 @@ the line. A range of words; @samp{-@var{y}} abbreviates @samp{0-@var{y}}. @item * -All of the words, except the @code{0}th. This is a synonym for @samp{1-$}. +All of the words, except the @code{0}th. +This is a synonym for @samp{1-$}. It is not an error to use @samp{*} if there is just one word in the event; -the empty string is returned in that case. +it expands to the empty string in this case. @item @var{x}* -Abbreviates @samp{@var{x}-$} +Abbreviates @samp{@var{x}-$}. @item @var{x}- Abbreviates @samp{@var{x}-$} like @samp{@var{x}*}, but omits the last word. @@ -490,7 +560,7 @@ If @samp{x} is missing, it defaults to 0. @end table If a word designator is supplied without an event specification, the -previous command is used as the event. +previous command is used as the event, equivalent to @code{!!}. @node Modifiers @subsection Modifiers @@ -524,8 +594,8 @@ Quote the substituted words, escaping further substitutions. @item x Quote the substituted words as with @samp{q}, but break into words at spaces, tabs, and newlines. -The @samp{q} and @samp{x} modifiers are mutually exclusive; the last one -supplied is used. +The @samp{q} and @samp{x} modifiers are mutually exclusive; +expansion uses the last one supplied. @end ifset @item s/@var{old}/@var{new}/ @@ -533,9 +603,9 @@ Substitute @var{new} for the first occurrence of @var{old} in the event line. Any character may be used as the delimiter in place of @samp{/}. The delimiter may be quoted in @var{old} and @var{new} -with a single backslash. If @samp{&} appears in @var{new}, -it is replaced by @var{old}. A single backslash will quote -the @samp{&}. +with a single backslash. +If @samp{&} appears in @var{new}, it is replaced with @var{old}. +A single backslash will quote the @samp{&} in @var{old} and @var{new}. If @var{old} is null, it is set to the last @var{old} substituted, or, if no previous history substitutions took place, the last @var{string} @@ -550,8 +620,8 @@ Repeat the previous substitution. @item g @itemx a -Cause changes to be applied over the entire event line. Used in -conjunction with @samp{s}, as in @code{gs/@var{old}/@var{new}/}, +Cause changes to be applied over the entire event line. +Used in conjunction with @samp{s}, as in @code{gs/@var{old}/@var{new}/}, or with @samp{&}. @item G diff --git a/lib/readline/doc/rluser.texi b/lib/readline/doc/rluser.texi index c4ba476d..52a12854 100644 --- a/lib/readline/doc/rluser.texi +++ b/lib/readline/doc/rluser.texi @@ -11,7 +11,7 @@ use these features. There is a document entitled "readline.texinfo" which contains both end-user and programmer documentation for the GNU Readline Library. -Copyright (C) 1988--2023 Free Software Foundation, Inc. +Copyright (C) 1988--2024 Free Software Foundation, Inc. Authored by Brian Fox and Chet Ramey. @@ -2003,10 +2003,10 @@ so forth. @section Programmable Completion @cindex programmable completion -When word completion is attempted for an argument to a command for +When the user attempts word completion for an argument to a command for which a completion specification (a @var{compspec}) has been defined using the @code{complete} builtin (@pxref{Programmable Completion Builtins}), -the programmable completion facilities are invoked. +\fBreadline\fP invokes the programmable completion facilities. First, the command name is identified. If a compspec has been defined for that command, the @@ -2016,13 +2016,13 @@ beginning of an empty line), any compspec defined with the @option{-E} option to @code{complete} is used. If the command word is a full pathname, a compspec for the full pathname is searched for first. -If no compspec is found for the full pathname, an attempt is made to +If no compspec is found for the full pathname, completion attempts to find a compspec for the portion following the final slash. If those searches do not result in a compspec, any compspec defined with the @option{-D} option to @code{complete} is used as the default. If there is no default compspec, Bash attempts alias expansion on the command word as a final resort, and attempts to find a compspec -for the command word from any successful expansion +for the command word from any successful expansion. Once a compspec has been found, it is used to generate the list of matching words. @@ -2087,6 +2087,7 @@ in an environment equivalent to command substitution. It should print a list of completions, one per line, to the standard output. Backslash may be used to escape a newline, if necessary. +These are added to the set of possible completions. After all of the possible completions are generated, any filter specified with the @option{-X} option is applied to the list. @@ -2104,8 +2105,7 @@ of alphabetic characters. Finally, any prefix and suffix specified with the @option{-P} and @option{-S} options are added to each member of the completion list, and the result is -returned to the Readline completion code as the list of possible -completions. +returned to Readline as the list of possible completions. If the previously-applied actions do not generate any matches, and the @option{-o dirnames} option was supplied to @code{complete} when the @@ -2117,11 +2117,11 @@ matches are added to the results of the other actions. By default, if a compspec is found, whatever it generates is returned to the completion code as the full set of possible completions. -The default Bash completions are not attempted, and the Readline default -of filename completion is disabled. +The default Bash completions and the Readline default +of filename completion are disabled. If the @option{-o bashdefault} option was supplied to @code{complete} when -the compspec was defined, the default Bash completions are attempted -if the compspec generates no matches. +the compspec was defined, if the compspec generates no matches, +the default Bash completions are attempted. If the @option{-o default} option was supplied to @code{complete} when the compspec was defined, Readline's default completion will be performed if the compspec (and, if attempted, the default Bash completions) @@ -2133,17 +2133,19 @@ to completed names which are symbolic links to directories, subject to the value of the @var{mark-directories} Readline variable, regardless of the setting of the @var{mark-symlinked-directories} Readline variable. -There is some support for dynamically modifying completions. This is -most useful when used in combination with a default completion specified -with @option{-D}. It's possible for shell functions executed as completion +There is some support for dynamically modifying completions. +This is most useful when used in combination with a default completion +specified with @option{-D}. +It's possible for shell functions executed as completion handlers to indicate that completion should be retried by returning an -exit status of 124. If a shell function returns 124, and changes +exit status of 124. +If a shell function returns 124, and changes the compspec associated with the command on which completion is being attempted (supplied as the first argument when the function is executed), programmable completion restarts from the beginning, with an -attempt to find a new compspec for that command. This allows a set of -completions to be built dynamically as completion is attempted, rather than -being loaded all at once. +attempt to find a new compspec for that command. +This allows a set of completions to be built dynamically as completion +is attempted, rather than being loaded all at once. For instance, assuming that there is a library of compspecs, each kept in a file corresponding to the name of the command, the following default @@ -2196,7 +2198,7 @@ The matches will be generated in the same way as if the programmable completion code had generated them directly from a completion specification with the same flags. If @var{word} is specified, only those completions matching @var{word} -will be displayed. +will be displayed or stored. The return value is true unless an invalid option is supplied, or no matches were generated. @@ -2243,7 +2245,6 @@ The arguments to the @option{-G}, @option{-W}, and @option{-X} options should be quoted to protect them from expansion before the @code{complete} builtin is invoked. - @table @code @item -o @var{comp-option} The @var{comp-option} controls several aspects of the compspec's behavior @@ -2287,9 +2288,8 @@ the end of the line. @item plusdirs After any matches defined by the compspec are generated, -directory name completion is attempted and any -matches are added to the results of the other actions. - +attempt directory name completion and add any +matches to the results of the other actions. @end table @item -A @var{action} @@ -2385,25 +2385,30 @@ When it is executed, $1 is the name of the command whose arguments are being completed, $2 is the word being completed, and $3 is the word preceding the word being completed, as described above (@pxref{Programmable Completion}). -When it finishes, the possible completions are retrieved from the value +When @code{function} finishes, +the possible completions are retrieved from the value of the @env{COMPREPLY} array variable. @item -G @var{globpat} -The filename expansion pattern @var{globpat} is expanded to generate +Expand the filename expansion pattern @var{globpat} to generate the possible completions. @item -P @var{prefix} -@var{prefix} is added at the beginning of each possible completion +Add @var{prefix} to the beginning of each possible completion after all other options have been applied. @item -S @var{suffix} -@var{suffix} is appended to each possible completion +Append @var{suffix} to each possible completion after all other options have been applied. @item -W @var{wordlist} The @var{wordlist} is split using the characters in the -@env{IFS} special variable as delimiters, and each resultant word +@env{IFS} special variable as delimiters, and each resulting word is expanded. +Shell quoting is honored within @var{wordlist} +in order to provide a +mechanism for the words to contain shell metacharacters or characters +in the value of @env{IFS}. The possible completions are the members of the resultant list which match the word being completed. @@ -2458,7 +2463,6 @@ over @option{-E}, and both take precedence over @option{-I} The return value is true unless an invalid option is supplied, an attempt is made to modify the options for a @var{name} for which no completion specification exists, or an output error occurs. - @end table @node A Programmable Completion Example @@ -2488,7 +2492,8 @@ a newline to accommodate file names containing spaces and tabs -- @code{compgen} prints the possible completions it generates one per line. Possible completions go into the @var{COMPREPLY} array variable, one -completion per array element. The programmable completion system retrieves +completion per array element. +The programmable completion system retrieves the completions from there when the function returns. @example @@ -2562,7 +2567,7 @@ extend @code{_comp_cd} to append a slash if we're using directories found via @var{CDPATH}: Readline can't tell those completions are directories). The @option{-o nospace} option tells Readline to not append a space character to the directory name, in case we want to append to it. -The @option{-o bashdefault} option brings in the rest of the "Bash default" +The @option{-o bashdefault} option brings in the rest of the ``Bash default'' completions -- possible completions that Bash adds to the default Readline set. These include things like command name completion, variable completion