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
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::).
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’.
‘--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’.
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
‘--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,
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.
‘--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
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
=========================
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:
• 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’
builtin_error ("%s: %s", temp, strerror (e));
if (temp != dirname)
free (temp);
+ /* posix says to return >1 if eflag && no_symlinks?? */
return (EXECUTION_FAILURE);
}
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.
+
_\bB_\bA_\bS_\bH(1) General Commands Manual _\bB_\bA_\bS_\bH(1)
N\bNA\bAM\bME\bE
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
B\bBa\bas\bsh\bh is an s\bsh\bh-compatible command language interpreter that executes
- commands read from the standard input or from a file. B\bBa\bas\bsh\bh also incor-
- porates useful features from the _\bK_\bo_\br_\bn and _\bC shells (k\bks\bsh\bh and c\bcs\bsh\bh).
+ commands read from the standard input, from a string, or from a file.
+ B\bBa\bas\bsh\bh also incorporates useful features from the _\bK_\bo_\br_\bn and _\bC shells (k\bks\bsh\bh
+ and c\bcs\bsh\bh).
POSIX is the name for a family of computing standards based on Unix.
B\bBa\bas\bsh\bh is intended to be a conformant implementation of the Shell and
signed to $\b$0\b0 and any remaining arguments are assigned to the
positional parameters. The assignment to $\b$0\b0 sets the name of
the shell, which is used in warning and error messages.
+
-\b-i\bi If the -\b-i\bi option is present, the shell is _\bi_\bn_\bt_\be_\br_\ba_\bc_\bt_\bi_\bv_\be.
+
-\b-l\bl Make b\bba\bas\bsh\bh act as if it had been invoked as a login shell (see
I\bIN\bNV\bVO\bOC\bCA\bAT\bTI\bIO\bON\bN below).
+
-\b-r\br If the -\b-r\br option is present, the shell becomes _\br_\be_\bs_\bt_\br_\bi_\bc_\bt_\be_\bd
(see R\bRE\bES\bST\bTR\bRI\bIC\bCT\bTE\bED\bD S\bSH\bHE\bEL\bLL\bL below).
+
-\b-s\bs If the -\b-s\bs 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.
- -\b-D\bD A list of all double-quoted strings preceded by $\b$ is printed
- on the standard output. These are the strings that are sub-
- ject to language translation when the current locale is not C\bC
- or P\bPO\bOS\bSI\bIX\bX. This implies the -\b-n\bn option; no commands will be
- executed.
+
+ -\b-D\bD Print a list of all double-quoted strings preceded by $\b$ on
+ the standard output. These are the strings that are subject
+ to language translation when the current locale is not C\bC or
+ P\bPO\bOS\bSI\bIX\bX. This implies the -\b-n\bn option; no commands will be exe-
+ cuted.
+
[\b[-\b-+\b+]\b]O\bO [\b[_\bs_\bh_\bo_\bp_\bt_\b__\bo_\bp_\bt_\bi_\bo_\bn]\b]
_\bs_\bh_\bo_\bp_\bt_\b__\bo_\bp_\bt_\bi_\bo_\bn is one of the shell options accepted by the
s\bsh\bho\bop\bpt\bt builtin (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below). If
_\bs_\bh_\bo_\bp_\bt_\b__\bo_\bp_\bt_\bi_\bo_\bn is present, -\b-O\bO sets the value of that option; +\b+O\bO
- unsets it. If _\bs_\bh_\bo_\bp_\bt_\b__\bo_\bp_\bt_\bi_\bo_\bn is not supplied, the names and
- values of the shell options accepted by s\bsh\bho\bop\bpt\bt are printed on
+ unsets it. If _\bs_\bh_\bo_\bp_\bt_\b__\bo_\bp_\bt_\bi_\bo_\bn is not supplied, b\bba\bas\bsh\bh prints the
+ names and values of the shell options accepted by s\bsh\bho\bop\bpt\bt on
the standard output. If the invocation option is +\b+O\bO, the
output is displayed in a format that may be reused as input.
+
-\b--\b- A -\b--\b- signals the end of options and disables further option
processing. Any arguments after the -\b--\b- are treated as a
shell script filename (see below) and arguments passed to
Arrange for the debugger profile to be executed before the shell
starts. Turns on extended debugging mode (see the description
of the e\bex\bxt\btd\bde\beb\bbu\bug\bg option to the s\bsh\bho\bop\bpt\bt builtin below).
+
-\b--\b-d\bdu\bum\bmp\bp-\b-p\bpo\bo-\b-s\bst\btr\bri\bin\bng\bgs\bs
Equivalent to -\b-D\bD, but the output is in the GNU _\bg_\be_\bt_\bt_\be_\bx_\bt p\bpo\bo
(portable object) file format.
+
-\b--\b-d\bdu\bum\bmp\bp-\b-s\bst\btr\bri\bin\bng\bgs\bs
Equivalent to -\b-D\bD.
+
-\b--\b-h\bhe\bel\blp\bp Display a usage message on standard output and exit success-
fully.
+
-\b--\b-i\bin\bni\bit\bt-\b-f\bfi\bil\ble\be _\bf_\bi_\bl_\be
-\b--\b-r\brc\bcf\bfi\bil\ble\be _\bf_\bi_\bl_\be
Execute commands from _\bf_\bi_\bl_\be instead of the standard personal ini-
sitional parameters are set to the remaining arguments. B\bBa\bas\bsh\bh reads and
executes commands from this file, then exits. B\bBa\bas\bsh\bh'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 P\bPA\bAT\bTH\bH 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 P\bPA\bAT\bTH\bH for the script.
I\bIN\bNV\bVO\bOC\bCA\bAT\bTI\bIO\bON\bN
A _\bl_\bo_\bg_\bi_\bn _\bs_\bh_\be_\bl_\bl is one whose first character of argument zero is a -\b-, or
An _\bi_\bn_\bt_\be_\br_\ba_\bc_\bt_\bi_\bv_\be shell is one started without non-option arguments (un-
less -\b-s\bs is specified) and without the -\b-c\bc option, whose standard input
- and error are both connected to terminals (as determined by _\bi_\bs_\ba_\bt_\bt_\by(3)),
- or one started with the -\b-i\bi option. P\bPS\bS1\b1 is set and $\b$-\b- includes i\bi if
- b\bba\bas\bsh\bh is interactive, allowing a shell script or a startup file to test
- this state.
-
- The following paragraphs describe how b\bba\bas\bsh\bh executes its startup files.
- If any of the files exist but cannot be read, b\bba\bas\bsh\bh reports an error.
- Tildes are expanded in filenames as described below under T\bTi\bil\bld\bde\be E\bEx\bxp\bpa\ban\bn-\b-
+ and standard error are both connected to terminals (as determined by
+ _\bi_\bs_\ba_\bt_\bt_\by(3)), or one started with the -\b-i\bi option. B\bBa\bas\bsh\bh sets P\bPS\bS1\b1 and $\b$-\b-
+ includes i\bi if the shell is interactive, so a shell script or a startup
+ file can test this state.
+
+ The following paragraphs describe how b\bba\bas\bsh\bh executes its startup files.
+ If any of the files exist but cannot be read, b\bba\bas\bsh\bh reports an error.
+ Tildes are expanded in filenames as described below under T\bTi\bil\bld\bde\be E\bEx\bxp\bpa\ban\bn-\b-
s\bsi\bio\bon\bn in the E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN section.
- When b\bba\bas\bsh\bh is invoked as an interactive login shell, or as a non-inter-
- active shell with the -\b--\b-l\blo\bog\bgi\bin\bn option, it first reads and executes com-
- mands from the file _\b/_\be_\bt_\bc_\b/_\bp_\br_\bo_\bf_\bi_\bl_\be, if that file exists. After reading
+ When b\bba\bas\bsh\bh is invoked as an interactive login shell, or as a non-inter-
+ active shell with the -\b--\b-l\blo\bog\bgi\bin\bn option, it first reads and executes com-
+ mands from the file _\b/_\be_\bt_\bc_\b/_\bp_\br_\bo_\bf_\bi_\bl_\be, if that file exists. After reading
that file, it looks for _\b~_\b/_\b._\bb_\ba_\bs_\bh_\b__\bp_\br_\bo_\bf_\bi_\bl_\be, _\b~_\b/_\b._\bb_\ba_\bs_\bh_\b__\bl_\bo_\bg_\bi_\bn, and _\b~_\b/_\b._\bp_\br_\bo_\bf_\bi_\bl_\be,
- in that order, and reads and executes commands from the first one that
- exists and is readable. The -\b--\b-n\bno\bop\bpr\bro\bof\bfi\bil\ble\be option may be used when the
+ in that order, and reads and executes commands from the first one that
+ exists and is readable. The -\b--\b-n\bno\bop\bpr\bro\bof\bfi\bil\ble\be 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 e\bex\bxi\bit\bt builtin command, b\bba\bas\bsh\bh reads and executes commands
+ executes the e\bex\bxi\bit\bt builtin command, b\bba\bas\bsh\bh reads and executes commands
from the file _\b~_\b/_\b._\bb_\ba_\bs_\bh_\b__\bl_\bo_\bg_\bo_\bu_\bt, if it exists.
- When an interactive shell that is not a login shell is started, b\bba\bas\bsh\bh
- reads and executes commands from _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc, if that file exists. This
- may be inhibited by using the -\b--\b-n\bno\bor\brc\bc option. The -\b--\b-r\brc\bcf\bfi\bil\ble\be _\bf_\bi_\bl_\be option
- will cause b\bba\bas\bsh\bh to use _\bf_\bi_\bl_\be instead of _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc.
+ When an interactive shell that is not a login shell is started, b\bba\bas\bsh\bh
+ reads and executes commands from _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc, if that file exists. This
+ may be inhibited by using the -\b--\b-n\bno\bor\brc\bc option. The -\b--\b-r\brc\bcf\bfi\bil\ble\be _\bf_\bi_\bl_\be option
+ causes b\bba\bas\bsh\bh to use _\bf_\bi_\bl_\be instead of _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc.
- When b\bba\bas\bsh\bh is started non-interactively, to run a shell script, for ex-
- ample, it looks for the variable B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV 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. B\bBa\bas\bsh\bh behaves as if the following com-
+ When b\bba\bas\bsh\bh is started non-interactively, to run a shell script, for ex-
+ ample, it looks for the variable B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV 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. B\bBa\bas\bsh\bh behaves as if the following com-
mand were executed:
if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
- but the value of the P\bPA\bAT\bTH\bH variable is not used to search for the file-
+ but does not use the value of the P\bPA\bAT\bTH\bH variable to search for the file-
name.
If b\bba\bas\bsh\bh is invoked with the name s\bsh\bh, it tries to mimic the startup be-
When b\bba\bas\bsh\bh is started in _\bp_\bo_\bs_\bi_\bx mode, as with the -\b--\b-p\bpo\bos\bsi\bix\bx command line
option, it follows the POSIX standard for startup files. In this mode,
- interactive shells expand the E\bEN\bNV\bV 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 E\bEN\bNV\bV variable and read and execute com-
+ mands from the file whose name is the expanded value. No other startup
+ files are read.
B\bBa\bas\bsh\bh 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 _\br_\bs_\bh_\bd, or the secure shell daemon _\bs_\bs_\bh_\bd. If
- b\bba\bas\bsh\bh determines it is being run non-interactively in this fashion, it
- reads and executes commands from _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc, if that file exists and is
- readable. It will not do this if invoked as s\bsh\bh. The -\b--\b-n\bno\bor\brc\bc option may
- be used to inhibit this behavior, and the -\b--\b-r\brc\bcf\bfi\bil\ble\be option will make
- b\bba\bas\bsh\bh use a different file instead of _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc, but neither _\br_\bs_\bh_\bd nor
- _\bs_\bs_\bh_\bd 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 _\br_\bs_\bh_\bd, or the secure shell
+ daemon _\bs_\bs_\bh_\bd. If b\bba\bas\bsh\bh determines it is being run non-interactively in
+ this fashion, it reads and executes commands from _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc, if that
+ file exists and is readable. It will not do this if invoked as s\bsh\bh.
+ The -\b--\b-n\bno\bor\brc\bc option may be used to inhibit this behavior, and the -\b--\b-r\brc\bc-\b-
+ f\bfi\bil\ble\be option will make b\bba\bas\bsh\bh use a different file instead of _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc,
+ but neither _\br_\bs_\bh_\bd nor _\bs_\bs_\bh_\bd 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 -\b-p\bp option is not supplied, no startup
The standard output of _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b1 is connected via a pipe to the standard
input of _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2. This connection is performed before any redirec-
- tions specified by the _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b1(see R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN below). If |\b|&\b& is used,
- _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b1's standard error, in addition to its standard output, is con-
- nected to _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2's standard input through the pipe; it is shorthand
- for 2\b2>\b>&\b&1\b1 |\b|. This implicit redirection of the standard error to the
- standard output is performed after any redirections specified by _\bc_\bo_\bm_\b-
- _\bm_\ba_\bn_\bd_\b1.
+ tions specified by the _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b1(see R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN below). If |\b|&\b& is the
+ pipeline operator, _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b1's standard error, in addition to its stan-
+ dard output, is connected to _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2's standard input through the
+ pipe; it is shorthand for 2\b2>\b>&\b&1\b1 |\b|. This implicit redirection of the
+ standard error to the standard output is performed after any redirec-
+ tions specified by _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b1.
The return status of a pipeline is the exit status of the last command,
- unless the p\bpi\bip\bpe\bef\bfa\bai\bil\bl option is enabled. If p\bpi\bip\bpe\bef\bfa\bai\bil\bl 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 p\bpi\bip\bpe\bef\bfa\bai\bil\bl option is enabled. If p\bpi\bip\bpe\bef\bfa\bai\bil\bl 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 !\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 terminate
- before returning a value.
-
- If the t\bti\bim\bme\be 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 -\b-p\bp option changes the output format to that
- specified by POSIX. When the shell is in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, it does not rec-
- ognize t\bti\bim\bme\be as a reserved word if the next token begins with a "-".
- The T\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT variable may be set to a format string that specifies
- how the timing information should be displayed; see the description of
- T\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT under S\bSh\bhe\bel\bll\bl V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs 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 t\bti\bim\bme\be 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 -\b-p\bp option changes the output format to
+ that specified by POSIX. When the shell is in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, it does not
+ recognize t\bti\bim\bme\be as a reserved word if the next token begins with a "-".
+ The value of the T\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT variable is a format string that specifies
+ how the timing information should be displayed; see the description of
+ T\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT below under S\bSh\bhe\bel\bll\bl V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs.
When the shell is in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, t\bti\bim\bme\be 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 T\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT variable specifies the
+ this case, the shell displays the total user and system time consumed
+ by the shell and its children. The T\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT variable specifies the
format of the time information.
- Each command in a multi-command pipeline, where pipes are created, is
- executed in a _\bs_\bu_\bb_\bs_\bh_\be_\bl_\bl, which is a separate process. See C\bCO\bOM\bMM\bMA\bAN\bND\bD E\bEX\bXE\bE-\b-
- C\bCU\bUT\bTI\bIO\bON\bN E\bEN\bNV\bVI\bIR\bRO\bON\bNM\bME\bEN\bNT\bT for a description of subshells and a subshell envi-
- ronment. If the l\bla\bas\bst\btp\bpi\bip\bpe\be option is enabled using the s\bsh\bho\bop\bpt\bt builtin
- (see the description of s\bsh\bho\bop\bpt\bt 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 _\bs_\bu_\bb_\bs_\bh_\be_\bl_\bl, which is a separate process. See C\bCO\bOM\bMM\bMA\bAN\bND\bD E\bEX\bXE\bE-\b-
+ C\bCU\bUT\bTI\bIO\bON\bN E\bEN\bNV\bVI\bIR\bRO\bON\bNM\bME\bEN\bNT\bT for a description of subshells and a subshell envi-
+ ronment. If the l\bla\bas\bst\btp\bpi\bip\bpe\be option is enabled using the s\bsh\bho\bop\bpt\bt builtin
+ (see the description of s\bsh\bho\bop\bpt\bt below), and job control is not active,
+ the last element of a pipeline may be run by the shell process.
L\bLi\bis\bst\bts\bs
- A _\bl_\bi_\bs_\bt is a sequence of one or more pipelines separated by one of the
+ A _\bl_\bi_\bs_\bt is a sequence of one or more pipelines separated by one of the
operators ;\b;, &\b&, &\b&&\b&, or |\b||\b|, and optionally terminated by one of ;\b;, &\b&, or
<\b<n\bne\bew\bwl\bli\bin\bne\be>\b>.
Of these list operators, &\b&&\b& and |\b||\b| have equal precedence, followed by ;\b;
and &\b&, which have equal precedence.
- A sequence of one or more newlines may appear in a _\bl_\bi_\bs_\bt instead of a
+ A sequence of one or more newlines may appear in a _\bl_\bi_\bs_\bt instead of a
semicolon to delimit commands.
- If a command is terminated by the control operator &\b&, the shell exe-
- cutes the command in the _\bb_\ba_\bc_\bk_\bg_\br_\bo_\bu_\bn_\bd in a subshell. The shell does not
- wait for the command to finish, and the return status is 0. These are
- referred to as _\ba_\bs_\by_\bn_\bc_\bh_\br_\bo_\bn_\bo_\bu_\bs commands. Commands separated by a ;\b; are
+ If a command is terminated by the control operator &\b&, the shell exe-
+ cutes the command in the _\bb_\ba_\bc_\bk_\bg_\br_\bo_\bu_\bn_\bd in a subshell. The shell does not
+ wait for the command to finish, and the return status is 0. These are
+ referred to as _\ba_\bs_\by_\bn_\bc_\bh_\br_\bo_\bn_\bo_\bu_\bs commands. Commands separated by a ;\b; 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 &\b&&\b& and |\b||\b| control operators, respectively. AND and OR lists are
+ AND and OR lists are sequences of one or more pipelines separated by
+ the &\b&&\b& and |\b||\b| control operators, respectively. AND and OR lists are
executed with left associativity. An AND list has the form
_\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b1 &\b&&\b& _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2
- _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2 is executed if, and only if, _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b1 returns an exit status
+ _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2 is executed if, and only if, _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b1 returns an exit status
of zero (success).
An OR list has the form
_\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b1 |\b||\b| _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2
- _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2 is executed if, and only if, _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b1 returns a non-zero exit
- status. The return status of AND and OR lists is the exit status of
+ _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2 is executed if, and only if, _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b1 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.
C\bCo\bom\bmp\bpo\bou\bun\bnd\bd C\bCo\bom\bmm\bma\ban\bnd\bds\bs
- A _\bc_\bo_\bm_\bp_\bo_\bu_\bn_\bd _\bc_\bo_\bm_\bm_\ba_\bn_\bd is one of the following. In most cases a _\bl_\bi_\bs_\bt 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 _\bc_\bo_\bm_\bp_\bo_\bu_\bn_\bd _\bc_\bo_\bm_\bm_\ba_\bn_\bd is one of the following. In most cases a _\bl_\bi_\bs_\bt 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.
- (_\bl_\bi_\bs_\bt) _\bl_\bi_\bs_\bt is executed in a subshell (see C\bCO\bOM\bMM\bMA\bAN\bND\bD E\bEX\bXE\bEC\bCU\bUT\bTI\bIO\bON\bN E\bEN\bNV\bVI\bIR\bRO\bON\bN-\b-
- M\bME\bEN\bNT\bT below for a description of a subshell environment). Vari-
- able assignments and builtin commands that affect the shell's
+ (_\bl_\bi_\bs_\bt) _\bl_\bi_\bs_\bt is executed in a subshell (see C\bCO\bOM\bMM\bMA\bAN\bND\bD E\bEX\bXE\bEC\bCU\bUT\bTI\bIO\bON\bN E\bEN\bNV\bVI\bIR\bRO\bON\bN-\b-
+ M\bME\bEN\bNT\bT 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 _\bl_\bi_\bs_\bt.
{ _\bl_\bi_\bs_\bt; }
- _\bl_\bi_\bs_\bt is simply executed in the current shell environment. _\bl_\bi_\bs_\bt
- must be terminated with a newline or semicolon. This is known
- as a _\bg_\br_\bo_\bu_\bp _\bc_\bo_\bm_\bm_\ba_\bn_\bd. The return status is the exit status of
- _\bl_\bi_\bs_\bt. Note that unlike the metacharacters (\b( and )\b), {\b{ and }\b} are
- _\br_\be_\bs_\be_\br_\bv_\be_\bd _\bw_\bo_\br_\bd_\bs and must occur where a reserved word is permitted
+ _\bl_\bi_\bs_\bt is executed in the current shell environment. _\bl_\bi_\bs_\bt must be
+ terminated with a newline or semicolon. This is known as a
+ _\bg_\br_\bo_\bu_\bp _\bc_\bo_\bm_\bm_\ba_\bn_\bd. The return status is the exit status of _\bl_\bi_\bs_\bt.
+
+ Note that unlike the metacharacters (\b( and )\b), {\b{ and }\b} are _\br_\be_\b-
+ _\bs_\be_\br_\bv_\be_\bd _\bw_\bo_\br_\bd_\bs 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 _\bl_\bi_\bs_\bt by whitespace or another shell
metacharacter.
((_\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn))
- The _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn is evaluated according to the rules described be-
- low under A\bAR\bRI\bIT\bTH\bHM\bME\bET\bTI\bIC\bC E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN. If the value of the expression
- is non-zero, the return status is 0; otherwise the return status
- is 1. The _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn undergoes the same expansions as if it
- were within double quotes, but double quote characters in _\be_\bx_\b-
- _\bp_\br_\be_\bs_\bs_\bi_\bo_\bn are not treated specially and are removed.
+ The arithmetic _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn is evaluated according to the rules
+ described below under A\bAR\bRI\bIT\bTH\bHM\bME\bET\bTI\bIC\bC E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN. If the value of
+ the expression is non-zero, the return status is 0; otherwise
+ the return status is 1. The _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn undergoes the same ex-
+ pansions as if it were within double quotes, but double quote
+ characters in _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn are not treated specially and are re-
+ moved.
[\b[[\b[ _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn ]\b]]\b]
- Return a status of 0 or 1 depending on the evaluation of the
- conditional expression _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn. Expressions are composed of
- the primaries described below under C\bCO\bON\bND\bDI\bIT\bTI\bIO\bON\bNA\bAL\bL E\bEX\bXP\bPR\bRE\bES\bSS\bSI\bIO\bON\bNS\bS.
- The words between the [\b[[\b[ and ]\b]]\b] 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 -\b-f\bf must be unquoted to be
- recognized as primaries.
-
- When used with [\b[[\b[, the <\b< and >\b> operators sort lexicographically
+ Evaluate the conditional expression _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn and return a sta-
+ tus of zero (true) or non-zero (false). Expressions are com-
+ posed of the primaries described below under C\bCO\bON\bND\bDI\bIT\bTI\bIO\bON\bNA\bAL\bL E\bEX\bXP\bPR\bRE\bES\bS-\b-
+ S\bSI\bIO\bON\bNS\bS. The words between the [\b[[\b[ and ]\b]]\b] 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 -\b-f\bf must be unquoted
+ to be recognized as primaries.
+
+ When used with [\b[[\b[, the <\b< and >\b> operators sort lexicographically
using the current locale.
- When the =\b==\b= and !\b!=\b= operators are used, the string to the right
+ When the =\b==\b= and !\b!=\b= operators are used, the string to the right
of the operator is considered a pattern and matched according to
the rules described below under P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg, as if the e\bex\bxt\bt-\b-
g\bgl\blo\bob\bb shell option were enabled. The =\b= operator is equivalent to
- =\b==\b=. If the n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh 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 (=\b==\b=) or does not
- match (!\b!=\b=) 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, =\b=~\b~, is available, with the same
- precedence as =\b==\b= and !\b!=\b=. When it is used, the string to the
+ =\b==\b=. If the n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh 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 (=\b==\b=) or does not
+ match (!\b!=\b=) 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, =\b=~\b~, is available, with the same
+ precedence as =\b==\b= and !\b!=\b=. 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 _\br_\be_\bg_\bc_\bo_\bm_\bp and
- _\br_\be_\bg_\be_\bx_\be_\bc interfaces usually described in _\br_\be_\bg_\be_\bx(3)). The return
- value is 0 if the string matches the pattern, and 1 otherwise.
+ pression and matched accordingly (using the POSIX _\br_\be_\bg_\bc_\bo_\bm_\bp and
+ _\br_\be_\bg_\be_\bx_\be_\bc interfaces usually described in _\br_\be_\bg_\be_\bx(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 n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh 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 ^\b^ and $\b$ regular expression opera-
- tors to force it to match the entire string. The array variable
- B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH records which parts of the string matched the pat-
- tern. The element of B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH 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 B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH in-
- dices. The element of B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH with index _\bn is the portion
- of the string matching the _\bnth parenthesized subexpression.
- B\bBa\bas\bsh\bh sets B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH 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 ^\b^ and $\b$ regular expression opera-
+ tors to force it to match the entire string.
+
+ The array variable B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH records which parts of the
+ string matched the pattern. The element of B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH 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 B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH indices. The element of B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH with in-
+ dex _\bn is the portion of the string matching the _\bnth parenthe-
+ sized subexpression. B\bBa\bas\bsh\bh sets B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH 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:
(\b( _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn )\b)
- Returns the value of _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn. This may be used to
+ Returns the value of _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn. This may be used to
override the normal precedence of operators.
!\b! _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn
True if _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn is false.
True if either _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b1 or _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b2 is true.
The &\b&&\b& and |\b||\b| operators do not evaluate _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b2 if the value
- of _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b1 is sufficient to determine the return value of
+ of _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b1 is sufficient to determine the return value of
the entire conditional expression.
f\bfo\bor\br _\bn_\ba_\bm_\be [ [ i\bin\bn [ _\bw_\bo_\br_\bd _\b._\b._\b. ] ] ; ] d\bdo\bo _\bl_\bi_\bs_\bt ; d\bdo\bon\bne\be
- The list of words following i\bin\bn is expanded, generating a list of
- items. The variable _\bn_\ba_\bm_\be is set to each element of this list in
- turn, and _\bl_\bi_\bs_\bt is executed each time. If the i\bin\bn _\bw_\bo_\br_\bd is omit-
- ted, the f\bfo\bor\br command executes _\bl_\bi_\bs_\bt once for each positional pa-
- rameter that is set (see P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS below). The return status
- is the exit status of the last command that executes. If the
- expansion of the items following i\bin\bn results in an empty list, no
- commands are executed, and the return status is 0.
+ First, expand The list of words following i\bin\bn, generating a list
+ of items. Then, the variable _\bn_\ba_\bm_\be is set to each element of
+ this list in turn, and _\bl_\bi_\bs_\bt is executed each time. If the i\bin\bn
+ _\bw_\bo_\br_\bd is omitted, the f\bfo\bor\br command executes _\bl_\bi_\bs_\bt once for each po-
+ sitional parameter that is set (see P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS below). The re-
+ turn status is the exit status of the last command that exe-
+ cutes. If the expansion of the items following i\bin\bn results in an
+ empty list, no commands are executed, and the return status is
+ 0.
f\bfo\bor\br (( _\be_\bx_\bp_\br_\b1 ; _\be_\bx_\bp_\br_\b2 ; _\be_\bx_\bp_\br_\b3 )) ; d\bdo\bo _\bl_\bi_\bs_\bt ; d\bdo\bon\bne\be
- First, the arithmetic expression _\be_\bx_\bp_\br_\b1 is evaluated according to
- the rules described below under A\bAR\bRI\bIT\bTH\bHM\bME\bET\bTI\bIC\bC E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN. The
- arithmetic expression _\be_\bx_\bp_\br_\b2 is then evaluated repeatedly until
- it evaluates to zero. Each time _\be_\bx_\bp_\br_\b2 evaluates to a non-zero
- value, _\bl_\bi_\bs_\bt is executed and the arithmetic expression _\be_\bx_\bp_\br_\b3 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 _\bl_\bi_\bs_\bt that is executed, or false if any of the expres-
- sions is invalid.
+ First, evaluate the arithmetic expression _\be_\bx_\bp_\br_\b1 according to the
+ rules described below under A\bAR\bRI\bIT\bTH\bHM\bME\bET\bTI\bIC\bC E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN. Then, re-
+ peatedly evaluate the arithmetic expression _\be_\bx_\bp_\br_\b2 until it eval-
+ uates to zero. Each time _\be_\bx_\bp_\br_\b2 evaluates to a non-zero value,
+ execute _\bl_\bi_\bs_\bt and evaluate the arithmetic expression _\be_\bx_\bp_\br_\b3. 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 _\bl_\bi_\bs_\bt
+ that is executed, or non-zero if any of the expressions is in-
+ valid.
+
+ Use the b\bbr\bre\bea\bak\bk and c\bco\bon\bnt\bti\bin\bnu\bue\be builtins (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
+ below) to control loop execution.
s\bse\bel\ble\bec\bct\bt _\bn_\ba_\bm_\be [ i\bin\bn _\bw_\bo_\br_\bd ] ; d\bdo\bo _\bl_\bi_\bs_\bt ; d\bdo\bon\bne\be
- The list of words following i\bin\bn 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 i\bin\bn _\bw_\bo_\br_\bd is omitted,
- the positional parameters are printed (see P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS below).
- s\bse\bel\ble\bec\bct\bt then displays the P\bPS\bS3\b3 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 _\bn_\ba_\bm_\be is set to
- that word. If the line is empty, the words and prompt are dis-
- played again. If EOF is read, the s\bse\bel\ble\bec\bct\bt command completes and
- returns 1. Any other value read causes _\bn_\ba_\bm_\be to be set to null.
- The line read is saved in the variable R\bRE\bEP\bPL\bLY\bY. The _\bl_\bi_\bs_\bt is exe-
- cuted after each selection until a b\bbr\bre\bea\bak\bk command is executed.
- The exit status of s\bse\bel\ble\bec\bct\bt is the exit status of the last command
- executed in _\bl_\bi_\bs_\bt, or zero if no commands were executed.
+ First, expand the list of words following i\bin\bn, generating a list
+ of items, and print the set of expanded words the standard er-
+ ror, each preceded by a number. If the i\bin\bn _\bw_\bo_\br_\bd is omitted,
+ print the positional parameters (see P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS below). s\bse\bel\ble\bec\bct\bt
+ then displays the P\bPS\bS3\b3 prompt and reads a line from the standard
+ input. If the line consists of a number corresponding to one of
+ the displayed words, then s\bse\bel\ble\bec\bct\bt sets the value of _\bn_\ba_\bm_\be to that
+ word. If the line is empty, s\bse\bel\ble\bec\bct\bt displays the words and
+ prompt again. If EOF is read, s\bse\bel\ble\bec\bct\bt completes and returns 1.
+ Any other value sets _\bn_\ba_\bm_\be to null. The line read is saved in
+ the variable R\bRE\bEP\bPL\bLY\bY. The _\bl_\bi_\bs_\bt is executed after each selection
+ until a b\bbr\bre\bea\bak\bk command is executed. The exit status of s\bse\bel\ble\bec\bct\bt is
+ the exit status of the last command executed in _\bl_\bi_\bs_\bt, or zero if
+ no commands were executed.
c\bca\bas\bse\be _\bw_\bo_\br_\bd i\bin\bn [ [(] _\bp_\ba_\bt_\bt_\be_\br_\bn [ |\b| _\bp_\ba_\bt_\bt_\be_\br_\bn ] ... ) _\bl_\bi_\bs_\bt ;; ] ... e\bes\bsa\bac\bc
A c\bca\bas\bse\be command first expands _\bw_\bo_\br_\bd, and tries to match it against
- each _\bp_\ba_\bt_\bt_\be_\br_\bn in turn, using the matching rules described under
- P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg below. The _\bw_\bo_\br_\bd is expanded using tilde expan-
- sion, parameter and variable expansion, arithmetic expansion,
- command substitution, process substitution and quote removal.
- Each _\bp_\ba_\bt_\bt_\be_\br_\bn examined is expanded using tilde expansion, parame-
- ter and variable expansion, arithmetic expansion, command sub-
- stitution, process substitution, and quote removal. If the n\bno\bo-\b-
- c\bca\bas\bse\bem\bma\bat\btc\bch\bh shell option is enabled, the match is performed with-
- out regard to the case of alphabetic characters. When a match
- is found, the corresponding _\bl_\bi_\bs_\bt is executed. If the ;\b;;\b; opera-
- tor is used, no subsequent matches are attempted after the first
- pattern match. Using ;\b;&\b& in place of ;\b;;\b; causes execution to con-
- tinue with the _\bl_\bi_\bs_\bt associated with the next set of patterns.
- Using ;\b;;\b;&\b& in place of ;\b;;\b; causes the shell to test the next pat-
- tern list in the statement, if any, and execute any associated
- _\bl_\bi_\bs_\bt 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 _\bl_\bi_\bs_\bt.
+ each _\bp_\ba_\bt_\bt_\be_\br_\bn in turn, proceeding from first to last, using the
+ matching rules described under P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg below. A pat-
+ tern list is a set of one or more patterns separated by , and
+ the ) operator terminates the pattern list. The _\bw_\bo_\br_\bd is ex-
+ panded using tilde expansion, parameter and variable expansion,
+ arithmetic expansion, command substitution, process substitution
+ and quote removal. Each _\bp_\ba_\bt_\bt_\be_\br_\bn examined is expanded using
+ tilde expansion, parameter and variable expansion, arithmetic
+ expansion, command substitution, process substitution, and quote
+ removal. If the n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh shell option is enabled, the match
+ is performed without regard to the case of alphabetic charac-
+ ters. A _\bc_\bl_\ba_\bu_\bs_\be is a pattern list and an associated _\bl_\bi_\bs_\bt.
+
+ When a match is found, c\bca\bas\bse\be executes the corresponding _\bl_\bi_\bs_\bt. If
+ the ;\b;;\b; operator terminates the case clause, the c\bca\bas\bse\be command
+ completes after the first match. Using ;\b;&\b& in place of ;\b;;\b; causes
+ execution to continue with the _\bl_\bi_\bs_\bt associated with the next
+ pattern list. Using ;\b;;\b;&\b& in place of ;\b;;\b; causes the shell to test
+ the next pattern list in the statement, if any, and execute any
+ associated _\bl_\bi_\bs_\bt 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 _\bl_\bi_\bs_\bt executed.
i\bif\bf _\bl_\bi_\bs_\bt; t\bth\bhe\ben\bn _\bl_\bi_\bs_\bt; [ e\bel\bli\bif\bf _\bl_\bi_\bs_\bt; t\bth\bhe\ben\bn _\bl_\bi_\bs_\bt; ] ... [ e\bel\bls\bse\be _\bl_\bi_\bs_\bt; ] f\bfi\bi
The i\bif\bf _\bl_\bi_\bs_\bt is executed. If its exit status is zero, the t\bth\bhe\ben\bn
c\bco\bop\bpr\bro\boc\bc _\bN_\bA_\bM_\bE { _\bc_\bo_\bm_\bm_\ba_\bn_\bd [_\br_\be_\bd_\bi_\br_\be_\bc_\bt_\bi_\bo_\bn_\bs]; }
- This form is recommended because simple commands result in the co-
- process always being named C\bCO\bOP\bPR\bRO\bOC\bC, 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 C\bCO\bOP\bPR\bRO\bOC\bC, and it is simpler to use and more complete
+ than the other compound commands.
If _\bc_\bo_\bm_\bm_\ba_\bn_\bd is a compound command, _\bN_\bA_\bM_\bE is optional. The word following
c\bco\bop\bpr\bro\boc\bc determines whether that word is interpreted as a variable name:
subshells.
The process ID of the shell spawned to execute the coprocess is avail-
- able as the value of the variable _\bN_\bA_\bM_\bE_PID. The w\bwa\bai\bit\bt builtin command
- may be used to wait for the coprocess to terminate.
+ able as the value of the variable _\bN_\bA_\bM_\bE_PID. The w\bwa\bai\bit\bt builtin may be
+ used to wait for the coprocess to terminate.
Since the coprocess is created as an asynchronous command, the c\bco\bop\bpr\bro\boc\bc
command always returns success. The return status of a coprocess is
When in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, _\bf_\bn_\ba_\bm_\be must be a valid shell _\bn_\ba_\bm_\be and may not
be the name of one of the POSIX _\bs_\bp_\be_\bc_\bi_\ba_\bl _\bb_\bu_\bi_\bl_\bt_\bi_\bn_\bs. In default
mode, a function name can be any unquoted shell word that does
- not contain $\b$. Any redirections (see R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN 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 F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS below.)
+ not contain $\b$.
+
+ Any redirections (see R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN 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 F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS below.)
C\bCO\bOM\bMM\bME\bEN\bNT\bTS\bS
In a non-interactive shell, or an interactive shell in which the i\bin\bnt\bte\ber\br-\b-
a\bac\bct\bti\biv\bve\be_\b_c\bco\bom\bmm\bme\ben\bnt\bts\bs option to the s\bsh\bho\bop\bpt\bt builtin is enabled (see S\bSH\bHE\bEL\bLL\bL
- B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below), a word beginning with #\b# causes that word and
- all remaining characters on that line to be ignored. An interactive
- shell without the i\bin\bnt\bte\ber\bra\bac\bct\bti\biv\bve\be_\b_c\bco\bom\bmm\bme\ben\bnt\bts\bs option enabled does not allow
- comments. The i\bin\bnt\bte\ber\bra\bac\bct\bti\biv\bve\be_\b_c\bco\bom\bmm\bme\ben\bnt\bts\bs option is on by default in interac-
- tive shells.
+ B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below), a word beginning with #\b# 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 i\bin\bnt\bte\ber\bra\bac\bct\bti\biv\bve\be_\b_c\bco\bom\bmm\bme\ben\bnt\bts\bs option enabled does not allow comments. The
+ i\bin\bnt\bte\ber\bra\bac\bct\bti\biv\bve\be_\b_c\bco\bom\bmm\bme\ben\bnt\bts\bs option is enabled by default in interactive
+ shells.
Q\bQU\bUO\bOT\bTI\bIN\bNG\bG
_\bQ_\bu_\bo_\bt_\bi_\bn_\bg is used to remove the special meaning of certain characters or
T\bTO\bOR\bRY\bY E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN below), the _\bh_\bi_\bs_\bt_\bo_\br_\by _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn character, usually !\b!, must
be quoted to prevent history expansion.
- There are three quoting mechanisms: the _\be_\bs_\bc_\ba_\bp_\be _\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br, single
- quotes, and double quotes.
+ There are four quoting mechanisms: the _\be_\bs_\bc_\ba_\bp_\be _\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br, single quotes,
+ double quotes, and dollar-single quotes.
- A non-quoted backslash (\\b\) is the _\be_\bs_\bc_\ba_\bp_\be _\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br. It preserves the
- literal value of the next character that follows, with the exception of
- <newline>. If a \\b\<newline> pair appears, and the backslash is not it-
- self quoted, the \\b\<newline> is treated as a line continuation (that is,
- it is removed from the input stream and effectively ignored).
+ A non-quoted backslash (\\b\) is the _\be_\bs_\bc_\ba_\bp_\be _\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br. It preserves the
+ literal value of the next character that follows, removing any special
+ meaning it has, with the exception of <newline>. If a \\b\<newline> pair
+ appears, and the backslash is not itself quoted, the \\b\<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 between
expansion is enabled. The characters $\b$ and `\b` retain their special
meaning within double quotes. The backslash retains its special mean-
ing only when followed by one of the following characters: $\b$, `\b`, "\b", \\b\,
- or <\b<n\bne\bew\bwl\bli\bin\bne\be>\b>. A double quote may be quoted within double quotes by
- preceding it with a backslash. If enabled, history expansion will be
- performed unless an !\b! appearing in double quotes is escaped using a
- backslash. The backslash preceding the !\b! is not removed.
+ or <\b<n\bne\bew\bwl\bli\bin\bne\be>\b>. 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
+ !\b! appearing in double quotes is escaped using a backslash. The back-
+ slash preceding the !\b! is not removed.
- The special parameters *\b* and @\b@ have special meaning when in double
+ The special parameters *\b* and @\b@ have special meaning when in double
quotes (see P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS below).
- Character sequences of the form $\b$'_\bs_\bt_\br_\bi_\bn_\bg' are treated as a special
- variant of single quotes. The sequence expands to _\bs_\bt_\br_\bi_\bn_\bg, with back-
- slash-escaped characters in _\bs_\bt_\br_\bi_\bn_\bg replaced as specified by the ANSI C
- standard. Backslash escape sequences, if present, are decoded as fol-
+ Character sequences of the form $\b$'_\bs_\bt_\br_\bi_\bn_\bg' are treated as a special
+ variant of single quotes. The sequence expands to _\bs_\bt_\br_\bi_\bn_\bg, with back-
+ slash-escaped characters in _\bs_\bt_\br_\bi_\bn_\bg replaced as specified by the ANSI C
+ standard. Backslash escape sequences, if present, are decoded as fol-
lows:
\\b\a\ba alert (bell)
\\b\b\bb backspace
\\b\'\b' single quote
\\b\"\b" double quote
\\b\?\b? question mark
- \\b\_\bn_\bn_\bn the eight-bit character whose value is the octal value
+ \\b\_\bn_\bn_\bn the eight-bit character whose value is the octal value
_\bn_\bn_\bn (one to three octal digits)
- \\b\x\bx_\bH_\bH the eight-bit character whose value is the hexadecimal
+ \\b\x\bx_\bH_\bH the eight-bit character whose value is the hexadecimal
value _\bH_\bH (one or two hex digits)
- \\b\u\bu_\bH_\bH_\bH_\bH the Unicode (ISO/IEC 10646) character whose value is the
+ \\b\u\bu_\bH_\bH_\bH_\bH the Unicode (ISO/IEC 10646) character whose value is the
hexadecimal value _\bH_\bH_\bH_\bH (one to four hex digits)
\\b\U\bU_\bH_\bH_\bH_\bH_\bH_\bH_\bH_\bH
- the Unicode (ISO/IEC 10646) character whose value is the
+ the Unicode (ISO/IEC 10646) character whose value is the
hexadecimal value _\bH_\bH_\bH_\bH_\bH_\bH_\bH_\bH (one to eight hex digits)
\\b\c\bc_\bx a control-_\bx 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.
+ T\bTr\bra\ban\bns\bsl\bla\bat\bti\bin\bng\bg S\bSt\btr\bri\bin\bng\bgs\bs
A double-quoted string preceded by a dollar sign ($\b$"_\bs_\bt_\br_\bi_\bn_\bg") will cause
- the string to be translated according to the current locale. The _\bg_\be_\bt_\b-
- _\bt_\be_\bx_\bt infrastructure performs the lookup and translation, using the
- L\bLC\bC_\b_M\bME\bES\bSS\bSA\bAG\bGE\bES\bS, T\bTE\bEX\bXT\bTD\bDO\bOM\bMA\bAI\bIN\bND\bDI\bIR\bR, and T\bTE\bEX\bXT\bTD\bDO\bOM\bMA\bAI\bIN\bN shell variables. If the
- current locale is C\bC or P\bPO\bOS\bSI\bIX\bX, 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 n\bno\boe\bex\bx-\b-
- p\bpa\ban\bnd\bd_\b_t\btr\bra\ban\bns\bsl\bla\bat\bti\bio\bon\bn option is enabled using the s\bsh\bho\bop\bpt\bt builtin, translated
- strings are single-quoted instead of double-quoted. See the descrip-
- tion of s\bsh\bho\bop\bpt\bt below under S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS.
+ the string to be translated according to the current locale. The _\bg_\be_\bt_\b-
+ _\bt_\be_\bx_\bt infrastructure performs the lookup and translation, using the
+ L\bLC\bC_\b_M\bME\bES\bSS\bSA\bAG\bGE\bES\bS, T\bTE\bEX\bXT\bTD\bDO\bOM\bMA\bAI\bIN\bND\bDI\bIR\bR, and T\bTE\bEX\bXT\bTD\bDO\bOM\bMA\bAI\bIN\bN shell variables. If the
+ current locale is C\bC or P\bPO\bOS\bSI\bIX\bX, 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 n\bno\boe\bex\bxp\bpa\ban\bnd\bd_\b_t\btr\bra\ban\bns\bsl\bla\ba-\b-
+ t\bti\bio\bon\bn option is enabled using the s\bsh\bho\bop\bpt\bt builtin, translated strings are
+ single-quoted instead of double-quoted. See the description of s\bsh\bho\bop\bpt\bt
+ below under S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS.
P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS
- A _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an entity that stores values. It can be a _\bn_\ba_\bm_\be, a num-
- ber, or one of the special characters listed below under S\bSp\bpe\bec\bci\bia\bal\bl P\bPa\bar\bra\ba-\b-
+ A _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an entity that stores values. It can be a _\bn_\ba_\bm_\be, a num-
+ ber, or one of the special characters listed below under S\bSp\bpe\bec\bci\bia\bal\bl P\bPa\bar\bra\ba-\b-
m\bme\bet\bte\ber\brs\bs. A _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be is a parameter denoted by a _\bn_\ba_\bm_\be. A variable has a
- _\bv_\ba_\bl_\bu_\be and zero or more _\ba_\bt_\bt_\br_\bi_\bb_\bu_\bt_\be_\bs. Attributes are assigned using the
- d\bde\bec\bcl\bla\bar\bre\be builtin command (see d\bde\bec\bcl\bla\bar\bre\be below in S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS).
+ _\bv_\ba_\bl_\bu_\be and zero or more _\ba_\bt_\bt_\br_\bi_\bb_\bu_\bt_\be_\bs. Attributes are assigned using the
+ d\bde\bec\bcl\bla\bar\bre\be builtin command (see d\bde\bec\bcl\bla\bar\bre\be below in S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS).
+ The e\bex\bxp\bpo\bor\brt\bt and r\bre\bea\bad\bdo\bon\bnl\bly\by 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 c\bco\bom\bmm\bma\ban\bnd\bd 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 d\bde\bec\bcl\bla\bar\bre\be that accept assignment statements (_\bd_\be_\b-
- _\bc_\bl_\ba_\br_\ba_\bt_\bi_\bo_\bn commands). When += is applied to a variable for which the
- i\bin\bnt\bte\beg\bge\ber\br attribute has been set, _\bv_\ba_\bl_\bu_\be 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 A\bAr\brr\bra\bay\bys\bs 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 _\bd_\be_\bc_\bl_\ba_\br_\ba_\bt_\bi_\bo_\bn
+ commands such as d\bde\bec\bcl\bla\bar\bre\be that accept assignment statements. When += is
+ applied to a variable for which the i\bin\bnt\bte\beg\bge\ber\br attribute has been set, the
+ variable's current value and _\bv_\ba_\bl_\bu_\be 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 A\bAr\brr\bra\bay\bys\bs 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, _\bv_\ba_\bl_\bu_\be is expanded and appended to
declare -n ref=$1
- inside the function creates a nameref variable r\bre\bef\bf whose value is the
- variable name passed as the first argument. References and assignments
- to r\bre\bef\bf, and changes to its attributes, are treated as references, as-
- signments, and attribute modifications to the variable whose name was
- passed as $\b$1\b1. If the control variable in a f\bfo\bor\br 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 r\bre\bef\bf whose value is
+ the variable name passed as the first argument. References and assign-
+ ments to r\bre\bef\bf, and changes to its attributes, are treated as references,
+ assignments, and attribute modifications to the variable whose name was
+ passed as $\b$1\b1. If the control variable in a f\bfo\bor\br 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 n\bna\bam\bme\ber\bre\bef\bf
- attribute. However, nameref variables can reference array variables
- and subscripted array variables. Namerefs can be unset using the -\b-n\bn
- option to the u\bun\bns\bse\bet\bt builtin. Otherwise, if u\bun\bns\bse\bet\bt 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 -\b-n\bn
+ option to the u\bun\bns\bse\bet\bt builtin. Otherwise, if u\bun\bns\bse\bet\bt is executed with the
+ name of a nameref variable as an argument, the variable referenced by
the nameref variable will be unset.
P\bPo\bos\bsi\bit\bti\bio\bon\bna\bal\bl P\bPa\bar\bra\bam\bme\bet\bte\ber\brs\bs
- A _\bp_\bo_\bs_\bi_\bt_\bi_\bo_\bn_\ba_\bl _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is a parameter denoted by one or more digits,
+ A _\bp_\bo_\bs_\bi_\bt_\bi_\bo_\bn_\ba_\bl _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br 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 s\bse\bet\bt 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 s\bse\bet\bt 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 F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS below).
- When a positional parameter consisting of more than a single digit is
- expanded, it must be enclosed in braces (see E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN below).
+ When a positional parameter consisting of more than a single digit is
+ expanded, it must be enclosed in braces (see E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN below). Without
+ braces, a digit following $ can only refer to one of the first nine po-
+ sitional parameters ($\b$1\b1-\b-$\b$9\b9) or the special parameter $\b$0\b0 (see the next
+ section).
S\bSp\bpe\bec\bci\bia\bal\bl P\bPa\bar\bra\bam\bme\bet\bte\ber\brs\bs
The shell treats several parameters specially. These parameters may
- only be referenced; assignment to them is not allowed.
- *\b* 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 I\bIF\bFS\bS
- special variable. That is, "\b"$\b$*\b*"\b" is equivalent to "\b"$\b$1\b1_\bc$\b$2\b2_\bc.\b..\b..\b."\b",
- where _\bc is the first character of the value of the I\bIF\bFS\bS variable.
- If I\bIF\bFS\bS is unset, the parameters are separated by spaces. If I\bIF\bFS\bS
- is null, the parameters are joined without intervening separa-
- tors.
- @\b@ 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.
+ *\b* ($\b$*\b*) 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
+ I\bIF\bFS\bS variable. That is, "\b"$\b$*\b*"\b" is equivalent to "\b"$\b$1\b1_\bc$\b$2\b2_\bc.\b..\b..\b."\b", where
+ _\bc is the first character of the value of the I\bIF\bFS\bS variable. If
+ I\bIF\bFS\bS is unset, the parameters are separated by spaces. If I\bIF\bFS\bS is
+ null, the parameters are joined without intervening separators.
+ @\b@ ($\b$@\b@) 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, "\b"$\b$@\b@"\b" is equivalent to
- "\b"$\b$1\b1"\b" "\b"$\b$2\b2"\b" .\b..\b..\b. 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, "\b"$\b$@\b@"\b" and $\b$@\b@ ex-
- pand to nothing (i.e., they are removed).
- #\b# Expands to the number of positional parameters in decimal.
- ?\b? Expands to the exit status of the most recently executed com-
- mand.
- -\b- Expands to the current option flags as specified upon invoca-
- tion, by the s\bse\bet\bt builtin command, or those set by the shell it-
- self (such as the -\b-i\bi option).
- $\b$ 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.
- !\b! Expands to the process ID of the job most recently placed into
- the background, whether executed as an asynchronous command or
- using the b\bbg\bg builtin (see J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL below).
- 0\b0 Expands to the name of the shell or shell script. This is set
- at shell initialization. If b\bba\bas\bsh\bh is invoked with a file of com-
- mands, $\b$0\b0 is set to the name of that file. If b\bba\bas\bsh\bh is started
- with the -\b-c\bc option, then $\b$0\b0 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 b\bba\bas\bsh\bh, 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,
+ "\b"$\b$@\b@"\b" is equivalent to "\b"$\b$1\b1"\b" "\b"$\b$2\b2"\b" .\b..\b..\b. 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, "\b"$\b$@\b@"\b" and $\b$@\b@ expand to nothing
+ (i.e., they are removed).
+ #\b# ($\b$#\b#) Expands to the number of positional parameters in decimal.
+ ?\b? ($\b$?\b?) Expands to the exit status of the most recently executed
+ command.
+ -\b- ($\b$-\b-) Expands to the current option flags as specified upon invo-
+ cation, by the s\bse\bet\bt builtin command, or those set by the shell
+ itself (such as the -\b-i\bi option).
+ $\b$ ($\b$$\b$) Expands to the process ID of the shell. In a subshell, it
+ expands to the process ID of the parent shell, not the subshell.
+ !\b! ($\b$!\b!)Expands to the process ID of the job most recently placed
+ into the background, whether executed as an asynchronous command
+ or using the b\bbg\bg builtin (see J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL below).
+ 0\b0 ($\b$0\b0) Expands to the name of the shell or shell script. This is
+ set at shell initialization. If b\bba\bas\bsh\bh is invoked with a file of
+ commands, $\b$0\b0 is set to the name of that file. If b\bba\bas\bsh\bh is
+ started with the -\b-c\bc option, then $\b$0\b0 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 b\bba\bas\bsh\bh, as given by argu-
+ ment zero.
S\bSh\bhe\bel\bll\bl V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs
- The following variables are set by the shell:
-
- _\b_ 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.
- B\bBA\bAS\bSH\bH Expands to the full filename used to invoke this instance of
+ The shell sets following variables:
+
+ _\b_ ($\b$_\b_, an underscore) This has a number of meanings depending on
+ context. At shell startup, _\b_ 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, $\b$_\b_ ex-
+ pands to the name of the mail file currently being checked.
+ B\bBA\bAS\bSH\bH Expands to the full filename used to invoke this instance of
b\bba\bas\bsh\bh.
B\bBA\bAS\bSH\bHO\bOP\bPT\bTS\bS
- A colon-separated list of enabled shell options. Each word in
- the list is a valid argument for the -\b-s\bs option to the s\bsh\bho\bop\bpt\bt
+ A colon-separated list of enabled shell options. Each word in
+ the list is a valid argument for the -\b-s\bs option to the s\bsh\bho\bop\bpt\bt
builtin command (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below). The options
- appearing in B\bBA\bAS\bSH\bHO\bOP\bPT\bTS\bS are those reported as _\bo_\bn by s\bsh\bho\bop\bpt\bt. If
- this variable is in the environment when b\bba\bas\bsh\bh starts up, each
- shell option in the list will be enabled before reading any
- startup files. This variable is read-only.
+ appearing in B\bBA\bAS\bSH\bHO\bOP\bPT\bTS\bS are those reported as _\bo_\bn by s\bsh\bho\bop\bpt\bt. If
+ this variable is in the environment when b\bba\bas\bsh\bh starts up, the
+ shell enables each option in the list before reading any startup
+ files. This variable is read-only.
B\bBA\bAS\bSH\bHP\bPI\bID\bD
Expands to the process ID of the current b\bba\bas\bsh\bh process. This
differs from $\b$$\b$ under certain circumstances, such as subshells
An associative array variable whose members correspond to the
internal list of aliases as maintained by the a\bal\bli\bia\bas\bs 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 B\bBA\bAS\bSH\bH_\b_A\bAL\bLI\bIA\bAS\bSE\bES\bS 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 B\bBA\bAS\bSH\bH_\b_A\bAL\bLI\bIA\bAS\bSE\bES\bS is unset, it loses its special
+ properties, even if it is subsequently reset.
B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGC\bC
- 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 b\bba\bas\bsh\bh execution call stack. The number
- of parameters to the current subroutine (shell function or
- script executed with .\b. or s\bso\bou\bur\brc\bce\be) 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 .\b. or s\bso\bou\bur\brc\bce\be) is at the top of the stack.
+ When a subroutine is executed, the number of parameters passed
is pushed onto B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGC\bC. The shell sets B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGC\bC only when in
extended debugging mode (see the description of the e\bex\bxt\btd\bde\beb\bbu\bug\bg op-
- tion to the s\bsh\bho\bop\bpt\bt builtin below). Setting e\bex\bxt\btd\bde\beb\bbu\bug\bg after the
+ tion to the s\bsh\bho\bop\bpt\bt builtin below). Setting e\bex\bxt\btd\bde\beb\bbu\bug\bg after the
shell has started to execute a script, or referencing this vari-
- able when e\bex\bxt\btd\bde\beb\bbu\bug\bg is not set, may result in inconsistent val-
+ able when e\bex\bxt\btd\bde\beb\bbu\bug\bg is not set, may result in inconsistent val-
ues. Assignments to B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGC\bC have no effect, and it may not be
unset.
B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV
- An array variable containing all of the parameters in the cur-
+ An array variable containing all of the parameters in the cur-
rent b\bba\bas\bsh\bh 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 B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV. The
- shell sets B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV only when in extended debugging mode (see
- the description of the e\bex\bxt\btd\bde\beb\bbu\bug\bg option to the s\bsh\bho\bop\bpt\bt builtin be-
- low). Setting e\bex\bxt\btd\bde\beb\bbu\bug\bg after the shell has started to execute a
- script, or referencing this variable when e\bex\bxt\btd\bde\beb\bbu\bug\bg is not set,
- may result in inconsistent values. Assignments to B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV
+ cuted, the shell pushes the supplied parameters onto B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV.
+ The shell sets B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV only when in extended debugging mode
+ (see the description of the e\bex\bxt\btd\bde\beb\bbu\bug\bg option to the s\bsh\bho\bop\bpt\bt builtin
+ below). Setting e\bex\bxt\btd\bde\beb\bbu\bug\bg after the shell has started to execute
+ a script, or referencing this variable when e\bex\bxt\btd\bde\beb\bbu\bug\bg is not set,
+ may result in inconsistent values. Assignments to B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV
have no effect, and it may not be unset.
B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV0\b0
- 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 $\b$0\b0; see the description of special
- parameter 0 above). Assignment to B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV0\b0 causes the value
- assigned to also be assigned to $\b$0\b0. If B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV0\b0 is unset, it
- loses its special properties, even if it is subsequently reset.
+ parameter 0 above). Assigning a value to B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV0\b0 assigns the
+ same value to $\b$0\b0. If B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV0\b0 is unset, it loses its special
+ properties, even if it is subsequently reset.
B\bBA\bAS\bSH\bH_\b_C\bCM\bMD\bDS\bS
An associative array variable whose members correspond to the
internal hash table of commands as maintained by the h\bha\bas\bsh\bh
- 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 B\bBA\bAS\bSH\bH_\b_C\bCM\bMD\bDS\bS 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 B\bBA\bAS\bSH\bH_\b_C\bCM\bMD\bDS\bS is un-
+ set, it loses its special properties, even if it is subsequently
+ reset.
B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMM\bMA\bAN\bND\bD
- 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\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMM\bMA\bAN\bND\bD 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 B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMM\bMA\bAN\bND\bD is unset, it loses its special
+ properties, even if it is subsequently reset.
B\bBA\bAS\bSH\bH_\b_E\bEX\bXE\bEC\bCU\bUT\bTI\bIO\bON\bN_\b_S\bST\bTR\bRI\bIN\bNG\bG
The command argument to the -\b-c\bc invocation option.
B\bBA\bAS\bSH\bH_\b_L\bLI\bIN\bNE\bEN\bNO\bO
tion). Use L\bLI\bIN\bNE\bEN\bNO\bO to obtain the current line number. Assign-
ments to B\bBA\bAS\bSH\bH_\b_L\bLI\bIN\bNE\bEN\bNO\bO have no effect, and it may not be unset.
B\bBA\bAS\bSH\bH_\b_L\bLO\bOA\bAD\bDA\bAB\bBL\bLE\bES\bS_\b_P\bPA\bAT\bTH\bH
- A colon-separated list of directories in which the shell looks
- for dynamically loadable builtins specified by the e\ben\bna\bab\bbl\ble\be com-
- mand.
- B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH
- An array variable whose members are assigned by the =\b=~\b~ binary
- operator to the [\b[[\b[ conditional command. The element with index
- 0 is the portion of the string matching the entire regular ex-
- pression. The element with index _\bn is the portion of the string
- matching the _\bnth parenthesized subexpression.
+ A colon-separated list of directories in which the e\ben\bna\bab\bbl\ble\be com-
+ mand. looks for dynamically loadable builtins.
B\bBA\bAS\bSH\bH_\b_M\bMO\bON\bNO\bOS\bSE\bEC\bCO\bON\bND\bDS\bS
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 E\bEP\bPO\bOC\bCH\bHS\bSE\bEC\bC-\b-
O\bON\bND\bDS\bS. If B\bBA\bAS\bSH\bH_\b_M\bMO\bON\bNO\bOS\bSE\bEC\bCO\bON\bND\bDS\bS is unset, it loses its special prop-
erties, even if it is subsequently reset.
+ B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH
+ An array variable whose members are assigned by the =\b=~\b~ binary
+ operator to the [\b[[\b[ conditional command. The element with index
+ 0 is the portion of the string matching the entire regular ex-
+ pression. The element with index _\bn is the portion of the string
+ matching the _\bnth parenthesized subexpression.
B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE
- An array variable whose members are the source filenames where
- the corresponding shell function names in the F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE array
+ An array variable whose members are the source filenames where
+ the corresponding shell function names in the F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE array
variable are defined. The shell function $\b${\b{F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE[\b[_\b$_\bi]\b]}\b} is de-
- fined in the file $\b${\b{B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE[\b[_\b$_\bi]\b]}\b} and called from
- $\b${\b{B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE[\b[_\b$_\bi_\b+_\b1]\b]}\b}. Assignments to B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE have no ef-
+ fined in the file $\b${\b{B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE[\b[_\b$_\bi]\b]}\b} and called from
+ $\b${\b{B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE[\b[_\b$_\bi_\b+_\b1]\b]}\b}. Assignments to B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE have no ef-
fect, and it may not be unset.
B\bBA\bAS\bSH\bH_\b_S\bSU\bUB\bBS\bSH\bHE\bEL\bLL\bL
- Incremented by one within each subshell or subshell environment
- when the shell begins executing in that environment. The ini-
- tial value is 0. If B\bBA\bAS\bSH\bH_\b_S\bSU\bUB\bBS\bSH\bHE\bEL\bLL\bL 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 B\bBA\bAS\bSH\bH_\b_S\bSU\bUB\bBS\bSH\bHE\bEL\bLL\bL is unset, it loses its spe-
cial properties, even if it is subsequently reset.
B\bBA\bAS\bSH\bH_\b_T\bTR\bRA\bAP\bPS\bSI\bIG\bG
- Set to the signal number corresponding to the trap action being
- executed during its execution. See the description of t\btr\bra\bap\bp un-
- der S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below for information about signal
+ Set to the signal number corresponding to the trap action being
+ executed during its execution. See the description of t\btr\bra\bap\bp un-
+ der S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below for information about signal
numbers and trap execution.
B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO
A readonly array variable whose members hold version information
- for this instance of b\bba\bas\bsh\bh. The values assigned to the array
+ for this instance of b\bba\bas\bsh\bh. The values assigned to the array
members are as follows:
B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO[\b[0]\b] The major version number (the _\br_\be_\bl_\be_\ba_\bs_\be).
B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO[\b[1]\b] The minor version number (the _\bv_\be_\br_\bs_\bi_\bo_\bn).
B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO[\b[4]\b] The release status (e.g., _\bb_\be_\bt_\ba).
B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO[\b[5]\b] The value of M\bMA\bAC\bCH\bHT\bTY\bYP\bPE\bE.
B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIO\bON\bN
- Expands to a string describing the version of this instance of
- b\bba\bas\bsh\bh.
+ Expands to a string describing the version of this instance of
+ b\bba\bas\bsh\bh (e.g., 5.2.37(3)-release).
C\bCO\bOM\bMP\bP_\b_C\bCW\bWO\bOR\bRD\bD
- An index into $\b${\b{C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDS\bS}\b} of the word containing the current
+ An index into $\b${\b{C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDS\bS}\b} 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
P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn below).
C\bCO\bOM\bMP\bP_\b_K\bKE\bEY\bY
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 P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn below).
C\bCO\bOM\bMP\bP_\b_L\bLI\bIN\bNE\bE
- 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 P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn below).
C\bCO\bOM\bMP\bP_\b_P\bPO\bOI\bIN\bNT\bT
- 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 $\b${\b{#\b#C\bCO\bOM\bMP\bP_\b_L\bLI\bIN\bNE\bE}\b}. This variable is available only in
- shell functions and external commands invoked by the programma-
+ equal to $\b${\b{#\b#C\bCO\bOM\bMP\bP_\b_L\bLI\bIN\bNE\bE}\b}. This variable is available only in
+ shell functions and external commands invoked by the programma-
ble completion facilities (see P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn below).
C\bCO\bOM\bMP\bP_\b_T\bTY\bYP\bPE\bE
- Set to an integer value corresponding to the type of completion
- attempted that caused a completion function to be called: _\bT_\bA_\bB,
- for normal completion, _\b?, for listing completions after succes-
- sive tabs, _\b!, for listing alternatives on partial word comple-
- tion, _\b@, to list completions if the word is not unmodified, or
- _\b%, 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: _\bT_\bA_\bB,
+ for normal completion, _\b?, for listing completions after succes-
+ sive tabs, _\b!, for listing alternatives on partial word comple-
+ tion, _\b@, to list completions if the word is not unmodified, or
+ _\b%, for menu completion. This variable is available only in
+ shell functions and external commands invoked by the programma-
ble completion facilities (see P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn below).
C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS
- The set of characters that the r\bre\bea\bad\bdl\bli\bin\bne\be library treats as word
- separators when performing word completion. If C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS
- is unset, it loses its special properties, even if it is subse-
+ The set of characters that the r\bre\bea\bad\bdl\bli\bin\bne\be library treats as word
+ separators when performing word completion. If C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS
+ is unset, it loses its special properties, even if it is subse-
quently reset.
C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDS\bS
- An array variable (see A\bAr\brr\bra\bay\bys\bs below) consisting of the individ-
- ual words in the current command line. The line is split into
- words as r\bre\bea\bad\bdl\bli\bin\bne\be would split it, using C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS as de-
- scribed above. This variable is available only in shell func-
- tions invoked by the programmable completion facilities (see
+ An array variable (see A\bAr\brr\bra\bay\bys\bs below) consisting of the individ-
+ ual words in the current command line. The line is split into
+ words as r\bre\bea\bad\bdl\bli\bin\bne\be would split it, using C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS as de-
+ scribed above. This variable is available only in shell func-
+ tions invoked by the programmable completion facilities (see
P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn below).
- C\bCO\bOP\bPR\bRO\bOC\bC An array variable (see A\bAr\brr\bra\bay\bys\bs below) created to hold the file
- descriptors for output from and input to an unnamed coprocess
+ C\bCO\bOP\bPR\bRO\bOC\bC An array variable (see A\bAr\brr\bra\bay\bys\bs below) created to hold the file
+ descriptors for output from and input to an unnamed coprocess
(see C\bCo\bop\bpr\bro\boc\bce\bes\bss\bse\bes\bs above).
D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK
An array variable (see A\bAr\brr\bra\bay\bys\bs below) containing the current con-
- tents of the directory stack. Directories appear in the stack
- in the order they are displayed by the d\bdi\bir\brs\bs builtin. Assigning
+ tents of the directory stack. Directories appear in the stack
+ in the order they are displayed by the d\bdi\bir\brs\bs builtin. Assigning
to members of this array variable may be used to modify directo-
- ries already in the stack, but the p\bpu\bus\bsh\bhd\bd and p\bpo\bop\bpd\bd builtins must
+ ries already in the stack, but the p\bpu\bus\bsh\bhd\bd and p\bpo\bop\bpd\bd builtins must
be used to add and remove directories. Assignment to this vari-
- able will not change the current directory. If D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK is un-
+ able will not change the current directory. If D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK is un-
set, it loses its special properties, even if it is subsequently
reset.
E\bEP\bPO\bOC\bCH\bHR\bRE\bEA\bAL\bLT\bTI\bIM\bME\bE
Each time this parameter is referenced, it expands to the number
- of seconds since the Unix Epoch (see _\bt_\bi_\bm_\be(3)) as a floating
+ of seconds since the Unix Epoch (see _\bt_\bi_\bm_\be(3)) as a floating
point value with micro-second granularity. Assignments to
- E\bEP\bPO\bOC\bCH\bHR\bRE\bEA\bAL\bLT\bTI\bIM\bME\bE are ignored. If E\bEP\bPO\bOC\bCH\bHR\bRE\bEA\bAL\bLT\bTI\bIM\bME\bE is unset, it loses
+ E\bEP\bPO\bOC\bCH\bHR\bRE\bEA\bAL\bLT\bTI\bIM\bME\bE are ignored. If E\bEP\bPO\bOC\bCH\bHR\bRE\bEA\bAL\bLT\bTI\bIM\bME\bE is unset, it loses
its special properties, even if it is subsequently reset.
E\bEP\bPO\bOC\bCH\bHS\bSE\bEC\bCO\bON\bND\bDS\bS
Each time this parameter is referenced, it expands to the number
- of seconds since the Unix Epoch (see _\bt_\bi_\bm_\be(3)). Assignments to
- E\bEP\bPO\bOC\bCH\bHS\bSE\bEC\bCO\bON\bND\bDS\bS are ignored. If E\bEP\bPO\bOC\bCH\bHS\bSE\bEC\bCO\bON\bND\bDS\bS is unset, it loses
+ of seconds since the Unix Epoch (see _\bt_\bi_\bm_\be(3)). Assignments to
+ E\bEP\bPO\bOC\bCH\bHS\bSE\bEC\bCO\bON\bND\bDS\bS are ignored. If E\bEP\bPO\bOC\bCH\bHS\bSE\bEC\bCO\bON\bND\bDS\bS is unset, it loses
its special properties, even if it is subsequently reset.
- E\bEU\bUI\bID\bD Expands to the effective user ID of the current user, initial-
+ E\bEU\bUI\bID\bD Expands to the effective user ID of the current user, initial-
ized at shell startup. This variable is readonly.
F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE
- 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 F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE have no effect. If F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE 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 F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE have no effect. If F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE is unset,
+ it loses its special properties, even if it is subsequently re-
set.
- This variable can be used with B\bBA\bAS\bSH\bH_\b_L\bLI\bIN\bNE\bEN\bNO\bO and B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE.
- Each element of F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE has corresponding elements in
+ This variable can be used with B\bBA\bAS\bSH\bH_\b_L\bLI\bIN\bNE\bEN\bNO\bO and B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE.
+ Each element of F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE has corresponding elements in
B\bBA\bAS\bSH\bH_\b_L\bLI\bIN\bNE\bEN\bNO\bO and B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE to describe the call stack. For in-
- stance, $\b${\b{F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE[\b[_\b$_\bi]\b]}\b} was called from the file
- $\b${\b{B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE[\b[_\b$_\bi_\b+_\b1]\b]}\b} at line number $\b${\b{B\bBA\bAS\bSH\bH_\b_L\bLI\bIN\bNE\bEN\bNO\bO[\b[_\b$_\bi]\b]}\b}. The
+ stance, $\b${\b{F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE[\b[_\b$_\bi]\b]}\b} was called from the file
+ $\b${\b{B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE[\b[_\b$_\bi_\b+_\b1]\b]}\b} at line number $\b${\b{B\bBA\bAS\bSH\bH_\b_L\bLI\bIN\bNE\bEN\bNO\bO[\b[_\b$_\bi]\b]}\b}. The
c\bca\bal\bll\ble\ber\br builtin displays the current call stack using this infor-
mation.
- G\bGR\bRO\bOU\bUP\bPS\bS An array variable containing the list of groups of which the
+ G\bGR\bRO\bOU\bUP\bPS\bS An array variable containing the list of groups of which the
current user is a member. Assignments to G\bGR\bRO\bOU\bUP\bPS\bS have no effect.
- If G\bGR\bRO\bOU\bUP\bPS\bS is unset, it loses its special properties, even if it
+ If G\bGR\bRO\bOU\bUP\bPS\bS is unset, it loses its special properties, even if it
is subsequently reset.
H\bHI\bIS\bST\bTC\bCM\bMD\bD
The history number, or index in the history list, of the current
H\bHO\bOS\bST\bTN\bNA\bAM\bME\bE
Automatically set to the name of the current host.
H\bHO\bOS\bST\bTT\bTY\bYP\bPE\bE
- Automatically set to a string that uniquely describes the type
- of machine on which b\bba\bas\bsh\bh is executing. The default is system-
+ Automatically set to a string that uniquely describes the type
+ of machine on which b\bba\bas\bsh\bh is executing. The default is system-
dependent.
- L\bLI\bIN\bNE\bEN\bNO\bO 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
+ L\bLI\bIN\bNE\bEN\bNO\bO 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 L\bLI\bIN\bNE\bEN\bNO\bO is unset, it loses its special proper-
ties, even if it is subsequently reset.
M\bMA\bAC\bCH\bHT\bTY\bYP\bPE\bE
- Automatically set to a string that fully describes the system
- type on which b\bba\bas\bsh\bh is executing, in the standard GNU _\bc_\bp_\bu_\b-_\bc_\bo_\bm_\b-
+ Automatically set to a string that fully describes the system
+ type on which b\bba\bas\bsh\bh is executing, in the standard GNU _\bc_\bp_\bu_\b-_\bc_\bo_\bm_\b-
_\bp_\ba_\bn_\by_\b-_\bs_\by_\bs_\bt_\be_\bm format. The default is system-dependent.
M\bMA\bAP\bPF\bFI\bIL\bLE\bE
- An array variable (see A\bAr\brr\bra\bay\bys\bs below) created to hold the text
+ An array variable (see A\bAr\brr\bra\bay\bys\bs below) created to hold the text
read by the m\bma\bap\bpf\bfi\bil\ble\be builtin when no variable name is supplied.
O\bOL\bLD\bDP\bPW\bWD\bD The previous working directory as set by the c\bcd\bd command.
- O\bOP\bPT\bTA\bAR\bRG\bG The value of the last option argument processed by the g\bge\bet\bto\bop\bpt\bts\bs
+ O\bOP\bPT\bTA\bAR\bRG\bG The value of the last option argument processed by the g\bge\bet\bto\bop\bpt\bts\bs
builtin command (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below).
- O\bOP\bPT\bTI\bIN\bND\bD The index of the next argument to be processed by the g\bge\bet\bto\bop\bpt\bts\bs
+ O\bOP\bPT\bTI\bIN\bND\bD The index of the next argument to be processed by the g\bge\bet\bto\bop\bpt\bts\bs
builtin command (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below).
- O\bOS\bST\bTY\bYP\bPE\bE Automatically set to a string that describes the operating sys-
- tem on which b\bba\bas\bsh\bh is executing. The default is system-depen-
+ O\bOS\bST\bTY\bYP\bPE\bE Automatically set to a string that describes the operating sys-
+ tem on which b\bba\bas\bsh\bh is executing. The default is system-depen-
dent.
P\bPI\bIP\bPE\bES\bST\bTA\bAT\bTU\bUS\bS
- An array variable (see A\bAr\brr\bra\bay\bys\bs 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 A\bAr\brr\bra\bay\bys\bs 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 S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR above).
- P\bPP\bPI\bID\bD The process ID of the shell's parent. This variable is read-
+ P\bPP\bPI\bID\bD The process ID of the shell's parent. This variable is read-
only.
P\bPW\bWD\bD The current working directory as set by the c\bcd\bd command.
- R\bRA\bAN\bND\bDO\bOM\bM Each time this parameter is referenced, it expands to a random
- integer between 0 and 32767. Assigning a value to R\bRA\bAN\bND\bDO\bOM\bM ini-
- tializes (seeds) the sequence of random numbers. If R\bRA\bAN\bND\bDO\bOM\bM is
- unset, it loses its special properties, even if it is subse-
- quently reset.
+ R\bRA\bAN\bND\bDO\bOM\bM Each time this parameter is referenced, it expands to a random
+ integer between 0 and 32767. Assigning a value to R\bRA\bAN\bND\bDO\bOM\bM 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 R\bRA\bAN\bND\bDO\bOM\bM is unset, it loses
+ its special properties, even if it is subsequently reset.
R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_A\bAR\bRG\bGU\bUM\bME\bEN\bNT\bT
Any numeric argument given to a readline command that was de-
fined using "bind -x" (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below) when it
the list is a valid argument for the -\b-o\bo option to the s\bse\bet\bt
builtin command (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below). The options
appearing in S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS are those reported as _\bo_\bn by s\bse\bet\bt -\b-o\bo. If
- this variable is in the environment when b\bba\bas\bsh\bh 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 b\bba\bas\bsh\bh starts up, the
+ shell enables each option in the list before reading any startup
+ files. This variable is read-only.
S\bSH\bHL\bLV\bVL\bL Incremented by one each time an instance of b\bba\bas\bsh\bh is started.
S\bSR\bRA\bAN\bND\bDO\bOM\bM
- 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 _\b/_\bd_\be_\bv_\b/_\bu_\br_\ba_\bn_\bd_\bo_\bm or _\ba_\br_\bc_\b4_\br_\ba_\bn_\bd_\bo_\bm(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 _\b/_\bd_\be_\bv_\b/_\bu_\br_\ba_\bn_\bd_\bo_\bm or _\ba_\br_\bc_\b4_\br_\ba_\bn_\bd_\bo_\bm(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 S\bSR\bRA\bAN\bND\bDO\bOM\bM is unset, it loses its
special properties, even if it is subsequently reset.
U\bUI\bID\bD 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, b\bba\bas\bsh\bh as-
- signs a default value to a variable; these cases are noted below.
+ The shell uses the following variables. In some cases, b\bba\bas\bsh\bh assigns a
+ default value to a variable; these cases are noted below.
B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMP\bPA\bAT\bT
- The value is used to set the shell's compatibility level. See
- S\bSH\bHE\bEL\bLL\bL C\bCO\bOM\bMP\bPA\bAT\bTI\bIB\bBI\bIL\bLI\bIT\bTY\bY M\bMO\bOD\bDE\bE below for a description of the various
+ The value is used to set the shell's compatibility level. See
+ S\bSH\bHE\bEL\bLL\bL C\bCO\bOM\bMP\bPA\bAT\bTI\bIB\bBI\bIL\bLI\bIT\bTY\bY M\bMO\bOD\bDE\bE 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 B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMP\bPA\bAT\bT is unset or
- set to the empty string, the compatibility level is set to the
- default for the current version. If B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMP\bPA\bAT\bT 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 S\bSH\bHE\bEL\bLL\bL C\bCO\bOM\bMP\bPA\bAT\bTI\bIB\bBI\bIL\bLI\bIT\bTY\bY M\bMO\bOD\bDE\bE. For example, 4.2 and 42 are
- valid values that correspond to the c\bco\bom\bmp\bpa\bat\bt4\b42\b2 s\bsh\bho\bop\bpt\bt 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 B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMP\bPA\bAT\bT is unset or
+ set to the empty string, the compatibility level is set to the
+ default for the current version. If B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMP\bPA\bAT\bT 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 S\bSH\bHE\bEL\bLL\bL C\bCO\bOM\bMP\bPA\bAT\bTI\bIB\bBI\bIL\bLI\bIT\bTY\bY M\bMO\bOD\bDE\bE. For example, 4.2 and 42 are
+ valid values that correspond to the c\bco\bom\bmp\bpa\bat\bt4\b42\b2 s\bsh\bho\bop\bpt\bt option and
+ set the compatibility level to 42. The current version is also
a valid value.
B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV
- If this parameter is set when b\bba\bas\bsh\bh is executing a shell script,
- its value is interpreted as a filename containing commands to
- initialize the shell, as in _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc. The value of B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV is
- subjected to parameter expansion, command substitution, and
- arithmetic expansion before being interpreted as a filename.
- P\bPA\bAT\bTH\bH is not used to search for the resultant filename.
+ If this parameter is set when b\bba\bas\bsh\bh 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 B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV is subjected to
+ parameter expansion, command substitution, and arithmetic expan-
+ sion before being interpreted as a filename. P\bPA\bAT\bTH\bH is not used
+ to search for the resultant filename.
B\bBA\bAS\bSH\bH_\b_X\bXT\bTR\bRA\bAC\bCE\bEF\bFD\bD
If set to an integer corresponding to a valid file descriptor,
b\bba\bas\bsh\bh will write the trace output generated when "set -x" is en-
B\bBA\bAS\bSH\bH_\b_X\bXT\bTR\bRA\bAC\bCE\bEF\bFD\bD to 2 (the standard error file descriptor) and then
unsetting it will result in the standard error being closed.
C\bCD\bDP\bPA\bAT\bTH\bH The search path for the c\bcd\bd command. This is a colon-separated
- list of directories in which the shell looks for destination di-
- rectories specified by the c\bcd\bd command. A sample value is
+ list of directories where the shell looks for directories speci-
+ fied as arguments to the c\bcd\bd command. A sample value is
".:~:/usr".
C\bCH\bHI\bIL\bLD\bD_\b_M\bMA\bAX\bX
Set the number of exited child status values for the shell to
above) when an interactive shell is invoked in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be.
E\bEX\bXE\bEC\bCI\bIG\bGN\bNO\bOR\bRE\bE
A colon-separated list of shell patterns (see P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg)
- defining the list of filenames to be ignored by command search
+ defining the set of filenames to be ignored by command search
using P\bPA\bAT\bTH\bH. Files whose full pathnames match one of these pat-
terns are not considered executable files for the purposes of
completion and command execution via P\bPA\bAT\bTH\bH lookup. This does not
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 G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE, it is removed from the list of matches.
+ patterns in G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE, it is removed from the list of matches.
+ The pattern matching honors the setting of the e\bex\bxt\btg\bgl\blo\bob\bb shell op-
+ tion.
G\bGL\bLO\bOB\bBS\bSO\bOR\bRT\bT
- 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 _\b+, which is ig-
+ If set, a valid value begins with an optional _\b+, which is ig-
nored, or _\b-, which reverses the sort order from ascending to de-
- scending, followed by a sort specifier. The valid sort speci-
- fiers are _\bn_\ba_\bm_\be, _\bn_\bu_\bm_\be_\br_\bi_\bc, _\bs_\bi_\bz_\be, _\bm_\bt_\bi_\bm_\be, _\ba_\bt_\bi_\bm_\be, _\bc_\bt_\bi_\bm_\be, and _\bb_\bl_\bo_\bc_\bk_\bs,
+ scending, followed by a sort specifier. The valid sort speci-
+ fiers are _\bn_\ba_\bm_\be, _\bn_\bu_\bm_\be_\br_\bi_\bc, _\bs_\bi_\bz_\be, _\bm_\bt_\bi_\bm_\be, _\ba_\bt_\bi_\bm_\be, _\bc_\bt_\bi_\bm_\be, and _\bb_\bl_\bo_\bc_\bk_\bs,
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 _\b-_\bm_\bt_\bi_\bm_\be sorts the results in descending order
- by modification time (newest first).
-
- The _\bn_\bu_\bm_\be_\br_\bi_\bc 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 _\bn_\bu_\bm_\be_\br_\bi_\bc, 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 _\b-_\bm_\bt_\bi_\bm_\be sorts the results in descending
+ order by modification time (newest first).
+
+ The _\bn_\bu_\bm_\be_\br_\bi_\bc 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 _\bn_\bu_\bm_\be_\br_\bi_\bc, 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 _\bn_\bo_\bs_\bo_\br_\bt disables sorting completely; the re-
+ A sort specifier of _\bn_\bo_\bs_\bo_\br_\bt disables sorting completely; the re-
sults are returned in the order they are read from the file sys-
- tem, and any leading _\b+ or _\b- is ignored. If the sort specifier
- is missing, it defaults to _\bn_\ba_\bm_\be, so a value of _\b+ is equivalent
- to the null string, and a value of _\b- sorts by name in descending
- order. Any invalid value restores the historical sorting behav-
- ior.
+ tem, and any leading _\b+ or _\b- is ignored.
+
+ If the sort specifier is missing, it defaults to _\bn_\ba_\bm_\be, so a
+ value of _\b+ is equivalent to the null string, and a value of _\b-
+ sorts by name in descending order. Any invalid value restores
+ the historical sorting behavior.
H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL
A colon-separated list of values controlling how commands are
saved on the history list. If the list of values includes
_\bi_\bg_\bn_\bo_\br_\be_\bs_\bp_\ba_\bc_\be, lines which begin with a s\bsp\bpa\bac\bce\be character are not
saved in the history list. A value of _\bi_\bg_\bn_\bo_\br_\be_\bd_\bu_\bp_\bs 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
_\bi_\bg_\bn_\bo_\br_\be_\bb_\bo_\bt_\bh is shorthand for _\bi_\bg_\bn_\bo_\br_\be_\bs_\bp_\ba_\bc_\be and _\bi_\bg_\bn_\bo_\br_\be_\bd_\bu_\bp_\bs. A value
of _\be_\br_\ba_\bs_\be_\bd_\bu_\bp_\bs causes all previous lines matching the current line
to be removed from the history list before that line is saved.
shell parser are saved on the history list, subject to the value
of H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE. 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 H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL.
+ regardless of the value of H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL 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.
H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE
The name of the file in which command history is saved (see H\bHI\bIS\bS-\b-
T\bTO\bOR\bRY\bY below). B\bBa\bas\bsh\bh assigns a default value of _\b~_\b/_\b._\bb_\ba_\bs_\bh_\b__\bh_\bi_\bs_\bt_\bo_\br_\by.
- If H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is unset or null, the command history is not saved
- when a shell exits.
+ If H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is unset or null, the shell does not save the com-
+ mand history when it exits.
H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bES\bSI\bIZ\bZE\bE
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
- H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE after reading any startup files.
+ truncated to this size after writing it when a shell exits or by
+ the h\bhi\bis\bst\bto\bor\bry\by 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 H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE after reading any startup files.
H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE
- 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 H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE, it is
- not saved on the history list. Each pattern is anchored at the
- beginning of the line and must match the complete line (b\bba\bas\bsh\bh
- will not implicitly append a "*\b*"). Each pattern is tested
- against the line after the checks specified by H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL 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 H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE, it is
+ not saved on the history list. Each pattern is anchored at the
+ beginning of the line and must match the complete line (b\bba\bas\bsh\bh
+ will not implicitly append a "*\b*"). Each pattern is tested
+ against the line after the checks specified by H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL are
applied. In addition to the normal shell pattern matching char-
acters, "&\b&" matches the previous history line. A backslash will
- escape the "&\b&"; the backslash is removed before attempting a
+ escape the "&\b&"; 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 H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE. The pattern matching honors the
- setting of the e\bex\bxt\btg\bgl\blo\bob\bb shell option.
+ command are not tested, and are added to the history regardless
+ of the value of H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE. 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 e\bex\bxt\btg\bgl\blo\bob\bb
+ shell option.
H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE
The number of commands to remember in the command history (see
H\bHI\bIS\bST\bTO\bOR\bRY\bY below). If the value is 0, commands are not saved in
If this variable is set and not null, its value is used as a
format string for _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be(3) to print the time stamp associated
with each history entry displayed by the h\bhi\bis\bst\bto\bor\bry\by 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.
H\bHO\bOM\bME\bE The home directory of the current user; the default argument for
the c\bcd\bd builtin command. The value of this variable is also used
when performing tilde expansion.
tions. When H\bHO\bOS\bST\bTF\bFI\bIL\bLE\bE is unset, the hostname list is cleared.
I\bIF\bFS\bS The _\bI_\bn_\bt_\be_\br_\bn_\ba_\bl _\bF_\bi_\be_\bl_\bd _\bS_\be_\bp_\ba_\br_\ba_\bt_\bo_\br that is used for word splitting af-
ter expansion and to split lines into words with the r\bre\bea\bad\bd
- builtin command. The default value is "<space><tab><newline>".
+ builtin command. Word splitting is described above under E\bEX\bXP\bPA\bAN\bN-\b-
+ S\bSI\bIO\bON\bN. The default value is "<space><tab><newline>".
I\bIG\bGN\bNO\bOR\bRE\bEE\bEO\bOF\bF
Controls the action of an interactive shell on receipt of an E\bEO\bOF\bF
character as the sole input. If set, the value is the number of
consecutive E\bEO\bOF\bF characters which must be typed as the first
characters on an input line before b\bba\bas\bsh\bh 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, E\bEO\bOF\bF 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, E\bEO\bOF\bF signifies the end
+ of input to the shell.
I\bIN\bNP\bPU\bUT\bTR\bRC\bC
The filename for the r\bre\bea\bad\bdl\bli\bin\bne\be startup file, overriding the de-
fault of _\b~_\b/_\b._\bi_\bn_\bp_\bu_\bt_\br_\bc (see R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE below).
length for printing selection lists. Automatically set if the
c\bch\bhe\bec\bck\bkw\bwi\bin\bns\bsi\biz\bze\be option is enabled or in an interactive shell upon
receipt of a S\bSI\bIG\bGW\bWI\bIN\bNC\bCH\bH.
- M\bMA\bAI\bIL\bL If this parameter is set to a file or directory name and the
- M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH variable is not set, b\bba\bas\bsh\bh informs the user of the ar-
- rival of mail in the specified file or Maildir-format directory.
+ M\bMA\bAI\bIL\bL If the value is set to a file or directory name and the M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH
+ variable is not set, b\bba\bas\bsh\bh informs the user of the arrival of
+ mail in the specified file or Maildir-format directory.
M\bMA\bAI\bIL\bLC\bCH\bHE\bEC\bCK\bK
- Specifies how often (in seconds) b\bba\bas\bsh\bh 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) b\bba\bas\bsh\bh 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.
M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH
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, $\b$_\b_ expands to the
+ be specified by separating the filename from the message with a
+ "?". When used in the text of the message, $\b$_\b_ expands to the
name of the current mailfile. Example:
M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH='/var/mail/bfox?"You have mail":~/shell-mail?"$_ has mail!"'
- B\bBa\bas\bsh\bh can be configured to supply a default value for this vari-
- able (there is no value by default), but the location of the
+ B\bBa\bas\bsh\bh 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/$\b$U\bUS\bSE\bER\bR).
O\bOP\bPT\bTE\bER\bRR\bR If set to the value 1, b\bba\bas\bsh\bh displays error messages generated by
- the g\bge\bet\bto\bop\bpt\bts\bs builtin command (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below).
- O\bOP\bPT\bTE\bER\bRR\bR is initialized to 1 each time the shell is invoked or a
+ the g\bge\bet\bto\bop\bpt\bts\bs builtin command (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below).
+ O\bOP\bPT\bTE\bER\bRR\bR is initialized to 1 each time the shell is invoked or a
shell script is executed.
- P\bPA\bAT\bTH\bH The search path for commands. It is a colon-separated list of
- directories in which the shell looks for commands (see C\bCO\bOM\bMM\bMA\bAN\bND\bD
- E\bEX\bXE\bEC\bCU\bUT\bTI\bIO\bON\bN below). A zero-length (null) directory name in the
+ P\bPA\bAT\bTH\bH The search path for commands. It is a colon-separated list of
+ directories in which the shell looks for commands (see C\bCO\bOM\bMM\bMA\bAN\bND\bD
+ E\bEX\bXE\bEC\bCU\bUT\bTI\bIO\bON\bN below). A zero-length (null) directory name in the
value of P\bPA\bAT\bTH\bH 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 b\bba\bas\bsh\bh. A common value is
"/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin".
P\bPO\bOS\bSI\bIX\bXL\bLY\bY_\b_C\bCO\bOR\bRR\bRE\bEC\bCT\bT
- If this variable is in the environment when b\bba\bas\bsh\bh starts, the
- shell enters _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be before reading the startup files, as if
- the -\b--\b-p\bpo\bos\bsi\bix\bx invocation option had been supplied. If it is set
- while the shell is running, b\bba\bas\bsh\bh enables _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, as if the
+ If this variable is in the environment when b\bba\bas\bsh\bh starts, the
+ shell enters _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be before reading the startup files, as if
+ the -\b--\b-p\bpo\bos\bsi\bix\bx invocation option had been supplied. If it is set
+ while the shell is running, b\bba\bas\bsh\bh enables _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, as if the
command "set -o posix" had been executed. When the shell enters
_\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, it sets this variable if it was not already set.
P\bPR\bRO\bOM\bMP\bPT\bT_\b_C\bCO\bOM\bMM\bMA\bAN\bND\bD
- 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.
P\bPR\bRO\bOM\bMP\bPT\bT_\b_D\bDI\bIR\bRT\bTR\bRI\bIM\bM
- 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 \\b\w\bw and \\b\W\bW prompt string escapes (see P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG below).
+ the \\b\w\bw and \\b\W\bW prompt string escapes (see P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG below).
Characters removed are replaced with an ellipsis.
- P\bPS\bS0\b0 The value of this parameter is expanded (see P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG below)
- and displayed by interactive shells after reading a command and
+ P\bPS\bS0\b0 The value of this parameter is expanded (see P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG below)
+ and displayed by interactive shells after reading a command and
before the command is executed.
- P\bPS\bS1\b1 The value of this parameter is expanded (see P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG below)
- and used as the primary prompt string. The default value is
+ P\bPS\bS1\b1 The value of this parameter is expanded (see P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG below)
+ and used as the primary prompt string. The default value is
"\s-\v\$ ".
- P\bPS\bS2\b2 The value of this parameter is expanded as with P\bPS\bS1\b1 and used as
+ P\bPS\bS2\b2 The value of this parameter is expanded as with P\bPS\bS1\b1 and used as
the secondary prompt string. The default is "> ".
P\bPS\bS3\b3 The value of this parameter is used as the prompt for the s\bse\bel\ble\bec\bct\bt
command (see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR above).
- P\bPS\bS4\b4 The value of this parameter is expanded as with P\bPS\bS1\b1 and the
+ P\bPS\bS4\b4 The value of this parameter is expanded as with P\bPS\bS1\b1 and the
value is printed before each command b\bba\bas\bsh\bh displays during an ex-
ecution trace. The first character of the expanded value of P\bPS\bS4\b4
is replicated multiple times, as necessary, to indicate multiple
levels of indirection. The default is "+ ".
- S\bSH\bHE\bEL\bLL\bL This variable expands to the full pathname to the shell. If it
- is not set when the shell starts, b\bba\bas\bsh\bh assigns to it the full
+ S\bSH\bHE\bEL\bLL\bL This variable expands to the full pathname to the shell. If it
+ is not set when the shell starts, b\bba\bas\bsh\bh assigns to it the full
pathname of the current user's login shell.
T\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT
- The value of this parameter is used as a format string specify-
- ing how the timing information for pipelines prefixed with the
- t\bti\bim\bme\be reserved word should be displayed. The %\b% 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
+ t\bti\bim\bme\be reserved word should be displayed. The %\b% 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.
%\b%%\b% A literal %\b%.
%\b%[\b[_\bp]\b][\b[l\bl]\b]R\bR The elapsed time in seconds.
%\b%[\b[_\bp]\b][\b[l\bl]\b]S\bS The number of CPU seconds spent in system mode.
%\b%P\bP The CPU percentage, computed as (%U + %S) / %R.
- The optional _\bp is a digit specifying the _\bp_\br_\be_\bc_\bi_\bs_\bi_\bo_\bn, the number
+ The optional _\bp is a digit specifying the _\bp_\br_\be_\bc_\bi_\bs_\bi_\bo_\bn, 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 _\bp greater
- than 6 are changed to 6. If _\bp is not specified, the value 3 is
- used.
+ no decimal point or fraction to be output. t\bti\bim\bme\be will print at
+ most six digits after the decimal point; values of _\bp greater
+ than 6 are changed to 6. If _\bp is not specified, t\bti\bim\bme\be prints
+ three digits after the decimal point.
- The optional l\bl specifies a longer format, including minutes, of
- the form _\bM_\bMm_\bS_\bS._\bF_\bFs. The value of _\bp determines whether or not
+ The optional l\bl specifies a longer format, including minutes, of
+ the form _\bM_\bMm_\bS_\bS._\bF_\bFs. The value of _\bp determines whether or not
the fraction is included.
- If this variable is not set, b\bba\bas\bsh\bh acts as if it had the value
- $\b$'\b'\\b\n\bnr\bre\bea\bal\bl\\b\t\bt%\b%3\b3l\blR\bR\\b\n\bnu\bus\bse\ber\br\\b\t\bt%\b%3\b3l\blU\bU\\b\n\bns\bsy\bys\bs\\b\t\bt%\b%3\b3l\blS\bS'\b'. If the value is null,
- b\bba\bas\bsh\bh does not display any timing information. A trailing new-
+ If this variable is not set, b\bba\bas\bsh\bh acts as if it had the value
+ $\b$'\b'\\b\n\bnr\bre\bea\bal\bl\\b\t\bt%\b%3\b3l\blR\bR\\b\n\bnu\bus\bse\ber\br\\b\t\bt%\b%3\b3l\blU\bU\\b\n\bns\bsy\bys\bs\\b\t\bt%\b%3\b3l\blS\bS'\b'. If the value is null,
+ b\bba\bas\bsh\bh does not display any timing information. A trailing new-
line is added when the format string is displayed.
- T\bTM\bMO\bOU\bUT\bT If set to a value greater than zero, T\bTM\bMO\bOU\bUT\bT is treated as the de-
- fault timeout for the r\bre\bea\bad\bd builtin. The s\bse\bel\ble\bec\bct\bt command termi-
- nates if input does not arrive after T\bTM\bMO\bOU\bUT\bT 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. B\bBa\bas\bsh\bh terminates after waiting
- for that number of seconds if a complete line of input does not
+ T\bTM\bMO\bOU\bUT\bT If set to a value greater than zero, the r\bre\bea\bad\bd builtin uses the
+ value as its default timeout. The s\bse\bel\ble\bec\bct\bt command terminates if
+ input does not arrive after T\bTM\bMO\bOU\bUT\bT 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. B\bBa\bas\bsh\bh terminates after waiting
+ for that number of seconds if a complete line of input does not
arrive.
- T\bTM\bMP\bPD\bDI\bIR\bR If set, b\bba\bas\bsh\bh uses its value as the name of a directory in which
+ T\bTM\bMP\bPD\bDI\bIR\bR If set, b\bba\bas\bsh\bh uses its value as the name of a directory in which
b\bba\bas\bsh\bh creates temporary files for the shell's use.
a\bau\but\bto\bo_\b_r\bre\bes\bsu\bum\bme\be
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 _\bn_\ba_\bm_\be of a
- stopped job, in this context, is the command line used to start
- it. If set to the value _\be_\bx_\ba_\bc_\bt, the string supplied must match
- the name of a stopped job exactly; if set to _\bs_\bu_\bb_\bs_\bt_\br_\bi_\bn_\bg, the
- string supplied needs to match a substring of the name of a
- stopped job. The _\bs_\bu_\bb_\bs_\bt_\br_\bi_\bn_\bg value provides functionality analo-
- gous to the %\b%?\b? job identifier (see J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL 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 _\bn_\ba_\bm_\be of a
+ stopped job, in this context, is the command line used to start
+ it. If set to the value _\be_\bx_\ba_\bc_\bt, the string supplied must match
+ the name of a stopped job exactly; if set to _\bs_\bu_\bb_\bs_\bt_\br_\bi_\bn_\bg, the
+ string supplied needs to match a substring of the name of a
+ stopped job. The _\bs_\bu_\bb_\bs_\bt_\br_\bi_\bn_\bg value provides functionality analo-
+ gous to the %\b%?\b? job identifier (see J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL 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
%\b%_\bs_\bt_\br_\bi_\bn_\bg job identifier.
h\bhi\bis\bst\btc\bch\bha\bar\brs\bs
- The two or three characters which control history expansion and
+ The two or three characters which control history expansion and
tokenization (see H\bHI\bIS\bST\bTO\bOR\bRY\bY E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN below). The first character
- is the _\bh_\bi_\bs_\bt_\bo_\br_\by _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn character, the character which signals
- the start of a history expansion, normally "!\b!". The second
- character is the _\bq_\bu_\bi_\bc_\bk _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\bt_\bi_\bo_\bn character, which is used as
- shorthand for re-running the previous command entered, substi-
+ is the _\bh_\bi_\bs_\bt_\bo_\br_\by _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn character, the character which signals
+ the start of a history expansion, normally "!\b!". The second
+ character is the _\bq_\bu_\bi_\bc_\bk _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\bt_\bi_\bo_\bn 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 "^\b^". The op-
+ the first character on the line. The default is "^\b^". 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 "#\b#". 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 "#\b#". 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.
A\bAr\brr\bra\bay\bys\bs
- B\bBa\bas\bsh\bh provides one-dimensional indexed and associative array variables.
- Any variable may be used as an indexed array; the d\bde\bec\bcl\bla\bar\bre\be 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
+ B\bBa\bas\bsh\bh provides one-dimensional indexed and associative array variables.
+ Any variable may be used as an indexed array; the d\bde\bec\bcl\bla\bar\bre\be 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 _\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]=_\bv_\ba_\bl_\bu_\be. The _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt is treated as
- an arithmetic expression that must evaluate to a number. To explicitly
- declare an indexed array, use d\bde\bec\bcl\bla\bar\bre\be -\b-a\ba _\bn_\ba_\bm_\be (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bM-\b-
- M\bMA\bAN\bND\bDS\bS below). d\bde\bec\bcl\bla\bar\bre\be -\b-a\ba _\bn_\ba_\bm_\be[\b[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]\b] is also accepted; the _\bs_\bu_\bb_\b-
- _\bs_\bc_\br_\bi_\bp_\bt is ignored.
+ an arithmetic expression that must evaluate to a number greater than or
+ equal to zero. To explicitly declare an indexed array, use d\bde\bec\bcl\bla\bar\bre\be -\b-a\ba
+ _\bn_\ba_\bm_\be (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below). d\bde\bec\bcl\bla\bar\bre\be -\b-a\ba _\bn_\ba_\bm_\be[\b[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]\b] is
+ also accepted; the _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt is ignored.
Associative arrays are created using d\bde\bec\bcl\bla\bar\bre\be -\b-A\bA _\bn_\ba_\bm_\be.
Attributes may be specified for an array variable using the d\bde\bec\bcl\bla\bar\bre\be and
r\bre\bea\bad\bdo\bon\bnl\bly\by builtins. Each attribute applies to all members of an array.
- Arrays are assigned to using compound assignments of the form
- _\bn_\ba_\bm_\be=(\b(value_\b1 ... value_\bn)\b), where each _\bv_\ba_\bl_\bu_\be may be of the form [_\bs_\bu_\bb_\b-
- _\bs_\bc_\br_\bi_\bp_\bt]=_\bs_\bt_\br_\bi_\bn_\bg. Indexed array assignments do not require anything but
- _\bs_\bt_\br_\bi_\bn_\bg. Each _\bv_\ba_\bl_\bu_\be in the list is expanded using the shell expansions
- described below under E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN, but _\bv_\ba_\bl_\bu_\bes 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 _\bn_\ba_\bm_\be=(\b(value_\b1
+ ... value_\bn)\b), where each _\bv_\ba_\bl_\bu_\be may be of the form [_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]=_\bs_\bt_\br_\bi_\bn_\bg.
+ Indexed array assignments do not require anything but _\bs_\bt_\br_\bi_\bn_\bg. Each
+ _\bv_\ba_\bl_\bu_\be in the list is expanded using the shell expansions described be-
+ low under E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN, but _\bv_\ba_\bl_\bu_\bes 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: _\bn_\ba_\bm_\be=(\b( _\bk_\be_\by_\b1 _\bv_\ba_\bl_\bu_\be_\b1 _\bk_\be_\by_\b2 _\bv_\ba_\bl_\bu_\be_\b2 ...)\b). These
- are treated identically to _\bn_\ba_\bm_\be=(\b( [_\bk_\be_\by_\b1]=_\bv_\ba_\bl_\bu_\be_\b1 [_\bk_\be_\by_\b2]=_\bv_\ba_\bl_\bu_\be_\b2 ...)\b).
- 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: _\bn_\ba_\bm_\be=(\b( _\bk_\be_\by_\b1 _\bv_\ba_\bl_\bu_\be_\b1 _\bk_\be_\by_\b2 _\bv_\ba_\bl_\bu_\be_\b2 ...)\b). These
+ are treated identically to _\bn_\ba_\bm_\be=(\b( [_\bk_\be_\by_\b1]=_\bv_\ba_\bl_\bu_\be_\b1 [_\bk_\be_\by_\b2]=_\bv_\ba_\bl_\bu_\be_\b2 ...)\b).
+ 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 d\bde\bec\bcl\bla\bar\bre\be builtin. Individual array
- elements may be assigned to using the _\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]=_\bv_\ba_\bl_\bu_\be syntax in-
- troduced above. When assigning to an indexed array, if _\bn_\ba_\bm_\be is sub-
- scripted by a negative number, that number is interpreted as relative
- to one greater than the maximum index of _\bn_\ba_\bm_\be, 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 d\bde\bec\bcl\bla\bar\bre\be builtin. Individual array
+ elements may be assigned to using the _\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]=_\bv_\ba_\bl_\bu_\be syntax in-
+ troduced above.
+
+ When assigning to an indexed array, if _\bn_\ba_\bm_\be is subscripted by a nega-
+ tive number, that number is interpreted as relative to one greater than
+ the maximum index of _\bn_\ba_\bm_\be, 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 P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS above.
- Any element of an array may be referenced using ${_\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]}.
- The braces are required to avoid conflicts with pathname expansion. If
- _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt is @\b@ or *\b*, the word expands to all members of _\bn_\ba_\bm_\be, 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, ${_\bn_\ba_\bm_\be[*]} expands to a single word with the
- value of each array member separated by the first character of the I\bIF\bFS\bS
- special variable, and ${_\bn_\ba_\bm_\be[@]} expands each element of _\bn_\ba_\bm_\be to a sep-
- arate word. When there are no array members, ${_\bn_\ba_\bm_\be[@]} 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 *\b* and @\b@ (see S\bSp\bpe\bec\bci\bia\bal\bl P\bPa\bar\bra\bam\bme\bet\bte\ber\brs\bs above).
- ${#_\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]} expands to the length of ${_\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]}. If
+ An array element is referenced using ${_\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]}. The braces
+ are required to avoid conflicts with pathname expansion. If _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt
+ is @\b@ or *\b*, the word expands to all members of _\bn_\ba_\bm_\be, 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, ${_\bn_\ba_\bm_\be[*]} expands to a single word with the value of each
+ array member separated by the first character of the I\bIF\bFS\bS special vari-
+ able, and ${_\bn_\ba_\bm_\be[@]} expands each element of _\bn_\ba_\bm_\be to a separate word.
+ When there are no array members, ${_\bn_\ba_\bm_\be[@]} 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 *\b* and @\b@ (see S\bSp\bpe\be-\b-
+ c\bci\bia\bal\bl P\bPa\bar\bra\bam\bme\bet\bte\ber\brs\bs above).
+
+ ${#_\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]} expands to the length of ${_\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]}. If
_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt is *\b* or @\b@, the expansion is the number of elements in the ar-
- ray. If the _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt 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 _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt 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
array variable _\bn_\ba_\bm_\be. The treatment when in double quotes is similar to
the expansion of the special parameters _\b@ and _\b* within double quotes.
- The u\bun\bns\bse\bet\bt builtin is used to destroy arrays. u\bun\bns\bse\bet\bt _\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt] de-
- stroys the array element at index _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt, 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. u\bun\bns\bse\bet\bt _\bn_\ba_\bm_\be, where _\bn_\ba_\bm_\be is an array, re-
- moves the entire array. u\bun\bns\bse\bet\bt _\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt], where _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt is *\b* or
- @\b@, behaves differently depending on whether _\bn_\ba_\bm_\be is an indexed or asso-
- ciative array. If _\bn_\ba_\bm_\be is an associative array, this unsets the ele-
- ment with subscript *\b* or @\b@. If _\bn_\ba_\bm_\be 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 u\bun\bns\bse\bet\bt, 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 d\bde\bec\bcl\bla\bar\bre\be, l\blo\boc\bca\bal\bl, and r\bre\bea\bad\bdo\bon\bnl\bly\by builtins each accept a -\b-a\ba option to
- specify an indexed array and a -\b-A\bA option to specify an associative ar-
- ray. If both options are supplied, -\b-A\bA takes precedence. The r\bre\bea\bad\bd
- builtin accepts a -\b-a\ba option to assign a list of words read from the
+ The u\bun\bns\bse\bet\bt builtin is used to destroy arrays. u\bun\bns\bse\bet\bt _\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt] un-
+ sets the array element at index _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt, 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. u\bun\bns\bse\bet\bt _\bn_\ba_\bm_\be, where _\bn_\ba_\bm_\be is an array, re-
+ moves the entire array. u\bun\bns\bse\bet\bt _\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt] behaves differently de-
+ pending on whether _\bn_\ba_\bm_\be is an indexed or associative array when _\bs_\bu_\bb_\b-
+ _\bs_\bc_\br_\bi_\bp_\bt is *\b* or @\b@. If _\bn_\ba_\bm_\be is an associative array, this unsets the el-
+ ement with subscript *\b* or @\b@. If _\bn_\ba_\bm_\be 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 u\bun\bns\bse\bet\bt, 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 d\bde\bec\bcl\bla\bar\bre\be, l\blo\boc\bca\bal\bl, and r\bre\bea\bad\bdo\bon\bnl\bly\by builtins each accept a -\b-a\ba option to
+ specify an indexed array and a -\b-A\bA option to specify an associative ar-
+ ray. If both options are supplied, -\b-A\bA takes precedence. The r\bre\bea\bad\bd
+ builtin accepts a -\b-a\ba option to assign a list of words read from the
standard input to an array. The s\bse\bet\bt and d\bde\bec\bcl\bla\bar\bre\be 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., m\bma\bap\bpf\bfi\bil\ble\be); see the
+ descriptions of individual builtins below for details. The shell pro-
+ vides a number of builtin array variables.
E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN
Expansion is performed on the command line after it has been split into
$\b${\b{_\bn_\ba_\bm_\be[\b[*\b*]\b]}\b} as explained above (see P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS).
B\bBr\bra\bac\bce\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
- _\bB_\br_\ba_\bc_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn is a mechanism by which arbitrary strings may be gener-
- ated. This mechanism is similar to _\bp_\ba_\bt_\bh_\bn_\ba_\bm_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn, but the file-
- names generated need not exist. Patterns to be brace expanded take the
- form of an optional _\bp_\br_\be_\ba_\bm_\bb_\bl_\be, followed by either a series of comma-sep-
- arated strings or a sequence expression between a pair of braces, fol-
- lowed by an optional _\bp_\bo_\bs_\bt_\bs_\bc_\br_\bi_\bp_\bt. 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.
+ _\bB_\br_\ba_\bc_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn is a mechanism to generate arbitrary strings sharing a
+ common prefix and suffix, either of which can be empty. This mechanism
+ is similar to _\bp_\ba_\bt_\bh_\bn_\ba_\bm_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn, but the filenames generated need not
+ exist. Patterns to be brace expanded are formed from an optional _\bp_\br_\be_\b-
+ _\ba_\bm_\bb_\bl_\be, followed by either a series of comma-separated strings or a se-
+ quence expression between a pair of braces, followed by an optional
+ _\bp_\bo_\bs_\bt_\bs_\bc_\br_\bi_\bp_\bt. 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,
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
- {\b{ or ,\b, 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 {\b{ or ,\b, 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 $\b${\b{ is not considered eligible for brace expansion, and
inhibits brace expansion until the closing }\b}.
or
chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}
- Brace expansion introduces a slight incompatibility with historical
- versions of s\bsh\bh. s\bsh\bh does not treat opening or closing braces specially
- when they appear as part of a word, and preserves them in the output.
- B\bBa\bas\bsh\bh removes braces from words as a consequence of brace expansion.
- For example, a word entered to s\bsh\bh as _\bf_\bi_\bl_\be_\b{_\b1_\b,_\b2_\b} appears identically in
- the output. The same word is output as _\bf_\bi_\bl_\be_\b1 _\bf_\bi_\bl_\be_\b2 after expansion by
- b\bba\bas\bsh\bh. If strict compatibility with s\bsh\bh is desired, start b\bba\bas\bsh\bh with the
- +\b+B\bB option or disable brace expansion with the +\b+B\bB option to the s\bse\bet\bt com-
- mand (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below).
+ Brace expansion introduces a slight incompatibility with historical
+ versions of s\bsh\bh. s\bsh\bh does not treat opening or closing braces specially
+ when they appear as part of a word, and preserves them in the output.
+ B\bBa\bas\bsh\bh removes braces from words as a consequence of brace expansion.
+ For example, a word entered to s\bsh\bh as _\bf_\bi_\bl_\be_\b{_\b1_\b,_\b2_\b} appears identically in
+ the output. B\bBa\bas\bsh\bh outputs that word as _\bf_\bi_\bl_\be_\b1 _\bf_\bi_\bl_\be_\b2 after brace expan-
+ sion. Start b\bba\bas\bsh\bh with the +\b+B\bB option or disable brace expansion with
+ the +\b+B\bB option to the s\bse\bet\bt command (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below) for
+ strict s\bsh\bh compatibility.
T\bTi\bil\bld\bde\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
- If a word begins with an unquoted tilde character ("~\b~"), all of the
- characters preceding the first unquoted slash (or all characters, if
- there is no unquoted slash) are considered a _\bt_\bi_\bl_\bd_\be_\b-_\bp_\br_\be_\bf_\bi_\bx. 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 _\bl_\bo_\bg_\bi_\bn _\bn_\ba_\bm_\be.
- If this login name is the null string, the tilde is replaced with the
- value of the shell parameter H\bHO\bOM\bME\bE. If H\bHO\bOM\bME\bE 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 ("~\b~"), all of the
+ characters preceding the first unquoted slash (or all characters, if
+ there is no unquoted slash) are considered a _\bt_\bi_\bl_\bd_\be_\b-_\bp_\br_\be_\bf_\bi_\bx. 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 _\bl_\bo_\bg_\bi_\bn _\bn_\ba_\bm_\be.
+ If this login name is the null string, the tilde is replaced with the
+ value of the shell parameter H\bHO\bOM\bME\bE. If H\bHO\bOM\bME\bE 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 P\bPW\bWD\bD re-
- places the tilde-prefix. If the tilde-prefix is a "~-", the value of
- the shell variable O\bOL\bLD\bDP\bPW\bWD\bD, if it is set, is substituted. If the char-
- acters following the tilde in the tilde-prefix consist of a number _\bN,
- 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 O\bOL\bLD\bDP\bPW\bWD\bD, if it is set. If the
+ characters following the tilde in the tilde-prefix consist of a number
+ _\bN, 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 d\bdi\bir\brs\bs 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 d\bdi\bir\brs\bs 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 :\b: or the first =\b=. In these cases, tilde expansion is
- also performed. Consequently, one may use filenames with tildes in as-
- signments to P\bPA\bAT\bTH\bH, M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH, and C\bCD\bDP\bPA\bAT\bTH\bH, and the shell assigns the ex-
+ B\bBa\bas\bsh\bh checks each variable assignment for unquoted tilde-prefixes imme-
+ diately following a :\b: or the first =\b=, and performs tilde expansion in
+ these cases. Consequently, one may use filenames with tildes in as-
+ signments to P\bPA\bAT\bTH\bH, M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH, and C\bCD\bDP\bPA\bAT\bTH\bH, and the shell assigns the ex-
panded value.
- B\bBa\bas\bsh\bh also performs tilde expansion on words satisfying the conditions
+ B\bBa\bas\bsh\bh also performs tilde expansion on words satisfying the conditions
of variable assignments (as described above under P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS) when they
- appear as arguments to simple commands. B\bBa\bas\bsh\bh does not do this, except
+ appear as arguments to simple commands. B\bBa\bas\bsh\bh does not do this, except
for the _\bd_\be_\bc_\bl_\ba_\br_\ba_\bt_\bi_\bo_\bn commands listed above, when in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be.
P\bPa\bar\bra\bam\bme\bet\bte\ber\br E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
The "$\b$" 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 "}\b}" not
+ When braces are used, the matching ending brace is the first "}\b}" 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
+
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br}
- The value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is substituted. The braces are required
- when _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is a positional parameter with more than one
- digit, or when _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is followed by a character which is not
- to be interpreted as part of its name. The _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is a shell
- parameter as described above P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS) or an array reference
- (A\bAr\brr\bra\bay\bys\bs).
-
- If the first character of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an exclamation point (!\b!), and
+
+ which substitutes the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. The braces are required when
+ _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is a positional parameter with more than one digit, or when
+ _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is followed by a character which is not to be interpreted as
+ part of its name. The _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is a shell parameter as described
+ above P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS) or an array reference (A\bAr\brr\bra\bay\bys\bs).
+
+ If the first character of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an exclamation point (!\b!), and
_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is not a _\bn_\ba_\bm_\be_\br_\be_\bf, it introduces a level of indirection. B\bBa\bas\bsh\bh
uses the value formed by expanding the rest of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br as the new _\bp_\ba_\b-
- _\br_\ba_\bm_\be_\bt_\be_\br; this is then expanded and that value is used in the rest of
- the expansion, rather than the expansion of the original _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br.
- This is known as _\bi_\bn_\bd_\bi_\br_\be_\bc_\bt _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn. The value is subject to tilde ex-
- pansion, parameter expansion, command substitution, and arithmetic ex-
- pansion. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is a nameref, this expands to the name of the
- parameter referenced by _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br instead of performing the complete
- indirect expansion. The exceptions to this are the expansions of
- ${!\b!_\bp_\br_\be_\bf_\bi_\bx*\b*} and ${!\b!_\bn_\ba_\bm_\be[_\b@]} described below. The exclamation point
- must immediately follow the left brace in order to introduce indirec-
- tion.
+ _\br_\ba_\bm_\be_\bt_\be_\br; this new parameter is then expanded and that value is used in
+ the rest of the expansion, rather than the expansion of the original
+ _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. This is known as _\bi_\bn_\bd_\bi_\br_\be_\bc_\bt _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn. The value is subject
+ to tilde expansion, parameter expansion, command substitution, and
+ arithmetic expansion. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is a nameref, this expands to the
+ name of the parameter referenced by _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br instead of performing the
+ complete indirect expansion, for compatibility. The exceptions to this
+ are the expansions of ${!\b!_\bp_\br_\be_\bf_\bi_\bx*\b*} and ${!\b!_\bn_\ba_\bm_\be[_\b@]} described below. The
+ exclamation point must immediately follow the left brace in order to
+ introduce indirection.
In each of the cases below, _\bw_\bo_\br_\bd 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., :\b:-\b-), b\bba\bas\bsh\bh 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., :\b:-\b-), b\bba\bas\bsh\bh tests for a parameter that is unset or null.
+ Omitting the colon tests only for a parameter that is unset.
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:-\b-_\bw_\bo_\br_\bd}
U\bUs\bse\be D\bDe\bef\bfa\bau\bul\blt\bt V\bVa\bal\blu\bue\bes\bs. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is unset or null, the expan-
is substituted.
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:=\b=_\bw_\bo_\br_\bd}
A\bAs\bss\bsi\big\bgn\bn D\bDe\bef\bfa\bau\bul\blt\bt V\bVa\bal\blu\bue\bes\bs. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is unset or null, the ex-
- pansion of _\bw_\bo_\br_\bd is assigned to _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. The value of _\bp_\ba_\br_\ba_\bm_\be_\b-
- _\bt_\be_\br is then substituted. Positional parameters and special pa-
- rameters may not be assigned to in this way.
+ pansion of _\bw_\bo_\br_\bd is assigned to _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br, and the expansion is
+ the final value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. Positional parameters and special
+ parameters may not be assigned in this way.
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:?\b?_\bw_\bo_\br_\bd}
- D\bDi\bis\bsp\bpl\bla\bay\by E\bEr\brr\bro\bor\br i\bif\bf N\bNu\bul\bll\bl o\bor\br U\bUn\bns\bse\bet\bt. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is null or unset,
- the expansion of _\bw_\bo_\br_\bd (or a message to that effect if _\bw_\bo_\br_\bd is
- not present) is written to the standard error and the shell, if
- it is not interactive, exits. Otherwise, the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
+ D\bDi\bis\bsp\bpl\bla\bay\by E\bEr\brr\bro\bor\br i\bif\bf N\bNu\bul\bll\bl o\bor\br U\bUn\bns\bse\bet\bt. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is null or unset,
+ the expansion of _\bw_\bo_\br_\bd (or a message to that effect if _\bw_\bo_\br_\bd 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 _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
is substituted.
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:+\b+_\bw_\bo_\br_\bd}
- U\bUs\bse\be A\bAl\blt\bte\ber\brn\bna\bat\bte\be V\bVa\bal\blu\bue\be. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is null or unset, nothing is
- substituted, otherwise the expansion of _\bw_\bo_\br_\bd is substituted.
+ U\bUs\bse\be A\bAl\blt\bte\ber\brn\bna\bat\bte\be V\bVa\bal\blu\bue\be. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is null or unset, nothing is
+ substituted, otherwise the expansion of _\bw_\bo_\br_\bd is substituted.
+ The value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is not used.
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:_\bo_\bf_\bf_\bs_\be_\bt}
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:_\bo_\bf_\bf_\bs_\be_\bt:\b:_\bl_\be_\bn_\bg_\bt_\bh}
S\bSu\bub\bbs\bst\btr\bri\bin\bng\bg E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn. Expands to up to _\bl_\be_\bn_\bg_\bt_\bh characters of the
each key expands to a separate word.
${#\b#_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br}
- P\bPa\bar\bra\bam\bme\bet\bte\ber\br l\ble\ben\bng\bgt\bth\bh. The length in characters of the value of _\bp_\ba_\b-
- _\br_\ba_\bm_\be_\bt_\be_\br is substituted. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is *\b* or @\b@, the value sub-
- stituted is the number of positional parameters. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
- is an array name subscripted by *\b* or @\b@, the value substituted is
- the number of elements in the array. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br 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
- _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br, so negative indices count back from the end of the
- array, and an index of -1 references the last element.
+ P\bPa\bar\bra\bam\bme\bet\bte\ber\br l\ble\ben\bng\bgt\bth\bh. Substitutes the length in characters of the
+ expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is *\b* or @\b@, the value
+ substituted is the number of positional parameters. If _\bp_\ba_\br_\ba_\bm_\be_\b-
+ _\bt_\be_\br is an array name subscripted by *\b* or @\b@, the value substi-
+ tuted is the number of elements in the array. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br 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 _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br, so negative indices count back from the
+ end of the array, and an index of -1 references the last ele-
+ ment.
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br#\b#_\bw_\bo_\br_\bd}
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br#\b##\b#_\bw_\bo_\br_\bd}
R\bRe\bem\bmo\bov\bve\be m\bma\bat\btc\bch\bhi\bin\bng\bg p\bpr\bre\bef\bfi\bix\bx p\bpa\bat\btt\bte\ber\brn\bn. The _\bw_\bo_\br_\bd is expanded to produce
a pattern just as in pathname expansion, and matched against the
expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br using the rules described under P\bPa\bat\bt-\b-
- t\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg below. If the pattern matches the beginning of
- the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br, then the result of the expansion is the
- expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br with the shortest matching pattern
- (the "#" case) or the longest matching pattern (the "##" case)
- deleted. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@ or *\b*, the pattern removal operation
- is applied to each positional parameter in turn, and the expan-
- sion is the resultant list. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an array variable
- subscripted with @\b@ or *\b*, the pattern removal operation is ap-
- plied to each member of the array in turn, and the expansion is
+ t\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg below. If the pattern matches the beginning of
+ the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br, then the result of the expansion is the
+ expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br with the shortest matching pattern
+ (the "#" case) or the longest matching pattern (the "##" case)
+ deleted. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@ or *\b*, the pattern removal operation
+ is applied to each positional parameter in turn, and the expan-
+ sion is the resultant list. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an array variable
+ subscripted with @\b@ or *\b*, the pattern removal operation is ap-
+ plied to each member of the array in turn, and the expansion is
the resultant list.
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br%\b%_\bw_\bo_\br_\bd}
R\bRe\bem\bmo\bov\bve\be m\bma\bat\btc\bch\bhi\bin\bng\bg s\bsu\buf\bff\bfi\bix\bx p\bpa\bat\btt\bte\ber\brn\bn. The _\bw_\bo_\br_\bd is expanded to produce
a pattern just as in pathname expansion, and matched against the
expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br using the rules described under P\bPa\bat\bt-\b-
- t\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg below. If the pattern matches a trailing portion
- of the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br, then the result of the ex-
- pansion is the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br with the shortest
- matching pattern (the "%" case) or the longest matching pattern
- (the "%%" case) deleted. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@ or *\b*, the pattern
- removal operation is applied to each positional parameter in
- turn, and the expansion is the resultant list. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is
- an array variable subscripted with @\b@ or *\b*, the pattern removal
- operation is applied to each member of the array in turn, and
+ t\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg below. If the pattern matches a trailing portion
+ of the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br, then the result of the ex-
+ pansion is the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br with the shortest
+ matching pattern (the "%" case) or the longest matching pattern
+ (the "%%" case) deleted. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@ or *\b*, the pattern
+ removal operation is applied to each positional parameter in
+ turn, and the expansion is the resultant list. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is
+ an array variable subscripted with @\b@ or *\b*, the pattern removal
+ operation is applied to each member of the array in turn, and
the expansion is the resultant list.
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br/\b/_\bp_\ba_\bt_\bt_\be_\br_\bn/\b/_\bs_\bt_\br_\bi_\bn_\bg}
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br/\b/#\b#_\bp_\ba_\bt_\bt_\be_\br_\bn/\b/_\bs_\bt_\br_\bi_\bn_\bg}
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br/\b/%\b%_\bp_\ba_\bt_\bt_\be_\br_\bn/\b/_\bs_\bt_\br_\bi_\bn_\bg}
P\bPa\bat\btt\bte\ber\brn\bn s\bsu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bn. The _\bp_\ba_\bt_\bt_\be_\br_\bn is expanded to produce a pat-
- tern just as in pathname expansion. _\bP_\ba_\br_\ba_\bm_\be_\bt_\be_\br is expanded and
- the longest match of _\bp_\ba_\bt_\bt_\be_\br_\bn against its value is replaced with
- _\bs_\bt_\br_\bi_\bn_\bg. _\bs_\bt_\br_\bi_\bn_\bg 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 P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg below. In the first form
- above, only the first match is replaced. If there are two
- slashes separating _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br and _\bp_\ba_\bt_\bt_\be_\br_\bn (the second form
- above), all matches of _\bp_\ba_\bt_\bt_\be_\br_\bn are replaced with _\bs_\bt_\br_\bi_\bn_\bg. If
- _\bp_\ba_\bt_\bt_\be_\br_\bn is preceded by #\b# (the third form above), it must match
- at the beginning of the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. If _\bp_\ba_\bt_\bt_\be_\br_\bn
- is preceded by %\b% (the fourth form above), it must match at the
- end of the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. If the expansion of
- _\bs_\bt_\br_\bi_\bn_\bg is null, matches of _\bp_\ba_\bt_\bt_\be_\br_\bn are deleted. If _\bs_\bt_\br_\bi_\bn_\bg is
- null, matches of _\bp_\ba_\bt_\bt_\be_\br_\bn are deleted and the /\b/ following _\bp_\ba_\bt_\bt_\be_\br_\bn
- may be omitted.
+ tern just as in pathname expansion and matched against the ex-
+ panded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br using the rules described under P\bPa\bat\bt-\b-
+ t\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg below. The longest match of _\bp_\ba_\bt_\bt_\be_\br_\bn in the ex-
+ panded value is replaced with _\bs_\bt_\br_\bi_\bn_\bg. _\bs_\bt_\br_\bi_\bn_\bg 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 _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br and _\bp_\ba_\bt_\bt_\be_\br_\bn (the sec-
+ ond form above), all matches of _\bp_\ba_\bt_\bt_\be_\br_\bn are replaced with
+ _\bs_\bt_\br_\bi_\bn_\bg. If _\bp_\ba_\bt_\bt_\be_\br_\bn is preceded by #\b# (the third form above), it
+ must match at the beginning of the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br.
+ If _\bp_\ba_\bt_\bt_\be_\br_\bn is preceded by %\b% (the fourth form above), it must
+ match at the end of the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br.
+
+ If the expansion of _\bs_\bt_\br_\bi_\bn_\bg is null, matches of _\bp_\ba_\bt_\bt_\be_\br_\bn are
+ deleted and the /\b/ following _\bp_\ba_\bt_\bt_\be_\br_\bn may be omitted.
If the p\bpa\bat\bts\bsu\bub\bb_\b_r\bre\bep\bpl\bla\bac\bce\bem\bme\ben\bnt\bt shell option is enabled using s\bsh\bho\bop\bpt\bt,
any unquoted instances of &\b& in _\bs_\bt_\br_\bi_\bn_\bg are replaced with the
want to be taken literally in the replacement and ensure any in-
stances of &\b& they want to be replaced are unquoted.
- If the n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh shell option is enabled, the match is per-
- formed without regard to the case of alphabetic characters. If
- _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@ or *\b*, the substitution operation is applied to
- each positional parameter in turn, and the expansion is the re-
- sultant list. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an array variable subscripted
- with @\b@ or *\b*, 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 n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh shell option is enabled, the match is per-
+ formed without regard to the case of alphabetic characters.
+
+ If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@ or *\b*, the substitution operation is applied to
+ each positional parameter in turn, and the expansion is the re-
+ sultant list. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an array variable subscripted
+ with @\b@ or *\b*, the substitution operation is applied to each mem-
+ ber of the array in turn, and the expansion is the resultant
list.
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br^\b^_\bp_\ba_\bt_\bt_\be_\br_\bn}
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br^\b^^\b^_\bp_\ba_\bt_\bt_\be_\br_\bn}
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br,\b,_\bp_\ba_\bt_\bt_\be_\br_\bn}
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br,\b,,\b,_\bp_\ba_\bt_\bt_\be_\br_\bn}
- C\bCa\bas\bse\be m\bmo\bod\bdi\bif\bfi\bic\bca\bat\bti\bio\bon\bn. This expansion modifies the case of alpha-
- betic characters in _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. The _\bp_\ba_\bt_\bt_\be_\br_\bn is expanded to pro-
+ C\bCa\bas\bse\be m\bmo\bod\bdi\bif\bfi\bic\bca\bat\bti\bio\bon\bn. This expansion modifies the case of alpha-
+ betic characters in _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. The _\bp_\ba_\bt_\bt_\be_\br_\bn is expanded to pro-
duce a pattern just as in pathname expansion. Each character in
- the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is tested against _\bp_\ba_\bt_\bt_\be_\br_\bn, and,
- if it matches the pattern, its case is converted. The pattern
- should not attempt to match more than one character. The ^\b^ op-
- erator converts lowercase letters matching _\bp_\ba_\bt_\bt_\be_\br_\bn to uppercase;
- the ,\b, operator converts matching uppercase letters to lowercase.
- The ^\b^^\b^ and ,\b,,\b, expansions convert each matched character in the
- expanded value; the ^\b^ and ,\b, expansions match and convert only
- the first character in the expanded value. If _\bp_\ba_\bt_\bt_\be_\br_\bn is omit-
- ted, it is treated like a ?\b?, which matches every character. If
- _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@ or *\b*, the case modification operation is applied
- to each positional parameter in turn, and the expansion is the
- resultant list. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an array variable subscripted
- with @\b@ or *\b*, 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 _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is tested against _\bp_\ba_\bt_\bt_\be_\br_\bn, and,
+ if it matches the pattern, its case is converted. The pattern
+ should not attempt to match more than one character.
+
+ The ^\b^ operator converts lowercase letters matching _\bp_\ba_\bt_\bt_\be_\br_\bn to
+ uppercase; the ,\b, operator converts matching uppercase letters to
+ lowercase. The ^\b^^\b^ and ,\b,,\b, expansions convert each matched char-
+ acter in the expanded value; the ^\b^ and ,\b, expansions match and
+ convert only the first character in the expanded value. If _\bp_\ba_\bt_\b-
+ _\bt_\be_\br_\bn is omitted, it is treated like a ?\b?, which matches every
+ character.
+
+ If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@ or *\b*, the case modification operation is ap-
+ plied to each positional parameter in turn, and the expansion is
+ the resultant list. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an array variable sub-
+ scripted with @\b@ or *\b*, the case modification operation is applied
+ to each member of the array in turn, and the expansion is the
+ resultant list.
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br@\b@_\bo_\bp_\be_\br_\ba_\bt_\bo_\br}
P\bPa\bar\bra\bam\bme\bet\bte\ber\br t\btr\bra\ban\bns\bsf\bfo\bor\brm\bma\bat\bti\bio\bon\bn. The expansion is either a transforma-
word splitting and pathname expansion on the results.
A\bAr\bri\bit\bth\bhm\bme\bet\bti\bic\bc E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
- 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:
$\b$(\b((\b(_\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn)\b))\b)
The evaluation is performed according to the rules listed below under
A\bAR\bRI\bIT\bTH\bHM\bME\bET\bTI\bIC\bC E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN. If _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn is invalid, b\bba\bas\bsh\bh 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.
P\bPr\bro\boc\bce\bes\bss\bs S\bSu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bn
- _\bP_\br_\bo_\bc_\be_\bs_\bs _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\bt_\bi_\bo_\bn allows a process's input or output to be referred
- to using a filename. It takes the form of <\b<(\b(_\bl_\bi_\bs_\bt)\b) or >\b>(\b(_\bl_\bi_\bs_\bt)\b). The
- process _\bl_\bi_\bs_\bt is run asynchronously, and its input or output appears as
+ _\bP_\br_\bo_\bc_\be_\bs_\bs _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\bt_\bi_\bo_\bn allows a process's input or output to be referred
+ to using a filename. It takes the form of <\b<(\b(_\bl_\bi_\bs_\bt)\b) or >\b>(\b(_\bl_\bi_\bs_\bt)\b). The
+ process _\bl_\bi_\bs_\bt 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 >\b>(\b(_\bl_\bi_\bs_\bt)\b) form is used,
- writing to the file will provide input for _\bl_\bi_\bs_\bt. If the <\b<(\b(_\bl_\bi_\bs_\bt)\b) form
- is used, the file passed as an argument should be read to obtain the
- output of _\bl_\bi_\bs_\bt. Process substitution is supported on systems that sup-
- port named pipes (_\bF_\bI_\bF_\bO_\bs) or the /\b/d\bde\bev\bv/\b/f\bfd\bd 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 >\b>(\b(_\bl_\bi_\bs_\bt)\b) form is used, writing to the file will provide input for
+ _\bl_\bi_\bs_\bt. If the <\b<(\b(_\bl_\bi_\bs_\bt)\b) form is used, reading the file will obtain the
+ output of _\bl_\bi_\bs_\bt. No space may appear between the <\b< or >\b> and the left
+ parenthesis, otherwise the construct would be interpreted as a redirec-
+ tion.
+
+ Process substitution is supported on systems that support named pipes
+ (_\bF_\bI_\bF_\bO_\bs) or the /\b/d\bde\bev\bv/\b/f\bfd\bd method of naming open files.
+
+ When available, process substitution is performed simultaneously with
+ parameter and variable expansion, command substitution, and arithmetic
expansion.
W\bWo\bor\brd\bd S\bSp\bpl\bli\bit\btt\bti\bin\bng\bg
- 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 _\bw_\bo_\br_\bd _\bs_\bp_\bl_\bi_\bt_\bt_\bi_\bn_\bg.
- The shell treats each character of I\bIF\bFS\bS as a delimiter, and splits the
- results of the other expansions into words using these characters as
+ The shell treats each character of I\bIF\bFS\bS as a delimiter, and splits the
+ results of the other expansions into words using these characters as
field terminators.
If I\bIF\bFS\bS is unset, or its value is exactly <\b<s\bsp\bpa\bac\bce\be>\b><\b<t\bta\bab\bb>\b><\b<n\bne\bew\bwl\bli\bin\bne\be>\b>, the de-
- fault, then sequences of s\bsp\bpa\bac\bce\be, t\bta\bab\bb, and n\bne\bew\bwl\bli\bin\bne\be at the beginning and
- end of the results of the previous expansions are ignored, and any se-
- quence of I\bIF\bFS\bS characters not at the beginning or end serves to delimit
- words. If I\bIF\bFS\bS has a value other than the default, then sequences of
- the whitespace characters s\bsp\bpa\bac\bce\be, t\bta\bab\bb, and n\bne\bew\bwl\bli\bin\bne\be are ignored at the
- beginning and end of the word, as long as the whitespace character is
- in the value of I\bIF\bFS\bS (an I\bIF\bFS\bS whitespace character). Any character in
- I\bIF\bFS\bS that is not I\bIF\bFS\bS whitespace, along with any adjacent I\bIF\bFS\bS whitespace
- characters, delimits a field. A sequence of I\bIF\bFS\bS whitespace characters
- is also treated as a delimiter.
-
- If the value of I\bIF\bFS\bS is null, no word splitting occurs. If I\bIF\bFS\bS is un-
- set, word splitting behaves as if it contained the default value of
+ fault, then sequences of s\bsp\bpa\bac\bce\be, t\bta\bab\bb, and n\bne\bew\bwl\bli\bin\bne\be at the beginning and
+ end of the results of the previous expansions are ignored, and any se-
+ quence of I\bIF\bFS\bS characters not at the beginning or end delimits words.
+ If I\bIF\bFS\bS has a value other than the default, then sequences of the white-
+ space characters s\bsp\bpa\bac\bce\be, t\bta\bab\bb, and n\bne\bew\bwl\bli\bin\bne\be present in the value of I\bIF\bFS\bS
+ (an I\bIF\bFS\bS whitespace character) are ignored at the beginning and end of
+ the word. Any character in I\bIF\bFS\bS that is not I\bIF\bFS\bS whitespace, along with
+ any adjacent I\bIF\bFS\bS whitespace characters, delimits a field. A sequence
+ of I\bIF\bFS\bS whitespace characters is also treated as a delimiter.
+
+ If the value of I\bIF\bFS\bS is null, no word splitting occurs. If I\bIF\bFS\bS is un-
+ set, word splitting behaves as if it contained the default value of
<\b<s\bsp\bpa\bac\bce\be>\b><\b<t\bta\bab\bb>\b><\b<n\bne\bew\bwl\bli\bin\bne\be>\b>.
- Explicit null arguments ("\b""\b" or '\b''\b') are retained and passed to commands
+ Explicit null arguments ("\b""\b" or '\b''\b') 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.
P\bPa\bat\bth\bhn\bna\bam\bme\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
- After word splitting, unless the -\b-f\bf option has been set, b\bba\bas\bsh\bh scans
- each word for the characters *\b*, ?\b?, and [\b[. If one of these characters
+ After word splitting, unless the -\b-f\bf option has been set, b\bba\bas\bsh\bh scans
+ each word for the characters *\b*, ?\b?, and [\b[. If one of these characters
appears, and is not quoted, then the word is regarded as a _\bp_\ba_\bt_\bt_\be_\br_\bn, and
- replaced with an alphabetically sorted list of filenames matching the
- pattern (see P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg below). If no matching filenames are
- found, and the shell option n\bnu\bul\bll\blg\bgl\blo\bob\bb is not enabled, the word is left
- unchanged. If the n\bnu\bul\bll\blg\bgl\blo\bob\bb option is set, and no matches are found,
- the word is removed. If the f\bfa\bai\bil\blg\bgl\blo\bob\bb shell option is set, and no
- matches are found, an error message is printed and the command is not
- executed. If the shell option n\bno\boc\bca\bas\bse\beg\bgl\blo\bob\bb 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 d\bdo\bot\btg\bgl\blo\bob\bb is set. In order to match the file-
- names "." and "..", the pattern must begin with "." (for example,
- ".?"), even if d\bdo\bot\btg\bgl\blo\bob\bb is set. If the g\bgl\blo\bob\bbs\bsk\bki\bip\bpd\bdo\bot\bts\bs 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 P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg. See the description of s\bsh\bho\bop\bpt\bt
- below under S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS for a description of the n\bno\boc\bca\bas\bse\beg\bgl\blo\bob\bb,
- n\bnu\bul\bll\blg\bgl\blo\bob\bb, g\bgl\blo\bob\bbs\bsk\bki\bip\bpd\bdo\bot\bts\bs, f\bfa\bai\bil\blg\bgl\blo\bob\bb, and d\bdo\bot\btg\bgl\blo\bob\bb shell options.
+ replaced with a sorted list of filenames matching the pattern (see P\bPa\bat\bt-\b-
+ t\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg below) subject to the value of the G\bGL\bLO\bOB\bBS\bSO\bOR\bRT\bT shell vari-
+ able.
+
+ If no matching filenames are found, and the shell option n\bnu\bul\bll\blg\bgl\blo\bob\bb is
+ not enabled, the word is left unchanged. If the n\bnu\bul\bll\blg\bgl\blo\bob\bb option is
+ set, and no matches are found, the word is removed. If the f\bfa\bai\bil\blg\bgl\blo\bob\bb
+ shell option is set, and no matches are found, b\bba\bas\bsh\bh prints an error
+ message and does not execute the command. If the shell option n\bno\boc\bca\bas\bse\be-\b-
+ g\bgl\blo\bob\bb 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 d\bdo\bot\btg\bgl\blo\bob\bb is set. In order to match
+ the filenames "." and "..", the pattern must begin with "." (for exam-
+ ple, ".?"), even if d\bdo\bot\btg\bgl\blo\bob\bb is set. If the g\bgl\blo\bob\bbs\bsk\bki\bip\bpd\bdo\bot\bts\bs 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
+ P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg.
+
+ See the description of s\bsh\bho\bop\bpt\bt below under S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS for a
+ description of the n\bno\boc\bca\bas\bse\beg\bgl\blo\bob\bb, n\bnu\bul\bll\blg\bgl\blo\bob\bb, g\bgl\blo\bob\bbs\bsk\bki\bip\bpd\bdo\bot\bts\bs, f\bfa\bai\bil\blg\bgl\blo\bob\bb, and
+ d\bdo\bot\btg\bgl\blo\bob\bb shell options.
The G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE shell variable may be used to restrict the set of file
names matching a _\bp_\ba_\bt_\bt_\be_\br_\bn. If G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE is set, each matching file
case. The filenames "." and ".." are always ignored when G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE is
set and not null. However, setting G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE to a non-null value has
the effect of enabling the d\bdo\bot\btg\bgl\blo\bob\bb 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 G\bGL\bLO\bO-\b-
B\bBI\bIG\bGN\bNO\bOR\bRE\bE. The d\bdo\bot\btg\bgl\blo\bob\bb option is disabled when G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE is unset. The
- pattern matching honors the setting of the e\bex\bxt\btg\bgl\blo\bob\bb shell option.
+ G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE pattern matching honors the setting of the e\bex\bxt\btg\bgl\blo\bob\bb shell op-
+ tion.
- The G\bGL\bLO\bOB\bBS\bSO\bOR\bRT\bT variable controls how the results of pathname expansion
- are sorted, as described above.
+ The G\bGL\bLO\bOB\bBS\bSO\bOR\bRT\bT shell variable controls how the results of pathname expan-
+ sion are sorted, as described above.
P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg
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:
- *\b* Matches any string, including the null string. When the
- g\bgl\blo\bob\bbs\bst\bta\bar\br shell option is enabled, and *\b* is used in a
- pathname expansion context, two adjacent *\b*s used as a
- single pattern will match all files and zero or more di-
- rectories and subdirectories. If followed by a /\b/, two
- adjacent *\b*s will match only directories and subdirecto-
+ *\b* Matches any string, including the null string. When the
+ g\bgl\blo\bob\bbs\bst\bta\bar\br shell option is enabled, and *\b* is used in a
+ pathname expansion context, two adjacent *\b*s used as a
+ single pattern will match all files and zero or more di-
+ rectories and subdirectories. If followed by a /\b/, two
+ adjacent *\b*s will match only directories and subdirecto-
ries.
?\b? Matches any single character.
- [\b[...]\b] Matches any one of the enclosed characters. A pair of
- characters separated by a hyphen denotes a _\br_\ba_\bn_\bg_\be _\be_\bx_\bp_\br_\be_\bs_\b-
- _\bs_\bi_\bo_\bn; any character that falls between those two charac-
+ [\b[...]\b] Matches any one of the enclosed characters. A pair of
+ characters separated by a hyphen denotes a _\br_\ba_\bn_\bg_\be _\be_\bx_\bp_\br_\be_\bs_\b-
+ _\bs_\bi_\bo_\bn; 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 [\b[ is a !\b! or a ^\b^ 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 L\bLC\bC_\b_C\bCO\bOL\bLL\bLA\bAT\bTE\bE or L\bLC\bC_\b_A\bAL\bLL\bL shell variables, if set.
- To obtain the traditional interpretation of range expres-
- sions, where [\b[a\ba-\b-d\bd]\b] is equivalent to [\b[a\bab\bbc\bcd\bd]\b], set value of
- the L\bLC\bC_\b_A\bAL\bLL\bL shell variable to C\bC, or enable the g\bgl\blo\bob\bba\bas\bsc\bci\bi-\b-
- i\bir\bra\ban\bng\bge\bes\bs 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.
-
- Within [\b[ and ]\b], _\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br _\bc_\bl_\ba_\bs_\bs_\be_\bs can be specified using
+ quence and character set, matches. If the first charac-
+ ter following the [\b[ is a !\b! or a ^\b^ then any character not
+ within the range matches. A -\b- may be matched by includ-
+ ing 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.
+
+ 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 L\bLC\bC_\b_C\bCO\bOL\bLL\bLA\bAT\bTE\bE or
+ L\bLC\bC_\b_A\bAL\bLL\bL shell variables, if set. To obtain the tradi-
+ tional interpretation of range expressions, where [\b[a\ba-\b-d\bd]\b]
+ is equivalent to [\b[a\bab\bbc\bcd\bd]\b], set the value of the L\bLC\bC_\b_C\bCO\bOL\bLL\bLA\bAT\bTE\bE
+ or L\bLC\bC_\b_A\bAL\bLL\bL shell variables to C\bC, or enable the g\bgl\blo\bob\bba\bas\bsc\bci\bi-\b-
+ i\bir\bra\ban\bng\bge\bes\bs shell option.
+
+ Within [\b[ and ]\b], _\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br _\bc_\bl_\ba_\bs_\bs_\be_\bs can be specified using
the syntax [\b[:\b:_\bc_\bl_\ba_\bs_\bs:\b:]\b], where _\bc_\bl_\ba_\bs_\bs is one of the following
classes defined in the POSIX standard:
- a\bal\bln\bnu\bum\bm a\bal\blp\bph\bha\ba a\bas\bsc\bci\bii\bi b\bbl\bla\ban\bnk\bk c\bcn\bnt\btr\brl\bl d\bdi\big\bgi\bit\bt g\bgr\bra\bap\bph\bh l\blo\bow\bwe\ber\br p\bpr\bri\bin\bnt\bt
+ a\bal\bln\bnu\bum\bm a\bal\blp\bph\bha\ba a\bas\bsc\bci\bii\bi b\bbl\bla\ban\bnk\bk c\bcn\bnt\btr\brl\bl d\bdi\big\bgi\bit\bt g\bgr\bra\bap\bph\bh l\blo\bow\bwe\ber\br p\bpr\bri\bin\bnt\bt
p\bpu\bun\bnc\bct\bt s\bsp\bpa\bac\bce\be u\bup\bpp\bpe\ber\br w\bwo\bor\brd\bd x\bxd\bdi\big\bgi\bit\bt
A character class matches any character belonging to that
and the character _.
Within [\b[ and ]\b], an _\be_\bq_\bu_\bi_\bv_\ba_\bl_\be_\bn_\bc_\be _\bc_\bl_\ba_\bs_\bs can be specified us-
- ing the syntax [\b[=\b=_\bc=\b=]\b], which matches all characters with
- the same collation weight (as defined by the current lo-
+ ing the syntax [\b[=\b=_\bc=\b=]\b], which matches all characters with
+ the same collation weight (as defined by the current lo-
cale) as the character _\bc.
Within [\b[ and ]\b], the syntax [\b[.\b._\bs_\by_\bm_\bb_\bo_\bl.\b.]\b] matches the collat-
ing symbol _\bs_\by_\bm_\bb_\bo_\bl.
- If the e\bex\bxt\btg\bgl\blo\bob\bb shell option is enabled using the s\bsh\bho\bop\bpt\bt builtin, the
- shell recognizes several extended pattern matching operators. In the
+ If the e\bex\bxt\btg\bgl\blo\bob\bb shell option is enabled using the s\bsh\bho\bop\bpt\bt builtin, the
+ shell recognizes several extended pattern matching operators. In the
following description, a _\bp_\ba_\bt_\bt_\be_\br_\bn_\b-_\bl_\bi_\bs_\bt is a list of one or more patterns
- separated by a |\b|. Composite patterns may be formed using one or more
+ separated by a |\b|. Composite patterns may be formed using one or more
of the following sub-patterns:
?\b?(\b(_\bp_\ba_\bt_\bt_\be_\br_\bn_\b-_\bl_\bi_\bs_\bt)\b)
- Matches zero or one occurrence of the given patterns
+ Matches zero or one occurrence of the given patterns.
*\b*(\b(_\bp_\ba_\bt_\bt_\be_\br_\bn_\b-_\bl_\bi_\bs_\bt)\b)
- Matches zero or more occurrences of the given patterns
+ Matches zero or more occurrences of the given patterns.
+\b+(\b(_\bp_\ba_\bt_\bt_\be_\br_\bn_\b-_\bl_\bi_\bs_\bt)\b)
- Matches one or more occurrences of the given patterns
+ Matches one or more occurrences of the given patterns.
@\b@(\b(_\bp_\ba_\bt_\bt_\be_\br_\bn_\b-_\bl_\bi_\bs_\bt)\b)
- Matches one of the given patterns
+ Matches one of the given patterns.
!\b!(\b(_\bp_\ba_\bt_\bt_\be_\br_\bn_\b-_\bl_\bi_\bs_\bt)\b)
- Matches anything except one of the given patterns
+ Matches anything except one of the given patterns.
The e\bex\bxt\btg\bgl\blo\bob\bb 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 e\bex\bxt\btg\bgl\blo\bob\bb 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 e\bex\bxt\btg\bgl\blo\bob\bb is enabled before parsing constructs containing the pat-
terns, including shell functions and command substitutions.
When matching filenames, the d\bdo\bot\btg\bgl\blo\bob\bb shell option determines the set of
- filenames that are tested: when d\bdo\bot\btg\bgl\blo\bob\bb 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 d\bdo\bot\btg\bgl\blo\bob\bb 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 g\bgl\blo\bob\bbs\bsk\bki\bip\bpd\bdo\bot\bts\bs
+ 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
using a special notation interpreted by the shell. _\bR_\be_\bd_\bi_\br_\be_\bc_\bt_\bi_\bo_\bn 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 _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd or may fol-
- low a _\bc_\bo_\bm_\bm_\ba_\bn_\bd. Redirections are processed in the order they appear,
- from left to right.
+ writes to. When used with the e\bex\bxe\bec\bc builtin, redirections modify file
+ handles in the current shell execution environment. The following
+ redirection operators may precede or appear anywhere within a _\bs_\bi_\bm_\bp_\bl_\be
+ _\bc_\bo_\bm_\bm_\ba_\bn_\bd or may follow a _\bc_\bo_\bm_\bm_\ba_\bn_\bd. 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 {_\bv_\ba_\br_\bn_\ba_\bm_\be}. 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 _\bv_\ba_\br_\bn_\ba_\bm_\be.
- If >&- or <&- is preceded by {_\bv_\ba_\br_\bn_\ba_\bm_\be}, the value of _\bv_\ba_\br_\bn_\ba_\bm_\be defines
- the file descriptor to close. If {_\bv_\ba_\br_\bn_\ba_\bm_\be} 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
- v\bva\bar\brr\bre\bed\bdi\bir\br_\b_c\bcl\blo\bos\bse\be shell option manages this behavior.
+ If {_\bv_\ba_\br_\bn_\ba_\bm_\be} precedes >&- or <&-, the value of _\bv_\ba_\br_\bn_\ba_\bm_\be defines the file
+ descriptor to close. If {_\bv_\ba_\br_\bn_\ba_\bm_\be} 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
+ e\bex\bxe\bec\bc builtin. The v\bva\bar\brr\bre\bed\bdi\bir\br_\b_c\bcl\blo\bos\bse\be 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 <\b<, the
first character of the redirection operator is >\b>, the redirection
refers to the standard output (file descriptor 1).
- The word following the redirection operator in the following descrip-
+ The _\bw_\bo_\br_\bd 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, b\bba\bas\bsh\bh 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 >\b> dirlist 2>\b>&\b&1
- directs both standard output and standard error to the file _\bd_\bi_\br_\bl_\bi_\bs_\bt,
+ directs both standard output and standard error to the file _\bd_\bi_\br_\bl_\bi_\bs_\bt,
while the command
ls 2>\b>&\b&1 >\b> dirlist
- directs only the standard output to file _\bd_\bi_\br_\bl_\bi_\bs_\bt, because the standard
- error was duplicated from the standard output before the standard out-
- put was redirected to _\bd_\bi_\br_\bl_\bi_\bs_\bt.
+ directs only the standard output to file _\bd_\bi_\br_\bl_\bi_\bs_\bt, because the standard
+ error was directed to the standard output before the standard output
+ was redirected to _\bd_\bi_\br_\bl_\bi_\bs_\bt.
B\bBa\bas\bsh\bh handles several filenames specially when they are used in redirec-
tions, as described in the following table. If the operating system on
- which b\bba\bas\bsh\bh is running provides these special files, bash will use them;
- otherwise it will emulate them internally with the behavior described
+ which b\bba\bas\bsh\bh is running provides these special files, b\bba\bas\bsh\bh will use them;
+ otherwise it will emulate them internally with the behavior described
below.
/\b/d\bde\bev\bv/\b/f\bfd\bd/\b/_\bf_\bd
- If _\bf_\bd is a valid integer, file descriptor _\bf_\bd is dupli-
- cated.
+ If _\bf_\bd is a valid integer, duplicate file descriptor _\bf_\bd.
/\b/d\bde\bev\bv/\b/s\bst\btd\bdi\bin\bn
File descriptor 0 is duplicated.
/\b/d\bde\bev\bv/\b/s\bst\btd\bdo\bou\but\bt
nally.
R\bRe\bed\bdi\bir\bre\bec\bct\bti\bin\bng\bg I\bIn\bnp\bpu\but\bt
- Redirection of input causes the file whose name results from the expan-
- sion of _\bw_\bo_\br_\bd to be opened for reading on file descriptor _\bn, or the
- standard input (file descriptor 0) if _\bn is not specified.
+ Redirecting input opens the file whose name results from the expansion
+ of _\bw_\bo_\br_\bd for reading on file descriptor _\bn, or the standard input (file
+ descriptor 0) if _\bn is not specified.
The general format for redirecting input is:
[_\bn]<\b<_\bw_\bo_\br_\bd
R\bRe\bed\bdi\bir\bre\bec\bct\bti\bin\bng\bg O\bOu\but\btp\bpu\but\bt
- Redirection of output causes the file whose name results from the ex-
- pansion of _\bw_\bo_\br_\bd to be opened for writing on file descriptor _\bn, or the
- standard output (file descriptor 1) if _\bn 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 _\bw_\bo_\br_\bd for writing on file descriptor _\bn, or the standard output (file
+ descriptor 1) if _\bn 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:
builtin has been enabled, the redirection will fail if the file whose
name results from the expansion of _\bw_\bo_\br_\bd exists and is a regular file.
If the redirection operator is >\b>|\b|, or the redirection operator is >\b> and
- the n\bno\boc\bcl\blo\bob\bbb\bbe\ber\br option to the s\bse\bet\bt builtin command is not enabled, the
- redirection is attempted even if the file named by _\bw_\bo_\br_\bd exists.
+ the n\bno\boc\bcl\blo\bob\bbb\bbe\ber\br option to the s\bse\bet\bt builtin command is not enabled, b\bba\bas\bsh\bh
+ attempts the redirection even if the file named by _\bw_\bo_\br_\bd exists.
A\bAp\bpp\bpe\ben\bnd\bdi\bin\bng\bg R\bRe\bed\bdi\bir\bre\bec\bct\bte\bed\bd O\bOu\but\btp\bpu\but\bt
- Redirection of output in this fashion causes the file whose name re-
- sults from the expansion of _\bw_\bo_\br_\bd to be opened for appending on file de-
- scriptor _\bn, or the standard output (file descriptor 1) if _\bn 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 _\bw_\bo_\br_\bd for appending on file descriptor _\bn, or the
+ standard output (file descriptor 1) if _\bn is not specified. If the file
+ does not exist it is created.
The general format for appending output is:
[_\bn]>\b>>\b>_\bw_\bo_\br_\bd
R\bRe\bed\bdi\bir\bre\bec\bct\bti\bin\bng\bg S\bSt\bta\ban\bnd\bda\bar\brd\bd O\bOu\but\btp\bpu\but\bt a\ban\bnd\bd S\bSt\bta\ban\bnd\bda\bar\brd\bd E\bEr\brr\bro\bor\br
- 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 _\bw_\bo_\br_\bd.
+ 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 _\bw_\bo_\br_\bd.
There are two formats for redirecting standard output and standard er-
ror:
s\bsc\bcr\bri\bip\bpt\bto\bor\brs\bs below) for compatibility reasons.
A\bAp\bpp\bpe\ben\bnd\bdi\bin\bng\bg S\bSt\bta\ban\bnd\bda\bar\brd\bd O\bOu\but\btp\bpu\but\bt a\ban\bnd\bd S\bSt\bta\ban\bnd\bda\bar\brd\bd E\bEr\brr\bro\bor\br
- 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 _\bw_\bo_\br_\bd.
+ 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 _\bw_\bo_\br_\bd.
The format for appending standard output and standard error is:
H\bHe\ber\bre\be D\bDo\boc\bcu\bum\bme\ben\bnt\bts\bs
This type of redirection instructs the shell to read input from the
current source until it reads a line containing only _\bd_\be_\bl_\bi_\bm_\bi_\bt_\be_\br (with no
- trailing blanks). All of the lines read up to that point are then used
- as the standard input (or file descriptor _\bn if _\bn is specified) for a
- command.
+ trailing blanks). All of the lines read up to that point then become
+ the standard input (or file descriptor _\bn if _\bn is specified) for a com-
+ mand.
The format of here-documents is:
_\bh_\be_\br_\be_\b-_\bd_\bo_\bc_\bu_\bm_\be_\bn_\bt
_\bd_\be_\bl_\bi_\bm_\bi_\bt_\be_\br
- No parameter and variable expansion, command substitution, arithmetic
- expansion, or pathname expansion is performed on _\bw_\bo_\br_\bd.
+ The shell does not perform parameter and variable expansion, command
+ substitution, arithmetic expansion, or pathname expansion is performed
+ on _\bw_\bo_\br_\bd.
If any part of _\bw_\bo_\br_\bd is quoted, the _\bd_\be_\bl_\bi_\bm_\bi_\bt_\be_\br is the result of quote re-
moval on _\bw_\bo_\br_\bd, and the lines in the here-document are not expanded. If
- _\bw_\bo_\br_\bd is unquoted, the _\bd_\be_\bl_\bi_\bm_\bi_\bt_\be_\br is _\bw_\bo_\br_\bd itself, all lines of the here-
- document are subjected to parameter expansion, command substitution,
- and arithmetic expansion, the character sequence \\b\<\b<n\bne\bew\bwl\bli\bin\bne\be>\b> is ignored,
- and \\b\ must be used to quote the characters \\b\, $\b$, and `\b`.
-
- If the redirection operator is <\b<<\b<-\b-, then all leading tab characters are
- stripped from input lines and the line containing _\bd_\be_\bl_\bi_\bm_\bi_\bt_\be_\br. This al-
- lows here-documents within shell scripts to be indented in a natural
- fashion.
+ _\bw_\bo_\br_\bd is unquoted, the _\bd_\be_\bl_\bi_\bm_\bi_\bt_\be_\br is _\bw_\bo_\br_\bd 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 \\b\<\b<n\bne\bew\bwl\bli\bin\bne\be>\b> is
+ treated literally, and \\b\ must be used to quote the characters \\b\, $\b$, and
+ `\b`; however, double quote characters have no special meaning.
+
+ If the redirection operator is <\b<<\b<-\b-, then the shell strips all leading
+ tab characters from input lines and the line containing _\bd_\be_\bl_\bi_\bm_\bi_\bt_\be_\br.
+ This allows here-documents within shell scripts to be indented in a
+ natural fashion.
+
+ If the delimiter is not quoted, the \\b\<\b<n\bne\bew\bwl\bli\bin\bne\be>\b> 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.
H\bHe\ber\bre\be S\bSt\btr\bri\bin\bng\bgs\bs
A variant of here documents, the format is:
[_\bn]<\b<<\b<<\b<_\bw_\bo_\br_\bd
- The _\bw_\bo_\br_\bd 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 _\bw_\bo_\br_\bd 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 _\bn if _\bn is specified).
[_\bn]<\b<&\b&_\bw_\bo_\br_\bd
is used to duplicate input file descriptors. If _\bw_\bo_\br_\bd expands to one or
- more digits, the file descriptor denoted by _\bn is made to be a copy of
- that file descriptor. If the digits in _\bw_\bo_\br_\bd do not specify a file de-
- scriptor open for input, a redirection error occurs. If _\bw_\bo_\br_\bd evaluates
- to -\b-, file descriptor _\bn is closed. If _\bn is not specified, the standard
- input (file descriptor 0) is used.
+ more digits, file descriptor _\bn is made to be a copy of that file de-
+ scriptor. It is a redirection error if the digits in _\bw_\bo_\br_\bd do not spec-
+ ify a file descriptor open for input. If _\bw_\bo_\br_\bd evaluates to -\b-, file de-
+ scriptor _\bn is closed. If _\bn is not specified, this uses the standard
+ input (file descriptor 0).
The operator
[_\bn]>\b>&\b&_\bw_\bo_\br_\bd
- is used similarly to duplicate output file descriptors. If _\bn is not
- specified, the standard output (file descriptor 1) is used. If the
- digits in _\bw_\bo_\br_\bd do not specify a file descriptor open for output, a
- redirection error occurs. If _\bw_\bo_\br_\bd evaluates to -\b-, file descriptor _\bn is
+ is used similarly to duplicate output file descriptors. If _\bn is not
+ specified, this uses the standard output (file descriptor 1). It is a
+ redirection error if the digits in _\bw_\bo_\br_\bd do not specify a file descrip-
+ tor open for output. If _\bw_\bo_\br_\bd evaluates to -\b-, file descriptor _\bn is
closed. As a special case, if _\bn is omitted, and _\bw_\bo_\br_\bd does not expand
- to one or more digits or -\b-, the standard output and standard error are
- redirected as described previously.
+ to one or more digits or -\b-, this redirects the standard output and
+ standard error as described previously.
M\bMo\bov\bvi\bin\bng\bg F\bFi\bil\ble\be D\bDe\bes\bsc\bcr\bri\bip\bpt\bto\bor\brs\bs
The redirection operator
[_\bn]<\b<>\b>_\bw_\bo_\br_\bd
- causes the file whose name is the expansion of _\bw_\bo_\br_\bd to be opened for
- both reading and writing on file descriptor _\bn, or on file descriptor 0
- if _\bn is not specified. If the file does not exist, it is created.
+ opens the file whose name is the expansion of _\bw_\bo_\br_\bd for both reading and
+ writing on file descriptor _\bn, or on file descriptor 0 if _\bn is not spec-
+ ified. If the file does not exist, it is created.
A\bAL\bLI\bIA\bAS\bSE\bES\bS
_\bA_\bl_\bi_\ba_\bs_\be_\bs allow a string to be substituted for a word that is in a posi-
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.
instance, and b\bba\bas\bsh\bh does not try to recursively expand the replacement
text.
- If the last character of the alias value is a _\bb_\bl_\ba_\bn_\bk, 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 _\bb_\bl_\ba_\bn_\bk, the shell checks
+ the next command word following the alias for alias expansion.
Aliases are created and listed with the a\bal\bli\bia\bas\bs command, and removed with
the u\bun\bna\bal\bli\bia\bas\bs command.
- There is no mechanism for using arguments in the replacement text. If
- arguments are needed, use a shell function (see F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS below).
+ There is no mechanism for using arguments in the replacement text. If
+ arguments are needed, use a shell function (see F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS below) in-
+ stead.
Aliases are not expanded when the shell is not interactive, unless the
e\bex\bxp\bpa\ban\bnd\bd_\b_a\bal\bli\bia\bas\bse\bes\bs shell option is set using s\bsh\bho\bop\bpt\bt (see the description of
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 a\bal\bli\bia\bas\bs 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 a\bal\bli\bia\bas\bs in compound
+ commands.
+
+ For almost every purpose, shell functions are preferable to aliases.
F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS
A shell function, defined as described above under S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR,
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 #\b# is
- updated to reflect the change. Special parameter 0\b0 is unchanged. The
- first element of the F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE variable is set to the name of the func-
- tion while the function is executing.
+ updated to reflect the new positional parameters. Special parameter 0\b0
+ is unchanged. The first element of the F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE 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 D\bDE\bEB\bBU\bUG\bG and
traps), and the E\bER\bRR\bR trap is not inherited unless the -\b-o\bo e\ber\brr\brt\btr\bra\bac\bce\be shell
option has been enabled.
- Variables local to the function may be declared with the l\blo\boc\bca\bal\bl builtin
+ Variables local to the function are declared with the l\blo\boc\bca\bal\bl builtin
command (_\bl_\bo_\bc_\ba_\bl _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be_\bs). Ordinarily, variables and their values are
shared between the function and its caller. If a variable is declared
l\blo\boc\bca\bal\bl, the variable's visible scope is restricted to that function and
In the following description, the _\bc_\bu_\br_\br_\be_\bn_\bt _\bs_\bc_\bo_\bp_\be 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 l\blo\boc\bca\bal\bl or d\bde\bec\bcl\bla\bar\bre\be builtins in the function
- that is currently executing.
+ shell function. A local variable at the current scope is a variable
+ declared using the l\blo\boc\bca\bal\bl or d\bde\bec\bcl\bla\bar\bre\be 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 _\bd_\by_\bn_\ba_\bm_\bi_\bc _\bs_\bc_\bo_\bp_\bi_\bn_\bg to control a variable's visibility
within functions. With dynamic scoping, visible variables and their
If the builtin command r\bre\bet\btu\bur\brn\bn 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 R\bRE\bET\bTU\bUR\bRN\bN trap is executed be-
- fore execution resumes. When a function completes, the values of the
- positional parameters and the special parameter #\b# are restored to the
- values they had prior to the function's execution.
-
- Function names and definitions may be listed with the -\b-f\bf option to the
- d\bde\bec\bcl\bla\bar\bre\be or t\bty\byp\bpe\bes\bse\bet\bt builtin commands. The -\b-F\bF option to d\bde\bec\bcl\bla\bar\bre\be or t\bty\byp\bpe\be-\b-
- s\bse\bet\bt will list the function names only (and optionally the source file
- and line number, if the e\bex\bxt\btd\bde\beb\bbu\bug\bg 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 -\b-f\bf option to the e\bex\bxp\bpo\bor\brt\bt builtin. A function definition may be
- deleted using the -\b-f\bf option to the u\bun\bns\bse\bet\bt builtin.
+ tion call. If r\bre\bet\btu\bur\brn\bn 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 r\bre\bet\btu\bur\brn\bn. Any com-
+ mand associated with the R\bRE\bET\bTU\bUR\bRN\bN trap is executed before execution re-
+ sumes. When a function completes, the values of the positional parame-
+ ters and the special parameter #\b# are restored to the values they had
+ prior to the function's execution.
+
+ The -\b-f\bf option to the d\bde\bec\bcl\bla\bar\bre\be or t\bty\byp\bpe\bes\bse\bet\bt builtin commands will list
+ function names and definitions. The -\b-F\bF option to d\bde\bec\bcl\bla\bar\bre\be or t\bty\byp\bpe\bes\bse\bet\bt
+ will list the function names only (and optionally the source file and
+ line number, if the e\bex\bxt\btd\bde\beb\bbu\bug\bg 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
+ -\b-f\bf option to the e\bex\bxp\bpo\bor\brt\bt builtin. The -\b-f\bf option to the u\bun\bns\bse\bet\bt builtin
+ will delete a function definition.
Functions may be recursive. The F\bFU\bUN\bNC\bCN\bNE\bES\bST\bT 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, b\bba\bas\bsh\bh imposes no limit on the number of
+ recursive calls.
A\bAR\bRI\bIT\bTH\bHM\bME\bET\bTI\bIC\bC E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN
The shell allows arithmetic expressions to be evaluated, under certain
circumstances (see the l\ble\bet\bt and d\bde\bec\bcl\bla\bar\bre\be builtin commands, the (\b((\b( com-
- pound command, and A\bAr\bri\bit\bth\bhm\bme\bet\bti\bic\bc E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn). 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 f\bfo\bor\br command, the [\b[[\b[ conditional command,
+ and A\bAr\bri\bit\bth\bhm\bme\bet\bti\bic\bc E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn).
+
+ 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.
_\bi_\bd+\b++\b+ _\bi_\bd-\b--\b-
variable post-increment and post-decrement
- -\b- +\b+ unary minus and plus
+\b++\b+_\bi_\bd -\b--\b-_\bi_\bd
variable pre-increment and pre-decrement
+ -\b- +\b+ unary minus and plus
!\b! ~\b~ logical and bitwise negation
*\b**\b* exponentiation
*\b* /\b/ %\b% multiplication, division, remainder
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 _\bx 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 _\bi_\bn_\bt_\be_\bg_\be_\br
attribute using d\bde\bec\bcl\bla\bar\bre\be -\b-i\bi is assigned a value. A null value evaluates
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.
C\bCO\bON\bND\bDI\bIT\bTI\bIO\bON\bNA\bAL\bL E\bEX\bXP\bPR\bRE\bES\bSS\bSI\bIO\bON\bNS\bS
Conditional expressions are used by the [\b[[\b[ compound command and the
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.
- B\bBa\bas\bsh\bh 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.
+
+ B\bBa\bas\bsh\bh handles several filenames specially when they are used in expres-
sions. If the operating system on which b\bba\bas\bsh\bh is running provides these
- special files, bash will use them; otherwise it will emulate them in-
- ternally with this behavior: If any _\bf_\bi_\bl_\be argument to one of the pri-
+ special files, bash will use them; otherwise it will emulate them in-
+ ternally with this behavior: If any _\bf_\bi_\bl_\be argument to one of the pri-
maries is of the form _\b/_\bd_\be_\bv_\b/_\bf_\bd_\b/_\bn, then file descriptor _\bn is checked. If
- the _\bf_\bi_\bl_\be argument to one of the primaries is one of _\b/_\bd_\be_\bv_\b/_\bs_\bt_\bd_\bi_\bn,
- _\b/_\bd_\be_\bv_\b/_\bs_\bt_\bd_\bo_\bu_\bt, or _\b/_\bd_\be_\bv_\b/_\bs_\bt_\bd_\be_\br_\br, file descriptor 0, 1, or 2, respectively,
+ the _\bf_\bi_\bl_\be argument to one of the primaries is one of _\b/_\bd_\be_\bv_\b/_\bs_\bt_\bd_\bi_\bn,
+ _\b/_\bd_\be_\bv_\b/_\bs_\bt_\bd_\bo_\bu_\bt, or _\b/_\bd_\be_\bv_\b/_\bs_\bt_\bd_\be_\br_\br, 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 [\b[[\b[, or when the shell is in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, the <\b< and >\b> op-
- erators sort lexicographically using the current locale. When the
- shell is not in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, the t\bte\bes\bst\bt command sorts using ASCII order-
+ When used with [\b[[\b[, or when the shell is in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, the <\b< and >\b> op-
+ erators sort lexicographically using the current locale. When the
+ shell is not in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, the t\bte\bes\bst\bt command sorts using ASCII order-
ing.
-\b-a\ba _\bf_\bi_\bl_\be
-\b-L\bL _\bf_\bi_\bl_\be
True if _\bf_\bi_\bl_\be exists and is a symbolic link.
-\b-N\bN _\bf_\bi_\bl_\be
- True if _\bf_\bi_\bl_\be exists and has been modified since it was last
- read.
+ True if _\bf_\bi_\bl_\be exists and has been modified since it was last ac-
+ cessed.
-\b-O\bO _\bf_\bi_\bl_\be
True if _\bf_\bi_\bl_\be exists and is owned by the effective user id.
-\b-S\bS _\bf_\bi_\bl_\be
True if _\bf_\bi_\bl_\be exists and is a socket.
- _\bf_\bi_\bl_\be_\b1 -\b-e\bef\bf _\bf_\bi_\bl_\be_\b2
- True if _\bf_\bi_\bl_\be_\b1 and _\bf_\bi_\bl_\be_\b2 refer to the same device and inode num-
- bers.
- _\bf_\bi_\bl_\be_\b1 -n\bnt\bt _\bf_\bi_\bl_\be_\b2
- True if _\bf_\bi_\bl_\be_\b1 is newer (according to modification date) than
- _\bf_\bi_\bl_\be_\b2, or if _\bf_\bi_\bl_\be_\b1 exists and _\bf_\bi_\bl_\be_\b2 does not.
- _\bf_\bi_\bl_\be_\b1 -o\bot\bt _\bf_\bi_\bl_\be_\b2
- True if _\bf_\bi_\bl_\be_\b1 is older than _\bf_\bi_\bl_\be_\b2, or if _\bf_\bi_\bl_\be_\b2 exists and _\bf_\bi_\bl_\be_\b1
- does not.
-\b-o\bo _\bo_\bp_\bt_\bn_\ba_\bm_\be
True if the shell option _\bo_\bp_\bt_\bn_\ba_\bm_\be is enabled. See the list of
options under the description of the -\b-o\bo option to the s\bse\bet\bt
command for POSIX conformance. When used with the [\b[[\b[ command,
this performs pattern matching as described above (C\bCo\bom\bmp\bpo\bou\bun\bnd\bd C\bCo\bom\bm-\b-
m\bma\ban\bnd\bds\bs).
-
_\bs_\bt_\br_\bi_\bn_\bg_\b1 !\b!=\b= _\bs_\bt_\br_\bi_\bn_\bg_\b2
True if the strings are not equal.
-
_\bs_\bt_\br_\bi_\bn_\bg_\b1 <\b< _\bs_\bt_\br_\bi_\bn_\bg_\b2
True if _\bs_\bt_\br_\bi_\bn_\bg_\b1 sorts before _\bs_\bt_\br_\bi_\bn_\bg_\b2 lexicographically.
-
_\bs_\bt_\br_\bi_\bn_\bg_\b1 >\b> _\bs_\bt_\br_\bi_\bn_\bg_\b2
True if _\bs_\bt_\br_\bi_\bn_\bg_\b1 sorts after _\bs_\bt_\br_\bi_\bn_\bg_\b2 lexicographically.
+ _\bf_\bi_\bl_\be_\b1 -\b-e\bef\bf _\bf_\bi_\bl_\be_\b2
+ True if _\bf_\bi_\bl_\be_\b1 and _\bf_\bi_\bl_\be_\b2 refer to the same device and inode num-
+ bers.
+ _\bf_\bi_\bl_\be_\b1 -n\bnt\bt _\bf_\bi_\bl_\be_\b2
+ True if _\bf_\bi_\bl_\be_\b1 is newer (according to modification date) than
+ _\bf_\bi_\bl_\be_\b2, or if _\bf_\bi_\bl_\be_\b1 exists and _\bf_\bi_\bl_\be_\b2 does not.
+ _\bf_\bi_\bl_\be_\b1 -o\bot\bt _\bf_\bi_\bl_\be_\b2
+ True if _\bf_\bi_\bl_\be_\b1 is older than _\bf_\bi_\bl_\be_\b2, or if _\bf_\bi_\bl_\be_\b2 exists and _\bf_\bi_\bl_\be_\b1
+ does not.
+
_\ba_\br_\bg_\b1 O\bOP\bP _\ba_\br_\bg_\b2
- O\bOP\bP is one of -\b-e\beq\bq, -\b-n\bne\be, -\b-l\blt\bt, -\b-l\ble\be, -\b-g\bgt\bt, or -\b-g\bge\be. These arithmetic
- binary operators return true if _\ba_\br_\bg_\b1 is equal to, not equal to,
- less than, less than or equal to, greater than, or greater than
- or equal to _\ba_\br_\bg_\b2, respectively. _\bA_\br_\bg_\b1 and _\ba_\br_\bg_\b2 may be positive
- or negative integers. When used with the [\b[[\b[ command, _\bA_\br_\bg_\b1 and
- _\bA_\br_\bg_\b2 are evaluated as arithmetic expressions (see A\bAR\bRI\bIT\bTH\bHM\bME\bET\bTI\bIC\bC
+ O\bOP\bP is one of -\b-e\beq\bq, -\b-n\bne\be, -\b-l\blt\bt, -\b-l\ble\be, -\b-g\bgt\bt, or -\b-g\bge\be. These arithmetic
+ binary operators return true if _\ba_\br_\bg_\b1 is equal to, not equal to,
+ less than, less than or equal to, greater than, or greater than
+ or equal to _\ba_\br_\bg_\b2, respectively. _\ba_\br_\bg_\b1 and _\ba_\br_\bg_\b2 may be positive
+ or negative integers. When used with the [\b[[\b[ command, _\ba_\br_\bg_\b1 and
+ _\ba_\br_\bg_\b2 are evaluated as arithmetic expressions (see A\bAR\bRI\bIT\bTH\bHM\bME\bET\bTI\bIC\bC
E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN above).
S\bSI\bIM\bMP\bPL\bLE\bE C\bCO\bOM\bMM\bMA\bAN\bND\bD E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN
- 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 R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN.
4. The text after the =\b= 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.
C\bCO\bOM\bMM\bMA\bAN\bND\bD E\bEX\bXE\bEC\bCU\bUT\bTI\bIO\bON\bN
- 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 F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS. 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 F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS. 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, b\bba\bas\bsh\bh searches each element of the P\bPA\bAT\bTH\bH for a directory con-
+ If the name is neither a shell function nor a builtin, and contains no
+ slashes, b\bba\bas\bsh\bh searches each element of the P\bPA\bAT\bTH\bH for a directory con-
taining an executable file by that name. B\bBa\bas\bsh\bh uses a hash table to re-
- member the full pathnames of executable files (see h\bha\bas\bsh\bh under S\bSH\bHE\bEL\bLL\bL
- B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below). A full search of the directories in P\bPA\bAT\bTH\bH 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 c\bco\bom\bmm\bma\ban\bnd\bd_\b_n\bno\bot\bt_\b_f\bfo\bou\bun\bnd\bd_\b_h\bha\ban\bnd\bdl\ble\be. 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 h\bha\bas\bsh\bh under S\bSH\bHE\bEL\bLL\bL
+ B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below). Bash performs a full search of the directo-
+ ries in P\bPA\bAT\bTH\bH 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 c\bco\bom\bmm\bma\ban\bnd\bd_\b_n\bno\bot\bt_\b_f\bfo\bou\bun\bnd\bd_\b_h\bha\ban\bnd\bdl\ble\be. 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 _\bs_\bh_\be_\bl_\bl _\bs_\bc_\br_\bi_\bp_\bt, 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 _\bs_\bh_\be_\bl_\bl _\bs_\bc_\br_\bi_\bp_\bt, 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 h\bha\bas\bsh\bh below under S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS) 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 h\bha\bas\bsh\bh
+ below under S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS are retained by the child.
If the program is a file beginning with #\b#!\b!, the remainder of the first
line specifies an interpreter for the program. The shell executes the
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 l\bla\bas\bst\btp\bpi\bip\bpe\be
+ 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 _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, subshells spawned to execute command
substitutions inherit the value of the -\b-e\be option from their parent
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 _\be_\bx_\bp_\bo_\br_\bt to child
- processes. Executed commands inherit the environment. The e\bex\bxp\bpo\bor\brt\bt and
- d\bde\bec\bcl\bla\bar\bre\be -\b-x\bx 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 u\bun\bns\bse\bet\bt command, plus
- any additions via the e\bex\bxp\bpo\bor\brt\bt and d\bde\bec\bcl\bla\bar\bre\be -\b-x\bx commands.
-
- The environment for any _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd or function may be augmented
- temporarily by prefixing it with parameter assignments, as described
- above in P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS. These assignment statements affect only the envi-
- ronment seen by that command.
-
- If the -\b-k\bk option is set (see the s\bse\bet\bt builtin command below), then _\ba_\bl_\bl
- parameter assignments are placed in the environment for a command, not
+ processes. Executed commands inherit the environment. The e\bex\bxp\bpo\bor\brt\bt, d\bde\be-\b-
+ c\bcl\bla\bar\bre\be -\b-x\bx, and u\bun\bns\bse\bet\bt 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 u\bun\bn-\b-
+ s\bse\bet\bt or e\bex\bxp\bpo\bor\brt\bt -\b-n\bn commands, plus any additions via the e\bex\bxp\bpo\bor\brt\bt and d\bde\be-\b-
+ c\bcl\bla\bar\bre\be -\b-x\bx commands.
+
+ If any parameter assignments, as described above in P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS, appear
+ before a _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd, 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 -\b-k\bk option is set (see the s\bse\bet\bt builtin command below), then _\ba_\bl_\bl
+ parameter assignments are placed in the environment for a command, not
just those that precede the command name.
- When b\bba\bas\bsh\bh invokes an external command, the variable _\b_ is set to the
- full filename of the command and passed to that command in its environ-
+ When b\bba\bas\bsh\bh invokes an external command, the variable _\b_ is set to the
+ full pathname of the command and passed to that command in its environ-
ment.
E\bEX\bXI\bIT\bT S\bST\bTA\bAT\bTU\bUS\bS
- 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
_\bw_\ba_\bi_\bt_\bp_\bi_\bd 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 _\bN, b\bba\bas\bsh\bh uses the value of 128+_\bN 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 _\bN, b\bba\bas\bsh\bh uses the value of
+ 128+_\bN 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 (_\bt_\br_\bu_\be) if successful, and
- non-zero (_\bf_\ba_\bl_\bs_\be) 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 (_\bt_\br_\bu_\be) if successful, and
+ non-zero (_\bf_\ba_\bl_\bs_\be) 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 $?.
- B\bBa\bas\bsh\bh 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
+ B\bBa\bas\bsh\bh 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 e\bex\bxi\bit\bt builtin command below.
S\bSI\bIG\bGN\bNA\bAL\bLS\bS
- When b\bba\bas\bsh\bh is interactive, in the absence of any traps, it ignores
- S\bSI\bIG\bGT\bTE\bER\bRM\bM (so that k\bki\bil\bll\bl 0\b0 does not kill an interactive shell), and S\bSI\bIG\bGI\bIN\bNT\bT
- is caught and handled (so that the w\bwa\bai\bit\bt builtin is interruptible). In
+ When b\bba\bas\bsh\bh is interactive, in the absence of any traps, it ignores
+ S\bSI\bIG\bGT\bTE\bER\bRM\bM (so that k\bki\bil\bll\bl 0\b0 does not kill an interactive shell), and
+ catches and handles S\bSI\bIG\bGI\bIN\bNT\bT (so that the w\bwa\bai\bit\bt builtin is interruptible).
+ When b\bba\bas\bsh\bh receives S\bSI\bIG\bGI\bIN\bNT\bT, it breaks out of any executing loops. In
all cases, b\bba\bas\bsh\bh ignores S\bSI\bIG\bGQ\bQU\bUI\bIT\bT. If job control is in effect, b\bba\bas\bsh\bh ig-
nores S\bSI\bIG\bGT\bTT\bTI\bIN\bN, S\bSI\bIG\bGT\bTT\bTO\bOU\bU, and S\bSI\bIG\bGT\bTS\bST\bTP\bP.
- Non-builtin commands run by b\bba\bas\bsh\bh 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 S\bSI\bIG\bGI\bIN\bNT\bT and S\bSI\bIG\bGQ\bQU\bUI\bIT\bT in addition to
- these inherited handlers. Commands run as a result of command substi-
- tution ignore the keyboard-generated job control signals S\bSI\bIG\bGT\bTT\bTI\bIN\bN, S\bSI\bIG\bGT\bT-\b-
- T\bTO\bOU\bU, and S\bSI\bIG\bGT\bTS\bST\bTP\bP.
-
- The shell exits by default upon receipt of a S\bSI\bIG\bGH\bHU\bUP\bP. Before exiting,
- an interactive shell resends the S\bSI\bIG\bGH\bHU\bUP\bP to all jobs, running or
- stopped. Stopped jobs are sent S\bSI\bIG\bGC\bCO\bON\bNT\bT to ensure that they receive the
- S\bSI\bIG\bGH\bHU\bUP\bP. To prevent the shell from sending the signal to a particular
- job, it should be removed from the jobs table with the d\bdi\bis\bso\bow\bwn\bn builtin
- (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below) or marked to not receive S\bSI\bIG\bGH\bHU\bUP\bP us-
- ing d\bdi\bis\bso\bow\bwn\bn -\b-h\bh.
-
- If the h\bhu\bup\bpo\bon\bne\bex\bxi\bit\bt shell option has been set with s\bsh\bho\bop\bpt\bt, b\bba\bas\bsh\bh sends a
+ The t\btr\bra\bap\bp builtin modifies the shell's signal handling, as described be-
+ low.
+
+ Non-builtin commands b\bba\bas\bsh\bh executes have signal handlers set to the val-
+ ues inherited by the shell from its parent, unless t\btr\bra\bap\bp 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 S\bSI\bIG\bGI\bIN\bNT\bT
+ and S\bSI\bIG\bGQ\bQU\bUI\bIT\bT in addition to these inherited handlers. Commands run as a
+ result of command substitution ignore the keyboard-generated job con-
+ trol signals S\bSI\bIG\bGT\bTT\bTI\bIN\bN, S\bSI\bIG\bGT\bTT\bTO\bOU\bU, and S\bSI\bIG\bGT\bTS\bST\bTP\bP.
+
+ The shell exits by default upon receipt of a S\bSI\bIG\bGH\bHU\bUP\bP. Before exiting,
+ an interactive shell resends the S\bSI\bIG\bGH\bHU\bUP\bP to all jobs, running or
+ stopped. The shell sends S\bSI\bIG\bGC\bCO\bON\bNT\bT to stopped jobs to ensure that they
+ receive the S\bSI\bIG\bGH\bHU\bUP\bP (see J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL 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 d\bdi\bis\bso\bow\bwn\bn
+ builtin (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below) or mark it not to receive
+ S\bSI\bIG\bGH\bHU\bUP\bP using d\bdi\bis\bso\bow\bwn\bn -\b-h\bh.
+
+ If the h\bhu\bup\bpo\bon\bne\bex\bxi\bit\bt shell option has been set using s\bsh\bho\bop\bpt\bt, b\bba\bas\bsh\bh sends a
S\bSI\bIG\bGH\bHU\bUP\bP to all jobs when an interactive login shell exits.
- If b\bba\bas\bsh\bh is waiting for a command to complete and receives a signal for
+ If b\bba\bas\bsh\bh 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 b\bba\bas\bsh\bh is waiting for an asynchronous command via
- the w\bwa\bai\bit\bt builtin, the reception of a signal for which a trap has been
- set will cause the w\bwa\bai\bit\bt builtin to return immediately with an exit sta-
- tus greater than 128, immediately after which the trap is executed.
+ mand completes. If b\bba\bas\bsh\bh is waiting for an asynchronous command via the
+ w\bwa\bai\bit\bt builtin, and it receives a signal for which a trap has been set,
+ the w\bwa\bai\bit\bt 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 b\bba\bas\bsh\bh is waiting for a foreground
+ When job control is not enabled, and b\bba\bas\bsh\bh is waiting for a foreground
command to complete, the shell receives keyboard-generated signals such
- as S\bSI\bIG\bGI\bIN\bNT\bT (usually generated by ^\b^C\bC) that users commonly intend to send
+ as S\bSI\bIG\bGI\bIN\bNT\bT (usually generated by ^\b^C\bC) 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 ^\b^C\bC sends S\bSI\bIG\bGI\bIN\bNT\bT to all
- processes in that process group.
+ the same process group as the terminal, and ^\b^C\bC sends S\bSI\bIG\bGI\bIN\bNT\bT to all
+ processes in that process group. See J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL below for more infor-
+ mation about process groups.
- When b\bba\bas\bsh\bh is running without job control enabled and receives S\bSI\bIG\bGI\bIN\bNT\bT
- while waiting for a foreground command, it waits until that foreground
+ When b\bba\bas\bsh\bh is running without job control enabled and receives S\bSI\bIG\bGI\bIN\bNT\bT
+ while waiting for a foreground command, it waits until that foreground
command terminates and then decides what to do about the S\bSI\bIG\bGI\bIN\bNT\bT:
1. If the command terminates due to the S\bSI\bIG\bGI\bIN\bNT\bT, b\bba\bas\bsh\bh concludes that
- the user meant to end the entire script, and acts on the S\bSI\bIG\bGI\bIN\bNT\bT
+ the user meant to end the entire script, and acts on the S\bSI\bIG\bGI\bIN\bNT\bT
(e.g., by running a S\bSI\bIG\bGI\bIN\bNT\bT trap or exiting itself);
- 2. If the command does not terminate due to S\bSI\bIG\bGI\bIN\bNT\bT, the program
- handled the S\bSI\bIG\bGI\bIN\bNT\bT itself and did not treat it as a fatal sig-
- nal. In that case, b\bba\bas\bsh\bh does not treat S\bSI\bIG\bGI\bIN\bNT\bT as a fatal sig-
- nal, either, instead assuming that the S\bSI\bIG\bGI\bIN\bNT\bT 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 S\bSI\bIG\bGI\bIN\bNT\bT, the program
+ handled the S\bSI\bIG\bGI\bIN\bNT\bT itself and did not treat it as a fatal sig-
+ nal. In that case, b\bba\bas\bsh\bh does not treat S\bSI\bIG\bGI\bIN\bNT\bT as a fatal sig-
+ nal, either, instead assuming that the S\bSI\bIG\bGI\bIN\bNT\bT was used as part
+ of the program's normal operation (e.g., emacs uses it to abort
editing commands) or deliberately discarded. However, b\bba\bas\bsh\bh will
- run any trap set on S\bSI\bIG\bGI\bIN\bNT\bT, as it does with any other trapped
- signal it receives while it is waiting for the foreground com-
+ run any trap set on S\bSI\bIG\bGI\bIN\bNT\bT, as it does with any other trapped
+ signal it receives while it is waiting for the foreground com-
mand to complete, for compatibility.
J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL
_\bJ_\bo_\bb _\bc_\bo_\bn_\bt_\br_\bo_\bl refers to the ability to selectively stop (_\bs_\bu_\bs_\bp_\be_\bn_\bd) the ex-
- ecution of processes and continue (_\br_\be_\bs_\bu_\bm_\be) their execution at a later
- point. A user typically employs this facility via an interactive in-
+ ecution of processes and continue (_\br_\be_\bs_\bu_\bm_\be) 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 b\bba\bas\bsh\bh.
- The shell associates a _\bj_\bo_\bb with each pipeline. It keeps a table of
- currently executing jobs, which may be listed with the j\bjo\bob\bbs\bs command.
- When b\bba\bas\bsh\bh starts a job asynchronously (in the _\bb_\ba_\bc_\bk_\bg_\br_\bo_\bu_\bn_\bd), it prints a
+ The shell associates a _\bj_\bo_\bb with each pipeline. It keeps a table of
+ currently executing jobs, which may be listed with the j\bjo\bob\bbs\bs command.
+ When b\bba\bas\bsh\bh starts a job asynchronously (in the _\bb_\ba_\bc_\bk_\bg_\br_\bo_\bu_\bn_\bd), 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. B\bBa\bas\bsh\bh
+ the processes in a single pipeline are members of the same job. B\bBa\bas\bsh\bh
uses the _\bj_\bo_\bb 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 _\bc_\bu_\br_\br_\be_\bn_\bt _\bt_\be_\br_\bm_\bi_\bn_\ba_\bl _\bp_\br_\bo_\bc_\be_\bs_\bs
_\bg_\br_\bo_\bu_\bp _\bI_\bD. 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 S\bSI\bIG\bGI\bIN\bNT\bT. These processes are said to be in
- the _\bf_\bo_\br_\be_\bg_\br_\bo_\bu_\bn_\bd. _\bB_\ba_\bc_\bk_\bg_\br_\bo_\bu_\bn_\bd processes are those whose process group ID
+ generated signals such as S\bSI\bIG\bGI\bIN\bNT\bT. These processes are said to be in
+ the _\bf_\bo_\br_\be_\bg_\br_\bo_\bu_\bn_\bd. _\bB_\ba_\bc_\bk_\bg_\br_\bo_\bu_\bn_\bd 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 S\bSI\bIG\bGT\bTT\bTI\bIN\bN (\b(S\bSI\bIG\bGT\bTT\bTO\bOU\bU)\b) signal by the
+ is in effect) the terminal are sent a S\bSI\bIG\bGT\bTT\bTI\bIN\bN (\b(S\bSI\bIG\bGT\bTT\bTO\bOU\bU)\b) signal by the
kernel's terminal driver, which, unless caught, suspends the process.
- If the operating system on which b\bba\bas\bsh\bh is running supports job control,
+ If the operating system on which b\bba\bas\bsh\bh is running supports job control,
b\bba\bas\bsh\bh contains facilities to use it. Typing the _\bs_\bu_\bs_\bp_\be_\bn_\bd character (typ-
ically ^\b^Z\bZ, Control-Z) while a process is running causes that process to
- be stopped and returns control to b\bba\bas\bsh\bh. Typing the _\bd_\be_\bl_\ba_\by_\be_\bd _\bs_\bu_\bs_\bp_\be_\bn_\bd
- character (typically ^\b^Y\bY, Control-Y) causes the process to be stopped
+ be stopped and returns control to b\bba\bas\bsh\bh. Typing the _\bd_\be_\bl_\ba_\by_\be_\bd _\bs_\bu_\bs_\bp_\be_\bn_\bd
+ character (typically ^\b^Y\bY, Control-Y) causes the process to be stopped
when it attempts to read input from the terminal, and control to be re-
- turned to b\bba\bas\bsh\bh. The user may then manipulate the state of this job,
- using the b\bbg\bg command to continue it in the background, the f\bfg\bg command
+ turned to b\bba\bas\bsh\bh. The user may then manipulate the state of this job,
+ using the b\bbg\bg command to continue it in the background, the f\bfg\bg command
to continue it in the foreground, or the k\bki\bil\bll\bl command to kill it. A ^\b^Z\bZ
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 %\b% introduces a job specification (_\bj_\bo_\bb_\bs_\bp_\be_\bc). Job number _\bn may be
+ ter %\b% introduces a job specification (_\bj_\bo_\bb_\bs_\bp_\be_\bc). Job number _\bn may be
referred to as %\b%n\bn. 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, %\b%c\bce\be refers to a stopped job whose command name be-
- gins with c\bce\be. If a prefix matches more than one job, b\bba\bas\bsh\bh reports an
+ line. For example, %\b%c\bce\be refers to a stopped job whose command name be-
+ gins with c\bce\be. If a prefix matches more than one job, b\bba\bas\bsh\bh reports an
error. Using %\b%?\b?c\bce\be, on the other hand, refers to any job containing the
- string c\bce\be in its command line. If the substring matches more than one
+ string c\bce\be in its command line. If the substring matches more than one
job, b\bba\bas\bsh\bh reports an error. The symbols %\b%%\b% and %\b%+\b+ refer to the shell's
- notion of the _\bc_\bu_\br_\br_\be_\bn_\bt _\bj_\bo_\bb, which is the last job stopped while it was
- in the foreground or started in the background. The _\bp_\br_\be_\bv_\bi_\bo_\bu_\bs _\bj_\bo_\bb may
- be referenced using %\b%-\b-. If there is only a single job, %\b%+\b+ and %\b%-\b- can
+ notion of the _\bc_\bu_\br_\br_\be_\bn_\bt _\bj_\bo_\bb, which is the last job stopped while it was
+ in the foreground or started in the background. The _\bp_\br_\be_\bv_\bi_\bo_\bu_\bs _\bj_\bo_\bb may
+ be referenced using %\b%-\b-. If there is only a single job, %\b%+\b+ and %\b%-\b- can
both be used to refer to that job. In output pertaining to jobs (e.g.,
the output of the j\bjo\bob\bbs\bs command), the current job is always flagged with
- a +\b+, and the previous job with a -\b-. A single % (with no accompanying
+ a +\b+, and the previous job with a -\b-. 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: %\b%1\b1 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: %\b%1\b1 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,
b\bba\bas\bsh\bh 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 -\b-b\bb option
- to the s\bse\bet\bt builtin command is enabled, b\bba\bas\bsh\bh 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 -\b-b\bb option
+ to the s\bse\bet\bt builtin command is enabled, b\bba\bas\bsh\bh reports such changes imme-
diately. Any trap on S\bSI\bIG\bGC\bCH\bHL\bLD\bD is executed for each child that exits.
- If an attempt to exit b\bba\bas\bsh\bh is made while jobs are stopped (or, if the
- c\bch\bhe\bec\bck\bkj\bjo\bob\bbs\bs shell option has been enabled using the s\bsh\bho\bop\bpt\bt builtin, run-
+ If an attempt to exit b\bba\bas\bsh\bh is made while jobs are stopped (or, if the
+ c\bch\bhe\bec\bck\bkj\bjo\bob\bbs\bs shell option has been enabled using the s\bsh\bho\bop\bpt\bt builtin, run-
ning), the shell prints a warning message, and, if the c\bch\bhe\bec\bck\bkj\bjo\bob\bbs\bs option
- is enabled, lists the jobs and their statuses. The j\bjo\bob\bbs\bs 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 j\bjo\bob\bbs\bs 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 w\bwa\bai\bit\bt builtin,
- and job control is enabled, w\bwa\bai\bit\bt will return when the job changes
- state. The -\b-f\bf option causes w\bwa\bai\bit\bt to wait until the job or process ter-
+ When the shell is waiting for a job or process using the w\bwa\bai\bit\bt builtin,
+ and job control is enabled, w\bwa\bai\bit\bt will return when the job changes
+ state. The -\b-f\bf option causes w\bwa\bai\bit\bt to wait until the job or process ter-
minates before returning.
P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG
When executing interactively, b\bba\bas\bsh\bh displays the primary prompt P\bPS\bS1\b1 when
- it is ready to read a command, and the secondary prompt P\bPS\bS2\b2 when it
- needs more input to complete a command. B\bBa\bas\bsh\bh displays P\bPS\bS0\b0 after it
- reads a command but before executing it. B\bBa\bas\bsh\bh displays P\bPS\bS4\b4 as de-
- scribed above before tracing each command when the -\b-x\bx option is en-
- abled. B\bBa\bas\bsh\bh allows these prompt strings to be customized by inserting
- a number of backslash-escaped special characters that are decoded as
- follows:
- \\b\a\ba an ASCII bell character (07)
- \\b\d\bd the date in "Weekday Month Date" format (e.g., "Tue May
- 26")
+ it is ready to read a command, and the secondary prompt P\bPS\bS2\b2 when it
+ needs more input to complete a command.
+
+ B\bBa\bas\bsh\bh examines the value of the array variable P\bPR\bRO\bOM\bMP\bPT\bT_\b_C\bCO\bOM\bMM\bMA\bAN\bND\bD just be-
+ fore printing each primary prompt. If any elements in P\bPR\bRO\bOM\bMP\bPT\bT_\b_C\bCO\bOM\bMM\bMA\bAN\bND\bD
+ are set and non-null, Bash executes each value, in numeric order, just
+ as if it had been typed on the command line. B\bBa\bas\bsh\bh displays P\bPS\bS0\b0 after
+ it reads a command but before executing it.
+
+ B\bBa\bas\bsh\bh displays P\bPS\bS4\b4 as described above before tracing each command when
+ the -\b-x\bx option is enabled.
+
+ B\bBa\bas\bsh\bh allows the prompt strings P\bPS\bS0\b0, P\bPS\bS1\b1, P\bPS\bS2\b2, and P\bPS\bS4\b4, to be customized
+ by inserting a number of backslash-escaped special characters that are
+ decoded as follows:
+
+ \\b\a\ba An ASCII bell character (07).
+ \\b\d\bd The date in "Weekday Month Date" format (e.g., "Tue May
+ 26").
\\b\D\bD{\b{_\bf_\bo_\br_\bm_\ba_\bt}\b}
- the _\bf_\bo_\br_\bm_\ba_\bt is passed to _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be(3) and the result is in-
+ The _\bf_\bo_\br_\bm_\ba_\bt is passed to _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be(3) and the result is in-
serted into the prompt string; an empty _\bf_\bo_\br_\bm_\ba_\bt results in
a locale-specific time representation. The braces are
- required
- \\b\e\be an ASCII escape character (033)
- \\b\h\bh the hostname up to the first "."
- \\b\H\bH the hostname
- \\b\j\bj the number of jobs currently managed by the shell
- \\b\l\bl the basename of the shell's terminal device name
- \\b\n\bn newline
- \\b\r\br carriage return
- \\b\s\bs the name of the shell, the basename of $\b$0\b0 (the portion
- following the final slash)
- \\b\t\bt the current time in 24-hour HH:MM:SS format
- \\b\T\bT the current time in 12-hour HH:MM:SS format
- \\b\@\b@ the current time in 12-hour am/pm format
- \\b\A\bA the current time in 24-hour HH:MM format
- \\b\u\bu the username of the current user
- \\b\v\bv the version of b\bba\bas\bsh\bh (e.g., 2.00)
- \\b\V\bV the release of b\bba\bas\bsh\bh, version + patch level (e.g., 2.00.0)
- \\b\w\bw the value of the P\bPW\bWD\bD shell variable ($\b$P\bPW\bWD\bD), with $\b$H\bHO\bOM\bME\bE
- abbreviated with a tilde (uses the value of the
- P\bPR\bRO\bOM\bMP\bPT\bT_\b_D\bDI\bIR\bRT\bTR\bRI\bIM\bM variable)
- \\b\W\bW the basename of $\b$P\bPW\bWD\bD, with $\b$H\bHO\bOM\bME\bE abbreviated with a tilde
- \\b\!\b! the history number of this command
- \\b\#\b# the command number of this command
- \\b\$\b$ if the effective UID is 0, a #\b#, otherwise a $\b$
- \\b\_\bn_\bn_\bn the character corresponding to the octal number _\bn_\bn_\bn
- \\b\\\b\ a backslash
- \\b\[\b[ begin a sequence of non-printing characters, which could
+ required.
+ \\b\e\be An ASCII escape character (033).
+ \\b\h\bh The hostname up to the first ".".
+ \\b\H\bH The hostname.
+ \\b\j\bj The number of jobs currently managed by the shell.
+ \\b\l\bl The basename of the shell's terminal device name (e.g.,
+ "ttys0").
+ \\b\n\bn A newline.
+ \\b\r\br A carriage return.
+ \\b\s\bs The name of the shell: the basename of $\b$0\b0 (the portion
+ following the final slash).
+ \\b\t\bt The current time in 24-hour HH:MM:SS format.
+ \\b\T\bT The current time in 12-hour HH:MM:SS format.
+ \\b\@\b@ The current time in 12-hour am/pm format.
+ \\b\A\bA The current time in 24-hour HH:MM format.
+ \\b\u\bu The username of the current user.
+ \\b\v\bv The b\bba\bas\bsh\bh version (e.g., 2.00)
+ \\b\V\bV The b\bba\bas\bsh\bh release, version + patch level (e.g., 2.00.0)
+ \\b\w\bw The value of the P\bPW\bWD\bD shell variable ($\b$P\bPW\bWD\bD), with $\b$H\bHO\bOM\bME\bE
+ abbreviated with a tilde (uses the value of the
+ P\bPR\bRO\bOM\bMP\bPT\bT_\b_D\bDI\bIR\bRT\bTR\bRI\bIM\bM variable).
+ \\b\W\bW The basename of $\b$P\bPW\bWD\bD, with $\b$H\bHO\bOM\bME\bE abbreviated with a
+ tilde.
+ \\b\!\b! The history number of this command.
+ \\b\#\b# The command number of this command.
+ \\b\$\b$ If the effective UID is 0, a #\b#, otherwise a $\b$.
+ \\b\_\bn_\bn_\bn The character corresponding to the octal number _\bn_\bn_\bn.
+ \\b\\\b\ A backslash.
+ \\b\[\b[ Begin a sequence of non-printing characters, which could
be used to embed a terminal control sequence into the
- prompt
- \\b\]\b] end a sequence of non-printing characters
+ prompt.
+ \\b\]\b] 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
R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE
This is the library that handles reading input when using an interac-
- tive shell, unless the -\b--\b-n\bno\boe\bed\bdi\bit\bti\bin\bng\bg option is given at shell invocation.
- Line editing is also used when using the -\b-e\be option to the r\bre\bea\bad\bd 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 -\b-o\bo e\bem\bma\bac\bcs\bs or -\b-o\bo v\bvi\bi options to the s\bse\bet\bt
- builtin (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below). To turn off line editing
- after the shell is running, use the +\b+o\bo e\bem\bma\bac\bcs\bs or +\b+o\bo v\bvi\bi options to the
- s\bse\bet\bt builtin.
+ tive shell, unless the -\b--\b-n\bno\boe\bed\bdi\bit\bti\bin\bng\bg option is supplied at shell invoca-
+ tion. Line editing is also used when using the -\b-e\be option to the r\bre\bea\bad\bd
+ 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 -\b-o\bo e\bem\bma\bac\bcs\bs or -\b-o\bo v\bvi\bi options
+ to the s\bse\bet\bt builtin (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below). To turn off
+ line editing after the shell is running, use the +\b+o\bo e\bem\bma\bac\bcs\bs or +\b+o\bo v\bvi\bi op-
+ tions to the s\bse\bet\bt builtin.
R\bRe\bea\bad\bdl\bli\bin\bne\be N\bNo\bot\bta\bat\bti\bio\bon\bn
In this section, the Emacs-style notation is used to denote keystrokes.
- Control keys are denoted by C-_\bk_\be_\by, e.g., C-n means Control-N. Simi-
+ Control keys are denoted by C-_\bk_\be_\by, e.g., C-n means Control-N. Simi-
larly, _\bm_\be_\bt_\ba keys are denoted by M-_\bk_\be_\by, so M-x means Meta-X.
- On keyboards without a _\bM_\be_\bt_\ba key, M-_\bx means ESC _\bx, i.e., press the Es-
+ On keyboards without a _\bM_\be_\bt_\ba key, M-_\bx means ESC _\bx, i.e., press the Es-
cape key then the _\bx key. This makes ESC the _\bm_\be_\bt_\ba _\bp_\br_\be_\bf_\bi_\bx. The combina-
- tion M-C-_\bx means ESC-Control-_\bx, or press the Escape key then hold the
+ tion M-C-_\bx means ESC-Control-_\bx, or press the Escape key then hold the
Control key while pressing the _\bx key.)
- On some keyboards, the Meta key modifier produces meta characters with
- the eighth bit (0200) set (you can use the e\ben\bna\bab\bbl\ble\be-\b-m\bme\bet\bta\ba-\b-k\bke\bey\by 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 e\ben\bna\bab\bbl\ble\be-\b-m\bme\bet\bta\ba-\b-k\bke\bey\by 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 _\bM_\be_\bt_\ba key produces a key sequence with the ESC meta prefix, you
- can make M-_\bk_\be_\by key bindings you specify (see R\bRe\bea\bad\bdl\bli\bin\bne\be K\bKe\bey\by B\bBi\bin\bnd\bdi\bin\bng\bgs\bs be-
+ If the _\bM_\be_\bt_\ba key produces a key sequence with the ESC meta prefix, you
+ can make M-_\bk_\be_\by key bindings you specify (see R\bRe\bea\bad\bdl\bli\bin\bne\be K\bKe\bey\by B\bBi\bin\bnd\bdi\bin\bng\bgs\bs be-
low) do the same thing by setting the f\bfo\bor\brc\bce\be-\b-m\bme\bet\bta\ba-\b-p\bpr\bre\bef\bfi\bix\bx variable.
Readline commands may be given numeric _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs, 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., k\bki\bil\bll\bl-\b-l\bli\bin\bne\be) 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., k\bki\bil\bll\bl-\b-l\bli\bin\bne\be) 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 _\bk_\bi_\bl_\bl_\bi_\bn_\bg text, the text deleted is saved
+ When a command is described as _\bk_\bi_\bl_\bl_\bi_\bn_\bg text, the text deleted is saved
for possible future retrieval (_\by_\ba_\bn_\bk_\bi_\bn_\bg). The killed text is saved in a
_\bk_\bi_\bl_\bl _\br_\bi_\bn_\bg. 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.
R\bRe\bea\bad\bdl\bli\bin\bne\be I\bIn\bni\bit\bti\bia\bal\bli\biz\bza\bat\bti\bio\bon\bn
- Readline is customized by putting commands in an initialization file
- (the _\bi_\bn_\bp_\bu_\bt_\br_\bc file). The name of this file is taken from the value of
+ Readline is customized by putting commands in an initialization file
+ (the _\bi_\bn_\bp_\bu_\bt_\br_\bc file). The name of this file is taken from the value of
the I\bIN\bNP\bPU\bUT\bTR\bRC\bC variable. If that variable is unset, the default is _\b~_\b/_\b._\bi_\bn_\b-
- _\bp_\bu_\bt_\br_\bc. If that file does not exist or cannot be read, the ultimate
- default is _\b/_\be_\bt_\bc_\b/_\bi_\bn_\bp_\bu_\bt_\br_\bc. 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 #\b# are comments. Lines beginning with a $\b$ indicate
- conditional constructs. Other lines denote key bindings and variable
+ _\bp_\bu_\bt_\br_\bc. If that file does not exist or cannot be read, the ultimate
+ default is _\b/_\be_\bt_\bc_\b/_\bi_\bn_\bp_\bu_\bt_\br_\bc. 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 #\b# are comments. Lines beginning with a $\b$ indicate
+ conditional constructs. Other lines denote key bindings and variable
settings.
- The default key-bindings may be changed with an _\bi_\bn_\bp_\bu_\bt_\br_\bc file. Other
+ The default key-bindings may be changed with an _\bi_\bn_\bp_\bu_\bt_\br_\bc file. Other
programs that use this library may add their own commands and bindings.
For example, placing
or
C-Meta-u: universal-argument
- into the _\bi_\bn_\bp_\bu_\bt_\br_\bc would make M-C-u execute the readline command _\bu_\bn_\bi_\bv_\be_\br_\b-
+ into the _\bi_\bn_\bp_\bu_\bt_\br_\bc would make M-C-u execute the readline command _\bu_\bn_\bi_\bv_\be_\br_\b-
_\bs_\ba_\bl_\b-_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt.
- The following symbolic character names are recognized: _\bR_\bU_\bB_\bO_\bU_\bT, _\bD_\bE_\bL,
+ The following symbolic character names are recognized: _\bR_\bU_\bB_\bO_\bU_\bT, _\bD_\bE_\bL,
_\bE_\bS_\bC, _\bL_\bF_\bD, _\bN_\bE_\bW_\bL_\bI_\bN_\bE, _\bR_\bE_\bT, _\bR_\bE_\bT_\bU_\bR_\bN, _\bS_\bP_\bC, _\bS_\bP_\bA_\bC_\bE, and _\bT_\bA_\bB.
- 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 _\bm_\ba_\bc_\br_\bo).
R\bRe\bea\bad\bdl\bli\bin\bne\be K\bKe\bey\by B\bBi\bin\bnd\bdi\bin\bng\bgs\bs
- The syntax for controlling key bindings in the _\bi_\bn_\bp_\bu_\bt_\br_\bc 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 _\bi_\bn_\bp_\bu_\bt_\br_\bc 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 _\bM_\be_\bt_\ba_\b- or
_\bC_\bo_\bn_\bt_\br_\bo_\bl_\b- prefixes, or as a key sequence.
Meta-Rubout: backward-kill-word
Control-o: "> output"
- In the above example, _\bC_\b-_\bu is bound to the function u\bun\bni\biv\bve\ber\brs\bsa\bal\bl-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt,
- _\bM_\b-_\bD_\bE_\bL is bound to the function b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd, and _\bC_\b-_\bo is bound to
- run the macro expressed on the right hand side (that is, to insert the
+ In the above example, _\bC_\b-_\bu is bound to the function u\bun\bni\biv\bve\ber\brs\bsa\bal\bl-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt,
+ _\bM_\b-_\bD_\bE_\bL is bound to the function b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd, and _\bC_\b-_\bo 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, "\b"k\bke\bey\bys\bse\beq\bq"\b":_\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be or _\bm_\ba_\bc_\br_\bo, k\bke\bey\bys\bse\beq\bq differs
- from k\bke\bey\byn\bna\bam\bme\be 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, "\b"k\bke\bey\bys\bse\beq\bq"\b":_\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be or _\bm_\ba_\bc_\br_\bo, k\bke\bey\bys\bse\beq\bq differs
+ from k\bke\bey\byn\bna\bam\bme\be 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
"\e[11~": "Function Key 1"
In this example, _\bC_\b-_\bu is again bound to the function u\bun\bni\biv\bve\ber\brs\bsa\bal\bl-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt.
- _\bC_\b-_\bx _\bC_\b-_\br is bound to the function r\bre\be-\b-r\bre\bea\bad\bd-\b-i\bin\bni\bit\bt-\b-f\bfi\bil\ble\be, and _\bE_\bS_\bC _\b[ _\b1 _\b1 _\b~ is
+ _\bC_\b-_\bx _\bC_\b-_\br is bound to the function r\bre\be-\b-r\bre\bea\bad\bd-\b-i\bin\bni\bit\bt-\b-f\bfi\bil\ble\be, and _\bE_\bS_\bC _\b[ _\b1 _\b1 _\b~ is
bound to insert the text "Function Key 1".
The full set of GNU Emacs style escape sequences is
\\b\C\bC-\b- control prefix
- \\b\M\bM-\b- adding the meta prefix or converting the following char-
- acter to a meta character, as described below under
+ \\b\M\bM-\b- adding the meta prefix or converting the following char-
+ acter to a meta character, as described below under
f\bfo\bor\brc\bce\be-\b-m\bme\bet\bta\ba-\b-p\bpr\bre\bef\bfi\bix\bx
\\b\e\be an escape character
\\b\\\b\ backslash
\\b\"\b" literal "
\\b\'\b' 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:
\\b\a\ba alert (bell)
\\b\b\bb backspace
\\b\r\br carriage return
\\b\t\bt horizontal tab
\\b\v\bv vertical tab
- \\b\_\bn_\bn_\bn the eight-bit character whose value is the octal value
+ \\b\_\bn_\bn_\bn the eight-bit character whose value is the octal value
_\bn_\bn_\bn (one to three digits)
- \\b\x\bx_\bH_\bH the eight-bit character whose value is the hexadecimal
+ \\b\x\bx_\bH_\bH the eight-bit character whose value is the hexadecimal
value _\bH_\bH (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 '.
- B\bBa\bas\bsh\bh allows the current readline key bindings to be displayed or modi-
- fied with the b\bbi\bin\bnd\bd builtin command. The editing mode may be switched
- during interactive use by using the -\b-o\bo option to the s\bse\bet\bt builtin com-
+ B\bBa\bas\bsh\bh allows the current readline key bindings to be displayed or modi-
+ fied with the b\bbi\bin\bnd\bd builtin command. The editing mode may be switched
+ during interactive use by using the -\b-o\bo option to the s\bse\bet\bt builtin com-
mand (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below).
R\bRe\bea\bad\bdl\bli\bin\bne\be V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs
s\bse\bet\bt _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be_\b-_\bn_\ba_\bm_\be _\bv_\ba_\bl_\bu_\be
or using the b\bbi\bin\bnd\bd builtin command (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below).
- Except where noted, readline variables can take the values O\bOn\bn or O\bOf\bff\bf
- (without regard to case). Unrecognized variable names are ignored.
+ Except where noted, readline variables can take the values O\bOn\bn or O\bOf\bff\bf
+ (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 O\bOn\bn. All other values are
+ insensitive), and "1" are equivalent to O\bOn\bn. All other values are
equivalent to O\bOf\bff\bf. The variables and their default values are:
a\bac\bct\bti\biv\bve\be-\b-r\bre\beg\bgi\bio\bon\bn-\b-s\bst\bta\bar\brt\bt-\b-c\bco\bol\blo\bor\br
- A string variable that controls the text color and background
- when displaying the text in the active region (see the descrip-
- tion of e\ben\bna\bab\bbl\ble\be-\b-a\bac\bct\bti\biv\bve\be-\b-r\bre\beg\bgi\bio\bon\bn 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 e\ben\bna\bab\bbl\ble\be-\b-a\bac\bct\bti\biv\bve\be-\b-r\bre\beg\bgi\bio\bon\bn 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".
a\bac\bct\bti\biv\bve\be-\b-r\bre\beg\bgi\bio\bon\bn-\b-e\ben\bnd\bd-\b-c\bco\bol\blo\bor\br
- A string variable that "undoes" the effects of a\bac\bct\bti\biv\bve\be-\b-r\bre\be-\b-
- g\bgi\bio\bon\bn-\b-s\bst\bta\bar\brt\bt-\b-c\bco\bol\blo\bor\br 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 a\bac\bct\bti\biv\bve\be-\b-r\bre\be-\b-
+ g\bgi\bio\bon\bn-\b-s\bst\bta\bar\brt\bt-\b-c\bco\bol\blo\bor\br 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".
b\bbe\bel\bll\bl-\b-s\bst\bty\byl\ble\be (\b(a\bau\bud\bdi\bib\bbl\ble\be)\b)
- Controls what happens when readline wants to ring the terminal
+ Controls what happens when readline wants to ring the terminal
bell. If set to n\bno\bon\bne\be, readline never rings the bell. If set to
- v\bvi\bis\bsi\bib\bbl\ble\be, readline uses a visible bell if one is available. If
+ v\bvi\bis\bsi\bib\bbl\ble\be, readline uses a visible bell if one is available. If
set to a\bau\bud\bdi\bib\bbl\ble\be, readline attempts to ring the terminal's bell.
b\bbi\bin\bnd\bd-\b-t\btt\bty\by-\b-s\bsp\bpe\bec\bci\bia\bal\bl-\b-c\bch\bha\bar\brs\bs (\b(O\bOn\bn)\b)
- If set to O\bOn\bn (the default), readline attempts to bind the con-
+ If set to O\bOn\bn (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
b\bba\bas\bsh\bh prompt to see your current terminal settings, including the
special control characters (usually c\bcc\bch\bha\bar\brs\bs).
b\bbl\bli\bin\bnk\bk-\b-m\bma\bat\btc\bch\bhi\bin\bng\bg-\b-p\bpa\bar\bre\ben\bn (\b(O\bOf\bff\bf)\b)
If set to O\bOn\bn, readline attempts to briefly move the cursor to an
opening parenthesis when a closing parenthesis is inserted.
c\bco\bol\blo\bor\bre\bed\bd-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn-\b-p\bpr\bre\bef\bfi\bix\bx (\b(O\bOf\bff\bf)\b)
- If set to O\bOn\bn, when listing completions, readline displays the
+ If set to O\bOn\bn, 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 L\bLS\bS_\b_C\bCO\bOL\bLO\bOR\bRS\bS environment variable. If there is a color defini-
- tion in $\b$L\bLS\bS_\b_C\bCO\bOL\bLO\bOR\bRS\bS for the custom suffix "readline-colored-com-
- pletion-prefix", readline uses this color for the common prefix
+ tion in $\b$L\bLS\bS_\b_C\bCO\bOL\bLO\bOR\bRS\bS for the custom suffix "readline-colored-com-
+ pletion-prefix", readline uses this color for the common prefix
instead of its default.
c\bco\bol\blo\bor\bre\bed\bd-\b-s\bst\bta\bat\bts\bs (\b(O\bOf\bff\bf)\b)
- If set to O\bOn\bn, readline displays possible completions using dif-
- ferent colors to indicate their file type. The color defini-
- tions are taken from the value of the L\bLS\bS_\b_C\bCO\bOL\bLO\bOR\bRS\bS environment
+ If set to O\bOn\bn, readline displays possible completions using dif-
+ ferent colors to indicate their file type. The color defini-
+ tions are taken from the value of the L\bLS\bS_\b_C\bCO\bOL\bLO\bOR\bRS\bS environment
variable.
c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn (\b("#\b#")\b)
- The string that is inserted when the readline i\bin\bns\bse\ber\brt\bt-\b-c\bco\bom\bmm\bme\ben\bnt\bt
+ The string that is inserted when the readline i\bin\bns\bse\ber\brt\bt-\b-c\bco\bom\bmm\bme\ben\bnt\bt
command is executed. This command is bound to M\bM-\b-#\b# in emacs mode
and to #\b# in vi command mode.
c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn-\b-d\bdi\bis\bsp\bpl\bla\bay\by-\b-w\bwi\bid\bdt\bth\bh (\b(-\b-1\b1)\b)
- 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.
c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn-\b-i\big\bgn\bno\bor\bre\be-\b-c\bca\bas\bse\be (\b(O\bOf\bff\bf)\b)
If set to O\bOn\bn, readline performs filename matching and completion
in a case-insensitive fashion.
c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn-\b-m\bma\bap\bp-\b-c\bca\bas\bse\be (\b(O\bOf\bff\bf)\b)
- If set to O\bOn\bn, and c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn-\b-i\big\bgn\bno\bor\bre\be-\b-c\bca\bas\bse\be is enabled, readline
- treats hyphens (_\b-) and underscores (_\b_) as equivalent when per-
+ If set to O\bOn\bn, and c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn-\b-i\big\bgn\bno\bor\bre\be-\b-c\bca\bas\bse\be is enabled, readline
+ treats hyphens (_\b-) and underscores (_\b_) as equivalent when per-
forming case-insensitive filename matching and completion.
c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn-\b-p\bpr\bre\bef\bfi\bix\bx-\b-d\bdi\bis\bsp\bpl\bla\bay\by-\b-l\ble\ben\bng\bgt\bth\bh (\b(0\b0)\b)
- 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.
c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn-\b-q\bqu\bue\ber\bry\by-\b-i\bit\bte\bem\bms\bs (\b(1\b10\b00\b0)\b)
- This determines when the user is queried about viewing the num-
- ber of possible completions generated by the p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\be-\b-
- t\bti\bio\bon\bns\bs 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 p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\be-\b-
+ t\bti\bio\bon\bns\bs 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.
c\bco\bon\bnv\bve\ber\brt\bt-\b-m\bme\bet\bta\ba (\b(O\bOn\bn)\b)
If set to O\bOn\bn, 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 _\bm_\be_\bt_\ba _\bp_\br_\be_\bf_\bi_\bx). The default is _\bO_\bn, but
- readline will set it to _\bO_\bf_\bf 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 _\bm_\be_\bt_\ba _\bp_\br_\be_\bf_\bi_\bx). The default is _\bO_\bn, but
+ readline will set it to _\bO_\bf_\bf if the locale contains characters
whose encodings may include bytes with the eighth bit set. This
- variable is dependent on the L\bLC\bC_\b_C\bCT\bTY\bYP\bPE\bE locale category, and may
+ variable is dependent on the L\bLC\bC_\b_C\bCT\bTY\bYP\bPE\bE locale category, and may
change if the locale is changed. This variable also affects key
bindings; see the description of f\bfo\bor\brc\bce\be-\b-m\bme\bet\bta\ba-\b-p\bpr\bre\bef\bfi\bix\bx below.
d\bdi\bis\bsa\bab\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn (\b(O\bOf\bff\bf)\b)
If set to O\bOn\bn, 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 s\bse\bel\blf\bf-\b-i\bin\bns\bse\ber\brt\bt.
e\bec\bch\bho\bo-\b-c\bco\bon\bnt\btr\bro\bol\bl-\b-c\bch\bha\bar\bra\bac\bct\bte\ber\brs\bs (\b(O\bOn\bn)\b)
- When set to O\bOn\bn, on operating systems that indicate they support
+ When set to O\bOn\bn, on operating systems that indicate they support
it, readline echoes a character corresponding to a signal gener-
ated from the keyboard.
e\bed\bdi\bit\bti\bin\bng\bg-\b-m\bmo\bod\bde\be (\b(e\bem\bma\bac\bcs\bs)\b)
ilar to _\bE_\bm_\ba_\bc_\bs or _\bv_\bi. e\bed\bdi\bit\bti\bin\bng\bg-\b-m\bmo\bod\bde\be can be set to either e\bem\bma\bac\bcs\bs or
v\bvi\bi.
e\bem\bma\bac\bcs\bs-\b-m\bmo\bod\bde\be-\b-s\bst\btr\bri\bin\bng\bg (\b(@\b@)\b)
- If the _\bs_\bh_\bo_\bw_\b-_\bm_\bo_\bd_\be_\b-_\bi_\bn_\b-_\bp_\br_\bo_\bm_\bp_\bt variable is enabled, this string is
+ If the _\bs_\bh_\bo_\bw_\b-_\bm_\bo_\bd_\be_\b-_\bi_\bn_\b-_\bp_\br_\bo_\bm_\bp_\bt 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.
e\ben\bna\bab\bbl\ble\be-\b-a\bac\bct\bti\biv\bve\be-\b-r\bre\beg\bgi\bio\bon\bn (\b(O\bOn\bn)\b)
- The _\bp_\bo_\bi_\bn_\bt is the current cursor position, and _\bm_\ba_\br_\bk refers to a
- saved cursor position. The text between the point and mark is
- referred to as the _\br_\be_\bg_\bi_\bo_\bn. When this variable is set to _\bO_\bn,
- readline allows certain commands to designate the region as _\ba_\bc_\b-
- _\bt_\bi_\bv_\be. When the region is active, readline highlights the text
- in the region using the value of the a\bac\bct\bti\biv\bve\be-\b-r\bre\beg\bgi\bio\bon\bn-\b-s\bst\bta\bar\brt\bt-\b-c\bco\bol\blo\bor\br,
- 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 _\bp_\bo_\bi_\bn_\bt is the current cursor position, and _\bm_\ba_\br_\bk refers to a
+ saved cursor position. The text between the point and mark is
+ referred to as the _\br_\be_\bg_\bi_\bo_\bn. When this variable is set to _\bO_\bn,
+ readline allows certain commands to designate the region as _\ba_\bc_\b-
+ _\bt_\bi_\bv_\be. When the region is active, readline highlights the text
+ in the region using the value of the a\bac\bct\bti\biv\bve\be-\b-r\bre\beg\bgi\bio\bon\bn-\b-s\bst\bta\bar\brt\bt-\b-c\bco\bol\blo\bor\br,
+ 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.
e\ben\bna\bab\bbl\ble\be-\b-b\bbr\bra\bac\bck\bke\bet\bte\bed\bd-\b-p\bpa\bas\bst\bte\be (\b(O\bOn\bn)\b)
- When set to O\bOn\bn, 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 O\bOn\bn, 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.
e\ben\bna\bab\bbl\ble\be-\b-k\bke\bey\byp\bpa\bad\bd (\b(O\bOf\bff\bf)\b)
pad when it is called. Some systems need this to enable the ar-
row keys.
e\ben\bna\bab\bbl\ble\be-\b-m\bme\bet\bta\ba-\b-k\bke\bey\by (\b(O\bOn\bn)\b)
- When set to O\bOn\bn, 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 O\bOn\bn, 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).
f\bfo\bor\brc\bce\be-\b-m\bme\bet\bta\ba-\b-p\bpr\bre\bef\bfi\bix\bx (\b(O\bOf\bff\bf)\b)
- If set to O\bOn\bn, readline modifies its behavior when binding key
- sequences containing \M- or Meta- (see K\bKe\bey\by B\bBi\bin\bnd\bdi\bin\bng\bgs\bs above) by
+ If set to O\bOn\bn, readline modifies its behavior when binding key
+ sequences containing \M- or Meta- (see K\bKe\bey\by B\bBi\bin\bnd\bdi\bin\bng\bgs\bs above) by
converting a key sequence of the form \M-_\bC or Meta-_\bC to the two-
- character sequence E\bES\bSC\bC_\bC (adding the meta prefix). If
+ character sequence E\bES\bSC\bC_\bC (adding the meta prefix). If
f\bfo\bor\brc\bce\be-\b-m\bme\bet\bta\ba-\b-p\bpr\bre\bef\bfi\bix\bx is set to O\bOf\bff\bf (the default), readline uses the
- value of the c\bco\bon\bnv\bve\ber\brt\bt-\b-m\bme\bet\bta\ba variable to determine whether to per-
- form this conversion: if c\bco\bon\bnv\bve\ber\brt\bt-\b-m\bme\bet\bta\ba is O\bOn\bn, readline performs
- the conversion described above; if it is O\bOf\bff\bf, Readline converts
+ value of the c\bco\bon\bnv\bve\ber\brt\bt-\b-m\bme\bet\bta\ba variable to determine whether to per-
+ form this conversion: if c\bco\bon\bnv\bve\ber\brt\bt-\b-m\bme\bet\bta\ba is O\bOn\bn, readline performs
+ the conversion described above; if it is O\bOf\bff\bf, Readline converts
_\bC to a meta character by setting the eighth bit (0200).
e\bex\bxp\bpa\ban\bnd\bd-\b-t\bti\bil\bld\bde\be (\b(O\bOf\bff\bf)\b)
- If set to O\bOn\bn, tilde expansion is performed when readline at-
+ If set to O\bOn\bn, tilde expansion is performed when readline at-
tempts word completion.
h\bhi\bis\bst\bto\bor\bry\by-\b-p\bpr\bre\bes\bse\ber\brv\bve\be-\b-p\bpo\boi\bin\bnt\bt (\b(O\bOf\bff\bf)\b)
- If set to O\bOn\bn, the history code attempts to place point at the
- same location on each history line retrieved with p\bpr\bre\bev\bvi\bio\bou\bus\bs-\b-h\bhi\bis\bs-\b-
+ If set to O\bOn\bn, the history code attempts to place point at the
+ same location on each history line retrieved with p\bpr\bre\bev\bvi\bio\bou\bus\bs-\b-h\bhi\bis\bs-\b-
t\bto\bor\bry\by or n\bne\bex\bxt\bt-\b-h\bhi\bis\bst\bto\bor\bry\by.
h\bhi\bis\bst\bto\bor\bry\by-\b-s\bsi\biz\bze\be (\b(u\bun\bns\bse\bet\bt)\b)
- 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 H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE
- shell variable. If an attempt is made to set _\bh_\bi_\bs_\bt_\bo_\br_\by_\b-_\bs_\bi_\bz_\be to a
+ the number of history entries is not limited. By default, the
+ number of history entries is set to the value of the H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE
+ shell variable. If an attempt is made to set _\bh_\bi_\bs_\bt_\bo_\br_\by_\b-_\bs_\bi_\bz_\be to a
non-numeric value, the maximum number of history entries will be
set to 500.
h\bho\bor\bri\biz\bzo\bon\bnt\bta\bal\bl-\b-s\bsc\bcr\bro\bol\bll\bl-\b-m\bmo\bod\bde\be (\b(O\bOf\bff\bf)\b)
- When set to O\bOn\bn, makes readline use a single line for display,
+ When set to O\bOn\bn, 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.
i\bin\bnp\bpu\but\bt-\b-m\bme\bet\bta\ba (\b(O\bOf\bff\bf)\b)
- If set to O\bOn\bn, readline will enable eight-bit input (that is, it
+ If set to O\bOn\bn, 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
- m\bme\bet\bta\ba-\b-f\bfl\bla\bag\bg is a synonym for this variable. The default is _\bO_\bf_\bf,
+ gardless of what the terminal claims it can support. The name
+ m\bme\bet\bta\ba-\b-f\bfl\bla\bag\bg is a synonym for this variable. The default is _\bO_\bf_\bf,
but readline will set it to _\bO_\bn if the locale contains characters
whose encodings may include bytes with the eighth bit set. This
- variable is dependent on the L\bLC\bC_\b_C\bCT\bTY\bYP\bPE\bE locale category, and may
+ variable is dependent on the L\bLC\bC_\b_C\bCT\bTY\bYP\bPE\bE locale category, and may
change if the locale is changed.
i\bis\bse\bea\bar\brc\bch\bh-\b-t\bte\ber\brm\bmi\bin\bna\bat\bto\bor\brs\bs (\b("C\bC-\b-[\b[C\bC-\b-J\bJ")\b)
- 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 _\bE_\bS_\bC and _\bC_\b-_\bJ will terminate an incremental search.
k\bke\bey\bym\bma\bap\bp (\b(e\bem\bma\bac\bcs\bs)\b)
- Set the current readline keymap. The set of valid keymap names
- is _\be_\bm_\ba_\bc_\bs_\b, _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\bd_\ba_\br_\bd_\b, _\be_\bm_\ba_\bc_\bs_\b-_\bm_\be_\bt_\ba_\b, _\be_\bm_\ba_\bc_\bs_\b-_\bc_\bt_\bl_\bx_\b, _\bv_\bi_\b, _\bv_\bi_\b-_\bc_\bo_\bm_\b-
- _\bm_\ba_\bn_\bd, and _\bv_\bi_\b-_\bi_\bn_\bs_\be_\br_\bt. _\bv_\bi is equivalent to _\bv_\bi_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd; _\be_\bm_\ba_\bc_\bs is
- equivalent to _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\bd_\ba_\br_\bd. The default value is _\be_\bm_\ba_\bc_\bs; the
+ Set the current readline keymap. The set of valid keymap names
+ is _\be_\bm_\ba_\bc_\bs_\b, _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\bd_\ba_\br_\bd_\b, _\be_\bm_\ba_\bc_\bs_\b-_\bm_\be_\bt_\ba_\b, _\be_\bm_\ba_\bc_\bs_\b-_\bc_\bt_\bl_\bx_\b, _\bv_\bi_\b, _\bv_\bi_\b-_\bc_\bo_\bm_\b-
+ _\bm_\ba_\bn_\bd, and _\bv_\bi_\b-_\bi_\bn_\bs_\be_\br_\bt. _\bv_\bi is equivalent to _\bv_\bi_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd; _\be_\bm_\ba_\bc_\bs is
+ equivalent to _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\bd_\ba_\br_\bd. The default value is _\be_\bm_\ba_\bc_\bs; the
value of e\bed\bdi\bit\bti\bin\bng\bg-\b-m\bmo\bod\bde\be also affects the default keymap.
k\bke\bey\bys\bse\beq\bq-\b-t\bti\bim\bme\beo\bou\but\bt (\b(5\b50\b00\b0)\b)
- Specifies the duration _\br_\be_\ba_\bd_\bl_\bi_\bn_\be will wait for a character when
- reading an ambiguous key sequence (one that can form a complete
+ Specifies the duration _\br_\be_\ba_\bd_\bl_\bi_\bn_\be 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, _\br_\be_\ba_\bd_\bl_\bi_\bn_\be will use the shorter but
- complete key sequence. The value is specified in milliseconds,
- so a value of 1000 means that _\br_\be_\ba_\bd_\bl_\bi_\bn_\be 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, _\br_\be_\ba_\bd_\bl_\bi_\bn_\be 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, _\br_\be_\ba_\bd_\bl_\bi_\bn_\be will use the shorter but
+ complete key sequence. The value is specified in milliseconds,
+ so a value of 1000 means that _\br_\be_\ba_\bd_\bl_\bi_\bn_\be 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, _\br_\be_\ba_\bd_\bl_\bi_\bn_\be will wait
+ until another key is pressed to decide which key sequence to
complete.
m\bma\bar\brk\bk-\b-d\bdi\bir\bre\bec\bct\bto\bor\bri\bie\bes\bs (\b(O\bOn\bn)\b)
If set to O\bOn\bn, completed directory names have a slash appended.
m\bma\bar\brk\bk-\b-m\bmo\bod\bdi\bif\bfi\bie\bed\bd-\b-l\bli\bin\bne\bes\bs (\b(O\bOf\bff\bf)\b)
- If set to O\bOn\bn, history lines that have been modified are dis-
+ If set to O\bOn\bn, history lines that have been modified are dis-
played with a preceding asterisk (*\b*).
m\bma\bar\brk\bk-\b-s\bsy\bym\bml\bli\bin\bnk\bke\bed\bd-\b-d\bdi\bir\bre\bec\bct\bto\bor\bri\bie\bes\bs (\b(O\bOf\bff\bf)\b)
If set to O\bOn\bn, completed names which are symbolic links to direc-
- tories have a slash appended (subject to the value of m\bma\bar\brk\bk-\b-d\bdi\bi-\b-
+ tories have a slash appended (subject to the value of m\bma\bar\brk\bk-\b-d\bdi\bi-\b-
r\bre\bec\bct\bto\bor\bri\bie\bes\bs).
m\bma\bat\btc\bch\bh-\b-h\bhi\bid\bdd\bde\ben\bn-\b-f\bfi\bil\ble\bes\bs (\b(O\bOn\bn)\b)
- This variable, when set to O\bOn\bn, forces readline to match files
- whose names begin with a "." (hidden files) when performing
- filename completion. If set to O\bOf\bff\bf, the user must include the
+ This variable, when set to O\bOn\bn, forces readline to match files
+ whose names begin with a "." (hidden files) when performing
+ filename completion. If set to O\bOf\bff\bf, the user must include the
leading "." in the filename to be completed.
m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-d\bdi\bis\bsp\bpl\bla\bay\by-\b-p\bpr\bre\bef\bfi\bix\bx (\b(O\bOf\bff\bf)\b)
- If set to O\bOn\bn, menu completion displays the common prefix of the
+ If set to O\bOn\bn, menu completion displays the common prefix of the
list of possible completions (which may be empty) before cycling
through the list.
o\bou\but\btp\bpu\but\bt-\b-m\bme\bet\bta\ba (\b(O\bOf\bff\bf)\b)
- If set to O\bOn\bn, readline will display characters with the eighth
+ If set to O\bOn\bn, readline will display characters with the eighth
bit set directly rather than as a meta-prefixed escape sequence.
The default is _\bO_\bf_\bf, but readline will set it to _\bO_\bn if the locale
- contains characters whose encodings may include bytes with the
- eighth bit set. This variable is dependent on the L\bLC\bC_\b_C\bCT\bTY\bYP\bPE\bE lo-
+ contains characters whose encodings may include bytes with the
+ eighth bit set. This variable is dependent on the L\bLC\bC_\b_C\bCT\bTY\bYP\bPE\bE lo-
cale category, and may change if the locale is changed.
p\bpa\bag\bge\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(O\bOn\bn)\b)
- If set to O\bOn\bn, readline uses an internal _\bm_\bo_\br_\be-like pager to dis-
+ If set to O\bOn\bn, readline uses an internal _\bm_\bo_\br_\be-like pager to dis-
play a screenful of possible completions at a time.
+ p\bpr\bre\bef\bfe\ber\br-\b-v\bvi\bis\bsi\bib\bbl\ble\be-\b-b\bbe\bel\bll\bl
+ See b\bbe\bel\bll\bl-\b-s\bst\bty\byl\ble\be.
p\bpr\bri\bin\bnt\bt-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs-\b-h\bho\bor\bri\biz\bzo\bon\bnt\bta\bal\bll\bly\by (\b(O\bOf\bff\bf)\b)
- If set to O\bOn\bn, readline will display completions with matches
- sorted horizontally in alphabetical order, rather than down the
+ If set to O\bOn\bn, readline will display completions with matches
+ sorted horizontally in alphabetical order, rather than down the
screen.
r\bre\bev\bve\ber\brt\bt-\b-a\bal\bll\bl-\b-a\bat\bt-\b-n\bne\bew\bwl\bli\bin\bne\be (\b(O\bOf\bff\bf)\b)
- If set to O\bOn\bn, readline will undo all changes to history lines
+ If set to O\bOn\bn, readline will undo all changes to history lines
before returning when a\bac\bcc\bce\bep\bpt\bt-\b-l\bli\bin\bne\be 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 r\bre\bea\bad\bdl\bli\bin\bne\be.
s\bse\bea\bar\brc\bch\bh-\b-i\big\bgn\bno\bor\bre\be-\b-c\bca\bas\bse\be (\b(O\bOf\bff\bf)\b)
- If set to O\bOn\bn, readline performs incremental and non-incremental
+ If set to O\bOn\bn, readline performs incremental and non-incremental
history list searches in a case-insensitive fashion.
s\bsh\bho\bow\bw-\b-a\bal\bll\bl-\b-i\bif\bf-\b-a\bam\bmb\bbi\big\bgu\buo\bou\bus\bs (\b(O\bOf\bff\bf)\b)
- This alters the default behavior of the completion functions.
+ This alters the default behavior of the completion functions.
If set to O\bOn\bn, 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.
s\bsh\bho\bow\bw-\b-a\bal\bll\bl-\b-i\bif\bf-\b-u\bun\bnm\bmo\bod\bdi\bif\bfi\bie\bed\bd (\b(O\bOf\bff\bf)\b)
- This alters the default behavior of the completion functions in
+ This alters the default behavior of the completion functions in
a fashion similar to s\bsh\bho\bow\bw-\b-a\bal\bll\bl-\b-i\bif\bf-\b-a\bam\bmb\bbi\big\bgu\buo\bou\bus\bs. If set to O\bOn\bn, 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.
s\bsh\bho\bow\bw-\b-m\bmo\bod\bde\be-\b-i\bin\bn-\b-p\bpr\bro\bom\bmp\bpt\bt (\b(O\bOf\bff\bf)\b)
- If set to O\bOn\bn, add a string to the beginning of the prompt indi-
- cating the editing mode: emacs, vi command, or vi insertion.
+ If set to O\bOn\bn, 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., _\be_\bm_\ba_\bc_\bs_\b-_\bm_\bo_\bd_\be_\b-_\bs_\bt_\br_\bi_\bn_\bg).
s\bsk\bki\bip\bp-\b-c\bco\bom\bmp\bpl\ble\bet\bte\bed\bd-\b-t\bte\bex\bxt\bt (\b(O\bOf\bff\bf)\b)
- If set to O\bOn\bn, 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 O\bOn\bn, 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.
v\bvi\bi-\b-c\bcm\bmd\bd-\b-m\bmo\bod\bde\be-\b-s\bst\btr\bri\bin\bng\bg (\b((\b(c\bcm\bmd\bd)\b))\b)
- If the _\bs_\bh_\bo_\bw_\b-_\bm_\bo_\bd_\be_\b-_\bi_\bn_\b-_\bp_\br_\bo_\bm_\bp_\bt variable is enabled, this string is
+ If the _\bs_\bh_\bo_\bw_\b-_\bm_\bo_\bd_\be_\b-_\bi_\bn_\b-_\bp_\br_\bo_\bm_\bp_\bt 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.
v\bvi\bi-\b-i\bin\bns\bs-\b-m\bmo\bod\bde\be-\b-s\bst\btr\bri\bin\bng\bg (\b((\b(i\bin\bns\bs)\b))\b)
- If the _\bs_\bh_\bo_\bw_\b-_\bm_\bo_\bd_\be_\b-_\bi_\bn_\b-_\bp_\br_\bo_\bm_\bp_\bt variable is enabled, this string is
+ If the _\bs_\bh_\bo_\bw_\b-_\bm_\bo_\bd_\be_\b-_\bi_\bn_\b-_\bp_\br_\bo_\bm_\bp_\bt 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.
v\bvi\bis\bsi\bib\bbl\ble\be-\b-s\bst\bta\bat\bts\bs (\b(O\bOf\bff\bf)\b)
- If set to O\bOn\bn, a character denoting a file's type as reported by
- _\bs_\bt_\ba_\bt(2) is appended to the filename when listing possible com-
+ If set to O\bOn\bn, a character denoting a file's type as reported by
+ _\bs_\bt_\ba_\bt(2) is appended to the filename when listing possible com-
pletions.
R\bRe\bea\bad\bdl\bli\bin\bne\be C\bCo\bon\bnd\bdi\bit\bti\bio\bon\bna\bal\bl C\bCo\bon\bns\bst\btr\bru\buc\bct\bts\bs
- 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.
- $\b$i\bif\bf The $\b$i\bif\bf 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,
+ $\b$i\bif\bf The $\b$i\bif\bf 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.
- m\bmo\bod\bde\be The m\bmo\bod\bde\be=\b= form of the $\b$i\bif\bf directive is used to test
- whether readline is in emacs or vi mode. This may be
- used in conjunction with the s\bse\bet\bt k\bke\bey\bym\bma\bap\bp command, for in-
- stance, to set bindings in the _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\bd_\ba_\br_\bd and
- _\be_\bm_\ba_\bc_\bs_\b-_\bc_\bt_\bl_\bx keymaps only if readline is starting out in
+ m\bmo\bod\bde\be The m\bmo\bod\bde\be=\b= form of the $\b$i\bif\bf directive is used to test
+ whether readline is in emacs or vi mode. This may be
+ used in conjunction with the s\bse\bet\bt k\bke\bey\bym\bma\bap\bp command, for in-
+ stance, to set bindings in the _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\bd_\ba_\br_\bd and
+ _\be_\bm_\ba_\bc_\bs_\b-_\bc_\bt_\bl_\bx keymaps only if readline is starting out in
emacs mode.
- t\bte\ber\brm\bm The t\bte\ber\brm\bm=\b= form may be used to include terminal-specific
+ t\bte\ber\brm\bm The t\bte\ber\brm\bm=\b= 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 =\b= is tested against both the full name of the ter-
- minal and the portion of the terminal name before the
- first -\b-. This allows _\bs_\bu_\bn to match both _\bs_\bu_\bn and _\bs_\bu_\bn_\b-_\bc_\bm_\bd,
+ minal and the portion of the terminal name before the
+ first -\b-. This allows _\bs_\bu_\bn to match both _\bs_\bu_\bn and _\bs_\bu_\bn_\b-_\bc_\bm_\bd,
for instance.
v\bve\ber\brs\bsi\bio\bon\bn
- The v\bve\ber\brs\bsi\bio\bon\bn test may be used to perform comparisons
- against specific readline versions. The v\bve\ber\brs\bsi\bio\bon\bn expands
- to the current readline version. The set of comparison
- operators includes =\b=, (and =\b==\b=), !\b!=\b=, <\b<=\b=, >\b>=\b=, <\b<, and >\b>.
- The version number supplied on the right side of the op-
- erator consists of a major version number, an optional
+ The v\bve\ber\brs\bsi\bio\bon\bn test may be used to perform comparisons
+ against specific readline versions. The v\bve\ber\brs\bsi\bio\bon\bn expands
+ to the current readline version. The set of comparison
+ operators includes =\b=, (and =\b==\b=), !\b!=\b=, <\b<=\b=, >\b>=\b=, <\b<, and >\b>.
+ 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., 7\b7.\b.1\b1).
- If the minor version is omitted, it is assumed to be 0\b0.
+ If the minor version is omitted, it is assumed to be 0\b0.
The operator may be separated from the string v\bve\ber\brs\bsi\bio\bon\bn and
from the version number argument by whitespace.
_\ba_\bp_\bp_\bl_\bi_\bc_\ba_\bt_\bi_\bo_\bn
The _\ba_\bp_\bp_\bl_\bi_\bc_\ba_\bt_\bi_\bo_\bn construct is used to include application-
- specific settings. Each program using the readline li-
- brary sets the _\ba_\bp_\bp_\bl_\bi_\bc_\ba_\bt_\bi_\bo_\bn _\bn_\ba_\bm_\be, and an initialization
+ specific settings. Each program using the readline li-
+ brary sets the _\ba_\bp_\bp_\bl_\bi_\bc_\ba_\bt_\bi_\bo_\bn _\bn_\ba_\bm_\be, 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
b\bba\bas\bsh\bh:
$\b$i\bif\bf Bash
_\bv_\ba_\br_\bi_\ba_\bb_\bl_\be
The _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be construct provides simple equality tests for
- readline variables and values. The permitted comparison
- operators are _\b=, _\b=_\b=, and _\b!_\b=. The variable name must be
+ readline variables and values. The permitted comparison
+ operators are _\b=, _\b=_\b=, and _\b!_\b=. 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 _\bo_\bn and _\bo_\bf_\bf.
$\b$e\ben\bnd\bdi\bif\bf This command, as seen in the previous example, terminates an $\b$i\bif\bf
test fails.
$\b$i\bin\bnc\bcl\blu\bud\bde\be
- 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 _\b/_\be_\bt_\bc_\b/_\bi_\bn_\bp_\bu_\bt_\br_\bc:
$\b$i\bin\bnc\bcl\blu\bud\bde\be _\b/_\be_\bt_\bc_\b/_\bi_\bn_\bp_\bu_\bt_\br_\bc
S\bSe\bea\bar\brc\bch\bhi\bin\bng\bg
- Readline provides commands for searching through the command history
+ Readline provides commands for searching through the command history
(see H\bHI\bIS\bST\bTO\bOR\bRY\bY below) for lines containing a specified string. There are
two search modes: _\bi_\bn_\bc_\br_\be_\bm_\be_\bn_\bt_\ba_\bl and _\bn_\bo_\bn_\b-_\bi_\bn_\bc_\br_\be_\bm_\be_\bn_\bt_\ba_\bl.
- 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 i\bis\bse\bea\bar\brc\bch\bh-\b-t\bte\ber\brm\bmi\bin\bna\bat\bto\bor\brs\bs 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 i\bis\bse\bea\bar\brc\bch\bh-\b-t\bte\ber\brm\bmi\bin\bna\bat\bto\bor\brs\bs 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 _\bn_\be_\bw_\bl_\bi_\bn_\be 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 _\bn_\be_\bw_\bl_\bi_\bn_\be 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.
R\bRe\bea\bad\bdl\bli\bin\bne\be C\bCo\bom\bmm\bma\ban\bnd\bd N\bNa\bam\bme\bes\bs
- 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, _\bp_\bo_\bi_\bn_\bt refers to the current cursor position, and _\bm_\ba_\br_\bk refers to
- a cursor position saved by the s\bse\bet\bt-\b-m\bma\bar\brk\bk command. The text between the
+ tions, _\bp_\bo_\bi_\bn_\bt refers to the current cursor position, and _\bm_\ba_\br_\bk refers to
+ a cursor position saved by the s\bse\bet\bt-\b-m\bma\bar\brk\bk command. The text between the
point and mark is referred to as the _\br_\be_\bg_\bi_\bo_\bn.
C\bCo\bom\bmm\bma\ban\bnd\bds\bs f\bfo\bor\br M\bMo\bov\bvi\bin\bng\bg
b\bbe\beg\bgi\bin\bnn\bni\bin\bng\bg-\b-o\bof\bf-\b-l\bli\bin\bne\be (\b(C\bC-\b-a\ba)\b)
- 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.
e\ben\bnd\bd-\b-o\bof\bf-\b-l\bli\bin\bne\be (\b(C\bC-\b-e\be)\b)
- 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.
f\bfo\bor\brw\bwa\bar\brd\bd-\b-c\bch\bha\bar\br (\b(C\bC-\b-f\bf)\b)
Move forward a character.
Move forward to the end of the next word. Words are composed of
alphanumeric characters (letters and digits).
b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-b\bb)\b)
- 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).
s\bsh\bhe\bel\bll\bl-\b-f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd
- 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.
s\bsh\bhe\bel\bll\bl-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd
- 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.
p\bpr\bre\bev\bvi\bio\bou\bus\bs-\b-s\bsc\bcr\bre\bee\ben\bn-\b-l\bli\bin\bne\be
- 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.
n\bne\bex\bxt\bt-\b-s\bsc\bcr\bre\bee\ben\bn-\b-l\bli\bin\bne\be
- 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.
c\bcl\ble\bea\bar\br-\b-d\bdi\bis\bsp\bpl\bla\bay\by (\b(M\bM-\b-C\bC-\b-l\bl)\b)
- 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.
c\bcl\ble\bea\bar\br-\b-s\bsc\bcr\bre\bee\ben\bn (\b(C\bC-\b-l\bl)\b)
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.
r\bre\bed\bdr\bra\baw\bw-\b-c\bcu\bur\brr\bre\ben\bnt\bt-\b-l\bli\bin\bne\be
Refresh the current line.
C\bCo\bom\bmm\bma\ban\bnd\bds\bs f\bfo\bor\br M\bMa\ban\bni\bip\bpu\bul\bla\bat\bti\bin\bng\bg t\bth\bhe\be H\bHi\bis\bst\bto\bor\bry\by
a\bac\bcc\bce\bep\bpt\bt-\b-l\bli\bin\bne\be (\b(N\bNe\bew\bwl\bli\bin\bne\be,\b, R\bRe\bet\btu\bur\brn\bn)\b)
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 H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL variable. If the line is a modified history
+ is non-empty, add it to the history list according to the state
+ of the H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL variable. If the line is a modified history
line, then restore the history line to its original state.
p\bpr\bre\bev\bvi\bio\bou\bus\bs-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(C\bC-\b-p\bp)\b)
Fetch the previous command from the history list, moving back in
the list.
n\bne\bex\bxt\bt-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(C\bC-\b-n\bn)\b)
- Fetch the next command from the history list, moving forward in
+ Fetch the next command from the history list, moving forward in
the list.
b\bbe\beg\bgi\bin\bnn\bni\bin\bng\bg-\b-o\bof\bf-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(M\bM-\b-<\b<)\b)
Move to the first line in the history.
e\ben\bnd\bd-\b-o\bof\bf-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(M\bM-\b->\b>)\b)
- 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.
o\bop\bpe\ber\bra\bat\bte\be-\b-a\ban\bnd\bd-\b-g\bge\bet\bt-\b-n\bne\bex\bxt\bt (\b(C\bC-\b-o\bo)\b)
- 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.
f\bfe\bet\btc\bch\bh-\b-h\bhi\bis\bst\bto\bor\bry\by
- 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.
r\bre\bev\bve\ber\brs\bse\be-\b-s\bse\bea\bar\brc\bch\bh-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(C\bC-\b-r\br)\b)
- 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.
f\bfo\bor\brw\bwa\bar\brd\bd-\b-s\bse\bea\bar\brc\bch\bh-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(C\bC-\b-s\bs)\b)
- 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.
n\bno\bon\bn-\b-i\bin\bnc\bcr\bre\bem\bme\ben\bnt\bta\bal\bl-\b-r\bre\bev\bve\ber\brs\bse\be-\b-s\bse\bea\bar\brc\bch\bh-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(M\bM-\b-p\bp)\b)
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.
n\bno\bon\bn-\b-i\bin\bnc\bcr\bre\bem\bme\ben\bnt\bta\bal\bl-\b-f\bfo\bor\brw\bwa\bar\brd\bd-\b-s\bse\bea\bar\brc\bch\bh-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(M\bM-\b-n\bn)\b)
- 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.
h\bhi\bis\bst\bto\bor\bry\by-\b-s\bse\bea\bar\brc\bch\bh-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd
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.
h\bhi\bis\bst\bto\bor\bry\by-\b-s\bse\bea\bar\brc\bch\bh-\b-f\bfo\bor\brw\bwa\bar\brd\bd
- 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.
h\bhi\bis\bst\bto\bor\bry\by-\b-s\bsu\bub\bbs\bst\btr\bri\bin\bng\bg-\b-s\bse\bea\bar\brc\bch\bh-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd
Search backward through the history for the string of characters
between the start of the current line and the current cursor po-
- sition (the _\bp_\bo_\bi_\bn_\bt). The search string may match anywhere in a
+ sition (the _\bp_\bo_\bi_\bn_\bt). The search string may match anywhere in a
history line. This is a non-incremental search.
h\bhi\bis\bst\bto\bor\bry\by-\b-s\bsu\bub\bbs\bst\btr\bri\bin\bng\bg-\b-s\bse\bea\bar\brc\bch\bh-\b-f\bfo\bor\brw\bwa\bar\brd\bd
- 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.
y\bya\ban\bnk\bk-\b-n\bnt\bth\bh-\b-a\bar\brg\bg (\b(M\bM-\b-C\bC-\b-y\by)\b)
- 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 _\bn,
- insert the _\bnth word from the previous command (the words in the
- previous command begin with word 0). A negative argument in-
- serts the _\bnth word from the end of the previous command. Once
- the argument _\bn is computed, the argument is extracted as if the
+ insert the _\bnth word from the previous command (the words in the
+ previous command begin with word 0). A negative argument in-
+ serts the _\bnth word from the end of the previous command. Once
+ the argument _\bn is computed, the argument is extracted as if the
"!_\bn" history expansion had been specified.
y\bya\ban\bnk\bk-\b-l\bla\bas\bst\bt-\b-a\bar\brg\bg (\b(M\bM-\b-.\b.,\b, M\bM-\b-_\b_)\b)
- 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 y\bya\ban\bnk\bk-\b-n\bnt\bth\bh-\b-a\bar\brg\bg. Successive calls to y\bya\ban\bnk\bk-\b-l\bla\bas\bst\bt-\b-a\bar\brg\bg
- 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 y\bya\ban\bnk\bk-\b-n\bnt\bth\bh-\b-a\bar\brg\bg. Successive calls to y\bya\ban\bnk\bk-\b-l\bla\bas\bst\bt-\b-a\bar\brg\bg
+ 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.
s\bsh\bhe\bel\bll\bl-\b-e\bex\bxp\bpa\ban\bnd\bd-\b-l\bli\bin\bne\be (\b(M\bM-\b-C\bC-\b-e\be)\b)
- 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, $\b$'_\bs_\bt_\br_\bi_\bn_\bg' and $\b$"_\bs_\bt_\br_\bi_\bn_\bg" 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 H\bHI\bIS\bST\bTO\bOR\bRY\bY E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN 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 H\bHI\bIS\bST\bTO\bOR\bRY\bY E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN below for
a description of history expansion.
h\bhi\bis\bst\bto\bor\bry\by-\b-e\bex\bxp\bpa\ban\bnd\bd-\b-l\bli\bin\bne\be (\b(M\bM-\b-^\b^)\b)
- Perform history expansion on the current line. See H\bHI\bIS\bST\bTO\bOR\bRY\bY E\bEX\bX-\b-
+ Perform history expansion on the current line. See H\bHI\bIS\bST\bTO\bOR\bRY\bY E\bEX\bX-\b-
P\bPA\bAN\bNS\bSI\bIO\bON\bN below for a description of history expansion.
m\bma\bag\bgi\bic\bc-\b-s\bsp\bpa\bac\bce\be
- Perform history expansion on the current line and insert a
+ Perform history expansion on the current line and insert a
space. See H\bHI\bIS\bST\bTO\bOR\bRY\bY E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN below for a description of history
expansion.
a\bal\bli\bia\bas\bs-\b-e\bex\bxp\bpa\ban\bnd\bd-\b-l\bli\bin\bne\be
- Perform alias expansion on the current line. See A\bAL\bLI\bIA\bAS\bSE\bES\bS above
+ Perform alias expansion on the current line. See A\bAL\bLI\bIA\bAS\bSE\bES\bS above
for a description of alias expansion.
h\bhi\bis\bst\bto\bor\bry\by-\b-a\ban\bnd\bd-\b-a\bal\bli\bia\bas\bs-\b-e\bex\bxp\bpa\ban\bnd\bd-\b-l\bli\bin\bne\be
Perform history and alias expansion on the current line.
i\bin\bns\bse\ber\brt\bt-\b-l\bla\bas\bst\bt-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt (\b(M\bM-\b-.\b.,\b, M\bM-\b-_\b_)\b)
A synonym for y\bya\ban\bnk\bk-\b-l\bla\bas\bst\bt-\b-a\bar\brg\bg.
e\bed\bdi\bit\bt-\b-a\ban\bnd\bd-\b-e\bex\bxe\bec\bcu\but\bte\be-\b-c\bco\bom\bmm\bma\ban\bnd\bd (\b(C\bC-\b-x\bx C\bC-\b-e\be)\b)
- 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. B\bBa\bas\bsh\bh attempts to invoke $\b$V\bVI\bIS\bSU\bUA\bAL\bL, $\b$E\bED\bD-\b-
I\bIT\bTO\bOR\bR, and _\be_\bm_\ba_\bc_\bs as the editor, in that order.
C\bCo\bom\bmm\bma\ban\bnd\bds\bs f\bfo\bor\br C\bCh\bha\ban\bng\bgi\bin\bng\bg T\bTe\bex\bxt\bt
_\be_\bn_\bd_\b-_\bo_\bf_\b-_\bf_\bi_\bl_\be (\b(u\bus\bsu\bua\bal\bll\bly\by C\bC-\b-d\bd)\b)
- The character indicating end-of-file as set, for example, by
+ The character indicating end-of-file as set, for example, by
_\bs_\bt_\bt_\by(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 E\bEO\bOF\bF.
same character as the tty E\bEO\bOF\bF character, as C\bC-\b-d\bd commonly is, see
above for the effects.
b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br (\b(R\bRu\bub\bbo\bou\but\bt)\b)
- 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.
f\bfo\bor\brw\bwa\bar\brd\bd-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br
- 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.
q\bqu\buo\bot\bte\bed\bd-\b-i\bin\bns\bse\ber\brt\bt (\b(C\bC-\b-q\bq,\b, C\bC-\b-v\bv)\b)
- 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 C\bC-\b-q\bq, for example.
t\bta\bab\bb-\b-i\bin\bns\bse\ber\brt\bt (\b(C\bC-\b-v\bv T\bTA\bAB\bB)\b)
Insert a tab character.
s\bse\bel\blf\bf-\b-i\bin\bns\bse\ber\brt\bt (\b(a\ba,\b, b\bb,\b, A\bA,\b, 1\b1,\b, !\b!,\b, ...)\b)
Insert the character typed.
t\btr\bra\ban\bns\bsp\bpo\bos\bse\be-\b-c\bch\bha\bar\brs\bs (\b(C\bC-\b-t\bt)\b)
- 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.
t\btr\bra\ban\bns\bsp\bpo\bos\bse\be-\b-w\bwo\bor\brd\bds\bs (\b(M\bM-\b-t\bt)\b)
- 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.
u\bup\bpc\bca\bas\bse\be-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-u\bu)\b)
- 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.
d\bdo\bow\bwn\bnc\bca\bas\bse\be-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-l\bl)\b)
- 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.
c\bca\bap\bpi\bit\bta\bal\bli\biz\bze\be-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-c\bc)\b)
Capitalize the current (or following) word. With a negative ar-
gument, capitalize the previous word, but do not move point.
o\bov\bve\ber\brw\bwr\bri\bit\bte\be-\b-m\bmo\bod\bde\be
- 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 e\bem\bma\bac\bcs\bs mode; v\bvi\bi mode does overwrite differently. Each call
+ only e\bem\bma\bac\bcs\bs mode; v\bvi\bi mode does overwrite differently. Each call
to _\br_\be_\ba_\bd_\bl_\bi_\bn_\be_\b(_\b) starts in insert mode. In overwrite mode, charac-
- ters bound to s\bse\bel\blf\bf-\b-i\bin\bns\bse\ber\brt\bt replace the text at point rather than
- pushing the text to the right. Characters bound to b\bba\bac\bck\bk-\b-
- w\bwa\bar\brd\bd-\b-d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br replace the character before point with a
+ ters bound to s\bse\bel\blf\bf-\b-i\bin\bns\bse\ber\brt\bt replace the text at point rather than
+ pushing the text to the right. Characters bound to b\bba\bac\bck\bk-\b-
+ w\bwa\bar\brd\bd-\b-d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br 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.
b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-k\bki\bil\bll\bl-\b-l\bli\bin\bne\be (\b(C\bC-\b-x\bx R\bRu\bub\bbo\bou\but\bt)\b)
Kill backward to the beginning of the line.
u\bun\bni\bix\bx-\b-l\bli\bin\bne\be-\b-d\bdi\bis\bsc\bca\bar\brd\bd (\b(C\bC-\b-u\bu)\b)
- 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.
k\bki\bil\bll\bl-\b-w\bwh\bho\bol\ble\be-\b-l\bli\bin\bne\be
- Kill all characters on the current line, no matter where point
+ Kill all characters on the current line, no matter where point
is.
k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-d\bd)\b)
- 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 f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-R\bRu\bub\bbo\bou\but\bt)\b)
- 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 b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
s\bsh\bhe\bel\bll\bl-\b-k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd
- 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 s\bsh\bhe\bel\bll\bl-\b-f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
s\bsh\bhe\bel\bll\bl-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd
- 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 s\bsh\bhe\bel\bll\bl-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
u\bun\bni\bix\bx-\b-w\bwo\bor\brd\bd-\b-r\bru\bub\bbo\bou\but\bt (\b(C\bC-\b-w\bw)\b)
- 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.
u\bun\bni\bix\bx-\b-f\bfi\bil\ble\ben\bna\bam\bme\be-\b-r\bru\bub\bbo\bou\but\bt
- 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.
d\bde\bel\ble\bet\bte\be-\b-h\bho\bor\bri\biz\bzo\bon\bnt\bta\bal\bl-\b-s\bsp\bpa\bac\bce\be (\b(M\bM-\b-\\b\)\b)
Delete all spaces and tabs around point.
c\bco\bop\bpy\by-\b-r\bre\beg\bgi\bio\bon\bn-\b-a\bas\bs-\b-k\bki\bil\bll\bl
Copy the text in the region to the kill buffer.
c\bco\bop\bpy\by-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd
- 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 b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
c\bco\bop\bpy\by-\b-f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd
- 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 f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
y\bya\ban\bnk\bk (\b(C\bC-\b-y\by)\b)
Yank the top of the kill ring into the buffer at point.
y\bya\ban\bnk\bk-\b-p\bpo\bop\bp (\b(M\bM-\b-y\by)\b)
- 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 y\bya\ban\bnk\bk or y\bya\ban\bnk\bk-\b-p\bpo\bop\bp.
N\bNu\bum\bme\ber\bri\bic\bc A\bAr\brg\bgu\bum\bme\ben\bnt\bts\bs
d\bdi\big\bgi\bit\bt-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt (\b(M\bM-\b-0\b0,\b, M\bM-\b-1\b1,\b, ...,\b, M\bM-\b--\b-)\b)
- 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.
u\bun\bni\biv\bve\ber\brs\bsa\bal\bl-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt
- 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 u\bun\bni\biv\bve\ber\brs\bsa\bal\bl-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt 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.
C\bCo\bom\bmp\bpl\ble\bet\bti\bin\bng\bg
c\bco\bom\bmp\bpl\ble\bet\bte\be (\b(T\bTA\bAB\bB)\b)
- Attempt to perform completion on the text before point. B\bBa\bas\bsh\bh
+ Attempt to perform completion on the text before point. B\bBa\bas\bsh\bh
attempts completion treating the text as a variable (if the text
- begins with $\b$), username (if the text begins with ~\b~), hostname
- (if the text begins with @\b@), or command (including aliases and
+ begins with $\b$), username (if the text begins with ~\b~), hostname
+ (if the text begins with @\b@), or command (including aliases and
functions) in turn. If none of these produces a match, filename
completion is attempted.
p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(M\bM-\b-?\b?)\b)
List the possible completions of the text before point.
i\bin\bns\bse\ber\brt\bt-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(M\bM-\b-*\b*)\b)
- 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 p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs.
m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be
- Similar to c\bco\bom\bmp\bpl\ble\bet\bte\be, but replaces the word to be completed with
- a single match from the list of possible completions. Repeated
- execution of m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be steps through the list of possible
- completions, inserting each match in turn. At the end of the
+ Similar to c\bco\bom\bmp\bpl\ble\bet\bte\be, but replaces the word to be completed with
+ a single match from the list of possible completions. Repeated
+ execution of m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be 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
b\bbe\bel\bll\bl-\b-s\bst\bty\byl\ble\be) and the original text is restored. An argument of _\bn
moves _\bn 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 T\bTA\bAB\bB, but is unbound by default.
m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd
- Identical to m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be, but moves backward through the list
- of possible completions, as if m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be had been given a
+ Identical to m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be, but moves backward through the list
+ of possible completions, as if m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be had been given a
negative argument. This command is unbound by default.
d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br-\b-o\bor\br-\b-l\bli\bis\bst\bt
- Deletes the character under the cursor if not at the beginning
- or end of the line (like d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br). If at the end of the
+ Deletes the character under the cursor if not at the beginning
+ or end of the line (like d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br). If at the end of the
line, behaves identically to p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs. This command
is unbound by default.
c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-f\bfi\bil\ble\ben\bna\bam\bme\be (\b(M\bM-\b-/\b/)\b)
List the possible completions of the text before point, treating
it as a filename.
c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-u\bus\bse\ber\brn\bna\bam\bme\be (\b(M\bM-\b-~\b~)\b)
- Attempt completion on the text before point, treating it as a
+ Attempt completion on the text before point, treating it as a
username.
p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-u\bus\bse\ber\brn\bna\bam\bme\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(C\bC-\b-x\bx ~\b~)\b)
List the possible completions of the text before point, treating
it as a username.
c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-v\bva\bar\bri\bia\bab\bbl\ble\be (\b(M\bM-\b-$\b$)\b)
- Attempt completion on the text before point, treating it as a
+ Attempt completion on the text before point, treating it as a
shell variable.
p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-v\bva\bar\bri\bia\bab\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(C\bC-\b-x\bx $\b$)\b)
List the possible completions of the text before point, treating
it as a shell variable.
c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-h\bho\bos\bst\btn\bna\bam\bme\be (\b(M\bM-\b-@\b@)\b)
- Attempt completion on the text before point, treating it as a
+ Attempt completion on the text before point, treating it as a
hostname.
p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-h\bho\bos\bst\btn\bna\bam\bme\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(C\bC-\b-x\bx @\b@)\b)
List the possible completions of the text before point, treating
it as a hostname.
c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-c\bco\bom\bmm\bma\ban\bnd\bd (\b(M\bM-\b-!\b!)\b)
- 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.
p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-c\bco\bom\bmm\bma\ban\bnd\bd-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(C\bC-\b-x\bx !\b!)\b)
List the possible completions of the text before point, treating
it as a command name.
d\bdy\byn\bna\bam\bmi\bic\bc-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(M\bM-\b-T\bTA\bAB\bB)\b)
- 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.
d\bda\bab\bbb\bbr\bre\bev\bv-\b-e\bex\bxp\bpa\ban\bnd\bd
- 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.
c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-i\bin\bnt\bto\bo-\b-b\bbr\bra\bac\bce\bes\bs (\b(M\bM-\b-{\b{)\b)
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 B\bBr\bra\bac\bce\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn above).
K\bKe\bey\byb\bbo\boa\bar\brd\bd M\bMa\bac\bcr\bro\bos\bs
s\bst\bta\bar\brt\bt-\b-k\bkb\bbd\bd-\b-m\bma\bac\bcr\bro\bo (\b(C\bC-\b-x\bx (\b()\b)
- Begin saving the characters typed into the current keyboard
+ Begin saving the characters typed into the current keyboard
macro.
e\ben\bnd\bd-\b-k\bkb\bbd\bd-\b-m\bma\bac\bcr\bro\bo (\b(C\bC-\b-x\bx )\b))\b)
Stop saving the characters typed into the current keyboard macro
and store the definition.
c\bca\bal\bll\bl-\b-l\bla\bas\bst\bt-\b-k\bkb\bbd\bd-\b-m\bma\bac\bcr\bro\bo (\b(C\bC-\b-x\bx e\be)\b)
- 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.
p\bpr\bri\bin\bnt\bt-\b-l\bla\bas\bst\bt-\b-k\bkb\bbd\bd-\b-m\bma\bac\bcr\bro\bo (\b()\b)
- Print the last keyboard macro defined in a format suitable for
+ Print the last keyboard macro defined in a format suitable for
the _\bi_\bn_\bp_\bu_\bt_\br_\bc file.
M\bMi\bis\bsc\bce\bel\bll\bla\ban\bne\beo\bou\bus\bs
r\bre\be-\b-r\bre\bea\bad\bd-\b-i\bin\bni\bit\bt-\b-f\bfi\bil\ble\be (\b(C\bC-\b-x\bx C\bC-\b-r\br)\b)
- Read in the contents of the _\bi_\bn_\bp_\bu_\bt_\br_\bc file, and incorporate any
+ Read in the contents of the _\bi_\bn_\bp_\bu_\bt_\br_\bc file, and incorporate any
bindings or variable assignments found there.
a\bab\bbo\bor\brt\bt (\b(C\bC-\b-g\bg)\b)
- 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 b\bbe\bel\bll\bl-\b-s\bst\bty\byl\ble\be).
d\bdo\bo-\b-l\blo\bow\bwe\ber\brc\bca\bas\bse\be-\b-v\bve\ber\brs\bsi\bio\bon\bn (\b(M\bM-\b-A\bA,\b, M\bM-\b-B\bB,\b, M\bM-\b-_\bx,\b, ...)\b)
- If the metafied character _\bx is uppercase, run the command that
+ If the metafied character _\bx is uppercase, run the command that
is bound to the corresponding metafied lowercase character. The
behavior is undefined if _\bx is already lowercase.
p\bpr\bre\bef\bfi\bix\bx-\b-m\bme\bet\bta\ba (\b(E\bES\bSC\bC)\b)
u\bun\bnd\bdo\bo (\b(C\bC-\b-_\b_,\b, C\bC-\b-x\bx C\bC-\b-u\bu)\b)
Incremental undo, separately remembered for each line.
r\bre\bev\bve\ber\brt\bt-\b-l\bli\bin\bne\be (\b(M\bM-\b-r\br)\b)
- Undo all changes made to this line. This is like executing the
- u\bun\bnd\bdo\bo command enough times to return the line to its initial
+ Undo all changes made to this line. This is like executing the
+ u\bun\bnd\bdo\bo command enough times to return the line to its initial
state.
t\bti\bil\bld\bde\be-\b-e\bex\bxp\bpa\ban\bnd\bd (\b(M\bM-\b-&\b&)\b)
Perform tilde expansion on the current word.
s\bse\bet\bt-\b-m\bma\bar\brk\bk (\b(C\bC-\b-@\b@,\b, M\bM-\b-<\b<s\bsp\bpa\bac\bce\be>\b>)\b)
- 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.
e\bex\bxc\bch\bha\ban\bng\bge\be-\b-p\bpo\boi\bin\bnt\bt-\b-a\ban\bnd\bd-\b-m\bma\bar\brk\bk (\b(C\bC-\b-x\bx C\bC-\b-x\bx)\b)
- 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.
c\bch\bha\bar\bra\bac\bct\bte\ber\br-\b-s\bse\bea\bar\brc\bch\bh (\b(C\bC-\b-]\b])\b)
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.
c\bch\bha\bar\bra\bac\bct\bte\ber\br-\b-s\bse\bea\bar\brc\bch\bh-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd (\b(M\bM-\b-C\bC-\b-]\b])\b)
- 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.
s\bsk\bki\bip\bp-\b-c\bcs\bsi\bi-\b-s\bse\beq\bqu\bue\ben\bnc\bce\be
- 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-[.
i\bin\bns\bse\ber\brt\bt-\b-c\bco\bom\bmm\bme\ben\bnt\bt (\b(M\bM-\b-#\b#)\b)
- Without a numeric argument, the value of the readline c\bco\bom\bm-\b-
- m\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn variable is inserted at the beginning of the current
+ Without a numeric argument, the value of the readline c\bco\bom\bm-\b-
+ m\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn 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 c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn, the value is inserted, other-
+ toggle: if the characters at the beginning of the line do not
+ match the value of c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn, the value is inserted, other-
wise the characters in c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn 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 c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn
- 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 c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn
+ 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.
s\bsp\bpe\bel\bll\bl-\b-c\bco\bor\brr\bre\bec\bct\bt-\b-w\bwo\bor\brd\bd (\b(C\bC-\b-x\bx s\bs)\b)
- Perform spelling correction on the current word, treating it as
- a directory or filename, in the same way as the c\bcd\bds\bsp\bpe\bel\bll\bl 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 c\bcd\bds\bsp\bpe\bel\bll\bl shell
+ option. Word boundaries are the same as those used by
s\bsh\bhe\bel\bll\bl-\b-f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
g\bgl\blo\bob\bb-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-g\bg)\b)
- 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.
g\bgl\blo\bob\bb-\b-e\bex\bxp\bpa\ban\bnd\bd-\b-w\bwo\bor\brd\bd (\b(C\bC-\b-x\bx *\b*)\b)
- 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.
g\bgl\blo\bob\bb-\b-l\bli\bis\bst\bt-\b-e\bex\bxp\bpa\ban\bns\bsi\bio\bon\bns\bs (\b(C\bC-\b-x\bx g\bg)\b)
- The list of expansions that would have been generated by
- g\bgl\blo\bob\bb-\b-e\bex\bxp\bpa\ban\bnd\bd-\b-w\bwo\bor\brd\bd 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
+ g\bgl\blo\bob\bb-\b-e\bex\bxp\bpa\ban\bnd\bd-\b-w\bwo\bor\brd\bd is displayed, and the line is redrawn. If a
+ numeric argument is supplied, an asterisk is appended before
pathname expansion.
d\bdu\bum\bmp\bp-\b-f\bfu\bun\bnc\bct\bti\bio\bon\bns\bs
- 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
_\bi_\bn_\bp_\bu_\bt_\br_\bc file.
d\bdu\bum\bmp\bp-\b-v\bva\bar\bri\bia\bab\bbl\ble\bes\bs
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 _\bi_\bn_\bp_\bu_\bt_\br_\bc file.
d\bdu\bum\bmp\bp-\b-m\bma\bac\bcr\bro\bos\bs
- 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
_\bi_\bn_\bp_\bu_\bt_\br_\bc file.
d\bdi\bis\bsp\bpl\bla\bay\by-\b-s\bsh\bhe\bel\bll\bl-\b-v\bve\ber\brs\bsi\bio\bon\bn (\b(C\bC-\b-x\bx C\bC-\b-v\bv)\b)
Display version information about the current instance of b\bba\bas\bsh\bh.
P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn
- When word completion is attempted for an argument to a command for
- which a completion specification (a _\bc_\bo_\bm_\bp_\bs_\bp_\be_\bc) has been defined using
- the c\bco\bom\bmp\bpl\ble\bet\bte\be builtin (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS 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 -\b-E\bE option to c\bco\bom\bmp\bpl\ble\bet\bte\be 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 -\b-D\bD option to c\bco\bom\bmp\bpl\ble\bet\bte\be is used as the default. If there is no
- default compspec, b\bba\bas\bsh\bh 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 _\bc_\bo_\bm_\bp_\bs_\bp_\be_\bc) has been defined using
+ the c\bco\bom\bmp\bpl\ble\bet\bte\be builtin (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS 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 -\b-E\bE option to c\bco\bom\bmp\bpl\ble\bet\bte\be 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 -\b-D\bD option to c\bco\bom\bmp\bpl\ble\bet\bte\be is used as the default. If there is no
+ default compspec, b\bba\bas\bsh\bh 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 b\bba\bas\bsh\bh 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 b\bba\bas\bsh\bh comple-
tion as described above under C\bCo\bom\bmp\bpl\ble\bet\bti\bin\bng\bg 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
- -\b-f\bf or -\b-d\bd 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
+ -\b-f\bf or -\b-d\bd option is used for filename or directory name completion, the
shell variable F\bFI\bIG\bGN\bNO\bOR\bRE\bE is used to filter the matches.
Any completions specified by a pathname expansion pattern to the -\b-G\bG op-
- tion are generated next. The words generated by the pattern need not
- match the word being completed. The G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE shell variable is not
+ tion are generated next. The words generated by the pattern need not
+ match the word being completed. The G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE shell variable is not
used to filter the matches, but the F\bFI\bIG\bGN\bNO\bOR\bRE\bE variable is used.
- Next, the string specified as the argument to the -\b-W\bW option is consid-
- ered. The string is first split using the characters in the I\bIF\bFS\bS 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 -\b-W\bW option is consid-
+ ered. The string is first split using the characters in the I\bIF\bFS\bS 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 E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN. The results are split using the rules
described above under W\bWo\bor\brd\bd S\bSp\bpl\bli\bit\btt\bti\bin\bng\bg. 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 -\b-F\bF and -\b-C\bC options is invoked. When the command or
+ After these matches have been generated, any shell function or command
+ specified with the -\b-F\bF and -\b-C\bC options is invoked. When the command or
function is invoked, the C\bCO\bOM\bMP\bP_\b_L\bLI\bIN\bNE\bE, C\bCO\bOM\bMP\bP_\b_P\bPO\bOI\bIN\bNT\bT, C\bCO\bOM\bMP\bP_\b_K\bKE\bEY\bY, and C\bCO\bOM\bMP\bP_\b_T\bTY\bYP\bPE\bE
variables are assigned values as described above under S\bSh\bhe\bel\bll\bl V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs.
- If a shell function is being invoked, the C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDS\bS and C\bCO\bOM\bMP\bP_\b_C\bCW\bWO\bOR\bRD\bD
- variables are also set. When the function or command is invoked, the
- first argument ($\b$1\b1) is the name of the command whose arguments are be-
- ing completed, the second argument ($\b$2\b2) is the word being completed,
- and the third argument ($\b$3\b3) is the word preceding the word being com-
+ If a shell function is being invoked, the C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDS\bS and C\bCO\bOM\bMP\bP_\b_C\bCW\bWO\bOR\bRD\bD
+ variables are also set. When the function or command is invoked, the
+ first argument ($\b$1\b1) is the name of the command whose arguments are be-
+ ing completed, the second argument ($\b$2\b2) is the word being completed,
+ and the third argument ($\b$3\b3) 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 -\b-F\bF is invoked first. The function may use
- any of the shell facilities, including the c\bco\bom\bmp\bpg\bge\ben\bn builtin described
- below, to generate the matches. It must put the possible completions
- in the C\bCO\bOM\bMP\bPR\bRE\bEP\bPL\bLY\bY array variable, one per array element.
+ Any function specified with -\b-F\bF is invoked first. The function may use
+ any of the shell facilities, including the c\bco\bom\bmp\bpg\bge\ben\bn and c\bco\bom\bmp\bpo\bop\bpt\bt builtins
+ described below, to generate the matches. It must put the possible
+ completions in the C\bCO\bOM\bMP\bPR\bRE\bEP\bPL\bLY\bY array variable, one per array element.
Next, any command specified with the -\b-C\bC 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 -\b-X\bX option is applied to the list. The filter is a pat-
- tern as used for pathname expansion; a &\b& in the pattern is replaced
- with the text of the word being completed. A literal &\b& 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 -\b-X\bX option is applied to the list. The filter is a pat-
+ tern as used for pathname expansion; a &\b& in the pattern is replaced
+ with the text of the word being completed. A literal &\b& 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 !\b! negates the pattern; in this case any completion not match-
- ing the pattern will be removed. If the n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh shell option is
- enabled, the match is performed without regard to the case of alpha-
+ ing the pattern will be removed. If the n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh 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 -\b-P\bP and -\b-S\bS 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 r\bre\bea\bad\bdl\bli\bin\bne\be as the list of possible completions.
- If the previously-applied actions do not generate any matches, and the
- -\b-o\bo d\bdi\bir\brn\bna\bam\bme\bes\bs option was supplied to c\bco\bom\bmp\bpl\ble\bet\bte\be when the compspec was de-
+ If the previously-applied actions do not generate any matches, and the
+ -\b-o\bo d\bdi\bir\brn\bna\bam\bme\bes\bs option was supplied to c\bco\bom\bmp\bpl\ble\bet\bte\be when the compspec was de-
fined, directory name completion is attempted.
- If the -\b-o\bo p\bpl\blu\bus\bsd\bdi\bir\brs\bs option was supplied to c\bco\bom\bmp\bpl\ble\bet\bte\be when the compspec
+ If the -\b-o\bo p\bpl\blu\bus\bsd\bdi\bir\brs\bs option was supplied to c\bco\bom\bmp\bpl\ble\bet\bte\be 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 b\bba\bas\bsh\bh completions are not attempted, and the readline default of
- filename completion is disabled. If the -\b-o\bo b\bba\bas\bsh\bhd\bde\bef\bfa\bau\bul\blt\bt option was sup-
- plied to c\bco\bom\bmp\bpl\ble\bet\bte\be when the compspec was defined, the b\bba\bas\bsh\bh default com-
- pletions are attempted if the compspec generates no matches. If the -\b-o\bo
- d\bde\bef\bfa\bau\bul\blt\bt option was supplied to c\bco\bom\bmp\bpl\ble\bet\bte\be when the compspec was defined,
- readline's default completion will be performed if the compspec (and,
- if attempted, the default b\bba\bas\bsh\bh 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 m\bma\bar\brk\bk-\b-d\bdi\bir\bre\bec\bct\bto\bor\bri\bie\bes\bs 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 b\bba\bas\bsh\bh completions and the r\bre\bea\bad\bdl\bli\bin\bne\be default of filename comple-
+ tion are disabled. If the -\b-o\bo b\bba\bas\bsh\bhd\bde\bef\bfa\bau\bul\blt\bt option was supplied to c\bco\bom\bm-\b-
+ p\bpl\ble\bet\bte\be when the compspec was defined, if the compspec generates no
+ matches, the b\bba\bas\bsh\bh default completions are attempted. If the -\b-o\bo d\bde\bef\bfa\bau\bul\blt\bt
+ option was supplied to c\bco\bom\bmp\bpl\ble\bet\bte\be when the compspec was defined, read-
+ line's default completion will be performed if the compspec (and, if
+ attempted, the default b\bba\bas\bsh\bh 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 m\bma\bar\brk\bk-\b-d\bdi\bir\bre\bec\bct\bto\bor\bri\bie\bes\bs readline variable, regardless of the
setting of the m\bma\bar\brk\bk-\b-s\bsy\bym\bml\bli\bin\bnk\bke\bed\bd-\b-d\bdi\bir\bre\bec\bct\bto\bor\bri\bie\bes\bs 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 c\bco\bom\bmp\bpl\ble\bet\bte\be -\b-D\bD. 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 c\bco\bom\bmp\bpl\ble\bet\bte\be -\b-D\bD. 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()
{
-o bashdefault -o default
H\bHI\bIS\bST\bTO\bOR\bRY\bY
- When the -\b-o\bo h\bhi\bis\bst\bto\bor\bry\by option to the s\bse\bet\bt builtin is enabled, the shell
+ When the -\b-o\bo h\bhi\bis\bst\bto\bor\bry\by option to the s\bse\bet\bt builtin is enabled, the shell
provides access to the _\bc_\bo_\bm_\bm_\ba_\bn_\bd _\bh_\bi_\bs_\bt_\bo_\br_\by, the list of commands previously
- typed. The value of the H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE variable is used as the number of
+ typed. The value of the H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE variable is used as the number of
commands to save in a history list. The text of the last H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE com-
- mands (default 500) is saved. The shell stores each command in the
- history list prior to parameter and variable expansion (see E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN
- 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 E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN
+ above) but after history expansion is performed, subject to the values
of the shell variables H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE and H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL.
- On startup, the history is initialized from the file named by the vari-
- able H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE (default _\b~_\b/_\b._\bb_\ba_\bs_\bh_\b__\bh_\bi_\bs_\bt_\bo_\br_\by). The file named by the value
- of H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is truncated, if necessary, to contain no more than the
- number of lines specified by the value of H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bES\bSI\bIZ\bZE\bE. If H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE-\b-
- S\bSI\bIZ\bZE\bE 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 H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT variable. When a shell with
- history enabled exits, the last $\b$H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE lines are copied from the
- history list to $\b$H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE. If the h\bhi\bis\bst\bta\bap\bpp\bpe\ben\bnd\bd shell option is enabled
- (see the description of s\bsh\bho\bop\bpt\bt under S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below), the
- lines are appended to the history file, otherwise the history file is
- overwritten. If H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is unset or null, or if the history file is
- unwritable, the history is not saved. If the H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT 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 H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bES\bSI\bIZ\bZE\bE lines. If H\bHI\bIS\bST\bT-\b-
- F\bFI\bIL\bLE\bES\bSI\bIZ\bZE\bE 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 f\bfc\bc (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below) may be used
- to list or edit and re-execute a portion of the history list. The h\bhi\bis\bs-\b-
- t\bto\bor\bry\by 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 H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL and H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE variables are used to cause the
- shell to save only a subset of the commands entered. The c\bcm\bmd\bdh\bhi\bis\bst\bt 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 l\bli\bit\bth\bhi\bis\bst\bt shell option
- causes the shell to save the command with embedded newlines instead of
- semicolons. See the description of the s\bsh\bho\bop\bpt\bt builtin below under S\bSH\bHE\bEL\bLL\bL
- B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS for information on setting and unsetting shell op-
- tions.
+ On startup, b\bba\bas\bsh\bh initializes the history list by reading history en-
+ tries from the the file named by the H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE variable (default
+ _\b~_\b/_\b._\bb_\ba_\bs_\bh_\b__\bh_\bi_\bs_\bt_\bo_\br_\by). That file is referred to as the _\bh_\bi_\bs_\bt_\bo_\br_\by _\bf_\bi_\bl_\be. The
+ history file is truncated, if necessary, to contain no more than the
+ number of history entries specified by the value of H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bES\bSI\bIZ\bZE\bE. If
+ H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bES\bSI\bIZ\bZE\bE 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 H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT variable. When
+ present, history timestamps delimit history entries, making multi-line
+ entries possible.
+
+ When a shell with history enabled exits, b\bba\bas\bsh\bh copies the last $\b$H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE
+ entries from the history list to $\b$H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE. If the h\bhi\bis\bst\bta\bap\bpp\bpe\ben\bnd\bd shell
+ option is enabled (see the description of s\bsh\bho\bop\bpt\bt under S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN
+ C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below), b\bba\bas\bsh\bh appends the entries to the history file, other-
+ wise the history file is overwritten. If H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is unset or null, or
+ if the history file is unwritable, the history is not saved. If the
+ H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT 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 H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT, the timestamps delimit multi-line history entries.
+ After saving the history, b\bba\bas\bsh\bh truncates the history file to contain no
+ more than H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bES\bSI\bIZ\bZE\bE lines. If H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bES\bSI\bIZ\bZE\bE 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 f\bfc\bc builtin command (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below) will list or
+ edit and re-execute a portion of the history list. The h\bhi\bis\bst\bto\bor\bry\by 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 H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL and H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE variables are used to save only a
+ subset of the commands entered. The c\bcm\bmd\bdh\bhi\bis\bst\bt 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 l\bli\bit\bth\bhi\bis\bst\bt shell option modifies c\bcm\bmd\bdh\bhi\bis\bst\bt
+ by saving the command with embedded newlines instead of semicolons.
+ See the description of the s\bsh\bho\bop\bpt\bt builtin below under S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bM-\b-
+ M\bMA\bAN\bND\bDS\bS for information on setting and unsetting shell options.
H\bHI\bIS\bST\bTO\bOR\bRY\bY E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN
- The shell supports a history expansion feature that is similar to the
- history expansion in c\bcs\bsh\bh. This section describes what syntax features
- are available. This feature is enabled by default for interactive
- shells, and can be disabled using the +\b+H\bH option to the s\bse\bet\bt builtin com-
- mand (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS 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 c\bcs\bsh\bh. This section describes what syntax features
+ are available.
+
+ History expansion is enabled by default for interactive shells, and can
+ be disabled using the +\b+H\bH option to the s\bse\bet\bt builtin command (see S\bSH\bHE\bEL\bLL\bL
+ B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS 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 _\be_\bv_\be_\bn_\bt, and the portions of
- that line that are acted upon are _\bw_\bo_\br_\bd_\bs. The line is broken into words
- in the same fashion as when reading input, so that several _\bm_\be_\bt_\ba_\bc_\bh_\ba_\br_\ba_\bc_\b-
- _\bt_\be_\br-separated words surrounded by quotes are considered one word. The
- _\be_\bv_\be_\bn_\bt _\bd_\be_\bs_\bi_\bg_\bn_\ba_\bt_\bo_\br selects the event, the optional _\bw_\bo_\br_\bd _\bd_\be_\bs_\bi_\bg_\bn_\ba_\bt_\bo_\br se-
- lects words from the event, and various optional _\bm_\bo_\bd_\bi_\bf_\bi_\be_\br_\bs are avail-
- able to manipulate the selected words.
-
- History expansions are introduced by the appearance of the history ex-
- pansion character, which is !\b! 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 _\be_\bv_\be_\bn_\bt, and the portions of that entry
+ that are acted upon are _\bw_\bo_\br_\bd_\bs. The entry is split into words in the
+ same fashion as when reading input, so that several _\bm_\be_\bt_\ba_\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br-sepa-
+ rated words surrounded by quotes are considered one word. The _\be_\bv_\be_\bn_\bt
+ _\bd_\be_\bs_\bi_\bg_\bn_\ba_\bt_\bo_\br selects the event, the optional _\bw_\bo_\br_\bd _\bd_\be_\bs_\bi_\bg_\bn_\ba_\bt_\bo_\br selects
+ words from the event, and various optional _\bm_\bo_\bd_\bi_\bf_\bi_\be_\br_\bs are available to
+ manipulate the selected words.
+
+ History expansions are introduced by the appearance of the history ex-
+ pansion character, which is !\b! by default. History expansions may ap-
pear anywhere in the input, but do not nest.
- Only backslash (\\b\) and single quotes can quote the history expansion
- character, but the history expansion character is also treated as
+ Only backslash (\\b\) 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, =\b=, 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, =\b=, and the other shell metacharacters
defined above.
There is a special abbreviation for substitution, active when the _\bq_\bu_\bi_\bc_\bk
- _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\bt_\bi_\bo_\bn character (described above under h\bhi\bis\bst\btc\bch\bha\bar\brs\bs) is the first
+ _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\bt_\bi_\bo_\bn character (described above under h\bhi\bis\bst\btc\bch\bha\bar\brs\bs) is the first
character on the line. It selects the previous history entry, using an
- event designator equivalent to !\b!!\b!, and substitutes one string for an-
- other in that line. It is described below under E\bEv\bve\ben\bnt\bt D\bDe\bes\bsi\big\bgn\bna\bat\bto\bor\brs\bs.
+ event designator equivalent to !\b!!\b!, and substitutes one string for an-
+ other in that entry. It is described below under E\bEv\bve\ben\bnt\bt D\bDe\bes\bsi\big\bgn\bna\bat\bto\bor\brs\bs.
This is the only history expansion that does not begin with the history
expansion character.
- Several shell options settable with the s\bsh\bho\bop\bpt\bt builtin may be used to
- tailor the behavior of history expansion. If the h\bhi\bis\bst\btv\bve\ber\bri\bif\bfy\by shell op-
- tion is enabled (see the description of the s\bsh\bho\bop\bpt\bt builtin below), and
- r\bre\bea\bad\bdl\bli\bin\bne\be is being used, history substitutions are not immediately
- passed to the shell parser. Instead, the expanded line is reloaded
- into the r\bre\bea\bad\bdl\bli\bin\bne\be editing buffer for further modification. If r\bre\bea\bad\bdl\bli\bin\bne\be
- is being used, and the h\bhi\bis\bst\btr\bre\bee\bed\bdi\bit\bt shell option is enabled, a failed
- history substitution will be reloaded into the r\bre\bea\bad\bdl\bli\bin\bne\be editing buffer
- for correction. The -\b-p\bp option to the h\bhi\bis\bst\bto\bor\bry\by builtin command may be
- used to see what a history expansion will do before using it. The -\b-s\bs
- option to the h\bhi\bis\bst\bto\bor\bry\by 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 s\bsh\bho\bop\bpt\bt builtin will modify his-
+ tory expansion behavior (see the description of the s\bsh\bho\bop\bpt\bt builtin be-
+ low).and If the h\bhi\bis\bst\btv\bve\ber\bri\bif\bfy\by shell option is enabled, and r\bre\bea\bad\bdl\bli\bin\bne\be is be-
+ ing used, history substitutions are not immediately passed to the shell
+ parser. Instead, the expanded line is reloaded into the r\bre\bea\bad\bdl\bli\bin\bne\be edit-
+ ing buffer for further modification. If r\bre\bea\bad\bdl\bli\bin\bne\be is being used, and
+ the h\bhi\bis\bst\btr\bre\bee\bed\bdi\bit\bt shell option is enabled, a failed history substitution
+ is reloaded into the r\bre\bea\bad\bdl\bli\bin\bne\be editing buffer for correction.
+
+ The -\b-p\bp option to the h\bhi\bis\bst\bto\bor\bry\by builtin command shows what a history ex-
+ pansion will do before using it. The -\b-s\bs option to the h\bhi\bis\bst\bto\bor\bry\by 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 h\bhi\bis\bst\btc\bch\bha\bar\brs\bs above under S\bSh\bhe\bel\bll\bl
tory timestamps when writing the history file.
E\bEv\bve\ben\bnt\bt D\bDe\bes\bsi\big\bgn\bna\bat\bto\bor\brs\bs
- 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.
!\b! Start a history substitution, except when followed by a b\bbl\bla\ban\bnk\bk,
- newline, carriage return, = or ( (when the e\bex\bxt\btg\bgl\blo\bob\bb shell option
- is enabled using the s\bsh\bho\bop\bpt\bt builtin).
- !\b!_\bn Refer to command line _\bn.
- !\b!-\b-_\bn Refer to the current command minus _\bn.
+ newline, carriage return, = or, when the e\bex\bxt\btg\bgl\blo\bob\bb shell option is
+ enabled using the s\bsh\bho\bop\bpt\bt builtin, (.
+ !\b!_\bn Refer to history list entry _\bn.
+ !\b!-\b-_\bn Refer to the current entry minus _\bn.
!\b!!\b! Refer to the previous command. This is a synonym for "!-1".
!\b!_\bs_\bt_\br_\bi_\bn_\bg
- 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 _\bs_\bt_\br_\bi_\bn_\bg.
!\b!?\b?_\bs_\bt_\br_\bi_\bn_\bg[\b[?\b?]\b]
- Refer to the most recent command preceding the current position
- in the history list containing _\bs_\bt_\br_\bi_\bn_\bg. The trailing ?\b? may be
- omitted if _\bs_\bt_\br_\bi_\bn_\bg is followed immediately by a newline. If
- _\bs_\bt_\br_\bi_\bn_\bg 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 _\bs_\bt_\br_\bi_\bn_\bg. The trailing ?\b? may be
+ omitted if _\bs_\bt_\br_\bi_\bn_\bg is followed immediately by a newline. If
+ _\bs_\bt_\br_\bi_\bn_\bg is missing, this uses the string from the most recent
+ search; it is an error if there is no previous search string.
^\b^_\bs_\bt_\br_\bi_\bn_\bg_\b1^\b^_\bs_\bt_\br_\bi_\bn_\bg_\b2^\b^
- Quick substitution. Repeat the previous command, replacing
- _\bs_\bt_\br_\bi_\bn_\bg_\b1 with _\bs_\bt_\br_\bi_\bn_\bg_\b2. Equivalent to "!!:s^_\bs_\bt_\br_\bi_\bn_\bg_\b1^_\bs_\bt_\br_\bi_\bn_\bg_\b2^"
+ Quick substitution. Repeat the previous command, replacing
+ _\bs_\bt_\br_\bi_\bn_\bg_\b1 with _\bs_\bt_\br_\bi_\bn_\bg_\b2. Equivalent to "!!:s^_\bs_\bt_\br_\bi_\bn_\bg_\b1^_\bs_\bt_\br_\bi_\bn_\bg_\b2^"
(see M\bMo\bod\bdi\bif\bfi\bie\ber\brs\bs below).
!\b!#\b# The entire command line typed so far.
W\bWo\bor\brd\bd D\bDe\bes\bsi\big\bgn\bna\bat\bto\bor\brs\bs
- Word designators are used to select desired words from the event. A :\b:
- separates the event specification from the word designator. It may be
- omitted if the word designator begins with a ^\b^, $\b$, *\b*, -\b-, or %\b%. 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 :\b: separates the event specification from
+ the word designator. It may be omitted if the word designator begins
+ with a ^\b^, $\b$, *\b*, -\b-, or %\b%. 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.
0\b0 (\b(z\bze\ber\bro\bo)\b)
The zeroth word. For the shell, this is the command word.
_\bn The _\bnth word.
- ^\b^ The first argument. That is, word 1.
- $\b$ The last word. This is usually the last argument, but will ex-
+ ^\b^ The first argument: word 1.
+ $\b$ 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.
- %\b% The first word matched by the most recent "?_\bs_\bt_\br_\bi_\bn_\bg?'" 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
+ %\b% The first word matched by the most recent "?_\bs_\bt_\br_\bi_\bn_\bg?'" 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.
_\bx-\b-_\by A range of words; "-_\by" abbreviates "0-_\by".
- *\b* All of the words but the zeroth. This is a synonym for "_\b1_\b-_\b$".
- 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.
+ *\b* All of the words but the zeroth. This is a synonym for "_\b1_\b-_\b$".
+ It is not an error to use *\b* if there is just one word in the
+ event; it expands to the empty string in this case.
x\bx*\b* Abbreviates _\bx_\b-_\b$.
x\bx-\b- Abbreviates _\bx_\b-_\b$ like x\bx*\b*, but omits the last word. If x\bx 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 !\b!!\b!.
M\bMo\bod\bdi\bif\bfi\bie\ber\brs\bs
- 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.
h\bh Remove a trailing filename component, leaving only the head.
t\bt Remove all leading filename components, leaving the tail.
e\be Remove all but the trailing suffix.
p\bp Print the new command but do not execute it.
q\bq Quote the substituted words, escaping further substitutions.
- x\bx Quote the substituted words as with q\bq, but break into words at
- b\bbl\bla\ban\bnk\bks\bs and newlines. The q\bq and x\bx modifiers are mutually exclu-
- sive; the last one supplied is used.
+ x\bx Quote the substituted words as with q\bq, but break into words at
+ b\bbl\bla\ban\bnk\bks\bs and newlines. The q\bq and x\bx modifiers are mutually exclu-
+ sive; expansion uses the last one supplied.
s\bs/\b/_\bo_\bl_\bd/\b/_\bn_\be_\bw/\b/
- Substitute _\bn_\be_\bw for the first occurrence of _\bo_\bl_\bd in the event
+ Substitute _\bn_\be_\bw for the first occurrence of _\bo_\bl_\bd 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 _\bo_\bl_\bd and _\bn_\be_\bw with
- a single backslash. If & appears in _\bn_\be_\bw, it is replaced by _\bo_\bl_\bd.
- A single backslash will quote the &. If _\bo_\bl_\bd is null, it is set
- to the last _\bo_\bl_\bd substituted, or, if no previous history substi-
- tutions took place, the last _\bs_\bt_\br_\bi_\bn_\bg in a !\b!?\b?_\bs_\bt_\br_\bi_\bn_\bg[\b[?\b?]\b] search.
- If _\bn_\be_\bw is null, each matching _\bo_\bl_\bd 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
+ _\bo_\bl_\bd and _\bn_\be_\bw. If & appears in _\bn_\be_\bw, it is replaced with _\bo_\bl_\bd. A
+ single backslash will quote the &. If _\bo_\bl_\bd is null, it is set to
+ the last _\bo_\bl_\bd substituted, or, if no previous history substitu-
+ tions took place, the last _\bs_\bt_\br_\bi_\bn_\bg in a !\b!?\b?_\bs_\bt_\br_\bi_\bn_\bg[\b[?\b?]\b] search. If
+ _\bn_\be_\bw is null, each matching _\bo_\bl_\bd is deleted.
&\b& Repeat the previous substitution.
g\bg Cause changes to be applied over the entire event line. This is
used in conjunction with ":\b:s\bs" (e.g., ":\b:g\bgs\bs/\b/_\bo_\bl_\bd/\b/_\bn_\be_\bw/\b/") or ":\b:&\b&".
s\bso\bou\bur\brc\bce\be [-\b-p\bp _\bp_\ba_\bt_\bh] _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
The .\b. command (s\bso\bou\bur\brc\bce\be) reads and execute commands from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
in the current shell environment and returns the exit status of
- the last command executed from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be. If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be does not
- contain a slash, .\b. searchs for it. If the -\b-p\bp option is sup-
- plied, .\b. treats _\bp_\ba_\bt_\bh as a colon-separated list of directories
- in which to find _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be; otherwise, .\b. uses the entries in
- P\bPA\bAT\bTH\bH to find the directory containing _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be. _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be does
- not need to be executable. When b\bba\bas\bsh\bh is not in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, it
- searches the current directory if no file is found in P\bPA\bAT\bTH\bH, but
- does not search the current directory if -\b-p\bp is supplied. If the
- s\bso\bou\bur\brc\bce\bep\bpa\bat\bth\bh option to the s\bsh\bho\bop\bpt\bt builtin command is turned off, .\b.
- does not search P\bPA\bAT\bTH\bH. If any _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs are supplied, they be-
- come the positional parameters when _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is executed. Oth-
- erwise the positional parameters are unchanged. If the -\b-T\bT op-
- tion is enabled, .\b. inherits any trap on D\bDE\bEB\bBU\bUG\bG; if it is not, any
- D\bDE\bEB\bBU\bUG\bG trap string is saved and restored around the call to .\b.,
- and .\b. unsets the D\bDE\bEB\bBU\bUG\bG trap while it executes. If -\b-T\bT is not
- set, and the sourced file changes the D\bDE\bEB\bBU\bUG\bG trap, the new value
- is retained when .\b. completes. The return status is the status
- of the last command exited within the script (0 if no commands
- are executed), and false if _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is not found or cannot be
- read.
+ the last command executed from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be.
+
+ If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be does not contain a slash, .\b. searchs for it. If the
+ -\b-p\bp option is supplied, .\b. treats _\bp_\ba_\bt_\bh as a colon-separated list
+ of directories in which to find _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be; otherwise, .\b. uses the
+ entries in P\bPA\bAT\bTH\bH to find the directory containing _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be.
+ _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be does not need to be executable. When b\bba\bas\bsh\bh is not in
+ _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, it searches the current directory if _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is not
+ found in P\bPA\bAT\bTH\bH, but does not search the current directory if -\b-p\bp
+ is supplied. If the s\bso\bou\bur\brc\bce\bep\bpa\bat\bth\bh option to the s\bsh\bho\bop\bpt\bt builtin com-
+ mand is turned off, .\b. does not search P\bPA\bAT\bTH\bH.
+
+ If any _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs are supplied, they become the positional para-
+ meters when _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is executed. Otherwise the positional pa-
+ rameters are unchanged.
+
+ If the -\b-T\bT option is enabled, .\b. inherits any trap on D\bDE\bEB\bBU\bUG\bG; if it
+ is not, any D\bDE\bEB\bBU\bUG\bG trap string is saved and restored around the
+ call to .\b., and .\b. unsets the D\bDE\bEB\bBU\bUG\bG trap while it executes. If -\b-T\bT
+ is not set, and the sourced file changes the D\bDE\bEB\bBU\bUG\bG trap, the new
+ value persists after .\b. completes. The return status is the sta-
+ tus of the last command executed from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be (0 if no commands
+ are executed), and non-zero if _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is not found or cannot
+ be read.
a\bal\bli\bia\bas\bs [-\b-p\bp] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ...]
- A\bAl\bli\bia\bas\bs with no arguments or with the -\b-p\bp option prints the list of
- aliases in the form a\bal\bli\bia\bas\bs _\bn_\ba_\bm_\be=_\bv_\ba_\bl_\bu_\be on standard output. When
- arguments are supplied, an alias is defined for each _\bn_\ba_\bm_\be whose
- _\bv_\ba_\bl_\bu_\be is given. A trailing space in _\bv_\ba_\bl_\bu_\be causes the next word
- to be checked for alias substitution when the alias is expanded.
- For each _\bn_\ba_\bm_\be in the argument list for which no _\bv_\ba_\bl_\bu_\be is sup-
- plied, the name and value of the alias is printed. A\bAl\bli\bia\bas\bs re-
- turns true unless a _\bn_\ba_\bm_\be is given for which no alias has been
- defined.
+ With no arguments or with the -\b-p\bp option,a\bal\bli\bia\bas\bs prints the list of
+ aliases in the form a\bal\bli\bia\bas\bs _\bn_\ba_\bm_\be=_\bv_\ba_\bl_\bu_\be on standard output. When
+ arguments are supplied, define an alias for each _\bn_\ba_\bm_\be whose
+ _\bv_\ba_\bl_\bu_\be is given. A trailing space in _\bv_\ba_\bl_\bu_\be causes the next word
+ to be checked for alias substitution when the alias is expanded
+ during command parsing. For each _\bn_\ba_\bm_\be in the argument list for
+ which no _\bv_\ba_\bl_\bu_\be is supplied, print the name and value of the
+ alias _\bn_\ba_\bm_\be. a\bal\bli\bia\bas\bs returns true unless a _\bn_\ba_\bm_\be is given (without
+ a corresponding =_\bv_\ba_\bl_\bu_\be) for which no alias has been defined.
b\bbg\bg [_\bj_\bo_\bb_\bs_\bp_\be_\bc ...]
Resume each suspended job _\bj_\bo_\bb_\bs_\bp_\be_\bc in the background, as if it
b\bbi\bin\bnd\bd [-\b-m\bm _\bk_\be_\by_\bm_\ba_\bp] _\bk_\be_\by_\bs_\be_\bq:_\br_\be_\ba_\bd_\bl_\bi_\bn_\be_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd
b\bbi\bin\bnd\bd _\br_\be_\ba_\bd_\bl_\bi_\bn_\be_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b-_\bl_\bi_\bn_\be
Display current r\bre\bea\bad\bdl\bli\bin\bne\be key and function bindings, bind a key
- sequence to a r\bre\bea\bad\bdl\bli\bin\bne\be function or macro, or set a r\bre\bea\bad\bdl\bli\bin\bne\be
- variable. Each non-option argument is a command as it would ap-
- pear in a r\bre\bea\bad\bdl\bli\bin\bne\be initialization file such as _\b._\bi_\bn_\bp_\bu_\bt_\br_\bc, 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 r\bre\bea\bad\bdl\bli\bin\bne\be initialization file or
- that would be supplied as individual arguments to a b\bbi\bin\bnd\bd com-
- mand. Options, if supplied, have the following meanings:
+ sequence to a r\bre\bea\bad\bdl\bli\bin\bne\be function or macro or to a shell command,
+ or set a r\bre\bea\bad\bdl\bli\bin\bne\be variable. Each non-option argument is a key
+ binding or command as it would appear in a r\bre\bea\bad\bdl\bli\bin\bne\be initializa-
+ tion file such as _\b._\bi_\bn_\bp_\bu_\bt_\br_\bc, 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 r\bre\bea\bad\bdl\bli\bin\bne\be initialization file or that would be supplied
+ as individual arguments to a b\bbi\bin\bnd\bd command. Options, if sup-
+ plied, have the following meanings:
-\b-m\bm _\bk_\be_\by_\bm_\ba_\bp
Use _\bk_\be_\by_\bm_\ba_\bp as the keymap to be affected by the subsequent
bindings. Acceptable _\bk_\be_\by_\bm_\ba_\bp names are _\be_\bm_\ba_\bc_\bs_\b, _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\b-
- _\bd_\ba_\br_\bd_\b, _\be_\bm_\ba_\bc_\bs_\b-_\bm_\be_\bt_\ba_\b, _\be_\bm_\ba_\bc_\bs_\b-_\bc_\bt_\bl_\bx_\b, _\bv_\bi_\b, _\bv_\bi_\b-_\bm_\bo_\bv_\be_\b, _\bv_\bi_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd,
- and _\bv_\bi_\b-_\bi_\bn_\bs_\be_\br_\bt. _\bv_\bi is equivalent to _\bv_\bi_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd (_\bv_\bi_\b-_\bm_\bo_\bv_\be
- is also a synonym); _\be_\bm_\ba_\bc_\bs is equivalent to _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\b-
+ _\bd_\ba_\br_\bd_\b, _\be_\bm_\ba_\bc_\bs_\b-_\bm_\be_\bt_\ba_\b, _\be_\bm_\ba_\bc_\bs_\b-_\bc_\bt_\bl_\bx_\b, _\bv_\bi_\b, _\bv_\bi_\b-_\bm_\bo_\bv_\be_\b, _\bv_\bi_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd,
+ and _\bv_\bi_\b-_\bi_\bn_\bs_\be_\br_\bt. _\bv_\bi is equivalent to _\bv_\bi_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd (_\bv_\bi_\b-_\bm_\bo_\bv_\be
+ is also a synonym); _\be_\bm_\ba_\bc_\bs is equivalent to _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\b-
_\bd_\ba_\br_\bd.
-\b-l\bl List the names of all r\bre\bea\bad\bdl\bli\bin\bne\be functions.
- -\b-p\bp Display r\bre\bea\bad\bdl\bli\bin\bne\be function names and bindings in such a
- way that they can be re-read. If arguments remain after
- option processing, b\bbi\bin\bnd\bd treats them as readline command
- names and restricts output to those names.
- -\b-P\bP List current r\bre\bea\bad\bdl\bli\bin\bne\be function names and bindings. If
+ -\b-p\bp Display r\bre\bea\bad\bdl\bli\bin\bne\be function names and bindings in such a
+ way that they can be used as an argument to a subsequent
+ b\bbi\bin\bnd\bd command or in a r\bre\bea\bad\bdl\bli\bin\bne\be initialization file. If
arguments remain after option processing, b\bbi\bin\bnd\bd treats
them as readline command names and restricts output to
those names.
- -\b-s\bs Display r\bre\bea\bad\bdl\bli\bin\bne\be key sequences bound to macros and the
- strings they output in such a way that they can be re-
- read.
- -\b-S\bS Display r\bre\bea\bad\bdl\bli\bin\bne\be key sequences bound to macros and the
+ -\b-P\bP List current r\bre\bea\bad\bdl\bli\bin\bne\be function names and bindings. If
+ arguments remain after option processing, b\bbi\bin\bnd\bd treats
+ them as readline command names and restricts output to
+ those names.
+ -\b-s\bs Display r\bre\bea\bad\bdl\bli\bin\bne\be 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 b\bbi\bin\bnd\bd command or in a r\bre\bea\bad\bd-\b-
+ l\bli\bin\bne\be initialization file.
+ -\b-S\bS Display r\bre\bea\bad\bdl\bli\bin\bne\be key sequences bound to macros and the
strings they output.
- -\b-v\bv Display r\bre\bea\bad\bdl\bli\bin\bne\be variable names and values in such a way
- that they can be re-read.
+ -\b-v\bv Display r\bre\bea\bad\bdl\bli\bin\bne\be variable names and values in such a way
+ that they can be used as an argument to a subsequent b\bbi\bin\bnd\bd
+ command or in a r\bre\bea\bad\bdl\bli\bin\bne\be initialization file.
-\b-V\bV List current r\bre\bea\bad\bdl\bli\bin\bne\be variable names and values.
-\b-f\bf _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
Read key bindings from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be.
-\b-q\bq _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn
- Query about which keys invoke the named _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn.
+ Display key sequences that invoke the named r\bre\bea\bad\bdl\bli\bin\bne\be
+ _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn.
-\b-u\bu _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn
- Unbind all keys bound to the named _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn.
+ Unbind all key sequences bound to the named r\bre\bea\bad\bdl\bli\bin\bne\be
+ _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn.
-\b-r\br _\bk_\be_\by_\bs_\be_\bq
Remove any current binding for _\bk_\be_\by_\bs_\be_\bq.
-\b-x\bx _\bk_\be_\by_\bs_\be_\bq[\b[:\b: ]\b]_\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd
Cause _\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd to be executed whenever _\bk_\be_\by_\bs_\be_\bq is en-
tered. The separator between _\bk_\be_\by_\bs_\be_\bq and _\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd is
- either whitespace or a colon optionally followed by
- whitespace. If the separator is whitespace, _\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\b-
- _\bm_\ba_\bn_\bd must be enclosed in double quotes and r\bre\bea\bad\bdl\bli\bin\bne\be ex-
- pands any of its special backslash-escapes in _\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\b-
- _\bm_\ba_\bn_\bd before saving it. If the separator is a colon, any
- enclosing double quotes are optional, and r\bre\bea\bad\bdl\bli\bin\bne\be 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 _\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\b-
- _\bm_\ba_\bn_\bd is executed, the shell sets the R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_L\bLI\bIN\bNE\bE vari-
- able to the contents of the r\bre\bea\bad\bdl\bli\bin\bne\be line buffer and the
- R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_P\bPO\bOI\bIN\bNT\bT and R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_M\bMA\bAR\bRK\bK 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 R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_A\bAR\bRG\bGU\bU-\b-
- M\bME\bEN\bNT\bT variable. If there was no argument, that variable
- is not set. If the executed command changes the value of
- any of R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_L\bLI\bIN\bNE\bE, R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_P\bPO\bOI\bIN\bNT\bT, or R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_M\bMA\bAR\bRK\bK,
- those new values will be reflected in the editing state.
- -\b-X\bX 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, _\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\b-
+ _\bm_\ba_\bn_\bd must be enclosed in double quotes and r\bre\bea\bad\bdl\bli\bin\bne\be ex-
+ pands any of its special backslash-escapes in _\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\b-
+ _\bm_\ba_\bn_\bd before saving it. If the separator is a colon, any
+ enclosing double quotes are optional, and r\bre\bea\bad\bdl\bli\bin\bne\be 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
+ _\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd is executed, the shell sets the R\bRE\bEA\bAD\bD-\b-
+ L\bLI\bIN\bNE\bE_\b_L\bLI\bIN\bNE\bE variable to the contents of the r\bre\bea\bad\bdl\bli\bin\bne\be line
+ buffer and the R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_P\bPO\bOI\bIN\bNT\bT and R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_M\bMA\bAR\bRK\bK 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 R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_A\bAR\bRG\bGU\bUM\bME\bEN\bNT\bT variable. If there was no argu-
+ ment, that variable is not set. If the executed command
+ changes the value of any of R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_L\bLI\bIN\bNE\bE, R\bRE\bEA\bAD\bD-\b-
+ L\bLI\bIN\bNE\bE_\b_P\bPO\bOI\bIN\bNT\bT, or R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_M\bMA\bAR\bRK\bK, those new values will be
+ reflected in the editing state.
+ -\b-X\bX 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.
b\bbr\bre\bea\bak\bk [_\bn]
Exit from within a f\bfo\bor\br, w\bwh\bhi\bil\ble\be, u\bun\bnt\bti\bil\bl, or s\bse\bel\ble\bec\bct\bt loop. If _\bn is
- specified, break _\bn levels. _\bn must be >= 1. If _\bn is greater
- than the number of enclosing loops, all enclosing loops are ex-
- ited. The return value is 0 unless _\bn is not greater than or
- equal to 1.
+ specified, b\bbr\bre\bea\bak\bk exits _\bn enclosing loops. _\bn must be >= 1. If _\bn
+ is greater than the number of enclosing loops, all enclosing
+ loops are exited. The return value is 0 unless _\bn is not greater
+ than or equal to 1.
b\bbu\bui\bil\blt\bti\bin\bn _\bs_\bh_\be_\bl_\bl_\b-_\bb_\bu_\bi_\bl_\bt_\bi_\bn [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
- Execute the specified shell builtin, passing it _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs, 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 c\bcd\bd builtin is
- commonly redefined this way. The return status is false if
- _\bs_\bh_\be_\bl_\bl_\b-_\bb_\bu_\bi_\bl_\bt_\bi_\bn is not a shell builtin command.
+ Execute the specified shell builtin _\bs_\bh_\be_\bl_\bl_\b-_\bb_\bu_\bi_\bl_\bt_\bi_\bn, passing it
+ _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs, 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 c\bcd\bd builtin is commonly redefined this way. The return sta-
+ tus is false if _\bs_\bh_\be_\bl_\bl_\b-_\bb_\bu_\bi_\bl_\bt_\bi_\bn is not a shell builtin command.
c\bca\bal\bll\ble\ber\br [_\be_\bx_\bp_\br]
Returns the context of any active subroutine call (a shell func-
- tion or a script executed with the .\b. or s\bso\bou\bur\brc\bce\be builtins). With-
- out _\be_\bx_\bp_\br, c\bca\bal\bll\ble\ber\br displays the line number and source filename of
- the current subroutine call. If a non-negative integer is sup-
- plied as _\be_\bx_\bp_\br, c\bca\bal\bll\ble\ber\br 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 _\be_\bx_\bp_\br does not correspond to a valid position in
+ tion or a script executed with the .\b. or s\bso\bou\bur\brc\bce\be builtins).
+
+ Without _\be_\bx_\bp_\br, c\bca\bal\bll\ble\ber\br displays the line number and source file-
+ name of the current subroutine call. If a non-negative integer
+ is supplied as _\be_\bx_\bp_\br, c\bca\bal\bll\ble\ber\br 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 _\be_\bx_\bp_\br does not correspond to a valid position in
the call stack.
c\bcd\bd [-\b-L\bL|[-\b-P\bP [-\b-e\be]]] [-@] [_\bd_\bi_\br]
- Change the current directory to _\bd_\bi_\br. if _\bd_\bi_\br is not supplied,
- the value of the H\bHO\bOM\bME\bE shell variable is the default. The vari-
- able C\bCD\bDP\bPA\bAT\bTH\bH defines the search path for the directory containing
- _\bd_\bi_\br: the shell searches each directory name in C\bCD\bDP\bPA\bAT\bTH\bH for _\bd_\bi_\br.
- Alternative directory names in C\bCD\bDP\bPA\bAT\bTH\bH are separated by a colon
- (:). A null directory name in C\bCD\bDP\bPA\bAT\bTH\bH is the same as the current
- directory, i.e., ".". If _\bd_\bi_\br begins with a slash (/), then C\bCD\bD-\b-
- P\bPA\bAT\bTH\bH is not used. The -\b-P\bP option causes c\bcd\bd to use the physical
- directory structure by resolving symbolic links while traversing
- _\bd_\bi_\br and before processing instances of _\b._\b. in _\bd_\bi_\br (see also the
- -\b-P\bP option to the s\bse\bet\bt builtin command); the -\b-L\bL option forces sym-
- bolic links to be followed by resolving the link after process-
- ing instances of _\b._\b. in _\bd_\bi_\br. If _\b._\b. appears in _\bd_\bi_\br, it is
- processed by removing the immediately previous pathname compo-
- nent from _\bd_\bi_\br, back to a slash or the beginning of _\bd_\bi_\br. If the
- -\b-e\be option is supplied with -\b-P\bP, and the current working directory
- cannot be successfully determined after a successful directory
- change, c\bcd\bd will return an unsuccessful status. On systems that
- support it, the -\b-@\b@ option presents the extended attributes asso-
- ciated with a file as a directory. An argument of -\b- is con-
- verted to $\b$O\bOL\bLD\bDP\bPW\bWD\bD before the directory change is attempted. If
- a non-empty directory name from C\bCD\bDP\bPA\bAT\bTH\bH is used, or if -\b- 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, c\bcd\bd sets
- the value of the P\bPW\bWD\bD environment variable to the new directory
- name, and sets the O\bOL\bLD\bDP\bPW\bWD\bD 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 _\bd_\bi_\br. if _\bd_\bi_\br is not supplied,
+ the value of the H\bHO\bOM\bME\bE shell variable is used as _\bd_\bi_\br. The vari-
+ able C\bCD\bDP\bPA\bAT\bTH\bH exists, c\bcd\bd uses it as a search path: the shell
+ searches each directory name in C\bCD\bDP\bPA\bAT\bTH\bH for _\bd_\bi_\br. Alternative di-
+ rectory names in C\bCD\bDP\bPA\bAT\bTH\bH are separated by a colon (:). A null
+ directory name in C\bCD\bDP\bPA\bAT\bTH\bH is the same as the current directory,
+ i.e., ".". If _\bd_\bi_\br begins with a slash (/), then C\bCD\bDP\bPA\bAT\bTH\bH is not
+ used.
+
+ The -\b-P\bP option causes c\bcd\bd to use the physical directory structure
+ by resolving symbolic links while traversing _\bd_\bi_\br and before pro-
+ cessing instances of _\b._\b. in _\bd_\bi_\br (see also the -\b-P\bP option to the
+ s\bse\bet\bt builtin command).
+
+ The -\b-L\bL option forces symbolic links to be followed by resolving
+ the link after processing instances of _\b._\b. in _\bd_\bi_\br. If _\b._\b. appears
+ in _\bd_\bi_\br, it is processed by removing the immediately previous
+ pathname component from _\bd_\bi_\br, back to a slash or the beginning of
+ _\bd_\bi_\br.
+
+ If the -\b-e\be option is supplied with -\b-P\bP, and the current working
+ directory cannot be successfully determined after a successful
+ directory change, c\bcd\bd will return a non-zero status.
+
+ On systems that support it, the -\b-@\b@ option presents the extended
+ attributes associated with a file as a directory.
+
+ An argument of -\b- is converted to $\b$O\bOL\bLD\bDP\bPW\bWD\bD before attempting the
+ directory change.
+
+ If c\bcd\bd uses a non-empty directory name from C\bCD\bDP\bPA\bAT\bTH\bH,\b, or if -\b- is
+ the first argument, and the directory change is successful, c\bcd\bd
+ writes the absolute pathname of the new working directory to the
+ standard output.
+
+ If the directory change is successful, c\bcd\bd sets the value of the
+ P\bPW\bWD\bD environment variable to the new directory name, and sets the
+ O\bOL\bLD\bDP\bPW\bWD\bD 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.
c\bco\bom\bmm\bma\ban\bnd\bd [-\b-p\bpV\bVv\bv] _\bc_\bo_\bm_\bm_\ba_\bn_\bd [_\ba_\br_\bg ...]
- Run _\bc_\bo_\bm_\bm_\ba_\bn_\bd with _\ba_\br_\bg_\bs suppressing the normal shell function
- lookup. Only builtin commands or commands found in the P\bPA\bAT\bTH\bH are
- executed. If the -\b-p\bp option is given, the search for _\bc_\bo_\bm_\bm_\ba_\bn_\bd is
- performed using a default value for P\bPA\bAT\bTH\bH that is guaranteed to
- find all of the standard utilities. If either the -\b-V\bV or -\b-v\bv op-
- tion is supplied, a description of _\bc_\bo_\bm_\bm_\ba_\bn_\bd is printed. The -\b-v\bv
- option causes a single word indicating the command or filename
- used to invoke _\bc_\bo_\bm_\bm_\ba_\bn_\bd to be displayed; the -\b-V\bV option produces a
- more verbose description. If the -\b-V\bV or -\b-v\bv option is supplied,
- the exit status is 0 if _\bc_\bo_\bm_\bm_\ba_\bn_\bd was found, and 1 if not. If
- neither option is supplied and an error occurred or _\bc_\bo_\bm_\bm_\ba_\bn_\bd can-
- not be found, the exit status is 127. Otherwise, the exit sta-
- tus of the c\bco\bom\bmm\bma\ban\bnd\bd builtin is the exit status of _\bc_\bo_\bm_\bm_\ba_\bn_\bd.
+ The c\bco\bom\bmm\bma\ban\bnd\bd builtin runs _\bc_\bo_\bm_\bm_\ba_\bn_\bd with _\ba_\br_\bg_\bs suppressing the nor-
+ mal shell function lookup for _\bc_\bo_\bm_\bm_\ba_\bn_\bd. Only builtin commands or
+ commands found in the P\bPA\bAT\bTH\bH named _\bc_\bo_\bm_\bm_\ba_\bn_\bd are executed. If the
+ -\b-p\bp option is supplied, the search for _\bc_\bo_\bm_\bm_\ba_\bn_\bd is performed using
+ a default value for P\bPA\bAT\bTH\bH that is guaranteed to find all of the
+ standard utilities.
+
+ If either the -\b-V\bV or -\b-v\bv option is supplied, c\bco\bom\bmm\bma\ban\bnd\bd prints a de-
+ scription of _\bc_\bo_\bm_\bm_\ba_\bn_\bd. The -\b-v\bv option displays a single word in-
+ dicating the command or filename used to invoke _\bc_\bo_\bm_\bm_\ba_\bn_\bd; the -\b-V\bV
+ option produces a more verbose description.
+
+ If the -\b-V\bV or -\b-v\bv option is supplied, the exit status is zero if
+ _\bc_\bo_\bm_\bm_\ba_\bn_\bd was found, and non-zero if not. If neither option is
+ supplied and an error occurred or _\bc_\bo_\bm_\bm_\ba_\bn_\bd cannot be found, the
+ exit status is 127. Otherwise, the exit status of the c\bco\bom\bmm\bma\ban\bnd\bd
+ builtin is the exit status of _\bc_\bo_\bm_\bm_\ba_\bn_\bd.
c\bco\bom\bmp\bpg\bge\ben\bn [-\b-V\bV _\bv_\ba_\br_\bn_\ba_\bm_\be] [_\bo_\bp_\bt_\bi_\bo_\bn] [_\bw_\bo_\br_\bd]
- Generate possible completion matches for _\bw_\bo_\br_\bd according to the
- _\bo_\bp_\bt_\bi_\bo_\bns, which may be any option accepted by the c\bco\bom\bmp\bpl\ble\bet\bte\be
+ Generate possible completion matches for _\bw_\bo_\br_\bd according to the
+ _\bo_\bp_\bt_\bi_\bo_\bns, which may be any option accepted by the c\bco\bom\bmp\bpl\ble\bet\bte\be
builtin with the exceptions of -\b-p\bp, -\b-r\br, -\b-D\bD, -\b-E\bE, and -\b-I\bI, and write
- the matches to the standard output. If the -\b-V\bV option is sup-
- plied, c\bco\bom\bmp\bpg\bge\ben\bn stores the generated completions into the indexed
- array variable _\bv_\ba_\br_\bn_\ba_\bm_\be instead of writing them to the standard
- output. When using the -\b-F\bF or -\b-C\bC 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 -\b-V\bV option is supplied, c\bco\bom\bmp\bpg\bge\ben\bn stores the generated com-
+ pletions into the indexed array variable _\bv_\ba_\br_\bn_\ba_\bm_\be instead of
+ writing them to the standard output.
+
+ When using the -\b-F\bF or -\b-C\bC 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 _\bw_\bo_\br_\bd is specified,
- only those completions matching _\bw_\bo_\br_\bd will be displayed.
+ tion specification with the same flags. If _\bw_\bo_\br_\bd is specified,
+ only those completions matching _\bw_\bo_\br_\bd will be displayed or
+ stored.
The return value is true unless an invalid option is supplied,
or no matches were generated.
line.
p\bpl\blu\bus\bsd\bdi\bir\brs\bs
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.
-\b-A\bA _\ba_\bc_\bt_\bi_\bo_\bn
The _\ba_\bc_\bt_\bi_\bo_\bn may be one of the following to generate a
list of possible completions:
guments are being completed, the second argument ($\b$2\b2) is
the word being completed, and the third argument ($\b$3\b3) 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 C\bCO\bOM\bMP\bPR\bRE\bEP\bPL\bLY\bY
- array variable.
+ rent command line. When _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn finishes, the possible
+ completions are retrieved from the value of the C\bCO\bOM\bMP\bPR\bRE\bE-\b-
+ P\bPL\bLY\bY array variable.
-\b-G\bG _\bg_\bl_\bo_\bb_\bp_\ba_\bt
- The pathname expansion pattern _\bg_\bl_\bo_\bb_\bp_\ba_\bt is expanded to
- generate the possible completions.
+ Expand the pathname expansion pattern _\bg_\bl_\bo_\bb_\bp_\ba_\bt to gener-
+ ate the possible completions.
-\b-P\bP _\bp_\br_\be_\bf_\bi_\bx
- _\bp_\br_\be_\bf_\bi_\bx is added at the beginning of each possible com-
- pletion after all other options have been applied.
+ Add _\bp_\br_\be_\bf_\bi_\bx to the beginning of each possible completion
+ after all other options have been applied.
-\b-S\bS _\bs_\bu_\bf_\bf_\bi_\bx
- _\bs_\bu_\bf_\bf_\bi_\bx is appended to each possible completion after all
+ Append _\bs_\bu_\bf_\bf_\bi_\bx to each possible completion after all
other options have been applied.
-\b-W\bW _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt
The _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt is split using the characters in the I\bIF\bFS\bS
- special variable as delimiters, and each resultant word
+ special variable as delimiters, and each resulting word
is expanded. Shell quoting is honored within _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt,
in order to provide a mechanism for the words to contain
shell metacharacters or characters in the value of I\bIF\bFS\bS.
c\bco\bom\bmp\bpo\bop\bpt\bt [-\b-o\bo _\bo_\bp_\bt_\bi_\bo_\bn] [-\b-D\bDE\bEI\bI] [+\b+o\bo _\bo_\bp_\bt_\bi_\bo_\bn] [_\bn_\ba_\bm_\be]
Modify completion options for each _\bn_\ba_\bm_\be according to the _\bo_\bp_\b-
_\bt_\bi_\bo_\bns, or for the currently-executing completion if no _\bn_\ba_\bm_\bes are
- supplied. If no _\bo_\bp_\bt_\bi_\bo_\bns are given, display the completion op-
- tions for each _\bn_\ba_\bm_\be or the current completion. The possible
+ supplied. If no _\bo_\bp_\bt_\bi_\bo_\bns are supplied, display the completion
+ options for each _\bn_\ba_\bm_\be or the current completion. The possible
values of _\bo_\bp_\bt_\bi_\bo_\bn are those valid for the c\bco\bom\bmp\bpl\ble\bet\bte\be builtin de-
scribed above. The -\b-D\bD option indicates that other supplied op-
tions should apply to the "default" command completion; that is,
mand delimiter such as ;\b; or |\b|, which is usually command name
completion.
+ If multiple options are supplied, the -\b-D\bD option takes precedence
+ over -\b-E\bE, and both take precedence over -\b-I\bI.
+
The return value is true unless an invalid option is supplied,
an attempt is made to modify the options for a _\bn_\ba_\bm_\be for which no
completion specification exists, or an output error occurs.
c\bco\bon\bnt\bti\bin\bnu\bue\be [_\bn]
- Resume the next iteration of the enclosing f\bfo\bor\br, w\bwh\bhi\bil\ble\be, u\bun\bnt\bti\bil\bl, or
- s\bse\bel\ble\bec\bct\bt loop. If _\bn is specified, resume at the _\bnth enclosing
- loop. _\bn must be >= 1. If _\bn 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 _\bn is not
- greater than or equal to 1.
+ c\bco\bon\bnt\bti\bin\bnu\bue\be resumes the next iteration of the enclosing f\bfo\bor\br, w\bwh\bhi\bil\ble\be,
+ u\bun\bnt\bti\bil\bl, or s\bse\bel\ble\bec\bct\bt loop. If _\bn is specified, b\bba\bas\bsh\bh resumes the _\bnth
+ enclosing loop. _\bn must be >= 1. If _\bn 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 _\bn is
+ not greater than or equal to 1.
d\bde\bec\bcl\bla\bar\bre\be [-\b-a\baA\bAf\bfF\bFg\bgi\biI\bIl\bln\bnr\brt\btu\bux\bx] [-\b-p\bp] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ...]
t\bty\byp\bpe\bes\bse\bet\bt [-\b-a\baA\bAf\bfF\bFg\bgi\biI\bIl\bln\bnr\brt\btu\bux\bx] [-\b-p\bp] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ...]
Declare variables and/or give them attributes. If no _\bn_\ba_\bm_\bes are
- given then display the values of variables. The -\b-p\bp option will
- display the attributes and values of each _\bn_\ba_\bm_\be. When -\b-p\bp is used
- with _\bn_\ba_\bm_\be arguments, additional options, other than -\b-f\bf and -\b-F\bF,
- are ignored. When -\b-p\bp is supplied without _\bn_\ba_\bm_\be 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 -\b-p\bp, d\bde\bec\bcl\bla\bar\bre\be will display the attrib-
- utes and values of all shell variables. The -\b-f\bf option will re-
- strict the display to shell functions. The -\b-F\bF option inhibits
- the display of function definitions; only the function name and
- attributes are printed. If the e\bex\bxt\btd\bde\beb\bbu\bug\bg shell option is enabled
- using s\bsh\bho\bop\bpt\bt, the source file name and line number where each
- _\bn_\ba_\bm_\be is defined are displayed as well. The -\b-F\bF option implies
- -\b-f\bf. The -\b-g\bg option forces variables to be created or modified at
- the global scope, even when d\bde\bec\bcl\bla\bar\bre\be is executed in a shell func-
- tion. It is ignored in all other cases. The -\b-I\bI option causes
- local variables to inherit the attributes (except the _\bn_\ba_\bm_\be_\br_\be_\bf
- attribute) and value of any existing variable with the same _\bn_\ba_\bm_\be
- 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:
- -\b-a\ba Each _\bn_\ba_\bm_\be is an indexed array variable (see A\bAr\brr\bra\bay\bys\bs
+ given then display the values of variables or functions. The -\b-p\bp
+ option will display the attributes and values of each _\bn_\ba_\bm_\be.
+ When -\b-p\bp is used with _\bn_\ba_\bm_\be arguments, additional options, other
+ than -\b-f\bf and -\b-F\bF, are ignored.
+
+ When -\b-p\bp is supplied without _\bn_\ba_\bm_\be arguments, d\bde\bec\bcl\bla\bar\bre\be will display
+ the attributes and values of all variables having the attributes
+ specified by the additional options. If no other options are
+ supplied with -\b-p\bp, d\bde\bec\bcl\bla\bar\bre\be will display the attributes and values
+ of all shell variables. The -\b-f\bf option restricts the display to
+ shell functions.
+
+ The -\b-F\bF option inhibits the display of function definitions; only
+ the function name and attributes are printed. If the e\bex\bxt\btd\bde\beb\bbu\bug\bg
+ shell option is enabled using s\bsh\bho\bop\bpt\bt, the source file name and
+ line number where each _\bn_\ba_\bm_\be is defined are displayed as well.
+ The -\b-F\bF option implies -\b-f\bf.
+
+ The -\b-g\bg option forces variables to be created or modified at the
+ global scope, even when d\bde\bec\bcl\bla\bar\bre\be is executed in a shell function.
+ It is ignored when d\bde\bec\bcl\bla\bar\bre\be is not executed in a shell function.
+
+ The -\b-I\bI option causes local variables to inherit the attributes
+ (except the _\bn_\ba_\bm_\be_\br_\be_\bf attribute) and value of any existing vari-
+ able with the same _\bn_\ba_\bm_\be 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:
+ -\b-a\ba Each _\bn_\ba_\bm_\be is an indexed array variable (see A\bAr\brr\bra\bay\bys\bs
above).
- -\b-A\bA Each _\bn_\ba_\bm_\be is an associative array variable (see A\bAr\brr\bra\bay\bys\bs
+ -\b-A\bA Each _\bn_\ba_\bm_\be is an associative array variable (see A\bAr\brr\bra\bay\bys\bs
above).
- -\b-f\bf Use function names only.
+ -\b-f\bf Each _\bn_\ba_\bm_\be refers to a shell function.
-\b-i\bi The variable is treated as an integer; arithmetic evalua-
- tion (see A\bAR\bRI\bIT\bTH\bHM\bME\bET\bTI\bIC\bC E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN above) is performed when
+ tion (see A\bAR\bRI\bIT\bTH\bHM\bME\bET\bTI\bIC\bC E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN above) is performed when
the variable is assigned a value.
- -\b-l\bl When the variable is assigned a value, all upper-case
- characters are converted to lower-case. The upper-case
+ -\b-l\bl When the variable is assigned a value, all upper-case
+ characters are converted to lower-case. The upper-case
attribute is disabled.
- -\b-n\bn Give each _\bn_\ba_\bm_\be the _\bn_\ba_\bm_\be_\br_\be_\bf attribute, making it a name
- reference to another variable. That other variable is
- defined by the value of _\bn_\ba_\bm_\be. All references, assign-
- ments, and attribute modifications to _\bn_\ba_\bm_\be, except those
- using or changing the -\b-n\bn attribute itself, are performed
- on the variable referenced by _\bn_\ba_\bm_\be's value. The nameref
+ -\b-n\bn Give each _\bn_\ba_\bm_\be the _\bn_\ba_\bm_\be_\br_\be_\bf attribute, making it a name
+ reference to another variable. That other variable is
+ defined by the value of _\bn_\ba_\bm_\be. All references, assign-
+ ments, and attribute modifications to _\bn_\ba_\bm_\be, except those
+ using or changing the -\b-n\bn attribute itself, are performed
+ on the variable referenced by _\bn_\ba_\bm_\be's value. The nameref
attribute cannot be applied to array variables.
-\b-r\br Make _\bn_\ba_\bm_\bes readonly. These names cannot then be assigned
values by subsequent assignment statements or unset.
-\b-t\bt Give each _\bn_\ba_\bm_\be the _\bt_\br_\ba_\bc_\be attribute. Traced functions in-
- herit the D\bDE\bEB\bBU\bUG\bG and R\bRE\bET\bTU\bUR\bRN\bN traps from the calling shell.
+ herit the D\bDE\bEB\bBU\bUG\bG and R\bRE\bET\bTU\bUR\bRN\bN traps from the calling shell.
The trace attribute has no special meaning for variables.
- -\b-u\bu When the variable is assigned a value, all lower-case
- characters are converted to upper-case. The lower-case
+ -\b-u\bu When the variable is assigned a value, all lower-case
+ characters are converted to upper-case. The lower-case
attribute is disabled.
- -\b-x\bx Mark _\bn_\ba_\bm_\bes for export to subsequent commands via the en-
- vironment.
-
- Using "+" instead of "-" turns off the attribute instead, with
- the exceptions that +\b+a\ba and +\b+A\bA may not be used to destroy array
- variables and +\b+r\br will not remove the readonly attribute. When
- used in a function, d\bde\bec\bcl\bla\bar\bre\be and t\bty\byp\bpe\bes\bse\bet\bt make each _\bn_\ba_\bm_\be local, as
- with the l\blo\boc\bca\bal\bl command, unless the -\b-g\bg option is supplied. If a
- variable name is followed by =_\bv_\ba_\bl_\bu_\be, the value of the variable
- is set to _\bv_\ba_\bl_\bu_\be. When using -\b-a\ba or -\b-A\bA 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 A\bAr\brr\bra\bay\bys\bs above), one of the _\bn_\ba_\bm_\be_\bs 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 -\b-f\bf.
+ -\b-x\bx Mark each _\bn_\ba_\bm_\be for export to subsequent commands via the
+ environment.
+
+ Using "+" instead of "-" turns off the specified attribute in-
+ stead, with the exceptions that +\b+a\ba and +\b+A\bA may not be used to de-
+ stroy array variables and +\b+r\br will not remove the readonly at-
+ tribute.
+
+ When used in a function, d\bde\bec\bcl\bla\bar\bre\be and t\bty\byp\bpe\bes\bse\bet\bt make each _\bn_\ba_\bm_\be lo-
+ cal, as with the l\blo\boc\bca\bal\bl command, unless the -\b-g\bg option is sup-
+ plied. If a variable name is followed by =_\bv_\ba_\bl_\bu_\be, the value of
+ the variable is set to _\bv_\ba_\bl_\bu_\be. When using -\b-a\ba or -\b-A\bA 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 A\bAr\brr\bra\bay\bys\bs above), one of
+ the _\bn_\ba_\bm_\be_\bs 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 -\b-f\bf.
d\bdi\bir\brs\bs [\b[-\b-c\bcl\blp\bpv\bv]\b] [\b[+\b+_\bn]\b] [\b[-\b-_\bn]\b]
- 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 p\bpu\bus\bsh\bhd\bd command; the p\bpo\bop\bpd\bd command removes entries
- from the list. The current directory is always the first direc-
- tory in the stack.
- -\b-c\bc 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 p\bpu\bus\bsh\bhd\bd command; the p\bpo\bop\bpd\bd command removes entries from
+ the list. The current directory is always the first directory
+ in the stack.
+
+ Options, if supplied, have the following meanings:
+ -\b-c\bc Clears the directory stack by deleting all of the en-
tries.
- -\b-l\bl Produces a listing using full pathnames; the default
+ -\b-l\bl Produces a listing using full pathnames; the default
listing format uses a tilde to denote the home directory.
-\b-p\bp Print the directory stack with one entry per line.
- -\b-v\bv Print the directory stack with one entry per line, pre-
+ -\b-v\bv Print the directory stack with one entry per line, pre-
fixing each entry with its index in the stack.
+\b+_\bn Displays the _\bnth entry counting from the left of the list
shown by d\bdi\bir\brs\bs when invoked without options, starting with
zero.
- -\b-_\bn Displays the _\bnth entry counting from the right of the
+ -\b-_\bn Displays the _\bnth entry counting from the right of the
list shown by d\bdi\bir\brs\bs when invoked without options, starting
with zero.
- The return value is 0 unless an invalid option is supplied or _\bn
+ The return value is 0 unless an invalid option is supplied or _\bn
indexes beyond the end of the directory stack.
- d\bdi\bis\bso\bow\bwn\bn [-\b-a\bar\br] [-\b-h\bh] [_\bj_\bo_\bb_\bs_\bp_\be_\bc ... | _\bp_\bi_\bd ... ]
- Without options, remove each _\bj_\bo_\bb_\bs_\bp_\be_\bc from the table of active
- jobs. If _\bj_\bo_\bb_\bs_\bp_\be_\bc is not present, and neither the -\b-a\ba nor the -\b-r\br
- option is supplied, the _\bc_\bu_\br_\br_\be_\bn_\bt _\bj_\bo_\bb is used. If the -\b-h\bh option
- is given, each _\bj_\bo_\bb_\bs_\bp_\be_\bc is not removed from the table, but is
- marked so that S\bSI\bIG\bGH\bHU\bUP\bP is not sent to the job if the shell re-
- ceives a S\bSI\bIG\bGH\bHU\bUP\bP. If no _\bj_\bo_\bb_\bs_\bp_\be_\bc is supplied, the -\b-a\ba option means
- to remove or mark all jobs; the -\b-r\br option without a _\bj_\bo_\bb_\bs_\bp_\be_\bc ar-
- gument restricts operation to running jobs. The return value is
- 0 unless a _\bj_\bo_\bb_\bs_\bp_\be_\bc does not specify a valid job.
+ d\bdi\bis\bso\bow\bwn\bn [-\b-a\bar\br] [-\b-h\bh] [_\bi_\bd ...]
+ Without options, remove each _\bi_\bd from the table of active jobs.
+ Each _\bi_\bd may be a job specification _\bj_\bo_\bb_\bs_\bp_\be_\bc or a process ID _\bp_\bi_\bd;
+ if _\bi_\bd is a _\bp_\bi_\bd, d\bdi\bis\bso\bow\bwn\bn uses the job containing _\bp_\bi_\bd as _\bj_\bo_\bb_\bs_\bp_\be_\bc.
+ If _\bi_\bd is not present, and neither the -\b-a\ba nor the -\b-r\br option is
+ supplied, d\bdi\bis\bso\bow\bwn\bn removes the _\bc_\bu_\br_\br_\be_\bn_\bt _\bj_\bo_\bb. If the -\b-h\bh option is
+ supplied, the job corresponding to each _\bi_\bd is not removed from
+ the table, but is marked so that S\bSI\bIG\bGH\bHU\bUP\bP is not sent to the job
+ if the shell receives a S\bSI\bIG\bGH\bHU\bUP\bP.
+
+ If no _\bi_\bd is supplied, the -\b-a\ba option means to remove or mark all
+ jobs; the -\b-r\br option without an _\bi_\bd argument restricts operation
+ to running jobs.
+
+ The return value is 0 unless an _\bi_\bd does not specify a valid job.
e\bec\bch\bho\bo [-\b-n\bne\beE\bE] [_\ba_\br_\bg ...]
Output the _\ba_\br_\bgs, separated by spaces, followed by a newline.
The return status is 0 unless a write error occurs. If -\b-n\bn is
- specified, the trailing newline is suppressed. If the -\b-e\be option
- is given, interpretation of the following backslash-escaped
- characters is enabled. The -\b-E\bE option disables the interpreta-
- tion of these escape characters, even on systems where they are
- interpreted by default. The x\bxp\bpg\bg_\b_e\bec\bch\bho\bo shell option may be used
- to dynamically determine whether or not e\bec\bch\bho\bo interprets any op-
- tions and expands these escape characters by default. e\bec\bch\bho\bo does
- not interpret -\b--\b- to mean the end of options. e\bec\bch\bho\bo interprets
- the following escape sequences:
+ specified, the trailing newline is not printed.
+
+ If the -\b-e\be option is given, e\bec\bch\bho\bo interprets the following back-
+ slash-escaped characters. The -\b-E\bE option disables interpretation
+ of these escape characters, even on systems where they are in-
+ terpreted by default. The x\bxp\bpg\bg_\b_e\bec\bch\bho\bo shell option determines
+ whether or not e\bec\bch\bho\bo interprets any options and expands these es-
+ cape characters. e\bec\bch\bho\bo does not interpret -\b--\b- to mean the end of
+ options.
+
+ e\bec\bch\bho\bo interprets the following escape sequences:
\\b\a\ba alert (bell)
\\b\b\bb backspace
\\b\c\bc suppress further output
the Unicode (ISO/IEC 10646) character whose value is the
hexadecimal value _\bH_\bH_\bH_\bH_\bH_\bH_\bH_\bH (one to eight hex digits)
+ e\bec\bch\bho\bo writes any unrecognized backslash-escaped characters un-
+ changed.
+
e\ben\bna\bab\bbl\ble\be [-\b-a\ba] [-\b-d\bdn\bnp\bps\bs] [-\b-f\bf _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be] [_\bn_\ba_\bm_\be ...]
- 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 -\b-n\bn is used, each _\bn_\ba_\bm_\be is disabled; otherwise, _\bn_\ba_\bm_\be_\bs are en-
- abled. For example, to use the t\bte\bes\bst\bt binary found via the P\bPA\bAT\bTH\bH
- instead of the shell builtin version, run "enable -n test". The
- -\b-f\bf option means to load the new builtin command _\bn_\ba_\bm_\be from shared
- object _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be, on systems that support dynamic loading. B\bBa\bas\bsh\bh
- will use the value of the B\bBA\bAS\bSH\bH_\b_L\bLO\bOA\bAD\bDA\bAB\bBL\bLE\bES\bS_\b_P\bPA\bAT\bTH\bH variable as a
- colon-separated list of directories in which to search for _\bf_\bi_\bl_\be_\b-
- _\bn_\ba_\bm_\be, if _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be does not contain a slash. The default is sys-
- tem-dependent, and may include "." to force a search of the cur-
- rent directory. The -\b-d\bd option will delete a builtin previously
- loaded with -\b-f\bf. If no _\bn_\ba_\bm_\be arguments are given, or if the -\b-p\bp
- option is supplied, a list of shell builtins is printed. With
- no other option arguments, the list consists of all enabled
- shell builtins. If -\b-n\bn is supplied, only disabled builtins are
- printed. If -\b-a\ba is supplied, the list printed includes all
- builtins, with an indication of whether or not each is enabled.
- If -\b-s\bs is supplied, the output is restricted to the POSIX _\bs_\bp_\be_\bc_\bi_\ba_\bl
- builtins. If no options are supplied and a _\bn_\ba_\bm_\be is not a shell
- builtin, e\ben\bna\bab\bbl\ble\be will attempt to load _\bn_\ba_\bm_\be from a shared object
- named _\bn_\ba_\bm_\be, as if the command were "enable -f _\bn_\ba_\bm_\be _\bn_\ba_\bm_\be". The
- return value is 0 unless a _\bn_\ba_\bm_\be 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 -\b-n\bn is supplied, each _\bn_\ba_\bm_\be is disabled; otherwise, _\bn_\ba_\bm_\bes are
+ enabled. For example, to use the t\bte\bes\bst\bt binary found usin g P\bPA\bAT\bTH\bH
+ instead of the shell builtin version, run "enable -n test".
+
+ If no _\bn_\ba_\bm_\be arguments are supplied, or if the -\b-p\bp 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 -\b-n\bn
+ is supplied, print only disabled builtins. If -\b-a\ba is supplied,
+ the list printed includes all builtins, with an indication of
+ whether or not each is enabled. The -\b-s\bs option means to restrict
+ the output to the POSIX _\bs_\bp_\be_\bc_\bi_\ba_\bl builtins.
+
+ The -\b-f\bf option means to load the new builtin command _\bn_\ba_\bm_\be from
+ shared object _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be, on systems that support dynamic loading.
+ If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be does not contain a slash, B\bBa\bas\bsh\bh will use the value of
+ the B\bBA\bAS\bSH\bH_\b_L\bLO\bOA\bAD\bDA\bAB\bBL\bLE\bES\bS_\b_P\bPA\bAT\bTH\bH variable as a colon-separated list of
+ directories in which to search for _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be. The default for
+ B\bBA\bAS\bSH\bH_\b_L\bLO\bOA\bAD\bDA\bAB\bBL\bLE\bES\bS_\b_P\bPA\bAT\bTH\bH is system-dependent, and may include "." to
+ force a search of the current directory. The -\b-d\bd option will
+ delete a builtin previously loaded with -\b-f\bf. If _\b-_\bs is used with
+ _\b-_\bf, the new builtin becomes a POSIX special builtin.
+
+ If no options are supplied and a _\bn_\ba_\bm_\be is not a shell builtin,
+ e\ben\bna\bab\bbl\ble\be will attempt to load _\bn_\ba_\bm_\be from a shared object named
+ _\bn_\ba_\bm_\be, as if the command were "enable -f _\bn_\ba_\bm_\be _\bn_\ba_\bm_\be".
+
+ The return value is 0 unless a _\bn_\ba_\bm_\be is not a shell builtin or
+ there is an error loading a new builtin from a shared object.
e\bev\bva\bal\bl [_\ba_\br_\bg ...]
- The _\ba_\br_\bgs 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 e\bev\bva\bal\bl. If there are
- no _\ba_\br_\bg_\bs, or only null arguments, e\bev\bva\bal\bl returns 0.
+ Concatenate the _\ba_\br_\bgs together into a single command, separating
+ them with spaces. B\bBa\bas\bsh\bh then reads and execute this command, and
+ returns its exit status as the return status of e\bev\bva\bal\bl. If there
+ are no _\ba_\br_\bg_\bs, or only null arguments, e\bev\bva\bal\bl returns 0.
e\bex\bxe\bec\bc [-\b-c\bcl\bl] [-\b-a\ba _\bn_\ba_\bm_\be] [_\bc_\bo_\bm_\bm_\ba_\bn_\bd [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]]
- If _\bc_\bo_\bm_\bm_\ba_\bn_\bd is specified, it replaces the shell. No new process
- is created. The _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs become the arguments to _\bc_\bo_\bm_\bm_\ba_\bn_\bd. If
- the -\b-l\bl option is supplied, the shell places a dash at the begin-
- ning of the zeroth argument passed to _\bc_\bo_\bm_\bm_\ba_\bn_\bd. This is what _\bl_\bo_\b-
- _\bg_\bi_\bn(1) does. The -\b-c\bc option causes _\bc_\bo_\bm_\bm_\ba_\bn_\bd to be executed with
- an empty environment. If -\b-a\ba is supplied, the shell passes _\bn_\ba_\bm_\be
- as the zeroth argument to the executed command. If _\bc_\bo_\bm_\bm_\ba_\bn_\bd can-
- not be executed for some reason, a non-interactive shell exits,
- unless the e\bex\bxe\bec\bcf\bfa\bai\bil\bl 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
- e\bex\bxe\bec\bc fails. If _\bc_\bo_\bm_\bm_\ba_\bn_\bd 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 _\bc_\bo_\bm_\bm_\ba_\bn_\bd is specified, it replaces the shell without creating
+ a new process. _\bc_\bo_\bm_\bm_\ba_\bn_\bd cannot be a shell builtin or function.
+ The _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs become the arguments to _\bc_\bo_\bm_\bm_\ba_\bn_\bd. If the -\b-l\bl option
+ is supplied, the shell places a dash at the beginning of the ze-
+ roth argument passed to _\bc_\bo_\bm_\bm_\ba_\bn_\bd. This is what _\bl_\bo_\bg_\bi_\bn(1) does.
+ The -\b-c\bc option causes _\bc_\bo_\bm_\bm_\ba_\bn_\bd to be executed with an empty envi-
+ ronment. If -\b-a\ba is supplied, the shell passes _\bn_\ba_\bm_\be as the zeroth
+ argument to the executed command.
+
+ If _\bc_\bo_\bm_\bm_\ba_\bn_\bd cannot be executed for some reason, a non-interactive
+ shell exits, unless the e\bex\bxe\bec\bcf\bfa\bai\bil\bl 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 e\bex\bxe\bec\bc fails.
+
+ If _\bc_\bo_\bm_\bm_\ba_\bn_\bd 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.
e\bex\bxi\bit\bt [_\bn]
- Cause the shell to exit with a status of _\bn. If _\bn is omitted,
- the exit status is that of the last command executed. A trap on
- E\bEX\bXI\bIT\bT is executed before the shell terminates.
+ Cause the shell to exit with a status of _\bn. If _\bn is omitted,
+ the exit status is that of the last command executed. Any trap
+ on E\bEX\bXI\bIT\bT is executed before the shell terminates.
- e\bex\bxp\bpo\bor\brt\bt [-\b-f\bfn\bn] [_\bn_\ba_\bm_\be[=_\bw_\bo_\br_\bd]] ...
+ e\bex\bxp\bpo\bor\brt\bt [-\b-f\bfn\bn] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be]] ...
e\bex\bxp\bpo\bor\brt\bt -\b-p\bp
The supplied _\bn_\ba_\bm_\be_\bs are marked for automatic export to the envi-
ronment of subsequently executed commands. If the -\b-f\bf option is
- given, the _\bn_\ba_\bm_\be_\bs refer to functions. If no _\bn_\ba_\bm_\be_\bs are given, or
- if the -\b-p\bp option is supplied, a list of names of all exported
- variables is printed. The -\b-n\bn option causes the export property
- to be removed from each _\bn_\ba_\bm_\be. If a variable name is followed by
- =_\bw_\bo_\br_\bd, the value of the variable is set to _\bw_\bo_\br_\bd. e\bex\bxp\bpo\bor\brt\bt returns
- an exit status of 0 unless an invalid option is encountered, one
- of the _\bn_\ba_\bm_\be_\bs is not a valid shell variable name, or -\b-f\bf is sup-
- plied with a _\bn_\ba_\bm_\be that is not a function.
+ given, the _\bn_\ba_\bm_\be_\bs refer to functions.
+
+ The -\b-n\bn option unexports, or removes the export attribute, from
+ each _\bn_\ba_\bm_\be. If no _\bn_\ba_\bm_\be_\bs are given, or if the -\b-p\bp option is sup-
+ plied, e\bex\bxp\bpo\bor\brt\bt prints a list of names of all exported variables
+ on the standard output.
- f\bfa\bal\bls\bse\be Does nothing, returns a non-zero status.
+ e\bex\bxp\bpo\bor\brt\bt allows the value of a variable to be set when it is ex-
+ ported or unexported by following the variable name with =_\bv_\ba_\bl_\bu_\be.
+ This sets the value of the variable to _\bv_\ba_\bl_\bu_\be while modifying the
+ export attribute. e\bex\bxp\bpo\bor\brt\bt returns an exit status of 0 unless an
+ invalid option is encountered, one of the _\bn_\ba_\bm_\be_\bs is not a valid
+ shell variable name, or -\b-f\bf is supplied with a _\bn_\ba_\bm_\be that is not a
+ function.
+
+ f\bfa\bal\bls\bse\be Does nothing; returns a non-zero status.
f\bfc\bc [-\b-e\be _\be_\bn_\ba_\bm_\be] [-\b-l\bln\bnr\br] [_\bf_\bi_\br_\bs_\bt] [_\bl_\ba_\bs_\bt]
f\bfc\bc -\b-s\bs [_\bp_\ba_\bt=_\br_\be_\bp] [_\bc_\bm_\bd]
them. _\bF_\bi_\br_\bs_\bt and _\bl_\ba_\bs_\bt 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
- _\bf_\bi_\br_\bs_\bt or _\bl_\ba_\bs_\bt of 0 is equivalent to -1 and -0 is equivalent to
- the current command (usually the f\bfc\bc command); otherwise 0 is
- equivalent to -1 and -0 is invalid. If _\bl_\ba_\bs_\bt is not specified,
- it is set to the current command for listing (so that "fc -l
- -10" prints the last 10 commands) and to _\bf_\bi_\br_\bs_\bt otherwise. If
- _\bf_\bi_\br_\bs_\bt is not specified, it is set to the previous command for
+ an offset from the current command number).
+
+ When listing, a _\bf_\bi_\br_\bs_\bt or _\bl_\ba_\bs_\bt of 0 is equivalent to -1 and -0 is
+ equivalent to the current command (usually the f\bfc\bc command); oth-
+ erwise 0 is equivalent to -1 and -0 is invalid. If _\bl_\ba_\bs_\bt is not
+ specified, it is set to the current command for listing (so that
+ "fc -l -10" prints the last 10 commands) and to _\bf_\bi_\br_\bs_\bt otherwise.
+ If _\bf_\bi_\br_\bs_\bt is not specified, it is set to the previous command for
editing and -16 for listing.
- The -\b-n\bn option suppresses the command numbers when listing. The
- -\b-r\br option reverses the order of the commands. If the -\b-l\bl option
- is given, the commands are listed on standard output. Other-
- wise, the editor given by _\be_\bn_\ba_\bm_\be is invoked on a file containing
- those commands. If _\be_\bn_\ba_\bm_\be is not given, the value of the F\bFC\bCE\bED\bDI\bIT\bT
- variable is used, and the value of E\bED\bDI\bIT\bTO\bOR\bR if F\bFC\bCE\bED\bDI\bIT\bT is not set.
- If neither variable is set, _\bv_\bi is used. When editing is com-
- plete, the edited commands are echoed and executed.
-
- In the second form, _\bc_\bo_\bm_\bm_\ba_\bn_\bd is re-executed after each instance
- of _\bp_\ba_\bt is replaced by _\br_\be_\bp. _\bC_\bo_\bm_\bm_\ba_\bn_\bd is interpreted the same as
- _\bf_\bi_\br_\bs_\bt 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 _\bf_\bi_\br_\bs_\bt or _\bl_\ba_\bs_\bt specify history
- lines out of range. If the -\b-e\be 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 _\bc_\bm_\bd does not specify a valid history line, in
- which case f\bfc\bc returns failure.
+ If the -\b-l\bl option is supplied, the commands are listed on the
+ standard output. The -\b-n\bn option suppresses the command numbers
+ when listing. The -\b-r\br option reverses the order of the commands.
+
+ Otherwise, f\bfc\bc invokes the editor named by _\be_\bn_\ba_\bm_\be on a file con-
+ taining those commands. If _\be_\bn_\ba_\bm_\be is not supplied, f\bfc\bc uses the
+ value of the F\bFC\bCE\bED\bDI\bIT\bT variable, and the value of E\bED\bDI\bIT\bTO\bOR\bR if F\bFC\bCE\bED\bDI\bIT\bT
+ is not set. If neither variable is set, f\bfc\bc uses _\bv_\bi_\b. When edit-
+ ing is complete, f\bfc\bc reads the file containing the edited com-
+ mands and echoes and executes them.
+
+ In the second form, f\bfc\bc re-executes _\bc_\bo_\bm_\bm_\ba_\bn_\bd after replacing each
+ instance of _\bp_\ba_\bt with _\br_\be_\bp. _\bC_\bo_\bm_\bm_\ba_\bn_\bd is interpreted the same as
+ _\bf_\bi_\br_\bs_\bt above.
+
+ A useful alias to use with f\bfc\bc 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 _\bf_\bi_\br_\bs_\bt or _\bl_\ba_\bs_\bt 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 _\bc_\bm_\bd does not specify a valid history en-
+ try, in which case f\bfc\bc returns a non-zero status.
f\bfg\bg [_\bj_\bo_\bb_\bs_\bp_\be_\bc]
Resume _\bj_\bo_\bb_\bs_\bp_\be_\bc in the foreground, and make it the current job.
- If _\bj_\bo_\bb_\bs_\bp_\be_\bc is not present, the shell's notion of the _\bc_\bu_\br_\br_\be_\bn_\bt _\bj_\bo_\bb
- 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 _\bj_\bo_\bb_\bs_\bp_\be_\bc does not spec-
- ify a valid job or _\bj_\bo_\bb_\bs_\bp_\be_\bc specifies a job that was started
- without job control.
+ If _\bj_\bo_\bb_\bs_\bp_\be_\bc is not present, use the shell's notion of the _\bc_\bu_\br_\br_\be_\bn_\bt
+ _\bj_\bo_\bb. 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 _\bj_\bo_\bb_\bs_\bp_\be_\bc does not specify a
+ valid job or _\bj_\bo_\bb_\bs_\bp_\be_\bc specifies a job that was started without
+ job control.
g\bge\bet\bto\bop\bpt\bts\bs _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg _\bn_\ba_\bm_\be [_\ba_\br_\bg ...]
- g\bge\bet\bto\bop\bpt\bts\bs is used by shell procedures to parse positional parame-
- ters. _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg 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, g\bge\bet\bto\bop\bpt\bts\bs
- places the next option in the shell variable _\bn_\ba_\bm_\be, initializing
- _\bn_\ba_\bm_\be if it does not exist, and the index of the next argument to
- be processed into the variable O\bOP\bPT\bTI\bIN\bND\bD. O\bOP\bPT\bTI\bIN\bND\bD is initialized to
- 1 each time the shell or a shell script is invoked. When an op-
- tion requires an argument, g\bge\bet\bto\bop\bpt\bts\bs places that argument into the
- variable O\bOP\bPT\bTA\bAR\bRG\bG. The shell does not reset O\bOP\bPT\bTI\bIN\bND\bD automatically;
- it must be manually reset between multiple calls to g\bge\bet\bto\bop\bpt\bts\bs
- within the same shell invocation if a new set of parameters is
- to be used.
-
- When the end of options is encountered, g\bge\bet\bto\bop\bpt\bts\bs exits with a re-
- turn value greater than zero. O\bOP\bPT\bTI\bIN\bND\bD is set to the index of the
+ g\bge\bet\bto\bop\bpt\bts\bs is used by shell scripts and functions to parse posi-
+ tional parameters and obtain options and their arguments. _\bo_\bp_\bt_\b-
+ _\bs_\bt_\br_\bi_\bn_\bg 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, g\bge\bet\bto\bop\bpt\bts\bs places the next option in the
+ shell variable _\bn_\ba_\bm_\be, initializing _\bn_\ba_\bm_\be if it does not exist, and
+ the index of the next argument to be processed into the variable
+ O\bOP\bPT\bTI\bIN\bND\bD. O\bOP\bPT\bTI\bIN\bND\bD is initialized to 1 each time the shell or a
+ shell script is invoked. When an option requires an argument,
+ g\bge\bet\bto\bop\bpt\bts\bs places that argument into the variable O\bOP\bPT\bTA\bAR\bRG\bG.
+
+ The shell does not reset O\bOP\bPT\bTI\bIN\bND\bD automatically; it must be manu-
+ ally reset between multiple calls to g\bge\bet\bto\bop\bpt\bts\bs within the same
+ shell invocation to use a new set of parameters.
+
+ When it reaches the end of options, g\bge\bet\bto\bop\bpt\bts\bs exits with a return
+ value greater than zero. O\bOP\bPT\bTI\bIN\bND\bD is set to the index of the
first non-option argument, and _\bn_\ba_\bm_\be is set to ?.
- g\bge\bet\bto\bop\bpt\bts\bs normally parses the positional parameters, but if more
- arguments are supplied as _\ba_\br_\bg values, g\bge\bet\bto\bop\bpt\bts\bs parses those in-
+ g\bge\bet\bto\bop\bpt\bts\bs normally parses the positional parameters, but if more
+ arguments are supplied as _\ba_\br_\bg values, g\bge\bet\bto\bop\bpt\bts\bs parses those in-
stead.
- g\bge\bet\bto\bop\bpt\bts\bs can report errors in two ways. If the first character
- of _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg is a colon, _\bs_\bi_\bl_\be_\bn_\bt error reporting is used. In
- normal operation, diagnostic messages are printed when invalid
- options or missing option arguments are encountered. If the
- variable O\bOP\bPT\bTE\bER\bRR\bR is set to 0, no error messages will be dis-
+ g\bge\bet\bto\bop\bpt\bts\bs can report errors in two ways. If the first character
+ of _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg is a colon, g\bge\bet\bto\bop\bpt\bts\bs uses _\bs_\bi_\bl_\be_\bn_\bt error reporting.
+ In normal operation, g\bge\bet\bto\bop\bpt\bts\bs prints diagnostic messages when it
+ encounters invalid options or missing option arguments. If the
+ variable O\bOP\bPT\bTE\bER\bRR\bR is set to 0, no error messages will be dis-
played, even if the first character of _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg is not a colon.
If g\bge\bet\bto\bop\bpt\bts\bs detects an invalid option, it places ? into _\bn_\ba_\bm_\be and,
- if not silent, prints an error message and unsets O\bOP\bPT\bTA\bAR\bRG\bG. If
- g\bge\bet\bto\bop\bpt\bts\bs is silent, it assigns the option character found to O\bOP\bP-\b-
+ if not silent, prints an error message and unsets O\bOP\bPT\bTA\bAR\bRG\bG. If
+ g\bge\bet\bto\bop\bpt\bts\bs is silent, it assigns the option character found to O\bOP\bP-\b-
T\bTA\bAR\bRG\bG and does not print a diagnostic message.
- If a required argument is not found, and g\bge\bet\bto\bop\bpt\bts\bs is not silent,
+ If a required argument is not found, and g\bge\bet\bto\bop\bpt\bts\bs is not silent,
it sets the value of _\bn_\ba_\bm_\be to a question mark (?\b?), unsets O\bOP\bPT\bTA\bAR\bRG\bG,
- and prints a diagnostic message. If g\bge\bet\bto\bop\bpt\bts\bs is silent, it sets
- the value of _\bn_\ba_\bm_\be to a colon (:\b:) and sets O\bOP\bPT\bTA\bAR\bRG\bG to the option
+ and prints a diagnostic message. If g\bge\bet\bto\bop\bpt\bts\bs is silent, it sets
+ the value of _\bn_\ba_\bm_\be to a colon (:\b:) and sets O\bOP\bPT\bTA\bAR\bRG\bG to the option
character found.
- g\bge\bet\bto\bop\bpt\bts\bs returns true if an option, specified or unspecified, is
+ g\bge\bet\bto\bop\bpt\bts\bs returns true if an option, specified or unspecified, is
found. It returns false if the end of options is encountered or
an error occurs.
h\bha\bas\bsh\bh [-\b-l\blr\br] [-\b-p\bp _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be] [-\b-d\bdt\bt] [_\bn_\ba_\bm_\be]
- Each time h\bha\bas\bsh\bh is invoked, the full pathname of the command _\bn_\ba_\bm_\be
- is determined by searching the directories in $\b$P\bPA\bAT\bTH\bH and remem-
- bered. Any previously-remembered pathname is discarded. If the
- -\b-p\bp option is supplied, h\bha\bas\bsh\bh uses _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be as the full filename
- of the command. The -\b-r\br option causes the shell to forget all
- remembered locations. Assigning to the P\bPA\bAT\bTH\bH variable also
- clears all hashed filenames. The -\b-d\bd option causes the shell to
- forget the remembered location of each _\bn_\ba_\bm_\be. If the -\b-t\bt option
- is supplied, the full pathname to which each _\bn_\ba_\bm_\be corresponds is
- printed. If multiple _\bn_\ba_\bm_\be arguments are supplied with -\b-t\bt, the
- _\bn_\ba_\bm_\be is printed before the hashed full pathname. The -\b-l\bl option
- causes output to be displayed in a format that may be reused as
- input. If no arguments are given, or if only -\b-l\bl is supplied,
- information about remembered commands is printed. The -\b-t\bt, -\b-d\bd,
- and -\b-p\bp options (the options that act on the _\bn_\ba_\bm_\be arguments) are
- mutually exclusive. Only one will be active. If more than one
- is supplied, -\b-t\bt has higher priority than -\b-p\bp, and both are higher
- priority than -\b-d\bd. The return status is true unless a _\bn_\ba_\bm_\be is
- not found or an invalid option is supplied.
+ Each time h\bha\bas\bsh\bh is invoked, it remembers the full pathname of the
+ command _\bn_\ba_\bm_\be as determined by searching the directories in
+ $\b$P\bPA\bAT\bTH\bH. Any previously-remembered pathname associated with _\bn_\ba_\bm_\be
+ is discarded. If the -\b-p\bp option is supplied, h\bha\bas\bsh\bh uses _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
+ as the full pathname of the command.
+
+ The -\b-r\br option causes the shell to forget all remembered loca-
+ tions. Assigning to the P\bPA\bAT\bTH\bH variable also clears all hashed
+ filenames. The -\b-d\bd option causes the shell to forget the remem-
+ bered location of each _\bn_\ba_\bm_\be.
+
+ If the -\b-t\bt option is supplied, h\bha\bas\bsh\bh prints the full pathname cor-
+ responding to each _\bn_\ba_\bm_\be. If multiple _\bn_\ba_\bm_\be arguments are sup-
+ plied with -\b-t\bt, h\bha\bas\bsh\bh prints the _\bn_\ba_\bm_\be before the corresponding
+ hashed full pathname. The -\b-l\bl option displays output in a format
+ that may be reused as input.
+
+ If no arguments are given, or if only -\b-l\bl is supplied, h\bha\bas\bsh\bh
+ prints information about remembered commands. The -\b-t\bt, -\b-d\bd, and
+ -\b-p\bp options (the options that act on the _\bn_\ba_\bm_\be arguments) are mu-
+ tually exclusive. Only one will be active. If more than one is
+ supplied, -\b-t\bt has higher priority than -\b-p\bp, and both have higher
+ priority than -\b-d\bd.
+
+ The return status is zero unless a _\bn_\ba_\bm_\be is not found or an in-
+ valid option is supplied.
h\bhe\bel\blp\bp [-\b-d\bdm\bms\bs] [_\bp_\ba_\bt_\bt_\be_\br_\bn]
Display helpful information about builtin commands. If _\bp_\ba_\bt_\bt_\be_\br_\bn
is specified, h\bhe\bel\blp\bp gives detailed help on all commands matching
- _\bp_\ba_\bt_\bt_\be_\br_\bn; otherwise help for all the builtins and shell control
- structures is printed.
+ _\bp_\ba_\bt_\bt_\be_\br_\bn; otherwise it displays a list of all the builtins and
+ shell compound commands.
-\b-d\bd Display a short description of each _\bp_\ba_\bt_\bt_\be_\br_\bn
-\b-m\bm Display the description of each _\bp_\ba_\bt_\bt_\be_\br_\bn in a manpage-like
format
h\bhi\bis\bst\bto\bor\bry\by -\b-a\ban\bnr\brw\bw [_\bf_\bi_\bl_\be_\bn_\ba_\bm_\be]
h\bhi\bis\bst\bto\bor\bry\by -\b-p\bp _\ba_\br_\bg [_\ba_\br_\bg ...]
h\bhi\bis\bst\bto\bor\bry\by -\b-s\bs _\ba_\br_\bg [_\ba_\br_\bg ...]
- With no options, display the command history list with line num-
- bers. Lines listed with a *\b* have been modified. An argument of
- _\bn lists only the last _\bn lines. If the shell variable H\bHI\bIS\bST\bTT\bTI\bIM\bME\bE-\b-
+ With no options, display the command history list with numbers.
+ Entries prefixed with a *\b* have been modified. An argument of _\bn
+ lists only the last _\bn entries. If the shell variable H\bHI\bIS\bST\bTT\bTI\bIM\bME\bE-\b-
F\bFO\bOR\bRM\bMA\bAT\bT is set and not null, it is used as a format string for
_\bs_\bt_\br_\bf_\bt_\bi_\bm_\be(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 _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is
- supplied, it is used as the name of the history file; if not,
- the value of H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is used. If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is not supplied and
- H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is unset or null, the -\b-a\ba,\b, -\b-n\bn,\b, -\b-r\br,\b, and -\b-w\bw options have
- no effect. Options, if supplied, have the following meanings:
- -\b-c\bc Clear the history list by deleting all the entries.
+ played history entry. If h\bhi\bis\bst\bto\bor\bry\by uses H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT, it does
+ not print an intervening space between the formatted time stamp
+ and the history entry.
+
+ If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is supplied, h\bhi\bis\bst\bto\bor\bry\by uses it as the name of the his-
+ tory file; if not, it uses the value of H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE. If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
+ is not supplied and H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is unset or null, the -\b-a\ba,\b, -\b-n\bn,\b, -\b-r\br,\b,
+ and -\b-w\bw options have no effect.
+
+ Options, if supplied, have the following meanings:
+ -\b-c\bc Clear the history list by deleting all the entries. This
+ can be used with the other options to replace the history
+ list.
-\b-d\bd _\bo_\bf_\bf_\bs_\be_\bt
- Delete the history entry at position _\bo_\bf_\bf_\bs_\be_\bt. If _\bo_\bf_\bf_\bs_\be_\bt
+ Delete the history entry at position _\bo_\bf_\bf_\bs_\be_\bt. If _\bo_\bf_\bf_\bs_\be_\bt
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 h\bhi\bis\bst\bto\bor\bry\by -\b-d\bd command.
-\b-d\bd _\bs_\bt_\ba_\br_\bt-_\be_\bn_\bd
- Delete the range of history entries between positions
- _\bs_\bt_\ba_\br_\bt and _\be_\bn_\bd, inclusive. Positive and negative values
+ Delete the range of history entries between positions
+ _\bs_\bt_\ba_\br_\bt and _\be_\bn_\bd, inclusive. Positive and negative values
for _\bs_\bt_\ba_\br_\bt and _\be_\bn_\bd are interpreted as described above.
- -\b-a\ba Append the "new" history lines to the history file.
- These are history lines entered since the beginning of
+ -\b-a\ba Append the "new" history lines to the history file.
+ These are history lines entered since the beginning of
the current b\bba\bas\bsh\bh session, but not already appended to the
history file.
- -\b-n\bn 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
+ -\b-n\bn 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 b\bba\bas\bsh\bh session.
- -\b-r\br Read the contents of the history file and append them to
- the current history list.
+ -\b-r\br Read the history file and append its contents to the cur-
+ rent history list.
-\b-w\bw Write the current history list to the history file, over-
writing the history file's contents.
-\b-p\bp Perform history substitution on the following _\ba_\br_\bg_\bs and
- display the result on the standard output. Does not
- store the results in the history list. Each _\ba_\br_\bg must be
+ display the result on the standard output, without stor-
+ ing the results in the history list. Each _\ba_\br_\bg must be
quoted to disable normal history expansion.
-\b-s\bs Store the _\ba_\br_\bg_\bs in the history list as a single entry.
The last command in the history list is removed before
- the _\ba_\br_\bg_\bs are added.
-
- If the H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT 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 _\bo_\bf_\bf_\bs_\be_\bt or range
- is supplied as an argument to -\b-d\bd, or the history expansion sup-
- plied as an argument to -\b-p\bp fails.
+ adding the _\ba_\br_\bg_\bs.
+
+ If the H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT variable is set, h\bhi\bis\bst\bto\bor\bry\by 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 _\bo_\bf_\bf_\bs_\be_\bt or range is supplied as an argument to -\b-d\bd, or the
+ history expansion supplied as an argument to -\b-p\bp fails.
j\bjo\bob\bbs\bs [-\b-l\bln\bnp\bpr\brs\bs] [ _\bj_\bo_\bb_\bs_\bp_\be_\bc ... ]
j\bjo\bob\bbs\bs -\b-x\bx _\bc_\bo_\bm_\bm_\ba_\bn_\bd [ _\ba_\br_\bg_\bs ... ]
The first form lists the active jobs. The options have the fol-
lowing meanings:
-\b-l\bl List process IDs in addition to the normal information.
- -\b-n\bn Display information only about jobs that have changed
+ -\b-n\bn Display information only about jobs that have changed
status since the user was last notified of their status.
- -\b-p\bp List only the process ID of the job's process group
+ -\b-p\bp List only the process ID of the job's process group
leader.
-\b-r\br Display only running jobs.
-\b-s\bs Display only stopped jobs.
- If _\bj_\bo_\bb_\bs_\bp_\be_\bc is given, output is restricted to information about
- that job. The return status is 0 unless an invalid option is
- encountered or an invalid _\bj_\bo_\bb_\bs_\bp_\be_\bc is supplied.
+ If _\bj_\bo_\bb_\bs_\bp_\be_\bc is supplied, j\bjo\bob\bbs\bs restricts output to information
+ about that job. The return status is 0 unless an invalid option
+ is encountered or an invalid _\bj_\bo_\bb_\bs_\bp_\be_\bc is supplied.
If the -\b-x\bx option is supplied, j\bjo\bob\bbs\bs replaces any _\bj_\bo_\bb_\bs_\bp_\be_\bc found in
_\bc_\bo_\bm_\bm_\ba_\bn_\bd or _\ba_\br_\bg_\bs with the corresponding process group ID, and ex-
- ecutes _\bc_\bo_\bm_\bm_\ba_\bn_\bd passing it _\ba_\br_\bg_\bs, returning its exit status.
+ ecutes _\bc_\bo_\bm_\bm_\ba_\bn_\bd, passing it _\ba_\br_\bg_\bs, returning its exit status.
k\bki\bil\bll\bl [-\b-s\bs _\bs_\bi_\bg_\bs_\bp_\be_\bc | -\b-n\bn _\bs_\bi_\bg_\bn_\bu_\bm | -\b-_\bs_\bi_\bg_\bs_\bp_\be_\bc] [_\bp_\bi_\bd | _\bj_\bo_\bb_\bs_\bp_\be_\bc] ...
k\bki\bil\bll\bl -\b-l\bl|-\b-L\bL [_\bs_\bi_\bg_\bs_\bp_\be_\bc | _\be_\bx_\bi_\bt_\b__\bs_\bt_\ba_\bt_\bu_\bs]
- Send the signal named by _\bs_\bi_\bg_\bs_\bp_\be_\bc or _\bs_\bi_\bg_\bn_\bu_\bm to the processes
+ Send the signal specified by _\bs_\bi_\bg_\bs_\bp_\be_\bc or _\bs_\bi_\bg_\bn_\bu_\bm to the processes
named by _\bp_\bi_\bd or _\bj_\bo_\bb_\bs_\bp_\be_\bc. _\bs_\bi_\bg_\bs_\bp_\be_\bc is either a case-insensitive
signal name such as S\bSI\bIG\bGK\bKI\bIL\bLL\bL (with or without the S\bSI\bIG\bG prefix) or
a signal number; _\bs_\bi_\bg_\bn_\bu_\bm is a signal number. If _\bs_\bi_\bg_\bs_\bp_\be_\bc is not
- present, then S\bSI\bIG\bGT\bTE\bER\bRM\bM is assumed. An argument of -\b-l\bl lists the
- signal names. If any arguments are supplied when -\b-l\bl is given,
- the names of the signals corresponding to the arguments are
- listed, and the return status is 0. The _\be_\bx_\bi_\bt_\b__\bs_\bt_\ba_\bt_\bu_\bs argument to
- -\b-l\bl is a number specifying either a signal number or the exit
- status of a process terminated by a signal. The -\b-L\bL option is
- equivalent to -\b-l\bl. k\bki\bil\bll\bl 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 k\bki\bil\bll\bl sends S\bSI\bIG\bGT\bTE\bER\bRM\bM.
+
+ An argument of -\b-l\bl lists the signal names. If any arguments are
+ supplied when -\b-l\bl is given, k\bki\bil\bll\bl lists the names of the signals
+ corresponding to the arguments, and the return status is 0. The
+ _\be_\bx_\bi_\bt_\b__\bs_\bt_\ba_\bt_\bu_\bs argument to -\b-l\bl is a number specifying either a sig-
+ nal number or the exit status of a process terminated by a sig-
+ nal. The -\b-L\bL option is equivalent to -\b-l\bl.
+
+ k\bki\bil\bll\bl returns true if at least one signal was successfully sent,
+ or false if an error occurs or an invalid option is encountered.
l\ble\bet\bt _\ba_\br_\bg [_\ba_\br_\bg ...]
- Each _\ba_\br_\bg is an arithmetic expression to be evaluated (see A\bAR\bRI\bIT\bTH\bH-\b-
+ Each _\ba_\br_\bg is evaluated as an arithmetic expression (see A\bAR\bRI\bIT\bTH\bH-\b-
M\bME\bET\bTI\bIC\bC E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN above). If the last _\ba_\br_\bg evaluates to 0, l\ble\bet\bt
- returns 1; 0 is returned otherwise.
+ returns 1; otherwise l\ble\bet\bt returns 0.
l\blo\boc\bca\bal\bl [_\bo_\bp_\bt_\bi_\bo_\bn] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ... | - ]
- For each argument, a local variable named _\bn_\ba_\bm_\be is created, and
- assigned _\bv_\ba_\bl_\bu_\be. The _\bo_\bp_\bt_\bi_\bo_\bn can be any of the options accepted
- by d\bde\bec\bcl\bla\bar\bre\be. When l\blo\boc\bca\bal\bl is used within a function, it causes the
+ For each argument, create a local variable named _\bn_\ba_\bm_\be and assign
+ it _\bv_\ba_\bl_\bu_\be. The _\bo_\bp_\bt_\bi_\bo_\bn can be any of the options accepted by d\bde\be-\b-
+ c\bcl\bla\bar\bre\be. When l\blo\boc\bca\bal\bl is used within a function, it causes the
variable _\bn_\ba_\bm_\be to have a visible scope restricted to that func-
- tion and its children. If _\bn_\ba_\bm_\be is -, the set of shell options
- is made local to the function in which l\blo\boc\bca\bal\bl is invoked: shell
- options changed using the s\bse\bet\bt builtin inside the function after
- the call to l\blo\boc\bca\bal\bl are restored to their original values when the
- function returns. The restore is effected as if a series of s\bse\bet\bt
- commands were executed to restore the values that were in place
- before the function. With no operands, l\blo\boc\bca\bal\bl writes a list of
- local variables to the standard output. It is an error to use
- l\blo\boc\bca\bal\bl when not within a function. The return status is 0 unless
- l\blo\boc\bca\bal\bl is used outside a function, an invalid _\bn_\ba_\bm_\be is supplied,
- or _\bn_\ba_\bm_\be is a readonly variable.
-
- l\blo\bog\bgo\bou\but\bt Exit a login shell.
+ tion and its children. It is an error to use l\blo\boc\bca\bal\bl when not
+ within a function.
+
+ If _\bn_\ba_\bm_\be is -, it makes the set of shell options local to the
+ function in which l\blo\boc\bca\bal\bl is invoked: any shell options changed
+ using the s\bse\bet\bt builtin inside the function after the call to l\blo\bo-\b-
+ c\bca\bal\bl are restored to their original values when the function re-
+ turns. The restore is performed as if a series of s\bse\bet\bt commands
+ were executed to restore the values that were in place before
+ the function.
+
+ With no operands, l\blo\boc\bca\bal\bl writes a list of local variables to the
+ standard output.
+
+ The return status is 0 unless l\blo\boc\bca\bal\bl is used outside a function,
+ an invalid _\bn_\ba_\bm_\be is supplied, or _\bn_\ba_\bm_\be is a readonly variable.
+
+ l\blo\bog\bgo\bou\but\bt [\b[_\bn]\b]
+ Exit a login shell, returning a status of _\bn to the shell's par-
+ ent.
m\bma\bap\bpf\bfi\bil\ble\be [-\b-d\bd _\bd_\be_\bl_\bi_\bm] [-\b-n\bn _\bc_\bo_\bu_\bn_\bt] [-\b-O\bO _\bo_\br_\bi_\bg_\bi_\bn] [-\b-s\bs _\bc_\bo_\bu_\bn_\bt] [-\b-t\bt] [-\b-u\bu _\bf_\bd] [-\b-C\bC
_\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk] [-\b-c\bc _\bq_\bu_\ba_\bn_\bt_\bu_\bm] [_\ba_\br_\br_\ba_\by]
r\bre\bea\bad\bda\bar\brr\bra\bay\by [-\b-d\bd _\bd_\be_\bl_\bi_\bm] [-\b-n\bn _\bc_\bo_\bu_\bn_\bt] [-\b-O\bO _\bo_\br_\bi_\bg_\bi_\bn] [-\b-s\bs _\bc_\bo_\bu_\bn_\bt] [-\b-t\bt] [-\b-u\bu _\bf_\bd] [-\b-C\bC
_\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk] [-\b-c\bc _\bq_\bu_\ba_\bn_\bt_\bu_\bm] [_\ba_\br_\br_\ba_\by]
- Read lines from the standard input into the indexed array vari-
- able _\ba_\br_\br_\ba_\by, or from file descriptor _\bf_\bd if the -\b-u\bu option is sup-
- plied. The variable M\bMA\bAP\bPF\bFI\bIL\bLE\bE is the default _\ba_\br_\br_\ba_\by. Options, if
+ Read lines from the standard input, or from file descriptor _\bf_\bd
+ if the -\b-u\bu option is supplied, into the indexed array variable
+ _\ba_\br_\br_\ba_\by. The variable M\bMA\bAP\bPF\bFI\bIL\bLE\bE is the default _\ba_\br_\br_\ba_\by. Options, if
supplied, have the following meanings:
- -\b-d\bd The first character of _\bd_\be_\bl_\bi_\bm is used to terminate each
- input line, rather than newline. If _\bd_\be_\bl_\bi_\bm is the empty
- string, m\bma\bap\bpf\bfi\bil\ble\be will terminate a line when it reads a NUL
- character.
- -\b-n\bn Copy at most _\bc_\bo_\bu_\bn_\bt lines. If _\bc_\bo_\bu_\bn_\bt is 0, all lines are
- copied.
- -\b-O\bO Begin assigning to _\ba_\br_\br_\ba_\by at index _\bo_\br_\bi_\bg_\bi_\bn. The default
+ -\b-d\bd Use the first character of _\bd_\be_\bl_\bi_\bm to terminate each input
+ line, rather than newline. If _\bd_\be_\bl_\bi_\bm is the empty string,
+ m\bma\bap\bpf\bfi\bil\ble\be will terminate a line when it reads a NUL charac-
+ ter.
+ -\b-n\bn Copy at most _\bc_\bo_\bu_\bn_\bt lines. If _\bc_\bo_\bu_\bn_\bt is 0, copy all lines.
+ -\b-O\bO Begin assigning to _\ba_\br_\br_\ba_\by at index _\bo_\br_\bi_\bg_\bi_\bn. The default
index is 0.
-\b-s\bs Discard the first _\bc_\bo_\bu_\bn_\bt lines read.
- -\b-t\bt Remove a trailing _\bd_\be_\bl_\bi_\bm (default newline) from each line
+ -\b-t\bt Remove a trailing _\bd_\be_\bl_\bi_\bm (default newline) from each line
read.
- -\b-u\bu Read lines from file descriptor _\bf_\bd instead of the stan-
+ -\b-u\bu Read lines from file descriptor _\bf_\bd instead of the stan-
dard input.
- -\b-C\bC Evaluate _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk each time _\bq_\bu_\ba_\bn_\bt_\bu_\bm lines are read. The
+ -\b-C\bC Evaluate _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk each time _\bq_\bu_\ba_\bn_\bt_\bu_\bm lines are read. The
-\b-c\bc option specifies _\bq_\bu_\ba_\bn_\bt_\bu_\bm.
- -\b-c\bc Specify the number of lines read between each call to
+ -\b-c\bc Specify the number of lines read between each call to
_\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk.
- If -\b-C\bC is specified without -\b-c\bc, the default quantum is 5000.
+ If -\b-C\bC is specified without -\b-c\bc, the default quantum is 5000.
When _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk 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. _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk is evaluated after
+ element as additional arguments. _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk is evaluated after
the line is read but before the array element is assigned.
- If not supplied with an explicit origin, m\bma\bap\bpf\bfi\bil\ble\be will clear _\ba_\br_\b-
+ If not supplied with an explicit origin, m\bma\bap\bpf\bfi\bil\ble\be will clear _\ba_\br_\b-
_\br_\ba_\by before assigning to it.
- m\bma\bap\bpf\bfi\bil\ble\be returns successfully unless an invalid option or option
- argument is supplied, _\ba_\br_\br_\ba_\by is invalid or unassignable, or if
- _\ba_\br_\br_\ba_\by is not an indexed array.
+ m\bma\bap\bpf\bfi\bil\ble\be returns zero unless an invalid option or option argument
+ is supplied, _\ba_\br_\br_\ba_\by is invalid or unassignable, or if _\ba_\br_\br_\ba_\by is
+ not an indexed array.
p\bpo\bop\bpd\bd [-n\bn] [+_\bn] [-_\bn]
- Removes entries from the directory stack. The elements are num-
- bered from 0 starting at the first directory listed by d\bdi\bir\brs\bs.
- With no arguments, p\bpo\bop\bpd\bd removes the top directory from the
- stack, and changes to the new top directory. Arguments, if sup-
- plied, have the following meanings:
- -\b-n\bn Suppresses the normal change of directory when removing
- directories from the stack, so that only the stack is ma-
- nipulated.
- +\b+_\bn Removes the _\bnth entry counting from the left of the list
- shown by d\bdi\bir\brs\bs, 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 d\bdi\bir\brs\bs, so
+ p\bpo\bop\bpd\bd is equivalent to "popd +0." With no arguments, p\bpo\bop\bpd\bd re-
+ moves the top directory from the stack, and changes to the new
+ top directory. Arguments, if supplied, have the following mean-
+ ings:
+ -\b-n\bn Suppress the normal change of directory when removing di-
+ rectories from the stack, only manipulate the stack.
+ +\b+_\bn Remove the _\bnth entry counting from the left of the list
+ shown by d\bdi\bir\brs\bs, starting with zero, from the stack. For
example: "popd +0" removes the first directory, "popd +1"
the second.
- -\b-_\bn Removes the _\bnth entry counting from the right of the list
+ -\b-_\bn Remove the _\bnth entry counting from the right of the list
shown by d\bdi\bir\brs\bs, starting with zero. For example: "popd
-0" removes the last directory, "popd -1" the next to
last.
to the directory at the top of the stack. If the c\bcd\bd fails, p\bpo\bop\bpd\bd
returns a non-zero value.
- Otherwise, p\bpo\bop\bpd\bd returns false if an invalid option is encoun-
- tered, the directory stack is empty, or a non-existent directory
- stack entry is specified.
+ Otherwise, p\bpo\bop\bpd\bd returns false if an invalid option is supplied,
+ the directory stack is empty, or _\bn specifies a non-existent di-
+ rectory stack entry.
- If the p\bpo\bop\bpd\bd command is successful, bash runs d\bdi\bir\brs\bs to show the
- final contents of the directory stack, and the return status is
+ If the p\bpo\bop\bpd\bd command is successful, b\bba\bas\bsh\bh runs d\bdi\bir\brs\bs to show the
+ final contents of the directory stack, and the return status is
0.
p\bpr\bri\bin\bnt\btf\bf [-\b-v\bv _\bv_\ba_\br] _\bf_\bo_\br_\bm_\ba_\bt [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
- Write the formatted _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs to the standard output under the
- control of the _\bf_\bo_\br_\bm_\ba_\bt. The -\b-v\bv option causes the output to be
- assigned to the variable _\bv_\ba_\br rather than being printed to the
- standard output.
+ Write the formatted _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs to the standard output under the
+ control of the _\bf_\bo_\br_\bm_\ba_\bt. The -\b-v\bv option assigns the output to the
+ variable _\bv_\ba_\br rather than printing it to the standard output.
The _\bf_\bo_\br_\bm_\ba_\bt is a character string which contains three types of
objects: plain characters, which are simply copied to standard
causes p\bpr\bri\bin\bnt\btf\bf to output the date-time string resulting
from using _\bd_\ba_\bt_\be_\bf_\bm_\bt as a format string for _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be(3).
The corresponding _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt 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 p\bpr\bri\bin\bnt\btf\bf 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 p\bpr\bri\bin\bnt\btf\bf behavior.
The %b, %q, and %T format specifiers all use the field width and
precision arguments from the format specification and write that
p\bpu\bus\bsh\bhd\bd [-\b-n\bn] [+_\bn] [-_\bn]
p\bpu\bus\bsh\bhd\bd [-\b-n\bn] [_\bd_\bi_\br]
- 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, p\bpu\bus\bsh\bhd\bd 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, p\bpu\bus\bsh\bhd\bd exchanges the top two ele-
+ ments of the directory stack. Arguments, if supplied, have the
following meanings:
- -\b-n\bn Suppresses the normal change of directory when rotating
- or adding directories to the stack, so that only the
- stack is manipulated.
- +\b+_\bn Rotates the stack so that the _\bnth directory (counting
- from the left of the list shown by d\bdi\bir\brs\bs, starting with
- zero) is at the top.
+ -\b-n\bn Suppress the normal change of directory when rotating or
+ adding directories to the stack, only manipulate the
+ stack.
+ +\b+_\bn Rotate the stack so that the _\bnth directory (counting from
+ the left of the list shown by d\bdi\bir\brs\bs, starting with zero)
+ is at the top.
-\b-_\bn Rotates the stack so that the _\bnth directory (counting
from the right of the list shown by d\bdi\bir\brs\bs, starting with
zero) is at the top.
- _\bd_\bi_\br Adds _\bd_\bi_\br to the directory stack at the top
+ _\bd_\bi_\br Adds _\bd_\bi_\br to the directory stack at the top.
After the stack has been modified, if the -\b-n\bn option was not sup-
plied, p\bpu\bus\bsh\bhd\bd uses the c\bcd\bd builtin to change to the directory at
the top of the stack. If the c\bcd\bd fails, p\bpu\bus\bsh\bhd\bd returns a non-zero
value.
- Otherwise, if no arguments are supplied, p\bpu\bus\bsh\bhd\bd returns 0 unless
- the directory stack is empty. When rotating the directory
- stack, p\bpu\bus\bsh\bhd\bd returns 0 unless the directory stack is empty or a
- non-existent directory stack element is specified.
+ Otherwise, if no arguments are supplied, p\bpu\bus\bsh\bhd\bd returns zero un-
+ less the directory stack is empty. When rotating the directory
+ stack, p\bpu\bus\bsh\bhd\bd returns zero unless the directory stack is empty or
+ _\bn specifies a non-existent directory stack element.
- If the p\bpu\bus\bsh\bhd\bd command is successful, bash runs d\bdi\bir\brs\bs to show the
+ If the p\bpu\bus\bsh\bhd\bd command is successful, b\bba\bas\bsh\bh runs d\bdi\bir\brs\bs to show the
final contents of the directory stack.
p\bpw\bwd\bd [-\b-L\bLP\bP]
- 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 -\b-P\bP option
is supplied or the -\b-o\bo p\bph\bhy\bys\bsi\bic\bca\bal\bl option to the s\bse\bet\bt builtin command
- is enabled. If the -\b-L\bL option is used, the pathname printed may
- contain symbolic links. The return status is 0 unless an error
+ is enabled. If the -\b-L\bL 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.
r\bre\bea\bad\bd [-\b-E\bEe\ber\brs\bs] [-\b-a\ba _\ba_\bn_\ba_\bm_\be] [-\b-d\bd _\bd_\be_\bl_\bi_\bm] [-\b-i\bi _\bt_\be_\bx_\bt] [-\b-n\bn _\bn_\bc_\bh_\ba_\br_\bs] [-\b-N\bN _\bn_\bc_\bh_\ba_\br_\bs]
[-\b-p\bp _\bp_\br_\bo_\bm_\bp_\bt] [-\b-t\bt _\bt_\bi_\bm_\be_\bo_\bu_\bt] [-\b-u\bu _\bf_\bd] [_\bn_\ba_\bm_\be ...]
- One line is read from the standard input, or from the file de-
- scriptor _\bf_\bd supplied as an argument to the -\b-u\bu option, split into
- words as described above under W\bWo\bor\brd\bd S\bSp\bpl\bli\bit\btt\bti\bin\bng\bg, and the first
- word is assigned to the first _\bn_\ba_\bm_\be, the second word to the sec-
- ond _\bn_\ba_\bm_\be, 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 _\bf_\bd supplied as an argument to the -\b-u\bu option, split it into
+ words as described above under W\bWo\bor\brd\bd S\bSp\bpl\bli\bit\btt\bti\bin\bng\bg, and assign the
+ first word to the first _\bn_\ba_\bm_\be, the second word to the second
+ _\bn_\ba_\bm_\be, and so on. If there are more words than names, the re-
+ maining words and their intervening delimiters are assigned to
the last _\bn_\ba_\bm_\be. If there are fewer words read from the input
stream than names, the remaining names are assigned empty val-
- ues. The characters in I\bIF\bFS\bS are used to split the line into
- words using the same rules the shell uses for expansion (de-
- scribed above under W\bWo\bor\brd\bd S\bSp\bpl\bli\bit\btt\bti\bin\bng\bg). The backslash character
- (\\b\) 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 I\bIF\bFS\bS variable are used
+ to split the line into words using the same rules the shell uses
+ for expansion (described above under W\bWo\bor\brd\bd S\bSp\bpl\bli\bit\btt\bti\bin\bng\bg). The back-
+ slash character (\\b\) removes any special meaning for the next
+ character read and is used for line continuation.
+
+ Options, if supplied, have the following meanings:
-\b-a\ba _\ba_\bn_\ba_\bm_\be
The words are assigned to sequential indices of the array
variable _\ba_\bn_\ba_\bm_\be, starting at 0. _\ba_\bn_\ba_\bm_\be is unset before any
new values are assigned. Other _\bn_\ba_\bm_\be arguments are ig-
nored.
-\b-d\bd _\bd_\be_\bl_\bi_\bm
- The first character of _\bd_\be_\bl_\bi_\bm is used to terminate the in-
- put line, rather than newline. If _\bd_\be_\bl_\bi_\bm is the empty
- string, r\bre\bea\bad\bd will terminate a line when it reads a NUL
- character.
+ The first character of _\bd_\be_\bl_\bi_\bm terminates the input line,
+ rather than newline. If _\bd_\be_\bl_\bi_\bm is the empty string, r\bre\bea\bad\bd
+ will terminate a line when it reads a NUL character.
-\b-e\be If the standard input is coming from a terminal, r\bre\bea\bad\bd
uses r\bre\bea\bad\bdl\bli\bin\bne\be (see R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE above) to obtain the line.
Readline uses the current (or default, if line editing
bash's default completion, including programmable comple-
tion.
-\b-i\bi _\bt_\be_\bx_\bt
- If r\bre\bea\bad\bdl\bli\bin\bne\be is being used to read the line, _\bt_\be_\bx_\bt is
- placed into the editing buffer before editing begins.
+ If r\bre\bea\bad\bdl\bli\bin\bne\be is being used to read the line, r\bre\bea\bad\bd places
+ _\bt_\be_\bx_\bt into the editing buffer before editing begins.
-\b-n\bn _\bn_\bc_\bh_\ba_\br_\bs
r\bre\bea\bad\bd returns after reading _\bn_\bc_\bh_\ba_\br_\bs characters rather than
- waiting for a complete line of input, but honors a delim-
- iter if fewer than _\bn_\bc_\bh_\ba_\br_\bs characters are read before the
- delimiter.
+ waiting for a complete line of input, unless it encoun-
+ ters EOF or r\bre\bea\bad\bd times out, but honors a delimiter if it
+ reads fewer than _\bn_\bc_\bh_\ba_\br_\bs characters before the delimiter.
-\b-N\bN _\bn_\bc_\bh_\ba_\br_\bs
- r\bre\bea\bad\bd returns after reading exactly _\bn_\bc_\bh_\ba_\br_\bs characters
- rather than waiting for a complete line of input, unless
- EOF is encountered or r\bre\bea\bad\bd times out. Delimiter charac-
- ters encountered in the input are not treated specially
- and do not cause r\bre\bea\bad\bd to return until _\bn_\bc_\bh_\ba_\br_\bs characters
- are read. The result is not split on the characters in
- I\bIF\bFS\bS; the intent is that the variable is assigned exactly
- the characters read (with the exception of backslash; see
- the -\b-r\br option below).
+ r\bre\bea\bad\bd returns after reading exactly _\bn_\bc_\bh_\ba_\br_\bs characters
+ rather than waiting for a complete line of input, unless
+ it encounters EOF or r\bre\bea\bad\bd times out. Any delimiter char-
+ acters in the input are not treated specially and do not
+ cause r\bre\bea\bad\bd to return until it has read _\bn_\bc_\bh_\ba_\br_\bs characters.
+ The result is not split on the characters in I\bIF\bFS\bS; the in-
+ tent is that the variable is assigned exactly the charac-
+ ters read (with the exception of backslash; see the -\b-r\br
+ option below).
-\b-p\bp _\bp_\br_\bo_\bm_\bp_\bt
Display _\bp_\br_\bo_\bm_\bp_\bt 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.
-\b-r\br 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.
-\b-s\bs Silent mode. If input is coming from a terminal, charac-
ters are not echoed.
-\b-t\bt _\bt_\bi_\bm_\be_\bo_\bu_\bt
- Cause r\bre\bea\bad\bd to time out and return failure if a complete
- line of input (or a specified number of characters) is
- not read within _\bt_\bi_\bm_\be_\bo_\bu_\bt seconds. _\bt_\bi_\bm_\be_\bo_\bu_\bt may be a deci-
- mal number with a fractional portion following the deci-
- mal point. This option is only effective if r\bre\bea\bad\bd is
- reading input from a terminal, pipe, or other special
- file; it has no effect when reading from regular files.
- If r\bre\bea\bad\bd times out, r\bre\bea\bad\bd saves any partial input read into
- the specified variable _\bn_\ba_\bm_\be. If _\bt_\bi_\bm_\be_\bo_\bu_\bt is 0, r\bre\bea\bad\bd 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.
- -\b-u\bu _\bf_\bd Read input from file descriptor _\bf_\bd.
-
- Other than the case where _\bd_\be_\bl_\bi_\bm is the empty string, r\bre\bea\bad\bd ig-
+ Cause r\bre\bea\bad\bd to time out and return failure if it does not
+ read a complete line of input (or a specified number of
+ characters) within _\bt_\bi_\bm_\be_\bo_\bu_\bt seconds. _\bt_\bi_\bm_\be_\bo_\bu_\bt may be a
+ decimal number with a fractional portion following the
+ decimal point. This option is only effective if r\bre\bea\bad\bd is
+ reading input from a terminal, pipe, or other special
+ file; it has no effect when reading from regular files.
+ If r\bre\bea\bad\bd times out, it saves any partial input read into
+ the specified variable _\bn_\ba_\bm_\be, and the exit status is
+ greater than 128. If _\bt_\bi_\bm_\be_\bo_\bu_\bt is 0, r\bre\bea\bad\bd 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.
+ -\b-u\bu _\bf_\bd Read input from file descriptor _\bf_\bd instead of the stan-
+ dard input.
+
+ Other than the case where _\bd_\be_\bl_\bi_\bm is the empty string, r\bre\bea\bad\bd ig-
nores any NUL characters in the input.
- If no _\bn_\ba_\bm_\be_\bs are supplied, the line read, without the ending de-
- limiter but otherwise unmodified, is assigned to the variable
- R\bRE\bEP\bPL\bLY\bY. The exit status is zero, unless end-of-file is encoun-
- tered, r\bre\bea\bad\bd 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 -\b-u\bu.
+ If no _\bn_\ba_\bm_\be_\bs are supplied, r\bre\bea\bad\bd assigns the line read, without
+ the ending delimiter but otherwise unmodified, to the variable
+ R\bRE\bEP\bPL\bLY\bY.
+
+ The exit status is zero, unless end-of-file is encountered, r\bre\bea\bad\bd
+ 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 -\b-u\bu.
r\bre\bea\bad\bdo\bon\bnl\bly\by [-\b-a\baA\bAf\bf] [-\b-p\bp] [_\bn_\ba_\bm_\be[=_\bw_\bo_\br_\bd] ...]
The given _\bn_\ba_\bm_\be_\bs are marked readonly; the values of these _\bn_\ba_\bm_\be_\bs
- may not be changed by subsequent assignment. If the -\b-f\bf option
- is supplied, the functions corresponding to the _\bn_\ba_\bm_\be_\bs are so
- marked. The -\b-a\ba option restricts the variables to indexed ar-
- rays; the -\b-A\bA option restricts the variables to associative ar-
- rays. If both options are supplied, -\b-A\bA takes precedence. If no
- _\bn_\ba_\bm_\be arguments are given, or if the -\b-p\bp 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 -\b-p\bp option causes output to be displayed in a format
- that may be reused as input. If a variable name is followed by
- =_\bw_\bo_\br_\bd, the value of the variable is set to _\bw_\bo_\br_\bd. The return
- status is 0 unless an invalid option is encountered, one of the
- _\bn_\ba_\bm_\be_\bs is not a valid shell variable name, or -\b-f\bf is supplied with
- a _\bn_\ba_\bm_\be that is not a function.
+ may not be changed by subsequent assignment or unset. If the -\b-f\bf
+ option is supplied, each _\bn_\ba_\bm_\be refers to a shell function. The
+ -\b-a\ba option restricts the variables to indexed arrays; the -\b-A\bA op-
+ tion restricts the variables to associative arrays. If both op-
+ tions are supplied, -\b-A\bA takes precedence. If no _\bn_\ba_\bm_\be arguments
+ are supplied, or if the -\b-p\bp 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\bp op-
+ tion displays output in a format that may be reused as input.
+
+ r\bre\bea\bad\bdo\bon\bnl\bly\by allows the value of a variable to be set at the same
+ time the readonly attribute is changed by following the variable
+ name with =_\bv_\ba_\bl_\bu_\be. This sets the value of the variable is to
+ _\bv_\ba_\bl_\bu_\be while modifying the readonly attribute.
+
+ The return status is 0 unless an invalid option is encountered,
+ one of the _\bn_\ba_\bm_\be_\bs is not a valid shell variable name, or -\b-f\bf is
+ supplied with a _\bn_\ba_\bm_\be that is not a function.
r\bre\bet\btu\bur\brn\bn [_\bn]
- Causes a function to stop executing and return the value speci-
- fied by _\bn to its caller. If _\bn is omitted, the return status is
- that of the last command executed in the function body. If r\bre\be-\b-
- t\btu\bur\brn\bn 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 r\bre\bet\btu\bur\brn\bn is executed during a D\bDE\bEB\bBU\bUG\bG trap, the last
- command used to determine the status is the last command exe-
- cuted by the trap handler before r\bre\bet\btu\bur\brn\bn was invoked. If r\bre\bet\btu\bur\brn\bn
- is used outside a function, but during execution of a script by
- the .\b. (s\bso\bou\bur\brc\bce\be) command, it causes the shell to stop executing
- that script and return either _\bn or the exit status of the last
- command executed within the script as the exit status of the
- script. If _\bn is supplied, the return value is its least signif-
- icant 8 bits. The return status is non-zero if r\bre\bet\btu\bur\brn\bn is sup-
- plied a non-numeric argument, or is used outside a function and
- not during execution of a script by .\b. or s\bso\bou\bur\brc\bce\be. Any command
- associated with the R\bRE\bET\bTU\bUR\bRN\bN 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 _\bn to its caller. If _\bn is omitted, the return
+ status is that of the last command executed. If r\bre\bet\btu\bur\brn\bn 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
+ r\bre\bet\btu\bur\brn\bn is executed during a D\bDE\bEB\bBU\bUG\bG trap, the last command used to
+ determine the status is the last command executed by the trap
+ handler before r\bre\bet\btu\bur\brn\bn was invoked.
+
+ When r\bre\bet\btu\bur\brn\bn is used to terminate execution of a script being ex-
+ ecuted by the .\b. (s\bso\bou\bur\brc\bce\be) command, it causes the shell to stop
+ executing that script and return either _\bn or the exit status of
+ the last command executed within the script as the exit status
+ of the script. If _\bn is supplied, the return value is its least
+ significant 8 bits.
+
+ Any command associated with the R\bRE\bET\bTU\bUR\bRN\bN trap is executed before
+ execution resumes after the function or script.
+
+ The return status is non-zero if r\bre\bet\btu\bur\brn\bn is supplied a non-nu-
+ meric argument, or is used outside a function and not during ex-
+ ecution of a script by .\b. or s\bso\bou\bur\brc\bce\be.
s\bse\bet\bt [-\b-a\bab\bbe\bef\bfh\bhk\bkm\bmn\bnp\bpt\btu\buv\bvx\bxB\bBC\bCE\bEH\bHP\bPT\bT] [-\b-o\bo _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be] [-\b--\b-] [-\b-] [_\ba_\br_\bg ...]
s\bse\bet\bt [+\b+a\bab\bbe\bef\bfh\bhk\bkm\bmn\bnp\bpt\btu\buv\bvx\bxB\bBC\bCE\bEH\bHP\bPT\bT] [+\b+o\bo _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be] [-\b--\b-] [-\b-] [_\ba_\br_\bg ...]
s\bse\bet\bt -\b-o\bo
- s\bse\bet\bt +\b+o\bo 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-
+ s\bse\bet\bt +\b+o\bo 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 _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, 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 _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, 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 $\b$1\b1,
- $\b$2\b2, ..., $\b$_\bn. Options, if specified, have the following mean-
+ $\b$2\b2, ..., $\b$_\bn. Options, if specified, have the following mean-
ings:
-\b-a\ba 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.
- -\b-b\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.
+ -\b-b\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.
-\b-e\be Exit immediately if a _\bp_\bi_\bp_\be_\bl_\bi_\bn_\be (which may consist of a
single _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd), a _\bl_\bi_\bs_\bt, or a _\bc_\bo_\bm_\bp_\bo_\bu_\bn_\bd _\bc_\bo_\bm_\bm_\ba_\bn_\bd
(see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR above), exits with a non-zero status.
no _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be, s\bse\bet\bt prints a series of s\bse\bet\bt commands to
recreate the current option settings on the standard
output.
- -\b-p\bp Turn on _\bp_\br_\bi_\bv_\bi_\bl_\be_\bg_\be_\bd mode. In this mode, the $\b$E\bEN\bNV\bV and
- $\b$B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV files are not processed, shell functions are
- not inherited from the environment, and the S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS,
- B\bBA\bAS\bSH\bHO\bOP\bPT\bTS\bS, C\bCD\bDP\bPA\bAT\bTH\bH, and G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE 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 -\b-p\bp option is not sup-
- plied, these actions are taken and the effective user id
- is set to the real user id. If the -\b-p\bp option is sup-
- plied at startup, the effective user id is not reset.
- Turning this option off causes the effective user and
+ -\b-p\bp Turn on _\bp_\br_\bi_\bv_\bi_\bl_\be_\bg_\be_\bd mode. In this mode, the shell does
+ not read the $\b$E\bEN\bNV\bV and $\b$B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV files, shell functions
+ are not inherited from the environment, and the S\bSH\bHE\bEL\bL-\b-
+ L\bLO\bOP\bPT\bTS\bS, B\bBA\bAS\bSH\bHO\bOP\bPT\bTS\bS, C\bCD\bDP\bPA\bAT\bTH\bH, and G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE 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 -\b-p\bp option is
+ not supplied, these actions are taken and the effective
+ user id is set to the real user id. If the -\b-p\bp 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.
-\b-r\br Enable restricted shell mode. This option cannot be un-
set once it has been set.
-\b-t\bt Exit after reading and executing one command.
-\b-u\bu 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.
-\b-v\bv Print shell input lines as they are read.
- -\b-x\bx After expanding each _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd, f\bfo\bor\br command, c\bca\bas\bse\be
+ -\b-x\bx After expanding each _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd, f\bfo\bor\br command, c\bca\bas\bse\be
command, s\bse\bel\ble\bec\bct\bt command, or arithmetic f\bfo\bor\br command, dis-
- play the expanded value of P\bPS\bS4\b4, followed by the command
- and its expanded arguments or associated word list, to
- standard error.
- -\b-B\bB The shell performs brace expansion (see B\bBr\bra\bac\bce\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
+ play the expanded value of P\bPS\bS4\b4, followed by the command
+ and its expanded arguments or associated word list, to
+ the standard error.
+ -\b-B\bB The shell performs brace expansion (see B\bBr\bra\bac\bce\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
above). This is on by default.
- -\b-C\bC If set, b\bba\bas\bsh\bh does not overwrite an existing file with
- the >\b>, >\b>&\b&, and <\b<>\b> redirection operators. This may be
- overridden when creating output files by using the redi-
- rection operator >\b>|\b| instead of >\b>.
+ -\b-C\bC If set, b\bba\bas\bsh\bh does not overwrite an existing file with
+ the >\b>, >\b>&\b&, and <\b<>\b> redirection operators. Using the
+ redirection operator >\b>|\b| instead of >\b> will override this
+ and force the creation of an output file.
-\b-E\bE If set, any trap on E\bER\bRR\bR is inherited by shell functions,
command substitutions, and commands executed in a sub-
shell environment. The E\bER\bRR\bR trap is normally not inher-
shell functions, command substitutions, and commands ex-
ecuted in a subshell environment. The D\bDE\bEB\bBU\bUG\bG and R\bRE\bET\bTU\bUR\bRN\bN
traps are normally not inherited in such cases.
- -\b--\b- If no arguments follow this option, then the positional
- parameters are unset. Otherwise, the positional parame-
- ters are set to the _\ba_\br_\bgs, even if some of them begin
- with a -\b-.
- -\b- Signal the end of options, cause all remaining _\ba_\br_\bgs to
- be assigned to the positional parameters. The -\b-x\bx and -\b-v\bv
- options are turned off. If there are no _\ba_\br_\bgs, the posi-
- tional parameters remain unchanged.
+ -\b--\b- If no arguments follow this option, unset the positional
+ parameters. Otherwise, set the positional parameters to
+ the _\ba_\br_\bgs, even if some of them begin with a -\b-.
+ -\b- Signal the end of options, and assign all remaining _\ba_\br_\bgs
+ to the positional parameters. The -\b-x\bx and -\b-v\bv options are
+ turned off. If there are no _\ba_\br_\bgs, 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 $\b$-\b-. 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.
s\bsh\bhi\bif\bft\bt [_\bn]
- The positional parameters from _\bn+1 ... are renamed to $\b$1\b1 .\b..\b..\b..\b.
- Parameters represented by the numbers $\b$#\b# down to $\b$#\b#-_\bn+1 are un-
- set. _\bn must be a non-negative number less than or equal to $\b$#\b#.
- If _\bn is 0, no parameters are changed. If _\bn is not given, it is
- assumed to be 1. If _\bn is greater than $\b$#\b#, the positional para-
- meters are not changed. The return status is greater than zero
- if _\bn is greater than $\b$#\b# or less than zero; otherwise 0.
+ Rename positional parameters from _\bn+1 ... to $\b$1\b1 .\b..\b..\b..\b. Parameters
+ represented by the numbers $\b$#\b# down to $\b$#\b#-_\bn+1 are unset. _\bn must
+ be a non-negative number less than or equal to $\b$#\b#. If _\bn is 0,
+ no parameters are changed. If _\bn is not given, it is assumed to
+ be 1. If _\bn is greater than $\b$#\b#, the positional parameters are
+ not changed. The return status is greater than zero if _\bn is
+ greater than $\b$#\b# or less than zero; otherwise 0.
s\bsh\bho\bop\bpt\bt [-\b-p\bpq\bqs\bsu\bu] [-\b-o\bo] [_\bo_\bp_\bt_\bn_\ba_\bm_\be ...]
- 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
-\b-o\bo option is used, those available with the -\b-o\bo option to the s\bse\bet\bt
- builtin command. With no options, or with the -\b-p\bp option, a list
- of all settable options is displayed, with an indication of
- whether or not each is set; if _\bo_\bp_\bt_\bn_\ba_\bm_\be_\bs are supplied, the output
- is restricted to those options. The -\b-p\bp 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 -\b-p\bp option, dis-
+ play a list of all settable options, with an indication of
+ whether or not each is set; if any _\bo_\bp_\bt_\bn_\ba_\bm_\be_\bs are supplied, the
+ output is restricted to those options. The -\b-p\bp option displays
+ output in a form that may be reused as input. Other options
+ have the following meanings:
-\b-s\bs Enable (set) each _\bo_\bp_\bt_\bn_\ba_\bm_\be.
-\b-u\bu Disable (unset) each _\bo_\bp_\bt_\bn_\ba_\bm_\be.
- -\b-q\bq Suppresses normal output (quiet mode); the return status
+ -\b-q\bq Suppresses normal output (quiet mode); the return status
indicates whether the _\bo_\bp_\bt_\bn_\ba_\bm_\be is set or unset. If multi-
- ple _\bo_\bp_\bt_\bn_\ba_\bm_\be arguments are given with -\b-q\bq, the return sta-
- tus is zero if all _\bo_\bp_\bt_\bn_\ba_\bm_\be_\bs are enabled; non-zero other-
- wise.
+ ple _\bo_\bp_\bt_\bn_\ba_\bm_\be arguments are supplied with -\b-q\bq, the return
+ status is zero if all _\bo_\bp_\bt_\bn_\ba_\bm_\be_\bs are enabled; non-zero oth-
+ erwise.
-\b-o\bo Restricts the values of _\bo_\bp_\bt_\bn_\ba_\bm_\be to be those defined for
the -\b-o\bo option to the s\bse\bet\bt builtin.
If set, an argument to the c\bcd\bd builtin command that is
not a directory is assumed to be the name of a variable
whose value is the directory to change to.
- c\bcd\bds\bsp\bpe\bel\bll\bl If set, minor errors in the spelling of a directory com-
- ponent in a c\bcd\bd 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.
+ c\bcd\bds\bsp\bpe\bel\bll\bl If set, the c\bcd\bd 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 c\bcd\bd corrects the directory name,
+ it prints the corrected filename, and the command pro-
+ ceeds. This option is only used by interactive shells.
c\bch\bhe\bec\bck\bkh\bha\bas\bsh\bh
If set, b\bba\bas\bsh\bh 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, b\bba\bas\bsh\bh performs a normal path
+ search.
c\bch\bhe\bec\bck\bkj\bjo\bob\bbs\bs
If set, b\bba\bas\bsh\bh 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 J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL above). The shell always postpones ex-
- iting if any jobs are stopped.
+ are running, b\bba\bas\bsh\bh defers the exit until a second exit is
+ attempted without an intervening command (see J\bJO\bOB\bB C\bCO\bON\bN-\b-
+ T\bTR\bRO\bOL\bL above). The shell always postpones exiting if any
+ jobs are stopped.
c\bch\bhe\bec\bck\bkw\bwi\bin\bns\bsi\biz\bze\be
- If set, b\bba\bas\bsh\bh checks the window size after each external
- (non-builtin) command and, if necessary, updates the
- values of L\bLI\bIN\bNE\bES\bS and C\bCO\bOL\bLU\bUM\bMN\bNS\bS. This option is enabled by
- default.
+ If set, b\bba\bas\bsh\bh checks the window size after each external
+ (non-builtin) command and, if necessary, updates the
+ values of L\bLI\bIN\bNE\bES\bS and C\bCO\bOL\bLU\bUM\bMN\bNS\bS, using the file descriptor
+ associated with the standard error if it is a terminal.
+ This option is enabled by default.
c\bcm\bmd\bdh\bhi\bis\bst\bt If set, b\bba\bas\bsh\bh 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
e\bex\bxe\bec\bcf\bfa\bai\bil\bl
If set, a non-interactive shell will not exit if it can-
not execute the file specified as an argument to the
- e\bex\bxe\bec\bc builtin command. An interactive shell does not
- exit if e\bex\bxe\bec\bc fails.
+ e\bex\bxe\bec\bc builtin. An interactive shell does not exit if
+ e\bex\bxe\bec\bc fails.
e\bex\bxp\bpa\ban\bnd\bd_\b_a\bal\bli\bia\bas\bse\bes\bs
If set, aliases are expanded as described above under
shell functions, and subshells invoked with (\b(
_\bc_\bo_\bm_\bm_\ba_\bn_\bd )\b) inherit the E\bER\bRR\bR trap.
- e\bex\bxt\btg\bgl\blo\bob\bb If set, the extended pattern matching features described
- above under P\bPa\bat\bth\bhn\bna\bam\bme\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn are enabled.
+ e\bex\bxt\btg\bgl\blo\bob\bb If set, enable the extended pattern matching features
+ described above under P\bPa\bat\bth\bhn\bna\bam\bme\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn.
e\bex\bxt\btq\bqu\buo\bot\bte\be
- If set, $\b$'_\bs_\bt_\br_\bi_\bn_\bg' and $\b$"_\bs_\bt_\br_\bi_\bn_\bg" quoting is performed
- within $\b${\b{_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br}\b} expansions enclosed in double
+ If set, $\b$'_\bs_\bt_\br_\bi_\bn_\bg' and $\b$"_\bs_\bt_\br_\bi_\bn_\bg" quoting is performed
+ within $\b${\b{_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br}\b} expansions enclosed in double
quotes. This option is enabled by default.
f\bfa\bai\bil\blg\bgl\blo\bob\bb
- 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.
f\bfo\bor\brc\bce\be_\b_f\bfi\big\bgn\bno\bor\bre\be
- If set, the suffixes specified by the F\bFI\bIG\bGN\bNO\bOR\bRE\bE shell
- variable cause words to be ignored when performing word
+ If set, the suffixes specified by the F\bFI\bIG\bGN\bNO\bOR\bRE\bE shell
+ variable cause words to be ignored when performing word
completion even if the ignored words are the only possi-
- ble completions. See S\bSH\bHE\bEL\bLL\bL V\bVA\bAR\bRI\bIA\bAB\bBL\bLE\bES\bS above for a de-
- scription of F\bFI\bIG\bGN\bNO\bOR\bRE\bE. This option is enabled by de-
+ ble completions. See S\bSH\bHE\bEL\bLL\bL V\bVA\bAR\bRI\bIA\bAB\bBL\bLE\bES\bS above for a de-
+ scription of F\bFI\bIG\bGN\bNO\bOR\bRE\bE. This option is enabled by de-
fault.
g\bgl\blo\bob\bba\bas\bsc\bci\bii\bir\bra\ban\bng\bge\bes\bs
- If set, range expressions used in pattern matching
- bracket expressions (see P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg 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 b\bb will not collate
- between A\bA and B\bB, and upper-case and lower-case ASCII
- characters will collate together.
+ If set, range expressions used in pattern matching
+ bracket expressions (see P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg 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 b\bb
+ will not collate between A\bA and B\bB, and upper-case and
+ lower-case ASCII characters will collate together.
g\bgl\blo\bob\bbs\bsk\bki\bip\bpd\bdo\bot\bts\bs
- 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.
g\bgl\blo\bob\bbs\bst\bta\bar\br
If set, the pattern *\b**\b* 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 /\b/,
+ text will match all files and zero or more directories
+ and subdirectories. If the pattern is followed by a /\b/,
only directories and subdirectories match.
g\bgn\bnu\bu_\b_e\ber\brr\brf\bfm\bmt\bt
GNU error message format.
h\bhi\bis\bst\bta\bap\bpp\bpe\ben\bnd\bd
- 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 H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE variable when the shell ex-
its, rather than overwriting the file.
h\bhi\bis\bst\btr\bre\bee\bed\bdi\bit\bt
- If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, a user is given the
- opportunity to re-edit a failed history substitution.
+ If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, the user is given
+ the opportunity to re-edit a failed history substitu-
+ tion.
h\bhi\bis\bst\btv\bve\ber\bri\bif\bfy\by
If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, the results of his-
enabled.
i\bin\bnt\bte\ber\bra\bac\bct\bti\biv\bve\be_\b_c\bco\bom\bmm\bme\ben\bnt\bts\bs
- 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 C\bCO\bOM\bMM\bME\bEN\bNT\bTS\bS above). This op-
- tion is enabled by default.
+ In an interactive shell, a word beginning with #\b# causes
+ that word and all remaining characters on that line to
+ be ignored, as in a non-interactive shell (see C\bCO\bOM\bMM\bME\bEN\bNT\bTS\bS
+ above). This option is enabled by default.
l\bla\bas\bst\btp\bpi\bip\bpe\be
- 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.
- l\bli\bit\bth\bhi\bis\bst\bt If set, and the c\bcm\bmd\bdh\bhi\bis\bst\bt option is enabled, multi-line
+ l\bli\bit\bth\bhi\bis\bst\bt If set, and the c\bcm\bmd\bdh\bhi\bis\bst\bt option is enabled, multi-line
commands are saved to the history with embedded newlines
rather than using semicolon separators where possible.
tribute is not inherited.
l\blo\boc\bca\bal\blv\bva\bar\br_\b_u\bun\bns\bse\bet\bt
- If set, calling u\bun\bns\bse\bet\bt 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 u\bun\bns\bse\bet\bt 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.
read".
n\bno\bo_\b_e\bem\bmp\bpt\bty\by_\b_c\bcm\bmd\bd_\b_c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn
- If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, b\bba\bas\bsh\bh will not at-
- tempt to search the P\bPA\bAT\bTH\bH for possible completions when
- completion is attempted on an empty line.
+ If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, b\bba\bas\bsh\bh does not search
+ P\bPA\bAT\bTH\bH for possible completions when completion is at-
+ tempted on an empty line.
n\bno\boc\bca\bas\bse\beg\bgl\blo\bob\bb
- If set, b\bba\bas\bsh\bh matches filenames in a case-insensitive
+ If set, b\bba\bas\bsh\bh matches filenames in a case-insensitive
fashion when performing pathname expansion (see P\bPa\bat\bth\bhn\bna\bam\bme\be
E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn above).
n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh
- If set, b\bba\bas\bsh\bh matches patterns in a case-insensitive
+ If set, b\bba\bas\bsh\bh matches patterns in a case-insensitive
fashion when performing matching while executing c\bca\bas\bse\be or
[\b[[\b[ 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.
n\bno\boe\bex\bxp\bpa\ban\bnd\bd_\b_t\btr\bra\ban\bns\bsl\bla\bat\bti\bio\bon\bn
- If set, b\bba\bas\bsh\bh encloses the translated results of $\b$"\b"..."\b"
- quoting in single quotes instead of double quotes. If
+ If set, b\bba\bas\bsh\bh encloses the translated results of $\b$"\b"..."\b"
+ quoting in single quotes instead of double quotes. If
the string is not translated, this has no effect.
n\bnu\bul\bll\blg\bgl\blo\bob\bb
p\bpa\bat\bts\bsu\bub\bb_\b_r\bre\bep\bpl\bla\bac\bce\bem\bme\ben\bnt\bt
If set, b\bba\bas\bsh\bh expands occurrences of &\b& in the replacement
- string of pattern substitution to the text matched by
- the pattern, as described under P\bPa\bar\bra\bam\bme\bet\bte\ber\br E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
+ string of pattern substitution to the text matched by
+ the pattern, as described under P\bPa\bar\bra\bam\bme\bet\bte\ber\br E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
above. This option is enabled by default.
p\bpr\bro\bog\bgc\bco\bom\bmp\bp
- If set, the programmable completion facilities (see P\bPr\bro\bo-\b-
- g\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn above) are enabled. This option is
- enabled by default.
+ If set, enable the programmable completion facilities
+ (see P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn above). This option is en-
+ abled by default.
p\bpr\bro\bog\bgc\bco\bom\bmp\bp_\b_a\bal\bli\bia\bas\bs
If set, and programmable completion is enabled, b\bba\bas\bsh\bh
treats a command name that doesn't have any completions
- as a possible alias and attempts alias expansion. If it
- has an alias, b\bba\bas\bsh\bh attempts programmable completion us-
+ as a possible alias and attempts alias expansion. If it
+ has an alias, b\bba\bas\bsh\bh attempts programmable completion us-
ing the command word resulting from the expanded alias.
p\bpr\bro\bom\bmp\bpt\btv\bva\bar\brs\bs
If set, prompt strings undergo parameter expansion, com-
- mand substitution, arithmetic expansion, and quote re-
- moval after being expanded as described in P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG
+ mand substitution, arithmetic expansion, and quote re-
+ moval after being expanded as described in P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG
above. This option is enabled by default.
r\bre\bes\bst\btr\bri\bic\bct\bte\bed\bd_\b_s\bsh\bhe\bel\bll\bl
- The shell sets this option if it is started in re-
- stricted mode (see R\bRE\bES\bST\bTR\bRI\bIC\bCT\bTE\bED\bD S\bSH\bHE\bEL\bLL\bL 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 R\bRE\bES\bST\bTR\bRI\bIC\bCT\bTE\bED\bD S\bSH\bHE\bEL\bLL\bL 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.
s\bsh\bhi\bif\bft\bt_\b_v\bve\ber\brb\bbo\bos\bse\be
- If set, the s\bsh\bhi\bif\bft\bt builtin prints an error message when
+ If set, the s\bsh\bhi\bif\bft\bt builtin prints an error message when
the shift count exceeds the number of positional parame-
ters.
s\bso\bou\bur\brc\bce\bep\bpa\bat\bth\bh
If set, the .\b. (s\bso\bou\bur\brc\bce\be) builtin uses the value of P\bPA\bAT\bTH\bH to
- find the directory containing the file supplied as an
- argument when the -\b-p\bp option is not supplied. This op-
+ find the directory containing the file supplied as an
+ argument when the -\b-p\bp option is not supplied. This op-
tion is enabled by default.
v\bva\bar\brr\bre\bed\bdi\bir\br_\b_c\bcl\blo\bos\bse\be
- If set, the shell automatically closes file descriptors
- assigned using the _\b{_\bv_\ba_\br_\bn_\ba_\bm_\be_\b} redirection syntax (see
+ If set, the shell automatically closes file descriptors
+ assigned using the _\b{_\bv_\ba_\br_\bn_\ba_\bm_\be_\b} redirection syntax (see
R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN above) instead of leaving them open when the
command completes.
x\bxp\bpg\bg_\b_e\bec\bch\bho\bo
- If set, the e\bec\bch\bho\bo builtin expands backslash-escape se-
- quences by default. If the p\bpo\bos\bsi\bix\bx shell option is also
+ If set, the e\bec\bch\bho\bo builtin expands backslash-escape se-
+ quences by default. If the p\bpo\bos\bsi\bix\bx shell option is also
enabled, e\bec\bch\bho\bo does not interpret any options.
s\bsu\bus\bsp\bpe\ben\bnd\bd [-\b-f\bf]
- Suspend the execution of this shell until it receives a S\bSI\bIG\bGC\bCO\bON\bNT\bT
- signal. A login shell, or a shell without job control enabled,
- cannot be suspended; the -\b-f\bf 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 -\b-f\bf is
- not supplied.
+ Suspend the execution of this shell until it receives a S\bSI\bIG\bGC\bCO\bON\bNT\bT
+ signal. A login shell, or a shell without job control enabled,
+ cannot be suspended; the -\b-f\bf 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 -\b-f\bf is not sup-
+ plied.
t\bte\bes\bst\bt _\be_\bx_\bp_\br
[\b[ _\be_\bx_\bp_\br ]\b]
Return a status of 0 (true) or 1 (false) depending on the evalu-
- ation of the conditional expression _\be_\bx_\bp_\br. Each operator and
- operand must be a separate argument. Expressions are composed
- of the primaries described above under C\bCO\bON\bND\bDI\bIT\bTI\bIO\bON\bNA\bAL\bL E\bEX\bXP\bPR\bRE\bES\bSS\bSI\bIO\bON\bNS\bS.
- t\bte\bes\bst\bt does not accept any options, nor does it accept and ignore
+ ation of the conditional expression _\be_\bx_\bp_\br. Each operator and
+ operand must be a separate argument. Expressions are composed
+ of the primaries described above under C\bCO\bON\bND\bDI\bIT\bTI\bIO\bON\bNA\bAL\bL E\bEX\bXP\bPR\bRE\bES\bSS\bSI\bIO\bON\bNS\bS.
+ t\bte\bes\bst\bt does not accept any options, nor does it accept and ignore
an argument of -\b--\b- 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. t\bte\bes\bst\bt uses operator
+ precedence when there are five or more arguments.
!\b! _\be_\bx_\bp_\br True if _\be_\bx_\bp_\br is false.
(\b( _\be_\bx_\bp_\br )\b)
Returns the value of _\be_\bx_\bp_\br. This may be used to override
- the normal precedence of operators.
+ normal operator precedence.
_\be_\bx_\bp_\br_\b1 -a\ba _\be_\bx_\bp_\br_\b2
True if both _\be_\bx_\bp_\br_\b1 and _\be_\bx_\bp_\br_\b2 are true.
_\be_\bx_\bp_\br_\b1 -o\bo _\be_\bx_\bp_\br_\b2
The following conditions are applied in the order listed.
If the first argument is !\b!, 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 (\b( and
- the fourth argument is exactly )\b), 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 (\b( and the
+ fourth argument is exactly )\b), 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 _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, or if the expression is part of
the [\b[[\b[ command, the <\b< and >\b> operators sort using the current lo-
- cale. If the shell is not in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, the t\bte\bes\bst\bt and [\b[ com-
+ cale. If the shell is not in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, the t\bte\bes\bst\bt and [\b[ 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 -\b-a\ba and -\b-o\bo 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 -\b-a\ba and
+ -\b-o\bo with the shell's &\b&&\b& and |\b||\b| list operators.
+
t\bti\bim\bme\bes\bs Print the accumulated user and system times for the shell and
for processes run from the shell. The return status is 0.
- t\btr\bra\bap\bp [-\b-l\blp\bp] [[_\ba_\bc_\bt_\bi_\bo_\bn] _\bs_\bi_\bg_\bs_\bp_\be_\bc ...]
+ t\btr\bra\bap\bp [-\b-P\bPl\blp\bp] [[_\ba_\bc_\bt_\bi_\bo_\bn] _\bs_\bi_\bg_\bs_\bp_\be_\bc ...]
The _\ba_\bc_\bt_\bi_\bo_\bn is a command that is read and executed when the shell
- receives signal(s) _\bs_\bi_\bg_\bs_\bp_\be_\bc. If _\ba_\bc_\bt_\bi_\bo_\bn is absent (and there is a
- single _\bs_\bi_\bg_\bs_\bp_\be_\bc) or -\b-, each specified signal is reset to its
- original disposition (the value it had upon entrance to the
- shell). If _\ba_\bc_\bt_\bi_\bo_\bn is the null string the signal specified by
- each _\bs_\bi_\bg_\bs_\bp_\be_\bc is ignored by the shell and by the commands it in-
- vokes.
-
- If no arguments are supplied, t\btr\bra\bap\bp displays the actions associ-
+ receives any of the signals _\bs_\bi_\bg_\bs_\bp_\be_\bc. If _\ba_\bc_\bt_\bi_\bo_\bn is absent (and
+ there is a single _\bs_\bi_\bg_\bs_\bp_\be_\bc) or -\b-, each specified _\bs_\bi_\bg_\bs_\bp_\be_\bc is reset
+ to the value it had when the shell was started. If _\ba_\bc_\bt_\bi_\bo_\bn is
+ the null string the signal specified by each _\bs_\bi_\bg_\bs_\bp_\be_\bc is ignored
+ by the shell and by the commands it invokes.
+
+ If no arguments are supplied, t\btr\bra\bap\bp displays the actions associ-
ated with each trapped signal as a set of t\btr\bra\bap\bp commands that can
- be reused as shell input to restore the current signal disposi-
- tions. If -\b-p\bp is given, and _\ba_\bc_\bt_\bi_\bo_\bn is not present, then t\btr\bra\bap\bp
- displays the actions associated with each _\bs_\bi_\bg_\bs_\bp_\be_\bc or, if none
+ be reused as shell input to restore the current signal disposi-
+ tions. If -\b-p\bp is given, and _\ba_\bc_\bt_\bi_\bo_\bn is not present, then t\btr\bra\bap\bp
+ displays the actions associated with each _\bs_\bi_\bg_\bs_\bp_\be_\bc or, if none
are supplied, for all trapped signals, as a set of t\btr\bra\bap\bp commands
- that can be reused as shell input to restore the current signal
- dispositions. The -\b-P\bP option behaves similarly, but displays
- only the actions associated with each _\bs_\bi_\bg_\bs_\bp_\be_\bc argument. -\b-P\bP re-
- quires at least one _\bs_\bi_\bg_\bs_\bp_\be_\bc argument. The -\b-P\bP or -\b-p\bp options to
- t\btr\bra\bap\bp may be used in a subshell environment (e.g., command sub-
- stitution) and, as long as they are used before t\btr\bra\bap\bp is used to
- change a signal's handling, will display the state of its par-
- ent's traps.
-
- The -\b-l\bl option causes t\btr\bra\bap\bp to print a list of signal names and
- their corresponding numbers. Each _\bs_\bi_\bg_\bs_\bp_\be_\bc is either a signal
- name defined in <_\bs_\bi_\bg_\bn_\ba_\bl_\b._\bh>, or a signal number. Signal names
- are case insensitive and the S\bSI\bIG\bG prefix is optional.
-
- If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is E\bEX\bXI\bIT\bT (0) the command _\ba_\bc_\bt_\bi_\bo_\bn is executed on exit
- from the shell. If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is D\bDE\bEB\bBU\bUG\bG, the command _\ba_\bc_\bt_\bi_\bo_\bn is
- executed before every _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd, _\bf_\bo_\br command, _\bc_\ba_\bs_\be command,
- _\bs_\be_\bl_\be_\bc_\bt command, (( arithmetic command, [[ conditional command,
- arithmetic _\bf_\bo_\br command, and before the first command executes in
- a shell function (see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR above). Refer to the de-
- scription of the e\bex\bxt\btd\bde\beb\bbu\bug\bg option to the s\bsh\bho\bop\bpt\bt builtin for de-
- tails of its effect on the D\bDE\bEB\bBU\bUG\bG trap. If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is R\bRE\bET\bTU\bUR\bRN\bN,
- the command _\ba_\bc_\bt_\bi_\bo_\bn is executed each time a shell function or a
- script executed with the .\b. or s\bso\bou\bur\brc\bce\be builtins finishes execut-
- ing.
-
- If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is E\bER\bRR\bR, the command _\ba_\bc_\bt_\bi_\bo_\bn 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 E\bER\bRR\bR trap is not executed if the
+ that can be reused as shell input to restore the current signal
+ dispositions. The -\b-P\bP option behaves similarly, but displays
+ only the actions associated with each _\bs_\bi_\bg_\bs_\bp_\be_\bc argument. -\b-P\bP re-
+ quires at least one _\bs_\bi_\bg_\bs_\bp_\be_\bc argument. The -\b-P\bP or -\b-p\bp options may
+ be used in a subshell environment (e.g., command substitution)
+ and, as long as they are used before t\btr\bra\bap\bp is used to change a
+ signal's handling, will display the state of its parent's traps.
+
+ The -\b-l\bl option prints a list of signal names and their corre-
+ sponding numbers. Each _\bs_\bi_\bg_\bs_\bp_\be_\bc is either a signal name defined
+ in <_\bs_\bi_\bg_\bn_\ba_\bl_\b._\bh>, or a signal number. Signal names are case insen-
+ sitive and the S\bSI\bIG\bG prefix is optional. If -\b-l\bl is supplied with
+ no _\bs_\bi_\bg_\bs_\bp_\be_\bc arguments, it prints a list of valid signal names.
+
+ If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is E\bEX\bXI\bIT\bT (0), _\ba_\bc_\bt_\bi_\bo_\bn is executed on exit from the
+ shell. If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is D\bDE\bEB\bBU\bUG\bG, _\ba_\bc_\bt_\bi_\bo_\bn is executed before every
+ _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd, _\bf_\bo_\br command, _\bc_\ba_\bs_\be command, _\bs_\be_\bl_\be_\bc_\bt command, ((
+ arithmetic command, [[ conditional command, arithmetic _\bf_\bo_\br com-
+ mand, and before the first command executes in a shell function
+ (see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR above). Refer to the description of the
+ e\bex\bxt\btd\bde\beb\bbu\bug\bg shell option (see s\bsh\bho\bop\bpt\bt above) for details of its ef-
+ fect on the D\bDE\bEB\bBU\bUG\bG trap. If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is R\bRE\bET\bTU\bUR\bRN\bN, _\ba_\bc_\bt_\bi_\bo_\bn is exe-
+ cuted each time a shell function or a script executed with the .\b.
+ or s\bso\bou\bur\brc\bce\be builtins finishes executing.
+
+ If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is E\bER\bRR\bR, _\ba_\bc_\bt_\bi_\bo_\bn 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 E\bER\bRR\bR trap is not executed if the
failed command is part of the command list immediately following
a w\bwh\bhi\bil\ble\be or u\bun\bnt\bti\bil\bl keyword, part of the test in an _\bi_\bf statement,
part of a command executed in a &\b&&\b& or |\b||\b| list except the command
following the final &\b&&\b& or |\b||\b|, any command in a pipeline but the
- last, or if the command's return value is being inverted using
- !\b!. These are the same conditions obeyed by the e\ber\brr\bre\bex\bxi\bit\bt (-\b-e\be) op-
- tion.
+ last (subject to the state of the p\bpi\bip\bpe\bef\bfa\bai\bil\bl shell option), or if
+ the command's return value is being inverted using !\b!. These are
+ the same conditions obeyed by the e\ber\brr\bre\bex\bxi\bit\bt (-\b-e\be) option.
When the shell is not interactive, signals ignored upon entry to
the shell cannot be trapped or reset. Interactive shells permit
t\btr\bru\bue\be Does nothing, returns a 0 status.
t\bty\byp\bpe\be [-\b-a\baf\bft\btp\bpP\bP] _\bn_\ba_\bm_\be [_\bn_\ba_\bm_\be ...]
- With no options, indicate how each _\bn_\ba_\bm_\be would be interpreted if
- used as a command name. If the -\b-t\bt option is used, t\bty\byp\bpe\be prints a
- string which is one of _\ba_\bl_\bi_\ba_\bs, _\bk_\be_\by_\bw_\bo_\br_\bd, _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn, _\bb_\bu_\bi_\bl_\bt_\bi_\bn, or
- _\bf_\bi_\bl_\be if _\bn_\ba_\bm_\be is an alias, shell reserved word, function,
- builtin, or executable disk file, respectively. If the _\bn_\ba_\bm_\be is
- not found, then nothing is printed, and t\bty\byp\bpe\be returns a non-zero
- exit status. If the -\b-p\bp option is used, t\bty\byp\bpe\be either returns the
- name of the executable file that would be found by searching
- $\b$P\bPA\bAT\bTH\bH if _\bn_\ba_\bm_\be were specified as a command name, or nothing if
- "type -t name" would not return _\bf_\bi_\bl_\be. The -\b-P\bP option forces a
- P\bPA\bAT\bTH\bH search for each _\bn_\ba_\bm_\be, even if "type -t name" would not re-
- turn _\bf_\bi_\bl_\be. If a command is hashed, -\b-p\bp and -\b-P\bP print the hashed
- value, which is not necessarily the file that appears first in
- P\bPA\bAT\bTH\bH. If the -\b-a\ba option is used, t\bty\byp\bpe\be prints all of the places
- that contain a command named _\bn_\ba_\bm_\be. This includes aliases, re-
- served words, functions, and builtins, but the path search op-
- tions (-\b-p\bp and -\b-P\bP) can be supplied to restrict the output to exe-
- cutable files. t\bty\byp\bpe\be does not consult the table of hashed com-
- mands when using -\b-a\ba with -\b-p\bp, and only performs a P\bPA\bAT\bTH\bH search for
- _\bn_\ba_\bm_\be. The -\b-f\bf option suppresses shell function lookup, as with
- the c\bco\bom\bmm\bma\ban\bnd\bd builtin. t\bty\byp\bpe\be returns true if all of the arguments
- are found, false if any are not found.
+ Indicate how each _\bn_\ba_\bm_\be would be interpreted if used as a command
+ name.
+
+ If the -\b-t\bt option is used, t\bty\byp\bpe\be prints a string which is one of
+ _\ba_\bl_\bi_\ba_\bs, _\bk_\be_\by_\bw_\bo_\br_\bd, _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn, _\bb_\bu_\bi_\bl_\bt_\bi_\bn, or _\bf_\bi_\bl_\be if _\bn_\ba_\bm_\be is an alias,
+ shell reserved word, function, builtin, or executable file, re-
+ spectively. If the _\bn_\ba_\bm_\be is not found, t\bty\byp\bpe\be prints nothing and
+ returns a non-zero exit status.
+
+ If the -\b-p\bp option is used, t\bty\byp\bpe\be either returns the pathname of
+ the executable file that would be found by searching $\b$P\bPA\bAT\bTH\bH for
+ _\bn_\ba_\bm_\be or nothing if "type -t name" would not return _\bf_\bi_\bl_\be. The -\b-P\bP
+ option forces a P\bPA\bAT\bTH\bH search for each _\bn_\ba_\bm_\be, even if "type -t
+ name" would not return _\bf_\bi_\bl_\be. If _\bn_\ba_\bm_\be is present in the table of
+ hashed commands, -\b-p\bp and -\b-P\bP print the hashed value, which is not
+ necessarily the file that appears first in P\bPA\bAT\bTH\bH.
+
+ If the -\b-a\ba option is used, t\bty\byp\bpe\be prints all of the places that
+ contain a command named _\bn_\ba_\bm_\be. This includes aliases, reserved
+ words, functions, and builtins, but the path search options (-\b-p\bp
+ and -\b-P\bP) can be supplied to restrict the output to executable
+ files. t\bty\byp\bpe\be does not consult the table of hashed commands when
+ using -\b-a\ba with -\b-p\bp, and only performs a P\bPA\bAT\bTH\bH search for _\bn_\ba_\bm_\be.
+
+ The -\b-f\bf option suppresses shell function lookup, as with the c\bco\bom\bm-\b-
+ m\bma\ban\bnd\bd builtin. t\bty\byp\bpe\be returns true if all of the arguments are
+ found, false if any are not found.
u\bul\bli\bim\bmi\bit\bt [-\b-H\bHS\bS] -\b-a\ba
u\bul\bli\bim\bmi\bit\bt [-\b-H\bHS\bS] [-\b-b\bbc\bcd\bde\bef\bfi\bik\bkl\blm\bmn\bnp\bpq\bqr\brs\bst\btu\buv\bvx\bxP\bPR\bRT\bT [_\bl_\bi_\bm_\bi_\bt]]
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 -\b-H\bH and -\b-S\bS 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 -\b-H\bH nor -\b-S\bS is speci-
- fied, both the soft and hard limits are set. The value of _\bl_\bi_\bm_\bi_\bt
- can be a number in the unit specified for the resource or one of
- the special values h\bha\bar\brd\bd, s\bso\bof\bft\bt, or u\bun\bnl\bli\bim\bmi\bit\bte\bed\bd, which stand for the
- current hard limit, the current soft limit, and no limit, re-
- spectively. If _\bl_\bi_\bm_\bi_\bt is omitted, the current value of the soft
- limit of the resource is printed, unless the -\b-H\bH 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:
- -\b-a\ba 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 -\b-H\bH nor -\b-S\bS is speci-
+ fied, u\bul\bli\bim\bmi\bit\bt sets both the soft and hard limits.
+
+ The value of _\bl_\bi_\bm_\bi_\bt can be a number in the unit specified for the
+ resource or one of the special values h\bha\bar\brd\bd, s\bso\bof\bft\bt, or u\bun\bnl\bli\bim\bmi\bit\bte\bed\bd,
+ which stand for the current hard limit, the current soft limit,
+ and no limit, respectively. If _\bl_\bi_\bm_\bi_\bt is omitted, u\bul\bli\bim\bmi\bit\bt prints
+ the current value of the soft limit of the resource, unless the
+ -\b-H\bH 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:
+ -\b-a\ba Report all current limits; no limits are set
-\b-b\bb The maximum socket buffer size
-\b-c\bc The maximum size of core files created
-\b-d\bd The maximum size of a process's data segment
-\b-e\be The maximum scheduling priority ("nice").
- -\b-f\bf The maximum size of files written by the shell and its
+ -\b-f\bf The maximum size of files written by the shell and its
children
-\b-i\bi The maximum number of pending signals
-\b-k\bk The maximum number of kqueues that may be allocated
-\b-l\bl The maximum size that may be locked into memory
- -\b-m\bm The maximum resident set size (many systems do not honor
+ -\b-m\bm The maximum resident set size (many systems do not honor
this limit)
-\b-n\bn The maximum number of open file descriptors (most systems
do not allow this value to be set)
-\b-r\br The maximum real-time scheduling priority
-\b-s\bs The maximum stack size
-\b-t\bt The maximum amount of cpu time in seconds
- -\b-u\bu The maximum number of processes available to a single
+ -\b-u\bu The maximum number of processes available to a single
user
- -\b-v\bv The maximum amount of virtual memory available to the
+ -\b-v\bv The maximum amount of virtual memory available to the
shell and, on some systems, to its children
-\b-x\bx The maximum number of file locks
-\b-P\bP The maximum number of pseudoterminals
- -\b-R\bR The maximum time a real-time process can run before
+ -\b-R\bR The maximum time a real-time process can run before
blocking, in microseconds
-\b-T\bT The maximum number of threads
- If _\bl_\bi_\bm_\bi_\bt is given, and the -\b-a\ba option is not used, _\bl_\bi_\bm_\bi_\bt is the
- new value of the specified resource. If no option is given,
- then -\b-f\bf is assumed. Values are in 1024-byte increments, except
- for -\b-t\bt, which is in seconds; -\b-R\bR, which is in microseconds; -\b-p\bp,
- which is in units of 512-byte blocks; -\b-P\bP, -\b-T\bT, -\b-b\bb, -\b-k\bk, -\b-n\bn, and
- -\b-u\bu, which are unscaled values; and, when in posix mode, -\b-c\bc and
- -\b-f\bf, 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 _\bl_\bi_\bm_\bi_\bt is supplied, and the -\b-a\ba option is not used, _\bl_\bi_\bm_\bi_\bt is
+ the new value of the specified resource. If no option is sup-
+ plied, then -\b-f\bf is assumed.
+
+ Values are in 1024-byte increments, except for -\b-t\bt, which is in
+ seconds; -\b-R\bR, which is in microseconds; -\b-p\bp, which is in units of
+ 512-byte blocks; -\b-P\bP, -\b-T\bT, -\b-b\bb, -\b-k\bk, -\b-n\bn, and -\b-u\bu, which are unscaled
+ values; and, when in posix mode, -\b-c\bc and -\b-f\bf, 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.
u\bum\bma\bas\bsk\bk [-\b-p\bp] [-\b-S\bS] [_\bm_\bo_\bd_\be]
- The user file-creation mask is set to _\bm_\bo_\bd_\be. If _\bm_\bo_\bd_\be 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
- _\bc_\bh_\bm_\bo_\bd(1). If _\bm_\bo_\bd_\be is omitted, the current value of the mask is
- printed. The -\b-S\bS option causes the mask to be printed in sym-
- bolic form; the default output is an octal number. If the -\b-p\bp
- option is supplied, and _\bm_\bo_\bd_\be 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 _\bm_\bo_\bd_\be argument was supplied,
- and false otherwise.
+ Set the user file-creation mask to _\bm_\bo_\bd_\be. If _\bm_\bo_\bd_\be 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
+ _\bc_\bh_\bm_\bo_\bd(1). If _\bm_\bo_\bd_\be is omitted, u\bum\bma\bas\bsk\bk prints the current value of
+ the mask. The -\b-S\bS option without a _\bm_\bo_\bd_\be argument prints the mask
+ in a symbolic format; the default output is an octal number. If
+ the -\b-p\bp option is supplied, and _\bm_\bo_\bd_\be 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 _\bm_\bo_\bd_\be argument was
+ supplied, and non-zero otherwise.
u\bun\bna\bal\bli\bia\bas\bs [-a\ba] [_\bn_\ba_\bm_\be ...]
Remove each _\bn_\ba_\bm_\be from the list of defined aliases. If -\b-a\ba is
- supplied, all alias definitions are removed. The return value
- is true unless a supplied _\bn_\ba_\bm_\be is not a defined alias.
+ supplied, remove all alias definitions. The return value is
+ true unless a supplied _\bn_\ba_\bm_\be is not a defined alias.
u\bun\bns\bse\bet\bt [-f\bfv\bv] [-n\bn] [_\bn_\ba_\bm_\be ...]
For each _\bn_\ba_\bm_\be, remove the corresponding variable or function.
If the -\b-v\bv option is given, each _\bn_\ba_\bm_\be refers to a shell variable,
- and that variable is removed. Read-only variables may not be
- unset. If -\b-f\bf is specified, each _\bn_\ba_\bm_\be refers to a shell func-
- tion, and the function definition is removed. If the -\b-n\bn option
- is supplied, and _\bn_\ba_\bm_\be is a variable with the _\bn_\ba_\bm_\be_\br_\be_\bf attribute,
- _\bn_\ba_\bm_\be will be unset rather than the variable it references. -\b-n\bn
- has no effect if the -\b-f\bf option is supplied. If no options are
- supplied, each _\bn_\ba_\bm_\be 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 B\bBA\bAS\bSH\bH_\b_A\bAL\bLI\bIA\bAS\bSE\bES\bS,
- B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV0\b0, B\bBA\bAS\bSH\bH_\b_C\bCM\bMD\bDS\bS, B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMM\bMA\bAN\bND\bD, B\bBA\bAS\bSH\bH_\b_S\bSU\bUB\bBS\bSH\bHE\bEL\bLL\bL, B\bBA\bAS\bSH\bHP\bPI\bID\bD,
- C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS, D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK, E\bEP\bPO\bOC\bCH\bHR\bRE\bEA\bAL\bLT\bTI\bIM\bME\bE, E\bEP\bPO\bOC\bCH\bHS\bSE\bEC\bCO\bON\bND\bDS\bS, F\bFU\bUN\bNC\bC-\b-
- N\bNA\bAM\bME\bE, G\bGR\bRO\bOU\bUP\bPS\bS, H\bHI\bIS\bST\bTC\bCM\bMD\bD, L\bLI\bIN\bNE\bEN\bNO\bO, R\bRA\bAN\bND\bDO\bOM\bM, S\bSE\bEC\bCO\bON\bND\bDS\bS, or S\bSR\bRA\bAN\bND\bDO\bOM\bM are
- unset, they lose their special properties, even if they are sub-
- sequently reset. The exit status is true unless a _\bn_\ba_\bm_\be is read-
- only or may not be unset.
+ and that variable is removed. If -\b-f\bf is specified, each _\bn_\ba_\bm_\be
+ refers to a shell function, and the function definition is re-
+ moved. If the -\b-n\bn option is supplied, and _\bn_\ba_\bm_\be is a variable
+ with the _\bn_\ba_\bm_\be_\br_\be_\bf attribute, _\bn_\ba_\bm_\be will be unset rather than the
+ variable it references. -\b-n\bn has no effect if the -\b-f\bf 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 _\bn_\ba_\bm_\be 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
+ B\bBA\bAS\bSH\bH_\b_A\bAL\bLI\bIA\bAS\bSE\bES\bS, B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV0\b0, B\bBA\bAS\bSH\bH_\b_C\bCM\bMD\bDS\bS, B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMM\bMA\bAN\bND\bD, B\bBA\bAS\bSH\bH_\b_S\bSU\bUB\bB-\b-
+ S\bSH\bHE\bEL\bLL\bL, B\bBA\bAS\bSH\bHP\bPI\bID\bD, C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS, D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK, E\bEP\bPO\bOC\bCH\bHR\bRE\bEA\bAL\bLT\bTI\bIM\bME\bE,
+ E\bEP\bPO\bOC\bCH\bHS\bSE\bEC\bCO\bON\bND\bDS\bS, F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE, G\bGR\bRO\bOU\bUP\bPS\bS, H\bHI\bIS\bST\bTC\bCM\bMD\bD, L\bLI\bIN\bNE\bEN\bNO\bO, R\bRA\bAN\bND\bDO\bOM\bM, S\bSE\bEC\bC-\b-
+ O\bON\bND\bDS\bS, or S\bSR\bRA\bAN\bND\bDO\bOM\bM are unset, they lose their special properties,
+ even if they are subsequently reset. The exit status is true
+ unless a _\bn_\ba_\bm_\be is readonly or may not be unset.
w\bwa\bai\bit\bt [-\b-f\bfn\bn] [-\b-p\bp _\bv_\ba_\br_\bn_\ba_\bm_\be] [_\bi_\bd ...]
Wait for each specified child process _\bi_\bd and return the termina-
- tion status of the last _\bi_\bd. Each _\bi_\bd may be a process ID or a
- job specification; if a job spec is given, w\bwa\bai\bit\bt waits for all
+ tion status of the last _\bi_\bd. Each _\bi_\bd may be a process ID or a
+ job specification; if a job spec is supplied, w\bwa\bai\bit\bt waits for all
processes in the job.
If no options or _\bi_\bds are supplied, w\bwa\bai\bit\bt waits for all running
If the -\b-p\bp option is supplied, the process or job identifier of
the job for which the exit status is returned is assigned to the
- variable _\bv_\ba_\br_\bn_\ba_\bm_\be named by the option argument. The variable
- will be unset initially, before any assignment. This is useful
- only when the -\b-n\bn option is supplied.
+ variable _\bv_\ba_\br_\bn_\ba_\bm_\be named by the option argument. The variable,
+ which cannot be readonly, will be unset initially, before any
+ assignment. This is useful only when the -\b-n\bn option is supplied.
Supplying the -\b-f\bf option, when job control is enabled, forces
w\bwa\bai\bit\bt to wait for each _\bi_\bd to terminate before returning its sta-
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 c\bco\bom\bmp\bpa\bat\bt3\b32\b2 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, c\bco\bom\bmp\bpa\bat\bt3\b32\b2, 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 b\bba\bas\bsh\bh, but that behavior may have been
- present in earlier versions. For instance, the change to use locale-
- based comparisons with the [\b[[\b[ command came in bash-4.1, and earlier
+ lar version (e.g., setting c\bco\bom\bmp\bpa\bat\bt3\b32\b2 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, c\bco\bom\bmp\bpa\bat\bt3\b32\b2, 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 b\bba\bas\bsh\bh, but that behavior may have been
+ present in earlier versions. For instance, the change to use locale-
+ based comparisons with the [\b[[\b[ command came in bash-4.1, and earlier
versions used ASCII-based comparisons, so enabling c\bco\bom\bmp\bpa\bat\bt3\b32\b2 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: B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMP\bPA\bAT\bT. The value as-
+ Bash-4.3 introduced a new shell variable: B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMP\bPA\bAT\bT. The value as-
signed to this variable (a decimal version number like 4.2, or an inte-
- ger corresponding to the c\bco\bom\bmp\bpa\bat\bt_\bN_\bN option, like 42) determines the com-
+ ger corresponding to the c\bco\bom\bmp\bpa\bat\bt_\bN_\bN option, like 42) determines the com-
patibility level.
- Starting with bash-4.4, b\bba\bas\bsh\bh has begun deprecating older compatibility
- levels. Eventually, the options will be removed in favor of B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bM-\b-
- P\bPA\bAT\bT.
+ Starting with bash-4.4, b\bba\bas\bsh\bh began deprecating older compatibility lev-
+ els. Eventually, the options will be removed in favor of B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMP\bPA\bAT\bT.
- 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 B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMP\bPA\bAT\bT.
+ Bash-5.0 was the final version for which there was an individual shopt
+ option for the previous version. B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMP\bPA\bAT\bT 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 c\bco\bom\bmp\bpa\bat\bt_\bN_\bN tag is used as shorthand for
quired for bash-5.1 and later versions.
c\bco\bom\bmp\bpa\bat\bt3\b31\b1
- +\bo quoting the rhs of the [\b[[\b[ command's regexp matching oper-
- ator (=~) has no special effect
+ +\bo Quoting the rhs of the [\b[[\b[ command's regexp matching oper-
+ ator (=~) has no special effect.
c\bco\bom\bmp\bpa\bat\bt3\b32\b2
- +\bo the <\b< and >\b> operators to the [\b[[\b[ command do not consider
+ +\bo The <\b< and >\b> operators to the [\b[[\b[ command do not consider
the current locale when comparing strings; they use ASCII
ordering.
c\bco\bom\bmp\bpa\bat\bt4\b40\b0
- +\bo the <\b< and >\b> operators to the [\b[[\b[ command do not consider
+ +\bo The <\b< and >\b> operators to the [\b[[\b[ command do not consider
the current locale when comparing strings; they use ASCII
ordering. B\bBa\bas\bsh\bh versions prior to bash-4.1 use ASCII col-
lation and _\bs_\bt_\br_\bc_\bm_\bp(3); bash-4.1 and later use the current
locale's collation sequence and _\bs_\bt_\br_\bc_\bo_\bl_\bl(3).
c\bco\bom\bmp\bpa\bat\bt4\b41\b1
- +\bo in _\bp_\bo_\bs_\bi_\bx mode, t\bti\bim\bme\be may be followed by options and still
+ +\bo In _\bp_\bo_\bs_\bi_\bx mode, t\bti\bim\bme\be may be followed by options and still
be recognized as a reserved word (this is POSIX interpre-
- tation 267)
- +\bo in _\bp_\bo_\bs_\bi_\bx mode, the parser requires that an even number of
+ tation 267).
+ +\bo In _\bp_\bo_\bs_\bi_\bx mode, the parser requires that an even number of
single quotes occur in the _\bw_\bo_\br_\bd 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).
c\bco\bom\bmp\bpa\bat\bt4\b42\b2
- +\bo the replacement string in double-quoted pattern substitu-
+ +\bo The replacement string in double-quoted pattern substitu-
tion does not undergo quote removal, as it does in ver-
- sions after bash-4.2
- +\bo in posix mode, single quotes are considered special when
+ sions after bash-4.2.
+ +\bo In posix mode, single quotes are considered special when
expanding the _\bw_\bo_\br_\bd 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.
c\bco\bom\bmp\bpa\bat\bt4\b43\b3
- +\bo word expansion errors are considered non-fatal errors
+ +\bo 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)
- +\bo when executing a shell function, the loop state
+ that cause the shell to exit).
+ +\bo When executing a shell function, the loop state
(while/until/etc.) is not reset, so b\bbr\bre\bea\bak\bk or c\bco\bon\bnt\bti\bin\bnu\bue\be 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.
c\bco\bom\bmp\bpa\bat\bt4\b44\b4
- +\bo the shell sets up the values used by B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV and
- B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGC\bC so they can expand to the shell's positional
- parameters even if extended debugging mode is not enabled
- +\bo a subshell inherits loops from its parent context, so
+ +\bo The shell sets up the values used by B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV and
+ B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGC\bC so they can expand to the shell's positional
+ parameters even if extended debugging mode is not en-
+ abled.
+ +\bo A subshell inherits loops from its parent context, so
b\bbr\bre\bea\bak\bk or c\bco\bon\bnt\bti\bin\bnu\bue\be will cause the subshell to exit.
Bash-5.0 and later reset the loop state to prevent the
exit
- +\bo variable assignments preceding builtins like e\bex\bxp\bpo\bor\brt\bt and
+ +\bo Variable assignments preceding builtins like e\bex\bxp\bpo\bor\brt\bt and
r\bre\bea\bad\bdo\bon\bnl\bly\by 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.
c\bco\bom\bmp\bpa\bat\bt5\b50\b0
+\bo Bash-5.1 changed the way $\b$R\bRA\bAN\bND\bDO\bOM\bM 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 R\bRA\bAN\bND\bDO\bOM\bM will
- produce the same sequence as in bash-5.0
+ produce the same sequence as in bash-5.0.
+\bo 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 -\b-l\bl op-
+ input. Bash-5.1 suppresses that message when the -\b-l\bl op-
tion is supplied.
c\bco\bom\bmp\bpa\bat\bt5\b51\b1
scripts @\b@ and *\b* differently depending on whether the ar-
ray is indexed or associative, and differently than in
previous versions.
- +\bo arithmetic commands ( (\b((\b(...)\b))\b) ) and the expressions in an
- arithmetic for statement can be expanded more than once
- +\bo expressions used as arguments to arithmetic operators in
- the [\b[[\b[ conditional command can be expanded more than once
- +\bo the expressions in substring parameter brace expansion
- can be expanded more than once
- +\bo the expressions in the $\b$(\b((\b(...)\b))\b) word expansion can be ex-
- panded more than once
- +\bo arithmetic expressions used as indexed array subscripts
- can be expanded more than once
- +\bo t\bte\bes\bst\bt -\b-v\bv, when given an argument of A\bA[\b[@\b@]\b], where A\bA is an
+ +\bo Arithmetic commands ( (\b((\b(...)\b))\b) ) and the expressions in an
+ arithmetic for statement can be expanded more than once.
+ +\bo Expressions used as arguments to arithmetic operators in
+ the [\b[[\b[ conditional command can be expanded more than
+ once.
+ +\bo The expressions in substring parameter brace expansion
+ can be expanded more than once.
+ +\bo The expressions in the $\b$(\b((\b(...)\b))\b) word expansion can be ex-
+ panded more than once.
+ +\bo Arithmetic expressions used as indexed array subscripts
+ can be expanded more than once.
+ +\bo t\bte\bes\bst\bt -\b-v\bv, when given an argument of A\bA[\b[@\b@]\b], where A\bA 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 @\b@.
- +\bo the ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br[\b[:\b:]\b]=\b=_\bv_\ba_\bl_\bu_\be} word expansion will return
- _\bv_\ba_\bl_\bu_\be, before any variable-specific transformations have
+ +\bo The ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br[\b[:\b:]\b]=\b=_\bv_\ba_\bl_\bu_\be} word expansion will return
+ _\bv_\ba_\bl_\bu_\be, 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.
- +\bo Parsing command substitutions will behave as if extended
+ +\bo Parsing command substitutions will behave as if extended
globbing (see the description of the s\bsh\bho\bop\bpt\bt 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.
c\bco\bom\bmp\bpa\bat\bt5\b52\b2
- +\bo The t\bte\bes\bst\bt builtin uses its historical algorithm to parse
- parenthesized subexpressions when given five or more ar-
+ +\bo The t\bte\bes\bst\bt builtin uses its historical algorithm to parse
+ parenthesized subexpressions when given five or more ar-
guments.
- +\bo If the -\b-p\bp or -\b-P\bP option is supplied to the b\bbi\bin\bnd\bd builtin,
+ +\bo If the -\b-p\bp or -\b-P\bP option is supplied to the b\bbi\bin\bnd\bd builtin,
b\bbi\bin\bnd\bd 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.
R\bRE\bES\bST\bTR\bRI\bIC\bCT\bTE\bED\bD S\bSH\bHE\bEL\bLL\bL
If b\bba\bas\bsh\bh is started with the name r\brb\bba\bas\bsh\bh, or the -\b-r\br 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 b\bba\bas\bsh\bh with the exception that the following are
+ invocation, the shell becomes _\br_\be_\bs_\bt_\br_\bi_\bc_\bt_\be_\bd. A restricted shell is used
+ to set up an environment more controlled than the standard shell. It
+ behaves identically to b\bba\bas\bsh\bh with the exception that the following are
disallowed or not performed:
- +\bo changing directories with c\bcd\bd
+ +\bo Changing directories with c\bcd\bd.
- +\bo setting or unsetting the values of S\bSH\bHE\bEL\bLL\bL, P\bPA\bAT\bTH\bH, H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE, E\bEN\bNV\bV,
- or B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV
+ +\bo Setting or unsetting the values of S\bSH\bHE\bEL\bLL\bL, P\bPA\bAT\bTH\bH, H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE, E\bEN\bNV\bV,
+ or B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV.
- +\bo specifying command names containing /\b/
+ +\bo Specifying command names containing /\b/.
- +\bo specifying a filename containing a /\b/ as an argument to the .\b.
- builtin command
+ +\bo Specifying a filename containing a /\b/ as an argument to the .\b.
+ builtin command.
- +\bo specifying a filename containing a slash as an argument to the
- h\bhi\bis\bst\bto\bor\bry\by builtin command
+ +\bo Using the -\b-p\bp option to the .\b. builtin command to specify a
+ search path.
- +\bo specifying a filename containing a slash as an argument to the
- -\b-p\bp option to the h\bha\bas\bsh\bh builtin command
+ +\bo Specifying a filename containing a slash as an argument to the
+ h\bhi\bis\bst\bto\bor\bry\by builtin command.
- +\bo importing function definitions from the shell environment at
- startup
+ +\bo Specifying a filename containing a slash as an argument to the
+ -\b-p\bp option to the h\bha\bas\bsh\bh builtin command.
- +\bo parsing the value of S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS from the shell environment at
- startup
+ +\bo Importing function definitions from the shell environment at
+ startup.
- +\bo redirecting output using the >, >|, <>, >&, &>, and >> redirec-
- tion operators
+ +\bo Parsing the value of S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS from the shell environment at
+ startup.
- +\bo using the e\bex\bxe\bec\bc builtin command to replace the shell with another
- command
+ +\bo Redirecting output using the >, >|, <>, >&, &>, and >> redirec-
+ tion operators.
- +\bo adding or deleting builtin commands with the -\b-f\bf and -\b-d\bd options
- to the e\ben\bna\bab\bbl\ble\be builtin command
+ +\bo Using the e\bex\bxe\bec\bc builtin command to replace the shell with another
+ command.
+
+ +\bo Adding or deleting builtin commands with the -\b-f\bf and -\b-d\bd options
+ to the e\ben\bna\bab\bbl\ble\be builtin command.
- +\bo using the e\ben\bna\bab\bbl\ble\be builtin command to enable disabled shell
- builtins
+ +\bo Using the e\ben\bna\bab\bbl\ble\be builtin command to enable disabled shell
+ builtins.
- +\bo specifying the -\b-p\bp option to the c\bco\bom\bmm\bma\ban\bnd\bd builtin command
+ +\bo Specifying the -\b-p\bp option to the c\bco\bom\bmm\bma\ban\bnd\bd builtin command.
- +\bo turning off restricted mode with s\bse\bet\bt +\b+r\br or s\bsh\bho\bop\bpt\bt -\b-u\bu r\bre\be-\b-
+ +\bo Turning off restricted mode with s\bse\bet\bt +\b+r\br or s\bsh\bho\bop\bpt\bt -\b-u\bu r\bre\be-\b-
s\bst\btr\bri\bic\bct\bte\bed\bd_\b_s\bsh\bhe\bel\bll\bl.
These restrictions are enforced after any startup files are read.
Array variables may not (yet) be exported.
- There may be only one active coprocess at a time.
-
-GNU Bash 5.3 2024 September 5 _\bB_\bA_\bS_\bH(1)
+GNU Bash 5.3 2024 September 29 _\bB_\bA_\bS_\bH(1)
-.\"
+\"
.\" 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
.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).
In addition, \fBbash\fP
interprets the following options when it is invoked:
.PP
-.PD 0
.TP 10
.B \-c
If the
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.
\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
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
.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
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
\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.
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
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
.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
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
.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
.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|| & && ; ;; ;& ;;& ( ) | |& <newline>\fP
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
.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
.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.
.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
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
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;
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" .
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.
.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,
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
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
.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
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).
.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
.\|.\|.\& ) \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.
.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; ] .\|.\|.\& \
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
.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
\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
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.
\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
.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.
\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 <newline>. If a \fB\e\fP<newline> pair
-appears, and the backslash is not itself quoted, the \fB\e\fP<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 \fB\e\fP<newline> pair appears, and the backslash is not itself quoted,
+the \fB\e\fP<newline> 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
.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 <newline> .
+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
.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
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
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
.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
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
.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.
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
.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
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.
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
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
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
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
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
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
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
.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 .
.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
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
.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
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
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
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
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
.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
.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.
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,
.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
.B getopts
builtin command (see
.SM
-.B SHELL BUILTIN COMMANDS
+.B "SHELL BUILTIN COMMANDS"
below).
.TP
.B OPTIND
.B getopts
builtin command (see
.SM
-.B SHELL BUILTIN COMMANDS
+.B "SHELL BUILTIN COMMANDS"
below).
.TP
.B OSTYPE
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
.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
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
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
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
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.
.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
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
.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
.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
.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
.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
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.
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.
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
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
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
.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.
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 <space><tab><newline> .
.TP
.B IGNOREEOF
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.
.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,
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
.B getopts
builtin command (see
.SM
-.B SHELL BUILTIN COMMANDS
+.B "SHELL BUILTIN COMMANDS"
below).
.SM
.B OPTERR
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
\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
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
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.
.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
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
.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.
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 .
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.
.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.
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,
.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
.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
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]}
.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
.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 ,
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:
.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
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.
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
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
.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 ),
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
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
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 +
.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 ,
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
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,
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
.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
.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
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.
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.
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
.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
.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
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
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
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.
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
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
.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.
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
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
.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
.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
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
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 .\&
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 ,
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 .\& ,
.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
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
.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 [
.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
.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.
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
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
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
.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.
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
[\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:
.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
[\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
.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:
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:
.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
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<newline>
-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<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.
.SS "Here Strings"
A variant of here documents, the format is:
.RS
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
[\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
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
[\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
.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
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
.B shopt
under
.SM
-\fBSHELL BUILTIN COMMANDS\fP
+.B "SHELL BUILTIN COMMANDS"
below).
.PP
The rules concerning the definition and use of aliases are
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
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
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
(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
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
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
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.
.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
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.
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
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
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.
.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
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
.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
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.
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.
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,
.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
.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
.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
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
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
.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
.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 .
.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
.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
.PP
If the
.B huponexit
-shell option has been set with
+shell option has been set using
.BR shopt ,
.B bash
sends a
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
.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
.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
(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
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.
.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
.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
.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
.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.
.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
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.
.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
.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)
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
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
.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.
.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
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
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
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
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
.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
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.
.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
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,
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
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 .
.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.
.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 %
.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.
.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
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
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
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;
.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.
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
.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 ,
\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
.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
.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.
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.
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
.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
.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
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
\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.
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
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.,
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
.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 .
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.
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.
.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
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
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.
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 ,
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
[\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
.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
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:
.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))
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
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
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" .
.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
.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
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
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
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,
\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
.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,
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
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,
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
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
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"
.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
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
.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
.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
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
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
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
.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
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.
.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
.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.
.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,
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] .\|.\|.
.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
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
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.
\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)).
.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
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
.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.
.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
.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
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.
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:
.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
.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
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
.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)
.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.
[\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 ,
.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
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
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
.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.
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
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
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
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 .\|.\|.]
.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
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)).
.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 ,
.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
.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
.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.
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.
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
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
.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.
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)).
.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)
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.
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
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:
.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
.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
.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
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)).
.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
.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,
.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
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
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
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
.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
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.
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
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
.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
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,
.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.
is
.SM
.BR ERR ,
-the command
.I action
is executed whenever
a pipeline (which may consist of a single simple
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 ! .
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,
.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
.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
first in
.SM
.BR PATH .
+.IP
If the
.B \-a
option is used,
.SM
.B PATH
search for \fIname\fP.
+.IP
The
.B \-f
option suppresses shell function lookup, as with the \fBcommand\fP builtin.
\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
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
.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 ,
.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
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
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 ,
.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
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
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,
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
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.
.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
.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
.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
.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
.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
.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
.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
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
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.
.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
.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.
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
</HEAD>
<BODY><TABLE WIDTH=100%>
<TR>
-<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2024 August 13<TH ALIGN=RIGHT width=33%>BASH(1)
+<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2024 September 29<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<BR><A HREF="#index">Index</A>
<B>Bash</B>
is an <B>sh</B>-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</B>
also incorporates useful features from the <I>Korn</I> and <I>C</I>
interprets the following options when it is invoked:
<P>
-
<DL COMPACT>
<DT><B>-c</B>
<B>-s</B>
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.
<DT><B>-D</B>
<DD>
-A list of all double-quoted strings preceded by <B>$</B>
-is printed on the standard output.
+Print a list of all double-quoted strings preceded by <B>$</B>
+on the standard output.
These are the strings that
are subject to language translation when the current locale
is not <B>C</B> or <B>POSIX</B>.
below).
If <I>shopt_option</I> is present, <B>-O</B> sets the value of that option;
<B>+O</B> unsets it.
-If <I>shopt_option</I> is not supplied, the names and values of the shell
-options accepted by <B>shopt</B> are printed on the standard output.
+If <I>shopt_option</I> is not supplied, <B>bash</B> prints
+the names and values of the shell
+options accepted by <B>shopt</B> on the standard output.
If the invocation option is <B>+O</B>, the output is displayed in a format
that may be reused as input.
<DT><B>--</B>
<B>-</B>
is equivalent to <B>--</B>.
-
</DL>
<P>
single-character options to be recognized.
<P>
-
<DL COMPACT>
<DT><B>--debugger</B>
<DD>
Display a usage message on standard output and exit successfully.
-<DT><B>--init-file</B> <I>file</I><DD>
-
+<DT>
+<DD>
+<B>--init-file</B> <I>file</I>
<DT><B>--rcfile</B> <I>file</I><DD>
Execute commands from
<B>bash</B>
on the standard output and exit successfully.
-
</DL>
<A NAME="lbAG"> </A>
<H3>ARGUMENTS</H3>
<B>Bash</B>'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
<FONT SIZE=-1><B>PATH</B>
</FONT>
<B>-c</B>
option,
-whose standard input and error are
+whose standard input and standard error are
both connected to terminals (as determined by
<I>isatty</I>(3)),
<B>-i</B>
option.
+<B>Bash</B>
+
+sets
<FONT SIZE=-1><B>PS1</B>
</FONT>
-is set and
+and
<B>$-</B>
includes
<B>i</B>
-if
-<B>bash</B>
-
-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.
<P>
The following paragraphs describe how
<B>--norc</B>
option.
-The <B>--rcfile</B> <I>file</I> option will cause
+The <B>--rcfile</B> <I>file</I> option causes
<B>bash</B>
to use <I>file</I> instead of <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>.
<P>
-but the value of the
+but does not use the value of the
<FONT SIZE=-1><B>PATH</B>
</FONT>
-variable is not used to search for the filename.
+variable to search for the filename.
<P>
If
<FONT SIZE=-1><B>ENV</B>
</FONT>
-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.
<P>
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 <I>rshd</I>,
+the historical and rarely-seen remote shell daemon, usually <I>rshd</I>,
or the secure shell daemon <I>sshd</I>.
If
<B>bash</B>
<DT><B>metacharacter</B>
<DD>
-A character that, when unquoted, separates words. One of the following:
+A character that, when unquoted, separates words.
+One of the following:
<BR>
<DL COMPACT><DT><DD>
<DT><B>control operator</B>
<DD>
-A <I>token</I> that performs a control function. It is one of the following
-symbols:
+A <I>token</I> that performs a control function.
+It is one of the following symbols:
<DL COMPACT><DT><DD>
<P>
A <I>simple command</I> is a sequence of optional variable assignments
followed by <B>blank</B>-separated words and redirections, and
-terminated by a <I>control operator</I>. The first word
+terminated by a <I>control operator</I>.
+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.
<P>
</FONT>
below).
-If <B>|&</B> is used, <I>command1</I>'s standard error, in addition to its
+If <B>|&</B> is the pipeline operator,
+<I>command1</I>'s standard error, in addition to its
standard output, is connected to
<I>command2</I>'s standard input through the pipe;
it is shorthand for <B>2>&1 |</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.
<P>
If the
<B>time</B>
-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 <B>-p</B> option changes the output format to that specified by POSIX.
When the shell is in <I>posix mode</I>, it does not recognize
<B>time</B> as a reserved word if the next token begins with a
-The
+The value of the
<FONT SIZE=-1><B>TIMEFORMAT</B>
</FONT>
-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
<FONT SIZE=-1><B>TIMEFORMAT</B>
</FONT>
-under
-<B>Shell Variables</B>
+below under
+<B>Shell Variables</B>.
-below.
<P>
When the shell is in <I>posix mode</I>, <B>time</B>
-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
<FONT SIZE=-1><B>TIMEFORMAT</B>
for a description of subshells and a subshell environment.
If the <B>lastpipe</B> option is enabled using the <B>shopt</B> builtin
(see the description of <B>shopt</B> 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.
<A NAME="lbAN"> </A>
<H4>Lists</H4>
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
-<I>list</I>.
+after the command completes.
+The return status is the exit status of <I>list</I>.
<DT>{ <I>list</I>; }<DD>
-<I>list</I> is simply executed in the current shell environment.
+<I>list</I> is executed in the current shell environment.
<I>list</I> must be terminated with a newline or semicolon.
This is known as a <I>group command</I>.
-The return status is the exit status of
-<I>list</I>.
+The return status is the exit status of <I>list</I>.
+<DT><DD>
Note that unlike the metacharacters <B>(</B> and <B>)</B>, <B>{</B> and
<B>}</B> are <I>reserved words</I> 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 <I>list</I> 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
+<I>list</I> by whitespace or another shell metacharacter.
<DT>((<I>expression</I>))<DD>
-The <I>expression</I> is evaluated according to the rules described
-below under
+The arithmetic <I>expression</I> is evaluated according to the rules
+described below under
<FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
</FONT>
The <I>expression</I>
undergoes the same expansions
as if it were within double quotes,
-but double quote characters in <I>expression</I> are not treated specially
-and are removed.
+but double quote characters in <I>expression</I> are not treated
+specially and are removed.
<DT><B>[[</B> <I>expression</I> <B>]]</B><DD>
-Return a status of 0 or 1 depending on the evaluation of
-the conditional expression <I>expression</I>.
+Evaluate the conditional expression <I>expression</I>
+and return a status of zero (true) or non-zero (false).
Expressions are composed of the primaries described below under
<FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>.
of alphabetic characters.
The return value is 0 if the string matches (<B>==</B>) or does not match
(<B>!=</B>) 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.
<DT><DD>
An additional binary operator, <B>=~</B>, is available, with the same
precedence as <B>==</B> and <B>!=</B>.
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.
+<DT><DD>
+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,
The pattern will match if it matches any part of the string.
Anchor the pattern using the <B>^</B> and <B>$</B> regular expression
operators to force it to match the entire string.
+<DT><DD>
The array variable
<FONT SIZE=-1><B>BASH_REMATCH</B>
<FONT SIZE=-1><B>BASH_REMATCH</B>
</FONT>
-indices. The element of
+indices.
+The element of
<FONT SIZE=-1><B>BASH_REMATCH</B>
</FONT>
</DL>
<DT><B>for</B> <I>name</I> [ [ <B>in</B> [ <I>word ...</I> ] ] ; ] <B>do</B> <I>list</I> ; <B>done</B><DD>
-The list of words following <B>in</B> is expanded, generating a list
+First, expand The list of words following <B>in</B>, generating a list
of items.
-The variable <I>name</I> is set to each element of this list
+Then, the variable <I>name</I> is set to each element of this list
in turn, and <I>list</I> is executed each time.
If the <B>in</B> <I>word</I> is omitted, the <B>for</B> command executes
<I>list</I> once for each positional parameter that is set (see
If the expansion of the items following <B>in</B> results in an empty
list, no commands are executed, and the return status is 0.
<DT><B>for</B> (( <I>expr1</I> ; <I>expr2</I> ; <I>expr3</I> )) ; <B>do</B> <I>list</I> ; <B>done</B><DD>
-First, the arithmetic expression <I>expr1</I> is evaluated according
+First, evaluate the arithmetic expression <I>expr1</I> according
to the rules described below under
<FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
</FONT>
-The arithmetic expression <I>expr2</I> is then evaluated repeatedly
+Then, repeatedly evaluate the arithmetic expression <I>expr2</I>
until it evaluates to zero.
-Each time <I>expr2</I> evaluates to a non-zero value, <I>list</I> is
-executed and the arithmetic expression <I>expr3</I> is evaluated.
+Each time <I>expr2</I> evaluates to a non-zero value,
+execute <I>list</I>
+and evaluate the arithmetic expression <I>expr3</I>.
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 <I>list</I>
-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.
+<DT><DD>
+Use the <B>break</B> and continue builtins
+(see
+<FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
+
+</FONT>
+below)
+to control loop execution.
<DT><B>select</B> <I>name</I> [ <B>in</B> <I>word</I> ] ; <B>do</B> <I>list</I> ; <B>done</B><DD>
-The list of words following <B>in</B> 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 <B>in</B>
-<I>word</I> is omitted, the positional parameters are printed (see
+First, expand the list of words following <B>in</B>,
+generating a list of items, and print the set of expanded words
+the standard error, each preceded by a number.
+If the <B>in</B>
+<I>word</I> is omitted, print the positional parameters (see
<FONT SIZE=-1><B>PARAMETERS</B>
</FONT>
</FONT>
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 <B>select</B> sets the value of
<I>name</I>
-is set to that word.
-If the line is empty, the words and prompt are displayed again.
-If EOF is read, the <B>select</B> command completes and returns 1.
-Any other value read causes
+to that word.
+If the line is empty, <B>select</B> displays the words and prompt again.
+If EOF is read, <B>select</B> completes and returns 1.
+Any other value sets
<I>name</I>
-to be set to null. The line read is saved in the variable
+to null.
+The line read is saved in the variable
<FONT SIZE=-1><B>REPLY</B>.
</FONT>
<DT><B>case</B> <I>word</I> <B>in</B> [ [(] <I>pattern</I> [ <B>|</B> <I>pattern</I> ]
.. ) <I>list</I> ;; ] ... <B>esac</B><DD>
A <B>case</B> command first expands <I>word</I>, and tries to match
-it against each <I>pattern</I> in turn, using the matching rules
+it against each <I>pattern</I> in turn,
+proceeding from first to last,
+using the matching rules
described under
<B>Pattern Matching</B>
below.
+A pattern list is a set of one or more patterns separated by ,
+and the ) operator terminates the pattern list.
The <I>word</I> is expanded using tilde
expansion, parameter and variable expansion, arithmetic expansion,
command substitution, process substitution and quote removal.
shell option is enabled, the match is performed without regard to the case
of alphabetic characters.
-When a match is found, the corresponding <I>list</I> is executed.
-If the <B>;;</B> operator is used, no subsequent matches are attempted after
-the first pattern match.
+A <I>clause</I> is a pattern list and an associated <I>list</I>.
+<DT><DD>
+When a match is found, <B>case</B> executes the corresponding <I>list</I>.
+If the <B>;;</B> operator terminates the case clause, the <B>case</B>
+command completes after the first match.
Using <B>;&</B> in place of <B>;;</B> causes execution to continue with
-the <I>list</I> associated with the next set of patterns.
+the <I>list</I> associated with the next pattern list.
Using <B>;;&</B> in place of <B>;;</B> causes the shell to test the next
pattern list in the statement, if any, and execute any associated <I>list</I>
-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 <I>list</I>.
+The exit status is zero if no pattern matches.
+<DT><DD>
+Otherwise, it is the exit status of the
+last command executed in the last <I>list</I> executed.
<DT><B>if</B> <I>list</I>; <B>then</B> <I>list</I>; [ <B>elif</B> <I>list</I>; <B>then</B> <I>list</I>; ] ... [ <B>else</B> <I>list</I>; ] <B>fi</B><DD>
The
<B>if</B>
<I>list</I>
-is executed. If its exit status is zero, the
-<B>then</B> <I>list</I> is executed. Otherwise, each <B>elif</B>
-<I>list</I> is executed in turn, and if its exit status is zero,
-the corresponding <B>then</B> <I>list</I> is executed and the
-command completes. Otherwise, the <B>else</B> <I>list</I> is
-executed, if present. The exit status is the exit status of the
+is executed.
+If its exit status is zero, the
+<B>then</B> <I>list</I> is executed.
+Otherwise, each <B>elif</B> <I>list</I> is executed in turn,
+and if its exit status is zero, the corresponding <B>then</B> <I>list</I>
+is executed and the command completes.
+Otherwise, the <B>else</B> <I>list</I> is executed, if present.
+The exit status is the exit status of the
last command executed, or zero if no condition tested true.
<DT><B>while</B> <I>list-1</I>; <B>do</B> <I>list-2</I>; <B>done</B><DD>
The <B>while</B> command continuously executes the list
<I>list-2</I> as long as the last command in the list <I>list-1</I> returns
-an exit status of zero. The <B>until</B> command is identical
+an exit status of zero.
+The <B>until</B> command is identical
to the <B>while</B> command, except that the test is negated:
<I>list-2</I>
<P>
-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 <B>COPROC</B>, and it is simpler to use and more complete
than the other compound commands.
<P>
The process ID of the shell spawned to execute the coprocess is
available as the value of the variable <I>NAME</I>_PID.
The <B>wait</B>
-builtin command may be used to wait for the coprocess to terminate.
+builtin may be used to wait for the coprocess to terminate.
<P>
Since the coprocess is created as an asynchronous command,
<I>compound-command</I> is executed whenever <I>fname</I> is specified as the
name of a simple command.
When in <I>posix mode</I>, <I>fname</I> must be a valid shell <I>name</I>
-and may not be the name of one of the
-POSIX <I>special builtins</I>.
+and may not be the name of one of the POSIX <I>special builtins</I>.
In default mode, a function name can be any unquoted shell word that does
not contain <B>$</B>.
+</DL>
+<P>
+
Any redirections (see
<FONT SIZE=-1><B>REDIRECTION</B>
</FONT>
below) specified when a function is defined are performed
when the function is executed.
+<P>
+
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
</FONT>
below.)
-</DL>
<A NAME="lbAR"> </A>
<H3>COMMENTS</H3>
below), a word beginning with
<B>#</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</B>
-option enabled does not allow comments. The
+option enabled does not allow comments.
+The
<B>interactive_comments</B>
-option is on by default in interactive shells.
+option is enabled by default in interactive shells.
<A NAME="lbAS"> </A>
<H3>QUOTING</H3>
<I>Quoting</I> 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.
to prevent history expansion.
<P>
-There are three quoting mechanisms: the
+There are four quoting mechanisms: the
<I>escape character</I>,
-single quotes, and double quotes.
+single quotes, double quotes,
+and dollar-single quotes.
<P>
A non-quoted backslash (<B>\</B>) is the
<I>escape character</I>.
It preserves the literal value of the next character that follows,
-with the exception of <newline>. If a <B>\</B><newline> pair
-appears, and the backslash is not itself quoted, the <B>\</B><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 <B>\</B><newline> pair appears, and the backslash is not itself quoted,
+the <B>\</B><newline> is treated as a line continuation (that is, it is
+removed from the input stream and effectively ignored).
<P>
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.
<P>
and, when history expansion is enabled,
<B>!</B>.
-When the shell is in <I>posix mode</I>, the <B>!</B> has no special meaning
+When the shell is in <I>posix mode</I>,
+the <B>!</B> has no special meaning
within double quotes, even when history expansion is enabled.
The characters
<B>$</B>
and
<B>`</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:
<B>$</B>,
<B>`</B>,
or
<B><newline></B>.
+Backslashes preceding characters without a
+special meaning are left unmodified.
+<P>
+
A double quote may be quoted within double quotes by preceding it with
a backslash.
If enabled, history expansion will be performed unless an
The expanded result is single-quoted, as if the dollar sign had
not been present.
-<P>
+<A NAME="lbAT"> </A>
+<H4>Translating Strings</H4>
A double-quoted string preceded by a dollar sign (<B>$</B>"
<I>string</I>"
and <B>TEXTDOMAIN</B> shell variables.
If the current locale is <B>C</B> or <B>POSIX</B>,
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 <B>noexpand_translation</B> option is enabled
<FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>.
</FONT>
-<A NAME="lbAT"> </A>
+<A NAME="lbAU"> </A>
<H3>PARAMETERS</H3>
A
<FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>).
</FONT>
+The <B>export</B> and <B>readonly</B> builtins assign specific attributes.
<P>
-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</B>
builtin command (see
If
<I>value</I>
-is not given, the variable is assigned the null string. All
+is not given, the variable is assigned the null string.
+All
<I>values</I>
undergo tilde expansion, parameter and variable expansion,
<FONT SIZE=-1><B>EXPANSION</B>
</FONT>
-below). If the variable has its
+below).
+If the variable has its
<B>integer</B>
attribute set, then
<P>
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 <B>declare</B> that
-accept assignment statements (<I>declaration</I> commands).
-When += is applied to a variable for which the <B>integer</B> attribute has been
-set, <I>value</I> is evaluated as an arithmetic expression and added to the
-variable's current value, which is also evaluated.
+This includes arguments to <I>declaration</I> commands such as
+<B>declare</B> that accept assignment statements.
+When += is applied to a variable for which the <B>integer</B> attribute
+has been set,
+the variable's current value and <I>value</I> 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</B>
<P>
-inside the function creates a nameref variable <B>ref</B> whose value is
-the variable name passed as the first argument.
+inside the function creates a local nameref variable <B>ref</B> whose value
+is the variable name passed as the first argument.
References and assignments to <B>ref</B>, and changes to its attributes,
are treated as references, assignments, and attribute modifications
to the variable whose name was passed as <B>$1</B>.
Namerefs can be unset using the <B>-n</B> option to the <B>unset</B> builtin.
Otherwise, if <B>unset</B> is executed with the name of a nameref variable
as an argument, the variable referenced by the nameref variable will be unset.
-<A NAME="lbAU"> </A>
+<A NAME="lbAV"> </A>
<H4>Positional Parameters</H4>
A
<I>positional parameter</I>
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</B>
-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
<FONT SIZE=-1><B>FUNCTIONS</B>
</FONT>
below).
-<A NAME="lbAV"> </A>
+Without braces, a digit following $ can only refer to
+one of the first nine positional parameters (<B>$1-$9</B>) or the
+special parameter <B>$0</B> (see the next section).
+<A NAME="lbAW"> </A>
<H4>Special Parameters</H4>
-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.
<DL COMPACT>
<DT><B>*</B>
<DD>
-Expands to the positional parameters, starting from one.
+(<B>$*</B>) 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
<FONT SIZE=-1><B>IFS</B>
</FONT>
-special variable.
+variable.
That is,
<B>$*</B>
<FONT SIZE=-1><B>IFS</B>
</FONT>
-variable. If
+variable.
+If
<FONT SIZE=-1><B>IFS</B>
</FONT>
<DT><B>@</B>
<DD>
-Expands to the positional parameters, starting from one.
+(<B>$@</B>) 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>$@</B>
<B>$1 $2 ...</B>
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>$@</B>
<DT><B>#</B>
<DD>
-Expands to the number of positional parameters in decimal.
+(<B>$#</B>) Expands to the number of positional parameters in decimal.
<DT><B>?</B>
<DD>
-Expands to the exit status of the most recently executed foreground
-command.
+(<B>$?</B>) Expands to the exit status of the most recently executed command.
<DT><B>-</B>
<DD>
-Expands to the current option flags as specified upon invocation,
+(<B>$-</B>) Expands to the current option flags as specified upon invocation,
by the
<B>set</B>
<DT><B>$</B>
<DD>
-Expands to the process ID of the shell. In a subshell, it
-expands to the process ID of the current shell, not the
-subshell.
+(<B>$$</B>) Expands to the process ID of the shell.
+In a subshell, it expands to the process ID of the parent shell,
+not the subshell.
<DT><B>!</B>
<DD>
-Expands to the process ID of the job most recently placed into the
+(<B>$!</B>)Expands to the process ID of the job most recently placed into the
background, whether executed as an asynchronous command or using
the <B>bg</B> builtin (see
<FONT SIZE=-1><B>JOB CONTROL</B>
<DT><B>0</B>
<DD>
-Expands to the name of the shell or shell script. This is set at
-shell initialization. If
-<B>bash</B>
-
-is invoked with a file of commands,
+(<B>$0</B>) Expands to the name of the shell or shell script.
+This is set at shell initialization.
+If <B>bash</B> is invoked with a file of commands,
<B>$0</B>
-is set to the name of that file. If
-<B>bash</B>
-
-is started with the
+is set to the name of that file.
+If <B>bash</B> is started with the
<B>-c</B>
option, then
<B>$0</B>
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
<B>bash</B>,
as given by argument zero.
</DL>
-<A NAME="lbAW"> </A>
+<A NAME="lbAX"> </A>
<H4>Shell Variables</H4>
-The following variables are set by the shell:
+The shell sets following variables:
<P>
<DT><B>_</B>
<DD>
-At shell startup, set to the pathname used to invoke the
+(<B>$_</B>, an underscore)
+This has a number of meanings depending on context.
+At shell startup, <B>_</B> 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, <B>$_</B> expands to the name of the mail file
currently being checked.
<DT><B>BASH</B>
<FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
</FONT>
-below). The options appearing in
+below).
+The options appearing in
<FONT SIZE=-1><B>BASHOPTS</B>
</FONT>
If this variable is in the environment when
<B>bash</B>
-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.
<DT><B>BASHPID</B>
An associative array variable whose members correspond to the internal
list of aliases as maintained by the <B>alias</B> 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</B>
<DD>
An array variable whose values are the number of parameters in each
frame of the current <B>bash</B> execution call stack.
-The number of
-parameters to the current subroutine (shell function or script executed
-with <B>.</B> or <B>source</B>) is at the top of the stack.
+The number of parameters to the current subroutine (shell function or
+script executed with <B>.</B> or <B>source</B>) is at the top of the stack.
When a subroutine is executed, the number of parameters passed is pushed onto
<FONT SIZE=-1><B>BASH_ARGC</B>.
<DD>
An array variable containing all of the parameters in the current <B>bash</B>
-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
<FONT SIZE=-1><B>BASH_ARGV</B>.
</FONT>
<B>$0</B>;
see the description of special parameter 0 above).
-Assignment to
+Assigning a value to
<B>BASH_ARGV0</B>
-causes the value assigned to also be assigned to <B>$0</B>.
+assigns the same value to <B>$0</B>.
If
<B>BASH_ARGV0</B>
<DD>
An associative array variable whose members correspond to the internal
hash table of commands as maintained by the <B>hash</B> 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</B>
<DT><B>BASH_COMMAND</B>
<DD>
-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</B>
<DT><B>BASH_LOADABLES_PATH</B>
<DD>
-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</B>
command.
-<DT><B>BASH_REMATCH</B>
-
-<DD>
-An array variable whose members are assigned by the <B>=~</B> binary
-operator to the <B>[[</B> conditional command.
-The element with index 0 is the portion of the string
-matching the entire regular expression.
-The element with index <I>n</I> is the portion of the
-string matching the <I>n</I>th parenthesized subexpression.
+looks for
+dynamically loadable builtins.
<DT><B>BASH_MONOSECONDS</B>
<DD>
is unset, it loses its special properties, even if it is
subsequently reset.
+<DT><B>BASH_REMATCH</B>
+
+<DD>
+An array variable whose members are assigned by the <B>=~</B> binary
+operator to the <B>[[</B> conditional command.
+The element with index 0 is the portion of the string
+matching the entire regular expression.
+The element with index <I>n</I> is the portion of the
+string matching the <I>n</I>th parenthesized subexpression.
<DT><B>BASH_SOURCE</B>
<DD>
<DD>
Expands to a string describing the version of this instance of
-<B>bash</B>.
+<B>bash</B>
+(e.g., 5.2.37(3)-release).
<DT><B>COMP_CWORD</B>
<DD>
<DD>
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 <B>Programmable Completion</B>
+below).
<DT><B>COMP_LINE</B>
<DD>
<DT><B>COMP_TYPE</B>
<DD>
-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:
<I>TAB</I>, for normal completion,
<I>?</I>, for listing completions after successive tabs,
<DD>
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
<FONT SIZE=-1><B>LINENO</B>
<DT><B>PPID</B>
<DD>
-The process ID of the shell's parent. This variable is readonly.
+The process ID of the shell's parent.
+This variable is readonly.
<DT><B>PWD</B>
<DD>
</FONT>
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
<FONT SIZE=-1><B>RANDOM</B>
<DT><B>SHELLOPTS</B>
<DD>
-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</B>
option to the
<FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
</FONT>
-below). The options appearing in
+below).
+The options appearing in
<FONT SIZE=-1><B>SHELLOPTS</B>
</FONT>
If this variable is in the environment when
<B>bash</B>
-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.
<DT><B>SHLVL</B>
<DT><B>SRANDOM</B>
<DD>
-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
<I>/dev/urandom</I>
</DL>
<P>
-The following variables are used by the shell. In some cases,
+The shell uses the following variables. In some cases,
<B>bash</B>
assigns a default value to a variable; these cases are noted
<DD>
If this parameter is set when <B>bash</B> is executing a shell script,
-its value is interpreted as a filename containing commands to
-initialize the shell, as in
-<A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>.
-
+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
<FONT SIZE=-1><B>BASH_ENV</B>
<B>cd</B>
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</B>
command.
<DD>
A colon-separated list of shell patterns (see <B>Pattern Matching</B>)
-defining the list of filenames to be ignored by command search using
+defining the set of filenames to be ignored by command search using
<B>PATH</B>.
Files whose full pathnames match one of these patterns are not considered
executable files for the purposes of completion and command execution
<DD>
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.
<DT><B>GLOBIGNORE</B>
</FONT>
it is removed from the list of matches.
+The pattern matching honors the setting of the <B>extglob</B> shell
+option.
<DT><B>GLOBSORT</B>
<DD>
-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
and
<I>blocks</I>,
-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.
+<DT><DD>
For example, a value of <I>-mtime</I> sorts the results in descending
order by modification time (newest first).
<DT><DD>
A sort specifier of <I>nosort</I> disables sorting completely; the results
are returned in the order they are read from the file system,
and any leading <I>+</I> or <I>-</I> is ignored.
+<DT><DD>
If the sort specifier is missing, it defaults to <I>name</I>,
so a value of <I>+</I> is equivalent to the null string,
and a value of <I>-</I> sorts by name in descending order.
A value of
<I>ignoredups</I>
-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</I>
</FONT>
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
-<FONT SIZE=-1><B>HISTCONTROL</B>.
+<FONT SIZE=-1><B>HISTCONTROL</B>
</FONT>
+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.
<DT><B>HISTFILE</B>
<DD>
below).
<B>Bash</B> assigns a default value of <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>.
If <B>HISTFILE</B> 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.
<DT><B>HISTFILESIZE</B>
<DD>
-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 <B>history</B> 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 <B>HISTSIZE</B>
<FONT SIZE=-1><B>HISTIGNORE</B>.
</FONT>
+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 <B>extglob</B> shell
option.
<DT><B>HISTSIZE</B>
to print the time stamp associated with each history
entry displayed by the <B>history</B> 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.
split lines into words with the
<B>read</B>
-builtin command. The default value is
+builtin command.
+Word splitting is described above under
+<FONT SIZE=-1><B>EXPANSION</B>.
+
+</FONT>
+The default value is
<DT><B>IGNOREEOF</B>
<FONT SIZE=-1><B>EOF</B>
</FONT>
-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
<FONT SIZE=-1><B>EOF</B>
</FONT>
typed as the first characters on an input line before
<B>bash</B>
-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,
<FONT SIZE=-1><B>EOF</B>
</FONT>
<DT><B>MAIL</B>
<DD>
-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
<FONT SIZE=-1><B>MAILPATH</B>
</FONT>
often (in seconds)
<B>bash</B>
-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.
<DT><B>MAILPATH</B>
<DT><B>PATH</B>
<DD>
-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
<FONT SIZE=-1><B>COMMAND EXECUTION</B>
<FONT SIZE=-1><B>PROMPTING</B>
</FONT>
-below). Characters removed are replaced with an ellipsis.
+below).
+Characters removed are replaced with an ellipsis.
<DT><B>PS0</B>
<DD>
<FONT SIZE=-1><B>PROMPTING</B>
</FONT>
-below) and used as the primary prompt string. The default value is
+below) and used as the primary prompt string.
+The default value is
<DT><B>PS2</B>
<FONT SIZE=-1><B>PS1</B>
</FONT>
-and used as the secondary prompt string. The default is
+and used as the secondary prompt string.
+The default is
<DT><B>PS3</B>
The optional <I>p</I> is a digit specifying the <I>precision</I>,
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;
+<B>time</B> will print at most six digits after the decimal point;
values of <I>p</I> greater than 6 are changed to 6.
-If <I>p</I> is not specified, the value 3 is used.
+If <I>p</I> is not specified,
+<B>time</B> prints three digits after the decimal point.
<DT><DD>
The optional <B>l</B> specifies a longer format, including
minutes, of the form <I>MM</I>m<I>SS</I>.<I>FF</I>s.
<DD>
If set to a value greater than zero,
-<FONT SIZE=-1><B>TMOUT</B>
-
-</FONT>
-is treated as the
-default timeout for the <B>read</B> builtin.
+the <B>read</B> builtin uses the value as its
+default timeout.
The <B>select</B> command terminates if input does not arrive
after
<FONT SIZE=-1><B>TMOUT</B>
primary prompt.
<B>Bash</B>
-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.
<DT><B>TMPDIR</B>
<DD>
<DD>
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</I>
of a stopped job, in this context, is the command line used to
<FONT SIZE=-1><B>HISTORY EXPANSION</B>
</FONT>
-below). The first character is the <I>history expansion</I> character,
+below).
+The first character is the <I>history expansion</I> character,
the character which signals the start of a history
expansion, normally
line as a comment.
</DL>
-<A NAME="lbAX"> </A>
+<A NAME="lbAY"> </A>
<H4>Arrays</H4>
<B>Bash</B>
using the syntax <I>name</I>[<I>subscript</I>]=<I>value</I>. The
<I>subscript</I>
-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 </B><I>name</I>
and
<B>readonly</B>
-builtins. Each attribute applies to all members of an array.
+builtins.
+Each attribute applies to all members of an array.
<P>
-Arrays are assigned to using compound assignments of the form
+Arrays are assigned using compound assignments of the form
<I>name</I>=<B>(</B>value<I>1</I> ... value<I>n</I><B>)</B>, where each
<I>value</I> may be of the form [<I>subscript</I>]=<I>string</I>.
Indexed array assignments do not require anything but <I>string</I>.
including the brackets and subscript do not undergo
brace expansion and word splitting, as with individual
variable assignments.
+<P>
+
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.
<P>
When assigning to an associative array, the words in a compound assignment
This syntax is also accepted by the
<B>declare</B>
-builtin. Individual array elements may be assigned to using the
+builtin.
+Individual array elements may be assigned to using the
<I>name</I>[<I>subscript</I>]=<I>value</I> syntax introduced above.
+<P>
+
When assigning to an indexed array, if
<I>name</I>
above.
<P>
-Any element of an array may be referenced using
-${<I>name</I>[<I>subscript</I>]}. The braces are required to avoid
-conflicts with pathname expansion. If
-<I>subscript</I> is <B>@</B> or <B>*</B>, the word expands to
+An array element is referenced using
+${<I>name</I>[<I>subscript</I>]}.
+The braces are required to avoid conflicts with pathname expansion.
+If <I>subscript</I> is <B>@</B> or <B>*</B>, the word expands to
all members of <I>name</I>,
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,
-${<I>name</I>[*]} expands to a single
+word appears within double quotes.
+If the word is double-quoted, ${<I>name</I>[*]} expands to a single
word with the value of each array member separated by the first
character of the
<FONT SIZE=-1><B>IFS</B>
</FONT>
special variable, and ${<I>name</I>[@]} expands each element of
-<I>name</I> to a separate word. When there are no array members,
-${<I>name</I>[@]} expands to nothing.
+<I>name</I> to a separate word.
+When there are no array members, ${<I>name</I>[@]} 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 <B>*</B> and <B>@</B> (see
<B>Special Parameters</B>
-above). ${#<I>name</I>[<I>subscript</I>]} expands to the length of
-${<I>name</I>[<I>subscript</I>]}. If <I>subscript</I> is <B>*</B> or
-<B>@</B>, the expansion is the number of elements in the array.
+above).
+<P>
+
+${#<I>name</I>[<I>subscript</I>]} expands to the length of
+${<I>name</I>[<I>subscript</I>]}.
+If <I>subscript</I> is <B>*</B> or <B>@</B>,
+the expansion is the number of elements in the array.
+<P>
+
If the
<I>subscript</I>
<P>
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.
<P>
It is possible to obtain the keys (indices) of an array as well as the values.
The
<B>unset</B>
-builtin is used to destroy arrays. <B>unset</B> <I>name</I>[<I>subscript</I>]
-destroys the array element at index <I>subscript</I>,
+builtin is used to destroy arrays.
+<B>unset</B> <I>name</I>[<I>subscript</I>]
+unsets the array element at index <I>subscript</I>,
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.
<B>unset</B> <I>name</I>, where <I>name</I> is an array,
removes the entire array.
-<B>unset</B> <I>name</I>[<I>subscript</I>], where
-<I>subscript</I> is <B>*</B> or <B>@</B>, behaves differently depending on
-whether <I>name</I> is an indexed or associative array.
+<B>unset</B> <I>name</I>[<I>subscript</I>]
+behaves differently depending on
+whether <I>name</I> is an indexed or associative array
+when <I>subscript</I> is <B>*</B> or <B>@</B>.
If <I>name</I> is an associative array, this unsets the element with
subscript <B>*</B> or <B>@</B>.
If <I>name</I> is an indexed array, unset removes all of the elements but
When using a variable name with a subscript as an argument to a command,
such as with <B>unset</B>, 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]').
<P>
The
<B>-a</B>
option to assign a list of words read from the standard input
-to an array. The
+to an array.
+The
<B>set</B>
and
builtins display array values in a way that allows them to be
reused as assignments.
-<A NAME="lbAY"> </A>
+Other builtins accept array name arguments as well
+(e.g., <B>mapfile</B>); see the descriptions
+of individual builtins below for details.
+The shell provides a number of builtin array variables.
+<A NAME="lbAZ"> </A>
<H3>EXPANSION</H3>
Expansion is performed on the command line after it has been split into
<FONT SIZE=-1><B>PARAMETERS</B>).
</FONT>
-<A NAME="lbAZ"> </A>
+<A NAME="lbBA"> </A>
<H4>Brace Expansion</H4>
<I>Brace expansion</I>
-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
<I>pathname expansion</I>, 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
<I>preamble</I>,
followed by either a series of comma-separated strings or
Note that both <I>x</I> and <I>y</I> 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.
<P>
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</B>
does not apply any syntactic interpretation to the context of the
and closing braces, and at least one unquoted comma or a valid
sequence expression.
Any incorrectly formed brace expansion is left unchanged.
+<P>
+
A <B>{</B> or <B>,</B> may be quoted with a backslash to prevent its
being considered part of a brace expression.
To avoid conflicts with parameter expansion, the string <B>${</B>
<B>Bash</B>
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</B>
as <I>file{1,2}</I>
-appears identically in the output. The same word is
-output as
+appears identically in the output.
+<B>Bash</B> outputs that word as
<I>file1 file2</I>
-after expansion by
-<B>bash</B>.
-
-If strict compatibility with
-<B>sh</B>
-
-is desired, start
+after brace expansion.
+Start
<B>bash</B>
with the
<FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
</FONT>
-below).
-<A NAME="lbBA"> </A>
+below) for strict <B>sh</B> compatibility.
+<A NAME="lbBB"> </A>
<H4>Tilde Expansion</H4>
If a word begins with an unquoted tilde character (
<FONT SIZE=-1><B>HOME</B>
</FONT>
-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.
<P>
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
<FONT SIZE=-1><B>OLDPWD</B>,
</FONT>
-if it is set, is substituted.
+if it is set.
If the characters following the tilde in the tilde-prefix consist
of a number <I>N</I>, optionally prefixed
by a
element from the directory stack, as it would be displayed by the
<B>dirs</B>
-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
is assumed.
<P>
-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.
+<P>
+
+If the login name is invalid, or the tilde expansion fails, the
+tilde-prefix is unchanged.
<P>
-Each variable assignment is checked for unquoted tilde-prefixes immediately
+<B>Bash</B> checks each variable assignment
+for unquoted tilde-prefixes immediately
following a
<B>:</B>
or the first
-<B>=</B>.
+<B>=</B>,
-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
<FONT SIZE=-1><B>PATH</B>,
when they appear as arguments to simple commands.
<B>Bash</B> does not do this, except for the <I>declaration</I> commands listed
above, when in <I>posix mode</I>.
-<A NAME="lbBB"> </A>
+<A NAME="lbBC"> </A>
<H4>Parameter Expansion</H4>
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
expansion.
<P>
+The basic form of parameter expansion is
+<P>
-<DL COMPACT>
-<DT>${<I>parameter</I>}<DD>
-The value of <I>parameter</I> is substituted. The braces are required
+${<I>parameter</I>}
+<P>
+
+which substitutes the value of <I>parameter</I>.
+The braces are required
when
<I>parameter</I>
The <I>parameter</I> is a shell parameter as described above
<B>PARAMETERS</B>) or an array reference (<B>Arrays</B>).
-</DL>
<P>
If the first character of <I>parameter</I> is an exclamation point (<B>!</B>),
and <I>parameter</I> is not a <I>nameref</I>,
it introduces a level of indirection.
<B>Bash</B> uses the value formed by expanding the rest of
-<I>parameter</I> as the new <I>parameter</I>; this is then
-expanded and that value is used in the rest of the expansion, rather
+<I>parameter</I> as the new <I>parameter</I>;
+this new parameter is then expanded and that value is used in the rest of the expansion, rather
than the expansion of the original <I>parameter</I>.
This is known as <I>indirect expansion</I>.
The value is subject to tilde expansion,
parameter expansion, command substitution, and arithmetic expansion.
If <I>parameter</I> is a nameref, this expands to the name of the
parameter referenced by <I>parameter</I> instead of performing the
-complete indirect expansion.
+complete indirect expansion, for compatibility.
The exceptions to this are the expansions of ${<B>!</B><I>prefix</I><B>*</B>} and
${<B>!</B><I>name</I>[<I>@</I>]} described below.
The exclamation point must immediately follow the left brace in order to
When not performing substring expansion, using the forms documented below
(e.g., <B>:-</B>),
-<B>bash</B> tests for a parameter that is unset or null. Omitting the colon
-results in a test only for a parameter that is unset.
+<B>bash</B> tests for a parameter that is unset or null.
+Omitting the colon tests only for a parameter that is unset.
<P>
is unset or null, the expansion of
<I>word</I>
-is substituted. Otherwise, the value of
+is substituted.
+Otherwise, the value of
<I>parameter</I>
is substituted.
<I>word</I>
is assigned to
-<I>parameter</I>.
+<I>parameter</I>,
-The value of
-<I>parameter</I>
+and the expansion is the final value of
+<I>parameter</I>.
-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.
<DT>${<I>parameter</I><B>:?</B><I>word</I>}<DD>
<B>Display Error if Null or Unset</B>.
If
<I>word</I>
is not present) is written to the standard error and the shell, if it
-is not interactive, exits. Otherwise, the value of <I>parameter</I> 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 <I>parameter</I> is substituted.
<DT>${<I>parameter</I><B>:+</B><I>word</I>}<DD>
<B>Use Alternate Value</B>.
If
<I>word</I>
is substituted.
+The value of <I>parameter</I> is not used.
<DT>${<I>parameter</I><B>:</B><I>offset</I>}<DD>
<DT>${<I>parameter</I><B>:</B><I>offset</I><B>:</B><I>length</I>}<DD>
key expands to a separate word.
<DT>${<B>#</B><I>parameter</I>}<DD>
<B>Parameter length</B>.
-The length in characters of the value of <I>parameter</I> is substituted.
+Substitutes the length in characters of the expanded value of <I>parameter</I>.
If
<I>parameter</I>
<B>Pattern substitution</B>.
The <I>pattern</I> is expanded to produce a pattern just as in
-pathname expansion.
-<I>Parameter</I> is expanded and the longest match of <I>pattern</I>
-against its value is replaced with <I>string</I>.
-<I>string</I> 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
+<I>parameter</I>
+using the rules described under
<B>Pattern Matching</B>
below.
+The longest match of <I>pattern</I>
+in the expanded value is replaced with <I>string</I>.
+<I>string</I> undergoes tilde expansion, parameter and variable expansion,
+arithmetic expansion, command and process substitution, and quote removal.
+<DT><DD>
In the first form above, only the first match is replaced.
If there are two slashes separating <I>parameter</I> and <I>pattern</I>
(the second form above), all matches of <I>pattern</I> are
it must match at the beginning of the expanded value of <I>parameter</I>.
If <I>pattern</I> is preceded by <B>%</B> (the fourth form above),
it must match at the end of the expanded value of <I>parameter</I>.
+<DT><DD>
If the expansion of <I>string</I> is null,
-matches of <I>pattern</I> are deleted.
-If <I>string</I> is null,
matches of <I>pattern</I> are deleted
and the <B>/</B> following <I>pattern</I> may be omitted.
<DT><DD>
they want to be taken literally in the replacement
and ensure any instances of <B>&</B> they want to be replaced are unquoted.
<DT><DD>
+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.
+<DT><DD>
If the
<B>nocasematch</B>
shell option is enabled, the match is performed without regard to the case
of alphabetic characters.
+<DT><DD>
If
<I>parameter</I>
Each character in the expanded value of <I>parameter</I> is tested against
<I>pattern</I>, and, if it matches the pattern, its case is converted.
The pattern should not attempt to match more than one character.
+<DT><DD>
The <B>^</B> operator converts lowercase letters matching <I>pattern</I>
to uppercase; the <B>,</B> operator converts matching uppercase letters
to lowercase.
the first character in the expanded value.
If <I>pattern</I> is omitted, it is treated like a <B>?</B>, which matches
every character.
+<DT><DD>
If
<I>parameter</I>
expansion as described below.
</DL>
-<A NAME="lbBC"> </A>
+<A NAME="lbBD"> </A>
<H4>Command Substitution</H4>
<I>Command substitution</I> allows the output of a command to replace
If the substitution appears within double quotes, <B>bash</B> does not perform
word splitting and pathname expansion on the results.
-<A NAME="lbBD"> </A>
+<A NAME="lbBE"> </A>
<H4>Arithmetic Expansion</H4>
-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:
<DL COMPACT><DT><DD>
<P>
is invalid,
<B>bash</B>
-prints a message indicating failure and no substitution occurs.
-<A NAME="lbBE"> </A>
+prints a message to standard error indicating failure,
+does not perform the substitution,
+and does not execute the command associated with the expansion.
+<A NAME="lbBF"> </A>
<H4>Process Substitution</H4>
<I>Process substitution</I> allows a process's input or output to be
This filename is
passed as an argument to the current command as the result of the
expansion.
+<P>
+
If the <B>>(</B><I>list</I><B>)</B> form is used, writing to
-the file will provide input for <I>list</I>. If the
-<B><(</B><I>list</I><B>)</B> form is used, the file passed as an
-argument should be read to obtain the output of <I>list</I>.
+the file will provide input for <I>list</I>.
+If the
+<B><(</B><I>list</I><B>)</B> form is used, reading the file
+will obtain the output of <I>list</I>.
+No space may appear between the <B><</B> or <B>></B>
+and the left parenthesis, otherwise the construct would be interpreted
+as a redirection.
+<P>
+
Process substitution is supported on systems that support named
pipes (<I>FIFOs</I>) or the <B>/dev/fd</B> method of naming open files.
<P>
simultaneously with parameter and variable expansion,
command substitution,
and arithmetic expansion.
-<A NAME="lbBF"> </A>
+<A NAME="lbBG"> </A>
<H4>Word Splitting</H4>
The shell scans the results of
<FONT SIZE=-1><B>IFS</B>
</FONT>
-characters not at the beginning or end serves to delimit words.
+characters not at the beginning or end delimits words.
If
<FONT SIZE=-1><B>IFS</B>
and
<B>newline</B>
-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
<FONT SIZE=-1><B>IFS</B>
</FONT>
<FONT SIZE=-1><B>IFS</B>
</FONT>
-whitespace character).
+whitespace character)
+are ignored at the beginning and end of the word.
Any character in
<FONT SIZE=-1><B>IFS</B>
after word splitting and null argument removal.
<P>
-Note that if no expansion occurs, no splitting
-is performed.
-<A NAME="lbBG"> </A>
+Note that if no expansion occurs, no splitting is performed.
+<A NAME="lbBH"> </A>
<H4>Pathname Expansion</H4>
After word splitting,
regarded as a
<I>pattern</I>,
-and replaced with an alphabetically sorted list of
-filenames matching the pattern
+and replaced with a sorted list of filenames matching the pattern
(see
<FONT SIZE=-1><B>Pattern Matching</B>
</FONT>
-below).
+below)
+subject to the value of the <B>GLOBSORT</B> shell variable.
+<P>
+
If no matching filenames are found,
and the shell option
<B>nullglob</B>
If the
<B>failglob</B>
-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,
+<B>bash</B> prints an error message and does not execute the command.
If the shell option
<B>nocaseglob</B>
is enabled, the match is performed without regard to the case
of alphabetic characters.
+<P>
+
When a pattern is used for pathname expansion,
the character
When not matching pathnames, the
character is not treated specially.
+<P>
+
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
<FONT SIZE=-1><B>Pattern Matching</B>.
</FONT>
+<P>
+
See the description of
<B>shopt</B>
<B>dotglob</B>
shell option, so all other filenames beginning with a
-Q .
+
will match.
To get the old behavior of ignoring filenames beginning with a
</FONT>
is unset.
-The pattern matching honors the setting of the <B>extglob</B> shell
+The
+<B>GLOBIGNORE</B>
+
+pattern matching honors the setting of the <B>extglob</B> shell
option.
<P>
<FONT SIZE=-1><B>GLOBSORT</B>
</FONT>
-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.
<P>
<B>Pattern Matching</B>
<DT><B>[</B>...<B>]</B>
<DD>
+
Matches any one of the enclosed characters.
A pair of characters separated by a hyphen denotes a
<I>range expression</I>;
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>[</B>
is a
or a
<B>^</B>
-then any character not enclosed is matched.
+then any character not within the range matches.
+A
+<B>-</B>
+
+may be matched by including it as the first or last character
+in the set.
+A
+<B>]</B>
+
+may be matched by including it as the first character
+in the set.
+<DT><DD>
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
<FONT SIZE=-1><B>LC_COLLATE</B>
</FONT>
is equivalent to
<B>[abcd]</B>,
-set value of the
+set the value of the
+<B>LC_COLLATE</B>
+
+or
<B>LC_ALL</B>
-shell variable to
+shell variables to
<B>C</B>,
or enable the
<B>globasciiranges</B>
shell option.
-A
-<B>-</B>
-
-may be matched by including it as the first or last character
-in the set.
-A
-<B>]</B>
-
-may be matched by including it as the first character
-in the set.
-
<DT><DD>
Within
<B>[</B>
<DL COMPACT><DT><DD>
<DL COMPACT>
<DT><B>?(</B><I>pattern-list</I><B>)</B><DD>
-Matches zero or one occurrence of the given patterns
+Matches zero or one occurrence of the given patterns.
<DT><B>*(</B><I>pattern-list</I><B>)</B><DD>
-Matches zero or more occurrences of the given patterns
+Matches zero or more occurrences of the given patterns.
<DT><B>+(</B><I>pattern-list</I><B>)</B><DD>
-Matches one or more occurrences of the given patterns
+Matches one or more occurrences of the given patterns.
<DT><B>@(</B><I>pattern-list</I><B>)</B><DD>
-Matches one of the given patterns
+Matches one of the given patterns.
<DT><B>!(</B><I>pattern-list</I><B>)</B><DD>
-Matches anything except one of the given patterns
+Matches anything except one of the given patterns.
</DL></DL>
unless the pattern or sub-pattern begins with a
+If the
+<B>globskipdots</B>
+
+shell option is enabled, the filenames
+
+and
+
+never appear in the set.
As above,
only has a special meaning when matching filenames.
contain multiple matches.
Using separate matches against shorter strings, or using arrays of
strings instead of a single long string, may be faster.
-<A NAME="lbBH"> </A>
+<A NAME="lbBI"> </A>
<H4>Quote Removal</H4>
After the preceding expansions, all unquoted occurrences of the
and <B>"
</B> that did not result from one of the above
expansions are removed.
-<A NAME="lbBI"> </A>
+<A NAME="lbBJ"> </A>
<H3>REDIRECTION</H3>
Before a command is executed, its input and output
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 <B>exec</B> 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</I>
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 <I>varname</I>.
-If >&- or <&- is preceded
-by {<I>varname</I>}, the value of <I>varname</I> defines the file
-descriptor to close.
+If {<I>varname</I>} precedes >&- or <&-,
+the value of <I>varname</I> defines the file descriptor to close.
If {<I>varname</I>} 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 <B>exec</B> builtin.
The <B>varredir_close</B> shell option manages this behavior.
<P>
1).
<P>
-The word following the redirection operator in the following
+The <I>word</I> 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</B>
reports an error.
<P>
-Note that the order of redirections is significant. For example,
+The order of redirections is significant.
+For example,
the command
<DL COMPACT><DT><DD>
<P>
directs only the standard output to file
<I>dirlist</I>,
-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
<I>dirlist</I>.
<B>Bash</B> handles several filenames specially when they are used in
redirections, as described in the following table.
If the operating system on which <B>bash</B> is running provides these
-special files, bash will use them; otherwise it will emulate them
+special files, <B>bash</B> will use them; otherwise it will emulate them
internally with the behavior described below.
<DL COMPACT><DT><DD>
<P>
<DT><B>/dev/fd/</B><I>fd</I>
<DD>
-If <I>fd</I> is a valid integer, file descriptor <I>fd</I> is duplicated.
+If <I>fd</I> is a valid integer, duplicate file descriptor <I>fd</I>.
<DT><B>/dev/stdin</B>
<DD>
Redirections using file descriptors greater than 9 should be used with
care, as they may conflict with file descriptors the shell uses
internally.
-<A NAME="lbBJ"> </A>
+<A NAME="lbBK"> </A>
<H4>Redirecting Input</H4>
-Redirection of input causes the file whose name results from
+Redirecting input opens the file whose name results from
the expansion of
<I>word</I>
-to be opened for reading on file descriptor
+for reading on file descriptor
<I>n</I>,
or the standard input (file descriptor 0) if
[<I>n</I>]<B><</B><I>word</I>
</DL>
-<A NAME="lbBK"> </A>
+<A NAME="lbBL"> </A>
<H4>Redirecting Output</H4>
-Redirection of output causes the file whose name results from
+Redirecting output opens the file whose name results from
the expansion of
<I>word</I>
-to be opened for writing on file descriptor
+for writing on file descriptor
<I>n</I>,
or the standard output (file descriptor 1) if
<I>n</I>
-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.
<P>
option to the
<B>set</B>
-builtin command is not enabled, the redirection is attempted even
-if the file named by <I>word</I> exists.
-<A NAME="lbBL"> </A>
+builtin command is not enabled,
+<B>bash</B> attempts the redirection
+even if the file named by <I>word</I> exists.
+<A NAME="lbBM"> </A>
<H4>Appending Redirected Output</H4>
-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</I>
-to be opened for appending on file descriptor
+for appending on file descriptor
<I>n</I>,
or the standard output (file descriptor 1) if
<I>n</I>
-is not specified. If the file does not exist it is created.
+is not specified.
+If the file does not exist it is created.
<P>
The general format for appending output is:
[<I>n</I>]<B>>></B><I>word</I>
</DL>
-<A NAME="lbBM"> </A>
+<A NAME="lbBN"> </A>
<H4>Redirecting Standard Output and Standard Error</H4>
-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
<I>word</I>.
<P>
<P>
When using the second form, <I>word</I> may not expand to a number or
-<B>-</B>. If it does, other redirection operators apply
+<B>-</B>.
+If it does, other redirection operators apply
(see <B>Duplicating File Descriptors</B> below) for compatibility
reasons.
-<A NAME="lbBN"> </A>
+<A NAME="lbBO"> </A>
<H4>Appending Standard Output and Standard Error</H4>
-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
<I>word</I>.
<P>
<P>
(see <B>Duplicating File Descriptors</B> below).
-<A NAME="lbBO"> </A>
+<A NAME="lbBP"> </A>
<H4>Here Documents</H4>
This type of redirection instructs the shell to read input from the
<I>delimiter</I>
(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 <I>n</I> if <I>n</I> is specified) for a command.
<P>
<P>
-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
<I>word</I>.
<I>delimiter</I>
is <I>word</I> 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>\<newline></B>
-is ignored, and
+is treated literally, and
<B>\</B>
must be used to quote the characters
<B>$</B>,
and
-<B>`</B>.
+<B>`</B>;
+however, double quote characters have no special meaning.
<P>
If the redirection operator is
<B><<-</B>,
-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
<I>delimiter</I>.
This allows
here-documents within shell scripts to be indented in a
natural fashion.
-<A NAME="lbBP"> </A>
+<P>
+
+If the delimiter is not quoted, the
+<B>\<newline></B>
+
+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.
+<A NAME="lbBQ"> </A>
<H4>Here Strings</H4>
A variant of here documents, the format is:
The result is supplied as a single string, with a newline appended,
to the command on its
standard input (or file descriptor <I>n</I> if <I>n</I> is specified).
-<A NAME="lbBQ"> </A>
+<A NAME="lbBR"> </A>
<H4>Duplicating File Descriptors</H4>
The redirection operator
If
<I>word</I>
-expands to one or more digits, the file descriptor denoted by
+expands to one or more digits, file descriptor
<I>n</I>
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</I>
-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</I>
file descriptor
<I>n</I>
-is closed. If
+is closed.
+If
<I>n</I>
-is not specified, the standard input (file descriptor 0) is used.
+is not specified, this uses the standard input (file descriptor 0).
<P>
The operator
<P>
-is used similarly to duplicate output file descriptors. If
+is used similarly to duplicate output file descriptors.
+If
<I>n</I>
-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</I>
-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</I>
<I>n</I>
is closed.
-As a special case, if <I>n</I> is omitted, and <I>word</I> does not
-expand to one or more digits or <B>-</B>, the standard output and standard
-error are redirected as described previously.
-<A NAME="lbBR"> </A>
+As a special case, if <I>n</I> is omitted,
+and <I>word</I> does not expand to one or more digits or <B>-</B>,
+this redirects the standard output and standard error as described
+previously.
+<A NAME="lbBS"> </A>
<H4>Moving File Descriptors</H4>
The redirection operator
<I>n</I>,
or the standard output (file descriptor 1) if <I>n</I> is not specified.
-<A NAME="lbBS"> </A>
+<A NAME="lbBT"> </A>
<H4>Opening File Descriptors for Reading and Writing</H4>
The redirection operator
<P>
-causes the file whose name is the expansion of
+opens the file whose name is the expansion of
<I>word</I>
-to be opened for both reading and writing on file descriptor
+for both reading and writing on file descriptor
<I>n</I>,
or on file descriptor 0 if
<I>n</I>
-is not specified. If the file does not exist, it is created.
-<A NAME="lbBT"> </A>
+is not specified.
+If the file does not exist, it is created.
+<A NAME="lbBU"> </A>
<H3>ALIASES</H3>
<I>Aliases</I> 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 <B>alias</B> and <B>unalias</B> builtin commands
(see
<FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
<P>
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
If the last character of the alias value is a
<I>blank</I>,
-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.
<P>
Aliases are created and listed with the
<FONT SIZE=-1><B>FUNCTIONS</B>
</FONT>
-below).
+below) instead.
<P>
Aliases are not expanded when the shell is not interactive, unless
<B>shopt</B>
under
-<FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B></FONT>
+<FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
+
+</FONT>
below).
<P>
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</B>
in compound commands.
<P>
-For almost every purpose, aliases are superseded by
-shell functions.
-<A NAME="lbBU"> </A>
+For almost every purpose, shell functions are preferable to aliases.
+<A NAME="lbBV"> </A>
<H3>FUNCTIONS</H3>
A shell function, defined as described above under
</FONT>
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).
+<P>
+
When a function is executed, the arguments to the
function become the positional parameters
during its execution.
The special parameter
<B>#</B>
-is updated to reflect the change. Special parameter <B>0</B>
-is unchanged.
+is updated to reflect the new positional parameters.
+Special parameter <B>0</B> is unchanged.
The first element of the
<FONT SIZE=-1><B>FUNCNAME</B>
been enabled.
<P>
-Variables local to the function may be declared with the
+Variables local to the function are declared with the
<B>local</B>
builtin command (<I>local variables</I>).
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 <B>local</B> or <B>declare</B> builtins in the
function that is currently executing.
<P>
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.
<P>
<P>
The <B>FUNCNEST</B> 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.
<P>
is executed in a function, the function completes and
execution resumes with the next command after the function
call.
+If <B>return</B> 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 <B>return</B>.
Any command associated with the <B>RETURN</B> trap is executed
before execution resumes.
When a function completes, the values of the
execution.
<P>
-Function names and definitions may be listed with the
+The
<B>-f</B>
option to the
or
<B>typeset</B>
-builtin commands. The
+builtin commands
+will list function names and definitions.
+The
<B>-F</B>
option to
<B>export</B>
builtin.
-A function definition may be deleted using the <B>-f</B> option to
+The <B>-f</B> option to
the
<B>unset</B>
-builtin.
+builtin will delete a function definition.
<P>
Functions may be recursive.
The <B>FUNCNEST</B> 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.
-<A NAME="lbBV"> </A>
+By default, <B>bash</B> imposes no limit on the number of recursive calls.
+<A NAME="lbBW"> </A>
<H3>ARITHMETIC EVALUATION</H3>
The shell allows arithmetic expressions to be evaluated, under
-certain circumstances (see the <B>let</B> and <B>declare</B> builtin
-commands, the <B>((</B> compound command, and <B>Arithmetic Expansion</B>).
-Evaluation is done in fixed-width integers with no check for overflow,
+certain circumstances
+(see the <B>let</B> and <B>declare</B> builtin commands,
+the <B>((</B> compound command,
+the arithmetic <B>for</B> command,
+the <B>[[</B> conditional command,
+and <B>Arithmetic Expansion</B>).
+<P>
+
+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.
<DD>
variable post-increment and post-decrement
-<DT><B>- +</B>
-
-<DD>
-unary minus and plus
<DT><B>++</B><I>id</I> --<I>id</I>
<DD>
variable pre-increment and pre-decrement
+<DT><B>- +</B>
+
+<DD>
+unary minus and plus
<DT><B>! ~</B>
<DD>
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 <I>x</I> 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.
+<P>
+
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>integer</I> attribute using <B>declare -i</B> is assigned a value.
and 35.
<P>
-Operators are evaluated in order of precedence. Sub-expressions in
-parentheses are evaluated first and may override the precedence
-rules above.
-<A NAME="lbBW"> </A>
+Operators are evaluated in precedence order.
+Sub-expressions in parentheses are evaluated first
+and may override the precedence rules above.
+<A NAME="lbBX"> </A>
<H3>CONDITIONAL EXPRESSIONS</H3>
Conditional expressions are used by the <B>[[</B> compound command and
other command-specific actions.
<P>
-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.
+<P>
+
<B>Bash</B> handles several filenames specially when they are used in
expressions.
If the operating system on which <B>bash</B> is running provides these
<DT><B>-N </B><I>file</I>
<DD>
-True if <I>file</I> exists and has been modified since it was last read.
+True if <I>file</I> exists and has been modified since it was last
+accessed.
<DT><B>-O </B><I>file</I>
<DD>
<DD>
True if <I>file</I> exists and is a socket.
-<DT><I>file1</I> <B>-ef</B> <I>file2</I><DD>
-True if <I>file1</I> and <I>file2</I> refer to the same device and
-inode numbers.
-<DT><I>file1</I> -<B>nt</B> <I>file2</I><DD>
-True if <I>file1</I> is newer (according to modification date) than <I>file2</I>,
-or if <I>file1</I> exists and file2 does not.
-<DT><I>file1</I> -<B>ot</B> <I>file2</I><DD>
-True if <I>file1</I> is older than <I>file2</I>, or if <I>file2</I> exists
-and <I>file1</I> does not.
<DT><B>-o </B><I>optname</I>
<DD>
<DD>
True if the length of <I>string</I> is zero.
<DT><I>string</I><DD>
-
<DT><B>-n </B><I>string</I>
<DD>
-
True if the length of
<I>string</I>
is non-zero.
+
<DT><I>string1</I> <B>==</B> <I>string2</I><DD>
<DT><I>string1</I> <B>=</B> <I>string2</I><DD>
-
-True if the strings are equal. <B>=</B> should be used
-with the <B>test</B> command for POSIX conformance.
+True if the strings are equal.
+<B>=</B> should be used with the <B>test</B> command for POSIX conformance.
When used with the <B>[[</B> command, this performs pattern matching as
described above (<B>Compound Commands</B>).
<DT><I>string1</I> <B>!=</B> <I>string2</I><DD>
True if <I>string1</I> sorts before <I>string2</I> lexicographically.
<DT><I>string1</I> <B>></B> <I>string2</I><DD>
True if <I>string1</I> sorts after <I>string2</I> lexicographically.
+
+<DT>
+<DD>
+<I>file1</I> <B>-ef</B> <I>file2</I>
+True if <I>file1</I> and <I>file2</I> refer to the same device and
+inode numbers.
+<DT><I>file1</I> -<B>nt</B> <I>file2</I><DD>
+True if <I>file1</I> is newer (according to modification date) than <I>file2</I>,
+or if <I>file1</I> exists and file2 does not.
+<DT><I>file1</I> -<B>ot</B> <I>file2</I><DD>
+True if <I>file1</I> is older than <I>file2</I>, or if <I>file2</I> exists
+and <I>file1</I> does not.
+
<DT><I>arg1</I> <B>OP</B> <I>arg2</I>
<DD>
These arithmetic binary operators return true if <I>arg1</I>
is equal to, not equal to, less than, less than or equal to,
greater than, or greater than or equal to <I>arg2</I>, respectively.
-<I>Arg1</I>
+<I>arg1</I>
and
<I>arg2</I>
may be positive or negative integers.
When used with the <B>[[</B> command,
-<I>Arg1</I>
+<I>arg1</I>
and
-<I>Arg2</I>
+<I>arg2</I>
are evaluated as arithmetic expressions (see
<FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
above).
</DL>
-<A NAME="lbBX"> </A>
+<A NAME="lbBY"> </A>
<H3>SIMPLE COMMAND EXPANSION</H3>
-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.
<DL COMPACT>
processing.
<DT>2.<DD>
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.
<DT>3.<DD>
<P>
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.
<P>
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.
-<A NAME="lbBY"> </A>
+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.
+<A NAME="lbBZ"> </A>
<H3>COMMAND EXECUTION</H3>
After a command has been split into words, if it results in a
<P>
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
<FONT SIZE=-1><B>FUNCTIONS</B>.
</FONT>
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.
<P>
If the name is neither a shell function nor a builtin,
</FONT>
below).
-A full search of the directories in
+Bash performs a full search of the directories in
<FONT SIZE=-1><B>PATH</B>
</FONT>
-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 <B>command_not_found_handle</B>.
If that function exists, it is invoked in a separate execution environment
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 <I>shell script</I>, a file
-containing shell commands, and the shell creates a
-new instance of itself
-to execute it.
+a <I>shell script</I>, 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
<B>hash</B>
below under
-<FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>)</FONT>
+<FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
+
+</FONT>
are retained by the child.
<P>
<B>#!</B>,
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.
-<A NAME="lbBZ"> </A>
+<A NAME="lbCA"> </A>
<H3>COMMAND EXECUTION ENVIRONMENT</H3>
The shell has an <I>execution environment</I>, which consists of the
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
+<B>lastpipe</B> shell option,
+are also executed in a subshell environment.
+Changes made to the subshell environment
cannot affect the shell's execution environment.
<P>
default standard input for the command is the empty file <I>/dev/null</I>.
Otherwise, the invoked command inherits the file descriptors of the calling
shell as modified by redirections.
-<A NAME="lbCA"> </A>
+<A NAME="lbCB"> </A>
<H3>ENVIRONMENT</H3>
When a program is invoked it is given an array of strings
it for
<I>export</I>
-to child processes. Executed commands inherit the environment.
+to child processes.
+Executed commands inherit the environment.
The
-<B>export</B>
+<B>export</B>,
+
+<B>declare -x</B>,
and
-<B>declare -x</B>
+<B>unset</B>
-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
<B>unset</B>
-command, plus any additions via the
+or
+<B>export -n</B>
+
+commands, plus any additions via the
<B>export</B>
and
commands.
<P>
-The environment for any
-<I>simple command</I>
-
-or function may be augmented temporarily by prefixing it with
-parameter assignments, as described above in
-<FONT SIZE=-1><B>PARAMETERS</B>.
+If any parameter assignments, as described above in
+<FONT SIZE=-1><B>PARAMETERS</B>,
</FONT>
+appear before a
+<I>simple command</I>,
+
+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.
<P>
If the
invokes an external command, the variable
<B>_</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.
-<A NAME="lbCB"> </A>
+<A NAME="lbCC"> </A>
<H3>EXIT STATUS</H3>
The exit status of an executed command is the value returned by the
-<I>waitpid</I> 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.
+<I>waitpid</I> 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.
<P>
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.
+<P>
+
When a command terminates on a fatal signal <I>N</I>, <B>bash</B> uses
the value of 128+<I>N</I> as the exit status.
<P>
<B>Bash</B> 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 <B>exit</B> builtin
-command below.
-<A NAME="lbCC"> </A>
+with a non-zero value.
+See also the <B>exit</B> builtin command below.
+<A NAME="lbCD"> </A>
<H3>SIGNALS</H3>
When <B>bash</B> is interactive, in the absence of any traps, it ignores
</FONT>
(so that <B>kill 0</B> does not kill an interactive shell),
-and
+and catches and handles
<FONT SIZE=-1><B>SIGINT</B>
</FONT>
-is caught and handled (so that the <B>wait</B> builtin is interruptible).
+(so that the <B>wait</B> builtin is interruptible).
+When <B>bash</B> receives
+<FONT SIZE=-1><B>SIGINT</B>,
+
+</FONT>
+it breaks out of any executing loops.
In all cases, <B>bash</B> ignores
<FONT SIZE=-1><B>SIGQUIT</B>.
</FONT>
<P>
-Non-builtin commands run by <B>bash</B> have signal handlers
-set to the values inherited by the shell from its parent.
+The <B>trap</B> builtin modifies the shell's signal handling, as
+described below.
+<P>
+
+Non-builtin commands <B>bash</B> executes have signal handlers
+set to the values inherited by the shell from its parent,
+unless <B>trap</B> 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
<FONT SIZE=-1><B>SIGINT</B>
</FONT>
to all jobs, running or stopped.
-Stopped jobs are sent
+The shell sends
<FONT SIZE=-1><B>SIGCONT</B>
</FONT>
-to ensure that they receive the
-<FONT SIZE=-1><B>SIGHUP</B>.
+to stopped jobs to ensure that they receive the
+<FONT SIZE=-1><B>SIGHUP </B>
+
+</FONT>
+(see
+<FONT SIZE=-1><B>JOB CONTROL</B>
</FONT>
+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</B>
<FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
</FONT>
-below) or marked
-to not receive
+below) or mark it not to receive
<FONT SIZE=-1><B>SIGHUP</B>
</FONT>
If the
<B>huponexit</B>
-shell option has been set with
+shell option has been set using
<B>shopt</B>,
<B>bash</B>
If <B>bash</B> 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 <B>bash</B> is waiting for an asynchronous command via the <B>wait</B>
-builtin, the reception of a signal for which a trap has been set will
-cause the <B>wait</B> builtin to return immediately with an exit status
-greater than 128, immediately after which the trap is executed.
+If <B>bash</B> is waiting for an asynchronous command via the <B>wait</B>
+builtin,
+and it receives a signal for which a trap has been set,
+the <B>wait</B> builtin will return immediately with an exit status
+greater than 128, immediately after which the shell executes the trap.
<P>
When job control is not enabled, and <B>bash</B> is waiting for a foreground
</FONT>
to all processes in that process group.
+See
+<FONT SIZE=-1><B>JOB CONTROL</B>
+
+</FONT>
+below for more information about process groups.
<P>
When <B>bash</B> is running without job control enabled and receives
receives while it is waiting for the foreground command to
complete, for compatibility.
</DL>
-<A NAME="lbCD"> </A>
+<A NAME="lbCE"> </A>
<H3>JOB CONTROL</H3>
<I>Job control</I>
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>-b</B>
option to the
builtin, and job control is enabled, <B>wait</B> will return when the
job changes state. The <B>-f</B> option causes <B>wait</B> to wait
until the job or process terminates before returning.
-<A NAME="lbCE"> </A>
+<A NAME="lbCF"> </A>
<H3>PROMPTING</H3>
When executing interactively,
</FONT>
when it needs more input to complete a command.
+<P>
+
+<B>Bash</B>
+
+examines the value of the array variable <B>PROMPT_COMMAND</B> just before
+printing each primary prompt.
+If any elements in <B>PROMPT_COMMAND</B> 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</B>
displays
</FONT>
after it reads a command but before executing it.
+<P>
+
<B>Bash</B>
displays
</FONT>
as described above
before tracing each command when the <B>-x</B> option is enabled.
+<P>
+
<B>Bash</B>
-allows these prompt strings to be customized by inserting a number of
+allows the prompt strings
+<B>PS0</B>, <B>PS1</B>, <B>PS2</B>, and <B>PS4</B>,
+to be customized by inserting a number of
backslash-escaped special characters that are decoded as follows:
<DL COMPACT><DT><DD>
-
<DL COMPACT>
<DT><B>\a</B>
<DD>
-an ASCII bell character (07)
+An ASCII bell character (07).
+
<DT><B>\d</B>
<DD>
-the date in
+The date in
format (e.g.,
<DT><B>\D{</B><I>format</I>}
<DD>
-the <I>format</I> is passed to
+The <I>format</I> is passed to
<I>strftime</I>(3)
and the result is inserted
into the prompt string; an empty <I>format</I> results in a locale-specific
-time representation. The braces are required
+time representation.
+The braces are required.
<DT><B>\e</B>
<DD>
-an ASCII escape character (033)
+An ASCII escape character (033).
<DT><B>\h</B>
<DD>
-the hostname up to the first
+The hostname up to the first
<DT><B>\H</B>
<DD>
-the hostname
+The hostname.
<DT><B>\j</B>
<DD>
-the number of jobs currently managed by the shell
+The number of jobs currently managed by the shell.
<DT><B>\l</B>
<DD>
-the basename of the shell's terminal device name
+The basename of the shell's terminal device name (e.g.,
+
<DT><B>\n</B>
<DD>
-newline
+A newline.
<DT><B>\r</B>
<DD>
-carriage return
+A carriage return.
<DT><B>\s</B>
<DD>
-the name of the shell, the basename of
+The name of the shell: the basename of
<B>$0</B>
-(the portion following the final slash)
+(the portion following the final slash).
<DT><B>\t</B>
<DD>
-the current time in 24-hour HH:MM:SS format
+The current time in 24-hour HH:MM:SS format.
<DT><B>\T</B>
<DD>
-the current time in 12-hour HH:MM:SS format
+The current time in 12-hour HH:MM:SS format.
<DT><B>\@</B>
<DD>
-the current time in 12-hour am/pm format
+The current time in 12-hour am/pm format.
<DT><B>\A</B>
<DD>
-the current time in 24-hour HH:MM format
+The current time in 24-hour HH:MM format.
<DT><B>\u</B>
<DD>
-the username of the current user
+The username of the current user.
<DT><B>\v</B>
<DD>
-the version of <B>bash</B> (e.g., 2.00)
+The <B>bash</B> version (e.g., 2.00)
<DT><B>\V</B>
<DD>
-the release of <B>bash</B>, version + patch level (e.g., 2.00.0)
+The <B>bash</B> release, version + patch level (e.g., 2.00.0)
<DT><B>\w</B>
<DD>
-the value of the <B>PWD</B> shell variable (<B>$PWD</B>),
+The value of the <B>PWD</B> shell variable (<B>$PWD</B>),
with
<FONT SIZE=-1><B>$HOME</B>
<FONT SIZE=-1><B>PROMPT_DIRTRIM</B>
</FONT>
-variable)
+variable).
<DT><B>\W</B>
<DD>
-the basename of <B>$PWD</B>,
+The basename of <B>$PWD</B>,
with
<FONT SIZE=-1><B>$HOME</B>
</FONT>
-abbreviated with a tilde
+abbreviated with a tilde.
<DT><B>\!</B>
<DD>
-the history number of this command
+The history number of this command.
<DT><B>\#</B>
<DD>
-the command number of this command
+The command number of this command.
<DT><B>\$</B>
<DD>
-if the effective UID is 0, a
+If the effective UID is 0, a
<B>#</B>,
otherwise a
-<B>$</B>
+<B>$</B>.
<DT><B>\</B><I>nnn</I>
<DD>
-the character corresponding to the octal number <I>nnn</I>
+The character corresponding to the octal number <I>nnn</I>.
<DT><B>\\</B>
<DD>
-a backslash
+A backslash.
<DT><B>\[</B>
<DD>
-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.
<DT><B>\]</B>
<DD>
-end a sequence of non-printing characters
+End a sequence of non-printing characters.
</DL></DL>
This can have unwanted side effects if escaped portions of the string
appear within command substitution or contain characters special to
word expansion.
-<A NAME="lbCF"> </A>
+<A NAME="lbCG"> </A>
<H3>READLINE</H3>
This is the library that handles reading input when using an interactive
shell, unless the
<B>--noediting</B>
-option is given at shell invocation.
+option is supplied at shell invocation.
Line editing is also used when using the <B>-e</B> option to the
<B>read</B> builtin.
By default, the line editing commands are similar to those of Emacs.
<B>set</B>
builtin.
-<A NAME="lbCG"> </A>
+<A NAME="lbCH"> </A>
<H4>Readline Notation</H4>
In this section, the Emacs-style notation is used to denote
<I>meta</I>
keys are denoted by M-<I>key</I>, so M-x means Meta-X.
-(On keyboards without a
-<I>meta</I>
+<P>
+
+On keyboards without a
+<I>Meta</I>
key, M-<I>x</I> means ESC <I>x</I>, i.e., press the Escape key
then the
<I>x</I>
-key. This makes ESC the <I>meta prefix</I>.
+key.
+This makes ESC the <I>meta prefix</I>.
The combination M-C-<I>x</I> means ESC-Control-<I>x</I>,
or press the Escape key
then hold the Control key while pressing the
key.)
<P>
+On some keyboards, the Meta key modifier produces meta characters with
+the eighth bit (0200) set (you can use the <B>enable-meta-key</B> 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.
+<P>
+
+If the <I>Meta</I> key produces a key sequence with the ESC meta prefix,
+you can make M-<I>key</I> key bindings you specify (see
+<B>Readline Key Bindings</B>
+
+below) do the same thing by setting the <B>force-meta-prefix</B> variable.
+<P>
+
Readline commands may be given numeric
<I>arguments</I>,
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.
-<A NAME="lbCH"> </A>
+<A NAME="lbCI"> </A>
<H4>Readline Initialization</H4>
Readline is customized by putting commands in an initialization
In addition to command names, readline allows keys to be bound
to a string that is inserted when the key is pressed (a <I>macro</I>).
-<A NAME="lbCI"> </A>
+<A NAME="lbCJ"> </A>
<H4>Readline Key Bindings</H4>
The syntax for controlling key bindings in the
<DT><B>\M-</B>
<DD>
-meta prefix
+adding the meta prefix or converting the following character to a meta
+character, as described below under <B>force-meta-prefix</B>
<DT><B>\e</B>
<DD>
</FONT>
below).
-<A NAME="lbCJ"> </A>
+<A NAME="lbCK"> </A>
<H4>Readline Variables</H4>
Readline has variables that can be used to further customize its
<DT><B>convert-meta (On)</B>
<DD>
-If set to <B>On</B>, 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 <I>meta prefix</I>).
-The default is <I>On</I>, but readline will set it to <I>Off</I> if the
-locale contains eight-bit characters.
+If set to <B>On</B>, 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 <I>meta prefix</I>).
+The default is <I>On</I>, but readline will set it to <I>Off</I>
+if the locale contains
+characters whose encodings may include bytes with the eighth bit set.
This variable is dependent on the <B>LC_CTYPE</B> locale category, and
may change if the locale is changed.
+This variable also affects key bindings; see the description of
+<B>force-meta-prefix</B> below.
<DT><B>disable-completion (Off)</B>
<DD>
<DD>
When set to <B>On</B>, 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).
+<DT><B>force-meta-prefix (Off)</B>
+
+<DD>
+If set to <B>On</B>, readline modifies its behavior when binding key
+sequences containing \M- or Meta-
+(see <B>Key Bindings</B> above) by converting a key sequence of the form
+\M-<I>C</I> or Meta-<I>C</I> to the two-character sequence
+<B>ESC</B><I>C</I> (adding the meta prefix).
+If
+<B>force-meta-prefix</B>
+
+is set to <B>Off</B> (the default),
+readline uses the value of the
+<B>convert-meta </B>
+
+variable to determine whether to perform this conversion:
+if <B>convert-meta</B> is <B>On</B>,
+readline performs the conversion described above;
+if it is <B>Off</B>, Readline converts <I>C</I> to a meta character by
+setting the eighth bit (0200).
<DT><B>expand-tilde (Off)</B>
<DD>
<DD>
If set to <B>On</B>, 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
<B>meta-flag</B>
is a synonym for this variable.
-The default is <I>Off</I>, but readline will set it to <I>On</I> if the
-locale contains eight-bit characters.
+The default is <I>Off</I>, but readline will set it to <I>On</I>
+if the locale contains
+characters whose encodings may include bytes with the eighth bit set.
This variable is dependent on the <B>LC_CTYPE</B> locale category, and
may change if the locale is changed.
<DT><B>isearch-terminators (</B>
If set to <B>On</B>, readline will display characters with the
eighth bit set directly rather than as a meta-prefixed escape
sequence.
-The default is <I>Off</I>, but readline will set it to <I>On</I> if the
-locale contains eight-bit characters.
+The default is <I>Off</I>, but readline will set it to <I>On</I>
+if the locale contains
+characters whose encodings may include bytes with the eighth bit set.
This variable is dependent on the <B>LC_CTYPE</B> locale category, and
may change if the locale is changed.
<DT><B>page-completions (On)</B>
<DD>
If set to <B>On</B>, readline uses an internal <I>more</I>-like pager
to display a screenful of possible completions at a time.
+<DT><B>prefer-visible-bell</B>
+
+<DD>
+See <B>bell-style</B>.
<DT><B>print-completions-horizontally (Off)</B>
<DD>
completions.
</DL>
-<A NAME="lbCK"> </A>
+<A NAME="lbCL"> </A>
<H4>Readline Conditional Constructs</H4>
Readline implements a facility similar in spirit to the conditional
</DL>
-<A NAME="lbCL"> </A>
+<A NAME="lbCM"> </A>
<H4>Searching</H4>
Readline provides commands for searching through the command history
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.
-<A NAME="lbCM"> </A>
+<A NAME="lbCN"> </A>
<H4>Readline Command Names</H4>
The following is a list of the names of the commands and the default
position, and <I>mark</I> refers to a cursor position saved by the
<B>set-mark</B> command.
The text between the point and mark is referred to as the <I>region</I>.
-<A NAME="lbCN"> </A>
+<A NAME="lbCO"> </A>
<H4>Commands for Moving</H4>
Refresh the current line.
</DL>
-<A NAME="lbCO"> </A>
+<A NAME="lbCP"> </A>
<H4>Commands for Manipulating the History</H4>
and <I>emacs</I> as the editor, in that order.
</DL>
-<A NAME="lbCP"> </A>
+<A NAME="lbCQ"> </A>
<H4>Commands for Changing Text</H4>
but may be bound to the Insert key on some keyboards.
</DL>
-<A NAME="lbCQ"> </A>
+<A NAME="lbCR"> </A>
<H4>Killing and Yanking</H4>
</DL>
-<A NAME="lbCR"> </A>
+<A NAME="lbCS"> </A>
<H4>Numeric Arguments</H4>
argument count sixteen, and so on.
</DL>
-<A NAME="lbCS"> </A>
+<A NAME="lbCT"> </A>
<H4>Completing</H4>
above).
</DL>
-<A NAME="lbCT"> </A>
+<A NAME="lbCU"> </A>
<H4>Keyboard Macros</H4>
<I>inputrc</I> file.
</DL>
-<A NAME="lbCU"> </A>
+<A NAME="lbCV"> </A>
<H4>Miscellaneous</H4>
</DL>
-<A NAME="lbCV"> </A>
+<A NAME="lbCW"> </A>
<H4>Programmable Completion</H4>
-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 <I>compspec</I>) has been defined
using the <B>complete</B> builtin (see
<FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
</FONT>
-below), the programmable completion facilities are invoked.
+below), Readline invokes the programmable completion facilities.
<P>
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 <B>-E</B> option to <B>complete</B> 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 <B>-D</B> option to <B>complete</B> is used as the default.
Any function specified with <B>-F</B> is invoked first.
The function may use any of the shell facilities, including the
-<B>compgen</B> builtin described below, to generate the matches.
+<B>compgen</B> and <B>compopt</B>
+builtins described below, to generate the matches.
It must put the possible completions in the
<FONT SIZE=-1><B>COMPREPLY</B>
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.
<P>
After all of the possible completions are generated, any filter
Finally, any prefix and suffix specified with the <B>-P</B> and <B>-S</B>
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 <B>readline</B> as the list of possible completions.
<P>
If the previously-applied actions do not generate any matches, and 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 <B>bash</B> completions are not attempted, and the readline
-default of filename completion is disabled.
+The default <B>bash</B> completions and the <B>readline</B>
+default of filename completion are disabled.
If the <B>-o bashdefault</B> option was supplied to <B>complete</B> when
-the compspec was defined, the <B>bash</B> default completions are attempted
-if the compspec generates no matches.
+the compspec was defined,
+if the compspec generates no matches,
+the <B>bash</B> default completions are attempted.
If the <B>-o default</B> option was supplied to <B>complete</B> when the
compspec was defined, readline's default completion will be performed
if the compspec (and, if attempted, the default <B>bash</B> completions)
of the setting of the <B>mark-symlinked-directories</B> readline variable.
<P>
-There is some support for dynamically modifying completions. This is
-most useful when used in combination with a default completion specified
-with <B>complete -D</B>.
+There is some support for dynamically modifying completions.
+This is most useful when used in combination with a default completion
+specified with <B>complete -D</B>.
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.
<P>
For instance, assuming that there is a library of compspecs, each kept in a
</DL>
-<A NAME="lbCW"> </A>
+<A NAME="lbCX"> </A>
<H3>HISTORY</H3>
When the
<FONT SIZE=-1><B>HISTSIZE</B>
</FONT>
-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
<FONT SIZE=-1><B>EXPANSION</B>
</FONT>
<P>
-On startup, the history is initialized from the file named by
-the variable
-<FONT SIZE=-1><B>HISTFILE</B>
-
-</FONT>
-(default <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>).
-The file named by the value of
+On startup, <B>bash</B> initializes the history list
+by reading history entries from the
+the file named by the
<FONT SIZE=-1><B>HISTFILE</B>
</FONT>
-is truncated, if necessary, to contain no more than
-the number of lines specified by the value of
+variable (default <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>).
+That file is referred to as the <I>history file</I>.
+The history file is truncated, if necessary,
+to contain no more than the number of history entries
+specified by the value of
<FONT SIZE=-1><B>HISTFILESIZE</B>.
</FONT>
If <B>HISTFILESIZE</B> is unset, or set to null, a non-numeric value,
or a numeric value less than zero, the history file is not truncated.
+<P>
+
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.
</FONT>
variable.
-When a shell with history enabled exits, the last
+When present, history timestamps delimit history entries, making
+multi-line entries possible.
+<P>
+
+When a shell with history enabled exits, <B>bash</B> copies the last
<FONT SIZE=-1><B>$HISTSIZE</B>
</FONT>
-lines are copied from the history list to
+entries from the history list to
<FONT SIZE=-1><B>$HISTFILE</B>.
</FONT>
<FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
</FONT>
-below), the lines are appended to the history file,
+below), <B>bash</B> appends the entries to the history file,
otherwise the history file is overwritten.
If
<FONT SIZE=-1><B>HISTFILE</B>
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
+<FONT SIZE=-1><B>HISTTIMEFORMAT</B>,
+
+</FONT>
+the timestamps delimit multi-line history entries.
+After saving the history, <B>bash</B> truncates the history file
to contain no more than
<FONT SIZE=-1><B>HISTFILESIZE</B>
</FONT>
-lines. If
+lines.
+If
<FONT SIZE=-1><B>HISTFILESIZE</B>
</FONT>
or a numeric value less than zero, the history file is not truncated.
<P>
-The builtin command
+The
<B>fc</B>
-(see
+builtin command (see
<FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
</FONT>
-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
<B>history</B>
-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.
<P>
-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
<FONT SIZE=-1><B>HISTCONTROL</B>
</FONT>
<FONT SIZE=-1><B>HISTIGNORE</B>
</FONT>
-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</B>
The
<B>lithist</B>
-shell option causes the shell to save the command with embedded newlines
-instead of semicolons. See the description of the
+shell option modifies <B>cmdhist</B> by saving
+the command with embedded newlines instead of semicolons.
+See the description of the
<B>shopt</B>
builtin below under
</FONT>
for information on setting and unsetting shell options.
-<A NAME="lbCX"> </A>
+<A NAME="lbCY"> </A>
<H3>HISTORY EXPANSION</H3>
The shell supports a history expansion feature that
is similar to the history expansion in
<B>csh</B>.
-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.
+<P>
+
+History expansion is enabled by default for interactive shells,
+and can be disabled using the
<B>+H</B>
option to the
<FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
</FONT>
-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
+
<P>
History expansions introduce words from the history list into
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.
+<P>
+
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 <I>event</I>,
-and the portions of that line that are acted upon are <I>words</I>.
-The line is broken into words in the same fashion as when reading input,
+The entry selected from the history is the <I>event</I>,
+and the portions of that entry that are acted upon are <I>words</I>.
+The entry is split into words in the same fashion as when reading input,
so that several <I>metacharacter</I>-separated words surrounded by
quotes are considered one word.
The <I>event designator</I> selects the event, the optional
is the first character on the line.
It selects the previous history entry, using an event designator
equivalent to <B>!!</B>,
-and substitutes one string for another in that line.
+and substitutes one string for another in that entry.
It is described below under <B>Event Designators</B>.
This is the only history expansion that does not begin with the history
expansion character.
Several shell options settable with the
<B>shopt</B>
-builtin may be used to tailor the behavior of history expansion.
+builtin will modify history expansion behavior
+(see the description of the
+<B>shopt</B>
+
+builtin below).and
If the
<B>histverify</B>
-shell option is enabled (see the description of the
-<B>shopt</B>
-
-builtin below), and
+shell option is enabled, and
<B>readline</B>
is being used, history substitutions are not immediately passed to
is being used, and the
<B>histreedit</B>
-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</B>
editing buffer for correction.
+<P>
+
The
<B>-p</B>
option to the
<B>history</B>
-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</B>
option to the
<B>history</B>
-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.
<P>
The shell uses
the history comment character to mark history timestamps when
writing the history file.
-<A NAME="lbCY"> </A>
+<A NAME="lbCZ"> </A>
<H4>Event Designators</H4>
-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,
<B>blank</B>,
newline, carriage return, =
-or ( (when the <B>extglob</B> shell option is enabled using
-the <B>shopt</B> builtin).
+or, when the <B>extglob</B> shell option is enabled using
+the <B>shopt</B> builtin, (.
<DT><B>!</B><I>n</I>
<DD>
-Refer to command line
+Refer to history list entry
<I>n</I>.
<DT><B>!-</B><I>n</I>
<DD>
-Refer to the current command minus
+Refer to the current entry minus
<I>n</I>.
<DT><B>!!</B>
<DD>
-Refer to the previous command. This is a synonym for
+Refer to the previous command.
+This is a synonym for
<DT><B>!</B><I>string</I>
<I>string</I>
is followed immediately by a newline.
-If <I>string</I> is missing, the string from the most recent search is used;
+If <I>string</I> is missing, this uses
+the string from the most recent search;
it is an error if there is no previous search string.
<DT><B></B><FONT SIZE=+2><B>^</B></FONT><B></B><I>string1</I><FONT SIZE=+2>^</FONT><I>string2</I><FONT SIZE=+2>^</FONT>
<DD>
-Quick substitution. Repeat the previous command, replacing
+Quick substitution.
+Repeat the previous command, replacing
<I>string1</I>
with
The entire command line typed so far.
</DL>
-<A NAME="lbCZ"> </A>
+<A NAME="lbDA"> </A>
<H4>Word Designators</H4>
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>:</B>
<DT><B>0 (zero)</B>
<DD>
-The zeroth word. For the shell, this is the command
-word.
+The zeroth word.
+For the shell, this is the command word.
<DT><I>n</I>
<DD>
<DT><B>^</B>
<DD>
-The first argument. That is, word 1.
+The first argument: word 1.
<DT><B>$</B>
<DD>
-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.
<DT><B>%</B>
It is not an error to use
<B>*</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.
<DT><B>x*</B>
<DD>
<P>
If a word designator is supplied without an event specification, the
-previous command is used as the event.
-<A NAME="lbDA"> </A>
+previous command is used as the event, equivalent to <B>!!</B>.
+<A NAME="lbDB"> </A>
<H4>Modifiers</H4>
-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.
<P>
<B>blanks</B>
and newlines.
-The <B>q</B> and <B>x</B> modifiers are mutually exclusive; the last one
-supplied is used.
+The <B>q</B> and <B>x</B> modifiers are mutually exclusive;
+expansion uses the last one supplied.
<DT><B>s/</B><I>old</I>/<I>new</I>/
<DD>
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</I>
and
-<I>new</I>
+<I>new</I>.
-with a single backslash. If & appears in
+If & appears in
<I>new</I>,
-it is replaced by
+it is replaced with
<I>old</I>.
A single backslash will quote the &.
modifier once to each word in the event line.
</DL>
-<A NAME="lbDB"> </A>
+<A NAME="lbDC"> </A>
<H3>SHELL BUILTIN COMMANDS</H3>
last command executed from
<I>filename</I>.
+<DT><DD>
If <I>filename</I> does not contain a slash, <B>. </B> searchs for it.
If the <B>-p</B> option is supplied, <B>. </B> treats <I>path</I>
as a colon-separated list of directories in which to find <I>filename</I>;
<I>filename</I> does not need to be executable.
When <B>bash</B> is not in <I>posix mode</I>, it searches
-the current directory if no file is found in
+the current directory if <I>filename</I> is not found in
<FONT SIZE=-1><B>PATH</B>,
</FONT>
<FONT SIZE=-1><B>PATH</B>.
</FONT>
+<DT><DD>
If any <I>arguments</I> are supplied, they become the positional
parameters when <I>filename</I> is executed.
Otherwise the positional parameters are unchanged.
+<DT><DD>
If the <B>-T</B> option is enabled, <B>.</B> inherits any trap on
<B>DEBUG</B>; if it is not, any <B>DEBUG</B> trap string is saved and
restored around the call to <B>.</B>, and <B>.</B> unsets the
<B>DEBUG</B> trap while it executes.
If <B>-T</B> is not set, and the sourced file changes
-the <B>DEBUG</B> trap, the new value is retained when <B>.</B> 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 <B>DEBUG</B> trap, the new value persists after <B>.</B> completes.
+The return status is the status of the last command executed from
+<I>filename</I> (0 if no commands are executed), and non-zero if
<I>filename</I>
is not found or cannot be read.
<DT><B>alias</B> [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
-<B>Alias</B> with no arguments or with the
+With no arguments or with the
<B>-p</B>
-option prints the list of aliases in the form
+option,<B>alias</B> prints the list of aliases in the form
<B>alias</B> <I>name</I>=<I>value</I> on standard output.
-When arguments are supplied, an alias is defined for
+When arguments are supplied, define an alias for
each <I>name</I> whose <I>value</I> is given.
A trailing space in <I>value</I> 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 <I>name</I> in the argument list for which no <I>value</I>
-is supplied, the name and value of the alias is printed.
-<B>Alias</B> returns true unless a <I>name</I> is given for which
-no alias has been defined.
+is supplied, print the name and value of the alias <I>name</I>.
+<B>alias</B> returns true unless a <I>name</I> is given
+(without a corresponding =<I>value</I>)
+for which no alias has been defined.
<DT><B>bg</B> [<I>jobspec</I> ...]<DD>
Resume each suspended job <I>jobspec</I> in the background, as if it
had been started with
key and function bindings, bind a key sequence to a
<B>readline</B>
-function or macro, or set a
+function or macro
+or to a shell command, or set a
<B>readline</B>
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</B>
initialization file such as
vi-move, vi-command</I>, and
<I>vi-insert</I>.
-<I>vi</I> is equivalent to <I>vi-command</I> (<I>vi-move</I> is also
-a synonym); <I>emacs</I> is
-equivalent to <I>emacs-standard</I>.
+<I>vi</I> is equivalent to <I>vi-command</I>
+(<I>vi-move</I> is also a synonym);
+<I>emacs</I> is equivalent to <I>emacs-standard</I>.
<DT><B>-l</B>
<DD>
<DD>
Display <B>readline</B> 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
+<B>bind</B> command or in a <B>readline</B> initialization file.
If arguments remain after option processing, <B>bind</B> treats
them as readline command names and restricts output to those names.
<DT><B>-P</B>
<DD>
Display <B>readline</B> 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 <B>bind</B> command
+or in a <B>readline</B> initialization file.
<DT><B>-S</B>
<DD>
<DD>
Display <B>readline</B> variable names and values in such a way that they
-can be re-read.
+can be
+used as an argument to a subsequent
+<B>bind</B> command or in a <B>readline</B> initialization file.
<DT><B>-V</B>
<DD>
<DT><B>-q </B><I>function</I>
<DD>
-Query about which keys invoke the named <I>function</I>.
+Display key sequences that invoke the named <B>readline</B> <I>function</I>.
<DT><B>-u </B><I>function</I>
<DD>
-Unbind all keys bound to the named <I>function</I>.
+Unbind all key sequences bound to the named <B>readline</B> <I>function</I>.
<DT><B>-r </B><I>keyseq</I>
<DD>
If the separator is a colon, any enclosing double quotes are optional, and
<B>readline</B> 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 <I>shell-command</I> is executed, the shell sets the
<FONT SIZE=-1><B>READLINE_LINE</B>
<DD>
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.
</DL>
<P>
-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.
</DL>
or
<B>select</B>
-loop. If <I>n</I> is specified, break <I>n</I> levels.
+loop.
+If <I>n</I> is specified, <B>break</B> exits <I>n</I> enclosing loops.
<I>n</I>
must be >= 1. If
are exited.
The return value is 0 unless <I>n</I> is not greater than or equal to 1.
<DT><B>builtin</B> <I>shell-builtin</I> [<I>arguments</I>]<DD>
-Execute the specified shell builtin, passing it
+Execute the specified shell builtin <I>shell-builtin</I>, passing it
<I>arguments</I>,
and return its exit status.
<DT><B>caller</B> [<I>expr</I>]<DD>
Returns the context of any active subroutine call (a shell function or
a script executed with the <B>.</B> or <B>source</B> builtins).
+<DT><DD>
Without <I>expr</I>, <B>caller</B> displays the line number and source
filename of the current subroutine call.
If a non-negative integer is supplied as <I>expr</I>, <B>caller</B>
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.
+<DT><DD>
The return value is 0 unless the shell is not executing a subroutine
call or <I>expr</I> does not correspond to a valid position in the
call stack.
<FONT SIZE=-1><B>HOME</B>
</FONT>
-shell variable is the default.
+shell variable is used as <I>dir</I>.
The variable
<FONT SIZE=-1><B>CDPATH</B>
</FONT>
-defines the search path for the directory containing
-<I>dir</I>:
-
+exists, <B>cd</B> uses it as a search path:
the shell searches each directory name in
<FONT SIZE=-1><B>CDPATH</B>
<FONT SIZE=-1><B>CDPATH</B>
</FONT>
-are separated by a colon (:). A null directory name in
+are separated by a colon (:).
+A null directory name in
<FONT SIZE=-1><B>CDPATH</B>
</FONT>
<FONT SIZE=-1><B>CDPATH</B>
</FONT>
-is not used. The
+is not used.
+<DT><DD>
+The
<B>-P</B>
option causes <B>cd</B> to use the physical directory structure
option to the
<B>set</B>
-builtin command); the
+builtin command).
+<DT><DD>
+The
<B>-L</B>
option forces symbolic links to be followed by resolving the link
If <I>..</I> appears in <I>dir</I>, it is processed by removing the
immediately previous pathname component from <I>dir</I>, back to a slash
or the beginning of <I>dir</I>.
+<DT><DD>
If the
<B>-e</B>
<B>-P</B>,
and the current working directory cannot be successfully determined
-after a successful directory change, <B>cd</B> will return an unsuccessful
+after a successful directory change, <B>cd</B> will return a non-zero
status.
+<DT><DD>
On systems that support it, the <B>-@</B> option presents the extended
attributes associated with a file as a directory.
+<DT><DD>
An argument of
<B>-</B>
<FONT SIZE=-1><B>$OLDPWD</B>
</FONT>
-before the directory change is attempted.
-If a non-empty directory name from
-<FONT SIZE=-1><B>CDPATH</B>
+before attempting the directory change.
+<DT><DD>
+If <B>cd</B> uses a non-empty directory name from
+<FONT SIZE=-1><B>CDPATH,</B>
</FONT>
-is used, or if
-<B>-</B> 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 <B>-</B> is the first argument, and the directory change is
+successful, <B>cd</B> writes the absolute pathname of the new
+working directory to the standard output.
+<DT><DD>
If the directory change is successful, <B>cd</B> sets the value of the
<B>PWD</B> environment variable to the new directory name, and sets the
<B>OLDPWD</B> environment variable to the value of the current working
directory before the change.
+<DT><DD>
The return value is true if the directory was successfully changed;
false otherwise.
<DT><B>command</B> [<B>-pVv</B>] <I>command</I> [<I>arg</I> ...]<DD>
-Run
+The <B>command</B> builtin runs
<I>command</I>
with
<I>args</I>
-suppressing the normal shell function lookup.
+suppressing the normal shell function lookup for <I>command</I>.
Only builtin commands or commands found in the
<FONT SIZE=-1><B>PATH</B>
</FONT>
-are executed. If the
+named <I>command</I> are executed.
+If the
<B>-p</B>
-option is given, the search for
+option is supplied, the search for
<I>command</I>
is performed using a default value for
</FONT>
that is guaranteed to find all of the standard utilities.
+<DT><DD>
If either the
<B>-V</B>
or
<B>-v</B>
-option is supplied, a description of
-<I>command</I>
+option is supplied, <B>command</B> prints a description of
+<I>command</I>.
-is printed. The
+The
<B>-v</B>
-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</I>
+<I>command</I>;
-to be displayed; the
+the
<B>-V</B>
option produces a more verbose description.
+<DT><DD>
If the
<B>-V</B>
or
<B>-v</B>
-option is supplied, the exit status is 0 if
+option is supplied, the exit status is zero if
<I>command</I>
-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</I>
-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</B>
builtin is the exit status of
<B>-I</B>,
and write the matches to the standard output.
+<DT><DD>
If the <B>-V</B> option is supplied, <B>compgen</B> stores the generated
completions into the indexed array variable <I>varname</I> instead of writing
them to the standard output.
+<DT><DD>
When using the <B>-F</B> or <B>-C</B> options, the various shell variables
set by the programmable completion facilities, while available, will not
have useful values.
completion code had generated them directly from a completion specification
with the same flags.
If <I>word</I> is specified, only those completions matching <I>word</I>
-will be displayed.
+will be displayed or stored.
<DT><DD>
The return value is true unless an invalid option is supplied, or no
matches were generated.
<DD>
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.
</DL></DL>
<DT><B>-A</B> <I>action</I><DD>
the second argument (<B>$2</B>) is the word being completed,
and the third argument (<B>$3</B>) 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 <I>function</I> finishes,
+the possible completions are retrieved from the value
of the
<FONT SIZE=-1><B>COMPREPLY</B>
</FONT>
array variable.
<DT><B>-G</B> <I>globpat</I><DD>
-The pathname expansion pattern <I>globpat</I> is expanded to generate
+Expand the pathname expansion pattern <I>globpat</I> to generate
the possible completions.
<DT><B>-P</B> <I>prefix</I><DD>
-<I>prefix</I> is added at the beginning of each possible completion
+Add <I>prefix</I> to the beginning of each possible completion
after all other options have been applied.
<DT><B>-S</B> <I>suffix</I><DD>
-<I>suffix</I> is appended to each possible completion
+Append <I>suffix</I> to each possible completion
after all other options have been applied.
<DT><B>-W</B> <I>wordlist</I><DD>
The <I>wordlist</I> is split using the characters in the
<FONT SIZE=-1><B>IFS</B>
</FONT>
-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 <I>wordlist</I>,
in order to provide a
mechanism for the words to contain shell metacharacters or characters
Modify completion options for each <I>name</I> according to the
<I>option</I>s, or for the
currently-executing completion if no <I>name</I>s are supplied.
-If no <I>option</I>s are given, display the completion options for each
+If no <I>option</I>s are supplied, display the completion options for each
<I>name</I> or the current completion.
The possible values of <I>option</I> are those valid for the <B>complete</B>
builtin described above.
or after a command delimiter such as <B>;</B> or <B>|</B>, which is usually
command name completion.
<DT><DD>
+If multiple options are supplied, the <B>-D</B> option takes precedence
+over <B>-E</B>, and both take precedence over <B>-I</B>.
+<DT><DD>
The return value is true unless an invalid option is supplied, an attempt
is made to modify the options for a <I>name</I> for which no completion
specification exists, or an output error occurs.
<DT><B>continue</B> [<I>n</I>]<DD>
-Resume the next iteration of the enclosing
+<B>continue</B> resumes the next iteration of the enclosing
<B>for</B>,
<B>while</B>,
If
<I>n</I>
-is specified, resume at the <I>n</I>th enclosing loop.
+is specified, <B>bash</B> resumes the <I>n</I>th enclosing loop.
<I>n</I>
-must be >= 1. If
+must be >= 1.
+If
<I>n</I>
is greater than the number of enclosing loops, the shell resumes
<DT><B>typeset</B> [<B>-aAfFgiIlnrtux</B>] [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
Declare variables and/or give them attributes.
-If no <I>name</I>s are given then display the values of variables.
+If no <I>name</I>s are given then display the values of variables
+or functions.
The
<B>-p</B>
is used with <I>name</I> arguments, additional options,
other than <B>-f</B> and <B>-F</B>, are ignored.
+<DT><DD>
When
<B>-p</B>
-is supplied without <I>name</I> 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 <B>-p</B>, <B>declare</B> will display
-the attributes and values of all shell variables. The <B>-f</B> option
-will restrict the display to shell functions.
+is supplied without <I>name</I> arguments,
+<B>declare</B> will display the attributes and values
+of all variables having the attributes specified by the additional options.
+If no other options are supplied with <B>-p</B>, <B>declare</B> will
+display the attributes and values of all shell variables.
+The <B>-f</B> option restricts the display to shell functions.
+<DT><DD>
The
<B>-F</B>
function name and attributes are printed.
If the <B>extdebug</B> shell option is enabled using <B>shopt</B>,
the source file name and line number where each <I>name</I>
-is defined are displayed as well. The
+is defined are displayed as well.
+The
<B>-F</B>
option implies
<B>-f</B>.
+<DT><DD>
The
<B>-g</B>
option forces variables to be created or modified at the global scope,
even when <B>declare</B> is executed in a shell function.
-It is ignored in all other cases.
+It is ignored when <B>declare</B> is not executed in a shell function.
+<DT><DD>
The
<B>-I</B>
and value of any existing variable with the same
<I>name</I> at a surrounding scope.
If there is no existing variable, the local variable is initially unset.
+<DT><DD>
The following options can
be used to restrict output to variables with the specified attribute or
to give variables attributes:
<DT><B>-f</B>
<DD>
-Use function names only.
+Each <I>name</I> refers to a shell function.
<DT><B>-i</B>
<DD>
-The variable is treated as an integer; arithmetic evaluation (see
+The variable is treated as an integer;
+arithmetic evaluation (see
<FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
</FONT>
<DT><B>-r</B>
<DD>
-Make <I>name</I>s readonly. These names cannot then be assigned values
+Make <I>name</I>s readonly.
+These names cannot then be assigned values
by subsequent assignment statements or unset.
<DT><B>-t</B>
<DT><B>-x</B>
<DD>
-Mark <I>name</I>s for export to subsequent commands via the environment.
+Mark each <I>name</I> for export to subsequent commands via the environment.
</DL>
<P>
instead of
-turns off the attribute instead,
-with the exceptions that <B>+a</B> and <B>+A</B>
+turns off the specified
+attribute instead, with the exceptions that <B>+a</B> and <B>+A</B>
may not be used to destroy array variables and <B>+r</B> will not
remove the readonly attribute.
+<P>
+
When used in a function,
<B>declare</B>
When using <B>-a</B> or <B>-A</B> and the compound assignment syntax to
create array variables, additional attributes do not take effect until
subsequent assignments.
+<P>
+
The return value is 0 unless an invalid option is encountered,
an attempt is made to define a function using
<DT><B>dirs [-clpv</B>] [+<I>n</I>] [-<I>n</I>]
<DD>
-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
command removes entries from the list.
The current directory is always the first directory in the stack.
+<DT><DD>
+Options, if supplied, have the following meanings:
<DL COMPACT><DT><DD>
<DL COMPACT>
of the directory stack.
</DL>
-<DT><B>disown</B> [<B>-ar</B>] [<B>-h</B>] [<I>jobspec</I> ... | <I>pid</I> ... ]<DD>
+<DT><B>disown</B> [<B>-ar</B>] [<B>-h</B>] [<I>id</I> ...]<DD>
Without options, remove each
-<I>jobspec</I>
+<I>id</I>
from the table of active jobs.
+Each <I>id</I> may be a job specification <I>jobspec</I>
+or a process ID
+<I>pid</I>; if <I>id</I> is a <I>pid</I>,
+<B>disown</B> uses the job containing <I>pid</I> as <I>jobspec</I>.
If
-<I>jobspec</I>
+<I>id</I>
is not present, and neither the <B>-a</B> nor the <B>-r</B> option
-is supplied, the <I>current job</I> is used.
-If the <B>-h</B> option is given, each
-<I>jobspec</I>
+is supplied, <B>disown</B> removes the <I>current job</I>.
+If the <B>-h</B> option is supplied, the job corresponding to each
+<I>id</I>
is not removed from the table, but is marked so that
<FONT SIZE=-1><B>SIGHUP</B>
<FONT SIZE=-1><B>SIGHUP</B>.
</FONT>
+<DT><DD>
If no
-<I>jobspec</I>
+<I>id</I>
is supplied, the
<B>-a</B>
option means to remove or mark all jobs; the
<B>-r</B>
-option without a
-<I>jobspec</I>
+option without an
+<I>id</I>
argument restricts operation to running jobs.
-The return value is 0 unless a
-<I>jobspec</I>
+<DT><DD>
+The return value is 0 unless an
+<I>id</I>
does not specify a valid job.
<DT><B>echo</B> [<B>-neE</B>] [<I>arg</I> ...]<DD>
Output the <I>arg</I>s, separated by spaces, followed by a newline.
The return status is 0 unless a write error occurs.
-If <B>-n</B> is specified, the trailing newline is
-suppressed. If the <B>-e</B> option is given, interpretation of
-the following backslash-escaped characters is enabled. The
+If <B>-n</B> is specified, the trailing newline is not printed.
+<DT><DD>
+If the <B>-e</B> option is given, <B>echo</B> interprets
+the following backslash-escaped characters.
+The
<B>-E</B>
-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 <B>xpg_echo</B> shell option may be used to
-dynamically determine whether or not <B>echo</B>
-interprets any options
-and expands these escape characters by default.
+The <B>xpg_echo</B> shell option determines
+whether or not <B>echo</B> interprets any options
+and expands these escape characters.
<B>echo</B>
does not interpret <B>--</B> to mean the end of options.
+<DT><DD>
<B>echo</B>
interprets the following escape sequences:
the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value
<I>HHHHHHHH</I> (one to eight hex digits)
-</DL></DL>
+</DL>
+<P>
+
+<B>echo</B> writes any unrecognized backslash-escaped characters unchanged.
+</DL>
<DT><B>enable</B> [<B>-a</B>] [<B>-dnps</B>] [<B>-f</B> <I>filename</I>] [<I>name</I> ...]<DD>
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 <B>-n</B> is used, each <I>name</I>
-is disabled; otherwise,
-<I>names</I> are enabled. For example, to use the
+even though the shell normally searches for builtins before files.
+<DT><DD>
+If <B>-n</B> is supplied, each <I>name</I> is disabled; otherwise,
+<I>name</I>s are enabled.
+For example, to use the
<B>test</B>
-binary found via the
+binary found usin g
<FONT SIZE=-1><B>PATH</B>
</FONT>
+<DT><DD>
+If no <I>name</I> arguments are supplied, or if the
+<B>-p</B>
+
+option is supplied, print a list of shell builtins.
+With no other option arguments, the list consists of all enabled
+shell builtins.
+If <B>-n</B> is supplied, print only disabled builtins.
+If <B>-a</B> is supplied, the list printed includes all builtins, with an
+indication of whether or not each is enabled.
+The <B>-s</B> option means to restrict the output to the POSIX
+<I>special</I> builtins.
+<DT><DD>
The
<B>-f</B>
<I>filename</I>,
on systems that support dynamic loading.
+If <I>filename</I> does not contain a slash,
<B>Bash</B> will use the value of the <B>BASH_LOADABLES_PATH</B> variable as a
-colon-separated list of directories in which to search for <I>filename</I>,
-if <I>filename</I> does not contain a slash.
-The default is system-dependent,
+colon-separated list of directories in which to search for <I>filename</I>.
+The default for <B>BASH_LOADABLES_PATH</B> is system-dependent,
and may include
to force a search of the current directory.
The
<B>-d</B>
-option will delete a builtin previously loaded with
-<B>-f</B>.
-
-If no <I>name</I> arguments are given, or if the
-<B>-p</B>
-
-option is supplied, a list of shell builtins is printed.
-With no other option arguments, the list consists of all enabled
-shell builtins.
-If <B>-n</B> is supplied, only disabled builtins are printed.
-If <B>-a</B> is supplied, the list printed includes all builtins, with an
-indication of whether or not each is enabled.
-If <B>-s</B> is supplied, the output is restricted to the POSIX
-<I>special</I> builtins.
+option will delete a builtin previously loaded with <B>-f</B>.
+If <I>-s</I> is used with <I>-f</I>, the new builtin becomes a POSIX
+special builtin.
+<DT><DD>
If no options are supplied and a <I>name</I> is not a shell builtin,
-<B>enable</B> will attempt to load <I>name</I> from a shared object named
-<I>name</I>, as if the command were
+<B>enable</B> will attempt to load <I>name</I> from a shared
+object named <I>name</I>, as if the command were
``enable -f <I>name name</I>''.
+<DT><DD>
The return value is 0 unless a
<I>name</I>
is not a shell builtin or there is an error loading a new builtin
from a shared object.
<DT><B>eval</B> [<I>arg</I> ...]<DD>
-The <I>arg</I>s 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
-<B>eval</B>.
-
+Concatenate the <I>arg</I>s together into a single command, separating
+them with spaces.
+<B>Bash</B> then reads and execute this command, and returns its exit status
+as the return status of <B>eval</B>.
If there are no
<I>args</I>,
If
<I>command</I>
-is specified, it replaces the shell.
-No new process is created. The
+is specified, it replaces the shell without creating a new process.
+<I>command</I> cannot be a shell builtin or function.
+The
<I>arguments</I>
become the arguments to <I>command</I>.
option causes
<I>command</I>
-to be executed with an empty environment. If
+to be executed with an empty environment.
+If
<B>-a</B>
is supplied, the shell passes
<I>name</I>
as the zeroth argument to the executed command.
+<DT><DD>
If
<I>command</I>
unless the
<B>execfail</B>
-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 <B>exec</B> fails.
+<DT><DD>
If
<I>command</I>
and the return status is 0. If there is a redirection error, the
return status is 1.
<DT><B>exit</B> [<I>n</I>]<DD>
-Cause the shell to exit
-with a status of <I>n</I>. If
+Cause the shell to exit with a status of <I>n</I>.
+If
<I>n</I>
-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
<FONT SIZE=-1><B>EXIT</B>
</FONT>
is executed before the shell terminates.
-<DT><B>export</B> [<B>-fn</B>] [<I>name</I>[=<I>word</I>]] ...<DD>
+<DT><B>export</B> [<B>-fn</B>] [<I>name</I>[=<I>value</I>]] ...<DD>
<DT><B>export -p</B>
<I>names</I>
are marked for automatic export to the environment of
-subsequently executed commands. If the
+subsequently executed commands.
+If the
<B>-f</B>
option is given, the
<I>names</I>
refer to functions.
+<DT><DD>
+The
+<B>-n</B>
+
+option unexports, or removes the export attribute, from each <I>name</I>.
If no
<I>names</I>
are given, or if the
<B>-p</B>
-option is supplied, a list
-of names of all exported variables is printed.
-The
-<B>-n</B>
-
-option causes the export property to be removed from each
-<I>name</I>.
-If a variable name is followed by =<I>word</I>, the value of
-the variable is set to <I>word</I>.
+option is supplied, <B>export</B> prints a list of names of all exported
+variables on the standard output.
+<DT><DD>
+<B>export</B> allows the value of a variable to be set when it is exported
+or unexported by following the variable name with =<I>value</I>.
+This sets the value of the variable to <I>value</I> while modifying the
+export attribute.
<B>export</B>
returns an exit status of 0 unless an invalid option is
that is not a function.
<DT><B>false</B><DD>
-Does nothing, returns a non-zero status.
+Does nothing; returns a non-zero status.
<DT><B>fc</B> [<B>-e</B> <I>ename</I>] [<B>-lnr</B>] [<I>first</I>] [<I>last</I>]<DD>
<DT><B>fc</B> <B>-s</B> [<I>pat</I>=<I>rep</I>] [<I>cmd</I>]<DD>
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).
+<DT><DD>
When listing, a <I>first</I> or <I>last</I> of
0 is equivalent to -1 and -0 is equivalent to the current
command (usually the <B>fc</B> command); otherwise 0 is equivalent to -1
is not specified, it is set to the previous
command for editing and -16 for listing.
<DT><DD>
+If the
+<B>-l</B>
+
+option is supplied, the commands are listed on the standard output.
The
<B>-n</B>
option suppresses
-the command numbers when listing. The
+the command numbers when listing.
+The
<B>-r</B>
option reverses the order of
-the commands. If the
-<B>-l</B>
-
-option is given,
-the commands are listed on
-standard output. Otherwise, the editor given by
+the commands.
+<DT><DD>
+Otherwise, <B>fc</B> invokes the editor named by
<I>ename</I>
-is invoked
-on a file containing those commands. If
+on a file containing those commands.
+If
<I>ename</I>
-is not given, the
-value of the
+is not supplied, <B>fc</B> uses the value of the
<FONT SIZE=-1><B>FCEDIT</B>
</FONT>
-variable is used, and
+variable, and
the value of
<FONT SIZE=-1><B>EDITOR</B>
<FONT SIZE=-1><B>FCEDIT</B>
</FONT>
-is not set. If neither variable is set,
+is not set.
+If neither variable is set, <B>fc</B> uses
-<I>vi</I>
+<I>vi.</I>
-is used. When editing is complete, the edited commands are
-echoed and executed.
+When editing is complete, <B>fc</B> reads the file containing
+the edited commands and echoes and executes them.
<DT><DD>
-In the second form, <I>command</I> is re-executed after each instance
-of <I>pat</I> is replaced by <I>rep</I>.
+In the second form, <B>fc</B> re-executes <I>command</I>
+after replacing each instance of <I>pat</I> with <I>rep</I>.
<I>Command</I> is interpreted the same as <I>first</I> above.
-A useful alias to use with this is
+<DT><DD>
+A useful alias to use with <B>fc</B> is
so that typing
re-executes the last command.
<DT><DD>
-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</I>
<I>last</I>
specify history lines out of range.
-If the
-<B>-e</B>
-
-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</I>
-does not specify a valid history line, in which case
+does not specify a valid history entry, in which case
<B>fc</B>
-returns failure.
+returns a non-zero status.
<DT><B>fg</B> [<I>jobspec</I>]<DD>
Resume
<I>jobspec</I>
If
<I>jobspec</I>
-is not present, the shell's notion of the <I>current job</I> is used.
+is not present, use the shell's notion of the <I>current job</I>.
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
<DT><B>getopts</B> <I>optstring</I> <I>name</I> [<I>arg</I> ...]<DD>
<B>getopts</B>
-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</I>
contains the option characters to be recognized; if a character
argument, which should be separated from it by white space.
The colon and question mark characters may not be used as
option characters.
+<DT><DD>
Each time it is invoked,
<B>getopts</B>
</FONT>
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</B>
places that argument into the variable
<FONT SIZE=-1><B>OPTARG</B>.
</FONT>
+<DT><DD>
The shell does not reset
<FONT SIZE=-1><B>OPTIND</B>
calls to
<B>getopts</B>
-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.
<DT><DD>
-When the end of options is encountered, <B>getopts</B> exits with a
+When it reaches the end of options, <B>getopts</B> exits with a
return value greater than zero.
<FONT SIZE=-1><B>OPTIND</B>
<DT><DD>
<B>getopts</B>
-can report errors in two ways. If the first character of
+can report errors in two ways.
+If the first character of
<I>optstring</I>
-is a colon,
+is a colon, <B>getopts</B> uses
<I>silent</I>
-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, <B>getopts</B> prints diagnostic messages
+when it encounters invalid options or missing option arguments.
If the variable
<FONT SIZE=-1><B>OPTERR</B>
It returns false if the end of options is encountered or an
error occurs.
<DT><B>hash</B> [<B>-lr</B>] [<B>-p</B> <I>filename</I>] [<B>-dt</B>] [<I>name</I>]<DD>
-Each time <B>hash</B> is invoked,
+Each time <B>hash</B> is invoked, it remembers
the full pathname of the command
<I>name</I>
-is determined by searching
+as determined by searching
the directories in
-<B>$PATH</B>
+<B>$PATH</B>.
-and remembered. Any previously-remembered pathname is discarded.
+Any previously-remembered pathname associated with <I>name</I> is discarded.
If the
<B>-p</B>
option is supplied, <B>hash</B> uses
<I>filename</I>
-as the full filename of the command.
+as the full pathname of the command.
+<DT><DD>
The
<B>-r</B>
<B>-d</B>
option causes the shell to forget the remembered location of each <I>name</I>.
+<DT><DD>
If the
<B>-t</B>
-option is supplied, the full pathname to which each <I>name</I> corresponds
-is printed. If multiple <I>name</I> arguments are supplied with <B>-t</B>,
-the <I>name</I> is printed before the hashed full pathname.
+option is supplied, <B>hash</B> prints the full pathname corresponding to
+each <I>name</I>.
+If multiple <I>name</I> arguments are supplied with <B>-t</B>,
+<B>hash</B> prints the <I>name</I> before the corresponding hashed
+full pathname.
The
<B>-l</B>
-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.
+<DT><DD>
If no arguments are given, or if only <B>-l</B> is supplied,
-information about remembered commands is printed.
+<B>hash</B> prints information about remembered commands.
The <B>-t</B>, <B>-d</B>, and <B>-p</B> options (the options that
act on the <I>name</I> arguments) are mutually exclusive.
Only one will be active.
If more than one is supplied, <B>-t</B> has higher priority than
-<B>-p</B>, and both are higher priority than <B>-d</B>.
-The return status is true unless a
+<B>-p</B>, and both have higher priority than <B>-d</B>.
+<DT><DD>
+The return status is zero unless a
<I>name</I>
is not found or an invalid option is supplied.
<DT><B>help</B> [<B>-dms</B>] [<I>pattern</I>]<DD>
-Display helpful information about builtin commands. If
+Display helpful information about builtin commands.
+If
<I>pattern</I>
is specified,
gives detailed help on all commands matching
<I>pattern</I>;
-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.
<DL COMPACT><DT><DD>
<DL COMPACT>
<DT><B>history</B> <B>-p</B> <I>arg</I> [<I>arg</I> ...]<DD>
<DT><B>history</B> <B>-s</B> <I>arg</I> [<I>arg</I> ...]<DD>
-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>*</B>
-have been modified. An argument of
+have been modified.
+An argument of
<I>n</I>
lists only the last
<I>n</I>
-lines.
+entries.
If the shell variable
<FONT SIZE=-1><B>HISTTIMEFORMAT</B>
<I>strftime</I>(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 <I>filename</I> is supplied, it is used as the
-name of the history file; if not, the value of
-<FONT SIZE=-1><B>HISTFILE</B>
+If
+<B>history</B>
+
+uses
+<FONT SIZE=-1><B>HISTTIMEFORMAT</B>,
+
+</FONT>
+it does not print an intervening space between the formatted time stamp
+and the history entry.
+<DT><DD>
+If <I>filename</I> is supplied, <B>history</B> uses it as the
+name of the history file; if not, it uses the value of
+<FONT SIZE=-1><B>HISTFILE</B>.
</FONT>
-is used.
If <I>filename</I> is not supplied and
<FONT SIZE=-1><B>HISTFILE</B>
</FONT>
is unset or null, the <B>-a, -n, -r,</B> and <B>-w</B> options
have no effect.
+<DT><DD>
Options, if supplied, have the following meanings:
<DL COMPACT><DT><DD>
<DD>
Clear the history list by deleting all the entries.
+This can be used with the other options to replace the history list.
<DT><B>-d</B> <I>offset</I><DD>
Delete the history entry at position <I>offset</I>.
If <I>offset</I> is negative, it is interpreted as relative to one greater
<DD>
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 <B>bash</B> session.
<DT><B>-r</B>
<DD>
-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.
<DT><B>-w</B>
<DD>
<DD>
Perform history substitution on the following <I>args</I> 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 <I>arg</I> must be quoted to disable normal history expansion.
<DT><B>-s</B>
Store the
<I>args</I>
-in the history list as a single entry. The last command in the
-history list is removed before the
-<I>args</I>
+in the history list as a single entry.
+The last command in the
+history list is removed before adding the
+<I>args</I>.
-are added.
-</DL>
-<P>
+</DL></DL>
+<DT><DD>
If the
<FONT SIZE=-1><B>HISTTIMEFORMAT</B>
</FONT>
-variable is set, the time stamp information
-associated with each history entry is written to the history file,
+variable is set, <B>history</B> 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.
+<DT><DD>
The return value is 0 unless an invalid option is encountered, an
error occurs while reading or writing the history file, an invalid
<I>offset</I> or range is supplied as an argument to <B>-d</B>, or the
history expansion supplied as an argument to <B>-p</B> fails.
-</DL>
-
<DT><B>jobs</B> [<B>-lnprs</B>] [ <I>jobspec</I> ... ]<DD>
<DT><B>jobs</B> <B>-x</B> <I>command</I> [ <I>args</I> ... ]<DD>
-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:
<DL COMPACT><DT><DD>
<DL COMPACT>
<DT><B>-l</B>
<DD>
-List process IDs
-in addition to the normal information.
+List process IDs in addition to the normal information.
<DT><B>-n</B>
<DD>
<DT><B>-p</B>
<DD>
-List only the process ID of the job's process group
-leader.
+List only the process ID of the job's process group leader.
<DT><B>-r</B>
<DD>
<DD>
Display only stopped jobs.
-</DL>
-<P>
+</DL></DL>
+<DT><DD>
If
<I>jobspec</I>
-is given, output is restricted to information about that job.
+is supplied, <B>jobs</B> restricts output to information about that job.
The return status is 0 unless an invalid option is encountered
or an invalid
<I>jobspec</I>
is supplied.
-<P>
-
+<DT><DD>
If the
<B>-x</B>
<I>args</I>
with the corresponding process group ID, and executes
-<I>command</I>
+<I>command</I>,
passing it
<I>args</I>,
returning its exit status.
-</DL>
-
<DT><B>kill</B> [<B>-s</B> <I>sigspec</I> | <B>-n</B> <I>signum</I> | <B>-</B><I>sigspec</I>] [<I>pid</I> | <I>jobspec</I>] ...<DD>
<DT><B>kill</B> <B>-l</B>|<B>-L</B> [<I>sigspec</I> | <I>exit_status</I>]<DD>
-Send the signal named by
+Send the signal specified by
<I>sigspec</I>
or
If
<I>sigspec</I>
-is not present, then
-<FONT SIZE=-1><B>SIGTERM</B>
+is not supplied, then
+<B>kill</B>
+
+sends
+<FONT SIZE=-1><B>SIGTERM</B>.
</FONT>
-is assumed.
+<DT><DD>
An argument of
<B>-l</B>
If any arguments are supplied when
<B>-l</B>
-is given, the names of the signals corresponding to the arguments are
-listed, and the return status is 0.
+is given,
+<B>kill</B>
+
+lists the names of the signals corresponding to the arguments,
+and the return status is 0.
The <I>exit_status</I> argument to
<B>-l</B>
<B>-L</B>
option is equivalent to <B>-l</B>.
+<DT><DD>
<B>kill</B>
returns true if at least one signal was successfully sent, or false
Each
<I>arg</I>
-is an arithmetic expression to be evaluated (see
+is evaluated as an arithmetic expression (see
<FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
</FONT>
evaluates to 0,
<B>let</B>
-returns 1; 0 is returned otherwise.
+returns 1; otherwise
+<B>let</B>
+
+returns 0.
<DT><B>local</B> [<I>option</I>] [<I>name</I>[=<I>value</I>] ... | - ]<DD>
-For each argument, a local variable named
+For each argument, create a local variable named
<I>name</I>
-is created, and assigned
+and assign it
<I>value</I>.
The <I>option</I> can be any of the options accepted by <B>declare</B>.
<I>name</I>
to have a visible scope restricted to that function and its children.
-If <I>name</I> is -, the set of shell options is made local to the function
-in which <B>local</B> is invoked: shell options changed using the
-<B>set</B> builtin inside the function
-after the call to <B>local</B>
-are restored to their original values
-when the function returns.
-The restore is effected as if a series of <B>set</B> 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</B>
-writes a list of local variables to the standard output. It is
-an error to use
+when not within a function.
+<DT><DD>
+If <I>name</I> is -, it makes the set of shell options
+local to the function in which <B>local</B> is invoked:
+any shell options changed using the <B>set</B> builtin inside
+the function after the call to <B>local</B> are restored to their
+original values when the function returns.
+The restore is performed as if a series of <B>set</B> commands were
+executed to restore the values that were in place before the function.
+<DT><DD>
+With no operands,
<B>local</B>
-when not within a function. The return status is 0 unless
+writes a list of local variables to the standard output.
+<DT><DD>
+The return status is 0 unless
<B>local</B>
is used outside a function, an invalid
is supplied, or
<I>name</I> is a readonly variable.
-<DT><B>logout</B>
+<DT><B>logout [</B><I>n</I>]
<DD>
-Exit a login shell.
+Exit a login shell,
+returning a status of <I>n</I> to the shell's parent.
<DT><B>mapfile</B> [<B>-d</B> <I>delim</I>] [<B>-n</B> <I>count</I>] [<B>-O</B> <I>origin</I>] [<B>-s</B> <I>count</I>] [<B>-t</B>] [<B>-u</B> <I>fd</I>] [<B>-C</B> <I>callback</I>] [<B>-c</B> <I>quantum</I>] [<I>array</I>]<DD>
<DT><B>readarray</B> [<B>-d</B> <I>delim</I>] [<B>-n</B> <I>count</I>] [<B>-O</B> <I>origin</I>] [<B>-s</B> <I>count</I>] [<B>-t</B>] [<B>-u</B> <I>fd</I>] [<B>-C</B> <I>callback</I>] [<B>-c</B> <I>quantum</I>] [<I>array</I>]<DD>
-Read lines from the standard input into the indexed array variable
-<I>array</I>,
-
+Read lines from the standard input,
or from file descriptor
<I>fd</I>
if the
<B>-u</B>
-option is supplied.
+option is supplied,
+into the indexed array variable
+<I>array</I>.
+
The variable
<FONT SIZE=-1><B>MAPFILE</B>
<DT><B>-d</B>
<DD>
-The first character of <I>delim</I> is used to terminate each input line,
+Use the first character of <I>delim</I> to terminate each input line,
rather than newline.
If <I>delim</I> is the empty string, <B>mapfile</B> will terminate a line
when it reads a NUL character.
Copy at most
<I>count</I>
-lines. If <I>count</I> is 0, all lines are copied.
+lines.
+If <I>count</I> is 0, copy all lines.
<DT><B>-O</B>
<DD>
Evaluate
<I>callback</I>
-each time <I>quantum</I> lines are read. The <B>-c</B> option specifies
+each time <I>quantum</I> lines are read.
+The <B>-c</B> option specifies
<I>quantum</I>.
<DT><B>-c</B>
<I>callback</I>.
-</DL>
-<P>
+</DL></DL>
+<DT><DD>
If
<B>-C</B>
as additional arguments.
<I>callback</I> is evaluated after the line is read but before the
array element is assigned.
-<P>
-
+<DT><DD>
If not supplied with an explicit origin, <B>mapfile</B> will clear <I>array</I>
before assigning to it.
-<P>
-
-<B>mapfile</B> returns successfully unless an invalid option or option
+<DT><DD>
+<B>mapfile</B> returns zero unless an invalid option or option
argument is supplied, <I>array</I> is invalid or unassignable, or if
<I>array</I> is not an indexed array.
-</DL>
-
<DT><B>popd</B> [-<B>n</B>] [+<I>n</I>] [-<I>n</I>]<DD>
-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 <B>dirs</B>.
-With no arguments, <B>popd</B>
-removes the top directory from the stack, and
-changes to the new top directory.
+listed by <B>dirs</B>, so <B>popd</B> is equivalent to
+
+With no arguments, <B>popd</B> removes the top directory from the stack,
+and changes to the new top directory.
Arguments, if supplied, have the following meanings:
<DL COMPACT><DT><DD>
<DT><B>-n</B>
<DD>
-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.
<DT><B>+</B><I>n</I><DD>
-Removes the <I>n</I>th entry counting from the left of the list
+Remove the <I>n</I>th entry counting from the left of the list
shown by
<B>dirs</B>,
the second.
<DT><B>-</B><I>n</I><DD>
-Removes the <I>n</I>th entry counting from the right of the list
+Remove the <I>n</I>th entry counting from the right of the list
shown by
<B>dirs</B>,
the next to last.
-</DL>
-<P>
+</DL></DL>
+<DT><DD>
If the top element of the directory stack is modified, and
the <I>-n</I> option was not supplied, <B>popd</B> uses the <B>cd</B>
builtin to change to the directory at the top of the stack.
If the <B>cd</B> fails, <B>popd</B> returns a non-zero value.
-<P>
-
+<DT><DD>
Otherwise,
<B>popd</B>
-returns false if an invalid option is encountered, the directory stack
-is empty, or a non-existent directory stack entry is specified.
-<P>
-
+returns false if an invalid option is supplied, the directory stack
+is empty, or <I>n</I> specifies a non-existent directory stack entry.
+<DT><DD>
If the
<B>popd</B>
command is successful,
-bash runs
+<B>bash</B> runs
<B>dirs</B>
to show the final contents of the directory stack,
and the return status is 0.
-</DL>
-
<DT><B>printf</B> [<B>-v</B> <I>var</I>] <I>format</I> [<I>arguments</I>]<DD>
Write the formatted <I>arguments</I> to the standard output under the
control of the <I>format</I>.
-The <B>-v</B> option causes the output to be assigned to the variable
-<I>var</I> rather than being printed to the standard output.
+The <B>-v</B> option assigns the output to the variable
+<I>var</I> rather than printing it to the standard output.
<DT><DD>
The <I>format</I> is a character string which contains three types of objects:
plain characters, which are simply copied to standard output, character
<I>printf</I>(3)
format characters
-<B>csndiouxXeEfFgGaA</B>,
+<B>cCsSndiouxXeEfFgGaA</B>,
<B>printf</B> interprets the following additional format specifiers:
<DL COMPACT><DT><DD>
The corresponding <I>argument</I> 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 <B>printf</B> behavior.
-</DL>
-<P>
+</DL></DL>
+<DT><DD>
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.
-<P>
-
+<DT><DD>
The %n format specifier accepts a corresponding argument that is treated
as a shell variable name.
-<P>
-
+<DT><DD>
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.
-<P>
-
+<DT><DD>
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.
-<P>
-
+<DT><DD>
The <I>format</I> is reused as necessary to consume all of the <I>arguments</I>.
If the <I>format</I> requires more <I>arguments</I> than are supplied, the
extra format specifications behave as if a zero value or null string, as
The return value is zero on success,
non-zero if an invalid option is supplied or a write or assignment error
occurs.
-</DL>
-
<DT><B>pushd</B> [<B>-n</B>] [+<I>n</I>] [-<I>n</I>]<DD>
<DT><B>pushd</B> [<B>-n</B>] [<I>dir</I>]<DD>
-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, <B>pushd</B> exchanges the top two elements of
<DT><B>-n</B>
<DD>
-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.
<DT><B>+</B><I>n</I><DD>
-Rotates the stack so that the <I>n</I>th directory
+Rotate the stack so that the <I>n</I>th directory
(counting from the left of the list shown by
<B>dirs</B>,
Adds
<I>dir</I>
-to the directory stack at the top
+to the directory stack at the top.
-</DL>
-<P>
+</DL></DL>
+<DT><DD>
After the stack has been modified, if the <B>-n</B> option was not
supplied, <B>pushd</B> uses the <B>cd</B> builtin to change to the
directory at the top of the stack.
If the <B>cd</B> fails, <B>pushd</B> returns a non-zero value.
-<P>
-
+<DT><DD>
Otherwise, if no arguments are supplied,
<B>pushd</B>
-returns 0 unless the directory stack is empty.
+returns zero unless the directory stack is empty.
When rotating the directory stack,
<B>pushd</B>
-returns 0 unless the directory stack is empty or
-a non-existent directory stack element is specified.
-<P>
-
+returns zero unless the directory stack is empty or
+<I>n</I> specifies a non-existent directory stack element.
+<DT><DD>
If the
<B>pushd</B>
command is successful,
-bash runs
+<B>bash</B> runs
<B>dirs</B>
to show the final contents of the directory stack.
-</DL>
-
<DT><B>pwd</B> [<B>-LP</B>]<DD>
Print the absolute pathname of the current working directory.
The pathname printed contains no symbolic links if the
reading the name of the current directory or an
invalid option is supplied.
<DT><B>read</B> [<B>-Eers</B>] [<B>-a</B> <I>aname</I>] [<B>-d</B> <I>delim</I>] [<B>-i</B> <I>text</I>] [<B>-n</B> <I>nchars</I>] [<B>-N</B> <I>nchars</I>] [<B>-p</B> <I>prompt</I>] [<B>-t</B> <I>timeout</I>] [<B>-u</B> <I>fd</I>] [<I>name</I> ...]<DD>
-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
<I>fd</I> supplied as an argument to the <B>-u</B> option,
-split into words as described
+split it into words as described
above
under <B>Word Splitting</B>,
-and the first word
-is assigned to the first
+and assign the first word to the first
<I>name</I>,
the second word to the second
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
<FONT SIZE=-1><B>IFS</B>
</FONT>
+variable
are used to split the line into words using the same rules the shell
uses for expansion (described
above
under <B>Word Splitting</B>).
-The backslash character (<B>\</B>) may be used to remove any special
-meaning for the next character read and for line continuation.
+The backslash character (<B>\</B>) removes any special
+meaning for the next character read and is used for line continuation.
+<DT><DD>
Options, if supplied, have the following meanings:
<DL COMPACT><DT><DD>
<DT><B>-a </B><I>aname</I>
<DD>
-The words are assigned to sequential indices
-of the array variable
+The words are assigned to sequential indices of the array variable
<I>aname</I>,
starting at 0.
<DT><B>-d </B><I>delim</I>
<DD>
-The first character of <I>delim</I> is used to terminate the input line,
+The first character of <I>delim</I> terminates the input line,
rather than newline.
If <I>delim</I> is the empty string, <B>read</B> will terminate a line
when it reads a NUL character.
<DT><B>-e</B>
<DD>
-If the standard input
-is coming from a terminal,
+If the standard input is coming from a terminal,
<B>read</B> uses
<B>readline</B>
<DT><B>-E</B>
<DD>
-If the standard input
-is coming from a terminal,
+If the standard input is coming from a terminal,
<B>read</B> uses
<B>readline</B>
If
<B>readline</B>
-is being used to read the line, <I>text</I> is placed into the editing
-buffer before editing begins.
+is being used to read the line, <B>read</B> places <I>text</I> into
+the editing buffer before editing begins.
<DT><B>-n </B><I>nchars</I>
<DD>
<B>read</B> returns after reading <I>nchars</I> characters rather than
-waiting for a complete line of input, but honors a delimiter if fewer
-than <I>nchars</I> characters are read before the delimiter.
+waiting for a complete line of input,
+unless it encounters EOF or <B>read</B> times out,
+but honors a delimiter if it reads fewer
+than <I>nchars</I> characters before the delimiter.
<DT><B>-N </B><I>nchars</I>
<DD>
<B>read</B> returns after reading exactly <I>nchars</I> characters rather
-than waiting for a complete line of input, unless EOF is encountered or
-<B>read</B> times out.
-Delimiter characters encountered in the input are
+than waiting for a complete line of input,
+unless it encounters EOF or <B>read</B> times out.
+Any delimiter characters in the input are
not treated specially and do not cause <B>read</B> to return until
-<I>nchars</I> characters are read.
+it has read <I>nchars</I> characters.
The result is not split on the characters in <B>IFS</B>; the intent is
that the variable is assigned exactly the characters read
(with the exception of backslash; see the <B>-r</B> option below).
<DD>
Display <I>prompt</I> 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.
<DT><B>-r</B>
<DD>
<DT><B>-s</B>
<DD>
-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.
<DT><B>-t </B><I>timeout</I>
<DD>
-Cause <B>read</B> to time out and return failure if a complete line of
-input (or a specified number of characters)
-is not read within <I>timeout</I> seconds.
+Cause <B>read</B> to time out and return failure if it does not read
+a complete line of input (or a specified number of characters)
+within <I>timeout</I> seconds.
<I>timeout</I> may be a decimal number with a fractional portion following
the decimal point.
This option is only effective if <B>read</B> is reading input from a
terminal, pipe, or other special file; it has no effect when reading
from regular files.
-If <B>read</B> times out, <B>read</B> saves any partial input read into
-the specified variable <I>name</I>.
+If <B>read</B> times out, it saves any partial input read into
+the specified variable <I>name</I>, and the exit status is greater than 128.
If <I>timeout</I> is 0, <B>read</B> 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.
<DT><B>-u </B><I>fd</I>
<DD>
-Read input from file descriptor <I>fd</I>.
+Read input from file descriptor <I>fd</I> instead of the standard input.
-</DL>
-<P>
+</DL></DL>
+<DT><DD>
Other than the case where <I>delim</I> is the empty string, <B>read</B>
ignores any NUL characters in the input.
-<P>
-
+<DT><DD>
If no
<I>names</I>
-are supplied, the line read,
+are supplied, <B>read</B> assigns the line read,
without the ending delimiter but otherwise unmodified,
-is assigned to the variable
+to the variable
<FONT SIZE=-1><B>REPLY</B>.
</FONT>
+<DT><DD>
The exit status is zero, unless end-of-file is encountered, <B>read</B>
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 <B>-u</B>.
-</DL>
-
<DT><B>readonly</B> [<B>-aAf</B>] [<B>-p</B>] [<I>name</I>[=<I>word</I>] ...]<DD>
The given
<I>names</I> are marked readonly; the values of these
<I>names</I>
-may not be changed by subsequent assignment.
+may not be changed by subsequent assignment or unset.
If the
<B>-f</B>
-option is supplied, the functions corresponding to the
-<I>names</I> are so
-marked.
+option is supplied, each <I>name</I> refers to a shell function.
The
<B>-a</B>
If no
<I>name</I>
-arguments are given, or if the
+arguments are supplied, or if the
<B>-p</B>
-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</B>
-option causes output to be displayed in a format that
-may be reused as input.
-If a variable name is followed by =<I>word</I>, the value of
-the variable is set to <I>word</I>.
+option displays output in a format that may be reused as input.
+<DT><DD>
+<B>readonly</B> allows the value of a variable to be set at the same time
+the readonly attribute is changed by following the variable name with
+=<I>value</I>.
+This sets the value of the variable is to <I>value</I> while modifying
+the readonly attribute.
+<DT><DD>
The return status is 0 unless an invalid option is encountered,
one of the
<I>names</I>
that is not a function.
<DT><B>return</B> [<I>n</I>]<DD>
-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</I>
to its caller.
<I>n</I>
is omitted, the return status is that of the last command
-executed in the function body.
+executed.
If <B>return</B> is executed by a trap handler, the last command used to
determine the status is the last command executed before the trap handler.
If <B>return</B> is executed during a <B>DEBUG</B> trap, the last command
used to determine the status is the last command executed by the trap
handler before <B>return</B> was invoked.
-If
+<DT><DD>
+When
<B>return</B>
-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>.</B>
(<B>source</B>) command, it causes the shell to stop executing
script as the exit status of the script.
If <I>n</I> is supplied, the return value is its least significant
8 bits.
+<DT><DD>
+Any command associated with the <B>RETURN</B> trap is executed
+before execution resumes after the function or script.
+<DT><DD>
The return status is non-zero if
<B>return</B>
-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 <B>.</B> or <B>source</B>.
-Any command associated with the <B>RETURN</B> trap is executed
-before execution resumes after the function or script.
<DT><B>set</B> [<B>-abefhkmnptuvxBCEHPT</B>] [<B>-o</B> <I>option-name</I>] [<B>--</B>] [<B>-</B>] [<I>arg</I> ...]<DD>
<DT><B>set</B> [<B>+abefhkmnptuvxBCEHPT</B>] [<B>+o</B> <I>option-name</I>] [<B>--</B>] [<B>-</B>] [<I>arg</I> ...]<DD>
<DD>
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.
<DT><B>-e</B>
<DD>
<DT><B>-m</B>
<DD>
-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
<FONT SIZE=-1><B>JOB CONTROL</B>
</FONT>
Turn on
<I>privileged</I>
-mode. In this mode, the
+mode. In this mode, the shell does not read the
<FONT SIZE=-1><B>$ENV</B>
</FONT>
<FONT SIZE=-1><B>$BASH_ENV</B>
</FONT>
-files are not processed, shell functions are not inherited from the
+files, shell functions are not inherited from the
environment, and the
<FONT SIZE=-1><B>SHELLOPTS</B>,
</FONT>
followed by the command and its expanded arguments
-or associated word list, to standard error.
+or associated word list, to the standard error.
<DT><B>-B</B>
<DD>
and
<B><></B>
-redirection operators. This may be overridden when
-creating output files by using the redirection operator
+redirection operators.
+Using the redirection operator
<B>>|</B>
instead of
-<B>></B>.
+<B>></B>
+will override this and force the creation of an output file.
<DT><B>-E</B>
<DD>
Enable
<B>!</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.
<DT><B>-P</B>
<DD>
commands such as
<B>cd</B>
-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</B>
follows the logical chain of directories when performing commands
<DT><B>--</B>
<DD>
-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
<I>arg</I>s, even if some of them begin with a
<B>-</B>.
<DT><B>-</B>
<DD>
-Signal the end of options, cause all remaining <I>arg</I>s to be
-assigned to the positional parameters. The
+Signal the end of options, and assign all remaining <I>arg</I>s to
+the positional parameters.
+The
<B>-x</B>
and
<B>-v</B>
options are turned off.
-If there are no <I>arg</I>s,
-the positional parameters remain unchanged.
+If there are no <I>arg</I>s, the positional parameters remain unchanged.
</DL>
<P>
The current set of options may be found in
<B>$-</B>.
-The return status is always true unless an invalid option is encountered.
+The return status is always zero unless an invalid option is encountered.
</DL>
<DT><B>shift</B> [<I>n</I>]<DD>
-The positional parameters from <I>n</I>+1 ... are renamed to
+Rename positional parameters from <I>n</I>+1 ... to
<B>$1</B>
<B>....</B>
With no options, or with the
<B>-p</B>
-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 <I>optnames</I> are supplied, the output is restricted to those options.
-The <B>-p</B> option causes output to be displayed in a form that
+if any <I>optnames</I> are supplied, the output is restricted to those options.
+The <B>-p</B> option displays output in a form that
may be reused as input.
Other options have the following meanings:
<DL COMPACT><DT><DD>
<DD>
Suppresses normal output (quiet mode); the return status indicates
whether the <I>optname</I> is set or unset.
-If multiple <I>optname</I> arguments are given with
+If multiple <I>optname</I> arguments are supplied with
<B>-q</B>,
the return status is zero if all <I>optnames</I> are enabled; non-zero
<DT><B>cdspell</B>
<DD>
-If set, minor errors in the spelling of a directory component in a
+If set, the
<B>cd</B>
-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 <B>cd</B> corrects the directory name, it prints the corrected filename,
and the command proceeds.
This option is only used by interactive shells.
<DT><B>checkhash</B>
<DD>
If set, <B>bash</B> 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, <B>bash</B> performs a normal path search.
<DT><B>checkjobs</B>
<DD>
If set, <B>bash</B> 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, <B>bash</B> defers the exit until a second
+exit is attempted without an intervening command (see
<FONT SIZE=-1><B>JOB CONTROL</B>
</FONT>
<DD>
If set, <B>bash</B> 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
<FONT SIZE=-1><B>LINES</B>
</FONT>
and
-<FONT SIZE=-1><B>COLUMNS</B>.
+<FONT SIZE=-1><B>COLUMNS</B>,
</FONT>
+using the file descriptor associated with the standard error
+if it is a terminal.
This option is enabled by default.
<DT><B>cmdhist</B>
<B>bash</B>
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
<B>bash</B>
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</B>
it cannot execute the file specified as an argument to the
<B>exec</B>
-builtin command. An interactive shell does not exit if
+builtin.
+An interactive shell does not exit if
<B>exec</B>
fails.
<DT><B>extdebug</B>
<DD>
-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 <B>--debugger</B> option.
If set after invocation, behavior intended for use by debuggers is enabled:
<DT><B>extglob</B>
<DD>
-If set, the extended pattern matching features described
+If set, enable the extended pattern matching features described
above
under
-<B>Pathname Expansion</B> are enabled.
+<B>Pathname Expansion</B>.
<DT><B>extquote</B>
<DD>
<I>string</I>"
quoting is
performed within <B>${</B><I>parameter</I><B>}</B> expansions
-enclosed in double quotes. This option is enabled by default.
+enclosed in double quotes.
+This option is enabled by default.
<DT><B>failglob</B>
<DD>
</FONT>
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</B>
will not collate between
If set, and
<B>readline</B>
-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.
<DT><B>histverify</B>
<B>readline</B>
is being used, the results of history substitution are not immediately
-passed to the shell parser. Instead, the resulting line is loaded into
-the <B>readline</B> editing buffer, allowing further modification.
+passed to the shell parser.
+Instead, the resulting line is loaded into the <B>readline</B> editing buffer,
+allowing further modification.
<DT><B>hostcomplete</B>
<DD>
<DT><B>interactive_comments</B>
<DD>
-If set, allow a word beginning with
-<B>#</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 <B>#</B>
+causes that word and all remaining characters on that
+line to be ignored, as in a non-interactive shell
+(see
<FONT SIZE=-1><B>COMMENTS</B>
</FONT>
<DD>
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.
<DT><B>localvar_unset</B>
<DD>
If set, calling <B>unset</B> 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.
<DT><B>login_shell</B>
<DD>
is being used,
<B>bash</B>
-will not attempt to search the
+does not search
<FONT SIZE=-1><B>PATH</B>
</FONT>
-for possible completions when
-completion is attempted on an empty line.
+for possible completions when completion is attempted on an empty line.
<DT><B>nocaseglob</B>
<DD>
above)
-expand to nothing and are removed,
-rather than expanding to themselves.
+expand to nothing and are removed, rather than expanding to themselves.
<DT><B>patsub_replacement</B>
<DD>
<DT><B>progcomp</B>
<DD>
-If set, the programmable completion facilities (see
+If set, enable the programmable completion facilities (see
<B>Programmable Completion</B>
-above)
-are enabled.
+above).
This option is enabled by default.
<DT><B>progcomp_alias</B>
<DD>
If set, and programmable completion is enabled, <B>bash</B> treats a command
name that doesn't have any completions as a possible alias and attempts
-alias expansion. If it has an alias, <B>bash</B> attempts programmable
+alias expansion.
+If it has an alias, <B>bash</B> attempts programmable
completion using the command word resulting from the expanded alias.
<DT><B>promptvars</B>
<FONT SIZE=-1><B>SIGCONT</B>
</FONT>
-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</B>
-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
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.
+<B>test</B> uses operator precedence when there are five or more arguments.
<DL COMPACT><DT><DD>
<DL COMPACT>
<DD>
Returns the value of <I>expr</I>.
-This may be used to override the normal precedence of operators.
+This may be used to override normal operator precedence.
<DT><I>expr1</I> -<B>a</B> <I>expr2</I><DD>
True if both
<I>expr1</I>
The following conditions are applied in the order listed.
If the first argument is <B>!</B>, 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 <B>(</B> and the fourth argument is
exactly <B>)</B>, the result is the two-argument test of the second
and third arguments.
current locale.
If the shell is not in <I>posix mode</I>, the <B>test</B> and <B>[</B>
commands sort lexicographically using ASCII ordering.
-</DL>
+<DL COMPACT>
+<DT><DD>
+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 <B>-a</B> and <B>-o</B>
+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 <B>-a</B> and <B>-o</B> with the shell's
+<B>&&</B> and <B>||</B> list operators.
+</DL></DL>
<DT><B>times</B>
<DD>
Print the accumulated user and system times for the shell and
-for processes run from the shell. The return status is 0.
-<DT><B>trap</B> [<B>-lp</B>] [[<I>action</I>] <I>sigspec</I> ...]<DD>
+for processes run from the shell.
+The return status is 0.
+<DT><B>trap</B> [<B>-Plp</B>] [[<I>action</I>] <I>sigspec</I> ...]<DD>
The
<I>action</I>
is a command that is read and executed when the shell receives
-signal(s)
+any of the signals
<I>sigspec</I>.
If
is absent (and there is a single <I>sigspec</I>) or
<B>-</B>,
-each specified signal is
-reset to its original disposition (the value it had
-upon entrance to the shell).
+each specified <I>sigspec</I> is
+reset to the value it had when the shell was started.
If
<I>action</I>
<B>-P</B>
requires at least one <I>sigspec</I> argument.
-The <B>-P</B> or <B>-p</B> options to <B>trap</B> may be used
+The <B>-P</B> or <B>-p</B> options may be used
in a subshell environment (e.g., command substitution) and, as
long as they are used before <B>trap</B> is used to change a signal's
handling, will display the state of its parent's traps.
The
<B>-l</B>
-option causes <B>trap</B> to print a list of signal names and
+option prints a list of signal names and
their corresponding numbers.
Each
<I>sigspec</I>
</FONT>
prefix is optional.
+If <B>-l</B> is supplied with no <I>sigspec</I> arguments, it prints a
+list of valid signal names.
<DT><DD>
If a
<I>sigspec</I>
<FONT SIZE=-1><B>EXIT</B>
</FONT>
-(0) the command
+(0),
<I>action</I>
is executed on exit from the shell.
<FONT SIZE=-1><B>DEBUG</B>,
</FONT>
-the command
<I>action</I>
is executed before every <I>simple command</I>, <I>for</I> command,
</FONT>
above).
-Refer to the description of the <B>extdebug</B> option to the
-<B>shopt</B> builtin for details of its effect on the <B>DEBUG</B> trap.
+Refer to the description of the <B>extdebug</B> shell option
+(see
+<B>shopt</B>
+
+
+above)
+for details of its effect on the <B>DEBUG</B> trap.
If a
<I>sigspec</I>
<FONT SIZE=-1><B>RETURN</B>,
</FONT>
-the command
<I>action</I>
is executed each time a shell function or a script executed with
<FONT SIZE=-1><B>ERR</B>,
</FONT>
-the command
<I>action</I>
is executed whenever
<B>||</B>
list except the command following the final <B>&&</B> or <B>||</B>,
-any command in a pipeline but the last,
+any command in a pipeline but the last
+(subject to the state of the <B>pipefail</B> shell option),
or if the command's return value is
being inverted using
<B>!</B>.
<DT><B>true</B><DD>
Does nothing, returns a 0 status.
<DT><B>type</B> [<B>-aftpP</B>] <I>name</I> [<I>name</I> ...]<DD>
-With no options,
-indicate how each
+Indicate how each
<I>name</I>
would be interpreted if used as a command name.
+<DT><DD>
If the
<B>-t</B>
if
<I>name</I>
-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</I>
-is not found, then nothing is printed, and <B>type</B> returns a
-non-zero exit status.
+is not found, <B>type</B> prints nothing and returns a non-zero exit status.
+<DT><DD>
If the
<B>-p</B>
option is used,
<B>type</B>
-either returns the name of the executable file
+either returns the pathname of the executable file
that would be found by searching
<B>$PATH</B>
-if
+for
<I>name</I>
-were specified as a command name,
or nothing if
would not return
would not return
<I>file</I>.
-If a command is hashed,
+If <I>name</I> is present in the table of hashed commands,
<B>-p</B>
and
<FONT SIZE=-1><B>PATH</B>.
</FONT>
+<DT><DD>
If the
<B>-a</B>
</FONT>
search for <I>name</I>.
+<DT><DD>
The
<B>-f</B>
<DT><B>ulimit</B> [<B>-HS</B>] [<B>-bcdefiklmnpqrstuvxPRT</B> [<I>limit</I>]]<DD>
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.
+<DT><DD>
The <B>-H</B> and <B>-S</B> 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 <B>-H</B> nor <B>-S</B> is specified, both the soft and hard
-limits are set.
+If neither <B>-H</B> nor <B>-S</B> is specified,
+<B>ulimit</B> sets both the soft and hard limits.
+<DT><DD>
The value of
<I>limit</I>
If
<I>limit</I>
-is omitted, the current value of the soft limit of the resource is
-printed, unless the <B>-H</B> option is given. When more than one
-resource is specified, the limit name and unit, if appropriate,
-are printed before the value.
+is omitted, <B>ulimit</B> prints the current value of the soft limit of
+the resource, unless the <B>-H</B> 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:
<DL COMPACT><DT><DD>
<DT><B>-a</B>
<DD>
-All current limits are reported; no limits are set
+Report all current limits; no limits are set
<DT><B>-b</B>
<DD>
If
<I>limit</I>
-is given, and the
+is supplied, and the
<B>-a</B>
option is not used,
<I>limit</I> is the new value of the specified resource.
-If no option is given, then
+If no option is supplied, then
<B>-f</B>
-is assumed. Values are in 1024-byte increments, except for
+is assumed.
+<P>
+
+Values are in 1024-byte increments, except for
<B>-t</B>,
which is in seconds;
</DL>
<DT><B>umask</B> [<B>-p</B>] [<B>-S</B>] [<I>mode</I>]<DD>
-The user file-creation mask is set to
+Set the user file-creation mask to
<I>mode</I>.
If
<I>mode</I>
-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
<I>chmod</I>(1).
If
<I>mode</I>
-is omitted, the current value of the mask is printed.
+is omitted, <B>umask</B> prints the current value of the mask.
The
<B>-S</B>
-option causes the mask to be printed in symbolic form; the
-default output is an octal number.
+option without a <I>mode</I> argument
+prints the mask in a symbolic format;
+the default output is an octal number.
If the
<B>-p</B>
<I>mode</I>
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 <I>mode</I> argument was supplied, and false otherwise.
+The return status is zero if the mode was successfully changed or
+if no <I>mode</I> argument was supplied, and non-zero otherwise.
<DT><B>unalias</B> [-<B>a</B>] [<I>name</I> ...]<DD>
-Remove each <I>name</I> from the list of defined aliases. If
+Remove each <I>name</I> from the list of defined aliases.
+If
<B>-a</B>
-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</I>
is not a defined alias.
<I>name</I>
refers to a shell variable, and that variable is removed.
-Read-only variables may not be unset.
If
<B>-f</B>
attribute, <I>name</I> will be unset rather than the variable it
references.
<B>-n</B> has no effect if the <B>-f</B> 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 <I>name</I> 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
<FONT SIZE=-1><B>BASH_ALIASES</B>,
</FONT>
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</I>
is readonly or may not be unset.
Wait for each specified child process <I>id</I> and return the
termination status of the last <I>id</I>.
Each <I>id</I> may be a process ID or a job specification;
-if a job spec is given, <B>wait</B> waits for all processes in the job.
+if a job spec is supplied, <B>wait</B> waits for all processes in the job.
<DT><DD>
If no options or <I>id</I>s are supplied,
<B>wait</B> waits for all running background jobs and
If the <B>-p</B> option is supplied, the process or job identifier
of the job for which the exit status is returned is assigned to the
variable <I>varname</I> 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 <B>-n</B> option is supplied.
<DT><DD>
Supplying the <B>-f</B> option, when job control is enabled,
above.
Otherwise, the return status is the exit status of the last <I>id</I>.
</DL>
-<A NAME="lbDC"> </A>
+<A NAME="lbDD"> </A>
<H3>SHELL COMPATIBILITY MODE</H3>
Bash-4.0 introduced the concept of a <I>shell compatibility level</I>,
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.
<P>
This section does not mention behavior that is standard for a particular
-version (e.g., setting <B>compat32</B> means that quoting the rhs of the regexp
+version (e.g., setting <B>compat32</B> 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).
<P>
compatibility level.
<P>
-Starting with bash-4.4, <B>bash</B> has begun deprecating older compatibility
+Starting with bash-4.4, <B>bash</B> began deprecating older compatibility
levels.
Eventually, the options will be removed in favor of
<FONT SIZE=-1><B>BASH_COMPAT</B>.
</FONT>
<P>
-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
-<FONT SIZE=-1><B>BASH_COMPAT</B>.
+Bash-5.0 was the final version for which there was an individual shopt
+option for the previous version.
+<FONT SIZE=-1><B>BASH_COMPAT</B>
</FONT>
+is the only mechanism to control the compatibility level
+in versions newer than bash-5.0.
<P>
The following table describes the behavior changes controlled by each
<DL COMPACT><DT><DD>
<DL COMPACT>
<DT>*<DD>
-quoting the rhs of the <B>[[</B> command's regexp matching operator (=~)
-has no special effect
+Quoting the rhs of the <B>[[</B> command's regexp matching operator (=~)
+has no special effect.
</DL></DL>
<DL COMPACT><DT><DD>
<DL COMPACT>
<DT>*<DD>
-the <B><</B> and <B>></B> operators to the <B>[[</B> command do not
+The <B><</B> and <B>></B> operators to the <B>[[</B> command do not
consider the current locale when comparing strings; they use ASCII
ordering.
</DL></DL>
<DL COMPACT><DT><DD>
<DL COMPACT>
<DT>*<DD>
-the <B><</B> and <B>></B> operators to the <B>[[</B> command do not
+The <B><</B> and <B>></B> operators to the <B>[[</B> command do not
consider the current locale when comparing strings; they use ASCII
ordering.
<B>Bash</B> versions prior to bash-4.1 use ASCII collation and
<DL COMPACT><DT><DD>
<DL COMPACT>
<DT>*<DD>
-in <I>posix</I> mode, <B>time</B> may be followed by options and still be
-recognized as a reserved word (this is POSIX interpretation 267)
+In <I>posix</I> mode, <B>time</B> may be followed by options and still be
+recognized as a reserved word (this is POSIX interpretation 267).
<DT>*<DD>
-in <I>posix</I> mode, the parser requires that an even number of single
+In <I>posix</I> mode, the parser requires that an even number of single
quotes occur in the <I>word</I> 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).
</DL></DL>
<DL COMPACT><DT><DD>
<DL COMPACT>
<DT>*<DD>
-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.
<DT>*<DD>
-in posix mode, single quotes are considered special when expanding
+In posix mode, single quotes are considered special when expanding
the <I>word</I> 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.
</DL></DL>
<DL COMPACT><DT><DD>
<DL COMPACT>
<DT>*<DD>
-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).
<DT>*<DD>
-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 <B>break</B> or <B>continue</B> 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.
</DL></DL>
<DL COMPACT><DT><DD>
<DL COMPACT>
<DT>*<DD>
-the shell sets up the values used by
+The shell sets up the values used by
<FONT SIZE=-1><B>BASH_ARGV</B>
</FONT>
</FONT>
so they can expand to the shell's positional parameters even if extended
-debugging mode is not enabled
+debugging mode is not enabled.
<DT>*<DD>
-a subshell inherits loops from its parent context, so <B>break</B>
+A subshell inherits loops from its parent context, so <B>break</B>
or <B>continue</B> will cause the subshell to exit.
Bash-5.0 and later reset the loop state to prevent the exit
<DT>*<DD>
-variable assignments preceding builtins like <B>export</B> and <B>readonly</B>
+Variable assignments preceding builtins like <B>export</B> and <B>readonly</B>
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.
</DL></DL>
<FONT SIZE=-1><B>$RANDOM</B>
</FONT>
-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
<FONT SIZE=-1><B>RANDOM</B>
</FONT>
-will produce the same sequence as in bash-5.0
+will produce the same sequence as in bash-5.0.
<DT>*<DD>
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 <B>-l</B> option is supplied.
</DL></DL>
and <B>*</B> differently depending on whether the array is indexed or
associative, and differently than in previous versions.
<DT>*<DD>
-arithmetic commands (
+Arithmetic commands (
<B>((</B>...<B>))</B>
) and the expressions in an arithmetic for
-statement can be expanded more than once
+statement can be expanded more than once.
<DT>*<DD>
-expressions used as arguments to arithmetic operators in the <B>[[</B>
-conditional command can be expanded more than once
+Expressions used as arguments to arithmetic operators in the <B>[[</B>
+conditional command can be expanded more than once.
<DT>*<DD>
-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.
<DT>*<DD>
-the expressions in the
+The expressions in the
<B>$((</B>...<B>))</B>
-word expansion can be expanded more than once
+word expansion can be expanded more than once.
<DT>*<DD>
-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.
<DT>*<DD>
<B>test -v</B>, when given an argument of <B>A[@]</B>, where <B>A</B> 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 <B>@</B>.
<DT>*<DD>
-the ${<I>parameter</I><B>[:]=</B><I>value</I>} word expansion will return
+The ${<I>parameter</I><B>[:]=</B><I>value</I>} word expansion will return
<I>value</I>, 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.
</DL>
-<A NAME="lbDD"> </A>
+<A NAME="lbDE"> </A>
<H3>RESTRICTED SHELL</H3>
or the
<B>-r</B>
-option is supplied at invocation,
-the shell becomes restricted.
+option is supplied at invocation, the shell becomes <I>restricted</I>.
A restricted shell is used to
set up an environment more controlled than the standard shell.
It behaves identically to
with the exception that the following are disallowed or not performed:
<DL COMPACT>
<DT>*<DD>
-changing directories with <B>cd</B>
+Changing directories with <B>cd</B>.
<DT>*<DD>
-setting or unsetting the values of
+Setting or unsetting the values of
<FONT SIZE=-1><B>SHELL</B>,
</FONT>
</FONT>
or
-<FONT SIZE=-1><B>BASH_ENV</B>
+<FONT SIZE=-1><B>BASH_ENV</B>.
</FONT>
<DT>*<DD>
-specifying command names containing
-<B>/</B>
+Specifying command names containing
+<B>/</B>.
<DT>*<DD>
-specifying a filename containing a
+Specifying a filename containing a
<B>/</B>
as an argument to the
<B>.</B>
-builtin command
+builtin command.
<DT>*<DD>
-specifying a filename containing a slash as an argument to the
+Using the <B>-p</B> option to the
+<B>.</B>
+
+builtin command to specify a search path.
+<DT>*<DD>
+Specifying a filename containing a slash as an argument to the
<B>history</B>
-builtin command
+builtin command.
<DT>*<DD>
-specifying a filename containing a slash as an argument to the
+Specifying a filename containing a slash as an argument to the
<B>-p</B>
option to the
<B>hash</B>
-builtin command
+builtin command.
<DT>*<DD>
-importing function definitions from the shell environment at startup
+Importing function definitions from the shell environment at startup.
<DT>*<DD>
-parsing the value of
+Parsing the value of
<FONT SIZE=-1><B>SHELLOPTS</B>
</FONT>
-from the shell environment at startup
+from the shell environment at startup.
<DT>*<DD>
-redirecting output using the >, >|, <>, >&, &>, and >> redirection operators
+Redirecting output using the >, >|, <>, >&, &>, and >> redirection operators.
<DT>*<DD>
-using the
+Using the
<B>exec</B>
-builtin command to replace the shell with another command
+builtin command to replace the shell with another command.
<DT>*<DD>
-adding or deleting builtin commands with the
+Adding or deleting builtin commands with the
<B>-f</B>
and
options to the
<B>enable</B>
-builtin command
+builtin command.
<DT>*<DD>
-using the <B>enable</B> builtin command to enable disabled shell builtins
+Using the <B>enable</B> builtin command to enable disabled shell builtins.
<DT>*<DD>
-specifying the
+Specifying the
<B>-p</B>
option to the
<B>command</B>
-builtin command
+builtin command.
<DT>*<DD>
-turning off restricted mode with
+Turning off restricted mode with
<B>set +r</B> or <B>shopt -u restricted_shell</B>.
</DL>
<P>
script.
-<A NAME="lbDE"> </A>
+<A NAME="lbDF"> </A>
<H3>SEE ALSO</H3>
<DT><I>readline</I>(3)<DD>
</DL>
-<A NAME="lbDF"> </A>
+<A NAME="lbDG"> </A>
<H3>FILES</H3>
Individual <I>readline</I> initialization file
</DL>
-<A NAME="lbDG"> </A>
+<A NAME="lbDH"> </A>
<H3>AUTHORS</H3>
Brian Fox, Free Software Foundation
<BR>
<A HREF="mailto:chet.ramey@case.edu">chet.ramey@case.edu</A>
-<A NAME="lbDH"> </A>
+<A NAME="lbDI"> </A>
<H3>BUG REPORTS</H3>
If you find a bug in
this manual page should be directed to
<I><A HREF="mailto:chet.ramey@case.edu">chet.ramey@case.edu</A></I>.
-<A NAME="lbDI"> </A>
+<A NAME="lbDJ"> </A>
<H3>BUGS</H3>
It's too big and too slow.
<P>
Array variables may not (yet) be exported.
-<P>
-
-There may be only one active coprocess at a time.
<HR>
<TABLE WIDTH=100%>
<TR>
-<TH ALIGN=LEFT width=33%>GNU Bash 5.3<TH ALIGN=CENTER width=33%>2024 August 13<TH ALIGN=RIGHT width=33%>BASH(1)
+<TH ALIGN=LEFT width=33%>GNU Bash 5.3<TH ALIGN=CENTER width=33%>2024 September 29<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<HR>
</DL>
<DT><A HREF="#lbAR">COMMENTS</A><DD>
<DT><A HREF="#lbAS">QUOTING</A><DD>
-<DT><A HREF="#lbAT">PARAMETERS</A><DD>
<DL>
-<DT><A HREF="#lbAU">Positional Parameters</A><DD>
-<DT><A HREF="#lbAV">Special Parameters</A><DD>
-<DT><A HREF="#lbAW">Shell Variables</A><DD>
-<DT><A HREF="#lbAX">Arrays</A><DD>
+<DT><A HREF="#lbAT">Translating Strings</A><DD>
+</DL>
+<DT><A HREF="#lbAU">PARAMETERS</A><DD>
+<DL>
+<DT><A HREF="#lbAV">Positional Parameters</A><DD>
+<DT><A HREF="#lbAW">Special Parameters</A><DD>
+<DT><A HREF="#lbAX">Shell Variables</A><DD>
+<DT><A HREF="#lbAY">Arrays</A><DD>
</DL>
-<DT><A HREF="#lbAY">EXPANSION</A><DD>
+<DT><A HREF="#lbAZ">EXPANSION</A><DD>
<DL>
-<DT><A HREF="#lbAZ">Brace Expansion</A><DD>
-<DT><A HREF="#lbBA">Tilde Expansion</A><DD>
-<DT><A HREF="#lbBB">Parameter Expansion</A><DD>
-<DT><A HREF="#lbBC">Command Substitution</A><DD>
-<DT><A HREF="#lbBD">Arithmetic Expansion</A><DD>
-<DT><A HREF="#lbBE">Process Substitution</A><DD>
-<DT><A HREF="#lbBF">Word Splitting</A><DD>
-<DT><A HREF="#lbBG">Pathname Expansion</A><DD>
-<DT><A HREF="#lbBH">Quote Removal</A><DD>
+<DT><A HREF="#lbBA">Brace Expansion</A><DD>
+<DT><A HREF="#lbBB">Tilde Expansion</A><DD>
+<DT><A HREF="#lbBC">Parameter Expansion</A><DD>
+<DT><A HREF="#lbBD">Command Substitution</A><DD>
+<DT><A HREF="#lbBE">Arithmetic Expansion</A><DD>
+<DT><A HREF="#lbBF">Process Substitution</A><DD>
+<DT><A HREF="#lbBG">Word Splitting</A><DD>
+<DT><A HREF="#lbBH">Pathname Expansion</A><DD>
+<DT><A HREF="#lbBI">Quote Removal</A><DD>
</DL>
-<DT><A HREF="#lbBI">REDIRECTION</A><DD>
+<DT><A HREF="#lbBJ">REDIRECTION</A><DD>
<DL>
-<DT><A HREF="#lbBJ">Redirecting Input</A><DD>
-<DT><A HREF="#lbBK">Redirecting Output</A><DD>
-<DT><A HREF="#lbBL">Appending Redirected Output</A><DD>
-<DT><A HREF="#lbBM">Redirecting Standard Output and Standard Error</A><DD>
-<DT><A HREF="#lbBN">Appending Standard Output and Standard Error</A><DD>
-<DT><A HREF="#lbBO">Here Documents</A><DD>
-<DT><A HREF="#lbBP">Here Strings</A><DD>
-<DT><A HREF="#lbBQ">Duplicating File Descriptors</A><DD>
-<DT><A HREF="#lbBR">Moving File Descriptors</A><DD>
-<DT><A HREF="#lbBS">Opening File Descriptors for Reading and Writing</A><DD>
+<DT><A HREF="#lbBK">Redirecting Input</A><DD>
+<DT><A HREF="#lbBL">Redirecting Output</A><DD>
+<DT><A HREF="#lbBM">Appending Redirected Output</A><DD>
+<DT><A HREF="#lbBN">Redirecting Standard Output and Standard Error</A><DD>
+<DT><A HREF="#lbBO">Appending Standard Output and Standard Error</A><DD>
+<DT><A HREF="#lbBP">Here Documents</A><DD>
+<DT><A HREF="#lbBQ">Here Strings</A><DD>
+<DT><A HREF="#lbBR">Duplicating File Descriptors</A><DD>
+<DT><A HREF="#lbBS">Moving File Descriptors</A><DD>
+<DT><A HREF="#lbBT">Opening File Descriptors for Reading and Writing</A><DD>
</DL>
-<DT><A HREF="#lbBT">ALIASES</A><DD>
-<DT><A HREF="#lbBU">FUNCTIONS</A><DD>
-<DT><A HREF="#lbBV">ARITHMETIC EVALUATION</A><DD>
-<DT><A HREF="#lbBW">CONDITIONAL EXPRESSIONS</A><DD>
-<DT><A HREF="#lbBX">SIMPLE COMMAND EXPANSION</A><DD>
-<DT><A HREF="#lbBY">COMMAND EXECUTION</A><DD>
-<DT><A HREF="#lbBZ">COMMAND EXECUTION ENVIRONMENT</A><DD>
-<DT><A HREF="#lbCA">ENVIRONMENT</A><DD>
-<DT><A HREF="#lbCB">EXIT STATUS</A><DD>
-<DT><A HREF="#lbCC">SIGNALS</A><DD>
-<DT><A HREF="#lbCD">JOB CONTROL</A><DD>
-<DT><A HREF="#lbCE">PROMPTING</A><DD>
-<DT><A HREF="#lbCF">READLINE</A><DD>
+<DT><A HREF="#lbBU">ALIASES</A><DD>
+<DT><A HREF="#lbBV">FUNCTIONS</A><DD>
+<DT><A HREF="#lbBW">ARITHMETIC EVALUATION</A><DD>
+<DT><A HREF="#lbBX">CONDITIONAL EXPRESSIONS</A><DD>
+<DT><A HREF="#lbBY">SIMPLE COMMAND EXPANSION</A><DD>
+<DT><A HREF="#lbBZ">COMMAND EXECUTION</A><DD>
+<DT><A HREF="#lbCA">COMMAND EXECUTION ENVIRONMENT</A><DD>
+<DT><A HREF="#lbCB">ENVIRONMENT</A><DD>
+<DT><A HREF="#lbCC">EXIT STATUS</A><DD>
+<DT><A HREF="#lbCD">SIGNALS</A><DD>
+<DT><A HREF="#lbCE">JOB CONTROL</A><DD>
+<DT><A HREF="#lbCF">PROMPTING</A><DD>
+<DT><A HREF="#lbCG">READLINE</A><DD>
<DL>
-<DT><A HREF="#lbCG">Readline Notation</A><DD>
-<DT><A HREF="#lbCH">Readline Initialization</A><DD>
-<DT><A HREF="#lbCI">Readline Key Bindings</A><DD>
-<DT><A HREF="#lbCJ">Readline Variables</A><DD>
-<DT><A HREF="#lbCK">Readline Conditional Constructs</A><DD>
-<DT><A HREF="#lbCL">Searching</A><DD>
-<DT><A HREF="#lbCM">Readline Command Names</A><DD>
-<DT><A HREF="#lbCN">Commands for Moving</A><DD>
-<DT><A HREF="#lbCO">Commands for Manipulating the History</A><DD>
-<DT><A HREF="#lbCP">Commands for Changing Text</A><DD>
-<DT><A HREF="#lbCQ">Killing and Yanking</A><DD>
-<DT><A HREF="#lbCR">Numeric Arguments</A><DD>
-<DT><A HREF="#lbCS">Completing</A><DD>
-<DT><A HREF="#lbCT">Keyboard Macros</A><DD>
-<DT><A HREF="#lbCU">Miscellaneous</A><DD>
-<DT><A HREF="#lbCV">Programmable Completion</A><DD>
+<DT><A HREF="#lbCH">Readline Notation</A><DD>
+<DT><A HREF="#lbCI">Readline Initialization</A><DD>
+<DT><A HREF="#lbCJ">Readline Key Bindings</A><DD>
+<DT><A HREF="#lbCK">Readline Variables</A><DD>
+<DT><A HREF="#lbCL">Readline Conditional Constructs</A><DD>
+<DT><A HREF="#lbCM">Searching</A><DD>
+<DT><A HREF="#lbCN">Readline Command Names</A><DD>
+<DT><A HREF="#lbCO">Commands for Moving</A><DD>
+<DT><A HREF="#lbCP">Commands for Manipulating the History</A><DD>
+<DT><A HREF="#lbCQ">Commands for Changing Text</A><DD>
+<DT><A HREF="#lbCR">Killing and Yanking</A><DD>
+<DT><A HREF="#lbCS">Numeric Arguments</A><DD>
+<DT><A HREF="#lbCT">Completing</A><DD>
+<DT><A HREF="#lbCU">Keyboard Macros</A><DD>
+<DT><A HREF="#lbCV">Miscellaneous</A><DD>
+<DT><A HREF="#lbCW">Programmable Completion</A><DD>
</DL>
-<DT><A HREF="#lbCW">HISTORY</A><DD>
-<DT><A HREF="#lbCX">HISTORY EXPANSION</A><DD>
+<DT><A HREF="#lbCX">HISTORY</A><DD>
+<DT><A HREF="#lbCY">HISTORY EXPANSION</A><DD>
<DL>
-<DT><A HREF="#lbCY">Event Designators</A><DD>
-<DT><A HREF="#lbCZ">Word Designators</A><DD>
-<DT><A HREF="#lbDA">Modifiers</A><DD>
+<DT><A HREF="#lbCZ">Event Designators</A><DD>
+<DT><A HREF="#lbDA">Word Designators</A><DD>
+<DT><A HREF="#lbDB">Modifiers</A><DD>
</DL>
-<DT><A HREF="#lbDB">SHELL BUILTIN COMMANDS</A><DD>
-<DT><A HREF="#lbDC">SHELL COMPATIBILITY MODE</A><DD>
-<DT><A HREF="#lbDD">RESTRICTED SHELL</A><DD>
-<DT><A HREF="#lbDE">SEE ALSO</A><DD>
-<DT><A HREF="#lbDF">FILES</A><DD>
-<DT><A HREF="#lbDG">AUTHORS</A><DD>
-<DT><A HREF="#lbDH">BUG REPORTS</A><DD>
-<DT><A HREF="#lbDI">BUGS</A><DD>
+<DT><A HREF="#lbDC">SHELL BUILTIN COMMANDS</A><DD>
+<DT><A HREF="#lbDD">SHELL COMPATIBILITY MODE</A><DD>
+<DT><A HREF="#lbDE">RESTRICTED SHELL</A><DD>
+<DT><A HREF="#lbDF">SEE ALSO</A><DD>
+<DT><A HREF="#lbDG">FILES</A><DD>
+<DT><A HREF="#lbDH">AUTHORS</A><DD>
+<DT><A HREF="#lbDI">BUG REPORTS</A><DD>
+<DT><A HREF="#lbDJ">BUGS</A><DD>
</DL>
<HR>
-This document was created by man2html from /usr/local/src/bash/bash-20240812/doc/bash.1.<BR>
-Time: 13 August 2024 14:46:04 EDT
+This document was created by man2html from /usr/local/src/bash/bash-20240927/doc/bash.1.<BR>
+Time: 07 October 2024 17:23:36 EDT
</BODY>
</HTML>
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,
*************
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
<http://www.gnu.org/software/bash/>.
- 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
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.
\1f
File: bash.info, Node: What is a shell?, Prev: What is Bash?, Up: Introduction
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
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.
\1f
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).
\1f
File: bash.info, Node: Single Quotes, Next: Double Quotes, Prev: Escape Character, Up: Quoting
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::).
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::),
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.
\1f
File: bash.info, Node: Shell Commands, Next: Shell Functions, Prev: Shell Syntax, Up: Basic Shell Features
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.
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
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
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
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.
\1f
File: bash.info, Node: Lists, Next: Compound Commands, Prev: Pipelines, Up: Shell Commands
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::).
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.
\1f
File: bash.info, Node: Conditional Constructs, Next: Command Grouping, Prev: Looping Constructs, Up: Compound Commands
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
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’
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’.
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.
{ 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
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.
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
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 ]
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
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
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
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.
\1f
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
(“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
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
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).
\1f
File: bash.info, Node: Special Parameters, Prev: Positional Parameters, Up: Shell Parameters
------------------------
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.
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,
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
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’
‘${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
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.
$ 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
‘${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}
‘${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}’
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:
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
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
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}’
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 ))
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.
\1f
File: bash.info, Node: Process Substitution, Next: Word Splitting, Prev: Arithmetic Expansion, Up: Shell Expansions
>(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
If ‘IFS’ is unset, or its value is exactly ‘<space><tab><newline>’,
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
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
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::).
\1f
File: bash.info, Node: Pattern Matching, Up: Filename Expansion
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.
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
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
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
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.
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
3.6.2 Redirecting Output
------------------------
-Redirection of output causes the file whose name results from the
-expansion of WORD 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 WORD 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:
[N]>[|]WORD
‘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
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:
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
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:
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 ‘\<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.
3.6.7 Here Strings
------------------
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
-----------------------------
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.
\1f
File: bash.info, Node: Executing Commands, Next: Shell Scripts, Prev: Redirections, Up: Basic Shell Features
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.
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.
\1f
File: bash.info, Node: Command Search and Execution, Next: Command Execution Environment, Prev: Simple Command Expansion, Up: Executing Commands
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
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.
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
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
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,
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::.
+
\1f
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
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
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
‘. (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
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
‘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]
‘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
‘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’.
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]
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’.
‘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.
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.
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’
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
‘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
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’
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.
\1f
File: bash.info, Node: Bash Builtins, Next: Modifying Shell Behavior, Prev: Bourne Shell Builtins, Up: Shell Builtin Commands
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]
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:
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
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.
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
‘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]
‘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,
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’
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
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
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
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’
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,
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:
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’
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.
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
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
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:
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
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]
‘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’.
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.
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.
‘-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.
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::.
\1f
File: bash.info, Node: Modifying Shell Behavior, Next: Special Builtins, Prev: Bash Builtins, Up: Shell Builtin Commands
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’
‘-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
‘-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.
‘-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,
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:
/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
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 ...]
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.
‘-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
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
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,
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
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 ‘.’
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’
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
‘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
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
‘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.
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’
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
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’
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
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.
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
‘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.
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
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
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
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: <TAB>,
+ 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, ‘!’, for listing alternatives on partial word
completion, ‘@’, to list completions if the word is not unmodified,
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’
‘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
‘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
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
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
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
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
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’.
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
‘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
‘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
‘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.
‘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
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
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.
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
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
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’
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.
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.
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
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
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
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.
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
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
................................................
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.
\1f
File: bash.info, Node: Is this Shell Interactive?, Next: Interactive Shell Behavior, Prev: What is an Interactive Shell?, Up: Interactive Shells
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.
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
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
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.
====================
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
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
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.
-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.
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.
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]
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
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
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
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
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.
\1f
File: bash.info, Node: The Directory Stack, Next: Controlling the Prompt, Prev: Arrays, Up: Bash Features
‘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.
‘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’.
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’
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.
‘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.
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.
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.
‘\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.
‘\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).
=========================
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:
• 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’
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
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
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
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
• 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
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
‘-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,
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
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
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.
‘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.
\1f
File: bash.info, Node: Command Line Editing, Next: Using History Interactively, Prev: Job Control, Up: Top
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
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
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
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
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
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
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.
‘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
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
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.
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’.
\1f
File: bash.info, Node: Bash History Builtins, Next: History Interaction, Prev: Bash History Facilities, Up: Using History Interactively
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
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
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.
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
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
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
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
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
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,
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’.
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
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
‘*’
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 ‘!!’.
\1f
File: bash.info, Node: Modifiers, Prev: Word Designators, Up: History Interaction
‘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.
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:
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::).
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’.
‘--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’.
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
‘--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
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.
‘--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
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
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
-<ftp://ftp.gnu.org/pub/gnu/bash/> and from
+of Bash. The latest released version of Bash is always available for
+FTP from <ftp://ftp.gnu.org/pub/gnu/bash/> and from
<http://git.savannah.gnu.org/cgit/bash.git/snapshot/bash-master.tar.gz>.
Once you have determined that a bug actually exists, use the
* .: 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)
\1f
File: bash.info, Node: Reserved Word Index, Next: Variable Index, Prev: Builtin Index, Up: Indexes
* !: 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.
* in: Conditional Constructs.
(line 28)
* select: Conditional Constructs.
- (line 83)
+ (line 84)
* then: Conditional Constructs.
(line 7)
* time: Pipelines. (line 9)
* 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.
(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.
(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.
(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.
(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)
\1f
File: bash.info, Node: Function Index, Next: Concept Index, Prev: Variable Index, Up: Indexes
* 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)
(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)
* 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)
* 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)
\1f
Tag Table:
-Node: Top\7f901
-Node: Introduction\7f2842
-Node: What is Bash?\7f3055
-Node: What is a shell?\7f4196
-Node: Definitions\7f6775
-Node: Basic Shell Features\7f9951
-Node: Shell Syntax\7f11171
-Node: Shell Operation\7f12198
-Node: Quoting\7f13496
-Node: Escape Character\7f14809
-Node: Single Quotes\7f15307
-Node: Double Quotes\7f15656
-Node: ANSI-C Quoting\7f16999
-Node: Locale Translation\7f18384
-Node: Creating Internationalized Scripts\7f19728
-Node: Comments\7f23926
-Node: Shell Commands\7f24561
-Node: Reserved Words\7f25500
-Node: Simple Commands\7f26365
-Node: Pipelines\7f27024
-Node: Lists\7f30087
-Node: Compound Commands\7f31959
-Node: Looping Constructs\7f32968
-Node: Conditional Constructs\7f35512
-Node: Command Grouping\7f50373
-Node: Coprocesses\7f51860
-Node: GNU Parallel\7f54556
-Node: Shell Functions\7f55474
-Node: Shell Parameters\7f63580
-Node: Positional Parameters\7f68113
-Node: Special Parameters\7f69048
-Node: Shell Expansions\7f72358
-Node: Brace Expansion\7f74547
-Node: Tilde Expansion\7f77210
-Node: Shell Parameter Expansion\7f79976
-Node: Command Substitution\7f99083
-Node: Arithmetic Expansion\7f102616
-Node: Process Substitution\7f103581
-Node: Word Splitting\7f104718
-Node: Filename Expansion\7f106859
-Node: Pattern Matching\7f109955
-Node: Quote Removal\7f115188
-Node: Redirections\7f115492
-Node: Executing Commands\7f125301
-Node: Simple Command Expansion\7f125968
-Node: Command Search and Execution\7f128079
-Node: Command Execution Environment\7f130487
-Node: Environment\7f133796
-Node: Exit Status\7f135500
-Node: Signals\7f137285
-Node: Shell Scripts\7f140899
-Node: Shell Builtin Commands\7f143991
-Node: Bourne Shell Builtins\7f146102
-Node: Bash Builtins\7f170872
-Node: Modifying Shell Behavior\7f205971
-Node: The Set Builtin\7f206313
-Node: The Shopt Builtin\7f217896
-Node: Special Builtins\7f234948
-Node: Shell Variables\7f235937
-Node: Bourne Shell Variables\7f236371
-Node: Bash Variables\7f238564
-Node: Bash Features\7f275759
-Node: Invoking Bash\7f276773
-Node: Bash Startup Files\7f283172
-Node: Interactive Shells\7f288475
-Node: What is an Interactive Shell?\7f288883
-Node: Is this Shell Interactive?\7f289549
-Node: Interactive Shell Behavior\7f290373
-Node: Bash Conditional Expressions\7f294127
-Node: Shell Arithmetic\7f299301
-Node: Aliases\7f302383
-Node: Arrays\7f305338
-Node: The Directory Stack\7f312137
-Node: Directory Stack Builtins\7f312934
-Node: Controlling the Prompt\7f317383
-Node: The Restricted Shell\7f320521
-Node: Bash POSIX Mode\7f323308
-Node: Shell Compatibility Mode\7f341567
-Node: Job Control\7f350518
-Node: Job Control Basics\7f350975
-Node: Job Control Builtins\7f356283
-Node: Job Control Variables\7f362227
-Node: Command Line Editing\7f363404
-Node: Introduction and Notation\7f365108
-Node: Readline Interaction\7f367203
-Node: Readline Bare Essentials\7f368391
-Node: Readline Movement Commands\7f370209
-Node: Readline Killing Commands\7f371206
-Node: Readline Arguments\7f373184
-Node: Searching\7f374241
-Node: Readline Init File\7f376470
-Node: Readline Init File Syntax\7f377752
-Node: Conditional Init Constructs\7f404292
-Node: Sample Init File\7f408657
-Node: Bindable Readline Commands\7f411778
-Node: Commands For Moving\7f413003
-Node: Commands For History\7f415230
-Node: Commands For Text\7f420435
-Node: Commands For Killing\7f424569
-Node: Numeric Arguments\7f427370
-Node: Commands For Completion\7f428522
-Node: Keyboard Macros\7f432838
-Node: Miscellaneous Commands\7f433539
-Node: Readline vi Mode\7f440193
-Node: Programmable Completion\7f441145
-Node: Programmable Completion Builtins\7f449102
-Node: A Programmable Completion Example\7f460668
-Node: Using History Interactively\7f466013
-Node: Bash History Facilities\7f466694
-Node: Bash History Builtins\7f469806
-Node: History Interaction\7f475049
-Node: Event Designators\7f479374
-Node: Word Designators\7f480957
-Node: Modifiers\7f483109
-Node: Installing Bash\7f485018
-Node: Basic Installation\7f486152
-Node: Compilers and Options\7f490031
-Node: Compiling For Multiple Architectures\7f490781
-Node: Installation Names\7f492530
-Node: Specifying the System Type\7f494764
-Node: Sharing Defaults\7f495510
-Node: Operation Controls\7f496224
-Node: Optional Features\7f497243
-Node: Reporting Bugs\7f509045
-Node: Major Differences From The Bourne Shell\7f510394
-Node: GNU Free Documentation License\7f530129
-Node: Indexes\7f555306
-Node: Builtin Index\7f555757
-Node: Reserved Word Index\7f562855
-Node: Variable Index\7f565300
-Node: Function Index\7f582572
-Node: Concept Index\7f596428
+Node: Top\7f903
+Node: Introduction\7f2846
+Node: What is Bash?\7f3059
+Node: What is a shell?\7f4192
+Node: Definitions\7f6783
+Node: Basic Shell Features\7f9959
+Node: Shell Syntax\7f11179
+Node: Shell Operation\7f12206
+Node: Quoting\7f13504
+Node: Escape Character\7f14842
+Node: Single Quotes\7f15377
+Node: Double Quotes\7f15726
+Node: ANSI-C Quoting\7f17071
+Node: Locale Translation\7f18456
+Node: Creating Internationalized Scripts\7f19863
+Node: Comments\7f24061
+Node: Shell Commands\7f24828
+Node: Reserved Words\7f25767
+Node: Simple Commands\7f26632
+Node: Pipelines\7f27294
+Node: Lists\7f30521
+Node: Compound Commands\7f32393
+Node: Looping Constructs\7f33402
+Node: Conditional Constructs\7f35921
+Node: Command Grouping\7f50853
+Node: Coprocesses\7f52345
+Node: GNU Parallel\7f55031
+Node: Shell Functions\7f55949
+Node: Shell Parameters\7f64426
+Node: Positional Parameters\7f69164
+Node: Special Parameters\7f70254
+Node: Shell Expansions\7f73715
+Node: Brace Expansion\7f75904
+Node: Tilde Expansion\7f78619
+Node: Shell Parameter Expansion\7f81561
+Node: Command Substitution\7f101333
+Node: Arithmetic Expansion\7f104866
+Node: Process Substitution\7f105879
+Node: Word Splitting\7f106995
+Node: Filename Expansion\7f109092
+Node: Pattern Matching\7f112360
+Node: Quote Removal\7f117688
+Node: Redirections\7f117992
+Node: Executing Commands\7f128207
+Node: Simple Command Expansion\7f128874
+Node: Command Search and Execution\7f130982
+Node: Command Execution Environment\7f133426
+Node: Environment\7f136859
+Node: Exit Status\7f138762
+Node: Signals\7f140820
+Node: Shell Scripts\7f144718
+Node: Shell Builtin Commands\7f148016
+Node: Bourne Shell Builtins\7f150127
+Node: Bash Builtins\7f176426
+Node: Modifying Shell Behavior\7f212868
+Node: The Set Builtin\7f213210
+Node: The Shopt Builtin\7f225146
+Node: Special Builtins\7f242192
+Node: Shell Variables\7f243181
+Node: Bourne Shell Variables\7f243615
+Node: Bash Variables\7f246123
+Node: Bash Features\7f284380
+Node: Invoking Bash\7f285394
+Node: Bash Startup Files\7f291820
+Node: Interactive Shells\7f297133
+Node: What is an Interactive Shell?\7f297541
+Node: Is this Shell Interactive?\7f298203
+Node: Interactive Shell Behavior\7f299027
+Node: Bash Conditional Expressions\7f302788
+Node: Shell Arithmetic\7f308005
+Node: Aliases\7f311344
+Node: Arrays\7f314306
+Node: The Directory Stack\7f321369
+Node: Directory Stack Builtins\7f322166
+Node: Controlling the Prompt\7f326611
+Node: The Restricted Shell\7f329495
+Node: Bash POSIX Mode\7f332377
+Node: Shell Compatibility Mode\7f350636
+Node: Job Control\7f359647
+Node: Job Control Basics\7f360104
+Node: Job Control Builtins\7f365412
+Node: Job Control Variables\7f371580
+Node: Command Line Editing\7f372748
+Node: Introduction and Notation\7f374452
+Node: Readline Interaction\7f376547
+Node: Readline Bare Essentials\7f377735
+Node: Readline Movement Commands\7f379553
+Node: Readline Killing Commands\7f380550
+Node: Readline Arguments\7f382528
+Node: Searching\7f383585
+Node: Readline Init File\7f385814
+Node: Readline Init File Syntax\7f387096
+Node: Conditional Init Constructs\7f413700
+Node: Sample Init File\7f418065
+Node: Bindable Readline Commands\7f421186
+Node: Commands For Moving\7f422411
+Node: Commands For History\7f424638
+Node: Commands For Text\7f429843
+Node: Commands For Killing\7f433977
+Node: Numeric Arguments\7f436778
+Node: Commands For Completion\7f437930
+Node: Keyboard Macros\7f442246
+Node: Miscellaneous Commands\7f442947
+Node: Readline vi Mode\7f449601
+Node: Programmable Completion\7f450553
+Node: Programmable Completion Builtins\7f458544
+Node: A Programmable Completion Example\7f470312
+Node: Using History Interactively\7f475657
+Node: Bash History Facilities\7f476338
+Node: Bash History Builtins\7f480124
+Node: History Interaction\7f486503
+Node: Event Designators\7f491354
+Node: Word Designators\7f492940
+Node: Modifiers\7f495225
+Node: Installing Bash\7f497158
+Node: Basic Installation\7f498274
+Node: Compilers and Options\7f502150
+Node: Compiling For Multiple Architectures\7f502900
+Node: Installation Names\7f504649
+Node: Specifying the System Type\7f506883
+Node: Sharing Defaults\7f507629
+Node: Operation Controls\7f508343
+Node: Optional Features\7f509362
+Node: Reporting Bugs\7f521742
+Node: Major Differences From The Bourne Shell\7f523100
+Node: GNU Free Documentation License\7f542835
+Node: Indexes\7f568012
+Node: Builtin Index\7f568463
+Node: Reserved Word Index\7f575561
+Node: Variable Index\7f578006
+Node: Function Index\7f595278
+Node: Concept Index\7f609134
\1f
End Tag Table
@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}
@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}
@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?}
@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}
-\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}}
\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}
\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}
\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}
\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}
-\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)}}
\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}
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,
*************
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
<http://www.gnu.org/software/bash/>.
- 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
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.
\1f
File: bashref.info, Node: What is a shell?, Prev: What is Bash?, Up: Introduction
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
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.
\1f
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).
\1f
File: bashref.info, Node: Single Quotes, Next: Double Quotes, Prev: Escape Character, Up: Quoting
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::).
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::),
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.
\1f
File: bashref.info, Node: Shell Commands, Next: Shell Functions, Prev: Shell Syntax, Up: Basic Shell Features
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.
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
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
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
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.
\1f
File: bashref.info, Node: Lists, Next: Compound Commands, Prev: Pipelines, Up: Shell Commands
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::).
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.
\1f
File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Prev: Looping Constructs, Up: Compound Commands
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
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’
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’.
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.
{ 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
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.
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
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 ]
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
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
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
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.
\1f
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
(“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
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
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).
\1f
File: bashref.info, Node: Special Parameters, Prev: Positional Parameters, Up: Shell Parameters
------------------------
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.
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,
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
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’
‘${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
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.
$ 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
‘${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}
‘${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}’
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:
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
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
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}’
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 ))
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.
\1f
File: bashref.info, Node: Process Substitution, Next: Word Splitting, Prev: Arithmetic Expansion, Up: Shell Expansions
>(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
If ‘IFS’ is unset, or its value is exactly ‘<space><tab><newline>’,
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
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
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::).
\1f
File: bashref.info, Node: Pattern Matching, Up: Filename Expansion
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.
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
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
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
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.
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
3.6.2 Redirecting Output
------------------------
-Redirection of output causes the file whose name results from the
-expansion of WORD 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 WORD 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:
[N]>[|]WORD
‘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
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:
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
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:
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 ‘\<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.
3.6.7 Here Strings
------------------
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
-----------------------------
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.
\1f
File: bashref.info, Node: Executing Commands, Next: Shell Scripts, Prev: Redirections, Up: Basic Shell Features
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.
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.
\1f
File: bashref.info, Node: Command Search and Execution, Next: Command Execution Environment, Prev: Simple Command Expansion, Up: Executing Commands
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
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.
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
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
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,
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::.
+
\1f
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
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
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
‘. (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
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
‘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]
‘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
‘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’.
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]
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’.
‘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.
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.
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’
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
‘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
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’
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.
\1f
File: bashref.info, Node: Bash Builtins, Next: Modifying Shell Behavior, Prev: Bourne Shell Builtins, Up: Shell Builtin Commands
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]
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:
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
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.
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
‘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]
‘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,
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’
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
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
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
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’
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,
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:
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’
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.
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
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
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:
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
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]
‘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’.
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.
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.
‘-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.
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::.
\1f
File: bashref.info, Node: Modifying Shell Behavior, Next: Special Builtins, Prev: Bash Builtins, Up: Shell Builtin Commands
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’
‘-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
‘-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.
‘-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,
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:
/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
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 ...]
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.
‘-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
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
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,
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
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 ‘.’
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’
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
‘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
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
‘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.
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’
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
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’
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
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.
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
‘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.
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
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
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
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: <TAB>,
+ 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, ‘!’, for listing alternatives on partial word
completion, ‘@’, to list completions if the word is not unmodified,
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’
‘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
‘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
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
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
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
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
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’.
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
‘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
‘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
‘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.
‘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
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
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.
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
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
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’
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.
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.
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
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
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
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.
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
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
................................................
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.
\1f
File: bashref.info, Node: Is this Shell Interactive?, Next: Interactive Shell Behavior, Prev: What is an Interactive Shell?, Up: Interactive Shells
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.
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
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
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.
====================
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
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
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.
-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.
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.
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]
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
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
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
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
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.
\1f
File: bashref.info, Node: The Directory Stack, Next: Controlling the Prompt, Prev: Arrays, Up: Bash Features
‘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.
‘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’.
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’
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.
‘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.
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.
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.
‘\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.
‘\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).
=========================
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:
• 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’
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
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
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
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
• 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
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
‘-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,
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
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
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.
‘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.
\1f
File: bashref.info, Node: Command Line Editing, Next: Using History Interactively, Prev: Job Control, Up: Top
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
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
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
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
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
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
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.
‘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
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
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.
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’.
\1f
File: bashref.info, Node: Bash History Builtins, Next: History Interaction, Prev: Bash History Facilities, Up: Using History Interactively
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
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
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.
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
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
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
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
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
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,
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’.
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
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
‘*’
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 ‘!!’.
\1f
File: bashref.info, Node: Modifiers, Prev: Word Designators, Up: History Interaction
‘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.
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:
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::).
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’.
‘--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’.
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
‘--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
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.
‘--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
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
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
-<ftp://ftp.gnu.org/pub/gnu/bash/> and from
+of Bash. The latest released version of Bash is always available for
+FTP from <ftp://ftp.gnu.org/pub/gnu/bash/> and from
<http://git.savannah.gnu.org/cgit/bash.git/snapshot/bash-master.tar.gz>.
Once you have determined that a bug actually exists, use the
* .: 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)
\1f
File: bashref.info, Node: Reserved Word Index, Next: Variable Index, Prev: Builtin Index, Up: Indexes
* !: 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.
* in: Conditional Constructs.
(line 28)
* select: Conditional Constructs.
- (line 83)
+ (line 84)
* then: Conditional Constructs.
(line 7)
* time: Pipelines. (line 9)
* 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.
(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.
(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.
(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.
(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)
\1f
File: bashref.info, Node: Function Index, Next: Concept Index, Prev: Variable Index, Up: Indexes
* 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)
(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)
* 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)
* 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)
\1f
Tag Table:
-Node: Top\7f904
-Node: Introduction\7f2848
-Node: What is Bash?\7f3064
-Node: What is a shell?\7f4208
-Node: Definitions\7f6790
-Node: Basic Shell Features\7f9969
-Node: Shell Syntax\7f11192
-Node: Shell Operation\7f12222
-Node: Quoting\7f13523
-Node: Escape Character\7f14839
-Node: Single Quotes\7f15340
-Node: Double Quotes\7f15692
-Node: ANSI-C Quoting\7f17038
-Node: Locale Translation\7f18426
-Node: Creating Internationalized Scripts\7f19773
-Node: Comments\7f23974
-Node: Shell Commands\7f24612
-Node: Reserved Words\7f25554
-Node: Simple Commands\7f26422
-Node: Pipelines\7f27084
-Node: Lists\7f30150
-Node: Compound Commands\7f32025
-Node: Looping Constructs\7f33037
-Node: Conditional Constructs\7f35584
-Node: Command Grouping\7f50448
-Node: Coprocesses\7f51938
-Node: GNU Parallel\7f54637
-Node: Shell Functions\7f55558
-Node: Shell Parameters\7f63667
-Node: Positional Parameters\7f68203
-Node: Special Parameters\7f69141
-Node: Shell Expansions\7f72454
-Node: Brace Expansion\7f74646
-Node: Tilde Expansion\7f77312
-Node: Shell Parameter Expansion\7f80081
-Node: Command Substitution\7f99191
-Node: Arithmetic Expansion\7f102727
-Node: Process Substitution\7f103695
-Node: Word Splitting\7f104835
-Node: Filename Expansion\7f106979
-Node: Pattern Matching\7f110078
-Node: Quote Removal\7f115314
-Node: Redirections\7f115621
-Node: Executing Commands\7f125433
-Node: Simple Command Expansion\7f126103
-Node: Command Search and Execution\7f128217
-Node: Command Execution Environment\7f130628
-Node: Environment\7f133940
-Node: Exit Status\7f135647
-Node: Signals\7f137435
-Node: Shell Scripts\7f141052
-Node: Shell Builtin Commands\7f144147
-Node: Bourne Shell Builtins\7f146261
-Node: Bash Builtins\7f171034
-Node: Modifying Shell Behavior\7f206136
-Node: The Set Builtin\7f206481
-Node: The Shopt Builtin\7f218067
-Node: Special Builtins\7f235122
-Node: Shell Variables\7f236114
-Node: Bourne Shell Variables\7f236551
-Node: Bash Variables\7f238747
-Node: Bash Features\7f275945
-Node: Invoking Bash\7f276962
-Node: Bash Startup Files\7f283364
-Node: Interactive Shells\7f288670
-Node: What is an Interactive Shell?\7f289081
-Node: Is this Shell Interactive?\7f289750
-Node: Interactive Shell Behavior\7f290577
-Node: Bash Conditional Expressions\7f294334
-Node: Shell Arithmetic\7f299511
-Node: Aliases\7f302596
-Node: Arrays\7f305554
-Node: The Directory Stack\7f312356
-Node: Directory Stack Builtins\7f313156
-Node: Controlling the Prompt\7f317608
-Node: The Restricted Shell\7f320749
-Node: Bash POSIX Mode\7f323539
-Node: Shell Compatibility Mode\7f341801
-Node: Job Control\7f350755
-Node: Job Control Basics\7f351215
-Node: Job Control Builtins\7f356526
-Node: Job Control Variables\7f362473
-Node: Command Line Editing\7f363653
-Node: Introduction and Notation\7f365360
-Node: Readline Interaction\7f367458
-Node: Readline Bare Essentials\7f368649
-Node: Readline Movement Commands\7f370470
-Node: Readline Killing Commands\7f371470
-Node: Readline Arguments\7f373451
-Node: Searching\7f374511
-Node: Readline Init File\7f376743
-Node: Readline Init File Syntax\7f378028
-Node: Conditional Init Constructs\7f404571
-Node: Sample Init File\7f408939
-Node: Bindable Readline Commands\7f412063
-Node: Commands For Moving\7f413291
-Node: Commands For History\7f415521
-Node: Commands For Text\7f420729
-Node: Commands For Killing\7f424866
-Node: Numeric Arguments\7f427670
-Node: Commands For Completion\7f428825
-Node: Keyboard Macros\7f433144
-Node: Miscellaneous Commands\7f433848
-Node: Readline vi Mode\7f440505
-Node: Programmable Completion\7f441460
-Node: Programmable Completion Builtins\7f449420
-Node: A Programmable Completion Example\7f460989
-Node: Using History Interactively\7f466337
-Node: Bash History Facilities\7f467021
-Node: Bash History Builtins\7f470136
-Node: History Interaction\7f475382
-Node: Event Designators\7f479710
-Node: Word Designators\7f481296
-Node: Modifiers\7f483451
-Node: Installing Bash\7f485363
-Node: Basic Installation\7f486500
-Node: Compilers and Options\7f490382
-Node: Compiling For Multiple Architectures\7f491135
-Node: Installation Names\7f492887
-Node: Specifying the System Type\7f495124
-Node: Sharing Defaults\7f495873
-Node: Operation Controls\7f496590
-Node: Optional Features\7f497612
-Node: Reporting Bugs\7f509417
-Node: Major Differences From The Bourne Shell\7f510769
-Node: GNU Free Documentation License\7f530507
-Node: Indexes\7f555687
-Node: Builtin Index\7f556141
-Node: Reserved Word Index\7f563242
-Node: Variable Index\7f565690
-Node: Function Index\7f582965
-Node: Concept Index\7f596824
+Node: Top\7f906
+Node: Introduction\7f2852
+Node: What is Bash?\7f3068
+Node: What is a shell?\7f4204
+Node: Definitions\7f6798
+Node: Basic Shell Features\7f9977
+Node: Shell Syntax\7f11200
+Node: Shell Operation\7f12230
+Node: Quoting\7f13531
+Node: Escape Character\7f14872
+Node: Single Quotes\7f15410
+Node: Double Quotes\7f15762
+Node: ANSI-C Quoting\7f17110
+Node: Locale Translation\7f18498
+Node: Creating Internationalized Scripts\7f19908
+Node: Comments\7f24109
+Node: Shell Commands\7f24879
+Node: Reserved Words\7f25821
+Node: Simple Commands\7f26689
+Node: Pipelines\7f27354
+Node: Lists\7f30584
+Node: Compound Commands\7f32459
+Node: Looping Constructs\7f33471
+Node: Conditional Constructs\7f35993
+Node: Command Grouping\7f50928
+Node: Coprocesses\7f52423
+Node: GNU Parallel\7f55112
+Node: Shell Functions\7f56033
+Node: Shell Parameters\7f64513
+Node: Positional Parameters\7f69254
+Node: Special Parameters\7f70347
+Node: Shell Expansions\7f73811
+Node: Brace Expansion\7f76003
+Node: Tilde Expansion\7f78721
+Node: Shell Parameter Expansion\7f81666
+Node: Command Substitution\7f101441
+Node: Arithmetic Expansion\7f104977
+Node: Process Substitution\7f105993
+Node: Word Splitting\7f107112
+Node: Filename Expansion\7f109212
+Node: Pattern Matching\7f112483
+Node: Quote Removal\7f117814
+Node: Redirections\7f118121
+Node: Executing Commands\7f128339
+Node: Simple Command Expansion\7f129009
+Node: Command Search and Execution\7f131120
+Node: Command Execution Environment\7f133567
+Node: Environment\7f137003
+Node: Exit Status\7f138909
+Node: Signals\7f140970
+Node: Shell Scripts\7f144871
+Node: Shell Builtin Commands\7f148172
+Node: Bourne Shell Builtins\7f150286
+Node: Bash Builtins\7f176588
+Node: Modifying Shell Behavior\7f213033
+Node: The Set Builtin\7f213378
+Node: The Shopt Builtin\7f225317
+Node: Special Builtins\7f242366
+Node: Shell Variables\7f243358
+Node: Bourne Shell Variables\7f243795
+Node: Bash Variables\7f246306
+Node: Bash Features\7f284566
+Node: Invoking Bash\7f285583
+Node: Bash Startup Files\7f292012
+Node: Interactive Shells\7f297328
+Node: What is an Interactive Shell?\7f297739
+Node: Is this Shell Interactive?\7f298404
+Node: Interactive Shell Behavior\7f299231
+Node: Bash Conditional Expressions\7f302995
+Node: Shell Arithmetic\7f308215
+Node: Aliases\7f311557
+Node: Arrays\7f314522
+Node: The Directory Stack\7f321588
+Node: Directory Stack Builtins\7f322388
+Node: Controlling the Prompt\7f326836
+Node: The Restricted Shell\7f329723
+Node: Bash POSIX Mode\7f332608
+Node: Shell Compatibility Mode\7f350870
+Node: Job Control\7f359884
+Node: Job Control Basics\7f360344
+Node: Job Control Builtins\7f365655
+Node: Job Control Variables\7f371826
+Node: Command Line Editing\7f372997
+Node: Introduction and Notation\7f374704
+Node: Readline Interaction\7f376802
+Node: Readline Bare Essentials\7f377993
+Node: Readline Movement Commands\7f379814
+Node: Readline Killing Commands\7f380814
+Node: Readline Arguments\7f382795
+Node: Searching\7f383855
+Node: Readline Init File\7f386087
+Node: Readline Init File Syntax\7f387372
+Node: Conditional Init Constructs\7f413979
+Node: Sample Init File\7f418347
+Node: Bindable Readline Commands\7f421471
+Node: Commands For Moving\7f422699
+Node: Commands For History\7f424929
+Node: Commands For Text\7f430137
+Node: Commands For Killing\7f434274
+Node: Numeric Arguments\7f437078
+Node: Commands For Completion\7f438233
+Node: Keyboard Macros\7f442552
+Node: Miscellaneous Commands\7f443256
+Node: Readline vi Mode\7f449913
+Node: Programmable Completion\7f450868
+Node: Programmable Completion Builtins\7f458862
+Node: A Programmable Completion Example\7f470633
+Node: Using History Interactively\7f475981
+Node: Bash History Facilities\7f476665
+Node: Bash History Builtins\7f480454
+Node: History Interaction\7f486836
+Node: Event Designators\7f491690
+Node: Word Designators\7f493279
+Node: Modifiers\7f495567
+Node: Installing Bash\7f497503
+Node: Basic Installation\7f498622
+Node: Compilers and Options\7f502501
+Node: Compiling For Multiple Architectures\7f503254
+Node: Installation Names\7f505006
+Node: Specifying the System Type\7f507243
+Node: Sharing Defaults\7f507992
+Node: Operation Controls\7f508709
+Node: Optional Features\7f509731
+Node: Reporting Bugs\7f522114
+Node: Major Differences From The Bourne Shell\7f523475
+Node: GNU Free Documentation License\7f543213
+Node: Indexes\7f568393
+Node: Builtin Index\7f568847
+Node: Reserved Word Index\7f575948
+Node: Variable Index\7f578396
+Node: Function Index\7f595671
+Node: Concept Index\7f609530
\1f
End Tag Table
-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
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]
\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
.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
.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
.@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 ][]
.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 ][]
.@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
.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
.@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[]
.@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 '[],
.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
.@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
-texlive/fonts/type1/public/amsfonts/cm/cmtt9.pfb></opt/local/share/texmf-texli
ve/fonts/type1/public/cm-super/sfrm1095.pfb></opt/local/share/texmf-texlive/fon
ts/type1/public/cm-super/sfrm1440.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)
\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}}
\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}}
\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}
\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}
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
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.
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.
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
@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{)}.
@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
@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{>}.
@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
@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
@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.
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
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{!}
@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.
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
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.
@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
@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.
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,
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
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
@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
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
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
@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{;;&}.
@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
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}.
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 ]]
[[ @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
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
@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
@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.
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.
@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
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
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.
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-
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
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}
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
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
@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}
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
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}.
@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
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
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
($*) 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.
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).
@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 $!
@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
@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}.
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
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{-},
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.
@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}
@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
@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}
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}.
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.
@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
$ 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
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=
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}@}
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.
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{@@},
@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
@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
@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}
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.
(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.
@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} ))
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
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.
@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}
@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
@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.
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
@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
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
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,
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
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
@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.
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.
@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:
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
@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:
>@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
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:
@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
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{\<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.
+
@subsection Here Strings
A variant of here documents, the format is:
@example
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).
@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
[@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
@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.
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
@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
@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
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
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,
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,
@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.
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.
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
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.
@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
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}
(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.
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}.
. [-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};
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
@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.
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
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
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.
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.
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.
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
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
false
@end example
-Does nothing, returns a non-zero status.
+Does nothing; returns a non-zero status.
@item getopts
@btindex getopts
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,
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{?}.
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.
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
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.
@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.
@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.
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}.
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.
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}
@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.
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.
@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.
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,
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.
@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
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
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
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.
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
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
@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.
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}.
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
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.
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
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}
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
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.
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)
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
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
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}.
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:
@var{HHHHHHHH} (one to eight hex digits)
@end table
+@code{echo} writes any unrecognized backslash-escaped characters unchanged.
+
@item enable
@btindex enable
@example
@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,
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:
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
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.
[-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.
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
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
@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
[-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}.
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.
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,
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
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
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.
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;
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
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
@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
@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.
@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
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.
@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}.
@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
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:
@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.
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.
@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}).
@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
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.
@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,
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:
@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
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
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
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
@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
@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
@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
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
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
@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.
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
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.
@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.
@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}
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.
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
@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.
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
@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
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
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,
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.
@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}
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
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
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
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
@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
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
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.
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}
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}.
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.
@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
@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.
@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.
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,
@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.
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.
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
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.
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.
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
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.
@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
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
@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}).
@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.
@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}
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
@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
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
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.
@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.
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,
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?
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
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
@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
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
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.
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
(@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
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
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.
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
@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.
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.
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
(@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
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.
@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}
@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}
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
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}),
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
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}
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
@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
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
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,
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
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
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.
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
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,
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
@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
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.
@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}:
@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.
@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
@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}
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
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).
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.
@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);
@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)
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
@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
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
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
@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.
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
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,
@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
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
@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
@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.
@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
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
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}:
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}.
@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
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}:
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
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}).
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
@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.
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}
@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
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
@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
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
@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
@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
(@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.
@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
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.
@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
@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
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.
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}.
@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
@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}
\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}}
\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}
s\bso\bou\bur\brc\bce\be [-\b-p\bp _\bp_\ba_\bt_\bh] _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
The .\b. command (s\bso\bou\bur\brc\bce\be) reads and execute commands from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
in the current shell environment and returns the exit status of
- the last command executed from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be. If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be does not
- contain a slash, .\b. searchs for it. If the -\b-p\bp option is sup-
- plied, .\b. treats _\bp_\ba_\bt_\bh as a colon-separated list of directories
- in which to find _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be; otherwise, .\b. uses the entries in
- P\bPA\bAT\bTH\bH to find the directory containing _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be. _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be does
- not need to be executable. When b\bba\bas\bsh\bh is not in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, it
- searches the current directory if no file is found in P\bPA\bAT\bTH\bH, but
- does not search the current directory if -\b-p\bp is supplied. If the
- s\bso\bou\bur\brc\bce\bep\bpa\bat\bth\bh option to the s\bsh\bho\bop\bpt\bt builtin command is turned off, .\b.
- does not search P\bPA\bAT\bTH\bH. If any _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs are supplied, they be-
- come the positional parameters when _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is executed. Oth-
- erwise the positional parameters are unchanged. If the -\b-T\bT op-
- tion is enabled, .\b. inherits any trap on D\bDE\bEB\bBU\bUG\bG; if it is not, any
- D\bDE\bEB\bBU\bUG\bG trap string is saved and restored around the call to .\b.,
- and .\b. unsets the D\bDE\bEB\bBU\bUG\bG trap while it executes. If -\b-T\bT is not
- set, and the sourced file changes the D\bDE\bEB\bBU\bUG\bG trap, the new value
- is retained when .\b. completes. The return status is the status
- of the last command exited within the script (0 if no commands
- are executed), and false if _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is not found or cannot be
- read.
+ the last command executed from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be.
+
+ If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be does not contain a slash, .\b. searchs for it. If the
+ -\b-p\bp option is supplied, .\b. treats _\bp_\ba_\bt_\bh as a colon-separated list
+ of directories in which to find _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be; otherwise, .\b. uses the
+ entries in P\bPA\bAT\bTH\bH to find the directory containing _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be.
+ _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be does not need to be executable. When b\bba\bas\bsh\bh is not in
+ _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, it searches the current directory if _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is not
+ found in P\bPA\bAT\bTH\bH, but does not search the current directory if -\b-p\bp
+ is supplied. If the s\bso\bou\bur\brc\bce\bep\bpa\bat\bth\bh option to the s\bsh\bho\bop\bpt\bt builtin com-
+ mand is turned off, .\b. does not search P\bPA\bAT\bTH\bH.
+
+ If any _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs are supplied, they become the positional para-
+ meters when _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is executed. Otherwise the positional pa-
+ rameters are unchanged.
+
+ If the -\b-T\bT option is enabled, .\b. inherits any trap on D\bDE\bEB\bBU\bUG\bG; if it
+ is not, any D\bDE\bEB\bBU\bUG\bG trap string is saved and restored around the
+ call to .\b., and .\b. unsets the D\bDE\bEB\bBU\bUG\bG trap while it executes. If -\b-T\bT
+ is not set, and the sourced file changes the D\bDE\bEB\bBU\bUG\bG trap, the new
+ value persists after .\b. completes. The return status is the sta-
+ tus of the last command executed from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be (0 if no commands
+ are executed), and non-zero if _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is not found or cannot
+ be read.
a\bal\bli\bia\bas\bs [-\b-p\bp] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ...]
- A\bAl\bli\bia\bas\bs with no arguments or with the -\b-p\bp option prints the list of
- aliases in the form a\bal\bli\bia\bas\bs _\bn_\ba_\bm_\be=_\bv_\ba_\bl_\bu_\be on standard output. When
- arguments are supplied, an alias is defined for each _\bn_\ba_\bm_\be whose
- _\bv_\ba_\bl_\bu_\be is given. A trailing space in _\bv_\ba_\bl_\bu_\be causes the next word
- to be checked for alias substitution when the alias is expanded.
- For each _\bn_\ba_\bm_\be in the argument list for which no _\bv_\ba_\bl_\bu_\be is sup-
- plied, the name and value of the alias is printed. A\bAl\bli\bia\bas\bs re-
- turns true unless a _\bn_\ba_\bm_\be is given for which no alias has been
- defined.
+ With no arguments or with the -\b-p\bp option,a\bal\bli\bia\bas\bs prints the list of
+ aliases in the form a\bal\bli\bia\bas\bs _\bn_\ba_\bm_\be=_\bv_\ba_\bl_\bu_\be on standard output. When
+ arguments are supplied, define an alias for each _\bn_\ba_\bm_\be whose
+ _\bv_\ba_\bl_\bu_\be is given. A trailing space in _\bv_\ba_\bl_\bu_\be causes the next word
+ to be checked for alias substitution when the alias is expanded
+ during command parsing. For each _\bn_\ba_\bm_\be in the argument list for
+ which no _\bv_\ba_\bl_\bu_\be is supplied, print the name and value of the
+ alias _\bn_\ba_\bm_\be. a\bal\bli\bia\bas\bs returns true unless a _\bn_\ba_\bm_\be is given (without
+ a corresponding =_\bv_\ba_\bl_\bu_\be) for which no alias has been defined.
b\bbg\bg [_\bj_\bo_\bb_\bs_\bp_\be_\bc ...]
Resume each suspended job _\bj_\bo_\bb_\bs_\bp_\be_\bc in the background, as if it
b\bbi\bin\bnd\bd [-\b-m\bm _\bk_\be_\by_\bm_\ba_\bp] _\bk_\be_\by_\bs_\be_\bq:_\br_\be_\ba_\bd_\bl_\bi_\bn_\be_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd
b\bbi\bin\bnd\bd _\br_\be_\ba_\bd_\bl_\bi_\bn_\be_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b-_\bl_\bi_\bn_\be
Display current r\bre\bea\bad\bdl\bli\bin\bne\be key and function bindings, bind a key
- sequence to a r\bre\bea\bad\bdl\bli\bin\bne\be function or macro, or set a r\bre\bea\bad\bdl\bli\bin\bne\be
- variable. Each non-option argument is a command as it would ap-
- pear in a r\bre\bea\bad\bdl\bli\bin\bne\be initialization file such as _\b._\bi_\bn_\bp_\bu_\bt_\br_\bc, 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 r\bre\bea\bad\bdl\bli\bin\bne\be initialization file or that
- would be supplied as individual arguments to a b\bbi\bin\bnd\bd command.
- Options, if supplied, have the following meanings:
+ sequence to a r\bre\bea\bad\bdl\bli\bin\bne\be function or macro or to a shell command,
+ or set a r\bre\bea\bad\bdl\bli\bin\bne\be variable. Each non-option argument is a key
+ binding or command as it would appear in a r\bre\bea\bad\bdl\bli\bin\bne\be initializa-
+ tion file such as _\b._\bi_\bn_\bp_\bu_\bt_\br_\bc, 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 r\bre\bea\bad\bdl\bli\bin\bne\be initialization file or that would be supplied as in-
+ dividual arguments to a b\bbi\bin\bnd\bd command. Options, if supplied,
+ have the following meanings:
-\b-m\bm _\bk_\be_\by_\bm_\ba_\bp
Use _\bk_\be_\by_\bm_\ba_\bp as the keymap to be affected by the subsequent
bindings. Acceptable _\bk_\be_\by_\bm_\ba_\bp names are _\be_\bm_\ba_\bc_\bs_\b, _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\b-
_\bd_\ba_\br_\bd.
-\b-l\bl List the names of all r\bre\bea\bad\bdl\bli\bin\bne\be functions.
-\b-p\bp Display r\bre\bea\bad\bdl\bli\bin\bne\be function names and bindings in such a
- way that they can be re-read. If arguments remain after
- option processing, b\bbi\bin\bnd\bd treats them as readline command
- names and restricts output to those names.
+ way that they can be used as an argument to a subsequent
+ b\bbi\bin\bnd\bd command or in a r\bre\bea\bad\bdl\bli\bin\bne\be initialization file. If
+ arguments remain after option processing, b\bbi\bin\bnd\bd treats
+ them as readline command names and restricts output to
+ those names.
-\b-P\bP List current r\bre\bea\bad\bdl\bli\bin\bne\be function names and bindings. If
arguments remain after option processing, b\bbi\bin\bnd\bd treats
them as readline command names and restricts output to
those names.
-\b-s\bs Display r\bre\bea\bad\bdl\bli\bin\bne\be 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 b\bbi\bin\bnd\bd command or in a r\bre\bea\bad\bd-\b-
+ l\bli\bin\bne\be initialization file.
-\b-S\bS Display r\bre\bea\bad\bdl\bli\bin\bne\be key sequences bound to macros and the
strings they output.
-\b-v\bv Display r\bre\bea\bad\bdl\bli\bin\bne\be 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 b\bbi\bin\bnd\bd
+ command or in a r\bre\bea\bad\bdl\bli\bin\bne\be initialization file.
-\b-V\bV List current r\bre\bea\bad\bdl\bli\bin\bne\be variable names and values.
-\b-f\bf _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
Read key bindings from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be.
-\b-q\bq _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn
- Query about which keys invoke the named _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn.
+ Display key sequences that invoke the named r\bre\bea\bad\bdl\bli\bin\bne\be
+ _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn.
-\b-u\bu _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn
- Unbind all keys bound to the named _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn.
+ Unbind all key sequences bound to the named r\bre\bea\bad\bdl\bli\bin\bne\be
+ _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn.
-\b-r\br _\bk_\be_\by_\bs_\be_\bq
Remove any current binding for _\bk_\be_\by_\bs_\be_\bq.
-\b-x\bx _\bk_\be_\by_\bs_\be_\bq[\b[:\b: ]\b]_\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd
enclosing double quotes are optional, and r\bre\bea\bad\bdl\bli\bin\bne\be 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 _\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\b-
- _\bm_\ba_\bn_\bd is executed, the shell sets the R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_L\bLI\bIN\bNE\bE vari-
- able to the contents of the r\bre\bea\bad\bdl\bli\bin\bne\be line buffer and the
- R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_P\bPO\bOI\bIN\bNT\bT and R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_M\bMA\bAR\bRK\bK 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 R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_A\bAR\bRG\bGU\bU-\b-
- M\bME\bEN\bNT\bT variable. If there was no argument, that variable
- is not set. If the executed command changes the value of
- any of R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_L\bLI\bIN\bNE\bE, R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_P\bPO\bOI\bIN\bNT\bT, or R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_M\bMA\bAR\bRK\bK,
- those new values will be reflected in the editing state.
+ ment, it should be enclosed in single quotes. When
+ _\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd is executed, the shell sets the R\bRE\bEA\bAD\bD-\b-
+ L\bLI\bIN\bNE\bE_\b_L\bLI\bIN\bNE\bE variable to the contents of the r\bre\bea\bad\bdl\bli\bin\bne\be line
+ buffer and the R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_P\bPO\bOI\bIN\bNT\bT and R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_M\bMA\bAR\bRK\bK 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 R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_A\bAR\bRG\bGU\bUM\bME\bEN\bNT\bT variable. If there was no argu-
+ ment, that variable is not set. If the executed command
+ changes the value of any of R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_L\bLI\bIN\bNE\bE, R\bRE\bEA\bAD\bD-\b-
+ L\bLI\bIN\bNE\bE_\b_P\bPO\bOI\bIN\bNT\bT, or R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_M\bMA\bAR\bRK\bK, those new values will be
+ reflected in the editing state.
-\b-X\bX 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.
b\bbr\bre\bea\bak\bk [_\bn]
- Exit from within a f\bfo\bor\br, w\bwh\bhi\bil\ble\be, u\bun\bnt\bti\bil\bl, or s\bse\bel\ble\bec\bct\bt loop. If _\bn is
- specified, break _\bn levels. _\bn must be >= 1. If _\bn is greater
- than the number of enclosing loops, all enclosing loops are ex-
- ited. The return value is 0 unless _\bn is not greater than or
- equal to 1.
+ Exit from within a f\bfo\bor\br, w\bwh\bhi\bil\ble\be, u\bun\bnt\bti\bil\bl, or s\bse\bel\ble\bec\bct\bt loop. If _\bn is
+ specified, b\bbr\bre\bea\bak\bk exits _\bn enclosing loops. _\bn must be >= 1. If _\bn
+ is greater than the number of enclosing loops, all enclosing
+ loops are exited. The return value is 0 unless _\bn is not greater
+ than or equal to 1.
b\bbu\bui\bil\blt\bti\bin\bn _\bs_\bh_\be_\bl_\bl_\b-_\bb_\bu_\bi_\bl_\bt_\bi_\bn [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
- Execute the specified shell builtin, passing it _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs, 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 c\bcd\bd builtin is
- commonly redefined this way. The return status is false if
- _\bs_\bh_\be_\bl_\bl_\b-_\bb_\bu_\bi_\bl_\bt_\bi_\bn is not a shell builtin command.
+ Execute the specified shell builtin _\bs_\bh_\be_\bl_\bl_\b-_\bb_\bu_\bi_\bl_\bt_\bi_\bn, passing it
+ _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs, 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 c\bcd\bd builtin is commonly redefined this way. The return sta-
+ tus is false if _\bs_\bh_\be_\bl_\bl_\b-_\bb_\bu_\bi_\bl_\bt_\bi_\bn is not a shell builtin command.
c\bca\bal\bll\ble\ber\br [_\be_\bx_\bp_\br]
Returns the context of any active subroutine call (a shell func-
- tion or a script executed with the .\b. or s\bso\bou\bur\brc\bce\be builtins). With-
- out _\be_\bx_\bp_\br, c\bca\bal\bll\ble\ber\br displays the line number and source filename of
- the current subroutine call. If a non-negative integer is sup-
- plied as _\be_\bx_\bp_\br, c\bca\bal\bll\ble\ber\br 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 .\b. or s\bso\bou\bur\brc\bce\be builtins).
+
+ Without _\be_\bx_\bp_\br, c\bca\bal\bll\ble\ber\br displays the line number and source file-
+ name of the current subroutine call. If a non-negative integer
+ is supplied as _\be_\bx_\bp_\br, c\bca\bal\bll\ble\ber\br 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 _\be_\bx_\bp_\br does not correspond to a valid position in
the call stack.
c\bcd\bd [-\b-L\bL|[-\b-P\bP [-\b-e\be]]] [-@] [_\bd_\bi_\br]
Change the current directory to _\bd_\bi_\br. if _\bd_\bi_\br is not supplied,
- the value of the H\bHO\bOM\bME\bE shell variable is the default. The vari-
- able C\bCD\bDP\bPA\bAT\bTH\bH defines the search path for the directory containing
- _\bd_\bi_\br: the shell searches each directory name in C\bCD\bDP\bPA\bAT\bTH\bH for _\bd_\bi_\br.
- Alternative directory names in C\bCD\bDP\bPA\bAT\bTH\bH are separated by a colon
- (:). A null directory name in C\bCD\bDP\bPA\bAT\bTH\bH is the same as the current
- directory, i.e., If _\bd_\bi_\br begins with a slash (/), then C\bCD\bDP\bPA\bAT\bTH\bH is
- not used. The -\b-P\bP option causes c\bcd\bd to use the physical directory
- structure by resolving symbolic links while traversing _\bd_\bi_\br and
- before processing instances of _\b._\b. in _\bd_\bi_\br (see also the -\b-P\bP option
- to the s\bse\bet\bt builtin command); the -\b-L\bL option forces symbolic links
- to be followed by resolving the link after processing instances
- of _\b._\b. in _\bd_\bi_\br. If _\b._\b. appears in _\bd_\bi_\br, it is processed by removing
- the immediately previous pathname component from _\bd_\bi_\br, back to a
- slash or the beginning of _\bd_\bi_\br. If the -\b-e\be option is supplied
- with -\b-P\bP, and the current working directory cannot be success-
- fully determined after a successful directory change, c\bcd\bd will
- return an unsuccessful status. On systems that support it, the
- -\b-@\b@ option presents the extended attributes associated with a
- file as a directory. An argument of -\b- is converted to $\b$O\bOL\bLD\bDP\bPW\bWD\bD
- before the directory change is attempted. If a non-empty direc-
- tory name from C\bCD\bDP\bPA\bAT\bTH\bH is used, or if -\b- 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, c\bcd\bd sets the value of the P\bPW\bWD\bD
- environment variable to the new directory name, and sets the
+ the value of the H\bHO\bOM\bME\bE shell variable is used as _\bd_\bi_\br. The vari-
+ able C\bCD\bDP\bPA\bAT\bTH\bH exists, c\bcd\bd uses it as a search path: the shell
+ searches each directory name in C\bCD\bDP\bPA\bAT\bTH\bH for _\bd_\bi_\br. Alternative di-
+ rectory names in C\bCD\bDP\bPA\bAT\bTH\bH are separated by a colon (:). A null
+ directory name in C\bCD\bDP\bPA\bAT\bTH\bH is the same as the current directory,
+ i.e., If _\bd_\bi_\br begins with a slash (/), then C\bCD\bDP\bPA\bAT\bTH\bH is not used.
+
+ The -\b-P\bP option causes c\bcd\bd to use the physical directory structure
+ by resolving symbolic links while traversing _\bd_\bi_\br and before pro-
+ cessing instances of _\b._\b. in _\bd_\bi_\br (see also the -\b-P\bP option to the
+ s\bse\bet\bt builtin command).
+
+ The -\b-L\bL option forces symbolic links to be followed by resolving
+ the link after processing instances of _\b._\b. in _\bd_\bi_\br. If _\b._\b. appears
+ in _\bd_\bi_\br, it is processed by removing the immediately previous
+ pathname component from _\bd_\bi_\br, back to a slash or the beginning of
+ _\bd_\bi_\br.
+
+ If the -\b-e\be option is supplied with -\b-P\bP, and the current working
+ directory cannot be successfully determined after a successful
+ directory change, c\bcd\bd will return a non-zero status.
+
+ On systems that support it, the -\b-@\b@ option presents the extended
+ attributes associated with a file as a directory.
+
+ An argument of -\b- is converted to $\b$O\bOL\bLD\bDP\bPW\bWD\bD before attempting the
+ directory change.
+
+ If c\bcd\bd uses a non-empty directory name from C\bCD\bDP\bPA\bAT\bTH\bH,\b, or if -\b- is
+ the first argument, and the directory change is successful, c\bcd\bd
+ writes the absolute pathname of the new working directory to the
+ standard output.
+
+ If the directory change is successful, c\bcd\bd sets the value of the
+ P\bPW\bWD\bD environment variable to the new directory name, and sets the
O\bOL\bLD\bDP\bPW\bWD\bD 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.
c\bco\bom\bmm\bma\ban\bnd\bd [-\b-p\bpV\bVv\bv] _\bc_\bo_\bm_\bm_\ba_\bn_\bd [_\ba_\br_\bg ...]
- Run _\bc_\bo_\bm_\bm_\ba_\bn_\bd with _\ba_\br_\bg_\bs suppressing the normal shell function
- lookup. Only builtin commands or commands found in the P\bPA\bAT\bTH\bH are
- executed. If the -\b-p\bp option is given, the search for _\bc_\bo_\bm_\bm_\ba_\bn_\bd is
- performed using a default value for P\bPA\bAT\bTH\bH that is guaranteed to
- find all of the standard utilities. If either the -\b-V\bV or -\b-v\bv op-
- tion is supplied, a description of _\bc_\bo_\bm_\bm_\ba_\bn_\bd is printed. The -\b-v\bv
- option causes a single word indicating the command or filename
- used to invoke _\bc_\bo_\bm_\bm_\ba_\bn_\bd to be displayed; the -\b-V\bV option produces a
- more verbose description. If the -\b-V\bV or -\b-v\bv option is supplied,
- the exit status is 0 if _\bc_\bo_\bm_\bm_\ba_\bn_\bd was found, and 1 if not. If
- neither option is supplied and an error occurred or _\bc_\bo_\bm_\bm_\ba_\bn_\bd can-
- not be found, the exit status is 127. Otherwise, the exit sta-
- tus of the c\bco\bom\bmm\bma\ban\bnd\bd builtin is the exit status of _\bc_\bo_\bm_\bm_\ba_\bn_\bd.
+ The c\bco\bom\bmm\bma\ban\bnd\bd builtin runs _\bc_\bo_\bm_\bm_\ba_\bn_\bd with _\ba_\br_\bg_\bs suppressing the nor-
+ mal shell function lookup for _\bc_\bo_\bm_\bm_\ba_\bn_\bd. Only builtin commands or
+ commands found in the P\bPA\bAT\bTH\bH named _\bc_\bo_\bm_\bm_\ba_\bn_\bd are executed. If the
+ -\b-p\bp option is supplied, the search for _\bc_\bo_\bm_\bm_\ba_\bn_\bd is performed using
+ a default value for P\bPA\bAT\bTH\bH that is guaranteed to find all of the
+ standard utilities.
+
+ If either the -\b-V\bV or -\b-v\bv option is supplied, c\bco\bom\bmm\bma\ban\bnd\bd prints a de-
+ scription of _\bc_\bo_\bm_\bm_\ba_\bn_\bd. The -\b-v\bv option displays a single word in-
+ dicating the command or filename used to invoke _\bc_\bo_\bm_\bm_\ba_\bn_\bd; the -\b-V\bV
+ option produces a more verbose description.
+
+ If the -\b-V\bV or -\b-v\bv option is supplied, the exit status is zero if
+ _\bc_\bo_\bm_\bm_\ba_\bn_\bd was found, and non-zero if not. If neither option is
+ supplied and an error occurred or _\bc_\bo_\bm_\bm_\ba_\bn_\bd cannot be found, the
+ exit status is 127. Otherwise, the exit status of the c\bco\bom\bmm\bma\ban\bnd\bd
+ builtin is the exit status of _\bc_\bo_\bm_\bm_\ba_\bn_\bd.
c\bco\bom\bmp\bpg\bge\ben\bn [-\b-V\bV _\bv_\ba_\br_\bn_\ba_\bm_\be] [_\bo_\bp_\bt_\bi_\bo_\bn] [_\bw_\bo_\br_\bd]
- Generate possible completion matches for _\bw_\bo_\br_\bd according to the
- _\bo_\bp_\bt_\bi_\bo_\bns, which may be any option accepted by the c\bco\bom\bmp\bpl\ble\bet\bte\be
+ Generate possible completion matches for _\bw_\bo_\br_\bd according to the
+ _\bo_\bp_\bt_\bi_\bo_\bns, which may be any option accepted by the c\bco\bom\bmp\bpl\ble\bet\bte\be
builtin with the exceptions of -\b-p\bp, -\b-r\br, -\b-D\bD, -\b-E\bE, and -\b-I\bI, and write
- the matches to the standard output. If the -\b-V\bV option is sup-
- plied, c\bco\bom\bmp\bpg\bge\ben\bn stores the generated completions into the indexed
- array variable _\bv_\ba_\br_\bn_\ba_\bm_\be instead of writing them to the standard
- output. When using the -\b-F\bF or -\b-C\bC 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 -\b-V\bV option is supplied, c\bco\bom\bmp\bpg\bge\ben\bn stores the generated com-
+ pletions into the indexed array variable _\bv_\ba_\br_\bn_\ba_\bm_\be instead of
+ writing them to the standard output.
+
+ When using the -\b-F\bF or -\b-C\bC 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 _\bw_\bo_\br_\bd is specified,
- only those completions matching _\bw_\bo_\br_\bd will be displayed.
+ tion specification with the same flags. If _\bw_\bo_\br_\bd is specified,
+ only those completions matching _\bw_\bo_\br_\bd will be displayed or
+ stored.
The return value is true unless an invalid option is supplied,
or no matches were generated.
line.
p\bpl\blu\bus\bsd\bdi\bir\brs\bs
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.
-\b-A\bA _\ba_\bc_\bt_\bi_\bo_\bn
The _\ba_\bc_\bt_\bi_\bo_\bn may be one of the following to generate a
list of possible completions:
guments are being completed, the second argument ($\b$2\b2) is
the word being completed, and the third argument ($\b$3\b3) 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 C\bCO\bOM\bMP\bPR\bRE\bEP\bPL\bLY\bY
- array variable.
+ rent command line. When _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn finishes, the possible
+ completions are retrieved from the value of the C\bCO\bOM\bMP\bPR\bRE\bE-\b-
+ P\bPL\bLY\bY array variable.
-\b-G\bG _\bg_\bl_\bo_\bb_\bp_\ba_\bt
- The pathname expansion pattern _\bg_\bl_\bo_\bb_\bp_\ba_\bt is expanded to
- generate the possible completions.
+ Expand the pathname expansion pattern _\bg_\bl_\bo_\bb_\bp_\ba_\bt to gener-
+ ate the possible completions.
-\b-P\bP _\bp_\br_\be_\bf_\bi_\bx
- _\bp_\br_\be_\bf_\bi_\bx is added at the beginning of each possible com-
- pletion after all other options have been applied.
+ Add _\bp_\br_\be_\bf_\bi_\bx to the beginning of each possible completion
+ after all other options have been applied.
-\b-S\bS _\bs_\bu_\bf_\bf_\bi_\bx
- _\bs_\bu_\bf_\bf_\bi_\bx is appended to each possible completion after all
+ Append _\bs_\bu_\bf_\bf_\bi_\bx to each possible completion after all
other options have been applied.
-\b-W\bW _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt
The _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt is split using the characters in the I\bIF\bFS\bS
- special variable as delimiters, and each resultant word
+ special variable as delimiters, and each resulting word
is expanded. Shell quoting is honored within _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt,
in order to provide a mechanism for the words to contain
shell metacharacters or characters in the value of I\bIF\bFS\bS.
c\bco\bom\bmp\bpo\bop\bpt\bt [-\b-o\bo _\bo_\bp_\bt_\bi_\bo_\bn] [-\b-D\bDE\bEI\bI] [+\b+o\bo _\bo_\bp_\bt_\bi_\bo_\bn] [_\bn_\ba_\bm_\be]
Modify completion options for each _\bn_\ba_\bm_\be according to the _\bo_\bp_\b-
_\bt_\bi_\bo_\bns, or for the currently-executing completion if no _\bn_\ba_\bm_\bes are
- supplied. If no _\bo_\bp_\bt_\bi_\bo_\bns are given, display the completion op-
- tions for each _\bn_\ba_\bm_\be or the current completion. The possible
+ supplied. If no _\bo_\bp_\bt_\bi_\bo_\bns are supplied, display the completion
+ options for each _\bn_\ba_\bm_\be or the current completion. The possible
values of _\bo_\bp_\bt_\bi_\bo_\bn are those valid for the c\bco\bom\bmp\bpl\ble\bet\bte\be builtin de-
scribed above. The -\b-D\bD option indicates that other supplied op-
tions should apply to the command completion; that is, comple-
assignment word on the line, or after a command delimiter such
as ;\b; or |\b|, which is usually command name completion.
+ If multiple options are supplied, the -\b-D\bD option takes precedence
+ over -\b-E\bE, and both take precedence over -\b-I\bI.
+
The return value is true unless an invalid option is supplied,
an attempt is made to modify the options for a _\bn_\ba_\bm_\be for which no
completion specification exists, or an output error occurs.
c\bco\bon\bnt\bti\bin\bnu\bue\be [_\bn]
- Resume the next iteration of the enclosing f\bfo\bor\br, w\bwh\bhi\bil\ble\be, u\bun\bnt\bti\bil\bl, or
- s\bse\bel\ble\bec\bct\bt loop. If _\bn is specified, resume at the _\bnth enclosing
- loop. _\bn must be >= 1. If _\bn is greater than the number of en-
- closing loops, the shell resumes the last enclosing loop (the
- loop). The return value is 0 unless _\bn is not greater than or
- equal to 1.
+ c\bco\bon\bnt\bti\bin\bnu\bue\be resumes the next iteration of the enclosing f\bfo\bor\br, w\bwh\bhi\bil\ble\be,
+ u\bun\bnt\bti\bil\bl, or s\bse\bel\ble\bec\bct\bt loop. If _\bn is specified, b\bba\bas\bsh\bh resumes the _\bnth
+ enclosing loop. _\bn must be >= 1. If _\bn is greater than the num-
+ ber of enclosing loops, the shell resumes the last enclosing
+ loop (the loop). The return value is 0 unless _\bn is not greater
+ than or equal to 1.
d\bde\bec\bcl\bla\bar\bre\be [-\b-a\baA\bAf\bfF\bFg\bgi\biI\bIl\bln\bnr\brt\btu\bux\bx] [-\b-p\bp] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ...]
t\bty\byp\bpe\bes\bse\bet\bt [-\b-a\baA\bAf\bfF\bFg\bgi\biI\bIl\bln\bnr\brt\btu\bux\bx] [-\b-p\bp] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ...]
Declare variables and/or give them attributes. If no _\bn_\ba_\bm_\bes are
- given then display the values of variables. The -\b-p\bp option will
- display the attributes and values of each _\bn_\ba_\bm_\be. When -\b-p\bp is used
- with _\bn_\ba_\bm_\be arguments, additional options, other than -\b-f\bf and -\b-F\bF,
- are ignored. When -\b-p\bp is supplied without _\bn_\ba_\bm_\be 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 -\b-p\bp, d\bde\bec\bcl\bla\bar\bre\be will display the attrib-
- utes and values of all shell variables. The -\b-f\bf option will re-
- strict the display to shell functions. The -\b-F\bF option inhibits
- the display of function definitions; only the function name and
- attributes are printed. If the e\bex\bxt\btd\bde\beb\bbu\bug\bg shell option is enabled
- using s\bsh\bho\bop\bpt\bt, the source file name and line number where each
- _\bn_\ba_\bm_\be is defined are displayed as well. The -\b-F\bF option implies
- -\b-f\bf. The -\b-g\bg option forces variables to be created or modified at
- the global scope, even when d\bde\bec\bcl\bla\bar\bre\be is executed in a shell func-
- tion. It is ignored in all other cases. The -\b-I\bI option causes
- local variables to inherit the attributes (except the _\bn_\ba_\bm_\be_\br_\be_\bf
- attribute) and value of any existing variable with the same _\bn_\ba_\bm_\be
- 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:
- -\b-a\ba Each _\bn_\ba_\bm_\be is an indexed array variable (see A\bAr\brr\bra\bay\bys\bs in
+ given then display the values of variables or functions. The -\b-p\bp
+ option will display the attributes and values of each _\bn_\ba_\bm_\be.
+ When -\b-p\bp is used with _\bn_\ba_\bm_\be arguments, additional options, other
+ than -\b-f\bf and -\b-F\bF, are ignored.
+
+ When -\b-p\bp is supplied without _\bn_\ba_\bm_\be arguments, d\bde\bec\bcl\bla\bar\bre\be will display
+ the attributes and values of all variables having the attributes
+ specified by the additional options. If no other options are
+ supplied with -\b-p\bp, d\bde\bec\bcl\bla\bar\bre\be will display the attributes and values
+ of all shell variables. The -\b-f\bf option restricts the display to
+ shell functions.
+
+ The -\b-F\bF option inhibits the display of function definitions; only
+ the function name and attributes are printed. If the e\bex\bxt\btd\bde\beb\bbu\bug\bg
+ shell option is enabled using s\bsh\bho\bop\bpt\bt, the source file name and
+ line number where each _\bn_\ba_\bm_\be is defined are displayed as well.
+ The -\b-F\bF option implies -\b-f\bf.
+
+ The -\b-g\bg option forces variables to be created or modified at the
+ global scope, even when d\bde\bec\bcl\bla\bar\bre\be is executed in a shell function.
+ It is ignored when d\bde\bec\bcl\bla\bar\bre\be is not executed in a shell function.
+
+ The -\b-I\bI option causes local variables to inherit the attributes
+ (except the _\bn_\ba_\bm_\be_\br_\be_\bf attribute) and value of any existing vari-
+ able with the same _\bn_\ba_\bm_\be 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:
+ -\b-a\ba Each _\bn_\ba_\bm_\be is an indexed array variable (see A\bAr\brr\bra\bay\bys\bs in
_\bb_\ba_\bs_\bh(1)).
-\b-A\bA Each _\bn_\ba_\bm_\be is an associative array variable (see A\bAr\brr\bra\bay\bys\bs in
_\bb_\ba_\bs_\bh(1)).
- -\b-f\bf Use function names only.
+ -\b-f\bf Each _\bn_\ba_\bm_\be refers to a shell function.
-\b-i\bi The variable is treated as an integer; arithmetic evalua-
- tion (see A\bAR\bRI\bIT\bTH\bHM\bME\bET\bTI\bIC\bC E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN in _\bb_\ba_\bs_\bh(1)) is performed
+ tion (see A\bAR\bRI\bIT\bTH\bHM\bME\bET\bTI\bIC\bC E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN in _\bb_\ba_\bs_\bh(1)) is performed
when the variable is assigned a value.
- -\b-l\bl When the variable is assigned a value, all upper-case
- characters are converted to lower-case. The upper-case
+ -\b-l\bl When the variable is assigned a value, all upper-case
+ characters are converted to lower-case. The upper-case
attribute is disabled.
- -\b-n\bn Give each _\bn_\ba_\bm_\be the _\bn_\ba_\bm_\be_\br_\be_\bf attribute, making it a name
- reference to another variable. That other variable is
- defined by the value of _\bn_\ba_\bm_\be. All references, assign-
- ments, and attribute modifications to _\bn_\ba_\bm_\be, except those
- using or changing the -\b-n\bn attribute itself, are performed
- on the variable referenced by _\bn_\ba_\bm_\be's value. The nameref
+ -\b-n\bn Give each _\bn_\ba_\bm_\be the _\bn_\ba_\bm_\be_\br_\be_\bf attribute, making it a name
+ reference to another variable. That other variable is
+ defined by the value of _\bn_\ba_\bm_\be. All references, assign-
+ ments, and attribute modifications to _\bn_\ba_\bm_\be, except those
+ using or changing the -\b-n\bn attribute itself, are performed
+ on the variable referenced by _\bn_\ba_\bm_\be's value. The nameref
attribute cannot be applied to array variables.
-\b-r\br Make _\bn_\ba_\bm_\bes readonly. These names cannot then be assigned
values by subsequent assignment statements or unset.
-\b-t\bt Give each _\bn_\ba_\bm_\be the _\bt_\br_\ba_\bc_\be attribute. Traced functions in-
- herit the D\bDE\bEB\bBU\bUG\bG and R\bRE\bET\bTU\bUR\bRN\bN traps from the calling shell.
+ herit the D\bDE\bEB\bBU\bUG\bG and R\bRE\bET\bTU\bUR\bRN\bN traps from the calling shell.
The trace attribute has no special meaning for variables.
- -\b-u\bu When the variable is assigned a value, all lower-case
- characters are converted to upper-case. The lower-case
+ -\b-u\bu When the variable is assigned a value, all lower-case
+ characters are converted to upper-case. The lower-case
attribute is disabled.
- -\b-x\bx Mark _\bn_\ba_\bm_\bes for export to subsequent commands via the en-
- vironment.
-
- Using instead of turns off the attribute instead, with the ex-
- ceptions that +\b+a\ba and +\b+A\bA may not be used to destroy array vari-
- ables and +\b+r\br will not remove the readonly attribute. When used
- in a function, d\bde\bec\bcl\bla\bar\bre\be and t\bty\byp\bpe\bes\bse\bet\bt make each _\bn_\ba_\bm_\be local, as with
- the l\blo\boc\bca\bal\bl command, unless the -\b-g\bg option is supplied. If a vari-
- able name is followed by =_\bv_\ba_\bl_\bu_\be, the value of the variable is
- set to _\bv_\ba_\bl_\bu_\be. When using -\b-a\ba or -\b-A\bA 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
- A\bAr\brr\bra\bay\bys\bs in _\bb_\ba_\bs_\bh(1)), one of the _\bn_\ba_\bm_\be_\bs 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 -\b-f\bf.
+ -\b-x\bx Mark each _\bn_\ba_\bm_\be for export to subsequent commands via the
+ environment.
+
+ Using instead of turns off the specified attribute instead, with
+ the exceptions that +\b+a\ba and +\b+A\bA may not be used to destroy array
+ variables and +\b+r\br will not remove the readonly attribute.
+
+ When used in a function, d\bde\bec\bcl\bla\bar\bre\be and t\bty\byp\bpe\bes\bse\bet\bt make each _\bn_\ba_\bm_\be lo-
+ cal, as with the l\blo\boc\bca\bal\bl command, unless the -\b-g\bg option is sup-
+ plied. If a variable name is followed by =_\bv_\ba_\bl_\bu_\be, the value of
+ the variable is set to _\bv_\ba_\bl_\bu_\be. When using -\b-a\ba or -\b-A\bA 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 A\bAr\brr\bra\bay\bys\bs in _\bb_\ba_\bs_\bh(1)), one of the _\bn_\ba_\bm_\be_\bs 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 -\b-f\bf.
d\bdi\bir\brs\bs [\b[-\b-c\bcl\blp\bpv\bv]\b] [\b[+\b+_\bn]\b] [\b[-\b-_\bn]\b]
- 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 p\bpu\bus\bsh\bhd\bd command; the p\bpo\bop\bpd\bd command removes entries
- from the list. The current directory is always the first direc-
- tory in the stack.
- -\b-c\bc 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 p\bpu\bus\bsh\bhd\bd command; the p\bpo\bop\bpd\bd command removes entries from
+ the list. The current directory is always the first directory
+ in the stack.
+
+ Options, if supplied, have the following meanings:
+ -\b-c\bc Clears the directory stack by deleting all of the en-
tries.
- -\b-l\bl Produces a listing using full pathnames; the default
+ -\b-l\bl Produces a listing using full pathnames; the default
listing format uses a tilde to denote the home directory.
-\b-p\bp Print the directory stack with one entry per line.
- -\b-v\bv Print the directory stack with one entry per line, pre-
+ -\b-v\bv Print the directory stack with one entry per line, pre-
fixing each entry with its index in the stack.
+\b+_\bn Displays the _\bnth entry counting from the left of the list
shown by d\bdi\bir\brs\bs when invoked without options, starting with
zero.
- -\b-_\bn Displays the _\bnth entry counting from the right of the
+ -\b-_\bn Displays the _\bnth entry counting from the right of the
list shown by d\bdi\bir\brs\bs when invoked without options, starting
with zero.
- The return value is 0 unless an invalid option is supplied or _\bn
+ The return value is 0 unless an invalid option is supplied or _\bn
indexes beyond the end of the directory stack.
- d\bdi\bis\bso\bow\bwn\bn [-\b-a\bar\br] [-\b-h\bh] [_\bj_\bo_\bb_\bs_\bp_\be_\bc ... | _\bp_\bi_\bd ... ]
- Without options, remove each _\bj_\bo_\bb_\bs_\bp_\be_\bc from the table of active
- jobs. If _\bj_\bo_\bb_\bs_\bp_\be_\bc is not present, and neither the -\b-a\ba nor the -\b-r\br
- option is supplied, the _\bc_\bu_\br_\br_\be_\bn_\bt _\bj_\bo_\bb is used. If the -\b-h\bh option
- is given, each _\bj_\bo_\bb_\bs_\bp_\be_\bc is not removed from the table, but is
- marked so that S\bSI\bIG\bGH\bHU\bUP\bP is not sent to the job if the shell re-
- ceives a S\bSI\bIG\bGH\bHU\bUP\bP. If no _\bj_\bo_\bb_\bs_\bp_\be_\bc is supplied, the -\b-a\ba option means
- to remove or mark all jobs; the -\b-r\br option without a _\bj_\bo_\bb_\bs_\bp_\be_\bc ar-
- gument restricts operation to running jobs. The return value is
- 0 unless a _\bj_\bo_\bb_\bs_\bp_\be_\bc does not specify a valid job.
+ d\bdi\bis\bso\bow\bwn\bn [-\b-a\bar\br] [-\b-h\bh] [_\bi_\bd ...]
+ Without options, remove each _\bi_\bd from the table of active jobs.
+ Each _\bi_\bd may be a job specification _\bj_\bo_\bb_\bs_\bp_\be_\bc or a process ID _\bp_\bi_\bd;
+ if _\bi_\bd is a _\bp_\bi_\bd, d\bdi\bis\bso\bow\bwn\bn uses the job containing _\bp_\bi_\bd as _\bj_\bo_\bb_\bs_\bp_\be_\bc.
+ If _\bi_\bd is not present, and neither the -\b-a\ba nor the -\b-r\br option is
+ supplied, d\bdi\bis\bso\bow\bwn\bn removes the _\bc_\bu_\br_\br_\be_\bn_\bt _\bj_\bo_\bb. If the -\b-h\bh option is
+ supplied, the job corresponding to each _\bi_\bd is not removed from
+ the table, but is marked so that S\bSI\bIG\bGH\bHU\bUP\bP is not sent to the job
+ if the shell receives a S\bSI\bIG\bGH\bHU\bUP\bP.
+
+ If no _\bi_\bd is supplied, the -\b-a\ba option means to remove or mark all
+ jobs; the -\b-r\br option without an _\bi_\bd argument restricts operation
+ to running jobs.
+
+ The return value is 0 unless an _\bi_\bd does not specify a valid job.
e\bec\bch\bho\bo [-\b-n\bne\beE\bE] [_\ba_\br_\bg ...]
Output the _\ba_\br_\bgs, separated by spaces, followed by a newline.
The return status is 0 unless a write error occurs. If -\b-n\bn is
- specified, the trailing newline is suppressed. If the -\b-e\be option
- is given, interpretation of the following backslash-escaped
- characters is enabled. The -\b-E\bE option disables the interpreta-
- tion of these escape characters, even on systems where they are
- interpreted by default. The x\bxp\bpg\bg_\b_e\bec\bch\bho\bo shell option may be used
- to dynamically determine whether or not e\bec\bch\bho\bo interprets any op-
- tions and expands these escape characters by default. e\bec\bch\bho\bo does
- not interpret -\b--\b- to mean the end of options. e\bec\bch\bho\bo interprets
- the following escape sequences:
+ specified, the trailing newline is not printed.
+
+ If the -\b-e\be option is given, e\bec\bch\bho\bo interprets the following back-
+ slash-escaped characters. The -\b-E\bE option disables interpretation
+ of these escape characters, even on systems where they are in-
+ terpreted by default. The x\bxp\bpg\bg_\b_e\bec\bch\bho\bo shell option determines
+ whether or not e\bec\bch\bho\bo interprets any options and expands these es-
+ cape characters. e\bec\bch\bho\bo does not interpret -\b--\b- to mean the end of
+ options.
+
+ e\bec\bch\bho\bo interprets the following escape sequences:
\\b\a\ba alert (bell)
\\b\b\bb backspace
\\b\c\bc suppress further output
the Unicode (ISO/IEC 10646) character whose value is the
hexadecimal value _\bH_\bH_\bH_\bH_\bH_\bH_\bH_\bH (one to eight hex digits)
+ e\bec\bch\bho\bo writes any unrecognized backslash-escaped characters un-
+ changed.
+
e\ben\bna\bab\bbl\ble\be [-\b-a\ba] [-\b-d\bdn\bnp\bps\bs] [-\b-f\bf _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be] [_\bn_\ba_\bm_\be ...]
- 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 -\b-n\bn is used, each _\bn_\ba_\bm_\be is disabled; otherwise, _\bn_\ba_\bm_\be_\bs are en-
- abled. For example, to use the t\bte\bes\bst\bt binary found via the P\bPA\bAT\bTH\bH
- instead of the shell builtin version, run The -\b-f\bf option means to
- load the new builtin command _\bn_\ba_\bm_\be from shared object _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be,
- on systems that support dynamic loading. B\bBa\bas\bsh\bh will use the
- value of the B\bBA\bAS\bSH\bH_\b_L\bLO\bOA\bAD\bDA\bAB\bBL\bLE\bES\bS_\b_P\bPA\bAT\bTH\bH variable as a colon-separated
- list of directories in which to search for _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be, if _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
- does not contain a slash. The default is system-dependent, and
- may include to force a search of the current directory. The -\b-d\bd
- option will delete a builtin previously loaded with -\b-f\bf. If no
- _\bn_\ba_\bm_\be arguments are given, or if the -\b-p\bp 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 -\b-n\bn
- is supplied, only disabled builtins are printed. If -\b-a\ba is sup-
- plied, the list printed includes all builtins, with an indica-
- tion of whether or not each is enabled. If -\b-s\bs is supplied, the
- output is restricted to the POSIX _\bs_\bp_\be_\bc_\bi_\ba_\bl builtins. If no op-
- tions are supplied and a _\bn_\ba_\bm_\be is not a shell builtin, e\ben\bna\bab\bbl\ble\be
- will attempt to load _\bn_\ba_\bm_\be from a shared object named _\bn_\ba_\bm_\be, as if
- the command were The return value is 0 unless a _\bn_\ba_\bm_\be 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 -\b-n\bn is supplied, each _\bn_\ba_\bm_\be is disabled; otherwise, _\bn_\ba_\bm_\bes are
+ enabled. For example, to use the t\bte\bes\bst\bt binary found usin g P\bPA\bAT\bTH\bH
+ instead of the shell builtin version, run
+
+ If no _\bn_\ba_\bm_\be arguments are supplied, or if the -\b-p\bp 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 -\b-n\bn
+ is supplied, print only disabled builtins. If -\b-a\ba is supplied,
+ the list printed includes all builtins, with an indication of
+ whether or not each is enabled. The -\b-s\bs option means to restrict
+ the output to the POSIX _\bs_\bp_\be_\bc_\bi_\ba_\bl builtins.
+
+ The -\b-f\bf option means to load the new builtin command _\bn_\ba_\bm_\be from
+ shared object _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be, on systems that support dynamic loading.
+ If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be does not contain a slash, B\bBa\bas\bsh\bh will use the value of
+ the B\bBA\bAS\bSH\bH_\b_L\bLO\bOA\bAD\bDA\bAB\bBL\bLE\bES\bS_\b_P\bPA\bAT\bTH\bH variable as a colon-separated list of
+ directories in which to search for _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be. The default for
+ B\bBA\bAS\bSH\bH_\b_L\bLO\bOA\bAD\bDA\bAB\bBL\bLE\bES\bS_\b_P\bPA\bAT\bTH\bH is system-dependent, and may include to
+ force a search of the current directory. The -\b-d\bd option will
+ delete a builtin previously loaded with -\b-f\bf. If _\b-_\bs is used with
+ _\b-_\bf, the new builtin becomes a POSIX special builtin.
+
+ If no options are supplied and a _\bn_\ba_\bm_\be is not a shell builtin,
+ e\ben\bna\bab\bbl\ble\be will attempt to load _\bn_\ba_\bm_\be from a shared object named
+ _\bn_\ba_\bm_\be, as if the command were
+
+ The return value is 0 unless a _\bn_\ba_\bm_\be is not a shell builtin or
+ there is an error loading a new builtin from a shared object.
e\bev\bva\bal\bl [_\ba_\br_\bg ...]
- The _\ba_\br_\bgs 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 e\bev\bva\bal\bl. If there are
- no _\ba_\br_\bg_\bs, or only null arguments, e\bev\bva\bal\bl returns 0.
+ Concatenate the _\ba_\br_\bgs together into a single command, separating
+ them with spaces. B\bBa\bas\bsh\bh then reads and execute this command, and
+ returns its exit status as the return status of e\bev\bva\bal\bl. If there
+ are no _\ba_\br_\bg_\bs, or only null arguments, e\bev\bva\bal\bl returns 0.
e\bex\bxe\bec\bc [-\b-c\bcl\bl] [-\b-a\ba _\bn_\ba_\bm_\be] [_\bc_\bo_\bm_\bm_\ba_\bn_\bd [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]]
- If _\bc_\bo_\bm_\bm_\ba_\bn_\bd is specified, it replaces the shell. No new process
- is created. The _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs become the arguments to _\bc_\bo_\bm_\bm_\ba_\bn_\bd. If
- the -\b-l\bl option is supplied, the shell places a dash at the begin-
- ning of the zeroth argument passed to _\bc_\bo_\bm_\bm_\ba_\bn_\bd. This is what _\bl_\bo_\b-
- _\bg_\bi_\bn(1) does. The -\b-c\bc option causes _\bc_\bo_\bm_\bm_\ba_\bn_\bd to be executed with
- an empty environment. If -\b-a\ba is supplied, the shell passes _\bn_\ba_\bm_\be
- as the zeroth argument to the executed command. If _\bc_\bo_\bm_\bm_\ba_\bn_\bd can-
- not be executed for some reason, a non-interactive shell exits,
- unless the e\bex\bxe\bec\bcf\bfa\bai\bil\bl 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
- e\bex\bxe\bec\bc fails. If _\bc_\bo_\bm_\bm_\ba_\bn_\bd 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 _\bc_\bo_\bm_\bm_\ba_\bn_\bd is specified, it replaces the shell without creating
+ a new process. _\bc_\bo_\bm_\bm_\ba_\bn_\bd cannot be a shell builtin or function.
+ The _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs become the arguments to _\bc_\bo_\bm_\bm_\ba_\bn_\bd. If the -\b-l\bl option
+ is supplied, the shell places a dash at the beginning of the ze-
+ roth argument passed to _\bc_\bo_\bm_\bm_\ba_\bn_\bd. This is what _\bl_\bo_\bg_\bi_\bn(1) does.
+ The -\b-c\bc option causes _\bc_\bo_\bm_\bm_\ba_\bn_\bd to be executed with an empty envi-
+ ronment. If -\b-a\ba is supplied, the shell passes _\bn_\ba_\bm_\be as the zeroth
+ argument to the executed command.
+
+ If _\bc_\bo_\bm_\bm_\ba_\bn_\bd cannot be executed for some reason, a non-interactive
+ shell exits, unless the e\bex\bxe\bec\bcf\bfa\bai\bil\bl 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 e\bex\bxe\bec\bc fails.
+
+ If _\bc_\bo_\bm_\bm_\ba_\bn_\bd 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.
e\bex\bxi\bit\bt [_\bn]
Cause the shell to exit with a status of _\bn. If _\bn is omitted,
- the exit status is that of the last command executed. A trap on
- E\bEX\bXI\bIT\bT is executed before the shell terminates.
+ the exit status is that of the last command executed. Any trap
+ on E\bEX\bXI\bIT\bT is executed before the shell terminates.
- e\bex\bxp\bpo\bor\brt\bt [-\b-f\bfn\bn] [_\bn_\ba_\bm_\be[=_\bw_\bo_\br_\bd]] ...
+ e\bex\bxp\bpo\bor\brt\bt [-\b-f\bfn\bn] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be]] ...
e\bex\bxp\bpo\bor\brt\bt -\b-p\bp
- The supplied _\bn_\ba_\bm_\be_\bs are marked for automatic export to the envi-
- ronment of subsequently executed commands. If the -\b-f\bf option is
- given, the _\bn_\ba_\bm_\be_\bs refer to functions. If no _\bn_\ba_\bm_\be_\bs are given, or
- if the -\b-p\bp option is supplied, a list of names of all exported
- variables is printed. The -\b-n\bn option causes the export property
- to be removed from each _\bn_\ba_\bm_\be. If a variable name is followed by
- =_\bw_\bo_\br_\bd, the value of the variable is set to _\bw_\bo_\br_\bd. e\bex\bxp\bpo\bor\brt\bt returns
- an exit status of 0 unless an invalid option is encountered, one
- of the _\bn_\ba_\bm_\be_\bs is not a valid shell variable name, or -\b-f\bf is sup-
- plied with a _\bn_\ba_\bm_\be that is not a function.
-
- f\bfa\bal\bls\bse\be Does nothing, returns a non-zero status.
+ The supplied _\bn_\ba_\bm_\be_\bs are marked for automatic export to the envi-
+ ronment of subsequently executed commands. If the -\b-f\bf option is
+ given, the _\bn_\ba_\bm_\be_\bs refer to functions.
+
+ The -\b-n\bn option unexports, or removes the export attribute, from
+ each _\bn_\ba_\bm_\be. If no _\bn_\ba_\bm_\be_\bs are given, or if the -\b-p\bp option is sup-
+ plied, e\bex\bxp\bpo\bor\brt\bt prints a list of names of all exported variables
+ on the standard output.
+
+ e\bex\bxp\bpo\bor\brt\bt allows the value of a variable to be set when it is ex-
+ ported or unexported by following the variable name with =_\bv_\ba_\bl_\bu_\be.
+ This sets the value of the variable to _\bv_\ba_\bl_\bu_\be while modifying the
+ export attribute. e\bex\bxp\bpo\bor\brt\bt returns an exit status of 0 unless an
+ invalid option is encountered, one of the _\bn_\ba_\bm_\be_\bs is not a valid
+ shell variable name, or -\b-f\bf is supplied with a _\bn_\ba_\bm_\be that is not a
+ function.
+
+ f\bfa\bal\bls\bse\be Does nothing; returns a non-zero status.
f\bfc\bc [-\b-e\be _\be_\bn_\ba_\bm_\be] [-\b-l\bln\bnr\br] [_\bf_\bi_\br_\bs_\bt] [_\bl_\ba_\bs_\bt]
f\bfc\bc -\b-s\bs [_\bp_\ba_\bt=_\br_\be_\bp] [_\bc_\bm_\bd]
- The first form selects a range of commands from _\bf_\bi_\br_\bs_\bt to _\bl_\ba_\bs_\bt
- from the history list and displays or edits and re-executes
- them. _\bF_\bi_\br_\bs_\bt and _\bl_\ba_\bs_\bt 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
- _\bf_\bi_\br_\bs_\bt or _\bl_\ba_\bs_\bt of 0 is equivalent to -1 and -0 is equivalent to
- the current command (usually the f\bfc\bc command); otherwise 0 is
- equivalent to -1 and -0 is invalid. If _\bl_\ba_\bs_\bt is not specified,
- it is set to the current command for listing (so that prints the
- last 10 commands) and to _\bf_\bi_\br_\bs_\bt otherwise. If _\bf_\bi_\br_\bs_\bt is not spec-
- ified, it is set to the previous command for editing and -16 for
- listing.
-
- The -\b-n\bn option suppresses the command numbers when listing. The
- -\b-r\br option reverses the order of the commands. If the -\b-l\bl option
- is given, the commands are listed on standard output. Other-
- wise, the editor given by _\be_\bn_\ba_\bm_\be is invoked on a file containing
- those commands. If _\be_\bn_\ba_\bm_\be is not given, the value of the F\bFC\bCE\bED\bDI\bIT\bT
- variable is used, and the value of E\bED\bDI\bIT\bTO\bOR\bR if F\bFC\bCE\bED\bDI\bIT\bT is not set.
- If neither variable is set, _\bv_\bi is used. When editing is com-
- plete, the edited commands are echoed and executed.
-
- In the second form, _\bc_\bo_\bm_\bm_\ba_\bn_\bd is re-executed after each instance
- of _\bp_\ba_\bt is replaced by _\br_\be_\bp. _\bC_\bo_\bm_\bm_\ba_\bn_\bd is interpreted the same as
- _\bf_\bi_\br_\bs_\bt 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 _\bf_\bi_\br_\bs_\bt or _\bl_\ba_\bs_\bt specify history
- lines out of range. If the -\b-e\be 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 _\bc_\bm_\bd does not specify a valid history line, in
- which case f\bfc\bc returns failure.
+ The first form selects a range of commands from _\bf_\bi_\br_\bs_\bt to _\bl_\ba_\bs_\bt
+ from the history list and displays or edits and re-executes
+ them. _\bF_\bi_\br_\bs_\bt and _\bl_\ba_\bs_\bt 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 _\bf_\bi_\br_\bs_\bt or _\bl_\ba_\bs_\bt of 0 is equivalent to -1 and -0 is
+ equivalent to the current command (usually the f\bfc\bc command); oth-
+ erwise 0 is equivalent to -1 and -0 is invalid. If _\bl_\ba_\bs_\bt is not
+ specified, it is set to the current command for listing (so that
+ prints the last 10 commands) and to _\bf_\bi_\br_\bs_\bt otherwise. If _\bf_\bi_\br_\bs_\bt
+ is not specified, it is set to the previous command for editing
+ and -16 for listing.
+
+ If the -\b-l\bl option is supplied, the commands are listed on the
+ standard output. The -\b-n\bn option suppresses the command numbers
+ when listing. The -\b-r\br option reverses the order of the commands.
+
+ Otherwise, f\bfc\bc invokes the editor named by _\be_\bn_\ba_\bm_\be on a file con-
+ taining those commands. If _\be_\bn_\ba_\bm_\be is not supplied, f\bfc\bc uses the
+ value of the F\bFC\bCE\bED\bDI\bIT\bT variable, and the value of E\bED\bDI\bIT\bTO\bOR\bR if F\bFC\bCE\bED\bDI\bIT\bT
+ is not set. If neither variable is set, f\bfc\bc uses _\bv_\bi_\b. When edit-
+ ing is complete, f\bfc\bc reads the file containing the edited com-
+ mands and echoes and executes them.
+
+ In the second form, f\bfc\bc re-executes _\bc_\bo_\bm_\bm_\ba_\bn_\bd after replacing each
+ instance of _\bp_\ba_\bt with _\br_\be_\bp. _\bC_\bo_\bm_\bm_\ba_\bn_\bd is interpreted the same as
+ _\bf_\bi_\br_\bs_\bt above.
+
+ A useful alias to use with f\bfc\bc 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 _\bf_\bi_\br_\bs_\bt or _\bl_\ba_\bs_\bt 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 _\bc_\bm_\bd does not specify a valid history en-
+ try, in which case f\bfc\bc returns a non-zero status.
f\bfg\bg [_\bj_\bo_\bb_\bs_\bp_\be_\bc]
Resume _\bj_\bo_\bb_\bs_\bp_\be_\bc in the foreground, and make it the current job.
- If _\bj_\bo_\bb_\bs_\bp_\be_\bc is not present, the shell's notion of the _\bc_\bu_\br_\br_\be_\bn_\bt _\bj_\bo_\bb
- 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 _\bj_\bo_\bb_\bs_\bp_\be_\bc does not spec-
- ify a valid job or _\bj_\bo_\bb_\bs_\bp_\be_\bc specifies a job that was started
- without job control.
+ If _\bj_\bo_\bb_\bs_\bp_\be_\bc is not present, use the shell's notion of the _\bc_\bu_\br_\br_\be_\bn_\bt
+ _\bj_\bo_\bb. 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 _\bj_\bo_\bb_\bs_\bp_\be_\bc does not specify a
+ valid job or _\bj_\bo_\bb_\bs_\bp_\be_\bc specifies a job that was started without
+ job control.
g\bge\bet\bto\bop\bpt\bts\bs _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg _\bn_\ba_\bm_\be [_\ba_\br_\bg ...]
- g\bge\bet\bto\bop\bpt\bts\bs is used by shell procedures to parse positional parame-
- ters. _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg 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, g\bge\bet\bto\bop\bpt\bts\bs
- places the next option in the shell variable _\bn_\ba_\bm_\be, initializing
- _\bn_\ba_\bm_\be if it does not exist, and the index of the next argument to
- be processed into the variable O\bOP\bPT\bTI\bIN\bND\bD. O\bOP\bPT\bTI\bIN\bND\bD is initialized to
- 1 each time the shell or a shell script is invoked. When an op-
- tion requires an argument, g\bge\bet\bto\bop\bpt\bts\bs places that argument into the
- variable O\bOP\bPT\bTA\bAR\bRG\bG. The shell does not reset O\bOP\bPT\bTI\bIN\bND\bD automatically;
- it must be manually reset between multiple calls to g\bge\bet\bto\bop\bpt\bts\bs
- within the same shell invocation if a new set of parameters is
- to be used.
-
- When the end of options is encountered, g\bge\bet\bto\bop\bpt\bts\bs exits with a re-
- turn value greater than zero. O\bOP\bPT\bTI\bIN\bND\bD is set to the index of the
+ g\bge\bet\bto\bop\bpt\bts\bs is used by shell scripts and functions to parse posi-
+ tional parameters and obtain options and their arguments. _\bo_\bp_\bt_\b-
+ _\bs_\bt_\br_\bi_\bn_\bg 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, g\bge\bet\bto\bop\bpt\bts\bs places the next option in the
+ shell variable _\bn_\ba_\bm_\be, initializing _\bn_\ba_\bm_\be if it does not exist, and
+ the index of the next argument to be processed into the variable
+ O\bOP\bPT\bTI\bIN\bND\bD. O\bOP\bPT\bTI\bIN\bND\bD is initialized to 1 each time the shell or a
+ shell script is invoked. When an option requires an argument,
+ g\bge\bet\bto\bop\bpt\bts\bs places that argument into the variable O\bOP\bPT\bTA\bAR\bRG\bG.
+
+ The shell does not reset O\bOP\bPT\bTI\bIN\bND\bD automatically; it must be manu-
+ ally reset between multiple calls to g\bge\bet\bto\bop\bpt\bts\bs within the same
+ shell invocation to use a new set of parameters.
+
+ When it reaches the end of options, g\bge\bet\bto\bop\bpt\bts\bs exits with a return
+ value greater than zero. O\bOP\bPT\bTI\bIN\bND\bD is set to the index of the
first non-option argument, and _\bn_\ba_\bm_\be is set to ?.
- g\bge\bet\bto\bop\bpt\bts\bs normally parses the positional parameters, but if more
- arguments are supplied as _\ba_\br_\bg values, g\bge\bet\bto\bop\bpt\bts\bs parses those in-
+ g\bge\bet\bto\bop\bpt\bts\bs normally parses the positional parameters, but if more
+ arguments are supplied as _\ba_\br_\bg values, g\bge\bet\bto\bop\bpt\bts\bs parses those in-
stead.
- g\bge\bet\bto\bop\bpt\bts\bs can report errors in two ways. If the first character
- of _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg is a colon, _\bs_\bi_\bl_\be_\bn_\bt error reporting is used. In
- normal operation, diagnostic messages are printed when invalid
- options or missing option arguments are encountered. If the
- variable O\bOP\bPT\bTE\bER\bRR\bR is set to 0, no error messages will be dis-
+ g\bge\bet\bto\bop\bpt\bts\bs can report errors in two ways. If the first character
+ of _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg is a colon, g\bge\bet\bto\bop\bpt\bts\bs uses _\bs_\bi_\bl_\be_\bn_\bt error reporting.
+ In normal operation, g\bge\bet\bto\bop\bpt\bts\bs prints diagnostic messages when it
+ encounters invalid options or missing option arguments. If the
+ variable O\bOP\bPT\bTE\bER\bRR\bR is set to 0, no error messages will be dis-
played, even if the first character of _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg is not a colon.
If g\bge\bet\bto\bop\bpt\bts\bs detects an invalid option, it places ? into _\bn_\ba_\bm_\be and,
- if not silent, prints an error message and unsets O\bOP\bPT\bTA\bAR\bRG\bG. If
- g\bge\bet\bto\bop\bpt\bts\bs is silent, it assigns the option character found to O\bOP\bP-\b-
+ if not silent, prints an error message and unsets O\bOP\bPT\bTA\bAR\bRG\bG. If
+ g\bge\bet\bto\bop\bpt\bts\bs is silent, it assigns the option character found to O\bOP\bP-\b-
T\bTA\bAR\bRG\bG and does not print a diagnostic message.
- If a required argument is not found, and g\bge\bet\bto\bop\bpt\bts\bs is not silent,
+ If a required argument is not found, and g\bge\bet\bto\bop\bpt\bts\bs is not silent,
it sets the value of _\bn_\ba_\bm_\be to a question mark (?\b?), unsets O\bOP\bPT\bTA\bAR\bRG\bG,
- and prints a diagnostic message. If g\bge\bet\bto\bop\bpt\bts\bs is silent, it sets
- the value of _\bn_\ba_\bm_\be to a colon (:\b:) and sets O\bOP\bPT\bTA\bAR\bRG\bG to the option
+ and prints a diagnostic message. If g\bge\bet\bto\bop\bpt\bts\bs is silent, it sets
+ the value of _\bn_\ba_\bm_\be to a colon (:\b:) and sets O\bOP\bPT\bTA\bAR\bRG\bG to the option
character found.
- g\bge\bet\bto\bop\bpt\bts\bs returns true if an option, specified or unspecified, is
+ g\bge\bet\bto\bop\bpt\bts\bs returns true if an option, specified or unspecified, is
found. It returns false if the end of options is encountered or
an error occurs.
h\bha\bas\bsh\bh [-\b-l\blr\br] [-\b-p\bp _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be] [-\b-d\bdt\bt] [_\bn_\ba_\bm_\be]
- Each time h\bha\bas\bsh\bh is invoked, the full pathname of the command _\bn_\ba_\bm_\be
- is determined by searching the directories in $\b$P\bPA\bAT\bTH\bH and remem-
- bered. Any previously-remembered pathname is discarded. If the
- -\b-p\bp option is supplied, h\bha\bas\bsh\bh uses _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be as the full filename
- of the command. The -\b-r\br option causes the shell to forget all
- remembered locations. Assigning to the P\bPA\bAT\bTH\bH variable also
- clears all hashed filenames. The -\b-d\bd option causes the shell to
- forget the remembered location of each _\bn_\ba_\bm_\be. If the -\b-t\bt option
- is supplied, the full pathname to which each _\bn_\ba_\bm_\be corresponds is
- printed. If multiple _\bn_\ba_\bm_\be arguments are supplied with -\b-t\bt, the
- _\bn_\ba_\bm_\be is printed before the hashed full pathname. The -\b-l\bl option
- causes output to be displayed in a format that may be reused as
- input. If no arguments are given, or if only -\b-l\bl is supplied,
- information about remembered commands is printed. The -\b-t\bt, -\b-d\bd,
- and -\b-p\bp options (the options that act on the _\bn_\ba_\bm_\be arguments) are
- mutually exclusive. Only one will be active. If more than one
- is supplied, -\b-t\bt has higher priority than -\b-p\bp, and both are higher
- priority than -\b-d\bd. The return status is true unless a _\bn_\ba_\bm_\be is
- not found or an invalid option is supplied.
+ Each time h\bha\bas\bsh\bh is invoked, it remembers the full pathname of the
+ command _\bn_\ba_\bm_\be as determined by searching the directories in
+ $\b$P\bPA\bAT\bTH\bH. Any previously-remembered pathname associated with _\bn_\ba_\bm_\be
+ is discarded. If the -\b-p\bp option is supplied, h\bha\bas\bsh\bh uses _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
+ as the full pathname of the command.
+
+ The -\b-r\br option causes the shell to forget all remembered loca-
+ tions. Assigning to the P\bPA\bAT\bTH\bH variable also clears all hashed
+ filenames. The -\b-d\bd option causes the shell to forget the remem-
+ bered location of each _\bn_\ba_\bm_\be.
+
+ If the -\b-t\bt option is supplied, h\bha\bas\bsh\bh prints the full pathname cor-
+ responding to each _\bn_\ba_\bm_\be. If multiple _\bn_\ba_\bm_\be arguments are sup-
+ plied with -\b-t\bt, h\bha\bas\bsh\bh prints the _\bn_\ba_\bm_\be before the corresponding
+ hashed full pathname. The -\b-l\bl option displays output in a format
+ that may be reused as input.
+
+ If no arguments are given, or if only -\b-l\bl is supplied, h\bha\bas\bsh\bh
+ prints information about remembered commands. The -\b-t\bt, -\b-d\bd, and
+ -\b-p\bp options (the options that act on the _\bn_\ba_\bm_\be arguments) are mu-
+ tually exclusive. Only one will be active. If more than one is
+ supplied, -\b-t\bt has higher priority than -\b-p\bp, and both have higher
+ priority than -\b-d\bd.
+
+ The return status is zero unless a _\bn_\ba_\bm_\be is not found or an in-
+ valid option is supplied.
h\bhe\bel\blp\bp [-\b-d\bdm\bms\bs] [_\bp_\ba_\bt_\bt_\be_\br_\bn]
Display helpful information about builtin commands. If _\bp_\ba_\bt_\bt_\be_\br_\bn
is specified, h\bhe\bel\blp\bp gives detailed help on all commands matching
- _\bp_\ba_\bt_\bt_\be_\br_\bn; otherwise help for all the builtins and shell control
- structures is printed.
+ _\bp_\ba_\bt_\bt_\be_\br_\bn; otherwise it displays a list of all the builtins and
+ shell compound commands.
-\b-d\bd Display a short description of each _\bp_\ba_\bt_\bt_\be_\br_\bn
-\b-m\bm Display the description of each _\bp_\ba_\bt_\bt_\be_\br_\bn in a manpage-like
format
h\bhi\bis\bst\bto\bor\bry\by -\b-a\ban\bnr\brw\bw [_\bf_\bi_\bl_\be_\bn_\ba_\bm_\be]
h\bhi\bis\bst\bto\bor\bry\by -\b-p\bp _\ba_\br_\bg [_\ba_\br_\bg ...]
h\bhi\bis\bst\bto\bor\bry\by -\b-s\bs _\ba_\br_\bg [_\ba_\br_\bg ...]
- With no options, display the command history list with line num-
- bers. Lines listed with a *\b* have been modified. An argument of
- _\bn lists only the last _\bn lines. If the shell variable H\bHI\bIS\bST\bTT\bTI\bIM\bME\bE-\b-
+ With no options, display the command history list with numbers.
+ Entries prefixed with a *\b* have been modified. An argument of _\bn
+ lists only the last _\bn entries. If the shell variable H\bHI\bIS\bST\bTT\bTI\bIM\bME\bE-\b-
F\bFO\bOR\bRM\bMA\bAT\bT is set and not null, it is used as a format string for
_\bs_\bt_\br_\bf_\bt_\bi_\bm_\be(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 _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is
- supplied, it is used as the name of the history file; if not,
- the value of H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is used. If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is not supplied and
- H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is unset or null, the -\b-a\ba,\b, -\b-n\bn,\b, -\b-r\br,\b, and -\b-w\bw options have
- no effect. Options, if supplied, have the following meanings:
- -\b-c\bc Clear the history list by deleting all the entries.
+ played history entry. If h\bhi\bis\bst\bto\bor\bry\by uses H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT, it does
+ not print an intervening space between the formatted time stamp
+ and the history entry.
+
+ If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is supplied, h\bhi\bis\bst\bto\bor\bry\by uses it as the name of the his-
+ tory file; if not, it uses the value of H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE. If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
+ is not supplied and H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is unset or null, the -\b-a\ba,\b, -\b-n\bn,\b, -\b-r\br,\b,
+ and -\b-w\bw options have no effect.
+
+ Options, if supplied, have the following meanings:
+ -\b-c\bc Clear the history list by deleting all the entries. This
+ can be used with the other options to replace the history
+ list.
-\b-d\bd _\bo_\bf_\bf_\bs_\be_\bt
- Delete the history entry at position _\bo_\bf_\bf_\bs_\be_\bt. If _\bo_\bf_\bf_\bs_\be_\bt
+ Delete the history entry at position _\bo_\bf_\bf_\bs_\be_\bt. If _\bo_\bf_\bf_\bs_\be_\bt
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 h\bhi\bis\bst\bto\bor\bry\by -\b-d\bd command.
-\b-d\bd _\bs_\bt_\ba_\br_\bt-_\be_\bn_\bd
- Delete the range of history entries between positions
- _\bs_\bt_\ba_\br_\bt and _\be_\bn_\bd, inclusive. Positive and negative values
+ Delete the range of history entries between positions
+ _\bs_\bt_\ba_\br_\bt and _\be_\bn_\bd, inclusive. Positive and negative values
for _\bs_\bt_\ba_\br_\bt and _\be_\bn_\bd are interpreted as described above.
- -\b-a\ba Append the history lines to the history file. These are
- history lines entered since the beginning of the current
- b\bba\bas\bsh\bh session, but not already appended to the history
+ -\b-a\ba Append the history lines to the history file. These are
+ history lines entered since the beginning of the current
+ b\bba\bas\bsh\bh session, but not already appended to the history
file.
- -\b-n\bn 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
+ -\b-n\bn 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 b\bba\bas\bsh\bh session.
- -\b-r\br Read the contents of the history file and append them to
- the current history list.
+ -\b-r\br Read the history file and append its contents to the cur-
+ rent history list.
-\b-w\bw Write the current history list to the history file, over-
writing the history file's contents.
-\b-p\bp Perform history substitution on the following _\ba_\br_\bg_\bs and
- display the result on the standard output. Does not
- store the results in the history list. Each _\ba_\br_\bg must be
+ display the result on the standard output, without stor-
+ ing the results in the history list. Each _\ba_\br_\bg must be
quoted to disable normal history expansion.
-\b-s\bs Store the _\ba_\br_\bg_\bs in the history list as a single entry.
The last command in the history list is removed before
- the _\ba_\br_\bg_\bs are added.
-
- If the H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT 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 _\bo_\bf_\bf_\bs_\be_\bt or range
- is supplied as an argument to -\b-d\bd, or the history expansion sup-
- plied as an argument to -\b-p\bp fails.
+ adding the _\ba_\br_\bg_\bs.
+
+ If the H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT variable is set, h\bhi\bis\bst\bto\bor\bry\by 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 _\bo_\bf_\bf_\bs_\be_\bt or range is supplied as an argument to -\b-d\bd, or the
+ history expansion supplied as an argument to -\b-p\bp fails.
j\bjo\bob\bbs\bs [-\b-l\bln\bnp\bpr\brs\bs] [ _\bj_\bo_\bb_\bs_\bp_\be_\bc ... ]
j\bjo\bob\bbs\bs -\b-x\bx _\bc_\bo_\bm_\bm_\ba_\bn_\bd [ _\ba_\br_\bg_\bs ... ]
The first form lists the active jobs. The options have the fol-
lowing meanings:
-\b-l\bl List process IDs in addition to the normal information.
- -\b-n\bn Display information only about jobs that have changed
+ -\b-n\bn Display information only about jobs that have changed
status since the user was last notified of their status.
- -\b-p\bp List only the process ID of the job's process group
+ -\b-p\bp List only the process ID of the job's process group
leader.
-\b-r\br Display only running jobs.
-\b-s\bs Display only stopped jobs.
- If _\bj_\bo_\bb_\bs_\bp_\be_\bc is given, output is restricted to information about
- that job. The return status is 0 unless an invalid option is
- encountered or an invalid _\bj_\bo_\bb_\bs_\bp_\be_\bc is supplied.
+ If _\bj_\bo_\bb_\bs_\bp_\be_\bc is supplied, j\bjo\bob\bbs\bs restricts output to information
+ about that job. The return status is 0 unless an invalid option
+ is encountered or an invalid _\bj_\bo_\bb_\bs_\bp_\be_\bc is supplied.
If the -\b-x\bx option is supplied, j\bjo\bob\bbs\bs replaces any _\bj_\bo_\bb_\bs_\bp_\be_\bc found in
_\bc_\bo_\bm_\bm_\ba_\bn_\bd or _\ba_\br_\bg_\bs with the corresponding process group ID, and ex-
- ecutes _\bc_\bo_\bm_\bm_\ba_\bn_\bd passing it _\ba_\br_\bg_\bs, returning its exit status.
+ ecutes _\bc_\bo_\bm_\bm_\ba_\bn_\bd, passing it _\ba_\br_\bg_\bs, returning its exit status.
k\bki\bil\bll\bl [-\b-s\bs _\bs_\bi_\bg_\bs_\bp_\be_\bc | -\b-n\bn _\bs_\bi_\bg_\bn_\bu_\bm | -\b-_\bs_\bi_\bg_\bs_\bp_\be_\bc] [_\bp_\bi_\bd | _\bj_\bo_\bb_\bs_\bp_\be_\bc] ...
k\bki\bil\bll\bl -\b-l\bl|-\b-L\bL [_\bs_\bi_\bg_\bs_\bp_\be_\bc | _\be_\bx_\bi_\bt_\b__\bs_\bt_\ba_\bt_\bu_\bs]
- Send the signal named by _\bs_\bi_\bg_\bs_\bp_\be_\bc or _\bs_\bi_\bg_\bn_\bu_\bm to the processes
+ Send the signal specified by _\bs_\bi_\bg_\bs_\bp_\be_\bc or _\bs_\bi_\bg_\bn_\bu_\bm to the processes
named by _\bp_\bi_\bd or _\bj_\bo_\bb_\bs_\bp_\be_\bc. _\bs_\bi_\bg_\bs_\bp_\be_\bc is either a case-insensitive
signal name such as S\bSI\bIG\bGK\bKI\bIL\bLL\bL (with or without the S\bSI\bIG\bG prefix) or
a signal number; _\bs_\bi_\bg_\bn_\bu_\bm is a signal number. If _\bs_\bi_\bg_\bs_\bp_\be_\bc is not
- present, then S\bSI\bIG\bGT\bTE\bER\bRM\bM is assumed. An argument of -\b-l\bl lists the
- signal names. If any arguments are supplied when -\b-l\bl is given,
- the names of the signals corresponding to the arguments are
- listed, and the return status is 0. The _\be_\bx_\bi_\bt_\b__\bs_\bt_\ba_\bt_\bu_\bs argument to
- -\b-l\bl is a number specifying either a signal number or the exit
- status of a process terminated by a signal. The -\b-L\bL option is
- equivalent to -\b-l\bl. k\bki\bil\bll\bl 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 k\bki\bil\bll\bl sends S\bSI\bIG\bGT\bTE\bER\bRM\bM.
+
+ An argument of -\b-l\bl lists the signal names. If any arguments are
+ supplied when -\b-l\bl is given, k\bki\bil\bll\bl lists the names of the signals
+ corresponding to the arguments, and the return status is 0. The
+ _\be_\bx_\bi_\bt_\b__\bs_\bt_\ba_\bt_\bu_\bs argument to -\b-l\bl is a number specifying either a sig-
+ nal number or the exit status of a process terminated by a sig-
+ nal. The -\b-L\bL option is equivalent to -\b-l\bl.
+
+ k\bki\bil\bll\bl returns true if at least one signal was successfully sent,
+ or false if an error occurs or an invalid option is encountered.
l\ble\bet\bt _\ba_\br_\bg [_\ba_\br_\bg ...]
- Each _\ba_\br_\bg is an arithmetic expression to be evaluated (see A\bAR\bRI\bIT\bTH\bH-\b-
+ Each _\ba_\br_\bg is evaluated as an arithmetic expression (see A\bAR\bRI\bIT\bTH\bH-\b-
M\bME\bET\bTI\bIC\bC E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN in _\bb_\ba_\bs_\bh(1)). If the last _\ba_\br_\bg evaluates to 0,
- l\ble\bet\bt returns 1; 0 is returned otherwise.
+ l\ble\bet\bt returns 1; otherwise l\ble\bet\bt returns 0.
l\blo\boc\bca\bal\bl [_\bo_\bp_\bt_\bi_\bo_\bn] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ... | - ]
- For each argument, a local variable named _\bn_\ba_\bm_\be is created, and
- assigned _\bv_\ba_\bl_\bu_\be. The _\bo_\bp_\bt_\bi_\bo_\bn can be any of the options accepted
- by d\bde\bec\bcl\bla\bar\bre\be. When l\blo\boc\bca\bal\bl is used within a function, it causes the
+ For each argument, create a local variable named _\bn_\ba_\bm_\be and assign
+ it _\bv_\ba_\bl_\bu_\be. The _\bo_\bp_\bt_\bi_\bo_\bn can be any of the options accepted by d\bde\be-\b-
+ c\bcl\bla\bar\bre\be. When l\blo\boc\bca\bal\bl is used within a function, it causes the
variable _\bn_\ba_\bm_\be to have a visible scope restricted to that func-
- tion and its children. If _\bn_\ba_\bm_\be is -, the set of shell options
- is made local to the function in which l\blo\boc\bca\bal\bl is invoked: shell
- options changed using the s\bse\bet\bt builtin inside the function after
- the call to l\blo\boc\bca\bal\bl are restored to their original values when the
- function returns. The restore is effected as if a series of s\bse\bet\bt
- commands were executed to restore the values that were in place
- before the function. With no operands, l\blo\boc\bca\bal\bl writes a list of
- local variables to the standard output. It is an error to use
- l\blo\boc\bca\bal\bl when not within a function. The return status is 0 unless
- l\blo\boc\bca\bal\bl is used outside a function, an invalid _\bn_\ba_\bm_\be is supplied,
- or _\bn_\ba_\bm_\be is a readonly variable.
-
- l\blo\bog\bgo\bou\but\bt Exit a login shell.
+ tion and its children. It is an error to use l\blo\boc\bca\bal\bl when not
+ within a function.
+
+ If _\bn_\ba_\bm_\be is -, it makes the set of shell options local to the
+ function in which l\blo\boc\bca\bal\bl is invoked: any shell options changed
+ using the s\bse\bet\bt builtin inside the function after the call to l\blo\bo-\b-
+ c\bca\bal\bl are restored to their original values when the function re-
+ turns. The restore is performed as if a series of s\bse\bet\bt commands
+ were executed to restore the values that were in place before
+ the function.
+
+ With no operands, l\blo\boc\bca\bal\bl writes a list of local variables to the
+ standard output.
+
+ The return status is 0 unless l\blo\boc\bca\bal\bl is used outside a function,
+ an invalid _\bn_\ba_\bm_\be is supplied, or _\bn_\ba_\bm_\be is a readonly variable.
+
+ l\blo\bog\bgo\bou\but\bt [\b[_\bn]\b]
+ Exit a login shell, returning a status of _\bn to the shell's par-
+ ent.
m\bma\bap\bpf\bfi\bil\ble\be [-\b-d\bd _\bd_\be_\bl_\bi_\bm] [-\b-n\bn _\bc_\bo_\bu_\bn_\bt] [-\b-O\bO _\bo_\br_\bi_\bg_\bi_\bn] [-\b-s\bs _\bc_\bo_\bu_\bn_\bt] [-\b-t\bt] [-\b-u\bu _\bf_\bd] [-\b-C\bC
_\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk] [-\b-c\bc _\bq_\bu_\ba_\bn_\bt_\bu_\bm] [_\ba_\br_\br_\ba_\by]
r\bre\bea\bad\bda\bar\brr\bra\bay\by [-\b-d\bd _\bd_\be_\bl_\bi_\bm] [-\b-n\bn _\bc_\bo_\bu_\bn_\bt] [-\b-O\bO _\bo_\br_\bi_\bg_\bi_\bn] [-\b-s\bs _\bc_\bo_\bu_\bn_\bt] [-\b-t\bt] [-\b-u\bu _\bf_\bd] [-\b-C\bC
_\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk] [-\b-c\bc _\bq_\bu_\ba_\bn_\bt_\bu_\bm] [_\ba_\br_\br_\ba_\by]
- Read lines from the standard input into the indexed array vari-
- able _\ba_\br_\br_\ba_\by, or from file descriptor _\bf_\bd if the -\b-u\bu option is sup-
- plied. The variable M\bMA\bAP\bPF\bFI\bIL\bLE\bE is the default _\ba_\br_\br_\ba_\by. Options, if
+ Read lines from the standard input, or from file descriptor _\bf_\bd
+ if the -\b-u\bu option is supplied, into the indexed array variable
+ _\ba_\br_\br_\ba_\by. The variable M\bMA\bAP\bPF\bFI\bIL\bLE\bE is the default _\ba_\br_\br_\ba_\by. Options, if
supplied, have the following meanings:
- -\b-d\bd The first character of _\bd_\be_\bl_\bi_\bm is used to terminate each
- input line, rather than newline. If _\bd_\be_\bl_\bi_\bm is the empty
- string, m\bma\bap\bpf\bfi\bil\ble\be will terminate a line when it reads a NUL
- character.
- -\b-n\bn Copy at most _\bc_\bo_\bu_\bn_\bt lines. If _\bc_\bo_\bu_\bn_\bt is 0, all lines are
- copied.
- -\b-O\bO Begin assigning to _\ba_\br_\br_\ba_\by at index _\bo_\br_\bi_\bg_\bi_\bn. The default
+ -\b-d\bd Use the first character of _\bd_\be_\bl_\bi_\bm to terminate each input
+ line, rather than newline. If _\bd_\be_\bl_\bi_\bm is the empty string,
+ m\bma\bap\bpf\bfi\bil\ble\be will terminate a line when it reads a NUL charac-
+ ter.
+ -\b-n\bn Copy at most _\bc_\bo_\bu_\bn_\bt lines. If _\bc_\bo_\bu_\bn_\bt is 0, copy all lines.
+ -\b-O\bO Begin assigning to _\ba_\br_\br_\ba_\by at index _\bo_\br_\bi_\bg_\bi_\bn. The default
index is 0.
-\b-s\bs Discard the first _\bc_\bo_\bu_\bn_\bt lines read.
- -\b-t\bt Remove a trailing _\bd_\be_\bl_\bi_\bm (default newline) from each line
+ -\b-t\bt Remove a trailing _\bd_\be_\bl_\bi_\bm (default newline) from each line
read.
- -\b-u\bu Read lines from file descriptor _\bf_\bd instead of the stan-
+ -\b-u\bu Read lines from file descriptor _\bf_\bd instead of the stan-
dard input.
- -\b-C\bC Evaluate _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk each time _\bq_\bu_\ba_\bn_\bt_\bu_\bm lines are read. The
+ -\b-C\bC Evaluate _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk each time _\bq_\bu_\ba_\bn_\bt_\bu_\bm lines are read. The
-\b-c\bc option specifies _\bq_\bu_\ba_\bn_\bt_\bu_\bm.
- -\b-c\bc Specify the number of lines read between each call to
+ -\b-c\bc Specify the number of lines read between each call to
_\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk.
- If -\b-C\bC is specified without -\b-c\bc, the default quantum is 5000.
+ If -\b-C\bC is specified without -\b-c\bc, the default quantum is 5000.
When _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk 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. _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk is evaluated after
+ element as additional arguments. _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk is evaluated after
the line is read but before the array element is assigned.
- If not supplied with an explicit origin, m\bma\bap\bpf\bfi\bil\ble\be will clear _\ba_\br_\b-
+ If not supplied with an explicit origin, m\bma\bap\bpf\bfi\bil\ble\be will clear _\ba_\br_\b-
_\br_\ba_\by before assigning to it.
- m\bma\bap\bpf\bfi\bil\ble\be returns successfully unless an invalid option or option
- argument is supplied, _\ba_\br_\br_\ba_\by is invalid or unassignable, or if
- _\ba_\br_\br_\ba_\by is not an indexed array.
+ m\bma\bap\bpf\bfi\bil\ble\be returns zero unless an invalid option or option argument
+ is supplied, _\ba_\br_\br_\ba_\by is invalid or unassignable, or if _\ba_\br_\br_\ba_\by is
+ not an indexed array.
p\bpo\bop\bpd\bd [-n\bn] [+_\bn] [-_\bn]
- Removes entries from the directory stack. The elements are num-
- bered from 0 starting at the first directory listed by d\bdi\bir\brs\bs.
- With no arguments, p\bpo\bop\bpd\bd removes the top directory from the
- stack, and changes to the new top directory. Arguments, if sup-
- plied, have the following meanings:
- -\b-n\bn Suppresses the normal change of directory when removing
- directories from the stack, so that only the stack is ma-
- nipulated.
- +\b+_\bn Removes the _\bnth entry counting from the left of the list
- shown by d\bdi\bir\brs\bs, 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 d\bdi\bir\brs\bs, so
+ p\bpo\bop\bpd\bd is equivalent to With no arguments, p\bpo\bop\bpd\bd removes the top
+ directory from the stack, and changes to the new top directory.
+ Arguments, if supplied, have the following meanings:
+ -\b-n\bn Suppress the normal change of directory when removing di-
+ rectories from the stack, only manipulate the stack.
+ +\b+_\bn Remove the _\bnth entry counting from the left of the list
+ shown by d\bdi\bir\brs\bs, starting with zero, from the stack. For
example: removes the first directory, the second.
- -\b-_\bn Removes the _\bnth entry counting from the right of the list
+ -\b-_\bn Remove the _\bnth entry counting from the right of the list
shown by d\bdi\bir\brs\bs, starting with zero. For example: removes
the last directory, the next to last.
to the directory at the top of the stack. If the c\bcd\bd fails, p\bpo\bop\bpd\bd
returns a non-zero value.
- Otherwise, p\bpo\bop\bpd\bd returns false if an invalid option is encoun-
- tered, the directory stack is empty, or a non-existent directory
- stack entry is specified.
+ Otherwise, p\bpo\bop\bpd\bd returns false if an invalid option is supplied,
+ the directory stack is empty, or _\bn specifies a non-existent di-
+ rectory stack entry.
- If the p\bpo\bop\bpd\bd command is successful, bash runs d\bdi\bir\brs\bs to show the
- final contents of the directory stack, and the return status is
+ If the p\bpo\bop\bpd\bd command is successful, b\bba\bas\bsh\bh runs d\bdi\bir\brs\bs to show the
+ final contents of the directory stack, and the return status is
0.
p\bpr\bri\bin\bnt\btf\bf [-\b-v\bv _\bv_\ba_\br] _\bf_\bo_\br_\bm_\ba_\bt [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
- Write the formatted _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs to the standard output under the
- control of the _\bf_\bo_\br_\bm_\ba_\bt. The -\b-v\bv option causes the output to be
- assigned to the variable _\bv_\ba_\br rather than being printed to the
- standard output.
+ Write the formatted _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs to the standard output under the
+ control of the _\bf_\bo_\br_\bm_\ba_\bt. The -\b-v\bv option assigns the output to the
+ variable _\bv_\ba_\br rather than printing it to the standard output.
The _\bf_\bo_\br_\bm_\ba_\bt is a character string which contains three types of
objects: plain characters, which are simply copied to standard
causes p\bpr\bri\bin\bnt\btf\bf to output the date-time string resulting
from using _\bd_\ba_\bt_\be_\bf_\bm_\bt as a format string for _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be(3).
The corresponding _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt 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 p\bpr\bri\bin\bnt\btf\bf 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 p\bpr\bri\bin\bnt\btf\bf behavior.
The %b, %q, and %T format specifiers all use the field width and
precision arguments from the format specification and write that
p\bpu\bus\bsh\bhd\bd [-\b-n\bn] [+_\bn] [-_\bn]
p\bpu\bus\bsh\bhd\bd [-\b-n\bn] [_\bd_\bi_\br]
- 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, p\bpu\bus\bsh\bhd\bd 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, p\bpu\bus\bsh\bhd\bd exchanges the top two ele-
+ ments of the directory stack. Arguments, if supplied, have the
following meanings:
- -\b-n\bn Suppresses the normal change of directory when rotating
- or adding directories to the stack, so that only the
- stack is manipulated.
- +\b+_\bn Rotates the stack so that the _\bnth directory (counting
- from the left of the list shown by d\bdi\bir\brs\bs, starting with
- zero) is at the top.
+ -\b-n\bn Suppress the normal change of directory when rotating or
+ adding directories to the stack, only manipulate the
+ stack.
+ +\b+_\bn Rotate the stack so that the _\bnth directory (counting from
+ the left of the list shown by d\bdi\bir\brs\bs, starting with zero)
+ is at the top.
-\b-_\bn Rotates the stack so that the _\bnth directory (counting
from the right of the list shown by d\bdi\bir\brs\bs, starting with
zero) is at the top.
- _\bd_\bi_\br Adds _\bd_\bi_\br to the directory stack at the top
+ _\bd_\bi_\br Adds _\bd_\bi_\br to the directory stack at the top.
After the stack has been modified, if the -\b-n\bn option was not sup-
plied, p\bpu\bus\bsh\bhd\bd uses the c\bcd\bd builtin to change to the directory at
the top of the stack. If the c\bcd\bd fails, p\bpu\bus\bsh\bhd\bd returns a non-zero
value.
- Otherwise, if no arguments are supplied, p\bpu\bus\bsh\bhd\bd returns 0 unless
- the directory stack is empty. When rotating the directory
- stack, p\bpu\bus\bsh\bhd\bd returns 0 unless the directory stack is empty or a
- non-existent directory stack element is specified.
+ Otherwise, if no arguments are supplied, p\bpu\bus\bsh\bhd\bd returns zero un-
+ less the directory stack is empty. When rotating the directory
+ stack, p\bpu\bus\bsh\bhd\bd returns zero unless the directory stack is empty or
+ _\bn specifies a non-existent directory stack element.
- If the p\bpu\bus\bsh\bhd\bd command is successful, bash runs d\bdi\bir\brs\bs to show the
+ If the p\bpu\bus\bsh\bhd\bd command is successful, b\bba\bas\bsh\bh runs d\bdi\bir\brs\bs to show the
final contents of the directory stack.
p\bpw\bwd\bd [-\b-L\bLP\bP]
- 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 -\b-P\bP option
is supplied or the -\b-o\bo p\bph\bhy\bys\bsi\bic\bca\bal\bl option to the s\bse\bet\bt builtin command
- is enabled. If the -\b-L\bL option is used, the pathname printed may
- contain symbolic links. The return status is 0 unless an error
+ is enabled. If the -\b-L\bL 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.
r\bre\bea\bad\bd [-\b-E\bEe\ber\brs\bs] [-\b-a\ba _\ba_\bn_\ba_\bm_\be] [-\b-d\bd _\bd_\be_\bl_\bi_\bm] [-\b-i\bi _\bt_\be_\bx_\bt] [-\b-n\bn _\bn_\bc_\bh_\ba_\br_\bs] [-\b-N\bN _\bn_\bc_\bh_\ba_\br_\bs]
[-\b-p\bp _\bp_\br_\bo_\bm_\bp_\bt] [-\b-t\bt _\bt_\bi_\bm_\be_\bo_\bu_\bt] [-\b-u\bu _\bf_\bd] [_\bn_\ba_\bm_\be ...]
- One line is read from the standard input, or from the file de-
- scriptor _\bf_\bd supplied as an argument to the -\b-u\bu option, split into
- words as described in _\bb_\ba_\bs_\bh (1) under W\bWo\bor\brd\bd S\bSp\bpl\bli\bit\btt\bti\bin\bng\bg, and the
- first word is assigned to the first _\bn_\ba_\bm_\be, the second word to the
- second _\bn_\ba_\bm_\be, 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 _\bf_\bd supplied as an argument to the -\b-u\bu option, split it into
+ words as described in _\bb_\ba_\bs_\bh (1) under W\bWo\bor\brd\bd S\bSp\bpl\bli\bit\btt\bti\bin\bng\bg, and assign
+ the first word to the first _\bn_\ba_\bm_\be, the second word to the second
+ _\bn_\ba_\bm_\be, and so on. If there are more words than names, the re-
+ maining words and their intervening delimiters are assigned to
the last _\bn_\ba_\bm_\be. If there are fewer words read from the input
stream than names, the remaining names are assigned empty val-
- ues. The characters in I\bIF\bFS\bS are used to split the line into
- words using the same rules the shell uses for expansion (de-
- scribed in _\bb_\ba_\bs_\bh (1) under W\bWo\bor\brd\bd S\bSp\bpl\bli\bit\btt\bti\bin\bng\bg). The backslash char-
- acter (\\b\) 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 I\bIF\bFS\bS variable are used
+ to split the line into words using the same rules the shell uses
+ for expansion (described in _\bb_\ba_\bs_\bh (1) under W\bWo\bor\brd\bd S\bSp\bpl\bli\bit\btt\bti\bin\bng\bg). The
+ backslash character (\\b\) removes any special meaning for the next
+ character read and is used for line continuation.
+
+ Options, if supplied, have the following meanings:
-\b-a\ba _\ba_\bn_\ba_\bm_\be
The words are assigned to sequential indices of the array
variable _\ba_\bn_\ba_\bm_\be, starting at 0. _\ba_\bn_\ba_\bm_\be is unset before any
new values are assigned. Other _\bn_\ba_\bm_\be arguments are ig-
nored.
-\b-d\bd _\bd_\be_\bl_\bi_\bm
- The first character of _\bd_\be_\bl_\bi_\bm is used to terminate the in-
- put line, rather than newline. If _\bd_\be_\bl_\bi_\bm is the empty
- string, r\bre\bea\bad\bd will terminate a line when it reads a NUL
- character.
+ The first character of _\bd_\be_\bl_\bi_\bm terminates the input line,
+ rather than newline. If _\bd_\be_\bl_\bi_\bm is the empty string, r\bre\bea\bad\bd
+ will terminate a line when it reads a NUL character.
-\b-e\be If the standard input is coming from a terminal, r\bre\bea\bad\bd
uses r\bre\bea\bad\bdl\bli\bin\bne\be (see R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE in _\bb_\ba_\bs_\bh(1)) to obtain the
line. Readline uses the current (or default, if line
uses bash's default completion, including programmable
completion.
-\b-i\bi _\bt_\be_\bx_\bt
- If r\bre\bea\bad\bdl\bli\bin\bne\be is being used to read the line, _\bt_\be_\bx_\bt is
- placed into the editing buffer before editing begins.
+ If r\bre\bea\bad\bdl\bli\bin\bne\be is being used to read the line, r\bre\bea\bad\bd places
+ _\bt_\be_\bx_\bt into the editing buffer before editing begins.
-\b-n\bn _\bn_\bc_\bh_\ba_\br_\bs
r\bre\bea\bad\bd returns after reading _\bn_\bc_\bh_\ba_\br_\bs characters rather than
- waiting for a complete line of input, but honors a delim-
- iter if fewer than _\bn_\bc_\bh_\ba_\br_\bs characters are read before the
- delimiter.
+ waiting for a complete line of input, unless it encoun-
+ ters EOF or r\bre\bea\bad\bd times out, but honors a delimiter if it
+ reads fewer than _\bn_\bc_\bh_\ba_\br_\bs characters before the delimiter.
-\b-N\bN _\bn_\bc_\bh_\ba_\br_\bs
- r\bre\bea\bad\bd returns after reading exactly _\bn_\bc_\bh_\ba_\br_\bs characters
- rather than waiting for a complete line of input, unless
- EOF is encountered or r\bre\bea\bad\bd times out. Delimiter charac-
- ters encountered in the input are not treated specially
- and do not cause r\bre\bea\bad\bd to return until _\bn_\bc_\bh_\ba_\br_\bs characters
- are read. The result is not split on the characters in
- I\bIF\bFS\bS; the intent is that the variable is assigned exactly
- the characters read (with the exception of backslash; see
- the -\b-r\br option below).
+ r\bre\bea\bad\bd returns after reading exactly _\bn_\bc_\bh_\ba_\br_\bs characters
+ rather than waiting for a complete line of input, unless
+ it encounters EOF or r\bre\bea\bad\bd times out. Any delimiter char-
+ acters in the input are not treated specially and do not
+ cause r\bre\bea\bad\bd to return until it has read _\bn_\bc_\bh_\ba_\br_\bs characters.
+ The result is not split on the characters in I\bIF\bFS\bS; the in-
+ tent is that the variable is assigned exactly the charac-
+ ters read (with the exception of backslash; see the -\b-r\br
+ option below).
-\b-p\bp _\bp_\br_\bo_\bm_\bp_\bt
Display _\bp_\br_\bo_\bm_\bp_\bt 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.
-\b-r\br 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.
-\b-s\bs Silent mode. If input is coming from a terminal, charac-
ters are not echoed.
-\b-t\bt _\bt_\bi_\bm_\be_\bo_\bu_\bt
- Cause r\bre\bea\bad\bd to time out and return failure if a complete
- line of input (or a specified number of characters) is
- not read within _\bt_\bi_\bm_\be_\bo_\bu_\bt seconds. _\bt_\bi_\bm_\be_\bo_\bu_\bt may be a deci-
- mal number with a fractional portion following the deci-
- mal point. This option is only effective if r\bre\bea\bad\bd is
- reading input from a terminal, pipe, or other special
- file; it has no effect when reading from regular files.
- If r\bre\bea\bad\bd times out, r\bre\bea\bad\bd saves any partial input read into
- the specified variable _\bn_\ba_\bm_\be. If _\bt_\bi_\bm_\be_\bo_\bu_\bt is 0, r\bre\bea\bad\bd 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.
- -\b-u\bu _\bf_\bd Read input from file descriptor _\bf_\bd.
-
- Other than the case where _\bd_\be_\bl_\bi_\bm is the empty string, r\bre\bea\bad\bd ig-
+ Cause r\bre\bea\bad\bd to time out and return failure if it does not
+ read a complete line of input (or a specified number of
+ characters) within _\bt_\bi_\bm_\be_\bo_\bu_\bt seconds. _\bt_\bi_\bm_\be_\bo_\bu_\bt may be a
+ decimal number with a fractional portion following the
+ decimal point. This option is only effective if r\bre\bea\bad\bd is
+ reading input from a terminal, pipe, or other special
+ file; it has no effect when reading from regular files.
+ If r\bre\bea\bad\bd times out, it saves any partial input read into
+ the specified variable _\bn_\ba_\bm_\be, and the exit status is
+ greater than 128. If _\bt_\bi_\bm_\be_\bo_\bu_\bt is 0, r\bre\bea\bad\bd 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.
+ -\b-u\bu _\bf_\bd Read input from file descriptor _\bf_\bd instead of the stan-
+ dard input.
+
+ Other than the case where _\bd_\be_\bl_\bi_\bm is the empty string, r\bre\bea\bad\bd ig-
nores any NUL characters in the input.
- If no _\bn_\ba_\bm_\be_\bs are supplied, the line read, without the ending de-
- limiter but otherwise unmodified, is assigned to the variable
- R\bRE\bEP\bPL\bLY\bY. The exit status is zero, unless end-of-file is encoun-
- tered, r\bre\bea\bad\bd 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 -\b-u\bu.
+ If no _\bn_\ba_\bm_\be_\bs are supplied, r\bre\bea\bad\bd assigns the line read, without
+ the ending delimiter but otherwise unmodified, to the variable
+ R\bRE\bEP\bPL\bLY\bY.
+
+ The exit status is zero, unless end-of-file is encountered, r\bre\bea\bad\bd
+ 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 -\b-u\bu.
r\bre\bea\bad\bdo\bon\bnl\bly\by [-\b-a\baA\bAf\bf] [-\b-p\bp] [_\bn_\ba_\bm_\be[=_\bw_\bo_\br_\bd] ...]
The given _\bn_\ba_\bm_\be_\bs are marked readonly; the values of these _\bn_\ba_\bm_\be_\bs
- may not be changed by subsequent assignment. If the -\b-f\bf option
- is supplied, the functions corresponding to the _\bn_\ba_\bm_\be_\bs are so
- marked. The -\b-a\ba option restricts the variables to indexed ar-
- rays; the -\b-A\bA option restricts the variables to associative ar-
- rays. If both options are supplied, -\b-A\bA takes precedence. If no
- _\bn_\ba_\bm_\be arguments are given, or if the -\b-p\bp 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 -\b-p\bp option causes output to be displayed in a format
- that may be reused as input. If a variable name is followed by
- =_\bw_\bo_\br_\bd, the value of the variable is set to _\bw_\bo_\br_\bd. The return
- status is 0 unless an invalid option is encountered, one of the
- _\bn_\ba_\bm_\be_\bs is not a valid shell variable name, or -\b-f\bf is supplied with
- a _\bn_\ba_\bm_\be that is not a function.
+ may not be changed by subsequent assignment or unset. If the -\b-f\bf
+ option is supplied, each _\bn_\ba_\bm_\be refers to a shell function. The
+ -\b-a\ba option restricts the variables to indexed arrays; the -\b-A\bA op-
+ tion restricts the variables to associative arrays. If both op-
+ tions are supplied, -\b-A\bA takes precedence. If no _\bn_\ba_\bm_\be arguments
+ are supplied, or if the -\b-p\bp 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\bp op-
+ tion displays output in a format that may be reused as input.
+
+ r\bre\bea\bad\bdo\bon\bnl\bly\by allows the value of a variable to be set at the same
+ time the readonly attribute is changed by following the variable
+ name with =_\bv_\ba_\bl_\bu_\be. This sets the value of the variable is to
+ _\bv_\ba_\bl_\bu_\be while modifying the readonly attribute.
+
+ The return status is 0 unless an invalid option is encountered,
+ one of the _\bn_\ba_\bm_\be_\bs is not a valid shell variable name, or -\b-f\bf is
+ supplied with a _\bn_\ba_\bm_\be that is not a function.
r\bre\bet\btu\bur\brn\bn [_\bn]
- Causes a function to stop executing and return the value speci-
- fied by _\bn to its caller. If _\bn is omitted, the return status is
- that of the last command executed in the function body. If r\bre\be-\b-
- t\btu\bur\brn\bn 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 r\bre\bet\btu\bur\brn\bn is executed during a D\bDE\bEB\bBU\bUG\bG trap, the last
- command used to determine the status is the last command exe-
- cuted by the trap handler before r\bre\bet\btu\bur\brn\bn was invoked. If r\bre\bet\btu\bur\brn\bn
- is used outside a function, but during execution of a script by
- the .\b. (s\bso\bou\bur\brc\bce\be) command, it causes the shell to stop executing
- that script and return either _\bn or the exit status of the last
- command executed within the script as the exit status of the
- script. If _\bn is supplied, the return value is its least signif-
- icant 8 bits. The return status is non-zero if r\bre\bet\btu\bur\brn\bn is sup-
- plied a non-numeric argument, or is used outside a function and
- not during execution of a script by .\b. or s\bso\bou\bur\brc\bce\be. Any command
- associated with the R\bRE\bET\bTU\bUR\bRN\bN 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 _\bn to its caller. If _\bn is omitted, the return
+ status is that of the last command executed. If r\bre\bet\btu\bur\brn\bn 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
+ r\bre\bet\btu\bur\brn\bn is executed during a D\bDE\bEB\bBU\bUG\bG trap, the last command used to
+ determine the status is the last command executed by the trap
+ handler before r\bre\bet\btu\bur\brn\bn was invoked.
+
+ When r\bre\bet\btu\bur\brn\bn is used to terminate execution of a script being ex-
+ ecuted by the .\b. (s\bso\bou\bur\brc\bce\be) command, it causes the shell to stop
+ executing that script and return either _\bn or the exit status of
+ the last command executed within the script as the exit status
+ of the script. If _\bn is supplied, the return value is its least
+ significant 8 bits.
+
+ Any command associated with the R\bRE\bET\bTU\bUR\bRN\bN trap is executed before
+ execution resumes after the function or script.
+
+ The return status is non-zero if r\bre\bet\btu\bur\brn\bn is supplied a non-nu-
+ meric argument, or is used outside a function and not during ex-
+ ecution of a script by .\b. or s\bso\bou\bur\brc\bce\be.
s\bse\bet\bt [-\b-a\bab\bbe\bef\bfh\bhk\bkm\bmn\bnp\bpt\btu\buv\bvx\bxB\bBC\bCE\bEH\bHP\bPT\bT] [-\b-o\bo _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be] [-\b--\b-] [-\b-] [_\ba_\br_\bg ...]
s\bse\bet\bt [+\b+a\bab\bbe\bef\bfh\bhk\bkm\bmn\bnp\bpt\btu\buv\bvx\bxB\bBC\bCE\bEH\bHP\bPT\bT] [+\b+o\bo _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be] [-\b--\b-] [-\b-] [_\ba_\br_\bg ...]
s\bse\bet\bt -\b-o\bo
- s\bse\bet\bt +\b+o\bo 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-
+ s\bse\bet\bt +\b+o\bo 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 _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, 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 _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, 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 $\b$1\b1,
- $\b$2\b2, ..., $\b$_\bn. Options, if specified, have the following mean-
+ $\b$2\b2, ..., $\b$_\bn. Options, if specified, have the following mean-
ings:
-\b-a\ba 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.
- -\b-b\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.
+ -\b-b\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.
-\b-e\be Exit immediately if a _\bp_\bi_\bp_\be_\bl_\bi_\bn_\be (which may consist of a
single _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd), a _\bl_\bi_\bs_\bt, or a _\bc_\bo_\bm_\bp_\bo_\bu_\bn_\bd _\bc_\bo_\bm_\bm_\ba_\bn_\bd
(see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR in _\bb_\ba_\bs_\bh(1)), exits with a non-zero
no _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be, s\bse\bet\bt prints a series of s\bse\bet\bt commands to
recreate the current option settings on the standard
output.
- -\b-p\bp Turn on _\bp_\br_\bi_\bv_\bi_\bl_\be_\bg_\be_\bd mode. In this mode, the $\b$E\bEN\bNV\bV and
- $\b$B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV files are not processed, shell functions are
- not inherited from the environment, and the S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS,
- B\bBA\bAS\bSH\bHO\bOP\bPT\bTS\bS, C\bCD\bDP\bPA\bAT\bTH\bH, and G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE 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 -\b-p\bp option is not sup-
- plied, these actions are taken and the effective user id
- is set to the real user id. If the -\b-p\bp option is sup-
- plied at startup, the effective user id is not reset.
- Turning this option off causes the effective user and
+ -\b-p\bp Turn on _\bp_\br_\bi_\bv_\bi_\bl_\be_\bg_\be_\bd mode. In this mode, the shell does
+ not read the $\b$E\bEN\bNV\bV and $\b$B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV files, shell functions
+ are not inherited from the environment, and the S\bSH\bHE\bEL\bL-\b-
+ L\bLO\bOP\bPT\bTS\bS, B\bBA\bAS\bSH\bHO\bOP\bPT\bTS\bS, C\bCD\bDP\bPA\bAT\bTH\bH, and G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE 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 -\b-p\bp option is
+ not supplied, these actions are taken and the effective
+ user id is set to the real user id. If the -\b-p\bp 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.
-\b-r\br Enable restricted shell mode. This option cannot be un-
set once it has been set.
-\b-t\bt Exit after reading and executing one command.
-\b-u\bu 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.
-\b-v\bv Print shell input lines as they are read.
- -\b-x\bx After expanding each _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd, f\bfo\bor\br command, c\bca\bas\bse\be
+ -\b-x\bx After expanding each _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd, f\bfo\bor\br command, c\bca\bas\bse\be
command, s\bse\bel\ble\bec\bct\bt command, or arithmetic f\bfo\bor\br command, dis-
- play the expanded value of P\bPS\bS4\b4, followed by the command
- and its expanded arguments or associated word list, to
- standard error.
- -\b-B\bB The shell performs brace expansion (see B\bBr\bra\bac\bce\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
+ play the expanded value of P\bPS\bS4\b4, followed by the command
+ and its expanded arguments or associated word list, to
+ the standard error.
+ -\b-B\bB The shell performs brace expansion (see B\bBr\bra\bac\bce\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
in _\bb_\ba_\bs_\bh(1)). This is on by default.
- -\b-C\bC If set, b\bba\bas\bsh\bh does not overwrite an existing file with
- the >\b>, >\b>&\b&, and <\b<>\b> redirection operators. This may be
- overridden when creating output files by using the redi-
- rection operator >\b>|\b| instead of >\b>.
+ -\b-C\bC If set, b\bba\bas\bsh\bh does not overwrite an existing file with
+ the >\b>, >\b>&\b&, and <\b<>\b> redirection operators. Using the
+ redirection operator >\b>|\b| instead of >\b> will override this
+ and force the creation of an output file.
-\b-E\bE If set, any trap on E\bER\bRR\bR is inherited by shell functions,
command substitutions, and commands executed in a sub-
shell environment. The E\bER\bRR\bR trap is normally not inher-
shell functions, command substitutions, and commands ex-
ecuted in a subshell environment. The D\bDE\bEB\bBU\bUG\bG and R\bRE\bET\bTU\bUR\bRN\bN
traps are normally not inherited in such cases.
- -\b--\b- If no arguments follow this option, then the positional
- parameters are unset. Otherwise, the positional parame-
- ters are set to the _\ba_\br_\bgs, even if some of them begin
- with a -\b-.
- -\b- Signal the end of options, cause all remaining _\ba_\br_\bgs to
- be assigned to the positional parameters. The -\b-x\bx and -\b-v\bv
- options are turned off. If there are no _\ba_\br_\bgs, the posi-
- tional parameters remain unchanged.
+ -\b--\b- If no arguments follow this option, unset the positional
+ parameters. Otherwise, set the positional parameters to
+ the _\ba_\br_\bgs, even if some of them begin with a -\b-.
+ -\b- Signal the end of options, and assign all remaining _\ba_\br_\bgs
+ to the positional parameters. The -\b-x\bx and -\b-v\bv options are
+ turned off. If there are no _\ba_\br_\bgs, 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 $\b$-\b-. 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.
s\bsh\bhi\bif\bft\bt [_\bn]
- The positional parameters from _\bn+1 ... are renamed to $\b$1\b1 .\b..\b..\b..\b.
- Parameters represented by the numbers $\b$#\b# down to $\b$#\b#-_\bn+1 are un-
- set. _\bn must be a non-negative number less than or equal to $\b$#\b#.
- If _\bn is 0, no parameters are changed. If _\bn is not given, it is
- assumed to be 1. If _\bn is greater than $\b$#\b#, the positional para-
- meters are not changed. The return status is greater than zero
- if _\bn is greater than $\b$#\b# or less than zero; otherwise 0.
+ Rename positional parameters from _\bn+1 ... to $\b$1\b1 .\b..\b..\b..\b. Parameters
+ represented by the numbers $\b$#\b# down to $\b$#\b#-_\bn+1 are unset. _\bn must
+ be a non-negative number less than or equal to $\b$#\b#. If _\bn is 0,
+ no parameters are changed. If _\bn is not given, it is assumed to
+ be 1. If _\bn is greater than $\b$#\b#, the positional parameters are
+ not changed. The return status is greater than zero if _\bn is
+ greater than $\b$#\b# or less than zero; otherwise 0.
s\bsh\bho\bop\bpt\bt [-\b-p\bpq\bqs\bsu\bu] [-\b-o\bo] [_\bo_\bp_\bt_\bn_\ba_\bm_\be ...]
- 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
-\b-o\bo option is used, those available with the -\b-o\bo option to the s\bse\bet\bt
- builtin command. With no options, or with the -\b-p\bp option, a list
- of all settable options is displayed, with an indication of
- whether or not each is set; if _\bo_\bp_\bt_\bn_\ba_\bm_\be_\bs are supplied, the output
- is restricted to those options. The -\b-p\bp 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 -\b-p\bp option, dis-
+ play a list of all settable options, with an indication of
+ whether or not each is set; if any _\bo_\bp_\bt_\bn_\ba_\bm_\be_\bs are supplied, the
+ output is restricted to those options. The -\b-p\bp option displays
+ output in a form that may be reused as input. Other options
+ have the following meanings:
-\b-s\bs Enable (set) each _\bo_\bp_\bt_\bn_\ba_\bm_\be.
-\b-u\bu Disable (unset) each _\bo_\bp_\bt_\bn_\ba_\bm_\be.
- -\b-q\bq Suppresses normal output (quiet mode); the return status
+ -\b-q\bq Suppresses normal output (quiet mode); the return status
indicates whether the _\bo_\bp_\bt_\bn_\ba_\bm_\be is set or unset. If multi-
- ple _\bo_\bp_\bt_\bn_\ba_\bm_\be arguments are given with -\b-q\bq, the return sta-
- tus is zero if all _\bo_\bp_\bt_\bn_\ba_\bm_\be_\bs are enabled; non-zero other-
- wise.
+ ple _\bo_\bp_\bt_\bn_\ba_\bm_\be arguments are supplied with -\b-q\bq, the return
+ status is zero if all _\bo_\bp_\bt_\bn_\ba_\bm_\be_\bs are enabled; non-zero oth-
+ erwise.
-\b-o\bo Restricts the values of _\bo_\bp_\bt_\bn_\ba_\bm_\be to be those defined for
the -\b-o\bo option to the s\bse\bet\bt builtin.
If set, an argument to the c\bcd\bd builtin command that is
not a directory is assumed to be the name of a variable
whose value is the directory to change to.
- c\bcd\bds\bsp\bpe\bel\bll\bl If set, minor errors in the spelling of a directory com-
- ponent in a c\bcd\bd 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.
+ c\bcd\bds\bsp\bpe\bel\bll\bl If set, the c\bcd\bd 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 c\bcd\bd corrects the directory name,
+ it prints the corrected filename, and the command pro-
+ ceeds. This option is only used by interactive shells.
c\bch\bhe\bec\bck\bkh\bha\bas\bsh\bh
If set, b\bba\bas\bsh\bh 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, b\bba\bas\bsh\bh performs a normal path
+ search.
c\bch\bhe\bec\bck\bkj\bjo\bob\bbs\bs
If set, b\bba\bas\bsh\bh 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 J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL in _\bb_\ba_\bs_\bh(1)). The shell always post-
- pones exiting if any jobs are stopped.
+ are running, b\bba\bas\bsh\bh defers the exit until a second exit is
+ attempted without an intervening command (see J\bJO\bOB\bB C\bCO\bON\bN-\b-
+ T\bTR\bRO\bOL\bL in _\bb_\ba_\bs_\bh(1)). The shell always postpones exiting if
+ any jobs are stopped.
c\bch\bhe\bec\bck\bkw\bwi\bin\bns\bsi\biz\bze\be
- If set, b\bba\bas\bsh\bh checks the window size after each external
- (non-builtin) command and, if necessary, updates the
- values of L\bLI\bIN\bNE\bES\bS and C\bCO\bOL\bLU\bUM\bMN\bNS\bS. This option is enabled by
- default.
+ If set, b\bba\bas\bsh\bh checks the window size after each external
+ (non-builtin) command and, if necessary, updates the
+ values of L\bLI\bIN\bNE\bES\bS and C\bCO\bOL\bLU\bUM\bMN\bNS\bS, using the file descriptor
+ associated with the standard error if it is a terminal.
+ This option is enabled by default.
c\bcm\bmd\bdh\bhi\bis\bst\bt If set, b\bba\bas\bsh\bh 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
e\bex\bxe\bec\bcf\bfa\bai\bil\bl
If set, a non-interactive shell will not exit if it can-
not execute the file specified as an argument to the
- e\bex\bxe\bec\bc builtin command. An interactive shell does not
- exit if e\bex\bxe\bec\bc fails.
+ e\bex\bxe\bec\bc builtin. An interactive shell does not exit if
+ e\bex\bxe\bec\bc fails.
e\bex\bxp\bpa\ban\bnd\bd_\b_a\bal\bli\bia\bas\bse\bes\bs
If set, aliases are expanded as described in _\bb_\ba_\bs_\bh(1) un-
shell functions, and subshells invoked with (\b(
_\bc_\bo_\bm_\bm_\ba_\bn_\bd )\b) inherit the E\bER\bRR\bR trap.
- e\bex\bxt\btg\bgl\blo\bob\bb If set, the extended pattern matching features described
- in _\bb_\ba_\bs_\bh(1) under P\bPa\bat\bth\bhn\bna\bam\bme\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn are enabled.
+ e\bex\bxt\btg\bgl\blo\bob\bb If set, enable the extended pattern matching features
+ described in _\bb_\ba_\bs_\bh(1) under P\bPa\bat\bth\bhn\bna\bam\bme\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn.
e\bex\bxt\btq\bqu\buo\bot\bte\be
- If set, $\b$_\bs_\bt_\br_\bi_\bn_\bg and $\b$_\bs_\bt_\br_\bi_\bn_\bg quoting is performed within
+ If set, $\b$_\bs_\bt_\br_\bi_\bn_\bg and $\b$_\bs_\bt_\br_\bi_\bn_\bg quoting is performed within
$\b${\b{_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br}\b} expansions enclosed in double quotes. This
option is enabled by default.
f\bfa\bai\bil\blg\bgl\blo\bob\bb
- 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.
f\bfo\bor\brc\bce\be_\b_f\bfi\big\bgn\bno\bor\bre\be
- If set, the suffixes specified by the F\bFI\bIG\bGN\bNO\bOR\bRE\bE shell
- variable cause words to be ignored when performing word
+ If set, the suffixes specified by the F\bFI\bIG\bGN\bNO\bOR\bRE\bE shell
+ variable cause words to be ignored when performing word
completion even if the ignored words are the only possi-
- ble completions. See S\bSH\bHE\bEL\bLL\bL V\bVA\bAR\bRI\bIA\bAB\bBL\bLE\bES\bS in _\bb_\ba_\bs_\bh(1) for a
- description of F\bFI\bIG\bGN\bNO\bOR\bRE\bE. This option is enabled by de-
+ ble completions. See S\bSH\bHE\bEL\bLL\bL V\bVA\bAR\bRI\bIA\bAB\bBL\bLE\bES\bS in _\bb_\ba_\bs_\bh(1) for a
+ description of F\bFI\bIG\bGN\bNO\bOR\bRE\bE. This option is enabled by de-
fault.
g\bgl\blo\bob\bba\bas\bsc\bci\bii\bir\bra\ban\bng\bge\bes\bs
- If set, range expressions used in pattern matching
- bracket expressions (see P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg in _\bb_\ba_\bs_\bh(1))
+ If set, range expressions used in pattern matching
+ bracket expressions (see P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg in _\bb_\ba_\bs_\bh(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 b\bb will not col-
- late between A\bA and B\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
+ b\bb will not collate between A\bA and B\bB, and upper-case and
+ lower-case ASCII characters will collate together.
g\bgl\blo\bob\bbs\bsk\bki\bip\bpd\bdo\bot\bts\bs
If set, pathname expansion will never match the file-
its, rather than overwriting the file.
h\bhi\bis\bst\btr\bre\bee\bed\bdi\bit\bt
- If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, a user is given the
- opportunity to re-edit a failed history substitution.
+ If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, the user is given
+ the opportunity to re-edit a failed history substitu-
+ tion.
h\bhi\bis\bst\btv\bve\ber\bri\bif\bfy\by
- If set, and r\bre\bea\bad\bdl\bli\bin\bne\be 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 r\bre\bea\bad\bdl\bli\bin\bne\be 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 r\bre\bea\bad\bdl\bli\bin\bne\be editing buffer, allowing further modi-
fication.
h\bho\bos\bst\btc\bco\bom\bmp\bpl\ble\bet\bte\be
If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, b\bba\bas\bsh\bh will attempt to
- perform hostname completion when a word containing a @\b@
- is being completed (see C\bCo\bom\bmp\bpl\ble\bet\bti\bin\bng\bg under R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE in
+ perform hostname completion when a word containing a @\b@
+ is being completed (see C\bCo\bom\bmp\bpl\ble\bet\bti\bin\bng\bg under R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE in
_\bb_\ba_\bs_\bh(1)). This is enabled by default.
h\bhu\bup\bpo\bon\bne\bex\bxi\bit\bt
active login shell exits.
i\bin\bnh\bhe\ber\bri\bit\bt_\b_e\ber\brr\bre\bex\bxi\bit\bt
- If set, command substitution inherits the value of the
- e\ber\brr\bre\bex\bxi\bit\bt option, instead of unsetting it in the subshell
- environment. This option is enabled when _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be is
+ If set, command substitution inherits the value of the
+ e\ber\brr\bre\bex\bxi\bit\bt option, instead of unsetting it in the subshell
+ environment. This option is enabled when _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be is
enabled.
i\bin\bnt\bte\ber\bra\bac\bct\bti\biv\bve\be_\b_c\bco\bom\bmm\bme\ben\bnt\bts\bs
- 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 C\bCO\bOM\bMM\bME\bEN\bNT\bTS\bS in _\bb_\ba_\bs_\bh(1)). This
- option is enabled by default.
+ In an interactive shell, a word beginning with #\b# causes
+ that word and all remaining characters on that line to
+ be ignored, as in a non-interactive shell (see C\bCO\bOM\bMM\bME\bEN\bNT\bTS\bS
+ in _\bb_\ba_\bs_\bh(1)). This option is enabled by default.
l\bla\bas\bst\btp\bpi\bip\bpe\be
- 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.
- l\bli\bit\bth\bhi\bis\bst\bt If set, and the c\bcm\bmd\bdh\bhi\bis\bst\bt option is enabled, multi-line
+ l\bli\bit\bth\bhi\bis\bst\bt If set, and the c\bcm\bmd\bdh\bhi\bis\bst\bt option is enabled, multi-line
commands are saved to the history with embedded newlines
rather than using semicolon separators where possible.
tribute is not inherited.
l\blo\boc\bca\bal\blv\bva\bar\br_\b_u\bun\bns\bse\bet\bt
- If set, calling u\bun\bns\bse\bet\bt 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 u\bun\bns\bse\bet\bt 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.
displays the message
n\bno\bo_\b_e\bem\bmp\bpt\bty\by_\b_c\bcm\bmd\bd_\b_c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn
- If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, b\bba\bas\bsh\bh will not at-
- tempt to search the P\bPA\bAT\bTH\bH for possible completions when
- completion is attempted on an empty line.
+ If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, b\bba\bas\bsh\bh does not search
+ P\bPA\bAT\bTH\bH for possible completions when completion is at-
+ tempted on an empty line.
n\bno\boc\bca\bas\bse\beg\bgl\blo\bob\bb
- If set, b\bba\bas\bsh\bh matches filenames in a case-insensitive
+ If set, b\bba\bas\bsh\bh matches filenames in a case-insensitive
fashion when performing pathname expansion (see P\bPa\bat\bth\bhn\bna\bam\bme\be
E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn in _\bb_\ba_\bs_\bh(1)).
n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh
- If set, b\bba\bas\bsh\bh matches patterns in a case-insensitive
+ If set, b\bba\bas\bsh\bh matches patterns in a case-insensitive
fashion when performing matching while executing c\bca\bas\bse\be or
[\b[[\b[ 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.
n\bno\boe\bex\bxp\bpa\ban\bnd\bd_\b_t\btr\bra\ban\bns\bsl\bla\bat\bti\bio\bon\bn
- If set, b\bba\bas\bsh\bh encloses the translated results of $\b$...
- quoting in single quotes instead of double quotes. If
+ If set, b\bba\bas\bsh\bh encloses the translated results of $\b$...
+ quoting in single quotes instead of double quotes. If
the string is not translated, this has no effect.
n\bnu\bul\bll\blg\bgl\blo\bob\bb
If set, pathname expansion patterns which match no files
- (see P\bPa\bat\bth\bhn\bna\bam\bme\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn in _\bb_\ba_\bs_\bh(1)) expand to nothing
+ (see P\bPa\bat\bth\bhn\bna\bam\bme\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn in _\bb_\ba_\bs_\bh(1)) expand to nothing
and are removed, rather than expanding to themselves.
p\bpa\bat\bts\bsu\bub\bb_\b_r\bre\bep\bpl\bla\bac\bce\bem\bme\ben\bnt\bt
If set, b\bba\bas\bsh\bh expands occurrences of &\b& in the replacement
- string of pattern substitution to the text matched by
- the pattern, as described under P\bPa\bar\bra\bam\bme\bet\bte\ber\br E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn in
+ string of pattern substitution to the text matched by
+ the pattern, as described under P\bPa\bar\bra\bam\bme\bet\bte\ber\br E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn in
_\bb_\ba_\bs_\bh(1). This option is enabled by default.
p\bpr\bro\bog\bgc\bco\bom\bmp\bp
- If set, the programmable completion facilities (see P\bPr\bro\bo-\b-
- g\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn in _\bb_\ba_\bs_\bh(1)) are enabled. This op-
- tion is enabled by default.
+ If set, enable the programmable completion facilities
+ (see P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn in _\bb_\ba_\bs_\bh(1)). This option
+ is enabled by default.
p\bpr\bro\bog\bgc\bco\bom\bmp\bp_\b_a\bal\bli\bia\bas\bs
If set, and programmable completion is enabled, b\bba\bas\bsh\bh
treats a command name that doesn't have any completions
- as a possible alias and attempts alias expansion. If it
- has an alias, b\bba\bas\bsh\bh attempts programmable completion us-
+ as a possible alias and attempts alias expansion. If it
+ has an alias, b\bba\bas\bsh\bh attempts programmable completion us-
ing the command word resulting from the expanded alias.
p\bpr\bro\bom\bmp\bpt\btv\bva\bar\brs\bs
If set, prompt strings undergo parameter expansion, com-
- mand substitution, arithmetic expansion, and quote re-
- moval after being expanded as described in P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG in
+ mand substitution, arithmetic expansion, and quote re-
+ moval after being expanded as described in P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG in
_\bb_\ba_\bs_\bh(1). This option is enabled by default.
r\bre\bes\bst\btr\bri\bic\bct\bte\bed\bd_\b_s\bsh\bhe\bel\bll\bl
- The shell sets this option if it is started in re-
- stricted mode (see R\bRE\bES\bST\bTR\bRI\bIC\bCT\bTE\bED\bD S\bSH\bHE\bEL\bLL\bL in _\bb_\ba_\bs_\bh(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 R\bRE\bES\bST\bTR\bRI\bIC\bCT\bTE\bED\bD S\bSH\bHE\bEL\bLL\bL in _\bb_\ba_\bs_\bh(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.
s\bsh\bhi\bif\bft\bt_\b_v\bve\ber\brb\bbo\bos\bse\be
- If set, the s\bsh\bhi\bif\bft\bt builtin prints an error message when
+ If set, the s\bsh\bhi\bif\bft\bt builtin prints an error message when
the shift count exceeds the number of positional parame-
ters.
s\bso\bou\bur\brc\bce\bep\bpa\bat\bth\bh
If set, the .\b. (s\bso\bou\bur\brc\bce\be) builtin uses the value of P\bPA\bAT\bTH\bH to
- find the directory containing the file supplied as an
- argument when the -\b-p\bp option is not supplied. This op-
+ find the directory containing the file supplied as an
+ argument when the -\b-p\bp option is not supplied. This op-
tion is enabled by default.
v\bva\bar\brr\bre\bed\bdi\bir\br_\b_c\bcl\blo\bos\bse\be
- If set, the shell automatically closes file descriptors
- assigned using the _\b{_\bv_\ba_\br_\bn_\ba_\bm_\be_\b} redirection syntax (see
- R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN in _\bb_\ba_\bs_\bh(1)) instead of leaving them open
+ If set, the shell automatically closes file descriptors
+ assigned using the _\b{_\bv_\ba_\br_\bn_\ba_\bm_\be_\b} redirection syntax (see
+ R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN in _\bb_\ba_\bs_\bh(1)) instead of leaving them open
when the command completes.
x\bxp\bpg\bg_\b_e\bec\bch\bho\bo
- If set, the e\bec\bch\bho\bo builtin expands backslash-escape se-
- quences by default. If the p\bpo\bos\bsi\bix\bx shell option is also
+ If set, the e\bec\bch\bho\bo builtin expands backslash-escape se-
+ quences by default. If the p\bpo\bos\bsi\bix\bx shell option is also
enabled, e\bec\bch\bho\bo does not interpret any options.
s\bsu\bus\bsp\bpe\ben\bnd\bd [-\b-f\bf]
- Suspend the execution of this shell until it receives a S\bSI\bIG\bGC\bCO\bON\bNT\bT
- signal. A login shell, or a shell without job control enabled,
- cannot be suspended; the -\b-f\bf 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 -\b-f\bf is
- not supplied.
+ Suspend the execution of this shell until it receives a S\bSI\bIG\bGC\bCO\bON\bNT\bT
+ signal. A login shell, or a shell without job control enabled,
+ cannot be suspended; the -\b-f\bf 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 -\b-f\bf is not sup-
+ plied.
t\bte\bes\bst\bt _\be_\bx_\bp_\br
[\b[ _\be_\bx_\bp_\br ]\b]
Return a status of 0 (true) or 1 (false) depending on the evalu-
- ation of the conditional expression _\be_\bx_\bp_\br. Each operator and
- operand must be a separate argument. Expressions are composed
- of the primaries described in _\bb_\ba_\bs_\bh(1) under C\bCO\bON\bND\bDI\bIT\bTI\bIO\bON\bNA\bAL\bL E\bEX\bXP\bPR\bRE\bES\bS-\b-
+ ation of the conditional expression _\be_\bx_\bp_\br. Each operator and
+ operand must be a separate argument. Expressions are composed
+ of the primaries described in _\bb_\ba_\bs_\bh(1) under C\bCO\bON\bND\bDI\bIT\bTI\bIO\bON\bNA\bAL\bL E\bEX\bXP\bPR\bRE\bES\bS-\b-
S\bSI\bIO\bON\bNS\bS. t\bte\bes\bst\bt does not accept any options, nor does it accept and
ignore an argument of -\b--\b- 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. t\bte\bes\bst\bt uses operator
+ precedence when there are five or more arguments.
!\b! _\be_\bx_\bp_\br True if _\be_\bx_\bp_\br is false.
(\b( _\be_\bx_\bp_\br )\b)
Returns the value of _\be_\bx_\bp_\br. This may be used to override
- the normal precedence of operators.
+ normal operator precedence.
_\be_\bx_\bp_\br_\b1 -a\ba _\be_\bx_\bp_\br_\b2
True if both _\be_\bx_\bp_\br_\b1 and _\be_\bx_\bp_\br_\b2 are true.
_\be_\bx_\bp_\br_\b1 -o\bo _\be_\bx_\bp_\br_\b2
The following conditions are applied in the order listed.
If the first argument is !\b!, 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 (\b( and
- the fourth argument is exactly )\b), 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 (\b( and the
+ fourth argument is exactly )\b), 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 _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, or if the expression is part of
the [\b[[\b[ command, the <\b< and >\b> operators sort using the current lo-
- cale. If the shell is not in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, the t\bte\bes\bst\bt and [\b[ com-
+ cale. If the shell is not in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, the t\bte\bes\bst\bt and [\b[ 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 -\b-a\ba and -\b-o\bo 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 -\b-a\ba and
+ -\b-o\bo with the shell's &\b&&\b& and |\b||\b| list operators.
+
t\bti\bim\bme\bes\bs Print the accumulated user and system times for the shell and
for processes run from the shell. The return status is 0.
- t\btr\bra\bap\bp [-\b-l\blp\bp] [[_\ba_\bc_\bt_\bi_\bo_\bn] _\bs_\bi_\bg_\bs_\bp_\be_\bc ...]
+ t\btr\bra\bap\bp [-\b-P\bPl\blp\bp] [[_\ba_\bc_\bt_\bi_\bo_\bn] _\bs_\bi_\bg_\bs_\bp_\be_\bc ...]
The _\ba_\bc_\bt_\bi_\bo_\bn is a command that is read and executed when the shell
- receives signal(s) _\bs_\bi_\bg_\bs_\bp_\be_\bc. If _\ba_\bc_\bt_\bi_\bo_\bn is absent (and there is a
- single _\bs_\bi_\bg_\bs_\bp_\be_\bc) or -\b-, each specified signal is reset to its
- original disposition (the value it had upon entrance to the
- shell). If _\ba_\bc_\bt_\bi_\bo_\bn is the null string the signal specified by
- each _\bs_\bi_\bg_\bs_\bp_\be_\bc is ignored by the shell and by the commands it in-
- vokes.
-
- If no arguments are supplied, t\btr\bra\bap\bp displays the actions associ-
+ receives any of the signals _\bs_\bi_\bg_\bs_\bp_\be_\bc. If _\ba_\bc_\bt_\bi_\bo_\bn is absent (and
+ there is a single _\bs_\bi_\bg_\bs_\bp_\be_\bc) or -\b-, each specified _\bs_\bi_\bg_\bs_\bp_\be_\bc is reset
+ to the value it had when the shell was started. If _\ba_\bc_\bt_\bi_\bo_\bn is
+ the null string the signal specified by each _\bs_\bi_\bg_\bs_\bp_\be_\bc is ignored
+ by the shell and by the commands it invokes.
+
+ If no arguments are supplied, t\btr\bra\bap\bp displays the actions associ-
ated with each trapped signal as a set of t\btr\bra\bap\bp commands that can
- be reused as shell input to restore the current signal disposi-
- tions. If -\b-p\bp is given, and _\ba_\bc_\bt_\bi_\bo_\bn is not present, then t\btr\bra\bap\bp
- displays the actions associated with each _\bs_\bi_\bg_\bs_\bp_\be_\bc or, if none
+ be reused as shell input to restore the current signal disposi-
+ tions. If -\b-p\bp is given, and _\ba_\bc_\bt_\bi_\bo_\bn is not present, then t\btr\bra\bap\bp
+ displays the actions associated with each _\bs_\bi_\bg_\bs_\bp_\be_\bc or, if none
are supplied, for all trapped signals, as a set of t\btr\bra\bap\bp commands
- that can be reused as shell input to restore the current signal
- dispositions. The -\b-P\bP option behaves similarly, but displays
- only the actions associated with each _\bs_\bi_\bg_\bs_\bp_\be_\bc argument. -\b-P\bP re-
- quires at least one _\bs_\bi_\bg_\bs_\bp_\be_\bc argument. The -\b-P\bP or -\b-p\bp options to
- t\btr\bra\bap\bp may be used in a subshell environment (e.g., command sub-
- stitution) and, as long as they are used before t\btr\bra\bap\bp is used to
- change a signal's handling, will display the state of its par-
- ent's traps.
-
- The -\b-l\bl option causes t\btr\bra\bap\bp to print a list of signal names and
- their corresponding numbers. Each _\bs_\bi_\bg_\bs_\bp_\be_\bc is either a signal
- name defined in <_\bs_\bi_\bg_\bn_\ba_\bl_\b._\bh>, or a signal number. Signal names
- are case insensitive and the S\bSI\bIG\bG prefix is optional.
-
- If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is E\bEX\bXI\bIT\bT (0) the command _\ba_\bc_\bt_\bi_\bo_\bn is executed on exit
- from the shell. If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is D\bDE\bEB\bBU\bUG\bG, the command _\ba_\bc_\bt_\bi_\bo_\bn is
- executed before every _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd, _\bf_\bo_\br command, _\bc_\ba_\bs_\be command,
- _\bs_\be_\bl_\be_\bc_\bt command, (( arithmetic command, [[ conditional command,
- arithmetic _\bf_\bo_\br command, and before the first command executes in
- a shell function (see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR in _\bb_\ba_\bs_\bh(1)). Refer to the
- description of the e\bex\bxt\btd\bde\beb\bbu\bug\bg option to the s\bsh\bho\bop\bpt\bt builtin for de-
- tails of its effect on the D\bDE\bEB\bBU\bUG\bG trap. If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is R\bRE\bET\bTU\bUR\bRN\bN,
- the command _\ba_\bc_\bt_\bi_\bo_\bn is executed each time a shell function or a
- script executed with the .\b. or s\bso\bou\bur\brc\bce\be builtins finishes execut-
- ing.
-
- If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is E\bER\bRR\bR, the command _\ba_\bc_\bt_\bi_\bo_\bn 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 E\bER\bRR\bR trap is not executed if the
+ that can be reused as shell input to restore the current signal
+ dispositions. The -\b-P\bP option behaves similarly, but displays
+ only the actions associated with each _\bs_\bi_\bg_\bs_\bp_\be_\bc argument. -\b-P\bP re-
+ quires at least one _\bs_\bi_\bg_\bs_\bp_\be_\bc argument. The -\b-P\bP or -\b-p\bp options may
+ be used in a subshell environment (e.g., command substitution)
+ and, as long as they are used before t\btr\bra\bap\bp is used to change a
+ signal's handling, will display the state of its parent's traps.
+
+ The -\b-l\bl option prints a list of signal names and their corre-
+ sponding numbers. Each _\bs_\bi_\bg_\bs_\bp_\be_\bc is either a signal name defined
+ in <_\bs_\bi_\bg_\bn_\ba_\bl_\b._\bh>, or a signal number. Signal names are case insen-
+ sitive and the S\bSI\bIG\bG prefix is optional. If -\b-l\bl is supplied with
+ no _\bs_\bi_\bg_\bs_\bp_\be_\bc arguments, it prints a list of valid signal names.
+
+ If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is E\bEX\bXI\bIT\bT (0), _\ba_\bc_\bt_\bi_\bo_\bn is executed on exit from the
+ shell. If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is D\bDE\bEB\bBU\bUG\bG, _\ba_\bc_\bt_\bi_\bo_\bn is executed before every
+ _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd, _\bf_\bo_\br command, _\bc_\ba_\bs_\be command, _\bs_\be_\bl_\be_\bc_\bt command, ((
+ arithmetic command, [[ conditional command, arithmetic _\bf_\bo_\br com-
+ mand, and before the first command executes in a shell function
+ (see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR in _\bb_\ba_\bs_\bh(1)). Refer to the description of the
+ e\bex\bxt\btd\bde\beb\bbu\bug\bg shell option (see s\bsh\bho\bop\bpt\bt in _\bb_\ba_\bs_\bh(1)) for details of its
+ effect on the D\bDE\bEB\bBU\bUG\bG trap. If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is R\bRE\bET\bTU\bUR\bRN\bN, _\ba_\bc_\bt_\bi_\bo_\bn is ex-
+ ecuted each time a shell function or a script executed with the
+ .\b. or s\bso\bou\bur\brc\bce\be builtins finishes executing.
+
+ If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is E\bER\bRR\bR, _\ba_\bc_\bt_\bi_\bo_\bn 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 E\bER\bRR\bR trap is not executed if the
failed command is part of the command list immediately following
- a w\bwh\bhi\bil\ble\be or u\bun\bnt\bti\bil\bl keyword, part of the test in an _\bi_\bf statement,
+ a w\bwh\bhi\bil\ble\be or u\bun\bnt\bti\bil\bl keyword, part of the test in an _\bi_\bf statement,
part of a command executed in a &\b&&\b& or |\b||\b| list except the command
- following the final &\b&&\b& or |\b||\b|, any command in a pipeline but the
- last, or if the command's return value is being inverted using
- !\b!. These are the same conditions obeyed by the e\ber\brr\bre\bex\bxi\bit\bt (-\b-e\be) op-
- tion.
+ following the final &\b&&\b& or |\b||\b|, any command in a pipeline but the
+ last (subject to the state of the p\bpi\bip\bpe\bef\bfa\bai\bil\bl shell option), or if
+ the command's return value is being inverted using !\b!. These are
+ the same conditions obeyed by the e\ber\brr\bre\bex\bxi\bit\bt (-\b-e\be) 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 _\bs_\bi_\bg_\bs_\bp_\be_\bc is invalid; otherwise t\btr\bra\bap\bp returns true.
t\btr\bru\bue\be Does nothing, returns a 0 status.
t\bty\byp\bpe\be [-\b-a\baf\bft\btp\bpP\bP] _\bn_\ba_\bm_\be [_\bn_\ba_\bm_\be ...]
- With no options, indicate how each _\bn_\ba_\bm_\be would be interpreted if
- used as a command name. If the -\b-t\bt option is used, t\bty\byp\bpe\be prints a
- string which is one of _\ba_\bl_\bi_\ba_\bs, _\bk_\be_\by_\bw_\bo_\br_\bd, _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn, _\bb_\bu_\bi_\bl_\bt_\bi_\bn, or
- _\bf_\bi_\bl_\be if _\bn_\ba_\bm_\be is an alias, shell reserved word, function,
- builtin, or executable disk file, respectively. If the _\bn_\ba_\bm_\be is
- not found, then nothing is printed, and t\bty\byp\bpe\be returns a non-zero
- exit status. If the -\b-p\bp option is used, t\bty\byp\bpe\be either returns the
- name of the executable file that would be found by searching
- $\b$P\bPA\bAT\bTH\bH if _\bn_\ba_\bm_\be were specified as a command name, or nothing if
- would not return _\bf_\bi_\bl_\be. The -\b-P\bP option forces a P\bPA\bAT\bTH\bH search for
- each _\bn_\ba_\bm_\be, even if would not return _\bf_\bi_\bl_\be. If a command is
- hashed, -\b-p\bp and -\b-P\bP print the hashed value, which is not necessar-
- ily the file that appears first in P\bPA\bAT\bTH\bH. If the -\b-a\ba option is
- used, t\bty\byp\bpe\be prints all of the places that contain a command named
- _\bn_\ba_\bm_\be. This includes aliases, reserved words, functions, and
- builtins, but the path search options (-\b-p\bp and -\b-P\bP) can be sup-
- plied to restrict the output to executable files. t\bty\byp\bpe\be does not
- consult the table of hashed commands when using -\b-a\ba with -\b-p\bp, and
- only performs a P\bPA\bAT\bTH\bH search for _\bn_\ba_\bm_\be. The -\b-f\bf option suppresses
- shell function lookup, as with the c\bco\bom\bmm\bma\ban\bnd\bd builtin. t\bty\byp\bpe\be re-
- turns true if all of the arguments are found, false if any are
- not found.
+ Indicate how each _\bn_\ba_\bm_\be would be interpreted if used as a command
+ name.
+
+ If the -\b-t\bt option is used, t\bty\byp\bpe\be prints a string which is one of
+ _\ba_\bl_\bi_\ba_\bs, _\bk_\be_\by_\bw_\bo_\br_\bd, _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn, _\bb_\bu_\bi_\bl_\bt_\bi_\bn, or _\bf_\bi_\bl_\be if _\bn_\ba_\bm_\be is an alias,
+ shell reserved word, function, builtin, or executable file, re-
+ spectively. If the _\bn_\ba_\bm_\be is not found, t\bty\byp\bpe\be prints nothing and
+ returns a non-zero exit status.
+
+ If the -\b-p\bp option is used, t\bty\byp\bpe\be either returns the pathname of
+ the executable file that would be found by searching $\b$P\bPA\bAT\bTH\bH for
+ _\bn_\ba_\bm_\be or nothing if would not return _\bf_\bi_\bl_\be. The -\b-P\bP option forces
+ a P\bPA\bAT\bTH\bH search for each _\bn_\ba_\bm_\be, even if would not return _\bf_\bi_\bl_\be. If
+ _\bn_\ba_\bm_\be is present in the table of hashed commands, -\b-p\bp and -\b-P\bP print
+ the hashed value, which is not necessarily the file that appears
+ first in P\bPA\bAT\bTH\bH.
+
+ If the -\b-a\ba option is used, t\bty\byp\bpe\be prints all of the places that
+ contain a command named _\bn_\ba_\bm_\be. This includes aliases, reserved
+ words, functions, and builtins, but the path search options (-\b-p\bp
+ and -\b-P\bP) can be supplied to restrict the output to executable
+ files. t\bty\byp\bpe\be does not consult the table of hashed commands when
+ using -\b-a\ba with -\b-p\bp, and only performs a P\bPA\bAT\bTH\bH search for _\bn_\ba_\bm_\be.
+
+ The -\b-f\bf option suppresses shell function lookup, as with the c\bco\bom\bm-\b-
+ m\bma\ban\bnd\bd builtin. t\bty\byp\bpe\be returns true if all of the arguments are
+ found, false if any are not found.
u\bul\bli\bim\bmi\bit\bt [-\b-H\bHS\bS] -\b-a\ba
u\bul\bli\bim\bmi\bit\bt [-\b-H\bHS\bS] [-\b-b\bbc\bcd\bde\bef\bfi\bik\bkl\blm\bmn\bnp\bpq\bqr\brs\bst\btu\buv\bvx\bxP\bPR\bRT\bT [_\bl_\bi_\bm_\bi_\bt]]
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 -\b-H\bH and -\b-S\bS 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 -\b-H\bH nor -\b-S\bS is speci-
- fied, both the soft and hard limits are set. The value of _\bl_\bi_\bm_\bi_\bt
- can be a number in the unit specified for the resource or one of
- the special values h\bha\bar\brd\bd, s\bso\bof\bft\bt, or u\bun\bnl\bli\bim\bmi\bit\bte\bed\bd, which stand for the
- current hard limit, the current soft limit, and no limit, re-
- spectively. If _\bl_\bi_\bm_\bi_\bt is omitted, the current value of the soft
- limit of the resource is printed, unless the -\b-H\bH 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:
- -\b-a\ba 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 -\b-H\bH nor -\b-S\bS is speci-
+ fied, u\bul\bli\bim\bmi\bit\bt sets both the soft and hard limits.
+
+ The value of _\bl_\bi_\bm_\bi_\bt can be a number in the unit specified for the
+ resource or one of the special values h\bha\bar\brd\bd, s\bso\bof\bft\bt, or u\bun\bnl\bli\bim\bmi\bit\bte\bed\bd,
+ which stand for the current hard limit, the current soft limit,
+ and no limit, respectively. If _\bl_\bi_\bm_\bi_\bt is omitted, u\bul\bli\bim\bmi\bit\bt prints
+ the current value of the soft limit of the resource, unless the
+ -\b-H\bH 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:
+ -\b-a\ba Report all current limits; no limits are set
-\b-b\bb The maximum socket buffer size
-\b-c\bc The maximum size of core files created
-\b-d\bd The maximum size of a process's data segment
-\b-e\be The maximum scheduling priority (
- -\b-f\bf The maximum size of files written by the shell and its
+ -\b-f\bf The maximum size of files written by the shell and its
children
-\b-i\bi The maximum number of pending signals
-\b-k\bk The maximum number of kqueues that may be allocated
-\b-l\bl The maximum size that may be locked into memory
- -\b-m\bm The maximum resident set size (many systems do not honor
+ -\b-m\bm The maximum resident set size (many systems do not honor
this limit)
-\b-n\bn The maximum number of open file descriptors (most systems
do not allow this value to be set)
-\b-r\br The maximum real-time scheduling priority
-\b-s\bs The maximum stack size
-\b-t\bt The maximum amount of cpu time in seconds
- -\b-u\bu The maximum number of processes available to a single
+ -\b-u\bu The maximum number of processes available to a single
user
- -\b-v\bv The maximum amount of virtual memory available to the
+ -\b-v\bv The maximum amount of virtual memory available to the
shell and, on some systems, to its children
-\b-x\bx The maximum number of file locks
-\b-P\bP The maximum number of pseudoterminals
- -\b-R\bR The maximum time a real-time process can run before
+ -\b-R\bR The maximum time a real-time process can run before
blocking, in microseconds
-\b-T\bT The maximum number of threads
- If _\bl_\bi_\bm_\bi_\bt is given, and the -\b-a\ba option is not used, _\bl_\bi_\bm_\bi_\bt is the
- new value of the specified resource. If no option is given,
- then -\b-f\bf is assumed. Values are in 1024-byte increments, except
- for -\b-t\bt, which is in seconds; -\b-R\bR, which is in microseconds; -\b-p\bp,
- which is in units of 512-byte blocks; -\b-P\bP, -\b-T\bT, -\b-b\bb, -\b-k\bk, -\b-n\bn, and
- -\b-u\bu, which are unscaled values; and, when in posix mode, -\b-c\bc and
- -\b-f\bf, 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 _\bl_\bi_\bm_\bi_\bt is supplied, and the -\b-a\ba option is not used, _\bl_\bi_\bm_\bi_\bt is
+ the new value of the specified resource. If no option is sup-
+ plied, then -\b-f\bf is assumed.
+
+ Values are in 1024-byte increments, except for -\b-t\bt, which is in
+ seconds; -\b-R\bR, which is in microseconds; -\b-p\bp, which is in units of
+ 512-byte blocks; -\b-P\bP, -\b-T\bT, -\b-b\bb, -\b-k\bk, -\b-n\bn, and -\b-u\bu, which are unscaled
+ values; and, when in posix mode, -\b-c\bc and -\b-f\bf, 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.
u\bum\bma\bas\bsk\bk [-\b-p\bp] [-\b-S\bS] [_\bm_\bo_\bd_\be]
- The user file-creation mask is set to _\bm_\bo_\bd_\be. If _\bm_\bo_\bd_\be 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
- _\bc_\bh_\bm_\bo_\bd(1). If _\bm_\bo_\bd_\be is omitted, the current value of the mask is
- printed. The -\b-S\bS option causes the mask to be printed in sym-
- bolic form; the default output is an octal number. If the -\b-p\bp
- option is supplied, and _\bm_\bo_\bd_\be 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 _\bm_\bo_\bd_\be argument was supplied,
- and false otherwise.
+ Set the user file-creation mask to _\bm_\bo_\bd_\be. If _\bm_\bo_\bd_\be 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
+ _\bc_\bh_\bm_\bo_\bd(1). If _\bm_\bo_\bd_\be is omitted, u\bum\bma\bas\bsk\bk prints the current value of
+ the mask. The -\b-S\bS option without a _\bm_\bo_\bd_\be argument prints the mask
+ in a symbolic format; the default output is an octal number. If
+ the -\b-p\bp option is supplied, and _\bm_\bo_\bd_\be 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 _\bm_\bo_\bd_\be argument was
+ supplied, and non-zero otherwise.
u\bun\bna\bal\bli\bia\bas\bs [-a\ba] [_\bn_\ba_\bm_\be ...]
Remove each _\bn_\ba_\bm_\be from the list of defined aliases. If -\b-a\ba is
- supplied, all alias definitions are removed. The return value
- is true unless a supplied _\bn_\ba_\bm_\be is not a defined alias.
+ supplied, remove all alias definitions. The return value is
+ true unless a supplied _\bn_\ba_\bm_\be is not a defined alias.
u\bun\bns\bse\bet\bt [-f\bfv\bv] [-n\bn] [_\bn_\ba_\bm_\be ...]
For each _\bn_\ba_\bm_\be, remove the corresponding variable or function.
If the -\b-v\bv option is given, each _\bn_\ba_\bm_\be refers to a shell variable,
- and that variable is removed. Read-only variables may not be
- unset. If -\b-f\bf is specified, each _\bn_\ba_\bm_\be refers to a shell func-
- tion, and the function definition is removed. If the -\b-n\bn option
- is supplied, and _\bn_\ba_\bm_\be is a variable with the _\bn_\ba_\bm_\be_\br_\be_\bf attribute,
- _\bn_\ba_\bm_\be will be unset rather than the variable it references. -\b-n\bn
- has no effect if the -\b-f\bf option is supplied. If no options are
- supplied, each _\bn_\ba_\bm_\be 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 B\bBA\bAS\bSH\bH_\b_A\bAL\bLI\bIA\bAS\bSE\bES\bS,
- B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV0\b0, B\bBA\bAS\bSH\bH_\b_C\bCM\bMD\bDS\bS, B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMM\bMA\bAN\bND\bD, B\bBA\bAS\bSH\bH_\b_S\bSU\bUB\bBS\bSH\bHE\bEL\bLL\bL, B\bBA\bAS\bSH\bHP\bPI\bID\bD,
- C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS, D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK, E\bEP\bPO\bOC\bCH\bHR\bRE\bEA\bAL\bLT\bTI\bIM\bME\bE, E\bEP\bPO\bOC\bCH\bHS\bSE\bEC\bCO\bON\bND\bDS\bS, F\bFU\bUN\bNC\bC-\b-
- N\bNA\bAM\bME\bE, G\bGR\bRO\bOU\bUP\bPS\bS, H\bHI\bIS\bST\bTC\bCM\bMD\bD, L\bLI\bIN\bNE\bEN\bNO\bO, R\bRA\bAN\bND\bDO\bOM\bM, S\bSE\bEC\bCO\bON\bND\bDS\bS, or S\bSR\bRA\bAN\bND\bDO\bOM\bM are
- unset, they lose their special properties, even if they are sub-
- sequently reset. The exit status is true unless a _\bn_\ba_\bm_\be is read-
- only or may not be unset.
+ and that variable is removed. If -\b-f\bf is specified, each _\bn_\ba_\bm_\be
+ refers to a shell function, and the function definition is re-
+ moved. If the -\b-n\bn option is supplied, and _\bn_\ba_\bm_\be is a variable
+ with the _\bn_\ba_\bm_\be_\br_\be_\bf attribute, _\bn_\ba_\bm_\be will be unset rather than the
+ variable it references. -\b-n\bn has no effect if the -\b-f\bf 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 _\bn_\ba_\bm_\be 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
+ B\bBA\bAS\bSH\bH_\b_A\bAL\bLI\bIA\bAS\bSE\bES\bS, B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV0\b0, B\bBA\bAS\bSH\bH_\b_C\bCM\bMD\bDS\bS, B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMM\bMA\bAN\bND\bD, B\bBA\bAS\bSH\bH_\b_S\bSU\bUB\bB-\b-
+ S\bSH\bHE\bEL\bLL\bL, B\bBA\bAS\bSH\bHP\bPI\bID\bD, C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS, D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK, E\bEP\bPO\bOC\bCH\bHR\bRE\bEA\bAL\bLT\bTI\bIM\bME\bE,
+ E\bEP\bPO\bOC\bCH\bHS\bSE\bEC\bCO\bON\bND\bDS\bS, F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE, G\bGR\bRO\bOU\bUP\bPS\bS, H\bHI\bIS\bST\bTC\bCM\bMD\bD, L\bLI\bIN\bNE\bEN\bNO\bO, R\bRA\bAN\bND\bDO\bOM\bM, S\bSE\bEC\bC-\b-
+ O\bON\bND\bDS\bS, or S\bSR\bRA\bAN\bND\bDO\bOM\bM are unset, they lose their special properties,
+ even if they are subsequently reset. The exit status is true
+ unless a _\bn_\ba_\bm_\be is readonly or may not be unset.
w\bwa\bai\bit\bt [-\b-f\bfn\bn] [-\b-p\bp _\bv_\ba_\br_\bn_\ba_\bm_\be] [_\bi_\bd ...]
Wait for each specified child process _\bi_\bd and return the termina-
- tion status of the last _\bi_\bd. Each _\bi_\bd may be a process ID or a
- job specification; if a job spec is given, w\bwa\bai\bit\bt waits for all
+ tion status of the last _\bi_\bd. Each _\bi_\bd may be a process ID or a
+ job specification; if a job spec is supplied, w\bwa\bai\bit\bt waits for all
processes in the job.
If no options or _\bi_\bds are supplied, w\bwa\bai\bit\bt waits for all running
If the -\b-p\bp option is supplied, the process or job identifier of
the job for which the exit status is returned is assigned to the
- variable _\bv_\ba_\br_\bn_\ba_\bm_\be named by the option argument. The variable
- will be unset initially, before any assignment. This is useful
- only when the -\b-n\bn option is supplied.
+ variable _\bv_\ba_\br_\bn_\ba_\bm_\be named by the option argument. The variable,
+ which cannot be readonly, will be unset initially, before any
+ assignment. This is useful only when the -\b-n\bn option is supplied.
Supplying the -\b-f\bf option, when job control is enabled, forces
w\bwa\bai\bit\bt to wait for each _\bi_\bd to terminate before returning its sta-
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 c\bco\bom\bmp\bpa\bat\bt3\b32\b2 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, c\bco\bom\bmp\bpa\bat\bt3\b32\b2, 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 b\bba\bas\bsh\bh, but that behavior may have been
- present in earlier versions. For instance, the change to use locale-
- based comparisons with the [\b[[\b[ command came in bash-4.1, and earlier
+ lar version (e.g., setting c\bco\bom\bmp\bpa\bat\bt3\b32\b2 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, c\bco\bom\bmp\bpa\bat\bt3\b32\b2, 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 b\bba\bas\bsh\bh, but that behavior may have been
+ present in earlier versions. For instance, the change to use locale-
+ based comparisons with the [\b[[\b[ command came in bash-4.1, and earlier
versions used ASCII-based comparisons, so enabling c\bco\bom\bmp\bpa\bat\bt3\b32\b2 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: B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMP\bPA\bAT\bT. The value as-
+ Bash-4.3 introduced a new shell variable: B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMP\bPA\bAT\bT. The value as-
signed to this variable (a decimal version number like 4.2, or an inte-
- ger corresponding to the c\bco\bom\bmp\bpa\bat\bt_\bN_\bN option, like 42) determines the com-
+ ger corresponding to the c\bco\bom\bmp\bpa\bat\bt_\bN_\bN option, like 42) determines the com-
patibility level.
- Starting with bash-4.4, b\bba\bas\bsh\bh has begun deprecating older compatibility
- levels. Eventually, the options will be removed in favor of B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bM-\b-
- P\bPA\bAT\bT.
+ Starting with bash-4.4, b\bba\bas\bsh\bh began deprecating older compatibility lev-
+ els. Eventually, the options will be removed in favor of B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMP\bPA\bAT\bT.
- 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 B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMP\bPA\bAT\bT.
+ Bash-5.0 was the final version for which there was an individual shopt
+ option for the previous version. B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMP\bPA\bAT\bT 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 c\bco\bom\bmp\bpa\bat\bt_\bN_\bN tag is used as shorthand for
quired for bash-5.1 and later versions.
c\bco\bom\bmp\bpa\bat\bt3\b31\b1
- +\bo quoting the rhs of the [\b[[\b[ command's regexp matching oper-
- ator (=) has no special effect
+ +\bo Quoting the rhs of the [\b[[\b[ command's regexp matching oper-
+ ator (=) has no special effect.
c\bco\bom\bmp\bpa\bat\bt3\b32\b2
- +\bo the <\b< and >\b> operators to the [\b[[\b[ command do not consider
+ +\bo The <\b< and >\b> operators to the [\b[[\b[ command do not consider
the current locale when comparing strings; they use ASCII
ordering.
c\bco\bom\bmp\bpa\bat\bt4\b40\b0
- +\bo the <\b< and >\b> operators to the [\b[[\b[ command do not consider
+ +\bo The <\b< and >\b> operators to the [\b[[\b[ command do not consider
the current locale when comparing strings; they use ASCII
ordering. B\bBa\bas\bsh\bh versions prior to bash-4.1 use ASCII col-
lation and _\bs_\bt_\br_\bc_\bm_\bp(3); bash-4.1 and later use the current
locale's collation sequence and _\bs_\bt_\br_\bc_\bo_\bl_\bl(3).
c\bco\bom\bmp\bpa\bat\bt4\b41\b1
- +\bo in _\bp_\bo_\bs_\bi_\bx mode, t\bti\bim\bme\be may be followed by options and still
+ +\bo In _\bp_\bo_\bs_\bi_\bx mode, t\bti\bim\bme\be may be followed by options and still
be recognized as a reserved word (this is POSIX interpre-
- tation 267)
- +\bo in _\bp_\bo_\bs_\bi_\bx mode, the parser requires that an even number of
+ tation 267).
+ +\bo In _\bp_\bo_\bs_\bi_\bx mode, the parser requires that an even number of
single quotes occur in the _\bw_\bo_\br_\bd 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).
c\bco\bom\bmp\bpa\bat\bt4\b42\b2
- +\bo the replacement string in double-quoted pattern substitu-
+ +\bo The replacement string in double-quoted pattern substitu-
tion does not undergo quote removal, as it does in ver-
- sions after bash-4.2
- +\bo in posix mode, single quotes are considered special when
+ sions after bash-4.2.
+ +\bo In posix mode, single quotes are considered special when
expanding the _\bw_\bo_\br_\bd 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.
c\bco\bom\bmp\bpa\bat\bt4\b43\b3
- +\bo word expansion errors are considered non-fatal errors
+ +\bo 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)
- +\bo when executing a shell function, the loop state
+ that cause the shell to exit).
+ +\bo When executing a shell function, the loop state
(while/until/etc.) is not reset, so b\bbr\bre\bea\bak\bk or c\bco\bon\bnt\bti\bin\bnu\bue\be 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.
c\bco\bom\bmp\bpa\bat\bt4\b44\b4
- +\bo the shell sets up the values used by B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV and
- B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGC\bC so they can expand to the shell's positional
- parameters even if extended debugging mode is not enabled
- +\bo a subshell inherits loops from its parent context, so
+ +\bo The shell sets up the values used by B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV and
+ B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGC\bC so they can expand to the shell's positional
+ parameters even if extended debugging mode is not en-
+ abled.
+ +\bo A subshell inherits loops from its parent context, so
b\bbr\bre\bea\bak\bk or c\bco\bon\bnt\bti\bin\bnu\bue\be will cause the subshell to exit.
Bash-5.0 and later reset the loop state to prevent the
exit
- +\bo variable assignments preceding builtins like e\bex\bxp\bpo\bor\brt\bt and
+ +\bo Variable assignments preceding builtins like e\bex\bxp\bpo\bor\brt\bt and
r\bre\bea\bad\bdo\bon\bnl\bly\by 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.
c\bco\bom\bmp\bpa\bat\bt5\b50\b0
+\bo Bash-5.1 changed the way $\b$R\bRA\bAN\bND\bDO\bOM\bM 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 R\bRA\bAN\bND\bDO\bOM\bM will
- produce the same sequence as in bash-5.0
+ produce the same sequence as in bash-5.0.
+\bo 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 -\b-l\bl op-
+ input. Bash-5.1 suppresses that message when the -\b-l\bl op-
tion is supplied.
c\bco\bom\bmp\bpa\bat\bt5\b51\b1
scripts @\b@ and *\b* differently depending on whether the ar-
ray is indexed or associative, and differently than in
previous versions.
- +\bo arithmetic commands ( (\b((\b(...)\b))\b) ) and the expressions in an
- arithmetic for statement can be expanded more than once
- +\bo expressions used as arguments to arithmetic operators in
- the [\b[[\b[ conditional command can be expanded more than once
- +\bo the expressions in substring parameter brace expansion
- can be expanded more than once
- +\bo the expressions in the $\b$(\b((\b(...)\b))\b) word expansion can be ex-
- panded more than once
- +\bo arithmetic expressions used as indexed array subscripts
- can be expanded more than once
- +\bo t\bte\bes\bst\bt -\b-v\bv, when given an argument of A\bA[\b[@\b@]\b], where A\bA is an
+ +\bo Arithmetic commands ( (\b((\b(...)\b))\b) ) and the expressions in an
+ arithmetic for statement can be expanded more than once.
+ +\bo Expressions used as arguments to arithmetic operators in
+ the [\b[[\b[ conditional command can be expanded more than
+ once.
+ +\bo The expressions in substring parameter brace expansion
+ can be expanded more than once.
+ +\bo The expressions in the $\b$(\b((\b(...)\b))\b) word expansion can be ex-
+ panded more than once.
+ +\bo Arithmetic expressions used as indexed array subscripts
+ can be expanded more than once.
+ +\bo t\bte\bes\bst\bt -\b-v\bv, when given an argument of A\bA[\b[@\b@]\b], where A\bA 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 @\b@.
- +\bo the ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br[\b[:\b:]\b]=\b=_\bv_\ba_\bl_\bu_\be} word expansion will return
- _\bv_\ba_\bl_\bu_\be, before any variable-specific transformations have
+ +\bo The ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br[\b[:\b:]\b]=\b=_\bv_\ba_\bl_\bu_\be} word expansion will return
+ _\bv_\ba_\bl_\bu_\be, 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.
- +\bo Parsing command substitutions will behave as if extended
+ +\bo Parsing command substitutions will behave as if extended
globbing (see the description of the s\bsh\bho\bop\bpt\bt 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.
c\bco\bom\bmp\bpa\bat\bt5\b52\b2
- +\bo The t\bte\bes\bst\bt builtin uses its historical algorithm to parse
- parenthesized subexpressions when given five or more ar-
+ +\bo The t\bte\bes\bst\bt builtin uses its historical algorithm to parse
+ parenthesized subexpressions when given five or more ar-
guments.
- +\bo If the -\b-p\bp or -\b-P\bP option is supplied to the b\bbi\bin\bnd\bd builtin,
+ +\bo If the -\b-p\bp or -\b-P\bP option is supplied to the b\bbi\bin\bnd\bd builtin,
b\bbi\bin\bnd\bd 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.
S\bSE\bEE\bE A\bAL\bLS\bSO\bO
R\bRE\bES\bST\bTR\bRI\bIC\bCT\bTE\bED\bD S\bSH\bHE\bEL\bLL\bL
If b\bba\bas\bsh\bh is started with the name r\brb\bba\bas\bsh\bh, or the -\b-r\br option is supplied at
- invocation, the shell becomes restricted. A restricted shell is used
+ invocation, the shell becomes _\br_\be_\bs_\bt_\br_\bi_\bc_\bt_\be_\bd. A restricted shell is used
to set up an environment more controlled than the standard shell. It
behaves identically to b\bba\bas\bsh\bh with the exception that the following are
disallowed or not performed:
- +\bo changing directories with c\bcd\bd
+ +\bo Changing directories with c\bcd\bd.
- +\bo setting or unsetting the values of S\bSH\bHE\bEL\bLL\bL, P\bPA\bAT\bTH\bH, H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE, E\bEN\bNV\bV,
- or B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV
+ +\bo Setting or unsetting the values of S\bSH\bHE\bEL\bLL\bL, P\bPA\bAT\bTH\bH, H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE, E\bEN\bNV\bV,
+ or B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV.
- +\bo specifying command names containing /\b/
+ +\bo Specifying command names containing /\b/.
- +\bo specifying a filename containing a /\b/ as an argument to the .\b.
- builtin command
+ +\bo Specifying a filename containing a /\b/ as an argument to the .\b.
+ builtin command.
- +\bo specifying a filename containing a slash as an argument to the
- h\bhi\bis\bst\bto\bor\bry\by builtin command
+ +\bo Using the -\b-p\bp option to the .\b. builtin command to specify a
+ search path.
- +\bo specifying a filename containing a slash as an argument to the
- -\b-p\bp option to the h\bha\bas\bsh\bh builtin command
+ +\bo Specifying a filename containing a slash as an argument to the
+ h\bhi\bis\bst\bto\bor\bry\by builtin command.
- +\bo importing function definitions from the shell environment at
- startup
+ +\bo Specifying a filename containing a slash as an argument to the
+ -\b-p\bp option to the h\bha\bas\bsh\bh builtin command.
- +\bo parsing the value of S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS from the shell environment at
- startup
+ +\bo Importing function definitions from the shell environment at
+ startup.
- +\bo redirecting output using the >, >|, <>, >&, &>, and >> redirec-
- tion operators
+ +\bo Parsing the value of S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS from the shell environment at
+ startup.
- +\bo using the e\bex\bxe\bec\bc builtin command to replace the shell with another
- command
+ +\bo Redirecting output using the >, >|, <>, >&, &>, and >> redirec-
+ tion operators.
- +\bo adding or deleting builtin commands with the -\b-f\bf and -\b-d\bd options
- to the e\ben\bna\bab\bbl\ble\be builtin command
+ +\bo Using the e\bex\bxe\bec\bc builtin command to replace the shell with another
+ command.
- +\bo using the e\ben\bna\bab\bbl\ble\be builtin command to enable disabled shell
- builtins
+ +\bo Adding or deleting builtin commands with the -\b-f\bf and -\b-d\bd options
+ to the e\ben\bna\bab\bbl\ble\be builtin command.
- +\bo specifying the -\b-p\bp option to the c\bco\bom\bmm\bma\ban\bnd\bd builtin command
+ +\bo Using the e\ben\bna\bab\bbl\ble\be builtin command to enable disabled shell
+ builtins.
- +\bo turning off restricted mode with s\bse\bet\bt +\b+r\br or s\bsh\bho\bop\bpt\bt -\b-u\bu r\bre\be-\b-
+ +\bo Specifying the -\b-p\bp option to the c\bco\bom\bmm\bma\ban\bnd\bd builtin command.
+
+ +\bo Turning off restricted mode with s\bse\bet\bt +\b+r\br or s\bsh\bho\bop\bpt\bt -\b-u\bu r\bre\be-\b-
s\bst\btr\bri\bic\bct\bte\bed\bd_\b_s\bsh\bhe\bel\bll\bl.
These restrictions are enforced after any startup files are read.
- When a command that is found to be a shell script is executed, r\brb\bba\bas\bsh\bh
+ When a command that is found to be a shell script is executed, r\brb\bba\bas\bsh\bh
turns off any restrictions in the shell spawned to execute the script.
S\bSE\bEE\bE A\bAL\bLS\bSO\bO
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
order of decreasing precedence.
"id++", "id--" [post-increment and post-decrement]
- "-", "+" [(unary operators)]
"++id", "--id" [pre-increment and pre-decrement]
+ "-", "+" [(unary operators)]
"!", "~"
"**" [(exponentiation)]
"*", "/", "%"
@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
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
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.
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}.
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
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}.
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
@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
@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
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.
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
@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
@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
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.
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
@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,
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.
@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
@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}/
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}
@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
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.
@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
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.
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.
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
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)
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
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.
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
@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}
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.
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
@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
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