bash - GNU Bourne-Again SHell
S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
- b\bba\bas\bsh\bh [options] [file]
+ b\bba\bas\bsh\bh [options] [command_string | file]
C\bCO\bOP\bPY\bYR\bRI\bIG\bGH\bHT\bT
- Bash is Copyright (C) 1989-2010 by the Free Software Foundation, Inc.
+ Bash is Copyright (C) 1989-2013 by the Free Software Foundation, Inc.
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
is invoked. In addition, b\bba\bas\bsh\bh interprets the following options when it
is invoked:
- -\b-c\bc _\bs_\bt_\br_\bi_\bn_\bg If the -\b-c\bc option is present, then commands are read from
- _\bs_\bt_\br_\bi_\bn_\bg. If there are arguments after the _\bs_\bt_\br_\bi_\bn_\bg, they are
- assigned to the positional parameters, starting with $\b$0\b0.
+ -\b-c\bc If the -\b-c\bc option is present, then commands are read from the
+ first non-option argument _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b__\bs_\bt_\br_\bi_\bn_\bg. If there are argu-
+ ments after the _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b__\bs_\bt_\br_\bi_\bn_\bg, they are assigned to the
+ positional parameters, starting with $\b$0\b0.
-\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
+ -\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
+ -\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.
- -\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-
+ -\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
+ or P\bPO\bOS\bSI\bIX\bX. This implies the -\b-n\bn option; no commands will be
executed.
[\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 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
- 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 file-
+ 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
+ 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 file-
names and arguments. An argument of -\b- is equivalent to -\b--\b-.
- B\bBa\bas\bsh\bh also interprets a number of multi-character options. These
- options must appear on the command line before the single-character
+ B\bBa\bas\bsh\bh also interprets a number of multi-character options. These
+ options must appear on the command line before the single-character
options to be recognized.
-\b--\b-d\bde\beb\bbu\bug\bgg\bge\ber\br
Arrange for the debugger profile to be executed before the shell
- starts. Turns on extended debugging mode (see the description
+ 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 (por-
+ Equivalent to -\b-D\bD, but the output is in the GNU _\bg_\be_\bt_\bt_\be_\bx_\bt p\bpo\bo (por-
table 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-
+ -\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-
- tialization file _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc if the shell is interactive (see
+ tialization file _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc if the shell is interactive (see
I\bIN\bNV\bVO\bOC\bCA\bAT\bTI\bIO\bON\bN below).
-\b--\b-l\blo\bog\bgi\bin\bn
Equivalent to -\b-l\bl.
-\b--\b-n\bno\boe\bed\bdi\bit\bti\bin\bng\bg
- Do not use the GNU r\bre\bea\bad\bdl\bli\bin\bne\be library to read command lines when
+ Do not use the GNU r\bre\bea\bad\bdl\bli\bin\bne\be library to read command lines when
the shell is interactive.
-\b--\b-n\bno\bop\bpr\bro\bof\bfi\bil\ble\be
- Do not read either the system-wide startup file _\b/_\be_\bt_\bc_\b/_\bp_\br_\bo_\bf_\bi_\bl_\be or
- any of the personal initialization files _\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, or _\b~_\b/_\b._\bp_\br_\bo_\bf_\bi_\bl_\be. By default, b\bba\bas\bsh\bh reads these
- files when it is invoked as a login shell (see I\bIN\bNV\bVO\bOC\bCA\bAT\bTI\bIO\bON\bN
+ Do not read either the system-wide startup file _\b/_\be_\bt_\bc_\b/_\bp_\br_\bo_\bf_\bi_\bl_\be or
+ any of the personal initialization files _\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, or _\b~_\b/_\b._\bp_\br_\bo_\bf_\bi_\bl_\be. By default, b\bba\bas\bsh\bh reads these
+ files when it is invoked as a login shell (see I\bIN\bNV\bVO\bOC\bCA\bAT\bTI\bIO\bON\bN
below).
-\b--\b-n\bno\bor\brc\bc Do not read and execute the personal initialization file
- _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc if the shell is interactive. This option is on by
+ _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc if the shell is interactive. This option is on by
default if the shell is invoked as s\bsh\bh.
-\b--\b-p\bpo\bos\bsi\bix\bx
- Change the behavior of b\bba\bas\bsh\bh where the default operation differs
- from the POSIX standard to match the standard (_\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be).
+ Change the behavior of b\bba\bas\bsh\bh where the default operation differs
+ from the POSIX standard to match the standard (_\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be). See
+ S\bSE\bEE\bE A\bAL\bLS\bSO\bO below for a reference to a document that details how
+ posix mode affects bash's behavior.
-\b--\b-r\bre\bes\bst\btr\bri\bic\bct\bte\bed\bd
The shell becomes restricted (see R\bRE\bES\bST\bTR\bRI\bIC\bCT\bTE\bED\bD S\bSH\bHE\bEL\bLL\bL below).
Equivalent to -\b-v\bv.
-\b--\b-v\bve\ber\brs\bsi\bio\bon\bn
- Show version information for this instance of b\bba\bas\bsh\bh on the stan-
+ Show version information for this instance of b\bba\bas\bsh\bh on the stan-
dard output and exit successfully.
A\bAR\bRG\bGU\bUM\bME\bEN\bNT\bTS\bS
If arguments remain after option processing, and neither the -\b-c\bc nor the
- -\b-s\bs option has been supplied, the first argument is assumed to be the
- name of a file containing shell commands. If b\bba\bas\bsh\bh is invoked in this
- fashion, $\b$0\b0 is set to the name of the file, and the positional parame-
- ters are set to the remaining arguments. B\bBa\bas\bsh\bh reads and executes com-
- mands from this file, then exits. B\bBa\bas\bsh\bh's exit status is the exit sta-
- tus 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
+ -\b-s\bs option has been supplied, the first argument is assumed to be the
+ name of a file containing shell commands. If b\bba\bas\bsh\bh is invoked in this
+ fashion, $\b$0\b0 is set to the name of the file, and the positional parame-
+ ters are set to the remaining arguments. B\bBa\bas\bsh\bh reads and executes com-
+ mands from this file, then exits. B\bBa\bas\bsh\bh's exit status is the exit sta-
+ tus 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 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
+ A _\bl_\bo_\bg_\bi_\bn _\bs_\bh_\be_\bl_\bl is one whose first character of argument zero is a -\b-, or
one started with the -\b--\b-l\blo\bog\bgi\bin\bn option.
- An _\bi_\bn_\bt_\be_\br_\ba_\bc_\bt_\bi_\bv_\be shell is one started without non-option arguments and
+ An _\bi_\bn_\bt_\be_\br_\ba_\bc_\bt_\bi_\bv_\be shell is one started without non-option arguments 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
+ 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 file names as described below under T\bTi\bil\bld\bde\be E\bEx\bxp\bpa\ban\bn-\b-
+ 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 a login shell exits, b\bba\bas\bsh\bh reads and executes commands from the
+ When a login shell exits, 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 force b\bba\bas\bsh\bh to read and execute commands from _\bf_\bi_\bl_\be instead of
+ 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 force b\bba\bas\bsh\bh to read and execute commands from _\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
+ When b\bba\bas\bsh\bh is started non-interactively, to run a shell script, for
example, 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-
+ 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 the value of the P\bPA\bAT\bTH\bH variable is not used 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
- behavior of historical versions of s\bsh\bh as closely as possible, while
- conforming to the POSIX standard as well. When invoked as an interac-
- tive login shell, or a non-interactive shell with the -\b--\b-l\blo\bog\bgi\bin\bn option,
- it first attempts to read and execute commands from _\b/_\be_\bt_\bc_\b/_\bp_\br_\bo_\bf_\bi_\bl_\be and
- _\b~_\b/_\b._\bp_\br_\bo_\bf_\bi_\bl_\be, in that order. The -\b--\b-n\bno\bop\bpr\bro\bof\bfi\bil\ble\be option may be used to
- inhibit this behavior. When invoked as an interactive shell with the
- name s\bsh\bh, b\bba\bas\bsh\bh looks for the variable E\bEN\bNV\bV, expands its value if it is
- defined, and uses the expanded value as the name of a file to read and
+ If b\bba\bas\bsh\bh is invoked with the name s\bsh\bh, it tries to mimic the startup
+ behavior of historical versions of s\bsh\bh as closely as possible, while
+ conforming to the POSIX standard as well. When invoked as an interac-
+ tive login shell, or a non-interactive shell with the -\b--\b-l\blo\bog\bgi\bin\bn option,
+ it first attempts to read and execute commands from _\b/_\be_\bt_\bc_\b/_\bp_\br_\bo_\bf_\bi_\bl_\be and
+ _\b~_\b/_\b._\bp_\br_\bo_\bf_\bi_\bl_\be, in that order. The -\b--\b-n\bno\bop\bpr\bro\bof\bfi\bil\ble\be option may be used to
+ inhibit this behavior. When invoked as an interactive shell with the
+ name s\bsh\bh, b\bba\bas\bsh\bh looks for the variable E\bEN\bNV\bV, 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 s\bsh\bh does not attempt to read and exe-
- cute commands from any other startup files, the -\b--\b-r\brc\bcf\bfi\bil\ble\be option has no
- effect. A non-interactive shell invoked with the name s\bsh\bh does not
- attempt to read any other startup files. When invoked as s\bsh\bh, b\bba\bas\bsh\bh
+ cute commands from any other startup files, the -\b--\b-r\brc\bcf\bfi\bil\ble\be option has no
+ effect. A non-interactive shell invoked with the name s\bsh\bh does not
+ attempt to read any other startup files. When invoked as s\bsh\bh, b\bba\bas\bsh\bh
enters _\bp_\bo_\bs_\bi_\bx mode after the startup files are read.
- 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
+ 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
+ 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.
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 remote shell
- daemon, usually _\br_\bs_\bh_\bd, or the secure shell daemon _\bs_\bs_\bh_\bd. If b\bba\bas\bsh\bh deter-
- mines it is being run 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 may be used to force another file to
- be read, but _\br_\bs_\bh_\bd does not generally invoke the shell with those
- options or allow them to be specified.
+ daemon, usually _\br_\bs_\bh_\bd, or the secure shell daemon _\bs_\bs_\bh_\bd. If b\bba\bas\bsh\bh deter-
+ mines it is being run 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 may be used to force another file to
+ be read, 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
files are read, shell functions are not inherited from the environment,
- 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
- appear in the environment, are ignored, and the effective user id is
- set to the real user id. If the -\b-p\bp option is supplied at invocation,
- the startup behavior is the same, but the effective user id is not
+ 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
+ appear in the environment, are ignored, and the effective user id is
+ set to the real user id. If the -\b-p\bp option is supplied at invocation,
+ the startup behavior is the same, but the effective user id is not
reset.
D\bDE\bEF\bFI\bIN\bNI\bIT\bTI\bIO\bON\bNS\bS
- The following definitions are used throughout the rest of this docu-
+ The following definitions are used throughout the rest of this docu-
ment.
b\bbl\bla\ban\bnk\bk A space or tab.
- w\bwo\bor\brd\bd A sequence of characters considered as a single unit by the
+ w\bwo\bor\brd\bd A sequence of characters considered as a single unit by the
shell. Also known as a t\bto\bok\bke\ben\bn.
- n\bna\bam\bme\be A _\bw_\bo_\br_\bd consisting only of alphanumeric characters and under-
- scores, and beginning with an alphabetic character or an under-
+ n\bna\bam\bme\be A _\bw_\bo_\br_\bd consisting only of alphanumeric characters and under-
+ scores, and beginning with an alphabetic character or an under-
score. Also referred to as an i\bid\bde\ben\bnt\bti\bif\bfi\bie\ber\br.
m\bme\bet\bta\bac\bch\bha\bar\bra\bac\bct\bte\ber\br
- A character that, when unquoted, separates words. One of the
+ A character that, when unquoted, separates words. One of the
following:
|\b| &\b& ;\b; (\b( )\b) <\b< >\b> s\bsp\bpa\bac\bce\be t\bta\bab\bb
c\bco\bon\bnt\btr\bro\bol\bl o\bop\bpe\ber\bra\bat\bto\bor\br
R\bRE\bES\bSE\bER\bRV\bVE\bED\bD W\bWO\bOR\bRD\bDS\bS
_\bR_\be_\bs_\be_\br_\bv_\be_\bd _\bw_\bo_\br_\bd_\bs are words that have a special meaning to the shell. The
following words are recognized as reserved when unquoted and either the
- first word of a simple command (see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR below) or the third
+ first word of a simple command (see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR below) or the third
word of a c\bca\bas\bse\be or f\bfo\bor\br command:
- !\b! c\bca\bas\bse\be d\bdo\bo d\bdo\bon\bne\be e\bel\bli\bif\bf e\bel\bls\bse\be e\bes\bsa\bac\bc f\bfi\bi f\bfo\bor\br f\bfu\bun\bnc\bct\bti\bio\bon\bn i\bif\bf i\bin\bn s\bse\bel\ble\bec\bct\bt t\bth\bhe\ben\bn u\bun\bnt\bti\bil\bl
- w\bwh\bhi\bil\ble\be {\b{ }\b} t\bti\bim\bme\be [\b[[\b[ ]\b]]\b]
+ !\b! c\bca\bas\bse\be c\bco\bop\bpr\bro\boc\bc d\bdo\bo d\bdo\bon\bne\be e\bel\bli\bif\bf e\bel\bls\bse\be e\bes\bsa\bac\bc f\bfi\bi f\bfo\bor\br f\bfu\bun\bnc\bct\bti\bio\bon\bn i\bif\bf i\bin\bn s\bse\bel\ble\bec\bct\bt
+ t\bth\bhe\ben\bn u\bun\bnt\bti\bil\bl w\bwh\bhi\bil\ble\be {\b{ }\b} t\bti\bim\bme\be [\b[[\b[ ]\b]]\b]
S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR
S\bSi\bim\bmp\bpl\ble\be C\bCo\bom\bmm\bma\ban\bnd\bds\bs
- A _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd is a sequence of optional variable assignments fol-
- lowed by b\bbl\bla\ban\bnk\bk-separated words and redirections, and terminated by a
+ A _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd is a sequence of optional variable assignments fol-
+ lowed by b\bbl\bla\ban\bnk\bk-separated words and redirections, and terminated by a
_\bc_\bo_\bn_\bt_\br_\bo_\bl _\bo_\bp_\be_\br_\ba_\bt_\bo_\br. The first word specifies the command to be executed,
- and is passed as argument zero. The remaining words are passed as
+ and is passed as argument zero. The remaining words are passed as
arguments to the invoked command.
- The return value of a _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd is its exit status, or 128+_\bn if
+ The return value of a _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd is its exit status, or 128+_\bn if
the command is terminated by signal _\bn.
P\bPi\bip\bpe\bel\bli\bin\bne\bes\bs
- A _\bp_\bi_\bp_\be_\bl_\bi_\bn_\be is a sequence of one or more commands separated by one of
+ A _\bp_\bi_\bp_\be_\bl_\bi_\bn_\be is a sequence of one or more commands separated by one of
the control operators |\b| or |\b|&\b&. The format for a pipeline is:
[t\bti\bim\bme\be [-\b-p\bp]] [ ! ] _\bc_\bo_\bm_\bm_\ba_\bn_\bd [ [|\b|||\b|&\b&] _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2 ... ]
- The standard output of _\bc_\bo_\bm_\bm_\ba_\bn_\bd 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-
+ The standard output of _\bc_\bo_\bm_\bm_\ba_\bn_\bd 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 command (see R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN below). If |\b|&\b& is used,
- the standard error of _\bc_\bo_\bm_\bm_\ba_\bn_\bd 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 redirect-
- ion of the standard error is performed after any redirections specified
- by the command.
+ _\bc_\bo_\bm_\bm_\ba_\bn_\bd'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 the
+ command.
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
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:
-
- (_\bl_\bi_\bs_\bt) _\bl_\bi_\bs_\bt is executed in a subshell environment (see C\bCO\bOM\bMM\bMA\bAN\bND\bD E\bEX\bXE\bEC\bCU\bU-\b-
- T\bTI\bIO\bON\bN E\bEN\bNV\bVI\bIR\bRO\bON\bNM\bME\bEN\bNT\bT below). Variable assignments and builtin com-
- mands that affect the shell's environment do not remain in
- effect after the command completes. The return status is the
+ 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 environment (see C\bCO\bOM\bMM\bMA\bAN\bND\bD E\bEX\bXE\bEC\bCU\bU-\b-
+ T\bTI\bIO\bON\bN E\bEN\bNV\bVI\bIR\bRO\bON\bNM\bME\bEN\bNT\bT below). Variable assignments and builtin com-
+ mands 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
+ _\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
- 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
+ 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
- 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 expres-
- sion is non-zero, the return status is 0; otherwise the return
+ The _\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 expres-
+ sion is non-zero, the return status is 0; otherwise the return
status is 1. This is exactly equivalent to l\ble\bet\bt "\b"_\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn"\b".
[\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.
- Word splitting and pathname expansion are not performed on the
- words between the [\b[[\b[ and ]\b]]\b]; tilde expansion, parameter and
- variable expansion, arithmetic expansion, command substitution,
- process substitution, and quote removal are performed. Condi-
+ 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.
+ Word splitting and pathname expansion are not performed on the
+ words between the [\b[[\b[ and ]\b]]\b]; tilde expansion, parameter and
+ variable expansion, arithmetic expansion, command substitution,
+ process substitution, and quote removal are performed. Condi-
tional 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
+ 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. If the shell
- option n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh 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 pat-
- tern, and 1 otherwise. Any part of the pattern may be quoted to
- force it 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
- right of the operator is considered an extended regular expres-
+ 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 shell option n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh 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
+ right of the operator is considered an extended regular expres-
sion and matched accordingly (as 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 conditional
+ regular expression is syntactically incorrect, the conditional
expression's return value is 2. If the shell option n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh
is enabled, the match is performed without regard to the case of
alphabetic characters. Any part of the pattern may be quoted to
- force it to be matched as a string. Substrings matched by
- parenthesized subexpressions within the regular expression are
- saved in the array variable B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH. The element of
- B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH with index 0 is the portion of the string matching
- the entire regular expression. 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 parenthe-
- sized subexpression.
-
- Expressions may be combined using the following operators,
+ force the quoted portion to be matched as a string. Bracket
+ expressions in regular expressions must be treated carefully,
+ since normal quoting characters lose their meanings between
+ brackets. If the pattern is stored in a shell variable, quoting
+ the variable expansion forces the entire pattern to be matched
+ as a string. Substrings matched by parenthesized subexpressions
+ within the regular expression are saved in the array variable
+ B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH. The element of B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH with index 0 is the
+ portion of the string matching the entire regular expression.
+ 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.
+
+ 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
+ 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
parameter 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
+ 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.
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
+ 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.
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. 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).
- The P\bPS\bS3\b3 prompt is then displayed and a line read from the stan-
- dard 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-
+ items. 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).
+ The P\bPS\bS3\b3 prompt is then displayed and a line read from the stan-
+ dard 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 command completes. 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 executed after each
+ 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 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,
+ 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 same matching rules as for path-
- name expansion (see P\bPa\bat\bth\bhn\bna\bam\bme\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn below). The _\bw_\bo_\br_\bd is
- expanded using tilde expansion, parameter and variable expan-
- sion, arithmetic substitution, command substitution, process
- substitution and quote removal. Each _\bp_\ba_\bt_\bt_\be_\br_\bn examined is
+ name expansion (see P\bPa\bat\bth\bhn\bna\bam\bme\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn below). The _\bw_\bo_\br_\bd is
expanded using tilde expansion, parameter and variable expan-
+ sion, arithmetic substitution, command substitution, process
+ substitution and quote removal. Each _\bp_\ba_\bt_\bt_\be_\br_\bn examined is
+ expanded using tilde expansion, parameter and variable expan-
sion, arithmetic substitution, command substitution, and process
- substitution. If the shell option n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh is enabled, the
- match is performed without regard to the case of alphabetic
- characters. When a match is found, the corresponding _\bl_\bi_\bs_\bt is
+ substitution. If the shell option n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh is enabled, the
+ match is performed without regard to the case of alphabetic
+ characters. When a match is found, the corresponding _\bl_\bi_\bs_\bt is
executed. If the ;\b;;\b; operator is used, no subsequent matches are
- attempted after the first pattern match. Using ;\b;&\b& in place of
- ;\b;;\b; causes execution to continue 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 pattern list in the statement, if any,
+ attempted after the first pattern match. Using ;\b;&\b& in place of
+ ;\b;;\b; causes execution to continue 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 pattern list in the statement, if any,
and execute any associated _\bl_\bi_\bs_\bt on a successful match. 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.
- i\bif\bf _\bl_\bi_\bs_\bt; t\bth\bhe\ben\bn _\bl_\bi_\bs_\bt_\b; [ 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
- _\bl_\bi_\bs_\bt is executed. Otherwise, each e\bel\bli\bif\bf _\bl_\bi_\bs_\bt is executed in
- turn, and if its exit status is zero, the corresponding t\bth\bhe\ben\bn
+ 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
+ _\bl_\bi_\bs_\bt is executed. Otherwise, each e\bel\bli\bif\bf _\bl_\bi_\bs_\bt is executed in
+ turn, and if its exit status is zero, the corresponding t\bth\bhe\ben\bn
_\bl_\bi_\bs_\bt is executed and the command completes. Otherwise, the e\bel\bls\bse\be
- _\bl_\bi_\bs_\bt is executed, if present. The exit status is the exit sta-
+ _\bl_\bi_\bs_\bt is executed, if present. The exit status is the exit sta-
tus of the last command executed, or zero if no condition tested
true.
w\bwh\bhi\bil\ble\be _\bl_\bi_\bs_\bt_\b-_\b1; d\bdo\bo _\bl_\bi_\bs_\bt_\b-_\b2; d\bdo\bon\bne\be
u\bun\bnt\bti\bil\bl _\bl_\bi_\bs_\bt_\b-_\b1; d\bdo\bo _\bl_\bi_\bs_\bt_\b-_\b2; d\bdo\bon\bne\be
- The w\bwh\bhi\bil\ble\be command continuously executes the list _\bl_\bi_\bs_\bt_\b-_\b2 as long
+ The w\bwh\bhi\bil\ble\be command continuously executes the list _\bl_\bi_\bs_\bt_\b-_\b2 as long
as the last command in the list _\bl_\bi_\bs_\bt_\b-_\b1 returns an exit status of
- zero. The u\bun\bnt\bti\bil\bl command is identical to the w\bwh\bhi\bil\ble\be command,
- except that the test is negated; _\bl_\bi_\bs_\bt_\b-_\b2 is executed as long as
- the last command in _\bl_\bi_\bs_\bt_\b-_\b1 returns a non-zero exit status. The
- exit status of the w\bwh\bhi\bil\ble\be and u\bun\bnt\bti\bil\bl commands is the exit status
+ zero. The u\bun\bnt\bti\bil\bl command is identical to the w\bwh\bhi\bil\ble\be command,
+ except that the test is negated; _\bl_\bi_\bs_\bt_\b-_\b2 is executed as long as
+ the last command in _\bl_\bi_\bs_\bt_\b-_\b1 returns a non-zero exit status. The
+ exit status of the w\bwh\bhi\bil\ble\be and u\bun\bnt\bti\bil\bl commands is the exit status
of the last command executed in _\bl_\bi_\bs_\bt_\b-_\b2, or zero if none was exe-
cuted.
C\bCo\bop\bpr\bro\boc\bce\bes\bss\bse\bes\bs
A _\bc_\bo_\bp_\br_\bo_\bc_\be_\bs_\bs is a shell command preceded by the c\bco\bop\bpr\bro\boc\bc reserved word. A
- coprocess is executed asynchronously in a subshell, as if the command
- had been terminated with the &\b& control operator, with a two-way pipe
+ coprocess is executed asynchronously in a subshell, as if the command
+ had been terminated with the &\b& control operator, with a two-way pipe
established between the executing shell and the coprocess.
The format for a coprocess is:
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 creates a coprocess named _\bN_\bA_\bM_\bE. If _\bN_\bA_\bM_\bE is not supplied, the
- default name is _\bC_\bO_\bP_\bR_\bO_\bC. _\bN_\bA_\bM_\bE must not be supplied if _\bc_\bo_\bm_\bm_\ba_\bn_\bd is a _\bs_\bi_\bm_\b-
+ This creates a coprocess named _\bN_\bA_\bM_\bE. If _\bN_\bA_\bM_\bE is not supplied, the
+ default name is C\bCO\bOP\bPR\bRO\bOC\bC. _\bN_\bA_\bM_\bE must not be supplied if _\bc_\bo_\bm_\bm_\ba_\bn_\bd is a _\bs_\bi_\bm_\b-
_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd (see above); otherwise, it is interpreted as the first word
- of the simple command. When the coproc is executed, the shell creates
- an array variable (see A\bAr\brr\bra\bay\bys\bs below) named _\bN_\bA_\bM_\bE in the context of the
- executing shell. The standard output of _\bc_\bo_\bm_\bm_\ba_\bn_\bd is connected via a
- pipe to a file descriptor in the executing shell, and that file
- descriptor is assigned to _\bN_\bA_\bM_\bE[0]. The standard input of _\bc_\bo_\bm_\bm_\ba_\bn_\bd is
- connected via a pipe to a file descriptor in the executing shell, and
- that file descriptor is assigned to _\bN_\bA_\bM_\bE[1]. This pipe is established
- before any redirections specified by the command (see R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN
- below). The file descriptors can be utilized as arguments to shell
- commands and redirections using standard word expansions. The process
- ID of the shell spawned to execute the coprocess is available 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.
-
- The return status of a coprocess is the exit status of _\bc_\bo_\bm_\bm_\ba_\bn_\bd.
+ of the simple command. When the coprocess is executed, the shell cre-
+ ates an array variable (see A\bAr\brr\bra\bay\bys\bs below) named _\bN_\bA_\bM_\bE in the context of
+ the executing shell. The standard output of _\bc_\bo_\bm_\bm_\ba_\bn_\bd is connected via a
+ pipe to a file descriptor in the executing shell, and that file
+ descriptor is assigned to _\bN_\bA_\bM_\bE[0]. The standard input of _\bc_\bo_\bm_\bm_\ba_\bn_\bd is
+ connected via a pipe to a file descriptor in the executing shell, and
+ that file descriptor is assigned to _\bN_\bA_\bM_\bE[1]. This pipe is established
+ before any redirections specified by the command (see R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN
+ below). The file descriptors can be utilized as arguments to shell
+ commands and redirections using standard word expansions. The file
+ descriptors are not available in subshells. The process ID of the
+ shell spawned to execute the coprocess is available as the value of the
+ variable _\bN_\bA_\bM_\bE_PID. The w\bwa\bai\bit\bt builtin command 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
+ the exit status of _\bc_\bo_\bm_\bm_\ba_\bn_\bd.
S\bSh\bhe\bel\bll\bl F\bFu\bun\bnc\bct\bti\bio\bon\bn D\bDe\bef\bfi\bin\bni\bit\bti\bio\bon\bns\bs
A shell function is an object that is called like a simple command and
That command is usually a _\bl_\bi_\bs_\bt of commands between { and }, but
may be any command listed under C\bCo\bom\bmp\bpo\bou\bun\bnd\bd C\bCo\bom\bmm\bma\ban\bnd\bds\bs above. _\bc_\bo_\bm_\b-
_\bp_\bo_\bu_\bn_\bd_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd is executed whenever _\bn_\ba_\bm_\be is specified as the name
- of a simple command. 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.)
+ of a simple command. When in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, _\bn_\ba_\bm_\be 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. 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 exe-
+ cuted, 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
+ 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.
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
- words to the shell. Quoting can be used to disable special treatment
+ _\bQ_\bu_\bo_\bt_\bi_\bn_\bg is used to remove the special meaning of certain 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 _\bm_\be_\bt_\ba_\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br_\bs listed above under D\bDE\bEF\bFI\bIN\bNI\bIT\bTI\bIO\bON\bNS\bS has special
+ Each of the _\bm_\be_\bt_\ba_\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br_\bs listed above under D\bDE\bEF\bFI\bIN\bNI\bIT\bTI\bIO\bON\bNS\bS 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 (see H\bHI\bIS\bS-\b-
+ When the command history expansion facilities are being used (see H\bHI\bIS\bS-\b-
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
+ 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.
- 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
+ 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
- itself quoted, the \\b\<newline> is treated as a line continuation (that
+ <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
+ Enclosing characters in single quotes preserves the literal value of
each character within the quotes. A single quote may not occur between
single quotes, even when preceded by a backslash.
- Enclosing characters in double quotes preserves the literal value of
- all characters within the quotes, with the exception of $\b$, `\b`, \\b\, and,
- when history expansion is enabled, !\b!. 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:
- $\b$, `\b`, "\b", \\b\, or <\b<n\bne\bew\bwl\bli\bin\bne\be>\b>. A double quote may be quoted within double
+ Enclosing characters in double quotes preserves the literal value of
+ all characters within the quotes, with the exception of $\b$, `\b`, \\b\, and,
+ when history expansion is enabled, !\b!. 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:
+ $\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
+ will be performed unless an !\b! appearing in double quotes is escaped
using a backslash. The backslash 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).
Words of the form $\b$'_\bs_\bt_\br_\bi_\bn_\bg' are treated specially. The word expands to
- _\bs_\bt_\br_\bi_\bn_\bg, with backslash-escaped characters replaced as specified by the
- ANSI C standard. Backslash escape sequences, if present, are decoded
+ _\bs_\bt_\br_\bi_\bn_\bg, with backslash-escaped characters replaced as specified by the
+ ANSI C standard. Backslash escape sequences, if present, are decoded
as follows:
\\b\a\ba alert (bell)
\\b\b\bb backspace
\\b\\\b\ backslash
\\b\'\b' single quote
\\b\"\b" double quote
- \\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)
- \\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.
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. If the
- current locale is C\bC or P\bPO\bOS\bSI\bIX\bX, the dollar sign is ignored. If the
+ the string to be translated according to the current locale. If the
+ current locale is C\bC or P\bPO\bOS\bSI\bIX\bX, the dollar sign is ignored. If the
string is translated and replaced, the replacement is double-quoted.
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-
+ 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\bam\bm-\b-
- e\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).
+ e\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).
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 valid value. Once a variable is set, it may be unset only by using
the u\bun\bns\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).
A _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be may be assigned to by a statement of the form
_\bn_\ba_\bm_\be=[_\bv_\ba_\bl_\bu_\be]
- If _\bv_\ba_\bl_\bu_\be is not given, the variable is assigned the null string. All
- _\bv_\ba_\bl_\bu_\be_\bs undergo tilde expansion, parameter and variable expansion, com-
- mand substitution, arithmetic expansion, and quote removal (see E\bEX\bXP\bPA\bAN\bN-\b-
+ If _\bv_\ba_\bl_\bu_\be is not given, the variable is assigned the null string. All
+ _\bv_\ba_\bl_\bu_\be_\bs undergo tilde expansion, parameter and variable expansion, com-
+ mand substitution, arithmetic expansion, and quote removal (see E\bEX\bXP\bPA\bAN\bN-\b-
S\bSI\bIO\bON\bN below). If the variable has its i\bin\bnt\bte\beg\bge\ber\br attribute set, then _\bv_\ba_\bl_\bu_\be
is evaluated as an arithmetic expression even if the $((...)) expansion
- is not used (see A\bAr\bri\bit\bth\bhm\bme\bet\bti\bic\bc E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn below). Word splitting is not
- performed, with the exception of "\b"$\b$@\b@"\b" as explained below under S\bSp\bpe\bec\bci\bia\bal\bl
- P\bPa\bar\bra\bam\bme\bet\bte\ber\brs\bs. Pathname expansion is not performed. Assignment state-
- ments may also appear as arguments to the a\bal\bli\bia\bas\bs, d\bde\bec\bcl\bla\bar\bre\be, t\bty\byp\bpe\bes\bse\bet\bt,
- e\bex\bxp\bpo\bor\brt\bt, r\bre\bea\bad\bdo\bon\bnl\bly\by, and l\blo\boc\bca\bal\bl builtin commands.
-
- In the context where an assignment statement is assigning a value to a
+ is not used (see A\bAr\bri\bit\bth\bhm\bme\bet\bti\bic\bc E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn below). Word splitting is not
+ performed, with the exception of "\b"$\b$@\b@"\b" as explained below under S\bSp\bpe\bec\bci\bia\bal\bl
+ P\bPa\bar\bra\bam\bme\bet\bte\ber\brs\bs. Pathname expansion is not performed. Assignment state-
+ ments may also appear as arguments to the a\bal\bli\bia\bas\bs, d\bde\bec\bcl\bla\bar\bre\be, t\bty\byp\bpe\bes\bse\bet\bt,
+ e\bex\bxp\bpo\bor\brt\bt, r\bre\bea\bad\bdo\bon\bnl\bly\by, and l\blo\boc\bca\bal\bl builtin commands. When in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be,
+ these builtins may appear in a command after one or more instances of
+ 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. When += is applied to a vari-
- able for which the _\bi_\bn_\bt_\be_\bg_\be_\br attribute has been set, _\bv_\ba_\bl_\bu_\be is evaluated
- as an arithmetic expression and added to the variable's current value,
+ able for which the _\bi_\bn_\bt_\be_\bg_\be_\br attribute has been set, _\bv_\ba_\bl_\bu_\be is evaluated
+ as an arithmetic expression and added to the variable's current value,
which is also evaluated. When += is applied to an array variable using
- compound assignment (see A\bAr\brr\bra\bay\bys\bs below), the variable's value is not
+ compound assignment (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
+ 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 applied to a string-valued variable, _\bv_\ba_\bl_\bu_\be is expanded and
+ When applied to a string-valued variable, _\bv_\ba_\bl_\bu_\be is expanded and
appended to the variable's value.
+ A variable can be assigned the _\bn_\ba_\bm_\be_\br_\be_\bf attribute using the -\b-n\bn option to
+ the d\bde\bec\bcl\bla\bar\bre\be or l\blo\boc\bca\bal\bl builtin commands (see the descriptions of d\bde\bec\bcl\bla\bar\bre\be
+ and l\blo\boc\bca\bal\bl below) to create a _\bn_\ba_\bm_\be_\br_\be_\bf, or a reference to another vari-
+ able. This allows variables to be manipulated indirectly. Whenever
+ the nameref variable is referenced or assigned to, the operation is
+ actually performed on the variable specified by the nameref variable's
+ value. A nameref is commonly used within shell functions to refer to a
+ variable whose name is passed as an argument to the function. For
+ instance, if a variable name is passed to a shell function as its first
+ argument, running
+ declare -n ref=$1
+ inside the function creates a nameref variable r\bre\bef\bf whose value is the
+ variable name passed as the first argument. References and assignments
+ to r\bre\bef\bf are treated as references and assignments 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
+ -\b-n\bn 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
+ 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).
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
+ 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 occurs within double quotes, it expands to a sin-
- gle word with the value of each parameter separated by the first
- character of the I\bIF\bFS\bS special variable. That is, "$\b$*\b*" is equiva-
- lent to "$\b$1\b1_\bc$\b$2\b2_\bc.\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 sepa-
- rated by spaces. If I\bIF\bFS\bS is null, the parameters are joined
- without intervening separators.
- @\b@ Expands to the positional parameters, starting from one. When
+ *\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 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*" is equivalent to "$\b$1\b1_\bc$\b$2\b2_\bc.\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@ Expands to the positional parameters, starting from one. When
the expansion occurs within double quotes, each parameter
expands to a separate word. That is, "$\b$@\b@" is equivalent to "$\b$1\b1"
- "$\b$2\b2" ... If the double-quoted expansion occurs within a word,
- the expansion of the first parameter is joined with the begin-
- ning 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@" and $\b$@\b@ expand to
+ "$\b$2\b2" ... If the double-quoted expansion occurs within a word,
+ the expansion of the first parameter is joined with the begin-
+ ning 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@" and $\b$@\b@ expand 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 fore-
+ ?\b? Expands to the exit status of the most recently executed fore-
ground pipeline.
- -\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
+ -\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
itself (such as the -\b-i\bi option).
- $\b$ Expands to the process ID of the shell. In a () subshell, it
- expands to the process ID of the current shell, not the sub-
+ $\b$ Expands to the process ID of the shell. In a () subshell, it
+ expands to the process ID of the current shell, not the sub-
shell.
- !\b! Expands to the process ID of the most recently executed back-
- ground (asynchronous) command.
+ !\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 file name used to invoke b\bba\bas\bsh\bh, as given by argument
+ set to the filename used to invoke b\bba\bas\bsh\bh, as given by argument
zero.
_\b_ At shell startup, set to the absolute pathname used to invoke
the shell or shell script being executed as passed in the envi-
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\bBA\bAS\bSH\bH Expands to the full file name used to invoke this instance of
+ 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
defined 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}.
B\bBA\bAS\bSH\bH_\b_S\bSU\bUB\bBS\bSH\bHE\bEL\bLL\bL
- Incremented by one each time a subshell or subshell environment
- is spawned. The initial value is 0.
+ Incremented by one within each subshell or subshell environment
+ when the shell begins executing in that environment. The ini-
+ tial value is 0.
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[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[2]\b] The patch level.
B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO[\b[3]\b] The build version.
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_\b1).
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
+ Expands to a string describing the version of this instance of
b\bba\bas\bsh\bh.
-
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.
-
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 pro-
- grammable 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
+ The current command line. This variable is available only in
+ shell functions and external commands invoked by the pro-
+ grammable 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 pro-
- grammable 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
+ 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 pro-
+ grammable 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 pro-
- grammable 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
+ 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 pro-
+ grammable 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
+ 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
described above. 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\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
- unset, it loses its special properties, even if it is subse-
+ able will not change the current directory. If D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK is
+ unset, it loses its special properties, even if it is subse-
quently 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 and return an error sta-
- tus. If F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE is unset, it loses its special properties,
+ 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 and return an error sta-
+ tus. If F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE is unset, it loses its special properties,
even if it is subsequently reset.
- 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
- instance, $\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
+ 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
+ instance, $\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
- current user is a member. Assignments to G\bGR\bRO\bOU\bUP\bPS\bS have no effect
- and return an error status. If G\bGR\bRO\bOU\bUP\bPS\bS is unset, it loses its
+ 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
+ and return an error status. 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
- command. If H\bHI\bIS\bST\bTC\bCM\bMD\bD is unset, it loses its special properties,
+ command. If H\bHI\bIS\bST\bTC\bCM\bMD\bD is unset, it loses its special properties,
even if it is subsequently reset.
-
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
+ 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 contain only a single command).
-
- 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, a random integer between
0 and 32767 is generated. The sequence of random numbers may be
initialized by assigning a value to R\bRA\bAN\bND\bDO\bOM\bM. If R\bRA\bAN\bND\bDO\bOM\bM is unset,
- it loses its special properties, even if it is subsequently
+ it loses its special properties, even if it is subsequently
reset.
-
R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_L\bLI\bIN\bNE\bE
The contents of the r\bre\bea\bad\bdl\bli\bin\bne\be line buffer, for use with "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).
-
R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_P\bPO\bOI\bIN\bNT\bT
The position of the insertion point in the r\bre\bea\bad\bdl\bli\bin\bne\be line buffer,
for use with "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).
-
- R\bRE\bEP\bPL\bLY\bY Set to the line of input read by the r\bre\bea\bad\bd builtin command when
+ R\bRE\bEP\bPL\bLY\bY Set to the line of input read by the r\bre\bea\bad\bd builtin command when
no arguments are supplied.
-
S\bSE\bEC\bCO\bON\bND\bDS\bS
- Each time this parameter is referenced, the number of seconds
- since shell invocation is returned. If a value is assigned to
- S\bSE\bEC\bCO\bON\bND\bDS\bS, the value returned upon subsequent references is the
- number of seconds since the assignment plus the value assigned.
+ Each time this parameter is referenced, the number of seconds
+ since shell invocation is returned. If a value is assigned to
+ S\bSE\bEC\bCO\bON\bND\bDS\bS, the value returned upon subsequent references is the
+ number of seconds since the assignment plus the value assigned.
If S\bSE\bEC\bCO\bON\bND\bDS\bS is unset, it loses its special properties, even if it
is subsequently reset.
-
S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS
- A colon-separated list of enabled shell options. Each word in
- the list is a valid argument for the -\b-o\bo option to the s\bse\bet\bt
+ A colon-separated list of enabled shell options. Each word in
+ 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
+ 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.
-
S\bSH\bHL\bLV\bVL\bL Incremented by one each time an instance of b\bba\bas\bsh\bh is started.
-
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
+ The following variables are used by the shell. 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
+ 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 a description of the various compatibility levels
+ and their effects. The value may be a decimal number (e.g.,
+ 4.2) or an integer (e.g., 42) corresponding to the desired com-
+ patibility 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. The valid compatibility levels correspond to
+ the compatibility options accepted by the s\bsh\bho\bop\bpt\bt builtin
+ described below (for example, c\bco\bom\bmp\bpa\bat\bt4\b42\b2 means that 4.2 and 42 are
+ valid values). 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 file name.
- P\bPA\bAT\bTH\bH is not used to search for the resultant file name.
+ arithmetic expansion 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 _\bs_\be_\bt _\b-_\bx is
list of directories in which the shell looks for destination
directories specified by 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
+ remember. Bash will not allow this value to be decreased below
+ a POSIX-mandated minimum, and there is a maximum value (cur-
+ rently 8192) that this may not exceed. The minimum value is
+ system-dependent.
C\bCO\bOL\bLU\bUM\bMN\bNS\bS
Used by the s\bse\bel\ble\bec\bct\bt compound command to determine the terminal
- width when printing selection lists. Automatically set upon
+ width when 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.
C\bCO\bOM\bMP\bPR\bRE\bEP\bPL\bLY\bY
An array variable from which b\bba\bas\bsh\bh reads the possible completions
- generated by a shell function invoked by the programmable com-
- pletion facility (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).
+ generated by a shell function invoked by the programmable com-
+ pletion facility (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). Each
+ array element contains one possible completion.
E\bEM\bMA\bAC\bCS\bS If b\bba\bas\bsh\bh 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.
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). The default value is _\b~_\b/_\b._\bb_\ba_\bs_\bh_\b__\bh_\bi_\bs_\bt_\bo_\br_\by. If unset,
- the command history is not saved when an interactive shell
- exits.
+ the command history is not saved when a shell 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, by removing the oldest entries, to contain
- no more than that number of lines. The default value is 500.
- The history file is also truncated to this size after writing it
- when an interactive shell exits.
+ 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.
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. Each pattern is
history regardless of the value of H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE.
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). The default value is 500.
+ H\bHI\bIS\bST\bTO\bOR\bRY\bY below). If the value is 0, commands are not saved in
+ the history list. Numeric values less than zero result in every
+ command being saved on the history list (there is no limit).
+ The shell sets the default value to 500 after reading any
+ startup files.
H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT
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
This variable determines the locale category used for number
formatting.
L\bLI\bIN\bNE\bES\bS Used by the s\bse\bel\ble\bec\bct\bt compound command to determine the column
- length for printing selection lists. Automatically set upon
+ 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
- arrival of mail in the specified file or Maildir-format direc-
+ 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
+ arrival of mail in the specified file or Maildir-format direc-
tory.
M\bMA\bAI\bIL\bLC\bCH\bHE\bEC\bCK\bK
- Specifies how often (in seconds) b\bba\bas\bsh\bh 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
+ Specifies how often (in seconds) b\bba\bas\bsh\bh 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.
M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH
- A colon-separated list of file names to be checked for mail.
- The message to be printed when mail arrives in a particular file
- may be specified by separating the file name from the message
- with a `?'. When used in the text of the message, $\b$_\b_ expands to
- the name of the current mailfile. Example:
+ 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
+ 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 supplies a default value for this variable, but the loca-
- tion of the user mail files that it uses is system dependent
+ B\bBa\bas\bsh\bh supplies a default value for this variable, but the loca-
+ tion 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
- set by the administrator who installs b\bba\bas\bsh\bh. A common value is
- ``/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin''.
+ 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 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%3\b3l\blS\bS'\b'. If the value is null, no
- timing information is displayed. A trailing newline is added
+ $\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,
+ no timing information is displayed. A trailing newline 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
default 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 input after
- issuing the primary prompt. B\bBa\bas\bsh\bh terminates after waiting for
- that number of seconds if 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
+ 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
+ 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
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 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
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-
- tuting one string for another in the command. The default is
- `^\b^'. The optional third character is the character which indi-
- cates that the remainder of the line is a comment when found as
- the first character of a word, normally `#\b#'. The history com-
+ 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. The default is
+ `^\b^'. The optional third character is the character which indi-
+ cates that the remainder of the line is a comment when found as
+ the first character of a word, normally `#\b#'. The history com-
ment character causes history substitution to be skipped for the
- remaining words on the line. It does not necessarily cause 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
- arithmetic expressions) and are zero-based; associative arrays are
- referenced using arbitrary strings.
+ 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
+ referenced using arbitrary strings. Unless otherwise noted, indexed
+ array indices must be non-negative integers.
An indexed array is created automatically if any variable is assigned
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. If _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt
- evaluates to a number less than zero, it is used as an offset from one
- greater than the array's maximum index (so a subcript of -1 refers to
- the last element of the array). 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.
+ 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.
Associative arrays are created using d\bde\bec\bcl\bla\bar\bre\be -\b-A\bA _\bn_\ba_\bm_\be.
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 is 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 the bracket
- and subscript. When assigning to indexed arrays, if the optional
- brackets and subscript are supplied, that index is assigned to; other-
- wise the index of the element assigned is the last index assigned to by
- the statement plus one. Indexing starts at zero.
+ _\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. 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.
When assigning to an associative array, the subscript is required.
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
- introduced above.
+ introduced 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.
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
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_\b-
_\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 ele-
ments in the array. Referencing an array variable without a subscript
- is equivalent to referencing the array with a subscript of 0.
+ is equivalent to referencing the array with a subscript of 0. 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 ele-
+ ment.
- An array variable is considered set if a subscript has been assigned a
+ An array variable is considered set if a subscript has been assigned a
value. The null string is a valid value.
+ It is possible to obtain the keys (indices) of an array as well as the
+ values. ${!\b!_\bn_\ba_\bm_\be[_\b@]} and ${!\b!_\bn_\ba_\bm_\be[_\b*]} expand to the indices assigned in
+ 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]
- destroys the array element at index _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt. Care must be taken to
- avoid unwanted side effects caused by pathname expansion. u\bun\bns\bse\bet\bt _\bn_\ba_\bm_\be,
- where _\bn_\ba_\bm_\be is an array, or 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@, removes the entire array.
-
- 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
- array. 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 assign-
- ments.
+ destroys the array element at index _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt. Negative subscripts to
+ indexed arrays are interpreted as described above. Care must be taken
+ to avoid unwanted side effects caused by pathname expansion. u\bun\bns\bse\bet\bt
+ _\bn_\ba_\bm_\be, where _\bn_\ba_\bm_\be is an array, or 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@, removes the entire array.
+
+ 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
+ array. 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.
E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN
Expansion is performed on the command line after it has been split into
- words. There are seven kinds of expansion performed: _\bb_\br_\ba_\bc_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn,
- _\bt_\bi_\bl_\bd_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn, _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br _\ba_\bn_\bd _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn, _\bc_\bo_\bm_\bm_\ba_\bn_\bd _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\b-
+ words. There are seven kinds of expansion performed: _\bb_\br_\ba_\bc_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn,
+ _\bt_\bi_\bl_\bd_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn, _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br _\ba_\bn_\bd _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn, _\bc_\bo_\bm_\bm_\ba_\bn_\bd _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\b-
_\bt_\bi_\bo_\bn, _\ba_\br_\bi_\bt_\bh_\bm_\be_\bt_\bi_\bc _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn, _\bw_\bo_\br_\bd _\bs_\bp_\bl_\bi_\bt_\bt_\bi_\bn_\bg, and _\bp_\ba_\bt_\bh_\bn_\ba_\bm_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn.
- The order of expansions is: brace expansion, tilde expansion, parame-
- ter, variable and arithmetic expansion and command substitution (done
- in a left-to-right fashion), word splitting, and pathname expansion.
+ The order of expansions is: brace expansion; tilde expansion, parameter
+ and variable expansion, arithmetic expansion, and command substitution
+ (done in a left-to-right fashion); word splitting; and pathname expan-
+ sion.
On systems that can support it, there is an additional expansion avail-
- able: _\bp_\br_\bo_\bc_\be_\bs_\bs _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\bt_\bi_\bo_\bn.
+ able: _\bp_\br_\bo_\bc_\be_\bs_\bs _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\bt_\bi_\bo_\bn. This is performed at the same time as
+ tilde, parameter, variable, and arithmetic expansion and command sub-
+ stitution.
Only brace expansion, word splitting, and pathname expansion can change
the number of words of the expansion; other expansions expand a single
or _\by begins with a zero, the shell attempts to force all generated
terms to contain the same number of digits, zero-padding where neces-
sary. When characters are supplied, the expression expands to each
- character lexicographically between _\bx and _\by, inclusive. Note that both
- _\bx and _\by must be of the same type. When the increment is supplied, it
- is used as the difference between each term. The default increment is
- 1 or -1 as appropriate.
+ character lexicographically between _\bx and _\by, inclusive, using the
+ default C locale. Note that both _\bx and _\by must be of the same type.
+ When the increment is supplied, it is used as the difference between
+ each term. The default increment is 1 or -1 as appropriate.
Brace expansion is performed before any other expansions, and any char-
acters special to other expansions are preserved in the result. It is
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 file names with tildes in
+ also performed. Consequently, one may use filenames with tildes in
assignments 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
expanded value.
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.
-
- If the first character of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an exclamation point (!\b!), a
- level of variable indirection is introduced. B\bBa\bas\bsh\bh uses the value of
- the variable formed from the rest of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br as the name of the vari-
- able; this variable is then expanded and that value is used in the rest
- of the substitution, rather than the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br itself. This
- is known as _\bi_\bn_\bd_\bi_\br_\be_\bc_\bt _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn. The exceptions to this are the expan-
- sions of ${!\b!\\b\f\bfP\bPf\bfI\bIp\bpr\bre\bef\bfi\bix\bx*\b*} and ${!\b!_\bn_\ba_\bm_\be[_\b@]} described below. The excla-
- mation point must immediately follow the left brace in order to intro-
- duce indirection.
+ 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!), it
+ introduces a level of variable indirection. B\bBa\bas\bsh\bh uses the value of the
+ variable formed from the rest of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br as the name of the variable;
+ this variable is then expanded and that value is used in the rest of
+ the substitution, rather than the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br itself. This is
+ known as _\bi_\bn_\bd_\bi_\br_\be_\bc_\bt _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn. 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.
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
- below, 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 unset.
+ below (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
+ 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-
- sion of _\bw_\bo_\br_\bd is substituted. Otherwise, the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
+ 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-
+ sion of _\bw_\bo_\br_\bd is substituted. 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}
- 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
+ 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
expansion 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_\b-
- _\be_\bt_\be_\br is then substituted. Positional parameters and special
+ _\be_\bt_\be_\br is then substituted. Positional parameters and special
parameters may not be assigned to 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
+ 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
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
+ 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.
${_\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
- _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br starting at the character specified by _\bo_\bf_\bf_\bs_\be_\bt. If
- _\bl_\be_\bn_\bg_\bt_\bh is omitted, expands to the substring of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br start-
- ing at the character specified by _\bo_\bf_\bf_\bs_\be_\bt. _\bl_\be_\bn_\bg_\bt_\bh and _\bo_\bf_\bf_\bs_\be_\bt are
- 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 below). If
- _\bo_\bf_\bf_\bs_\be_\bt evaluates to a number less than zero, the value is used
- as an offset from the end of the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. If _\bl_\be_\bn_\bg_\bt_\bh
- evaluates to a number less than zero, and _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is not @\b@ and
- not an indexed or associative array, it is interpreted as an
- offset from the end of the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br rather than a num-
- ber of characters, and the expansion is the characters between
- the two offsets. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@, the result is _\bl_\be_\bn_\bg_\bt_\bh posi-
- tional parameters beginning at _\bo_\bf_\bf_\bs_\be_\bt. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an
- indexed array name subscripted by @ or *, the result is the
- _\bl_\be_\bn_\bg_\bt_\bh members of the array beginning with ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br[_\bo_\bf_\bf_\bs_\be_\bt]}.
- A negative _\bo_\bf_\bf_\bs_\be_\bt is taken relative to one greater than the max-
- imum index of the specified array. Substring expansion applied
- to an associative array produces undefined results. Note that a
- negative offset must be separated from the colon by at least one
- space to avoid being confused with the :- expansion. Substring
- indexing is zero-based unless the positional parameters are
- used, in which case the indexing starts at 1 by default. If
- _\bo_\bf_\bf_\bs_\be_\bt is 0, and the positional parameters are used, $\b$0\b0 is pre-
- fixed to the list.
+ 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
+ value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br starting at the character specified by _\bo_\bf_\bf_\b-
+ _\bs_\be_\bt. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@, an indexed array subscripted by @\b@ or *\b*,
+ or an associative array name, the results differ as described
+ below. If _\bl_\be_\bn_\bg_\bt_\bh is omitted, expands to the substring of the
+ value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br starting at the character specified by _\bo_\bf_\bf_\bs_\be_\bt
+ and extending to the end of the value. _\bl_\be_\bn_\bg_\bt_\bh and _\bo_\bf_\bf_\bs_\be_\bt are
+ 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 below).
+
+ If _\bo_\bf_\bf_\bs_\be_\bt evaluates to a number less than zero, the value is
+ used as an offset in characters from the end of the value of
+ _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. If _\bl_\be_\bn_\bg_\bt_\bh evaluates to a number less than zero, it
+ is interpreted as an offset in characters from the end of the
+ value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br rather than a number of characters, and the
+ expansion is the characters between _\bo_\bf_\bf_\bs_\be_\bt 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 :\b:-\b- expan-
+ sion.
+
+ If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@, the result is _\bl_\be_\bn_\bg_\bt_\bh positional parameters
+ beginning at _\bo_\bf_\bf_\bs_\be_\bt. A negative _\bo_\bf_\bf_\bs_\be_\bt is taken relative to one
+ greater than the greatest positional parameter, so an offset of
+ -1 evaluates to the last positional parameter. It is an expan-
+ sion error if _\bl_\be_\bn_\bg_\bt_\bh evaluates to a number less than zero.
+
+ If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an indexed array name subscripted by @ or *, the
+ result is the _\bl_\be_\bn_\bg_\bt_\bh members of the array beginning with
+ ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br[_\bo_\bf_\bf_\bs_\be_\bt]}. A negative _\bo_\bf_\bf_\bs_\be_\bt is taken relative to
+ one greater than the maximum index of the specified array. It
+ is an expansion error if _\bl_\be_\bn_\bg_\bt_\bh evaluates to a number less than
+ zero.
+
+ Substring expansion applied to an associative array produces
+ undefined results.
+
+ Substring indexing is zero-based unless the positional parame-
+ ters are used, in which case the indexing starts at 1 by
+ default. If _\bo_\bf_\bf_\bs_\be_\bt is 0, and the positional parameters are
+ used, $\b$0\b0 is prefixed to the list.
${!\b!_\bp_\br_\be_\bf_\bi_\bx*\b*}
${!\b!_\bp_\br_\be_\bf_\bi_\bx@\b@}
_\bp_\ba_\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
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.
+ 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. 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 ``#\b#'' case) or the longest matching pat-
- tern (the ``#\b##\b#'' 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 parame-
+ 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 ``#\b#'' case) or the longest matching pat-
+ tern (the ``#\b##\b#'' 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 parame-
ter in turn, and the expansion is the resultant list. If _\bp_\ba_\br_\ba_\bm_\b-
- _\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
+ _\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%_\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 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. 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 expansion is the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br with
- the shortest matching pattern (the ``%\b%'' case) or the longest
- matching pattern (the ``%\b%%\b%'' case) deleted. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@
- or *\b*, the pattern removal operation is applied to each posi-
- tional 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
+ a trailing portion of the expanded 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 ``%\b%'' case) or the longest
+ matching pattern (the ``%\b%%\b%'' case) deleted. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@
+ or *\b*, the pattern removal operation is applied to each posi-
+ tional 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}
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. If _\bp_\ba_\bt_\bt_\be_\br_\bn begins with /\b/, all matches of _\bp_\ba_\bt_\bt_\be_\br_\bn are
- replaced with _\bs_\bt_\br_\bi_\bn_\bg. Normally only the first match is
+ 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. If _\bp_\ba_\bt_\bt_\be_\br_\bn begins with /\b/, all matches of _\bp_\ba_\bt_\bt_\be_\br_\bn are
+ replaced with _\bs_\bt_\br_\bi_\bn_\bg. Normally only the first match is
replaced. If _\bp_\ba_\bt_\bt_\be_\br_\bn begins with #\b#, it must match at the begin-
ning of the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. If _\bp_\ba_\bt_\bt_\be_\br_\bn begins with
- %\b%, it must match at the end of the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br.
+ %\b%, it must match at the end of the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br.
If _\bs_\bt_\br_\bi_\bn_\bg is null, matches of _\bp_\ba_\bt_\bt_\be_\br_\bn are deleted and the /\b/ fol-
lowing _\bp_\ba_\bt_\bt_\be_\br_\bn may be omitted. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@ or *\b*, the sub-
- stitution 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 substitution
- operation is applied to each member of the array in turn, and
+ stitution 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 substitution
+ 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}
${_\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-
- duce a pattern just as in pathname expansion. 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 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.
+ 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^
+ operator converts lowercase letters matching _\bp_\ba_\bt_\bt_\be_\br_\bn to upper-
+ case; the ,\b, operator converts matching uppercase letters to low-
+ ercase. 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
+ 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
+ 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 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.
C\bCo\bom\bmm\bma\ban\bnd\bd S\bSu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bn
_\bC_\bo_\bm_\bm_\ba_\bn_\bd _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\bt_\bi_\bo_\bn allows the output of a command to replace the com-
mand name. There are two forms:
-
$\b$(\b(_\bc_\bo_\bm_\bm_\ba_\bn_\bd)\b)
or
`\b`_\bc_\bo_\bm_\bm_\ba_\bn_\bd`\b`
The _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn is treated as if it were within double quotes, but a
double quote inside the parentheses is not treated specially. All
- tokens in the expression undergo parameter expansion, string expansion,
- command substitution, and quote removal. Arithmetic expansions may be
+ tokens in the expression undergo parameter and variable expansion, com-
+ mand substitution, and quote removal. The result is treated as the
+ arithmetic expression to be evaluated. Arithmetic expansions may be
nested.
- The evaluation is performed according to the rules listed below under
+ 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.
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 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. 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 with its input or out-
+ _\bP_\br_\bo_\bc_\be_\bs_\bs _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\bt_\bi_\bo_\bn 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. 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 with its input or out-
put connected to a _\bF_\bI_\bF_\bO or some file in /\b/d\bde\bev\bv/\b/f\bfd\bd. The name of this file
- is passed as an argument to the current command as the result of the
- expansion. If the >\b>(\b(_\bl_\bi_\bs_\bt)\b) form is used, writing to the file will pro-
- vide input for _\bl_\bi_\bs_\bt. If the <\b<(\b(_\bl_\bi_\bs_\bt)\b) form is used, the file passed as
+ is passed as an argument to the current command as the result of the
+ expansion. If the >\b>(\b(_\bl_\bi_\bs_\bt)\b) form is used, writing to the file will pro-
+ vide 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.
- When available, process substitution is performed simultaneously with
- parameter and variable expansion, command substitution, and arithmetic
+ 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 on these characters. 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 default,
- then sequences of <\b<s\bsp\bpa\bac\bce\be>\b>, <\b<t\bta\bab\bb>\b>, and <\b<n\bne\bew\bwl\bli\bin\bne\be>\b> at the beginning and
- end of the results of the previous expansions are ignored, and any
- sequence 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 and t\bta\bab\bb 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.
-
- Explicit null arguments ("\b""\b" or '\b''\b') are retained. Unquoted implicit
+ 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 default, then sequences of <\b<s\bsp\bpa\bac\bce\be>\b>, <\b<t\bta\bab\bb>\b>,
+ and <\b<n\bne\bew\bwl\bli\bin\bne\be>\b> at the beginning and end of the results of the previous
+ expansions are ignored, and any sequence 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 and
+ t\bta\bab\bb 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 charac-
+ ter). 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.
+
+ Explicit null arguments ("\b""\b" or '\b''\b') are retained. Unquoted implicit
null arguments, resulting from the expansion of parameters that have no
- values, are removed. If a parameter with no value is expanded within
+ values, are removed. If a parameter with no value is expanded within
double quotes, a null argument results and is retained.
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
- appears, then the word is regarded as a _\bp_\ba_\bt_\bt_\be_\br_\bn, and replaced with an
- alphabetically sorted list of file names matching the pattern. If no
- matching file names 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 performed without regard to the case of alpha-
- betic characters. When a pattern is used for pathname expansion, the
- character `\b``\b`.\b.'\b''\b' 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. When matching a pathname, the slash character must always be
- matched explicitly. In other cases, the `\b``\b`.\b.'\b''\b' character is not
- treated specially. 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, f\bfa\bai\bil\bl-\b-
- g\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
- name that also matches one of the patterns in G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE is removed
- from the list of matches. The file names `\b``\b`.\b.'\b''\b' and `\b``\b`.\b..\b.'\b''\b' 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\bG-\b-
- N\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 file names beginning with a `\b``\b`.\b.'\b''\b' will match. To
- get the old behavior of ignoring file names beginning with a `\b``\b`.\b.'\b''\b',
- make `\b``\b`.\b.*\b*'\b''\b' one of the patterns in G\bGL\bLO\bOB\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.
+ 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, 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\bt-\b-
+ t\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 performed without
+ regard to the case of alphabetic characters. When a pattern is used
+ for pathname expansion, the character `\b``\b`.\b.'\b''\b' 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. When matching a pathname, the slash char-
+ acter must always be matched explicitly. In other cases, the `\b``\b`.\b.'\b''\b'
+ character is not treated specially. 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\bl-\b-
+ g\bgl\blo\bob\bb, 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 filename
+ that also matches one of the patterns in G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE is removed from the
+ list of matches. The filenames `\b``\b`.\b.'\b''\b' and `\b``\b`.\b..\b.'\b''\b' 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 `\b``\b`.\b.'\b''\b' will match. To get the old
+ behavior of ignoring filenames beginning with a `\b``\b`.\b.'\b''\b', make `\b``\b`.\b.*\b*'\b''\b' one
+ of the patterns in G\bGL\bLO\bOB\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.
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
- directories 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
+ directories 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..\b..\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 sorts between those two charac-
- ters, inclusive, using the current locale's collating
- sequence and character set, is matched. If the first
+ [\b[.\b..\b..\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
+ sequence and character set, is matched. If the first
character following the [\b[ is a !\b! or a ^\b^ then any charac-
- ter not enclosed is matched. The sorting order of char-
- acters in range expressions is determined by the current
- locale and the value of the L\bLC\bC_\b_C\bCO\bOL\bLL\bLA\bAT\bTE\bE shell variable, if
- set. A -\b- may be matched by including it as the first or
- last character in the set. A ]\b] may be matched by includ-
- ing 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
+ ter not enclosed is matched. The sorting order of char-
+ acters in range expressions is 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 traditional interpreta-
+ tion of range expressions, 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\bii\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
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
class. The w\bwo\bor\brd\bd character class matches letters, digits,
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
+ Within [\b[ and ]\b], an _\be_\bq_\bu_\bi_\bv_\ba_\bl_\be_\bn_\bc_\be _\bc_\bl_\ba_\bs_\bs can be specified
using the syntax [\b[=\b=_\bc=\b=]\b], which matches all characters with
- the same collation weight (as defined by the current
+ the same collation weight (as defined by the current
locale) 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, several
- extended pattern matching operators are recognized. In the following
+ extended pattern matching operators are recognized. 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 of the fol-
lowing sub-patterns:
Q\bQu\buo\bot\bte\be R\bRe\bem\bmo\bov\bva\bal\bl
After the preceding expansions, all unquoted occurrences of the charac-
- ters \\b\, '\b', and "\b" that did not result from one of the above expansions
+ ters \\b\, '\b', and "\b" that did not result from one of the above expansions
are removed.
R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN
- Before a command is executed, its input and output may be _\br_\be_\bd_\bi_\br_\be_\bc_\bt_\be_\bd
- using a special notation interpreted by the shell. Redirection may
- also be used to open and close files for 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 order they appear, from left to right.
+ Before a command is executed, its input and output may be _\br_\be_\bd_\bi_\br_\be_\bc_\bt_\be_\bd
+ 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 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.
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 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.
+ 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.
In the following descriptions, if the file descriptor number is omit-
ted, and the first character of the redirection operator is <\b<, the re-
The word following the redirection operator in the following descrip-
tions, unless otherwise noted, is subjected to brace expansion, tilde
- expansion, parameter expansion, command substitution, arithmetic expan-
- sion, quote removal, pathname expansion, and word splitting. If it
- expands to more than one word, b\bba\bas\bsh\bh reports an error.
+ 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
+ Note that 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-
+ 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.
B\bBa\bas\bsh\bh handles several filenames specially when they are used in redirec-
tions, as described in the following table:
/\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-
+ If _\bf_\bd is a valid integer, file descriptor _\bf_\bd is dupli-
cated.
/\b/d\bde\bev\bv/\b/s\bst\btd\bdi\bin\bn
File descriptor 0 is duplicated.
File descriptor 2 is duplicated.
/\b/d\bde\bev\bv/\b/t\btc\bcp\bp/\b/_\bh_\bo_\bs_\bt/\b/_\bp_\bo_\br_\bt
If _\bh_\bo_\bs_\bt is a valid hostname or Internet address, and _\bp_\bo_\br_\bt
- is an integer port number or service name, b\bba\bas\bsh\bh attempts
- to open a TCP connection to the corresponding socket.
+ is an integer port number or service name, b\bba\bas\bsh\bh attempts
+ to open the corresponding TCP socket.
/\b/d\bde\bev\bv/\b/u\bud\bdp\bp/\b/_\bh_\bo_\bs_\bt/\b/_\bp_\bo_\br_\bt
If _\bh_\bo_\bs_\bt is a valid hostname or Internet address, and _\bp_\bo_\br_\bt
- is an integer port number or service name, b\bba\bas\bsh\bh attempts
- to open a UDP connection to the corresponding socket.
+ is an integer port number or service name, b\bba\bas\bsh\bh attempts
+ to open the corresponding UDP socket.
A failure to open or create a file causes the redirection to fail.
- Redirections using file descriptors greater than 9 should be used with
- care, as they may conflict with file descriptors the shell uses inter-
+ Redirections using file descriptors greater than 9 should be used with
+ care, as they may conflict with file descriptors the shell uses inter-
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
+ 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.
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
+ Redirection of output causes the file whose name results from the
expansion 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
+ does not exist it is created; if it does exist it is truncated to zero
size.
The general format for redirecting output is:
[_\bn]>\b>_\bw_\bo_\br_\bd
- If 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 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>, and the n\bno\boc\bcl\blo\bob\bbb\bbe\ber\br option to the s\bse\bet\bt
+ 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 re-
direction is attempted 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
- results from the expansion of _\bw_\bo_\br_\bd to be opened for appending on file
- descriptor _\bn, or the standard output (file descriptor 1) if _\bn is not
+ Redirection of output in this fashion causes the file whose name
+ results from the expansion of _\bw_\bo_\br_\bd to be opened 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:
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
+ 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.
- There are two formats for redirecting standard output and standard
+ There are two formats for redirecting standard output and standard
error:
&\b&>\b>_\bw_\bo_\br_\bd
>\b>_\bw_\bo_\br_\bd 2>\b>&\b&1
+ When using the second form, _\bw_\bo_\br_\bd may not expand to a number or -\b-. If
+ it does, other redirection operators apply (see D\bDu\bup\bpl\bli\bic\bca\bat\bti\bin\bng\bg F\bFi\bil\ble\be
+ D\bDe\bes\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
+ 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.
The format for appending standard output and standard error is:
>\b>>\b>_\bw_\bo_\br_\bd 2>\b>&\b&1
+ (see D\bDu\bup\bpl\bli\bic\bca\bat\bti\bin\bng\bg F\bFi\bil\ble\be D\bDe\bes\bsc\bcr\bri\bip\bpt\bto\bor\brs\bs below).
+
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
+ This type of redirection instructs the shell to read input from the
current source until a line containing only _\bd_\be_\bl_\bi_\bm_\bi_\bt_\be_\br (with no trailing
- blanks) is seen. All of the lines read up to that point are then used
+ blanks) is seen. All of the lines read up to that point are then used
as the standard input for a command.
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 expansion, command substitution, arithmetic expansion, or
- pathname expansion is performed on _\bw_\bo_\br_\bd. If any characters in _\bw_\bo_\br_\bd are
- quoted, the _\bd_\be_\bl_\bi_\bm_\bi_\bt_\be_\br is the result of quote removal on _\bw_\bo_\br_\bd, and the
- lines in the here-document are not expanded. If _\bw_\bo_\br_\bd is unquoted, all
- lines of the here-document are subjected to parameter expansion, com-
- mand substitution, and arithmetic expansion. In the latter case, 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`.
+ No parameter and variable expansion, command substitution, arithmetic
+ expansion, or pathname expansion is performed on _\bw_\bo_\br_\bd. If any charac-
+ ters in _\bw_\bo_\br_\bd are quoted, the _\bd_\be_\bl_\bi_\bm_\bi_\bt_\be_\br is the result of quote removal
+ on _\bw_\bo_\br_\bd, and the lines in the here-document are not expanded. If _\bw_\bo_\br_\bd
+ is unquoted, all lines of the here-document are subjected to parameter
+ expansion, command substitution, and arithmetic expansion, the charac-
+ ter 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
- allows here-documents within shell scripts to be indented in a natural
+ stripped 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.
H\bHe\ber\bre\be S\bSt\btr\bri\bin\bng\bgs\bs
<\b<<\b<<\b<_\bw_\bo_\br_\bd
- The _\bw_\bo_\br_\bd is expanded and supplied to the command on its standard input.
+ The _\bw_\bo_\br_\bd undergoes brace expansion, tilde expansion, parameter and
+ variable expansion, command substitution, arithmetic expansion, and
+ quote removal. Pathname expansion and word splitting are not per-
+ formed. The result is supplied as a single string to the command on
+ its standard input.
D\bDu\bup\bpl\bli\bic\bca\bat\bti\bin\bng\bg F\bFi\bil\ble\be D\bDe\bes\bsc\bcr\bri\bip\bpt\bto\bor\brs\bs
The redirection operator
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 re-
- direction error occurs. As a special case, if _\bn is omitted, and _\bw_\bo_\br_\bd
- does not expand to one or more digits, the standard output and standard
- error are redirected as described previously.
+ direction error occurs. 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.
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&_\bd_\bi_\bg_\bi_\bt-\b-
- moves the file descriptor _\bd_\bi_\bg_\bi_\bt to file descriptor _\bn, or the standard
+ moves the file descriptor _\bd_\bi_\bg_\bi_\bt to file descriptor _\bn, or the standard
input (file descriptor 0) if _\bn is not specified. _\bd_\bi_\bg_\bi_\bt is closed after
being duplicated to _\bn.
[_\bn]>\b>&\b&_\bd_\bi_\bg_\bi_\bt-\b-
- moves the file descriptor _\bd_\bi_\bg_\bi_\bt to file descriptor _\bn, or the standard
+ moves the file descriptor _\bd_\bi_\bg_\bi_\bt to file descriptor _\bn, or the standard
output (file descriptor 1) if _\bn is not specified.
O\bOp\bpe\ben\bni\bin\bng\bg F\bFi\bil\ble\be D\bDe\bes\bsc\bcr\bri\bip\bpt\bto\bor\brs\bs f\bfo\bor\br R\bRe\bea\bad\bdi\bin\bng\bg a\ban\bnd\bd W\bWr\bri\bit\bti\bin\bng\bg
[_\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
+ 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.
A\bAL\bLI\bIA\bAS\bSE\bES\bS
- _\bA_\bl_\bi_\ba_\bs_\be_\bs allow a string to be substituted for a word when it is used as
- the first word of a simple command. The shell maintains a list of
- aliases that may be set and unset with the a\bal\bli\bia\bas\bs and u\bun\bna\bal\bli\bia\bas\bs builtin
- commands (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 first word of each
- simple command, if unquoted, is checked to see if it has an alias. If
- so, that word is replaced by the text of the alias. The characters /\b/,
- $\b$, `\b`, and =\b= and any of the shell _\bm_\be_\bt_\ba_\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br_\bs or quoting characters
+ _\bA_\bl_\bi_\ba_\bs_\be_\bs allow a string to be substituted for a word when it is used as
+ the first word of a simple command. The shell maintains a list of
+ aliases that may be set and unset with the a\bal\bli\bia\bas\bs and u\bun\bna\bal\bli\bia\bas\bs builtin
+ commands (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 first word of each
+ simple command, if unquoted, is checked to see if it has an alias. If
+ so, that word is replaced by the text of the alias. The characters /\b/,
+ $\b$, `\b`, and =\b= and any of the shell _\bm_\be_\bt_\ba_\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br_\bs or quoting characters
listed above may not appear in an alias name. The replacement text may
- contain any valid shell input, including shell metacharacters. The
- first word of the replacement text is tested for aliases, but a word
- that is identical to an alias being expanded is not expanded a second
- time. This means that one may alias l\bls\bs to l\bls\bs -\b-F\bF, for 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 command
+ contain any valid shell input, including shell metacharacters. The
+ first word of the replacement text is tested for aliases, but a word
+ that is identical to an alias being expanded is not expanded a second
+ time. This means that one may alias l\bls\bs to l\bls\bs -\b-F\bF, for 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 command
word following the alias is also checked 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, a shell function should be used (see F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS
+ There is no mechanism for using arguments in the replacement text. If
+ arguments are needed, a shell function should be used (see F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS
below).
- 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
+ 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
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 rules concerning the definition and use of aliases are somewhat
- confusing. B\bBa\bas\bsh\bh always reads at least one complete line of input
- before executing any of the commands on that line. 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
+ The rules concerning the definition and use of aliases are somewhat
+ confusing. B\bBa\bas\bsh\bh always reads at least one complete line of input
+ before executing any of the commands on that line. 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 com-
+ 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-
pound 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 a\bal\bli\bia\bas\bs in com-
+ available 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 com-
pound commands.
For almost every purpose, aliases are superseded by shell functions.
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
+ 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
- interpret them (contrast this with the execution of a shell script).
- When a function is executed, the arguments to the function become the
+ in the context of the current shell; no new process is 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-
+ 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.
- All other aspects of the shell execution environment are identical
+ All other aspects of the shell execution environment are identical
between a function and its caller with these exceptions: the D\bDE\bEB\bBU\bUG\bG and
- R\bRE\bET\bTU\bUR\bRN\bN traps (see the description of the t\btr\bra\bap\bp builtin 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) are not inherited unless the function has been
- given the t\btr\bra\bac\bce\be attribute (see the description of the d\bde\bec\bcl\bla\bar\bre\be builtin
- below) or the -\b-o\bo f\bfu\bun\bnc\bct\btr\bra\bac\bce\be shell option has been enabled with the s\bse\bet\bt
- builtin (in which case all functions inherit the D\bDE\bEB\bBU\bUG\bG and R\bRE\bET\bTU\bUR\bRN\bN
- 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
+ R\bRE\bET\bTU\bUR\bRN\bN traps (see the description of the t\btr\bra\bap\bp builtin 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) are not inherited unless the function has been
+ given the t\btr\bra\bac\bce\be attribute (see the description of the d\bde\bec\bcl\bla\bar\bre\be builtin
+ below) or the -\b-o\bo f\bfu\bun\bnc\bct\btr\bra\bac\bce\be shell option has been enabled with the s\bse\bet\bt
+ builtin (in which case all functions inherit the D\bDE\bEB\bBU\bUG\bG and R\bRE\bET\bTU\bUR\bRN\bN
+ 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 may be declared with the l\blo\boc\bca\bal\bl builtin
command. Ordinarily, variables and their values are shared between the
function and its caller.
- The F\bFU\bUN\bNC\bCN\bNE\bES\bST\bT variable, if set to a numeric value greater than 0,
- defines a maximum function nesting level. Function invocations that
+ The F\bFU\bUN\bNC\bCN\bNE\bES\bST\bT 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 abort.
- 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
+ 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
before execution resumes. When a function completes, the values of the
- positional parameters and the special parameter #\b# are restored to 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
+ 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 subshells 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. Note that shell
+ 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 subshells 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. Note that shell
functions and variables with the same name may result in multiple iden-
- tically-named entries in the environment passed to the shell's chil-
+ tically-named entries in the environment passed to the shell's chil-
dren. Care should be taken in cases where this may cause a problem.
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
+ 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
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 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 following list of operators is grouped
- into levels of equal-precedence operators. The levels are listed in
+ 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 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 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-
_\be_\bx_\bp_\br_\b1 ,\b, _\be_\bx_\bp_\br_\b2
comma
- Shell variables are allowed as operands; parameter expansion is per-
+ Shell variables are allowed as operands; parameter expansion is per-
formed before the expression is evaluated. Within an expression, shell
- variables may also be referenced by name without using the parameter
- expansion syntax. A shell variable that is null or unset evaluates to
+ variables may also be referenced by name without using the parameter
+ expansion syntax. A shell variable that is null or unset evaluates to
0 when referenced by name without using the parameter expansion syntax.
- The value of a variable is evaluated as an arithmetic expression when
- it is referenced, or when a variable which has been given the _\bi_\bn_\bt_\be_\bg_\be_\br
+ 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
- to 0. A shell variable need not have its _\bi_\bn_\bt_\be_\bg_\be_\br attribute turned on
+ to 0. A shell variable need not have its _\bi_\bn_\bt_\be_\bg_\be_\br attribute turned on
to be used in an expression.
Constants with a leading 0 are interpreted as octal numbers. A leading
- 0x or 0X denotes hexadecimal. Otherwise, numbers take the form
- [_\bb_\ba_\bs_\be_\b#]n, where the optional _\bb_\ba_\bs_\be is a decimal number between 2 and 64
- representing the arithmetic base, and _\bn is a number in that base. If
- _\bb_\ba_\bs_\be_\b# is omitted, then base 10 is used. The digits greater than 9 are
- represented by the lowercase letters, the uppercase letters, @, and _,
- in that order. If _\bb_\ba_\bs_\be is less than or equal to 36, lowercase and
- uppercase letters may be used interchangeably to represent numbers
- between 10 and 35.
-
- Operators are evaluated in order of precedence. Sub-expressions in
- parentheses are evaluated first and may override the precedence rules
+ 0x or 0X denotes hexadecimal. Otherwise, numbers take the form
+ [_\bb_\ba_\bs_\be_\b#]n, where the optional _\bb_\ba_\bs_\be is a decimal number between 2 and 64
+ representing the arithmetic base, and _\bn is a number in that base. If
+ _\bb_\ba_\bs_\be_\b# is omitted, then base 10 is used. When specifying _\bn, the digits
+ greater< than 9 are represented by the lowercase letters, the uppercase
+ letters, @, and _, in that order. If _\bb_\ba_\bs_\be is less than or equal to 36,
+ lowercase and uppercase letters may be used interchangeably to repre-
+ sent 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.
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
- t\bte\bes\bst\bt and [\b[ builtin commands to test file attributes and perform string
- and arithmetic comparisons. Expressions are formed from the following
- unary or binary primaries. If any _\bf_\bi_\bl_\be argument to one of the pri-
+ Conditional expressions are used by the [\b[[\b[ compound command and the
+ t\bte\bes\bst\bt and [\b[ builtin commands to test file attributes and perform string
+ and arithmetic comparisons. Expressions are formed from the following
+ unary or binary primaries. 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[, the <\b< and >\b> operators sort lexicographically using
+ When used with [\b[[\b[, the <\b< and >\b> operators sort lexicographically using
the current locale. The t\bte\bes\bst\bt command sorts using ASCII ordering.
-\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
+ True if _\bf_\bi_\bl_\be exists and has been modified since it was last
read.
-\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-
+ 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
+ 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
+ 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
+ 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
builtin below.
-\b-v\bv _\bv_\ba_\br_\bn_\ba_\bm_\be
- True if the shell variable _\bv_\ba_\br_\bn_\ba_\bm_\be is set (has been assigned a
+ True if the shell variable _\bv_\ba_\br_\bn_\ba_\bm_\be is set (has been assigned a
value).
+ -\b-R\bR _\bv_\ba_\br_\bn_\ba_\bm_\be
+ True if the shell variable _\bv_\ba_\br_\bn_\ba_\bm_\be is set and is a name refer-
+ ence.
-\b-z\bz _\bs_\bt_\br_\bi_\bn_\bg
True if the length of _\bs_\bt_\br_\bi_\bn_\bg is zero.
_\bs_\bt_\br_\bi_\bn_\bg
_\bs_\bt_\br_\bi_\bn_\bg_\b1 =\b==\b= _\bs_\bt_\br_\bi_\bn_\bg_\b2
_\bs_\bt_\br_\bi_\bn_\bg_\b1 =\b= _\bs_\bt_\br_\bi_\bn_\bg_\b2
True if the strings are equal. =\b= should be used with the t\bte\bes\bst\bt
- command for POSIX conformance.
+ 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.
The shell has an _\be_\bx_\be_\bc_\bu_\bt_\bi_\bo_\bn _\be_\bn_\bv_\bi_\br_\bo_\bn_\bm_\be_\bn_\bt, which consists of the follow-
ing:
-
+\bo open files inherited by the shell at invocation, as modified by
redirections supplied to the e\bex\bxe\bec\bc builtin
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 file name of the command and passed to that command in its envi-
- ronment.
+ full filename 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
If set to O\bOn\bn, readline attempts to bind the control characters
treated specially by the kernel's terminal driver to their read-
line equivalents.
+ 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
+ variable.
c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn (\b(`\b``\b`#\b#'\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-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-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
+ 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, the user is
- asked whether or not he wishes to view them; otherwise they are
+ asked whether or not he wishes to view them; otherwise they are
simply listed on the terminal.
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 with the eighth
+ If set to O\bOn\bn, 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
+ prefixing an escape character (in effect, using escape as the
_\bm_\be_\bt_\ba _\bp_\br_\be_\bf_\bi_\bx).
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\bed\bdi\bit\bti\bin\bng\bg-\b-m\bmo\bod\bde\be (\b(e\bem\bma\bac\bcs\bs)\b)
Controls whether readline begins with a set of key bindings sim-
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\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\ben\bna\bab\bbl\ble\be-\b-k\bke\bey\byp\bpa\bad\bd (\b(O\bOf\bff\bf)\b)
When set to O\bOn\bn, readline will try to enable the application key-
- pad when it is called. Some systems need this to enable the
+ pad when it is called. Some systems need this to enable the
arrow 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
+ 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.
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
+ If set to O\bOn\bn, tilde expansion is performed when readline
attempts 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(0\b0)\b)
- Set the maximum number of history entries saved in the history
- list. If set to zero, the number of entries in the history list
- is not limited.
+ 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 not limited.
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
+ becomes longer than the screen width rather than wrapping to a
new line.
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
- will not strip the high bit from the characters it reads),
+ If set to O\bOn\bn, readline will enable eight-bit input (that is, it
+ will not strip the high bit from the characters it reads),
regardless 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.
i\bis\bse\bea\bar\brc\bch\bh-\b-t\bte\ber\brm\bmi\bin\bna\bat\bto\bor\brs\bs (\b(`\b``\b`C\bC-\b-[\b[C\bC-\b-J\bJ'\b''\b')\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
+ key sequence using the input read so far, or can take additional
+ input to complete a longer key sequence). If no input is
+ received 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
+ tories have a slash appended (subject to the value of
m\bma\bar\brk\bk-\b-d\bdi\bir\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, causes readline to match files
- whose names begin with a `.' (hidden files) when performing
- filename completion. If set to O\bOf\bff\bf, the leading `.' must be
+ This variable, when set to O\bOn\bn, causes readline to match files
+ whose names begin with a `.' (hidden files) when performing
+ filename completion. If set to O\bOf\bff\bf, the leading `.' must be
supplied by the user 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.
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\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\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
+ 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
instead 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 character to the beginning of the prompt
+ indicating the editing mode: emacs (@), vi command (:) or vi
+ insertion (+).
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\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 extends to the end of the line;
+ $\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 extends to the end of the line;
no characters 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
- instance, 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
+ instance, 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 the both 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.
a\bap\bpp\bpl\bli\bic\bca\bat\bti\bio\bon\bn
The a\bap\bpp\bpl\bli\bic\bca\bat\bti\bio\bon\bn construct is used to include application-
specific settings. Each program using the readline
- library sets the _\ba_\bp_\bp_\bl_\bi_\bc_\ba_\bt_\bi_\bo_\bn _\bn_\ba_\bm_\be, and an initialization
+ library 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
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, any remembered search string is used.
- 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
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.
c\bcl\ble\bea\bar\br-\b-s\bsc\bcr\bre\bee\ben\bn (\b(C\bC-\b-l\bl)\b)
- Clear the screen leaving the current line at the top of the
- screen. With an argument, refresh the current line without
+ Clear the screen leaving the current 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.
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-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
+ 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.
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.
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
+ insert the _\bnth word from the previous command (the words in the
+ previous command begin with word 0). A negative argument
inserts the _\bnth word from the end of the previous command. Once
- the argument _\bn is computed, the argument is extracted as if the
+ 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 argument, as if the "!$" history expansion had
- been specified.
+ 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 as the shell does. This performs alias and his-
tory expansion as well as all of the shell word expansions. 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 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
+ Perform history expansion on the current line. 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.
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.
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. Any
+ Accept the current line for execution and fetch the next line
+ relative to the current line from the history for editing. Any
argument is ignored.
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\bxC\bC-\b-e\be)\b)
- 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,
+ 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\bDI\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
+ ``stty''. If this character is read when there are no charac-
+ ters 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.
d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br (\b(C\bC-\b-d\bd)\b)
- Delete the character at point. If point is at the beginning of
- the line, there are no characters in the line, and the last
- character typed was not bound to d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br, then return E\bEO\bOF\bF.
+ Delete the character at point. If this function is bound to the
+ 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
argument, save the deleted text on the kill ring.
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-
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
+ 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-u\bup\bpp\bpe\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..\b..\b.)\b)
- If the metafied character _\bx is lowercase, run the command that
+ If the metafied character _\bx is lowercase, run the command that
is bound to the corresponding uppercase character.
p\bpr\bre\bef\bfi\bix\bx-\b-m\bme\bet\bta\ba (\b(E\bES\bSC\bC)\b)
Metafy the next character typed. E\bES\bSC\bC f\bf is equivalent to M\bMe\bet\bta\ba-\b-f\bf.
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 count searches for previous occur-
+ that character. A negative count searches for previous occur-
rences.
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 count searches for subse-
+ A character is read and point is moved to the previous occur-
+ rence of that character. A negative count searches for subse-
quent 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
+ 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
removed, the line will be executed by the shell.
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
- expansion, with an asterisk implicitly appended. This pattern
- is used to generate a list of matching file names for possible
+ The word before point is treated as a pattern for pathname
+ expansion, with an asterisk implicitly appended. This pattern
+ is used to generate a list of matching filenames for possible
completions.
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
- expansion, and the list of matching file names is inserted,
- replacing the word. If a numeric argument is supplied, an
+ The word before point is treated as a pattern for pathname
+ expansion, and the list of matching filenames is inserted,
+ replacing 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.
+ 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 pro-
+ 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 pro-
grammable 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
+ 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
+ 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.
- 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
+ Any completions specified by a pathname expansion pattern to the -\b-G\bG
option 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
+ 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 is the name of the command whose arguments are being
- completed, the second argument is the word being completed, and the
- third argument is the word preceding the word being completed on the
- current command line. No filtering of the generated completions
- 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.
-
- 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
+ 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
+ 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 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.
+
+ 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.
+ 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.
added to each member of the completion list, and the result is returned
to the readline completion code 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
+ 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
defined, 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
+ 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-
+ 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,
+ 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
+ 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
+ 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 function would load completions dynamically:
_completion_loader()
{
. "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124
}
- complete -D -F _completion_loader
+ complete -D -F _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. When the his-
- tory file is read, lines beginning with the history comment character
- followed immediately by a digit are interpreted as timestamps for the
- preceding history line. These timestamps are optionally displayed
- depending on the value of the H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT variable. When an inter-
- active shell exits, the last $\b$H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE lines are copied from the his-
- tory 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 over-
- written. If H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is unset, 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 sessions. This uses
- the history comment character to distinguish timestamps from other his-
- tory 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\bTF\bFI\bIL\bLE\bES\bSI\bIZ\bZE\bE is not set,
- no truncation is performed.
+ 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 pre-
+ ceding 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 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-
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 postition
+ 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.
^\b^_\bs_\bt_\br_\bi_\bn_\bg_\b1^\b^_\bs_\bt_\br_\bi_\bn_\bg_\b2^\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 argument.
+ $\b$ 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.
%\b% The word matched by the most recent `?_\bs_\bt_\br_\bi_\bn_\bg?' search.
_\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$'.
After the optional word designator, there may appear a sequence of one
or more of the following modifiers, each preceded by a `:'.
- h\bh Remove a trailing file name component, leaving only the head.
- t\bt Remove all leading file name components, leaving the tail.
+ h\bh Remove a trailing filename component, leaving only the head.
+ t\bt Remove all leading filename components, leaving the tail.
r\br Remove a trailing suffix of the form _\b._\bx_\bx_\bx, leaving the basename.
e\be Remove all but the trailing suffix.
p\bp Print the new command but do not execute it.
s\bso\bou\bur\brc\bce\be _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
Read and execute commands from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be in the current shell
environment and return the exit status of the last command exe-
- cuted from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be. If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be does not contain a slash, file
- names in P\bPA\bAT\bTH\bH are used to find the directory containing _\bf_\bi_\bl_\be_\b-
- _\bn_\ba_\bm_\be. The file searched for in P\bPA\bAT\bTH\bH need not be executable.
+ cuted from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be. If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be does not contain a slash,
+ filenames in P\bPA\bAT\bTH\bH are used to find the directory containing
+ _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be. The file searched for in P\bPA\bAT\bTH\bH need not be executable.
When b\bba\bas\bsh\bh is not in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, the current directory is
searched if no file is found in P\bPA\bAT\bTH\bH. 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, the P\bPA\bAT\bTH\bH is not
enabled, any specified _\bj_\bo_\bb_\bs_\bp_\be_\bc was not found or was started
without job control.
- b\bbi\bin\bnd\bd [-\b-m\bm _\bk_\be_\by_\bm_\ba_\bp] [-\b-l\blp\bps\bsv\bvP\bPS\bSV\bV]
+ b\bbi\bin\bnd\bd [-\b-m\bm _\bk_\be_\by_\bm_\ba_\bp] [-\b-l\blp\bps\bsv\bvP\bPS\bSV\bVX\bX]
b\bbi\bin\bnd\bd [-\b-m\bm _\bk_\be_\by_\bm_\ba_\bp] [-\b-q\bq _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn] [-\b-u\bu _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn] [-\b-r\br _\bk_\be_\by_\bs_\be_\bq]
b\bbi\bin\bnd\bd [-\b-m\bm _\bk_\be_\by_\bm_\ba_\bp] -\b-f\bf _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
b\bbi\bin\bnd\bd [-\b-m\bm _\bk_\be_\by_\bm_\ba_\bp] -\b-x\bx _\bk_\be_\by_\bs_\be_\bq:_\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd
command changes the value of R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_L\bLI\bIN\bNE\bE or R\bRE\bEA\bAD\bD-\b-
L\bLI\bIN\bNE\bE_\b_P\bPO\bOI\bIN\bNT\bT, 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
+ input.
The return value is 0 unless an unrecognized option is given or
an error occurred.
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. The variable H\bHO\bOM\bME\bE is the
- default _\bd_\bi_\br. The variable C\bCD\bDP\bPA\bAT\bTH\bH defines the search path for
- the directory containing _\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., ``.\b.''. If
- _\bd_\bi_\br begins with a slash (/), then C\bCD\bDP\bPA\bAT\bTH\bH is not used. The -\b-P\bP
- option says to use the physical directory structure instead of
- following symbolic links (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 fol-
- lowed. If the -\b-e\be option is supplied with -\b-P\bP, and the current
- working directory cannot be successfully determined after a suc-
- cessful directory change, c\bcd\bd will return an unsuccessful status.
- An argument of -\b- is equivalent to $\b$O\bOL\bLD\bDP\bPW\bWD\bD. If a non-empty
- directory name from C\bCD\bDP\bPA\bAT\bTH\bH is used, or if -\b- is the first argu-
- ment, and the directory change is successful, the absolute path-
- name of the new working directory is written to the standard
- output. The return value is true if the directory was success-
- fully changed; false otherwise.
+ 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. Any addi-
+ tional arguments following _\bd_\bi_\br are ignored. The variable C\bCD\bDP\bPA\bAT\bTH\bH
+ defines the search path for the directory containing _\bd_\bi_\br: each
+ directory name in C\bCD\bDP\bPA\bAT\bTH\bH is searched 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., ``.\b.''. 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.
+ 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
+ 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
option 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 file name
+ 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
+ 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-
+ 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.
c\bco\bom\bmp\bpg\bge\ben\bn [_\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
- builtin with the exception of -\b-p\bp and -\b-r\br, and write the matches
- to the standard output. When using the -\b-F\bF or -\b-C\bC options, the
- various shell variables set by the programmable completion
+ 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 exception of -\b-p\bp and -\b-r\br, and write the matches
+ 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 pro-
- grammable completion code had generated them directly from a
+ The matches will be generated in the same way as if the pro-
+ grammable completion code had generated them directly from a
completion specification with the same flags. If _\bw_\bo_\br_\bd is speci-
fied, only those completions matching _\bw_\bo_\br_\bd will be displayed.
- The return value is true unless an invalid option is supplied,
+ The return value is true unless an invalid option is supplied,
or no matches were generated.
- c\bco\bom\bmp\bpl\ble\bet\bte\be [-\b-a\bab\bbc\bcd\bde\bef\bfg\bgj\bjk\bks\bsu\buv\bv] [-\b-o\bo _\bc_\bo_\bm_\bp_\b-_\bo_\bp_\bt_\bi_\bo_\bn] [-\b-D\bDE\bE] [-\b-A\bA _\ba_\bc_\bt_\bi_\bo_\bn] [-\b-G\bG _\bg_\bl_\bo_\bb_\b-
+ c\bco\bom\bmp\bpl\ble\bet\bte\be [-\b-a\bab\bbc\bcd\bde\bef\bfg\bgj\bjk\bks\bsu\buv\bv] [-\b-o\bo _\bc_\bo_\bm_\bp_\b-_\bo_\bp_\bt_\bi_\bo_\bn] [-\b-D\bDE\bE] [-\b-A\bA _\ba_\bc_\bt_\bi_\bo_\bn] [-\b-G\bG _\bg_\bl_\bo_\bb_\b-
_\bp_\ba_\bt] [-\b-W\bW _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt] [-\b-F\bF _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn] [-\b-C\bC _\bc_\bo_\bm_\bm_\ba_\bn_\bd]
[-\b-X\bX _\bf_\bi_\bl_\bt_\be_\br_\bp_\ba_\bt] [-\b-P\bP _\bp_\br_\be_\bf_\bi_\bx] [-\b-S\bS _\bs_\bu_\bf_\bf_\bi_\bx] _\bn_\ba_\bm_\be [_\bn_\ba_\bm_\be _\b._\b._\b.]
c\bco\bom\bmp\bpl\ble\bet\bte\be -\b-p\bpr\br [-\b-D\bDE\bE] [_\bn_\ba_\bm_\be ...]
- Specify how arguments to each _\bn_\ba_\bm_\be should be completed. If the
- -\b-p\bp option is supplied, or if no options are supplied, existing
- completion specifications are printed in a way that allows them
+ Specify how arguments to each _\bn_\ba_\bm_\be should be completed. If the
+ -\b-p\bp option is supplied, or if no options are supplied, existing
+ completion specifications are printed in a way that allows them
to be reused as input. The -\b-r\br option removes a completion spec-
- ification for each _\bn_\ba_\bm_\be, or, if no _\bn_\ba_\bm_\bes are supplied, all com-
+ ification for each _\bn_\ba_\bm_\be, or, if no _\bn_\ba_\bm_\bes are supplied, all com-
pletion specifications. The -\b-D\bD option indicates that the
- remaining options and actions should apply to the ``default''
- command completion; that is, completion attempted on a command
- for which no completion has previously been defined. The -\b-E\bE
- option indicates that the remaining options and actions should
- apply to ``empty'' command completion; that is, completion
+ remaining options and actions should apply to the ``default''
+ command completion; that is, completion attempted on a command
+ for which no completion has previously been defined. The -\b-E\bE
+ option indicates that the remaining options and actions should
+ apply to ``empty'' command completion; that is, completion
attempted on a blank line.
- The process of applying these completion specifications when
- word completion is attempted is described above under P\bPr\bro\bo-\b-
+ The process of applying these completion specifications when
+ word completion is attempted is described above under 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.
- Other options, if specified, have the following meanings. The
- arguments to the -\b-G\bG, -\b-W\bW, and -\b-X\bX options (and, if necessary, the
- -\b-P\bP and -\b-S\bS options) should be quoted to protect them from expan-
+ Other options, if specified, have the following meanings. The
+ arguments to the -\b-G\bG, -\b-W\bW, and -\b-X\bX options (and, if necessary, the
+ -\b-P\bP and -\b-S\bS options) should be quoted to protect them from expan-
sion before the c\bco\bom\bmp\bpl\ble\bet\bte\be builtin is invoked.
-\b-o\bo _\bc_\bo_\bm_\bp_\b-_\bo_\bp_\bt_\bi_\bo_\bn
- The _\bc_\bo_\bm_\bp_\b-_\bo_\bp_\bt_\bi_\bo_\bn controls several aspects of the comp-
- spec's behavior beyond the simple generation of comple-
+ The _\bc_\bo_\bm_\bp_\b-_\bo_\bp_\bt_\bi_\bo_\bn controls several aspects of the comp-
+ spec's behavior beyond the simple generation of comple-
tions. _\bc_\bo_\bm_\bp_\b-_\bo_\bp_\bt_\bi_\bo_\bn may be one of:
b\bba\bas\bsh\bhd\bde\bef\bfa\bau\bul\blt\bt
Perform the rest of the default b\bba\bas\bsh\bh completions
if the compspec generates no matches.
- d\bde\bef\bfa\bau\bul\blt\bt Use readline's default filename completion if
+ d\bde\bef\bfa\bau\bul\blt\bt Use readline's default filename completion if
the compspec generates no matches.
d\bdi\bir\brn\bna\bam\bme\bes\bs
- Perform directory name completion if the comp-
+ Perform directory name completion if the comp-
spec generates no matches.
f\bfi\bil\ble\ben\bna\bam\bme\bes\bs
- Tell readline that the compspec generates file-
- names, so it can perform any filename-specific
- processing (like adding a slash to directory
- names, quoting special characters, or suppress-
- ing trailing spaces). Intended to be used with
+ Tell readline that the compspec generates file-
+ names, so it can perform any filename-specific
+ processing (like adding a slash to directory
+ names, quoting special characters, or suppress-
+ ing trailing spaces). Intended to be used with
shell functions.
- n\bno\bos\bsp\bpa\bac\bce\be Tell readline not to append a space (the
- default) to words completed at the end of the
+ n\bno\boq\bqu\buo\bot\bte\be Tell readline not to quote the completed words
+ if they are filenames (quoting filenames is the
+ default).
+ n\bno\bos\bsp\bpa\bac\bce\be Tell readline not to append a space (the
+ default) to words completed at the end of the
line.
p\bpl\blu\bus\bsd\bdi\bir\brs\bs
- After any matches defined by the compspec are
- generated, directory name completion is
- attempted and any matches are added to the
+ 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.
-\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
+ The _\ba_\bc_\bt_\bi_\bo_\bn may be one of the following to generate a
list of possible completions:
a\bal\bli\bia\bas\bs Alias names. May also be specified as -\b-a\ba.
a\bar\brr\bra\bay\byv\bva\bar\br
Array variable names.
b\bbi\bin\bnd\bdi\bin\bng\bg R\bRe\bea\bad\bdl\bli\bin\bne\be key binding names.
- b\bbu\bui\bil\blt\bti\bin\bn Names of shell builtin commands. May also be
+ b\bbu\bui\bil\blt\bti\bin\bn Names of shell builtin commands. May also be
specified as -\b-b\bb.
c\bco\bom\bmm\bma\ban\bnd\bd Command names. May also be specified as -\b-c\bc.
d\bdi\bir\bre\bec\bct\bto\bor\bry\by
d\bdi\bis\bsa\bab\bbl\ble\bed\bd
Names of disabled shell builtins.
e\ben\bna\bab\bbl\ble\bed\bd Names of enabled shell builtins.
- e\bex\bxp\bpo\bor\brt\bt Names of exported shell variables. May also be
+ e\bex\bxp\bpo\bor\brt\bt Names of exported shell variables. May also be
specified as -\b-e\be.
f\bfi\bil\ble\be File names. May also be specified as -\b-f\bf.
f\bfu\bun\bnc\bct\bti\bio\bon\bn
h\bhe\bel\blp\bpt\bto\bop\bpi\bic\bc
Help topics as accepted by the h\bhe\bel\blp\bp builtin.
h\bho\bos\bst\btn\bna\bam\bme\be
- Hostnames, as taken from the file specified by
+ Hostnames, as taken from the file specified by
the H\bHO\bOS\bST\bTF\bFI\bIL\bLE\bE shell variable.
- j\bjo\bob\bb Job names, if job control is active. May also
+ j\bjo\bob\bb Job names, if job control is active. May also
be specified as -\b-j\bj.
- k\bke\bey\byw\bwo\bor\brd\bd Shell reserved words. May also be specified as
+ k\bke\bey\byw\bwo\bor\brd\bd Shell reserved words. May also be specified as
-\b-k\bk.
r\bru\bun\bnn\bni\bin\bng\bg Names of running jobs, if job control is active.
s\bse\ber\brv\bvi\bic\bce\be Service names. May also be specified as -\b-s\bs.
- s\bse\bet\bto\bop\bpt\bt Valid arguments for the -\b-o\bo option to the s\bse\bet\bt
+ s\bse\bet\bto\bop\bpt\bt Valid arguments for the -\b-o\bo option to the s\bse\bet\bt
builtin.
- s\bsh\bho\bop\bpt\bt Shell option names as accepted by the s\bsh\bho\bop\bpt\bt
+ s\bsh\bho\bop\bpt\bt Shell option names as accepted by the s\bsh\bho\bop\bpt\bt
builtin.
s\bsi\big\bgn\bna\bal\bl Signal names.
s\bst\bto\bop\bpp\bpe\bed\bd Names of stopped jobs, if job control is active.
Names of all shell variables. May also be spec-
ified as -\b-v\bv.
-\b-C\bC _\bc_\bo_\bm_\bm_\ba_\bn_\bd
- _\bc_\bo_\bm_\bm_\ba_\bn_\bd is executed in a subshell environment, and its
+ _\bc_\bo_\bm_\bm_\ba_\bn_\bd is executed in a subshell environment, and its
output is used as the possible completions.
-\b-F\bF _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn
- The shell function _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn is executed in the current
- shell environment. 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.
+ The shell function _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn is executed in the current
+ shell environment. When the function is executed, the
+ first argument ($\b$1\b1) is the name of the command whose
+ arguments 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
+ current command line. When it 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.
loop) is resumed. 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\bil\blr\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\bil\blr\brt\btu\bux\bx] [-\b-p\bp] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ...]
+ d\bde\bec\bcl\bla\bar\bre\be [-\b-a\baA\bAf\bfF\bFg\bgi\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\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 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 attributes and values of all shell
- variables. The -\b-f\bf option will restrict the display to shell
- functions. The -\b-F\bF option inhibits the display of function defi-
- nitions; 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 the function is defined are dis-
- played 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 in
- all other cases. The following options can be used to restrict
- output to variables with the specified attribute or to give
- variables attributes:
+ 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
+ attributes and values of all shell variables. The -\b-f\bf option
+ will restrict 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 the function 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 in all other cases. The
+ following options can be used to restrict output to variables
+ with the specified attribute 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
above).
-\b-A\bA Each _\bn_\ba_\bm_\be is an associative array variable (see A\bAr\brr\bra\bay\bys\bs
-\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 and assign-
+ ments to _\bn_\ba_\bm_\be, except for changing the -\b-n\bn attribute
+ itself, are performed on the variable referenced by
+ _\bn_\ba_\bm_\be's value. The -\b-n\bn 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
Using `+' instead of `-' turns off the attribute instead, with
the exceptions that +\b+a\ba may not be used to destroy an array vari-
able and +\b+r\br will not remove the readonly attribute. When used
- in a function, makes each _\bn_\ba_\bm_\be local, as with the l\blo\boc\bca\bal\bl command,
- unless the -\b-g\bgP\bP o\bop\bpt\bti\bio\bon\bn i\bis\bs s\bsu\bup\bpp\bpl\bli\bie\bed\bd,\b, I\bIf\bf a\ba v\bva\bar\bri\bia\bab\bbl\ble\be n\bna\bam\bme\be i\bis\bs f\bfo\bol\bl-\b-
- l\blo\bow\bwe\bed\bd b\bby\by =\b=_\bv_\ba_\bl_\bu_\be,\b, t\bth\bhe\be v\bva\bal\blu\bue\be o\bof\bf t\bth\bhe\be v\bva\bar\bri\bia\bab\bbl\ble\be i\bis\bs s\bse\bet\bt t\bto\bo _\bv_\ba_\bl_\bu_\be.\b. T\bTh\bhe\be
- r\bre\bet\btu\bur\brn\bn v\bva\bal\blu\bue\be i\bis\bs 0\b0 u\bun\bnl\ble\bes\bss\bs a\ban\bn i\bin\bnv\bva\bal\bli\bid\bd o\bop\bpt\bti\bio\bon\bn i\bis\bs e\ben\bnc\bco\bou\bun\bnt\bte\ber\bre\bed\bd,\b, a\ban\bn
- a\bat\btt\bte\bem\bmp\bpt\bt i\bis\bs m\bma\bad\bde\be t\bto\bo d\bde\bef\bfi\bin\bne\be a\ba f\bfu\bun\bnc\bct\bti\bio\bon\bn u\bus\bsi\bin\bng\bg `\b``\b`-\b-f\bf f\bfo\boo\bo=\b=b\bba\bar\br'\b''\b',\b, a\ban\bn
- a\bat\btt\bte\bem\bmp\bpt\bt i\bis\bs m\bma\bad\bde\be t\bto\bo a\bas\bss\bsi\big\bgn\bn a\ba v\bva\bal\blu\bue\be t\bto\bo a\ba r\bre\bea\bad\bdo\bon\bnl\bly\by v\bva\bar\bri\bia\bab\bbl\ble\be,\b, a\ban\bn
- a\bat\btt\bte\bem\bmp\bpt\bt i\bis\bs m\bma\bad\bde\be t\bto\bo a\bas\bss\bsi\big\bgn\bn a\ba v\bva\bal\blu\bue\be t\bto\bo a\ban\bn a\bar\brr\bra\bay\by v\bva\bar\bri\bia\bab\bbl\ble\be w\bwi\bit\bth\bho\bou\but\bt
- u\bus\bsi\bin\bng\bg t\bth\bhe\be c\bco\bom\bmp\bpo\bou\bun\bnd\bd a\bas\bss\bsi\big\bgn\bnm\bme\ben\bnt\bt s\bsy\byn\bnt\bta\bax\bx (\b(s\bse\bee\be 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+_\bn]\b] [\b[-\b-_\bn]\b] [\b[-\b-c\bcl\blp\bpv\bv]\b]
- Without options, displays 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 p\bpu\bus\bsh\bhd\bd command; the p\bpo\bop\bpd\bd command removes
+ 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 ``-f foo=bar'', 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 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.
+
+ 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
+ directories. 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.
- +\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
- list shown by d\bdi\bir\brs\bs when invoked without options, starting
- with zero.
-\b-c\bc Clears the directory stack by deleting all of the
entries.
- -\b-l\bl Produces a longer listing; the default listing format
- uses a tilde to denote the home directory.
+ -\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-
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
+ 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
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 ...]
- Without options, each _\bj_\bo_\bb_\bs_\bp_\be_\bc is removed from the table of
- active jobs. If _\bj_\bo_\bb_\bs_\bp_\be_\bc is not present, and neither -\b-a\ba nor -\b-r\br
- is supplied, the shell's notion of 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 ta-
- ble, 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 _\bj_\bo_\bb_\bs_\bp_\be_\bc is 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 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 argument restricts
- operation to running jobs. The return value is 0 unless a _\bj_\bo_\bb_\b-
- _\bs_\bp_\be_\bc does not specify a valid job.
+ 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
+ receives 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_\b-
+ _\bs_\bp_\be_\bc argument 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.
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 always 0. If -\b-n\bn is specified, the trailing
- newline is suppressed. If the -\b-e\be option is given, interpreta-
- tion of the following backslash-escaped characters is enabled.
- The -\b-E\bE option disables the interpretation of these escape char-
- acters, 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 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:
+ 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 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:
\\b\a\ba alert (bell)
\\b\b\bb backspace
\\b\c\bc suppress further output
\\b\t\bt horizontal tab
\\b\v\bv vertical tab
\\b\\\b\ backslash
- \\b\0\b0_\bn_\bn_\bn the eight-bit character whose value is the octal value
+ \\b\0\b0_\bn_\bn_\bn the eight-bit character whose value is the octal value
_\bn_\bn_\bn (zero 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)
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
+ 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
+ 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
enabled. 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
+ 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.
- The -\b-d\bd option will delete a builtin previously loaded with -\b-f\bf.
+ 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. The return
- value is 0 unless a _\bn_\ba_\bm_\be is not a shell builtin or there is an
+ 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. 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
+ 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.
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
+ 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
+ ning of the zeroth 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 environment. If -\b-a\ba is supplied, the shell passes _\bn_\ba_\bm_\be
+ 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 shell option e\bex\bxe\bec\bcf\bfa\bai\bil\bl is enabled, in which case it
- returns failure. An interactive shell returns failure if the
+ 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. If _\bc_\bo_\bm_\bm_\ba_\bn_\bd is not specified, any redi-
rections take effect in the current shell, and the return status
- is 0. If there is a redirection error, the return status is 1.
+ is 0. If there is a redirection 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,
+ 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.
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-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 all names that are
- exported in this shell 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 supplied with a _\bn_\ba_\bm_\be that is not a func-
- tion.
+ 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\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]
- Fix Command. In the first form, a range of commands from _\bf_\bi_\br_\bs_\bt
- to _\bl_\ba_\bs_\bt is selected from the history list. _\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 cur-
- rent command number). 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 spec-
- ified it is set to the previous command for editing and -16 for
- listing.
+ 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). 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 other-
+ wise. If _\bf_\bi_\br_\bs_\bt is not specified it is set to the previous com-
+ mand 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
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. 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 com-
- mand.
+ of _\bp_\ba_\bt is replaced by _\br_\be_\bp. _\bC_\bo_\bm_\bm_\ba_\bn_\bd is intepreted 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
invalid option is encountered or _\bf_\bi_\br_\bs_\bt or _\bl_\ba_\bs_\bt specify history
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
+ 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-
played, even if the first character of _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg is not a colon.
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, no path search is performed, and _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
- is used as the full file name of the command. The -\b-r\br option
+ is used as the full filename of the command. The -\b-r\br option
causes the shell to forget all remembered locations. 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
-\b-m\bm Display the description of each _\bp_\ba_\bt_\bt_\be_\br_\bn in a manpage-like
format
-\b-s\bs Display only a short usage synopsis for each _\bp_\ba_\bt_\bt_\be_\br_\bn
- The return status is 0 unless no command matches _\bp_\ba_\bt_\bt_\be_\br_\bn.
+
+ The return status is 0 unless no command matches _\bp_\ba_\bt_\bt_\be_\br_\bn.
h\bhi\bis\bst\bto\bor\bry\by [\b[_\bn]\b]
h\bhi\bis\bst\bto\bor\bry\by -\b-c\bc
file into the current history list. These are lines
appended 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 use them as the
- current history.
- -\b-w\bw Write the current history to the history file, overwrit-
- ing the history file's contents.
+ -\b-r\br Read the contents of the history file and append them to
+ the current 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
status since the user was last notified of their status.
-\b-p\bp List only the process ID of the job's process group
leader.
- -\b-r\br Restrict output to running jobs.
- -\b-s\bs Restrict output to stopped jobs.
+ -\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
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.
+ -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 p\bpr\bri\bin\bnt\btf\bf
+ behavior.
- Arguments to non-string format specifiers are treated as C con-
+ Arguments to non-string format specifiers are treated as C con-
stants, except that a leading plus or minus sign is allowed, and
- if the leading character is a single or double quote, the value
+ if the leading character is a single or double quote, the value
is the ASCII value of the following character.
- The _\bf_\bo_\br_\bm_\ba_\bt is reused as necessary to consume all of the _\ba_\br_\bg_\bu_\b-
+ The _\bf_\bo_\br_\bm_\ba_\bt is reused as necessary to consume all of the _\ba_\br_\bg_\bu_\b-
_\bm_\be_\bn_\bt_\bs. If the _\bf_\bo_\br_\bm_\ba_\bt requires more _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs than are supplied,
- the extra format specifications behave as if a zero value or
- null string, as appropriate, had been supplied. The return
+ the extra format specifications behave as if a zero value or
+ null string, as appropriate, had been supplied. The return
value is zero on success, non-zero on failure.
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
+ 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, exchanges the top two directories
- and returns 0, unless the directory stack is empty. Arguments,
+ and returns 0, unless the directory stack is empty. Arguments,
if supplied, have the following meanings:
- -\b-n\bn Suppresses the normal change of directory when adding
- directories to the stack, so that only the stack is
+ -\b-n\bn Suppresses the normal change of directory when 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
+ +\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-_\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
+ -\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, making it the
- new current working directory.
+ new current working directory as if it had been supplied
+ as the argument to the c\bcd\bd builtin.
If the p\bpu\bus\bsh\bhd\bd command is successful, a d\bdi\bir\brs\bs is performed as well.
If the first form is used, p\bpu\bus\bsh\bhd\bd returns 0 unless the cd to _\bd_\bi_\br
ing separators 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 values. The characters in I\bIF\bFS\bS are used to
- split the line into words. The backslash character (\\b\) may be
- used to remove any special meaning for the next character read
- and for line continuation. Options, if supplied, have the fol-
- lowing meanings:
+ 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\) may be used to remove any special meaning
+ for the next character read and 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
ignored.
-\b-d\bd _\bd_\be_\bl_\bi_\bm
- The first character of _\bd_\be_\bl_\bi_\bm is used to terminate the
+ The first character of _\bd_\be_\bl_\bi_\bm is used to terminate the
input line, rather than newline.
-\b-e\be If the standard input is coming from a terminal, r\bre\bea\bad\bdl\bli\bin\bne\be
- (see R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE above) is used to obtain the line. Read-
- line uses the current (or default, if line editing was
+ (see R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE above) is used to obtain the line. Read-
+ line uses the current (or default, if line editing was
not previously active) editing settings.
-\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
+ 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.
-\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 honor a delim-
- iter if fewer than _\bn_\bc_\bh_\ba_\br_\bs characters are read before the
+ 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 honor a delim-
+ iter if fewer than _\bn_\bc_\bh_\ba_\br_\bs characters are read 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
+ 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.
-\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.
-\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 be used as a line
+ slash is considered to be part of the line. In particu-
+ lar, a backslash-newline pair may not 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 is not read within _\bt_\bi_\bm_\be_\bo_\bu_\bt seconds. _\bt_\bi_\bm_\be_\b-
- _\bo_\bu_\bt may be a decimal number with a fractional portion
- following the decimal point. This option is only effec-
- tive 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 _\bt_\bi_\bm_\be_\bo_\bu_\bt is 0, r\bre\bea\bad\bd returns success if
- input is available on the specified file descriptor,
- failure otherwise. The exit status is greater than 128
- if the timeout is exceeded.
+ 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
+ returns immediately, without trying to read any data.
+ The exit status is 0 if input is available on the speci-
+ fied file descriptor, non-zero otherwise. The exit sta-
+ tus is greater than 128 if the timeout is exceeded.
-\b-u\bu _\bf_\bd Read input from file descriptor _\bf_\bd.
If no _\bn_\ba_\bm_\be_\bs are supplied, the line read is assigned to the vari-
able R\bRE\bEP\bPL\bLY\bY. The return code is zero, unless end-of-file is
encountered, r\bre\bea\bad\bd times out (in which case the return code is
- greater than 128), 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\bAp\bpf\bf] [_\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
- arrays; the -\b-A\bA option restricts the variables to associative
- arrays. 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 -\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.
+ greater than 128), a variable assignment error (such as assign-
+ ing to a readonly variable) occurs, or an invalid file descrip-
+ tor 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
+ arrays; the -\b-A\bA option restricts the variables to associative
+ arrays. 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.
r\bre\bet\btu\bur\brn\bn [_\bn]
- Causes a function to exit with the return value specified by _\bn.
- If _\bn is omitted, the return status is that of the last command
- executed in the function body. If 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 used outside a
- function and not during execution of a script by .\b., the return
- status is false. Any command associated with the R\bRE\bET\bTU\bUR\bRN\bN trap is
- executed before execution resumes after the function or script.
+ 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\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
+ significant 8 bits. The return status is non-zero if r\bre\bet\btu\bur\brn\bn is
+ supplied 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 com-
+ mand associated with the R\bRE\bET\bTU\bUR\bRN\bN trap is executed before execu-
+ tion resumes after the function or script.
s\bse\bet\bt [-\b--\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] [_\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] [_\ba_\br_\bg ...]
- Without options, the name and value of each shell variable are
+ Without options, the name and value of each shell variable are
displayed in a format that can be reused as input for setting or
resetting the currently-set variables. Read-only variables can-
- not 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
- arguments remaining after option processing are treated as val-
+ not be reset. In _\bp_\bo_\bs_\bi_\bx mode, 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
+ arguments remaining after option processing are treated as val-
ues for the positional parameters and are assigned, in order, to
- $\b$1\b1, $\b$2\b2, .\b..\b..\b. $\b$_\bn. Options, if specified, have the following
+ $\b$1\b1, $\b$2\b2, .\b..\b..\b. $\b$_\bn. Options, if specified, have the following
meanings:
- -\b-a\ba Automatically mark variables and functions which are
- modified or created for export to the environment of
+ -\b-a\ba Automatically mark variables and functions which are
+ modified or created for export to the environment of
subsequent commands.
- -\b-b\bb Report the status of terminated background jobs immedi-
+ -\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-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 _\bs_\bu_\bb_\bs_\bh_\be_\bl_\bl command enclosed in
- parentheses, or one of the commands executed as part of
- a command list enclosed by braces (see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR
- above) exits with a non-zero status. The shell does not
- exit if the command that fails is part of the command
- list immediately following a w\bwh\bhi\bil\ble\be or u\bun\bnt\bti\bil\bl keyword,
- part of the test following the i\bif\bf or e\bel\bli\bif\bf reserved
- words, part of any 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 with !\b!. A trap on E\bER\bRR\bR,
+ -\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 sta-
+ tus. The shell does not exit if the command that fails
+ 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 following the
+ i\bif\bf or e\bel\bli\bif\bf reserved words, part of any 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 with
+ !\b!. If a compound command other than a subshell returns
+ a non-zero status because a command failed while -\b-e\be was
+ being ignored, the shell does not exit. A trap on E\bER\bRR\bR,
if set, is executed before the shell exits. This option
applies to the shell environment and each subshell envi-
ronment separately (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\bNM\bME\bEN\bNT\bT
above), and may cause subshells to exit before executing
all the commands in the subshell.
+
+ If a compound command or shell function executes in a
+ context where -\b-e\be is being ignored, none of the commands
+ executed within the compound command or function body
+ will be affected by the -\b-e\be setting, even if -\b-e\be is set
+ and a command returns a failure status. If a compound
+ command or shell function sets -\b-e\be while executing in a
+ context where -\b-e\be is ignored, that setting will not have
+ any effect until the compound command or the command
+ containing the function call completes.
-\b-f\bf Disable pathname expansion.
-\b-h\bh Remember the location of commands as they are looked up
for execution. This is enabled by default.
that precede the command name.
-\b-m\bm Monitor mode. Job control is enabled. This option is
on by default for interactive shells on systems that
- support it (see J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL above). Background pro-
- cesses run in a separate process group and a line con-
- taining their exit status is printed upon their comple-
- tion.
+ support it (see J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL above). All processes run
+ in a separate process group. When a background job com-
+ pletes, the shell prints a line containing its exit sta-
+ tus.
-\b-n\bn Read commands but do not execute them. This may be used
to check a shell script for syntax errors. This is
ignored by interactive shells.
is disabled by default.
p\bpo\bos\bsi\bix\bx Change the behavior of b\bba\bas\bsh\bh where the default
operation differs from the POSIX standard to
- match the standard (_\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be).
+ match the standard (_\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be). See S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ below for a reference to a document that details
+ how posix mode affects bash's behavior.
p\bpr\bri\biv\bvi\bil\ble\beg\bge\bed\bd
Same as -\b-p\bp.
v\bve\ber\brb\bbo\bos\bse\be Same as -\b-v\bv.
ited in such cases.
-\b-H\bH Enable !\b! style history substitution. This option is on
by default when the shell is interactive.
- -\b-P\bP If set, the shell does not follow symbolic links when
+ -\b-P\bP If set, the shell does not resolve symbolic links when
executing commands such as c\bcd\bd that change the current
working directory. It uses the physical directory
structure instead. By default, b\bba\bas\bsh\bh follows the logical
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 variables controlling optional shell behav-
- ior. With no options, or with the -\b-p\bp option, a list of all set-
- table options is displayed, with an indication of whether or not
- each is set. The -\b-p\bp option causes output to be displayed in a
- form that may be reused as input. Other options have the fol-
- lowing meanings:
+ 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. The -\b-p\bp option causes output to be
+ displayed 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-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 either -\b-s\bs or -\b-u\bu is used with no _\bo_\bp_\bt_\bn_\ba_\bm_\be arguments, the dis-
- play is limited to those options which are set or unset, respec-
- tively. Unless otherwise noted, the s\bsh\bho\bop\bpt\bt options are disabled
- (unset) by default.
+ If either -\b-s\bs or -\b-u\bu is used with no _\bo_\bp_\bt_\bn_\ba_\bm_\be arguments, s\bsh\bho\bop\bpt\bt
+ shows only those options which are set or unset, respectively.
+ Unless otherwise noted, the s\bsh\bho\bop\bpt\bt options are disabled (unset)
+ by default.
The return status when listing options is zero if all _\bo_\bp_\bt_\bn_\ba_\bm_\be_\bs
are enabled, non-zero otherwise. When setting or unsetting
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 file name is printed, and the com-
+ found, the corrected filename is printed, and the com-
mand proceeds. This option is only used by interactive
shells.
c\bch\bhe\bec\bck\bkh\bha\bas\bsh\bh
c\bco\bom\bmp\bpa\bat\bt3\b31\b1
If set, b\bba\bas\bsh\bh changes its behavior to that of version 3.1
with respect to quoted arguments to the [\b[[\b[ conditional
- command's =\b=~\b~ operator.
+ command's =\b=~\b~ operator and locale-specific string compar-
+ ison when using the [\b[[\b[ conditional command's <\b< and >\b>
+ operators. Bash versions prior to bash-4.1 use ASCII
+ collation and _\bs_\bt_\br_\bc_\bm_\bp(3); bash-4.1 and later use the cur-
+ rent locale's collation sequence and _\bs_\bt_\br_\bc_\bo_\bl_\bl(3).
c\bco\bom\bmp\bpa\bat\bt3\b32\b2
If set, b\bba\bas\bsh\bh changes its behavior to that of version 3.2
with respect to locale-specific string comparison when
- using the [\b[[\b[ conditional command's <\b< and >\b> operators.
- Bash versions prior to bash-4.1 use ASCII collation 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).
+ using the [\b[[\b[ conditional command's <\b< and >\b> operators
+ (see previous item).
c\bco\bom\bmp\bpa\bat\bt4\b40\b0
If set, b\bba\bas\bsh\bh changes its behavior to that of version 4.0
with respect to locale-specific string comparison when
using the [\b[[\b[ conditional command's <\b< and >\b> operators
- (see previous item) and the effect of interrupting a
- command list.
+ (see description of c\bco\bom\bmp\bpa\bat\bt3\b31\b1) and the effect of inter-
+ rupting a command list. Bash versions 4.0 and later
+ interrupt the list as if the shell received the inter-
+ rupt; previous versions continue with the next command
+ in the list.
c\bco\bom\bmp\bpa\bat\bt4\b41\b1
- @item compat41 If set, b\bba\bas\bsh\bh, when in posix mode, treats
- a single quote in a double-quoted parameter expansion as
- a special character. The single quotes must match (an
- even number) and the characters between the single
- quotes are considered quoted. This is the behavior of
- posix mode through version 4.1. The default bash behav-
- ior remains as in previous versions.
+ If set, b\bba\bas\bsh\bh, when in _\bp_\bo_\bs_\bi_\bx mode, treats a single quote
+ in a double-quoted parameter expansion as a special
+ character. The single quotes must match (an even num-
+ ber) and the characters between the single quotes are
+ considered quoted. This is the behavior of posix mode
+ through version 4.1. The default bash behavior remains
+ as in previous versions.
+ c\bco\bom\bmp\bpa\bat\bt4\b42\b2
+ If set, b\bba\bas\bsh\bh does not process the replacement string in
+ the pattern substitution word expansion using quote
+ removal.
+ c\bco\bom\bmp\bpl\ble\bet\bte\be_\b_f\bfu\bul\bll\blq\bqu\buo\bot\bte\be
+ If set, b\bba\bas\bsh\bh quotes all shell metacharacters in file-
+ names and directory names when performing completion.
+ If not set, b\bba\bas\bsh\bh removes metacharacters such as the dol-
+ lar sign from the set of characters that will be quoted
+ in completed filenames when these metacharacters appear
+ in shell variable references in words to be completed.
+ This means that dollar signs in variable names that
+ expand to directories will not be quoted; however, any
+ dollar signs appearing in filenames will not be quoted,
+ either. This is active only when bash is using back-
+ slashes to quote completed filenames. This variable is
+ set by default, which is the default bash behavior in
+ versions through 4.2.
+ d\bdi\bir\bre\bex\bxp\bpa\ban\bnd\bd
+ If set, b\bba\bas\bsh\bh replaces directory names with the results
+ of word expansion when performing filename completion.
+ This changes the contents of the readline editing
+ buffer. If not set, b\bba\bas\bsh\bh attempts to preserve what the
+ user typed.
d\bdi\bir\brs\bsp\bpe\bel\bll\bl
- If set, b\bba\bas\bsh\bh attempts spelling correction on directory
- names during word completion if the directory name ini-
+ If set, b\bba\bas\bsh\bh attempts spelling correction on directory
+ names during word completion if the directory name ini-
tially supplied does not exist.
- d\bdo\bot\btg\bgl\blo\bob\bb If set, b\bba\bas\bsh\bh includes filenames beginning with a `.' in
+ d\bdo\bot\btg\bgl\blo\bob\bb If set, b\bba\bas\bsh\bh includes filenames beginning with a `.' in
the results of pathname expansion.
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
+ 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\bxp\bpa\ban\bnd\bd_\b_a\bal\bli\bia\bas\bse\bes\bs
- If set, aliases are expanded as described above under
+ If set, aliases are expanded as described above under
A\bAL\bLI\bIA\bAS\bSE\bES\bS. This option is enabled by default for interac-
tive shells.
e\bex\bxt\btd\bde\beb\bbu\bug\bg
- If set, behavior intended for use by debuggers is
+ If set, behavior intended for use by debuggers is
enabled:
1\b1.\b. The -\b-F\bF option to the d\bde\bec\bcl\bla\bar\bre\be builtin displays the
source file name and line number corresponding to
each function name supplied as an argument.
- 2\b2.\b. If the command run by the D\bDE\bEB\bBU\bUG\bG trap returns a
- non-zero value, the next command is skipped and
+ 2\b2.\b. If the command run by the D\bDE\bEB\bBU\bUG\bG trap returns a
+ non-zero value, the next command is skipped and
not executed.
- 3\b3.\b. If the command run by the D\bDE\bEB\bBU\bUG\bG trap returns a
- value of 2, and the shell is executing in a sub-
- routine (a shell function or a shell script exe-
- cuted by the .\b. or s\bso\bou\bur\brc\bce\be builtins), a call to
+ 3\b3.\b. If the command run by the D\bDE\bEB\bBU\bUG\bG trap returns a
+ value of 2, and the shell is executing in a sub-
+ routine (a shell function or a shell script exe-
+ cuted by the .\b. or s\bso\bou\bur\brc\bce\be builtins), a call to
r\bre\bet\btu\bur\brn\bn is simulated.
- 4\b4.\b. B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGC\bC and B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV are updated as described
+ 4\b4.\b. B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGC\bC and B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV are updated as described
in their descriptions above.
- 5\b5.\b. Function tracing is enabled: command substitu-
+ 5\b5.\b. Function tracing is enabled: command substitu-
tion, shell functions, and subshells invoked with
(\b( _\bc_\bo_\bm_\bm_\ba_\bn_\bd )\b) inherit the D\bDE\bEB\bBU\bUG\bG and R\bRE\bET\bTU\bUR\bRN\bN traps.
- 6\b6.\b. Error tracing is enabled: command substitution,
- shell functions, and subshells invoked with (\b(
+ 6\b6.\b. Error tracing is enabled: command substitution,
+ 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\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
- description of F\bFI\bIG\bGN\bNO\bOR\bRE\bE. This option is enabled by
+ description of F\bFI\bIG\bGN\bNO\bOR\bRE\bE. This option is enabled by
default.
+ 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
+ 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.
g\bgl\blo\bob\bbs\bst\bta\bar\br
If set, the pattern *\b**\b* used in a pathname expansion con-
- text will match a files and zero or more directories and
- subdirectories. If the pattern is followed by a /\b/, only
- directories and subdirectories match.
+ 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
If set, shell error messages are written in the standard
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
- by the value of the H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE variable when the shell
+ 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
exits, 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
+ 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.
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
+ 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
above). This is enabled by default.
h\bhu\bup\bpo\bon\bne\bex\bxi\bit\bt
If set, b\bba\bas\bsh\bh will send S\bSI\bIG\bGH\bHU\bUP\bP to all jobs when an inter-
active login shell exits.
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
+ 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
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.
l\blo\bog\bgi\bin\bn_\b_s\bsh\bhe\bel\bll\bl
- The shell sets this option if it is started as a login
- shell (see I\bIN\bNV\bVO\bOC\bCA\bAT\bTI\bIO\bON\bN above). The value may not be
+ The shell sets this option if it is started as a login
+ shell (see I\bIN\bNV\bVO\bOC\bCA\bAT\bTI\bIO\bON\bN above). The value may not be
changed.
m\bma\bai\bil\blw\bwa\bar\brn\bn
- If set, and a file that b\bba\bas\bsh\bh is checking for mail has
- been accessed since the last time it was checked, the
- message ``The mail in _\bm_\ba_\bi_\bl_\bf_\bi_\bl_\be has been read'' is dis-
+ If set, and a file that b\bba\bas\bsh\bh is checking for mail has
+ been accessed since the last time it was checked, the
+ message ``The mail in _\bm_\ba_\bi_\bl_\bf_\bi_\bl_\be has been read'' is dis-
played.
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
+ If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, b\bba\bas\bsh\bh will not
attempt to search the P\bPA\bAT\bTH\bH for possible completions when
completion is attempted 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.
n\bnu\bul\bll\blg\bgl\blo\bob\bb
- If set, b\bba\bas\bsh\bh allows 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 above) to expand to a null string,
+ If set, b\bba\bas\bsh\bh allows 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 above) to expand to a null string,
rather than themselves.
p\bpr\bro\bog\bgc\bco\bom\bmp\bp
If set, the programmable completion facilities (see P\bPr\bro\bo-\b-
enabled by default.
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
- removal after being expanded as described in P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG
+ mand substitution, arithmetic expansion, and quote
+ removal 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
+ The shell sets this option if it is started in
restricted 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-
+ 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 s\bso\bou\bur\brc\bce\be (.\b.) builtin uses the value of P\bPA\bAT\bTH\bH to
- find the directory containing the file supplied as an
+ find the directory containing the file supplied as an
argument. This option is enabled by default.
x\bxp\bpg\bg_\b_e\bec\bch\bho\bo
- If set, the e\bec\bch\bho\bo builtin expands backslash-escape
+ If set, the e\bec\bch\bho\bo builtin expands backslash-escape
sequences by default.
+
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
+ Suspend the execution of this shell until it receives a S\bSI\bIG\bGC\bCO\bON\bNT\bT
signal. A login shell cannot be suspended; the -\b-f\bf option can be
used to override this and force the suspension. The return sta-
- tus is 0 unless the shell is a login shell and -\b-f\bf is not sup-
+ tus is 0 unless the shell is a login shell and -\b-f\bf is not sup-
plied, or if job control is not enabled.
+
t\bte\bes\bst\bt _\be_\bx_\bp_\br
[\b[ _\be_\bx_\bp_\br ]\b]
- Return a status of 0 or 1 depending on the evaluation 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,
+ 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 op-
+ erand 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
- depends on the number of arguments; see below. Operator prece-
+ depends on the number of arguments; see below. Operator prece-
dence is used 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
+ Returns the value of _\be_\bx_\bp_\br. This may be used to override
the normal precedence of operators.
_\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.
null.
2 arguments
If the first argument is !\b!, the expression is true if and
- only if the second argument is null. If the first argu-
- ment is one of the unary conditional operators listed
- 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, the expression is
+ only if the second argument is null. If the first argu-
+ ment is one of the unary conditional operators listed
+ 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, the expression is
true if the unary test is true. If the first argument is
not a valid unary conditional operator, the expression is
false.
3 arguments
The following conditions are applied in the order listed.
- If the second argument is one of the binary conditional
+ If the second argument is one of the binary conditional
operators listed 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, the
result of the expression is the result of the binary test
- using the first and third arguments as operands. The -\b-a\ba
- and -\b-o\bo operators are considered binary operators when
- there are three arguments. If the first argument is !\b!,
- the value is the negation of the two-argument test using
+ using the first and third arguments as operands. The -\b-a\ba
+ and -\b-o\bo operators are considered binary operators when
+ there are three arguments. If the first argument is !\b!,
+ the value is the negation of the two-argument test using
the second and third arguments. If the first argument is
exactly (\b( and the third argument is exactly )\b), the result
- is the one-argument test of the second argument. Other-
+ is the one-argument test of the second argument. Other-
wise, the expression is false.
4 arguments
If the first argument is !\b!, the result is the negation of
- the three-argument expression composed of the remaining
+ the three-argument expression composed of the remaining
arguments. Otherwise, the expression is parsed and eval-
- uated according to precedence using the rules listed
+ uated 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 used with t\bte\bes\bst\bt or [\b[, the <\b< and >\b> operators sort lexico-
+ When used with t\bte\bes\bst\bt or [\b[, the <\b< and >\b> operators sort lexico-
graphically using ASCII ordering.
- t\bti\bim\bme\bes\bs Print the accumulated user and system times for the shell and
+ 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_\br_\bg] _\bs_\bi_\bg_\bs_\bp_\be_\bc ...]
- The command _\ba_\br_\bg is to be read and executed when the shell
- receives signal(s) _\bs_\bi_\bg_\bs_\bp_\be_\bc. If _\ba_\br_\bg 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_\br_\bg 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 _\ba_\br_\bg is not present and -\b-p\bp has been supplied, then the trap
- commands associated with each _\bs_\bi_\bg_\bs_\bp_\be_\bc are displayed. If no
- arguments are supplied or if only -\b-p\bp is given, t\btr\bra\bap\bp prints the
- list of commands associated with each signal. The -\b-l\bl option
- causes the shell to print a list of signal names and their cor-
- responding 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
+ The command _\ba_\br_\bg is to be read and executed when the shell
+ receives signal(s) _\bs_\bi_\bg_\bs_\bp_\be_\bc. If _\ba_\br_\bg 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_\br_\bg 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 _\ba_\br_\bg is not present and -\b-p\bp has been supplied, then the trap
+ commands associated with each _\bs_\bi_\bg_\bs_\bp_\be_\bc are displayed. If no
+ arguments are supplied or if only -\b-p\bp is given, t\btr\bra\bap\bp prints the
+ list of commands associated with each signal. The -\b-l\bl option
+ causes the shell to print a list of signal names and their cor-
+ responding 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_\br_\bg 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_\br_\bg is exe-
- cuted 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, every 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 description of the e\bex\bxt\btd\bde\beb\bbu\bug\bg option to the
+ If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is E\bEX\bXI\bIT\bT (0) the command _\ba_\br_\bg 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_\br_\bg is exe-
+ cuted 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, every 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 description of the e\bex\bxt\btd\bde\beb\bbu\bug\bg option to the
s\bsh\bho\bop\bpt\bt builtin 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, the command _\ba_\br_\bg is executed each time a shell
function or a script executed with the .\b. or s\bso\bou\bur\brc\bce\be builtins fin-
ishes executing.
- If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is E\bER\bRR\bR, the command _\ba_\br_\bg is executed whenever a sim-
- ple command has 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, or if the command's return
- value is being inverted via !\b!. These are the same conditions
- obeyed by the e\ber\brr\bre\bex\bxi\bit\bt option.
+ If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is E\bER\bRR\bR, the command _\ba_\br_\bg is executed whenever a 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)
+ option.
Signals ignored upon entry to the shell cannot be trapped or
reset. Trapped signals that are not being ignored are reset to
fied 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 return _\bf_\bi_\bl_\be. If a command is
- hashed, -\b-p\bp and -\b-P\bP print the hashed value, 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 an executable named _\bn_\ba_\bm_\be.
- This includes aliases and functions, if and only if the -\b-p\bp
- option is not also used. The table of hashed commands is not
- consulted when using -\b-a\ba. The -\b-f\bf option suppresses shell func-
- tion 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.
+ 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 an executable
+ named _\bn_\ba_\bm_\be. This includes aliases and functions, if and only if
+ the -\b-p\bp option is not also used. The table of hashed commands is
+ not consulted when using -\b-a\ba. 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.
u\bul\bli\bim\bmi\bit\bt [-\b-H\bHS\bST\bTa\bab\bbc\bcd\bde\bef\bfi\bil\blm\bmn\bnp\bpq\bqr\brs\bst\btu\buv\bvx\bx [_\bl_\bi_\bm_\bi_\bt]]
Provides control over the resources available to the shell and
-\b-x\bx The maximum number of file locks
-\b-T\bT The maximum number of threads
- If _\bl_\bi_\bm_\bi_\bt is given, it is the new value of the specified resource
- (the -\b-a\ba option is display only). 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-p\bp, which is in units of 512-byte blocks,
- and -\b-T\bT, -\b-b\bb, -\b-n\bn, and -\b-u\bu, which are unscaled values. 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 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-p\bp, which is in units of 512-byte
+ blocks; and -\b-T\bT, -\b-b\bb, -\b-n\bn, and -\b-u\bu, which are unscaled values. The
+ return status is 0 unless an invalid option or argument is sup-
+ plied, 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
supplied, all alias definitions are removed. 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] [_\bn_\ba_\bm_\be ...]
+ 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 no options are supplied, or the -\b-v\bv option is given, each _\bn_\ba_\bm_\be
- refers to a shell variable. Read-only variables may not be
+ 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. Each unset vari-
- able or function is removed from the environment passed to sub-
- sequent commands. If any of C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS, R\bRA\bAN\bND\bDO\bOM\bM, S\bSE\bEC\bCO\bON\bND\bDS\bS,
- L\bLI\bIN\bNE\bEN\bNO\bO, H\bHI\bIS\bST\bTC\bCM\bMD\bD, F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE, G\bGR\bRO\bOU\bUP\bPS\bS, or D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK 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.
-
- w\bwa\bai\bit\bt [_\bn _\b._\b._\b.]
- Wait for each specified process and return its termination sta-
- tus. Each _\bn may be a process ID or a job specification; if a
+ 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, any function with that name is unset. Each
+ unset variable or function is removed from the environment
+ passed to subsequent commands. If any of C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS, R\bRA\bAN\bN-\b-
+ D\bDO\bOM\bM, S\bSE\bEC\bCO\bON\bND\bDS\bS, L\bLI\bIN\bNE\bEN\bNO\bO, H\bHI\bIS\bST\bTC\bCM\bMD\bD, F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE, G\bGR\bRO\bOU\bUP\bPS\bS, or D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK 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.
+
+ w\bwa\bai\bit\bt [-\b-n\bn] [_\bn _\b._\b._\b.]
+ Wait for each specified child process and return its termination
+ status. Each _\bn may be a process ID or a job specification; if a
job spec is given, all processes in that job's pipeline are
waited for. If _\bn is not given, all currently active child pro-
- cesses are waited for, and the return status is zero. If _\bn
- specifies a non-existent process or job, the return status is
- 127. Otherwise, the return status is the exit status of the
- last process or job waited for.
+ cesses are waited for, and the return status is zero. If the -\b-n\bn
+ option is supplied, w\bwa\bai\bit\bt waits for any job to terminate and
+ returns its exit status. If _\bn specifies a non-existent process
+ or job, the return status is 127. Otherwise, the return status
+ is the exit status of the last process or job waited for.
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 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
disallowed or not performed:
+\bo changing directories with c\bcd\bd
+\bo specifying command names containing /\b/
- +\bo specifying a file name containing a /\b/ as an argument to the .\b.
+ +\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
+ +\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 importing function definitions from the shell environment at
+ +\bo importing function definitions from the shell environment at
startup
- +\bo parsing the value of S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS from the shell environment at
+ +\bo parsing the value of S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS from the shell environment at
startup
+\bo redirecting output using the >, >|, <>, >&, &>, and >> redirect-
+\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
+ +\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
+ +\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
These restrictions are enforced after any startup files are read.
When a command that is found to be a shell script is executed (see C\bCO\bOM\bM-\b-
- M\bMA\bAN\bND\bD E\bEX\bXE\bEC\bCU\bUT\bTI\bIO\bON\bN above), r\brb\bba\bas\bsh\bh turns off any restrictions in the shell
+ M\bMA\bAN\bND\bD E\bEX\bXE\bEC\bCU\bUT\bTI\bIO\bON\bN above), 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
_\bB_\ba_\bs_\bh _\bR_\be_\bf_\be_\br_\be_\bn_\bc_\be _\bM_\ba_\bn_\bu_\ba_\bl, Brian Fox and Chet Ramey
_\bT_\bh_\be _\bG_\bn_\bu _\bR_\be_\ba_\bd_\bl_\bi_\bn_\be _\bL_\bi_\bb_\br_\ba_\br_\by, Brian Fox and Chet Ramey
_\bT_\bh_\be _\bG_\bn_\bu _\bH_\bi_\bs_\bt_\bo_\br_\by _\bL_\bi_\bb_\br_\ba_\br_\by, Brian Fox and Chet Ramey
- _\bP_\bo_\br_\bt_\ba_\bb_\bl_\be _\bO_\bp_\be_\br_\ba_\bt_\bi_\bn_\bg _\bS_\by_\bs_\bt_\be_\bm _\bI_\bn_\bt_\be_\br_\bf_\ba_\bc_\be _\b(_\bP_\bO_\bS_\bI_\bX_\b) _\bP_\ba_\br_\bt _\b2_\b: _\bS_\bh_\be_\bl_\bl _\ba_\bn_\bd _\bU_\bt_\bi_\bl_\bi_\b-
- _\bt_\bi_\be_\bs, IEEE
+ _\bP_\bo_\br_\bt_\ba_\bb_\bl_\be _\bO_\bp_\be_\br_\ba_\bt_\bi_\bn_\bg _\bS_\by_\bs_\bt_\be_\bm _\bI_\bn_\bt_\be_\br_\bf_\ba_\bc_\be _\b(_\bP_\bO_\bS_\bI_\bX_\b) _\bP_\ba_\br_\bt _\b2_\b: _\bS_\bh_\be_\bl_\bl _\ba_\bn_\bd _\bU_\bt_\bi_\bl_\bi_\b-
+ _\bt_\bi_\be_\bs, IEEE --
+ http://pubs.opengroup.org/onlinepubs/9699919799/
+ http://tiswww.case.edu/~chet/bash/POSIX -- a description of posix mode
_\bs_\bh(1), _\bk_\bs_\bh(1), _\bc_\bs_\bh(1)
_\be_\bm_\ba_\bc_\bs(1), _\bv_\bi(1)
_\br_\be_\ba_\bd_\bl_\bi_\bn_\be(3)
_\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc
The individual per-interactive-shell startup file
_\b~_\b/_\b._\bb_\ba_\bs_\bh_\b__\bl_\bo_\bg_\bo_\bu_\bt
- The individual login shell cleanup file, executed when a login
+ The individual login shell cleanup file, executed when a login
shell exits
_\b~_\b/_\b._\bi_\bn_\bp_\bu_\bt_\br_\bc
Individual _\br_\be_\ba_\bd_\bl_\bi_\bn_\be initialization file
B\bBU\bUG\bG R\bRE\bEP\bPO\bOR\bRT\bTS\bS
If you find a bug in b\bba\bas\bsh\bh,\b, you should report it. But first, you should
- make sure that it really is a bug, and that it appears in the latest
- version of b\bba\bas\bsh\bh. The latest version is always available from
+ make sure that it really is a bug, and that it appears in the latest
+ version of b\bba\bas\bsh\bh. The latest version is always available from
_\bf_\bt_\bp_\b:_\b/_\b/_\bf_\bt_\bp_\b._\bg_\bn_\bu_\b._\bo_\br_\bg_\b/_\bp_\bu_\bb_\b/_\bg_\bn_\bu_\b/_\bb_\ba_\bs_\bh_\b/.
- Once you have determined that a bug actually exists, use the _\bb_\ba_\bs_\bh_\bb_\bu_\bg
- command to submit a bug report. If you have a fix, you are encouraged
- to mail that as well! Suggestions and `philosophical' bug reports may
- be mailed to _\bb_\bu_\bg_\b-_\bb_\ba_\bs_\bh_\b@_\bg_\bn_\bu_\b._\bo_\br_\bg or posted to the Usenet newsgroup
+ Once you have determined that a bug actually exists, use the _\bb_\ba_\bs_\bh_\bb_\bu_\bg
+ command to submit a bug report. If you have a fix, you are encouraged
+ to mail that as well! Suggestions and `philosophical' bug reports may
+ be mailed to _\bb_\bu_\bg_\b-_\bb_\ba_\bs_\bh_\b@_\bg_\bn_\bu_\b._\bo_\br_\bg or posted to the Usenet newsgroup
g\bgn\bnu\bu.\b.b\bba\bas\bsh\bh.\b.b\bbu\bug\bg.
ALL bug reports should include:
A description of the bug behaviour
A short script or `recipe' which exercises the bug
- _\bb_\ba_\bs_\bh_\bb_\bu_\bg inserts the first three items automatically into the template
+ _\bb_\ba_\bs_\bh_\bb_\bu_\bg inserts the first three items automatically into the template
it provides for filing a bug report.
Comments and bug reports concerning this manual page should be directed
- to _\bc_\bh_\be_\bt_\b@_\bp_\bo_\b._\bc_\bw_\br_\bu_\b._\be_\bd_\bu.
+ to _\bc_\bh_\be_\bt_\b._\br_\ba_\bm_\be_\by_\b@_\bc_\ba_\bs_\be_\b._\be_\bd_\bu.
B\bBU\bUG\bGS\bS
It's too big and too slow.
Shell builtin commands and functions are not stoppable/restartable.
Compound commands and command sequences of the form `a ; b ; c' are not
- handled gracefully when process suspension is attempted. When a
- process is stopped, the shell immediately executes the next command in
- the sequence. It suffices to place the sequence of commands between
- parentheses to force it into a subshell, which may be stopped as a
+ handled gracefully when process suspension is attempted. When a
+ process is stopped, the shell immediately executes the next command in
+ the sequence. It suffices to place the sequence of commands between
+ parentheses to force it into a subshell, which may be stopped as a
unit.
Array variables may not (yet) be exported.
-GNU Bash-4.2 2010 December 28 BASH(1)
+GNU Bash 4.3 2014 February 2 BASH(1)