]> git.ipfire.org Git - thirdparty/bash.git/blob - doc/bash.0
bash-5.0-rc1 release
[thirdparty/bash.git] / doc / bash.0
1 BASH(1) General Commands Manual BASH(1)
2
3
4
5 N\bNA\bAM\bME\bE
6 bash - GNU Bourne-Again SHell
7
8 S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
9 b\bba\bas\bsh\bh [options] [command_string | file]
10
11 C\bCO\bOP\bPY\bYR\bRI\bIG\bGH\bHT\bT
12 Bash is Copyright (C) 1989-2018 by the Free Software Foundation, Inc.
13
14 D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
15 B\bBa\bas\bsh\bh is an s\bsh\bh-compatible command language interpreter that executes
16 commands read from the standard input or from a file. B\bBa\bas\bsh\bh also incor-
17 porates useful features from the _\bK_\bo_\br_\bn and _\bC shells (k\bks\bsh\bh and c\bcs\bsh\bh).
18
19 B\bBa\bas\bsh\bh is intended to be a conformant implementation of the Shell and
20 Utilities portion of the IEEE POSIX specification (IEEE Standard
21 1003.1). B\bBa\bas\bsh\bh can be configured to be POSIX-conformant by default.
22
23 O\bOP\bPT\bTI\bIO\bON\bNS\bS
24 All of the single-character shell options documented in the description
25 of the s\bse\bet\bt builtin command, including -\b-o\bo, can be used as options when
26 the shell is invoked. In addition, b\bba\bas\bsh\bh interprets the following
27 options when it is invoked:
28
29 -\b-c\bc If the -\b-c\bc option is present, then commands are read from the
30 first non-option argument _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b__\bs_\bt_\br_\bi_\bn_\bg. If there are argu-
31 ments after the _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b__\bs_\bt_\br_\bi_\bn_\bg, the first argument is
32 assigned to $\b$0\b0 and any remaining arguments are assigned to
33 the positional parameters. The assignment to $\b$0\b0 sets the
34 name of the shell, which is used in warning and error mes-
35 sages.
36 -\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.
37 -\b-l\bl Make b\bba\bas\bsh\bh act as if it had been invoked as a login shell (see
38 I\bIN\bNV\bVO\bOC\bCA\bAT\bTI\bIO\bON\bN below).
39 -\b-r\br If the -\b-r\br option is present, the shell becomes _\br_\be_\bs_\bt_\br_\bi_\bc_\bt_\be_\bd
40 (see R\bRE\bES\bST\bTR\bRI\bIC\bCT\bTE\bED\bD S\bSH\bHE\bEL\bLL\bL below).
41 -\b-s\bs If the -\b-s\bs option is present, or if no arguments remain after
42 option processing, then commands are read from the standard
43 input. This option allows the positional parameters to be
44 set when invoking an interactive shell or when reading input
45 through a pipe.
46 -\b-D\bD A list of all double-quoted strings preceded by $\b$ is printed
47 on the standard output. These are the strings that are sub-
48 ject to language translation when the current locale is not C\bC
49 or P\bPO\bOS\bSI\bIX\bX. This implies the -\b-n\bn option; no commands will be
50 executed.
51 [\b[-\b-+\b+]\b]O\bO [\b[_\bs_\bh_\bo_\bp_\bt_\b__\bo_\bp_\bt_\bi_\bo_\bn]\b]
52 _\bs_\bh_\bo_\bp_\bt_\b__\bo_\bp_\bt_\bi_\bo_\bn is one of the shell options accepted by the
53 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
54 _\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
55 unsets it. If _\bs_\bh_\bo_\bp_\bt_\b__\bo_\bp_\bt_\bi_\bo_\bn is not supplied, the names and
56 values of the shell options accepted by s\bsh\bho\bop\bpt\bt are printed on
57 the standard output. If the invocation option is +\b+O\bO, the
58 output is displayed in a format that may be reused as input.
59 -\b--\b- A -\b--\b- signals the end of options and disables further option
60 processing. Any arguments after the -\b--\b- are treated as file-
61 names and arguments. An argument of -\b- is equivalent to -\b--\b-.
62
63 B\bBa\bas\bsh\bh also interprets a number of multi-character options. These
64 options must appear on the command line before the single-character
65 options to be recognized.
66
67 -\b--\b-d\bde\beb\bbu\bug\bgg\bge\ber\br
68 Arrange for the debugger profile to be executed before the shell
69 starts. Turns on extended debugging mode (see the description
70 of the e\bex\bxt\btd\bde\beb\bbu\bug\bg option to the s\bsh\bho\bop\bpt\bt builtin below).
71 -\b--\b-d\bdu\bum\bmp\bp-\b-p\bpo\bo-\b-s\bst\btr\bri\bin\bng\bgs\bs
72 Equivalent to -\b-D\bD, but the output is in the GNU _\bg_\be_\bt_\bt_\be_\bx_\bt p\bpo\bo (por-
73 table object) file format.
74 -\b--\b-d\bdu\bum\bmp\bp-\b-s\bst\btr\bri\bin\bng\bgs\bs
75 Equivalent to -\b-D\bD.
76 -\b--\b-h\bhe\bel\blp\bp Display a usage message on standard output and exit success-
77 fully.
78 -\b--\b-i\bin\bni\bit\bt-\b-f\bfi\bil\ble\be _\bf_\bi_\bl_\be
79 -\b--\b-r\brc\bcf\bfi\bil\ble\be _\bf_\bi_\bl_\be
80 Execute commands from _\bf_\bi_\bl_\be instead of the standard personal ini-
81 tialization file _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc if the shell is interactive (see
82 I\bIN\bNV\bVO\bOC\bCA\bAT\bTI\bIO\bON\bN below).
83
84 -\b--\b-l\blo\bog\bgi\bin\bn
85 Equivalent to -\b-l\bl.
86
87 -\b--\b-n\bno\boe\bed\bdi\bit\bti\bin\bng\bg
88 Do not use the GNU r\bre\bea\bad\bdl\bli\bin\bne\be library to read command lines when
89 the shell is interactive.
90
91 -\b--\b-n\bno\bop\bpr\bro\bof\bfi\bil\ble\be
92 Do not read either the system-wide startup file _\b/_\be_\bt_\bc_\b/_\bp_\br_\bo_\bf_\bi_\bl_\be or
93 any of the personal initialization files _\b~_\b/_\b._\bb_\ba_\bs_\bh_\b__\bp_\br_\bo_\bf_\bi_\bl_\be,
94 _\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
95 files when it is invoked as a login shell (see I\bIN\bNV\bVO\bOC\bCA\bAT\bTI\bIO\bON\bN
96 below).
97
98 -\b--\b-n\bno\bor\brc\bc Do not read and execute the personal initialization file
99 _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc if the shell is interactive. This option is on by
100 default if the shell is invoked as s\bsh\bh.
101
102 -\b--\b-p\bpo\bos\bsi\bix\bx
103 Change the behavior of b\bba\bas\bsh\bh where the default operation differs
104 from the POSIX standard to match the standard (_\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be). See
105 S\bSE\bEE\bE A\bAL\bLS\bSO\bO below for a reference to a document that details how
106 posix mode affects bash's behavior.
107
108 -\b--\b-r\bre\bes\bst\btr\bri\bic\bct\bte\bed\bd
109 The shell becomes restricted (see R\bRE\bES\bST\bTR\bRI\bIC\bCT\bTE\bED\bD S\bSH\bHE\bEL\bLL\bL below).
110
111 -\b--\b-v\bve\ber\brb\bbo\bos\bse\be
112 Equivalent to -\b-v\bv.
113
114 -\b--\b-v\bve\ber\brs\bsi\bio\bon\bn
115 Show version information for this instance of b\bba\bas\bsh\bh on the stan-
116 dard output and exit successfully.
117
118 A\bAR\bRG\bGU\bUM\bME\bEN\bNT\bTS\bS
119 If arguments remain after option processing, and neither the -\b-c\bc nor the
120 -\b-s\bs option has been supplied, the first argument is assumed to be the
121 name of a file containing shell commands. If b\bba\bas\bsh\bh is invoked in this
122 fashion, $\b$0\b0 is set to the name of the file, and the positional parame-
123 ters are set to the remaining arguments. B\bBa\bas\bsh\bh reads and executes com-
124 mands from this file, then exits. B\bBa\bas\bsh\bh's exit status is the exit sta-
125 tus of the last command executed in the script. If no commands are
126 executed, the exit status is 0. An attempt is first made to open the
127 file in the current directory, and, if no file is found, then the shell
128 searches the directories in P\bPA\bAT\bTH\bH for the script.
129
130 I\bIN\bNV\bVO\bOC\bCA\bAT\bTI\bIO\bON\bN
131 A _\bl_\bo_\bg_\bi_\bn _\bs_\bh_\be_\bl_\bl is one whose first character of argument zero is a -\b-, or
132 one started with the -\b--\b-l\blo\bog\bgi\bin\bn option.
133
134 An _\bi_\bn_\bt_\be_\br_\ba_\bc_\bt_\bi_\bv_\be shell is one started without non-option arguments
135 (unless -\b-s\bs is specified) and without the -\b-c\bc option whose standard input
136 and error are both connected to terminals (as determined by _\bi_\bs_\ba_\bt_\bt_\by(3)),
137 or one started with the -\b-i\bi option. P\bPS\bS1\b1 is set and $\b$-\b- includes i\bi if
138 b\bba\bas\bsh\bh is interactive, allowing a shell script or a startup file to test
139 this state.
140
141 The following paragraphs describe how b\bba\bas\bsh\bh executes its startup files.
142 If any of the files exist but cannot be read, b\bba\bas\bsh\bh reports an error.
143 Tildes are expanded in filenames as described below under T\bTi\bil\bld\bde\be E\bEx\bxp\bpa\ban\bn-\b-
144 s\bsi\bio\bon\bn in the E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN section.
145
146 When b\bba\bas\bsh\bh is invoked as an interactive login shell, or as a non-inter-
147 active shell with the -\b--\b-l\blo\bog\bgi\bin\bn option, it first reads and executes com-
148 mands from the file _\b/_\be_\bt_\bc_\b/_\bp_\br_\bo_\bf_\bi_\bl_\be, if that file exists. After reading
149 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,
150 in that order, and reads and executes commands from the first one that
151 exists and is readable. The -\b--\b-n\bno\bop\bpr\bro\bof\bfi\bil\ble\be option may be used when the
152 shell is started to inhibit this behavior.
153
154 When an interactive login shell exits, or a non-interactive login shell
155 executes the e\bex\bxi\bit\bt builtin command, b\bba\bas\bsh\bh reads and executes commands
156 from the file _\b~_\b/_\b._\bb_\ba_\bs_\bh_\b__\bl_\bo_\bg_\bo_\bu_\bt, if it exists.
157
158 When an interactive shell that is not a login shell is started, b\bba\bas\bsh\bh
159 reads and executes commands from _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc, if that file exists. This
160 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
161 will force b\bba\bas\bsh\bh to read and execute commands from _\bf_\bi_\bl_\be instead of
162 _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc.
163
164 When b\bba\bas\bsh\bh is started non-interactively, to run a shell script, for
165 example, it looks for the variable B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV in the environment, expands
166 its value if it appears there, and uses the expanded value as the name
167 of a file to read and execute. B\bBa\bas\bsh\bh behaves as if the following com-
168 mand were executed:
169 if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
170 but the value of the P\bPA\bAT\bTH\bH variable is not used to search for the file-
171 name.
172
173 If b\bba\bas\bsh\bh is invoked with the name s\bsh\bh, it tries to mimic the startup
174 behavior of historical versions of s\bsh\bh as closely as possible, while
175 conforming to the POSIX standard as well. When invoked as an interac-
176 tive login shell, or a non-interactive shell with the -\b--\b-l\blo\bog\bgi\bin\bn option,
177 it first attempts to read and execute commands from _\b/_\be_\bt_\bc_\b/_\bp_\br_\bo_\bf_\bi_\bl_\be and
178 _\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
179 inhibit this behavior. When invoked as an interactive shell with the
180 name s\bsh\bh, b\bba\bas\bsh\bh looks for the variable E\bEN\bNV\bV, expands its value if it is
181 defined, and uses the expanded value as the name of a file to read and
182 execute. Since a shell invoked as s\bsh\bh does not attempt to read and exe-
183 cute commands from any other startup files, the -\b--\b-r\brc\bcf\bfi\bil\ble\be option has no
184 effect. A non-interactive shell invoked with the name s\bsh\bh does not
185 attempt to read any other startup files. When invoked as s\bsh\bh, b\bba\bas\bsh\bh
186 enters _\bp_\bo_\bs_\bi_\bx mode after the startup files are read.
187
188 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
189 option, it follows the POSIX standard for startup files. In this mode,
190 interactive shells expand the E\bEN\bNV\bV variable and commands are read and
191 executed from the file whose name is the expanded value. No other
192 startup files are read.
193
194 B\bBa\bas\bsh\bh attempts to determine when it is being run with its standard input
195 connected to a network connection, as when executed by the remote shell
196 daemon, usually _\br_\bs_\bh_\bd, or the secure shell daemon _\bs_\bs_\bh_\bd. If b\bba\bas\bsh\bh deter-
197 mines it is being run in this fashion, it reads and executes commands
198 from _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc, if that file exists and is readable. It will not do
199 this if invoked as s\bsh\bh. The -\b--\b-n\bno\bor\brc\bc option may be used to inhibit this
200 behavior, and the -\b--\b-r\brc\bcf\bfi\bil\ble\be option may be used to force another file to
201 be read, but neither _\br_\bs_\bh_\bd nor _\bs_\bs_\bh_\bd generally invoke the shell with
202 those options or allow them to be specified.
203
204 If the shell is started with the effective user (group) id not equal to
205 the real user (group) id, and the -\b-p\bp option is not supplied, no startup
206 files are read, shell functions are not inherited from the environment,
207 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
208 appear in the environment, are ignored, and the effective user id is
209 set to the real user id. If the -\b-p\bp option is supplied at invocation,
210 the startup behavior is the same, but the effective user id is not
211 reset.
212
213 D\bDE\bEF\bFI\bIN\bNI\bIT\bTI\bIO\bON\bNS\bS
214 The following definitions are used throughout the rest of this docu-
215 ment.
216 b\bbl\bla\ban\bnk\bk A space or tab.
217 w\bwo\bor\brd\bd A sequence of characters considered as a single unit by the
218 shell. Also known as a t\bto\bok\bke\ben\bn.
219 n\bna\bam\bme\be A _\bw_\bo_\br_\bd consisting only of alphanumeric characters and under-
220 scores, and beginning with an alphabetic character or an under-
221 score. Also referred to as an i\bid\bde\ben\bnt\bti\bif\bfi\bie\ber\br.
222 m\bme\bet\bta\bac\bch\bha\bar\bra\bac\bct\bte\ber\br
223 A character that, when unquoted, separates words. One of the
224 following:
225 |\b| &\b& ;\b; (\b( )\b) <\b< >\b> s\bsp\bpa\bac\bce\be t\bta\bab\bb n\bne\bew\bwl\bli\bin\bne\be
226 c\bco\bon\bnt\btr\bro\bol\bl o\bop\bpe\ber\bra\bat\bto\bor\br
227 A _\bt_\bo_\bk_\be_\bn that performs a control function. It is one of the fol-
228 lowing symbols:
229 |\b||\b| &\b& &\b&&\b& ;\b; ;\b;;\b; ;\b;&\b& ;\b;;\b;&\b& (\b( )\b) |\b| |\b|&\b& <\b<n\bne\bew\bwl\bli\bin\bne\be>\b>
230
231 R\bRE\bES\bSE\bER\bRV\bVE\bED\bD W\bWO\bOR\bRD\bDS\bS
232 _\bR_\be_\bs_\be_\br_\bv_\be_\bd _\bw_\bo_\br_\bd_\bs are words that have a special meaning to the shell. The
233 following words are recognized as reserved when unquoted and either the
234 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
235 word of a c\bca\bas\bse\be or f\bfo\bor\br command:
236
237 !\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
238 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]
239
240 S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR
241 S\bSi\bim\bmp\bpl\ble\be C\bCo\bom\bmm\bma\ban\bnd\bds\bs
242 A _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd is a sequence of optional variable assignments fol-
243 lowed by b\bbl\bla\ban\bnk\bk-separated words and redirections, and terminated by a
244 _\bc_\bo_\bn_\bt_\br_\bo_\bl _\bo_\bp_\be_\br_\ba_\bt_\bo_\br. The first word specifies the command to be executed,
245 and is passed as argument zero. The remaining words are passed as
246 arguments to the invoked command.
247
248 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
249 the command is terminated by signal _\bn.
250
251 P\bPi\bip\bpe\bel\bli\bin\bne\bes\bs
252 A _\bp_\bi_\bp_\be_\bl_\bi_\bn_\be is a sequence of one or more commands separated by one of
253 the control operators |\b| or |\b|&\b&. The format for a pipeline is:
254
255 [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 ... ]
256
257 The standard output of _\bc_\bo_\bm_\bm_\ba_\bn_\bd is connected via a pipe to the standard
258 input of _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2. This connection is performed before any redirec-
259 tions specified by the command (see R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN below). If |\b|&\b& is used,
260 _\bc_\bo_\bm_\bm_\ba_\bn_\bd's standard error, in addition to its standard output, is con-
261 nected to _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2's standard input through the pipe; it is shorthand
262 for 2\b2>\b>&\b&1\b1 |\b|. This implicit redirection of the standard error to the
263 standard output is performed after any redirections specified by the
264 command.
265
266 The return status of a pipeline is the exit status of the last command,
267 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
268 pipeline's return status is the value of the last (rightmost) command
269 to exit with a non-zero status, or zero if all commands exit success-
270 fully. If the reserved word !\b! precedes a pipeline, the exit status of
271 that pipeline is the logical negation of the exit status as described
272 above. The shell waits for all commands in the pipeline to terminate
273 before returning a value.
274
275 If the t\bti\bim\bme\be reserved word precedes a pipeline, the elapsed as well as
276 user and system time consumed by its execution are reported when the
277 pipeline terminates. The -\b-p\bp option changes the output format to that
278 specified by POSIX. When the shell is in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, it does not rec-
279 ognize t\bti\bim\bme\be as a reserved word if the next token begins with a `-'.
280 The T\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT variable may be set to a format string that specifies
281 how the timing information should be displayed; see the description of
282 T\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT under S\bSh\bhe\bel\bll\bl V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs below.
283
284 When the shell is in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, t\bti\bim\bme\be may be followed by a newline. In
285 this case, the shell displays the total user and system time consumed
286 by the shell and its children. The T\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT variable may be used to
287 specify the format of the time information.
288
289 Each command in a pipeline is executed as a separate process (i.e., in
290 a subshell). See C\bCO\bOM\bMM\bMA\bAN\bND\bD E\bEX\bXE\bEC\bCU\bUT\bTI\bIO\bON\bN E\bEN\bNV\bVI\bIR\bRO\bON\bNM\bME\bEN\bNT\bT for a description of a
291 subshell environment. If the l\bla\bas\bst\btp\bpi\bip\bpe\be option is enabled using the
292 s\bsh\bho\bop\bpt\bt builtin (see the description of s\bsh\bho\bop\bpt\bt below), the last element of
293 a pipeline may be run by the shell process.
294
295 L\bLi\bis\bst\bts\bs
296 A _\bl_\bi_\bs_\bt is a sequence of one or more pipelines separated by one of the
297 operators ;\b;, &\b&, &\b&&\b&, or |\b||\b|, and optionally terminated by one of ;\b;, &\b&, or
298 <\b<n\bne\bew\bwl\bli\bin\bne\be>\b>.
299
300 Of these list operators, &\b&&\b& and |\b||\b| have equal precedence, followed by ;\b;
301 and &\b&, which have equal precedence.
302
303 A sequence of one or more newlines may appear in a _\bl_\bi_\bs_\bt instead of a
304 semicolon to delimit commands.
305
306 If a command is terminated by the control operator &\b&, the shell exe-
307 cutes the command in the _\bb_\ba_\bc_\bk_\bg_\br_\bo_\bu_\bn_\bd in a subshell. The shell does not
308 wait for the command to finish, and the return status is 0. These are
309 referred to as _\ba_\bs_\by_\bn_\bc_\bh_\br_\bo_\bn_\bo_\bu_\bs commands. Commands separated by a ;\b; are
310 executed sequentially; the shell waits for each command to terminate in
311 turn. The return status is the exit status of the last command exe-
312 cuted.
313
314 AND and OR lists are sequences of one or more pipelines separated by
315 the &\b&&\b& and |\b||\b| control operators, respectively. AND and OR lists are
316 executed with left associativity. An AND list has the form
317
318 _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b1 &\b&&\b& _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2
319
320 _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2 is executed if, and only if, _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b1 returns an exit status
321 of zero (success).
322
323 An OR list has the form
324
325 _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b1 |\b||\b| _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2
326
327 _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2 is executed if, and only if, _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b1 returns a non-zero exit
328 status. The return status of AND and OR lists is the exit status of
329 the last command executed in the list.
330
331 C\bCo\bom\bmp\bpo\bou\bun\bnd\bd C\bCo\bom\bmm\bma\ban\bnd\bds\bs
332 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
333 command's description may be separated from the rest of the command by
334 one or more newlines, and may be followed by a newline in place of a
335 semicolon.
336
337 (_\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-
338 T\bTI\bIO\bON\bN E\bEN\bNV\bVI\bIR\bRO\bON\bNM\bME\bEN\bNT\bT below). Variable assignments and builtin com-
339 mands that affect the shell's environment do not remain in
340 effect after the command completes. The return status is the
341 exit status of _\bl_\bi_\bs_\bt.
342
343 { _\bl_\bi_\bs_\bt; }
344 _\bl_\bi_\bs_\bt is simply executed in the current shell environment. _\bl_\bi_\bs_\bt
345 must be terminated with a newline or semicolon. This is known
346 as a _\bg_\br_\bo_\bu_\bp _\bc_\bo_\bm_\bm_\ba_\bn_\bd. The return status is the exit status of
347 _\bl_\bi_\bs_\bt. Note that unlike the metacharacters (\b( and )\b), {\b{ and }\b} are
348 _\br_\be_\bs_\be_\br_\bv_\be_\bd _\bw_\bo_\br_\bd_\bs and must occur where a reserved word is permitted
349 to be recognized. Since they do not cause a word break, they
350 must be separated from _\bl_\bi_\bs_\bt by whitespace or another shell
351 metacharacter.
352
353 ((_\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn))
354 The _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn is evaluated according to the rules described
355 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-
356 sion is non-zero, the return status is 0; otherwise the return
357 status is 1. This is exactly equivalent to l\ble\bet\bt "\b"_\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn"\b".
358
359 [\b[[\b[ _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn ]\b]]\b]
360 Return a status of 0 or 1 depending on the evaluation of the
361 conditional expression _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn. Expressions are composed of
362 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.
363 Word splitting and pathname expansion are not performed on the
364 words between the [\b[[\b[ and ]\b]]\b]; tilde expansion, parameter and
365 variable expansion, arithmetic expansion, command substitution,
366 process substitution, and quote removal are performed. Condi-
367 tional operators such as -\b-f\bf must be unquoted to be recognized as
368 primaries.
369
370 When used with [\b[[\b[, the <\b< and >\b> operators sort lexicographically
371 using the current locale.
372
373 When the =\b==\b= and !\b!=\b= operators are used, the string to the right
374 of the operator is considered a pattern and matched according to
375 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-
376 g\bgl\blo\bob\bb shell option were enabled. The =\b= operator is equivalent to
377 =\b==\b=. If the n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh shell option is enabled, the match is
378 performed without regard to the case of alphabetic characters.
379 The return value is 0 if the string matches (=\b==\b=) or does not
380 match (!\b!=\b=) the pattern, and 1 otherwise. Any part of the pat-
381 tern may be quoted to force the quoted portion to be matched as
382 a string.
383
384 An additional binary operator, =\b=~\b~, is available, with the same
385 precedence as =\b==\b= and !\b!=\b=. When it is used, the string to the
386 right of the operator is considered a POSIX extended regular
387 expression and matched accordingly (as in _\br_\be_\bg_\be_\bx(3)). The return
388 value is 0 if the string matches the pattern, and 1 otherwise.
389 If the regular expression is syntactically incorrect, the condi-
390 tional expression's return value is 2. If the n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh shell
391 option is enabled, the match is performed without regard to the
392 case of alphabetic characters. Any part of the pattern may be
393 quoted to force the quoted portion to be matched as a string.
394 Bracket expressions in regular expressions must be treated care-
395 fully, since normal quoting characters lose their meanings
396 between brackets. If the pattern is stored in a shell variable,
397 quoting the variable expansion forces the entire pattern to be
398 matched as a string. Substrings matched by parenthesized subex-
399 pressions within the regular expression are saved in the array
400 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
401 is the portion of the string matching the entire regular expres-
402 sion. The element of B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH with index _\bn is the portion
403 of the string matching the _\bnth parenthesized subexpression.
404
405 Expressions may be combined using the following operators,
406 listed in decreasing order of precedence:
407
408 (\b( _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn )\b)
409 Returns the value of _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn. This may be used to
410 override the normal precedence of operators.
411 !\b! _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn
412 True if _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn is false.
413 _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b1 &\b&&\b& _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b2
414 True if both _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b1 and _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b2 are true.
415 _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b1 |\b||\b| _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b2
416 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.
417
418 The &\b&&\b& and |\b||\b| operators do not evaluate _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b2 if the value
419 of _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b1 is sufficient to determine the return value of
420 the entire conditional expression.
421
422 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
423 The list of words following i\bin\bn is expanded, generating a list of
424 items. The variable _\bn_\ba_\bm_\be is set to each element of this list in
425 turn, and _\bl_\bi_\bs_\bt is executed each time. If the i\bin\bn _\bw_\bo_\br_\bd is omit-
426 ted, the f\bfo\bor\br command executes _\bl_\bi_\bs_\bt once for each positional
427 parameter that is set (see P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS below). The return status
428 is the exit status of the last command that executes. If the
429 expansion of the items following i\bin\bn results in an empty list, no
430 commands are executed, and the return status is 0.
431
432 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
433 First, the arithmetic expression _\be_\bx_\bp_\br_\b1 is evaluated according to
434 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
435 arithmetic expression _\be_\bx_\bp_\br_\b2 is then evaluated repeatedly until
436 it evaluates to zero. Each time _\be_\bx_\bp_\br_\b2 evaluates to a non-zero
437 value, _\bl_\bi_\bs_\bt is executed and the arithmetic expression _\be_\bx_\bp_\br_\b3 is
438 evaluated. If any expression is omitted, it behaves as if it
439 evaluates to 1. The return value is the exit status of the last
440 command in _\bl_\bi_\bs_\bt that is executed, or false if any of the expres-
441 sions is invalid.
442
443 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
444 The list of words following i\bin\bn is expanded, generating a list of
445 items. The set of expanded words is printed on the standard
446 error, each preceded by a number. If the i\bin\bn _\bw_\bo_\br_\bd is omitted,
447 the positional parameters are printed (see P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS below).
448 The P\bPS\bS3\b3 prompt is then displayed and a line read from the stan-
449 dard input. If the line consists of a number corresponding to
450 one of the displayed words, then the value of _\bn_\ba_\bm_\be is set to
451 that word. If the line is empty, the words and prompt are dis-
452 played again. If EOF is read, the command completes. Any other
453 value read causes _\bn_\ba_\bm_\be to be set to null. The line read is
454 saved in the variable R\bRE\bEP\bPL\bLY\bY. The _\bl_\bi_\bs_\bt is executed after each
455 selection until a b\bbr\bre\bea\bak\bk command is executed. The exit status of
456 s\bse\bel\ble\bec\bct\bt is the exit status of the last command executed in _\bl_\bi_\bs_\bt,
457 or zero if no commands were executed.
458
459 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
460 A c\bca\bas\bse\be command first expands _\bw_\bo_\br_\bd, and tries to match it against
461 each _\bp_\ba_\bt_\bt_\be_\br_\bn in turn, using the matching rules described under
462 P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg below. The _\bw_\bo_\br_\bd is expanded using tilde expan-
463 sion, parameter and variable expansion, arithmetic expansion,
464 command substitution, process substitution and quote removal.
465 Each _\bp_\ba_\bt_\bt_\be_\br_\bn examined is expanded using tilde expansion, parame-
466 ter and variable expansion, arithmetic expansion, command sub-
467 stitution, and process substitution. If the n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh shell
468 option is enabled, the match is performed without regard to the
469 case of alphabetic characters. When a match is found, the cor-
470 responding _\bl_\bi_\bs_\bt is executed. If the ;\b;;\b; operator is used, no
471 subsequent matches are attempted after the first pattern match.
472 Using ;\b;&\b& in place of ;\b;;\b; causes execution to continue with the
473 _\bl_\bi_\bs_\bt associated with the next set of patterns. Using ;\b;;\b;&\b& in
474 place of ;\b;;\b; causes the shell to test the next pattern list in
475 the statement, if any, and execute any associated _\bl_\bi_\bs_\bt on a suc-
476 cessful match. The exit status is zero if no pattern matches.
477 Otherwise, it is the exit status of the last command executed in
478 _\bl_\bi_\bs_\bt.
479
480 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
481 The i\bif\bf _\bl_\bi_\bs_\bt is executed. If its exit status is zero, the t\bth\bhe\ben\bn
482 _\bl_\bi_\bs_\bt is executed. Otherwise, each e\bel\bli\bif\bf _\bl_\bi_\bs_\bt is executed in
483 turn, and if its exit status is zero, the corresponding t\bth\bhe\ben\bn
484 _\bl_\bi_\bs_\bt is executed and the command completes. Otherwise, the e\bel\bls\bse\be
485 _\bl_\bi_\bs_\bt is executed, if present. The exit status is the exit sta-
486 tus of the last command executed, or zero if no condition tested
487 true.
488
489 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
490 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
491 The w\bwh\bhi\bil\ble\be command continuously executes the list _\bl_\bi_\bs_\bt_\b-_\b2 as long
492 as the last command in the list _\bl_\bi_\bs_\bt_\b-_\b1 returns an exit status of
493 zero. The u\bun\bnt\bti\bil\bl command is identical to the w\bwh\bhi\bil\ble\be command,
494 except that the test is negated: _\bl_\bi_\bs_\bt_\b-_\b2 is executed as long as
495 the last command in _\bl_\bi_\bs_\bt_\b-_\b1 returns a non-zero exit status. The
496 exit status of the w\bwh\bhi\bil\ble\be and u\bun\bnt\bti\bil\bl commands is the exit status
497 of the last command executed in _\bl_\bi_\bs_\bt_\b-_\b2, or zero if none was exe-
498 cuted.
499
500 C\bCo\bop\bpr\bro\boc\bce\bes\bss\bse\bes\bs
501 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
502 coprocess is executed asynchronously in a subshell, as if the command
503 had been terminated with the &\b& control operator, with a two-way pipe
504 established between the executing shell and the coprocess.
505
506 The format for a coprocess is:
507
508 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]
509
510 This creates a coprocess named _\bN_\bA_\bM_\bE. If _\bN_\bA_\bM_\bE is not supplied, the
511 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-
512 _\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd (see above); otherwise, it is interpreted as the first word
513 of the simple command. When the coprocess is executed, the shell cre-
514 ates an array variable (see A\bAr\brr\bra\bay\bys\bs below) named _\bN_\bA_\bM_\bE in the context of
515 the executing shell. The standard output of _\bc_\bo_\bm_\bm_\ba_\bn_\bd is connected via a
516 pipe to a file descriptor in the executing shell, and that file
517 descriptor is assigned to _\bN_\bA_\bM_\bE[0]. The standard input of _\bc_\bo_\bm_\bm_\ba_\bn_\bd is
518 connected via a pipe to a file descriptor in the executing shell, and
519 that file descriptor is assigned to _\bN_\bA_\bM_\bE[1]. This pipe is established
520 before any redirections specified by the command (see R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN
521 below). The file descriptors can be utilized as arguments to shell
522 commands and redirections using standard word expansions. Other than
523 those created to execute command and process substitutions, the file
524 descriptors are not available in subshells. The process ID of the
525 shell spawned to execute the coprocess is available as the value of the
526 variable _\bN_\bA_\bM_\bE_PID. The w\bwa\bai\bit\bt builtin command may be used to wait for
527 the coprocess to terminate.
528
529 Since the coprocess is created as an asynchronous command, the c\bco\bop\bpr\bro\boc\bc
530 command always returns success. The return status of a coprocess is
531 the exit status of _\bc_\bo_\bm_\bm_\ba_\bn_\bd.
532
533 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
534 A shell function is an object that is called like a simple command and
535 executes a compound command with a new set of positional parameters.
536 Shell functions are declared as follows:
537
538 _\bn_\ba_\bm_\be () _\bc_\bo_\bm_\bp_\bo_\bu_\bn_\bd_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd [_\br_\be_\bd_\bi_\br_\be_\bc_\bt_\bi_\bo_\bn]
539 f\bfu\bun\bnc\bct\bti\bio\bon\bn _\bn_\ba_\bm_\be [()] _\bc_\bo_\bm_\bp_\bo_\bu_\bn_\bd_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd [_\br_\be_\bd_\bi_\br_\be_\bc_\bt_\bi_\bo_\bn]
540 This defines a function named _\bn_\ba_\bm_\be. The reserved word f\bfu\bun\bnc\bct\bti\bio\bon\bn
541 is optional. If the f\bfu\bun\bnc\bct\bti\bio\bon\bn reserved word is supplied, the
542 parentheses are optional. The _\bb_\bo_\bd_\by of the function is the com-
543 pound command _\bc_\bo_\bm_\bp_\bo_\bu_\bn_\bd_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd (see C\bCo\bom\bmp\bpo\bou\bun\bnd\bd C\bCo\bom\bmm\bma\ban\bnd\bds\bs above).
544 That command is usually a _\bl_\bi_\bs_\bt of commands between { and }, but
545 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, with
546 one exception: If the f\bfu\bun\bnc\bct\bti\bio\bon\bn reserved word is used, but the
547 parentheses are not supplied, the braces are required. _\bc_\bo_\bm_\b-
548 _\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
549 of a simple command. When in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, _\bn_\ba_\bm_\be may not be the
550 name of one of the POSIX _\bs_\bp_\be_\bc_\bi_\ba_\bl _\bb_\bu_\bi_\bl_\bt_\bi_\bn_\bs. Any redirections
551 (see R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN below) specified when a function is defined are
552 performed when the function is executed. The exit status of a
553 function definition is zero unless a syntax error occurs or a
554 readonly function with the same name already exists. When exe-
555 cuted, the exit status of a function is the exit status of the
556 last command executed in the body. (See F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS below.)
557
558 C\bCO\bOM\bMM\bME\bEN\bNT\bTS\bS
559 In a non-interactive shell, or an interactive shell in which the i\bin\bnt\bte\ber\br-\b-
560 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
561 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
562 all remaining characters on that line to be ignored. An interactive
563 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
564 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-
565 tive shells.
566
567 Q\bQU\bUO\bOT\bTI\bIN\bNG\bG
568 _\bQ_\bu_\bo_\bt_\bi_\bn_\bg is used to remove the special meaning of certain characters or
569 words to the shell. Quoting can be used to disable special treatment
570 for special characters, to prevent reserved words from being recognized
571 as such, and to prevent parameter expansion.
572
573 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
574 meaning to the shell and must be quoted if it is to represent itself.
575
576 When the command history expansion facilities are being used (see H\bHI\bIS\bS-\b-
577 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
578 be quoted to prevent history expansion.
579
580 There are three quoting mechanisms: the _\be_\bs_\bc_\ba_\bp_\be _\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br, single
581 quotes, and double quotes.
582
583 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
584 literal value of the next character that follows, with the exception of
585 <newline>. If a \\b\<newline> pair appears, and the backslash is not
586 itself quoted, the \\b\<newline> is treated as a line continuation (that
587 is, it is removed from the input stream and effectively ignored).
588
589 Enclosing characters in single quotes preserves the literal value of
590 each character within the quotes. A single quote may not occur between
591 single quotes, even when preceded by a backslash.
592
593 Enclosing characters in double quotes preserves the literal value of
594 all characters within the quotes, with the exception of $\b$, `\b`, \\b\, and,
595 when history expansion is enabled, !\b!. When the shell is in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be,
596 the !\b! has no special meaning within double quotes, even when history
597 expansion is enabled. The characters $\b$ and `\b` retain their special
598 meaning within double quotes. The backslash retains its special mean-
599 ing only when followed by one of the following characters: $\b$, `\b`, "\b", \\b\,
600 or <\b<n\bne\bew\bwl\bli\bin\bne\be>\b>. A double quote may be quoted within double quotes by
601 preceding it with a backslash. If enabled, history expansion will be
602 performed unless an !\b! appearing in double quotes is escaped using a
603 backslash. The backslash preceding the !\b! is not removed.
604
605 The special parameters *\b* and @\b@ have special meaning when in double
606 quotes (see P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS below).
607
608 Words of the form $\b$'_\bs_\bt_\br_\bi_\bn_\bg' are treated specially. The word expands to
609 _\bs_\bt_\br_\bi_\bn_\bg, with backslash-escaped characters replaced as specified by the
610 ANSI C standard. Backslash escape sequences, if present, are decoded
611 as follows:
612 \\b\a\ba alert (bell)
613 \\b\b\bb backspace
614 \\b\e\be
615 \\b\E\bE an escape character
616 \\b\f\bf form feed
617 \\b\n\bn new line
618 \\b\r\br carriage return
619 \\b\t\bt horizontal tab
620 \\b\v\bv vertical tab
621 \\b\\\b\ backslash
622 \\b\'\b' single quote
623 \\b\"\b" double quote
624 \\b\?\b? question mark
625 \\b\_\bn_\bn_\bn the eight-bit character whose value is the octal value
626 _\bn_\bn_\bn (one to three octal digits)
627 \\b\x\bx_\bH_\bH the eight-bit character whose value is the hexadecimal
628 value _\bH_\bH (one or two hex digits)
629 \\b\u\bu_\bH_\bH_\bH_\bH the Unicode (ISO/IEC 10646) character whose value is the
630 hexadecimal value _\bH_\bH_\bH_\bH (one to four hex digits)
631 \\b\U\bU_\bH_\bH_\bH_\bH_\bH_\bH_\bH_\bH
632 the Unicode (ISO/IEC 10646) character whose value is the
633 hexadecimal value _\bH_\bH_\bH_\bH_\bH_\bH_\bH_\bH (one to eight hex digits)
634 \\b\c\bc_\bx a control-_\bx character
635
636 The expanded result is single-quoted, as if the dollar sign had not
637 been present.
638
639 A double-quoted string preceded by a dollar sign ($\b$"_\bs_\bt_\br_\bi_\bn_\bg") will cause
640 the string to be translated according to the current locale. If the
641 current locale is C\bC or P\bPO\bOS\bSI\bIX\bX, the dollar sign is ignored. If the
642 string is translated and replaced, the replacement is double-quoted.
643
644 P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS
645 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-
646 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-
647 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
648 _\bv_\ba_\bl_\bu_\be and zero or more _\ba_\bt_\bt_\br_\bi_\bb_\bu_\bt_\be_\bs. Attributes are assigned using the
649 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).
650
651 A parameter is set if it has been assigned a value. The null string is
652 a valid value. Once a variable is set, it may be unset only by using
653 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).
654
655 A _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be may be assigned to by a statement of the form
656
657 _\bn_\ba_\bm_\be=[_\bv_\ba_\bl_\bu_\be]
658
659 If _\bv_\ba_\bl_\bu_\be is not given, the variable is assigned the null string. All
660 _\bv_\ba_\bl_\bu_\be_\bs undergo tilde expansion, parameter and variable expansion, com-
661 mand substitution, arithmetic expansion, and quote removal (see E\bEX\bXP\bPA\bAN\bN-\b-
662 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
663 is evaluated as an arithmetic expression even if the $((...)) expansion
664 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
665 performed, with the exception of "\b"$\b$@\b@"\b" as explained below under S\bSp\bpe\bec\bci\bia\bal\bl
666 P\bPa\bar\bra\bam\bme\bet\bte\ber\brs\bs. Pathname expansion is not performed. Assignment state-
667 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,
668 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 (_\bd_\be_\bc_\bl_\ba_\br_\ba_\bt_\bi_\bo_\bn commands).
669 When in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, these builtins may appear in a command after one or
670 more instances of the c\bco\bom\bmm\bma\ban\bnd\bd builtin and retain these assignment
671 statement properties.
672
673 In the context where an assignment statement is assigning a value to a
674 shell variable or array index, the += operator can be used to append to
675 or add to the variable's previous value. This includes arguments to
676 builtin commands such as d\bde\bec\bcl\bla\bar\bre\be that accept assignment statements
677 (_\bd_\be_\bc_\bl_\ba_\br_\ba_\bt_\bi_\bo_\bn commands). When += is applied to a variable for which the
678 _\bi_\bn_\bt_\be_\bg_\be_\br attribute has been set, _\bv_\ba_\bl_\bu_\be is evaluated as an arithmetic
679 expression and added to the variable's current value, which is also
680 evaluated. When += is applied to an array variable using compound
681 assignment (see A\bAr\brr\bra\bay\bys\bs below), the variable's value is not unset (as it
682 is when using =), and new values are appended to the array beginning at
683 one greater than the array's maximum index (for indexed arrays) or
684 added as additional key-value pairs in an associative array. When
685 applied to a string-valued variable, _\bv_\ba_\bl_\bu_\be is expanded and appended to
686 the variable's value.
687
688 A variable can be assigned the _\bn_\ba_\bm_\be_\br_\be_\bf attribute using the -\b-n\bn option to
689 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
690 and l\blo\boc\bca\bal\bl below) to create a _\bn_\ba_\bm_\be_\br_\be_\bf, or a reference to another vari-
691 able. This allows variables to be manipulated indirectly. Whenever
692 the nameref variable is referenced, assigned to, unset, or has its
693 attributes modified (other than using or changing the _\bn_\ba_\bm_\be_\br_\be_\bf attribute
694 itself), the operation is actually performed on the variable specified
695 by the nameref variable's value. A nameref is commonly used within
696 shell functions to refer to a variable whose name is passed as an argu-
697 ment to the function. For instance, if a variable name is passed to a
698 shell function as its first argument, running
699 declare -n ref=$1
700 inside the function creates a nameref variable r\bre\bef\bf whose value is the
701 variable name passed as the first argument. References and assignments
702 to r\bre\bef\bf, and changes to its attributes, are treated as references,
703 assignments, and attribute modifications to the variable whose name was
704 passed as $\b$1\b1. If the control variable in a f\bfo\bor\br loop has the nameref
705 attribute, the list of words can be a list of shell variables, and a
706 name reference will be established for each word in the list, in turn,
707 when the loop is executed. Array variables cannot be given the n\bna\bam\bme\ber\bre\bef\bf
708 attribute. However, nameref variables can reference array variables
709 and subscripted array variables. Namerefs can be unset using the -\b-n\bn
710 option to the u\bun\bns\bse\bet\bt builtin. Otherwise, if u\bun\bns\bse\bet\bt is executed with the
711 name of a nameref variable as an argument, the variable referenced by
712 the nameref variable will be unset.
713
714 P\bPo\bos\bsi\bit\bti\bio\bon\bna\bal\bl P\bPa\bar\bra\bam\bme\bet\bte\ber\brs\bs
715 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,
716 other than the single digit 0. Positional parameters are assigned from
717 the shell's arguments when it is invoked, and may be reassigned using
718 the s\bse\bet\bt builtin command. Positional parameters may not be assigned to
719 with assignment statements. The positional parameters are temporarily
720 replaced when a shell function is executed (see F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS below).
721
722 When a positional parameter consisting of more than a single digit is
723 expanded, it must be enclosed in braces (see E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN below).
724
725 S\bSp\bpe\bec\bci\bia\bal\bl P\bPa\bar\bra\bam\bme\bet\bte\ber\brs\bs
726 The shell treats several parameters specially. These parameters may
727 only be referenced; assignment to them is not allowed.
728 *\b* Expands to the positional parameters, starting from one. When
729 the expansion is not within double quotes, each positional
730 parameter expands to a separate word. In contexts where it is
731 performed, those words are subject to further word splitting and
732 pathname expansion. When the expansion occurs within double
733 quotes, it expands to a single word with the value of each
734 parameter separated by the first character of the I\bIF\bFS\bS special
735 variable. That is, "$\b$*\b*" is equivalent to "$\b$1\b1_\bc$\b$2\b2_\bc.\b..\b..\b.", where _\bc
736 is the first character of the value of the I\bIF\bFS\bS variable. If I\bIF\bFS\bS
737 is unset, the parameters are separated by spaces. If I\bIF\bFS\bS is
738 null, the parameters are joined without intervening separators.
739 @\b@ Expands to the positional parameters, starting from one. In
740 contexts where word splitting is performed, this expands each
741 positional parameter to a separate word; if not within double
742 quotes, these words are subject to word splitting. In contexts
743 where word splitting is not performed, this expands to a single
744 word with each positional parameter separated by a space. When
745 the expansion occurs within double quotes, each parameter
746 expands to a separate word. That is, "$\b$@\b@" is equivalent to "$\b$1\b1"
747 "$\b$2\b2" ... If the double-quoted expansion occurs within a word,
748 the expansion of the first parameter is joined with the begin-
749 ning part of the original word, and the expansion of the last
750 parameter is joined with the last part of the original word.
751 When there are no positional parameters, "$\b$@\b@" and $\b$@\b@ expand to
752 nothing (i.e., they are removed).
753 #\b# Expands to the number of positional parameters in decimal.
754 ?\b? Expands to the exit status of the most recently executed fore-
755 ground pipeline.
756 -\b- Expands to the current option flags as specified upon invoca-
757 tion, by the s\bse\bet\bt builtin command, or those set by the shell
758 itself (such as the -\b-i\bi option).
759 $\b$ Expands to the process ID of the shell. In a () subshell, it
760 expands to the process ID of the current shell, not the sub-
761 shell.
762 !\b! Expands to the process ID of the job most recently placed into
763 the background, whether executed as an asynchronous command or
764 using the b\bbg\bg builtin (see J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL below).
765 0\b0 Expands to the name of the shell or shell script. This is set
766 at shell initialization. If b\bba\bas\bsh\bh is invoked with a file of com-
767 mands, $\b$0\b0 is set to the name of that file. If b\bba\bas\bsh\bh is started
768 with the -\b-c\bc option, then $\b$0\b0 is set to the first argument after
769 the string to be executed, if one is present. Otherwise, it is
770 set to the filename used to invoke b\bba\bas\bsh\bh, as given by argument
771 zero.
772 _\b_ At shell startup, set to the absolute pathname used to invoke
773 the shell or shell script being executed as passed in the envi-
774 ronment or argument list. Subsequently, expands to the last
775 argument to the previous simple command executed in the fore-
776 ground, after expansion. Also set to the full pathname used to
777 invoke each command executed and placed in the environment
778 exported to that command. When checking mail, this parameter
779 holds the name of the mail file currently being checked.
780
781 S\bSh\bhe\bel\bll\bl V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs
782 The following variables are set by the shell:
783
784 B\bBA\bAS\bSH\bH Expands to the full filename used to invoke this instance of
785 b\bba\bas\bsh\bh.
786 B\bBA\bAS\bSH\bHO\bOP\bPT\bTS\bS
787 A colon-separated list of enabled shell options. Each word in
788 the list is a valid argument for the -\b-s\bs option to the s\bsh\bho\bop\bpt\bt
789 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
790 appearing in B\bBA\bAS\bSH\bHO\bOP\bPT\bTS\bS are those reported as _\bo_\bn by s\bsh\bho\bop\bpt\bt. If
791 this variable is in the environment when b\bba\bas\bsh\bh starts up, each
792 shell option in the list will be enabled before reading any
793 startup files. This variable is read-only.
794 B\bBA\bAS\bSH\bHP\bPI\bID\bD
795 Expands to the process ID of the current b\bba\bas\bsh\bh process. This
796 differs from $\b$$\b$ under certain circumstances, such as subshells
797 that do not require b\bba\bas\bsh\bh to be re-initialized. Assignments to
798 B\bBA\bAS\bSH\bHP\bPI\bID\bD have no effect. If B\bBA\bAS\bSH\bHP\bPI\bID\bD is unset, it loses its spe-
799 cial properties, even if it is subsequently reset.
800 B\bBA\bAS\bSH\bH_\b_A\bAL\bLI\bIA\bAS\bSE\bES\bS
801 An associative array variable whose members correspond to the
802 internal list of aliases as maintained by the a\bal\bli\bia\bas\bs builtin.
803 Elements added to this array appear in the alias list; however,
804 unsetting array elements currently does not cause aliases to be
805 removed from the alias list. If B\bBA\bAS\bSH\bH_\b_A\bAL\bLI\bIA\bAS\bSE\bES\bS is unset, it loses
806 its special properties, even if it is subsequently reset.
807 B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGC\bC
808 An array variable whose values are the number of parameters in
809 each frame of the current b\bba\bas\bsh\bh execution call stack. The number
810 of parameters to the current subroutine (shell function or
811 script executed with .\b. or s\bso\bou\bur\brc\bce\be) is at the top of the stack.
812 When a subroutine is executed, the number of parameters passed
813 is pushed onto B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGC\bC. The shell sets B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGC\bC only when in
814 extended debugging mode (see the description of the e\bex\bxt\btd\bde\beb\bbu\bug\bg
815 option to the s\bsh\bho\bop\bpt\bt builtin below). Setting e\bex\bxt\btd\bde\beb\bbu\bug\bg after the
816 shell has started to execute a script, or referencing this vari-
817 able when e\bex\bxt\btd\bde\beb\bbu\bug\bg is not set, may result in inconsistent val-
818 ues.
819 B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV
820 An array variable containing all of the parameters in the cur-
821 rent b\bba\bas\bsh\bh execution call stack. The final parameter of the last
822 subroutine call is at the top of the stack; the first parameter
823 of the initial call is at the bottom. When a subroutine is exe-
824 cuted, the parameters supplied are pushed onto B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV. The
825 shell sets B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV only when in extended debugging mode (see
826 the description of the e\bex\bxt\btd\bde\beb\bbu\bug\bg option to the s\bsh\bho\bop\bpt\bt builtin
827 below). Setting e\bex\bxt\btd\bde\beb\bbu\bug\bg after the shell has started to execute
828 a script, or referencing this variable when e\bex\bxt\btd\bde\beb\bbu\bug\bg is not set,
829 may result in inconsistent values.
830 B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV0\b0
831 When referenced, this variable expands to the name of the shell
832 or shell script (identical to $\b$0\b0; see the description of special
833 parameter 0 above). Assignment to B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV0\b0 causes the value
834 assigned to also be assigned to $\b$0\b0. If B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV0\b0 is unset, it
835 loses its special properties, even if it is subsequently reset.
836 B\bBA\bAS\bSH\bH_\b_C\bCM\bMD\bDS\bS
837 An associative array variable whose members correspond to the
838 internal hash table of commands as maintained by the h\bha\bas\bsh\bh
839 builtin. Elements added to this array appear in the hash table;
840 however, unsetting array elements currently does not cause com-
841 mand names to be removed from the hash table. If B\bBA\bAS\bSH\bH_\b_C\bCM\bMD\bDS\bS is
842 unset, it loses its special properties, even if it is subse-
843 quently reset.
844 B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMM\bMA\bAN\bND\bD
845 The command currently being executed or about to be executed,
846 unless the shell is executing a command as the result of a trap,
847 in which case it is the command executing at the time of the
848 trap.
849 B\bBA\bAS\bSH\bH_\b_E\bEX\bXE\bEC\bCU\bUT\bTI\bIO\bON\bN_\b_S\bST\bTR\bRI\bIN\bNG\bG
850 The command argument to the -\b-c\bc invocation option.
851 B\bBA\bAS\bSH\bH_\b_L\bLI\bIN\bNE\bEN\bNO\bO
852 An array variable whose members are the line numbers in source
853 files where each corresponding member of F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE was invoked.
854 $\b${\b{B\bBA\bAS\bSH\bH_\b_L\bLI\bIN\bNE\bEN\bNO\bO[\b[_\b$_\bi]\b]}\b} is the line number in the source file
855 ($\b${\b{B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE[\b[_\b$_\bi_\b+_\b1]\b]}\b}) where $\b${\b{F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE[\b[_\b$_\bi]\b]}\b} was called (or
856 $\b${\b{B\bBA\bAS\bSH\bH_\b_L\bLI\bIN\bNE\bEN\bNO\bO[\b[_\b$_\bi_\b-_\b1]\b]}\b} if referenced within another shell func-
857 tion). Use L\bLI\bIN\bNE\bEN\bNO\bO to obtain the current line number.
858 B\bBA\bAS\bSH\bH_\b_L\bLO\bOA\bAD\bDA\bAB\bBL\bLE\bES\bS_\b_P\bPA\bAT\bTH\bH
859 A colon-separated list of directories in which the shell looks
860 for dynamically loadable builtins specified by the e\ben\bna\bab\bbl\ble\be com-
861 mand.
862 B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH
863 An array variable whose members are assigned by the =\b=~\b~ binary
864 operator to the [\b[[\b[ conditional command. The element with index
865 0 is the portion of the string matching the entire regular
866 expression. The element with index _\bn is the portion of the
867 string matching the _\bnth parenthesized subexpression. This vari-
868 able is read-only.
869 B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE
870 An array variable whose members are the source filenames where
871 the corresponding shell function names in the F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE array
872 variable are defined. The shell function $\b${\b{F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE[\b[_\b$_\bi]\b]}\b} is
873 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
874 $\b${\b{B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE[\b[_\b$_\bi_\b+_\b1]\b]}\b}.
875 B\bBA\bAS\bSH\bH_\b_S\bSU\bUB\bBS\bSH\bHE\bEL\bLL\bL
876 Incremented by one within each subshell or subshell environment
877 when the shell begins executing in that environment. The ini-
878 tial value is 0.
879 B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO
880 A readonly array variable whose members hold version information
881 for this instance of b\bba\bas\bsh\bh. The values assigned to the array
882 members are as follows:
883 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).
884 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).
885 B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO[\b[2]\b] The patch level.
886 B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO[\b[3]\b] The build version.
887 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).
888 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.
889 B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIO\bON\bN
890 Expands to a string describing the version of this instance of
891 b\bba\bas\bsh\bh.
892 C\bCO\bOM\bMP\bP_\b_C\bCW\bWO\bOR\bRD\bD
893 An index into $\b${\b{C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDS\bS}\b} of the word containing the current
894 cursor position. This variable is available only in shell func-
895 tions invoked by the programmable completion facilities (see
896 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).
897 C\bCO\bOM\bMP\bP_\b_K\bKE\bEY\bY
898 The key (or final key of a key sequence) used to invoke the cur-
899 rent completion function.
900 C\bCO\bOM\bMP\bP_\b_L\bLI\bIN\bNE\bE
901 The current command line. This variable is available only in
902 shell functions and external commands invoked by the program-
903 mable 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).
904 C\bCO\bOM\bMP\bP_\b_P\bPO\bOI\bIN\bNT\bT
905 The index of the current cursor position relative to the begin-
906 ning of the current command. If the current cursor position is
907 at the end of the current command, the value of this variable is
908 equal to $\b${\b{#\b#C\bCO\bOM\bMP\bP_\b_L\bLI\bIN\bNE\bE}\b}. This variable is available only in
909 shell functions and external commands invoked by the program-
910 mable 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).
911 C\bCO\bOM\bMP\bP_\b_T\bTY\bYP\bPE\bE
912 Set to an integer value corresponding to the type of completion
913 attempted that caused a completion function to be called: _\bT_\bA_\bB,
914 for normal completion, _\b?, for listing completions after succes-
915 sive tabs, _\b!, for listing alternatives on partial word comple-
916 tion, _\b@, to list completions if the word is not unmodified, or
917 _\b%, for menu completion. This variable is available only in
918 shell functions and external commands invoked by the program-
919 mable 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).
920 C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS
921 The set of characters that the r\bre\bea\bad\bdl\bli\bin\bne\be library treats as word
922 separators when performing word completion. If C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS
923 is unset, it loses its special properties, even if it is subse-
924 quently reset.
925 C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDS\bS
926 An array variable (see A\bAr\brr\bra\bay\bys\bs below) consisting of the individ-
927 ual words in the current command line. The line is split into
928 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
929 described above. This variable is available only in shell func-
930 tions invoked by the programmable completion facilities (see
931 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).
932 C\bCO\bOP\bPR\bRO\bOC\bC An array variable (see A\bAr\brr\bra\bay\bys\bs below) created to hold the file
933 descriptors for output from and input to an unnamed coprocess
934 (see C\bCo\bop\bpr\bro\boc\bce\bes\bss\bse\bes\bs above).
935 D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK
936 An array variable (see A\bAr\brr\bra\bay\bys\bs below) containing the current con-
937 tents of the directory stack. Directories appear in the stack
938 in the order they are displayed by the d\bdi\bir\brs\bs builtin. Assigning
939 to members of this array variable may be used to modify directo-
940 ries already in the stack, but the p\bpu\bus\bsh\bhd\bd and p\bpo\bop\bpd\bd builtins must
941 be used to add and remove directories. Assignment to this vari-
942 able will not change the current directory. If D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK is
943 unset, it loses its special properties, even if it is subse-
944 quently reset.
945 E\bEP\bPO\bOC\bCH\bHR\bRE\bEA\bAL\bLT\bTI\bIM\bME\bE
946 Each time this parameter is referenced, it expands to the number
947 of seconds since the Unix Epoch (see _\bt_\bi_\bm_\be(3)) as a floating
948 point value with micro-second granularity. Assignments to
949 E\bEP\bPO\bOC\bCH\bHR\bRE\bEA\bAL\bLT\bTI\bIM\bME\bE are ignored. If E\bEP\bPO\bOC\bCH\bHR\bRE\bEA\bAL\bLT\bTI\bIM\bME\bE is unset, it loses
950 its special properties, even if it is subsequently reset.
951 E\bEP\bPO\bOC\bCH\bHS\bSE\bEC\bCO\bON\bND\bDS\bS
952 Each time this parameter is referenced, it expands to the number
953 of seconds since the Unix Epoch (see _\bt_\bi_\bm_\be(3)). Assignments to
954 E\bEP\bPO\bOC\bCH\bHS\bSE\bEC\bCO\bON\bND\bDS\bS are ignored. If E\bEP\bPO\bOC\bCH\bHS\bSE\bEC\bCO\bON\bND\bDS\bS is unset, it loses
955 its special properties, even if it is subsequently reset.
956 E\bEU\bUI\bID\bD Expands to the effective user ID of the current user, initial-
957 ized at shell startup. This variable is readonly.
958 F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE
959 An array variable containing the names of all shell functions
960 currently in the execution call stack. The element with index 0
961 is the name of any currently-executing shell function. The bot-
962 tom-most element (the one with the highest index) is "main".
963 This variable exists only when a shell function is executing.
964 Assignments to F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE have no effect. If F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE is unset,
965 it loses its special properties, even if it is subsequently
966 reset.
967
968 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.
969 Each element of F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE has corresponding elements in
970 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
971 instance, $\b${\b{F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE[\b[_\b$_\bi]\b]}\b} was called from the file
972 $\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
973 c\bca\bal\bll\ble\ber\br builtin displays the current call stack using this infor-
974 mation.
975 G\bGR\bRO\bOU\bUP\bPS\bS An array variable containing the list of groups of which the
976 current user is a member. Assignments to G\bGR\bRO\bOU\bUP\bPS\bS have no effect.
977 If G\bGR\bRO\bOU\bUP\bPS\bS is unset, it loses its special properties, even if it
978 is subsequently reset.
979 H\bHI\bIS\bST\bTC\bCM\bMD\bD
980 The history number, or index in the history list, of the current
981 command. If H\bHI\bIS\bST\bTC\bCM\bMD\bD is unset, it loses its special properties,
982 even if it is subsequently reset.
983 H\bHO\bOS\bST\bTN\bNA\bAM\bME\bE
984 Automatically set to the name of the current host.
985 H\bHO\bOS\bST\bTT\bTY\bYP\bPE\bE
986 Automatically set to a string that uniquely describes the type
987 of machine on which b\bba\bas\bsh\bh is executing. The default is system-
988 dependent.
989 L\bLI\bIN\bNE\bEN\bNO\bO Each time this parameter is referenced, the shell substitutes a
990 decimal number representing the current sequential line number
991 (starting with 1) within a script or function. When not in a
992 script or function, the value substituted is not guaranteed to
993 be meaningful. If L\bLI\bIN\bNE\bEN\bNO\bO is unset, it loses its special proper-
994 ties, even if it is subsequently reset.
995 M\bMA\bAC\bCH\bHT\bTY\bYP\bPE\bE
996 Automatically set to a string that fully describes the system
997 type on which b\bba\bas\bsh\bh is executing, in the standard GNU _\bc_\bp_\bu_\b-_\bc_\bo_\bm_\b-
998 _\bp_\ba_\bn_\by_\b-_\bs_\by_\bs_\bt_\be_\bm format. The default is system-dependent.
999 M\bMA\bAP\bPF\bFI\bIL\bLE\bE
1000 An array variable (see A\bAr\brr\bra\bay\bys\bs below) created to hold the text
1001 read by the m\bma\bap\bpf\bfi\bil\ble\be builtin when no variable name is supplied.
1002 O\bOL\bLD\bDP\bPW\bWD\bD The previous working directory as set by the c\bcd\bd command.
1003 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
1004 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).
1005 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
1006 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).
1007 O\bOS\bST\bTY\bYP\bPE\bE Automatically set to a string that describes the operating sys-
1008 tem on which b\bba\bas\bsh\bh is executing. The default is system-depen-
1009 dent.
1010 P\bPI\bIP\bPE\bES\bST\bTA\bAT\bTU\bUS\bS
1011 An array variable (see A\bAr\brr\bra\bay\bys\bs below) containing a list of exit
1012 status values from the processes in the most-recently-executed
1013 foreground pipeline (which may contain only a single command).
1014 P\bPP\bPI\bID\bD The process ID of the shell's parent. This variable is read-
1015 only.
1016 P\bPW\bWD\bD The current working directory as set by the c\bcd\bd command.
1017 R\bRA\bAN\bND\bDO\bOM\bM Each time this parameter is referenced, a random integer between
1018 0 and 32767 is generated. The sequence of random numbers may be
1019 initialized by assigning a value to R\bRA\bAN\bND\bDO\bOM\bM. If R\bRA\bAN\bND\bDO\bOM\bM is unset,
1020 it loses its special properties, even if it is subsequently
1021 reset.
1022 R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_L\bLI\bIN\bNE\bE
1023 The contents of the r\bre\bea\bad\bdl\bli\bin\bne\be line buffer, for use with "bind -x"
1024 (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).
1025 R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_P\bPO\bOI\bIN\bNT\bT
1026 The position of the insertion point in the r\bre\bea\bad\bdl\bli\bin\bne\be line buffer,
1027 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).
1028 R\bRE\bEP\bPL\bLY\bY Set to the line of input read by the r\bre\bea\bad\bd builtin command when
1029 no arguments are supplied.
1030 S\bSE\bEC\bCO\bON\bND\bDS\bS
1031 Each time this parameter is referenced, the number of seconds
1032 since shell invocation is returned. If a value is assigned to
1033 S\bSE\bEC\bCO\bON\bND\bDS\bS, the value returned upon subsequent references is the
1034 number of seconds since the assignment plus the value assigned.
1035 If S\bSE\bEC\bCO\bON\bND\bDS\bS is unset, it loses its special properties, even if it
1036 is subsequently reset.
1037 S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS
1038 A colon-separated list of enabled shell options. Each word in
1039 the list is a valid argument for the -\b-o\bo option to the s\bse\bet\bt
1040 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
1041 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
1042 this variable is in the environment when b\bba\bas\bsh\bh starts up, each
1043 shell option in the list will be enabled before reading any
1044 startup files. This variable is read-only.
1045 S\bSH\bHL\bLV\bVL\bL Incremented by one each time an instance of b\bba\bas\bsh\bh is started.
1046 U\bUI\bID\bD Expands to the user ID of the current user, initialized at shell
1047 startup. This variable is readonly.
1048
1049 The following variables are used by the shell. In some cases, b\bba\bas\bsh\bh
1050 assigns a default value to a variable; these cases are noted below.
1051
1052 B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMP\bPA\bAT\bT
1053 The value is used to set the shell's compatibility level. See
1054 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
1055 C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS for a description of the various compatibility levels
1056 and their effects. The value may be a decimal number (e.g.,
1057 4.2) or an integer (e.g., 42) corresponding to the desired com-
1058 patibility level. If B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMP\bPA\bAT\bT is unset or set to the empty
1059 string, the compatibility level is set to the default for the
1060 current version. If B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMP\bPA\bAT\bT is set to a value that is not
1061 one of the valid compatibility levels, the shell prints an error
1062 message and sets the compatibility level to the default for the
1063 current version. The valid compatibility levels correspond to
1064 the compatibility options accepted by the s\bsh\bho\bop\bpt\bt builtin
1065 described below (for example, c\bco\bom\bmp\bpa\bat\bt4\b42\b2 means that 4.2 and 42 are
1066 valid values). The current version is also a valid value.
1067 B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV
1068 If this parameter is set when b\bba\bas\bsh\bh is executing a shell script,
1069 its value is interpreted as a filename containing commands to
1070 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
1071 subjected to parameter expansion, command substitution, and
1072 arithmetic expansion before being interpreted as a filename.
1073 P\bPA\bAT\bTH\bH is not used to search for the resultant filename.
1074 B\bBA\bAS\bSH\bH_\b_X\bXT\bTR\bRA\bAC\bCE\bEF\bFD\bD
1075 If set to an integer corresponding to a valid file descriptor,
1076 b\bba\bas\bsh\bh will write the trace output generated when _\bs_\be_\bt _\b-_\bx is
1077 enabled to that file descriptor. The file descriptor is closed
1078 when B\bBA\bAS\bSH\bH_\b_X\bXT\bTR\bRA\bAC\bCE\bEF\bFD\bD is unset or assigned a new value. Unsetting
1079 B\bBA\bAS\bSH\bH_\b_X\bXT\bTR\bRA\bAC\bCE\bEF\bFD\bD or assigning it the empty string causes the trace
1080 output to be sent to the standard error. Note that setting
1081 B\bBA\bAS\bSH\bH_\b_X\bXT\bTR\bRA\bAC\bCE\bEF\bFD\bD to 2 (the standard error file descriptor) and then
1082 unsetting it will result in the standard error being closed.
1083 C\bCD\bDP\bPA\bAT\bTH\bH The search path for the c\bcd\bd command. This is a colon-separated
1084 list of directories in which the shell looks for destination
1085 directories specified by the c\bcd\bd command. A sample value is
1086 ".:~:/usr".
1087 C\bCH\bHI\bIL\bLD\bD_\b_M\bMA\bAX\bX
1088 Set the number of exited child status values for the shell to
1089 remember. Bash will not allow this value to be decreased below
1090 a POSIX-mandated minimum, and there is a maximum value (cur-
1091 rently 8192) that this may not exceed. The minimum value is
1092 system-dependent.
1093 C\bCO\bOL\bLU\bUM\bMN\bNS\bS
1094 Used by the s\bse\bel\ble\bec\bct\bt compound command to determine the terminal
1095 width when printing selection lists. Automatically set if the
1096 c\bch\bhe\bec\bck\bkw\bwi\bin\bns\bsi\biz\bze\be option is enabled or in an interactive shell upon
1097 receipt of a S\bSI\bIG\bGW\bWI\bIN\bNC\bCH\bH.
1098 C\bCO\bOM\bMP\bPR\bRE\bEP\bPL\bLY\bY
1099 An array variable from which b\bba\bas\bsh\bh reads the possible completions
1100 generated by a shell function invoked by the programmable com-
1101 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
1102 array element contains one possible completion.
1103 E\bEM\bMA\bAC\bCS\bS If b\bba\bas\bsh\bh finds this variable in the environment when the shell
1104 starts with value "t", it assumes that the shell is running in
1105 an Emacs shell buffer and disables line editing.
1106 E\bEN\bNV\bV Similar to B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV; used when the shell is invoked in _\bp_\bo_\bs_\bi_\bx
1107 _\bm_\bo_\bd_\be.
1108 E\bEX\bXE\bEC\bCI\bIG\bGN\bNO\bOR\bRE\bE
1109 A colon-separated list of shell patterns (see P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg)
1110 defining the list of filenames to be ignored by command search
1111 using P\bPA\bAT\bTH\bH. Files whose full pathnames match one of these pat-
1112 terns are not considered executable files for the purposes of
1113 completion and command execution via P\bPA\bAT\bTH\bH lookup. This does not
1114 affect the behavior of the [\b[, t\bte\bes\bst\bt, and [\b[[\b[ commands. Full path-
1115 names in the command hash table are not subject to E\bEX\bXE\bEC\bCI\bIG\bGN\bNO\bOR\bRE\bE.
1116 Use this variable to ignore shared library files that have the
1117 executable bit set, but are not executable files. The pattern
1118 matching honors the setting of the e\bex\bxt\btg\bgl\blo\bob\bb shell option.
1119 F\bFC\bCE\bED\bDI\bIT\bT The default editor for the f\bfc\bc builtin command.
1120 F\bFI\bIG\bGN\bNO\bOR\bRE\bE
1121 A colon-separated list of suffixes to ignore when performing
1122 filename completion (see R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE below). A filename whose suf-
1123 fix matches one of the entries in F\bFI\bIG\bGN\bNO\bOR\bRE\bE is excluded from the
1124 list of matched filenames. A sample value is ".o:~".
1125 F\bFU\bUN\bNC\bCN\bNE\bES\bST\bT
1126 If set to a numeric value greater than 0, defines a maximum
1127 function nesting level. Function invocations that exceed this
1128 nesting level will cause the current command to abort.
1129 G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE
1130 A colon-separated list of patterns defining the set of file
1131 names to be ignored by pathname expansion. If a file name
1132 matched by a pathname expansion pattern also matches one of the
1133 patterns in G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE, it is removed from the list of matches.
1134 H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL
1135 A colon-separated list of values controlling how commands are
1136 saved on the history list. If the list of values includes
1137 _\bi_\bg_\bn_\bo_\br_\be_\bs_\bp_\ba_\bc_\be, lines which begin with a s\bsp\bpa\bac\bce\be character are not
1138 saved in the history list. A value of _\bi_\bg_\bn_\bo_\br_\be_\bd_\bu_\bp_\bs causes lines
1139 matching the previous history entry to not be saved. A value of
1140 _\bi_\bg_\bn_\bo_\br_\be_\bb_\bo_\bt_\bh is shorthand for _\bi_\bg_\bn_\bo_\br_\be_\bs_\bp_\ba_\bc_\be and _\bi_\bg_\bn_\bo_\br_\be_\bd_\bu_\bp_\bs. A value
1141 of _\be_\br_\ba_\bs_\be_\bd_\bu_\bp_\bs causes all previous lines matching the current line
1142 to be removed from the history list before that line is saved.
1143 Any value not in the above list is ignored. If H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL is
1144 unset, or does not include a valid value, all lines read by the
1145 shell parser are saved on the history list, subject to the value
1146 of H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE. The second and subsequent lines of a multi-line
1147 compound command are not tested, and are added to the history
1148 regardless of the value of H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL.
1149 H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE
1150 The name of the file in which command history is saved (see H\bHI\bIS\bS-\b-
1151 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,
1152 the command history is not saved when a shell exits.
1153 H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bES\bSI\bIZ\bZE\bE
1154 The maximum number of lines contained in the history file. When
1155 this variable is assigned a value, the history file is trun-
1156 cated, if necessary, to contain no more than that number of
1157 lines by removing the oldest entries. The history file is also
1158 truncated to this size after writing it when a shell exits. If
1159 the value is 0, the history file is truncated to zero size.
1160 Non-numeric values and numeric values less than zero inhibit
1161 truncation. The shell sets the default value to the value of
1162 H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE after reading any startup files.
1163 H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE
1164 A colon-separated list of patterns used to decide which command
1165 lines should be saved on the history list. Each pattern is
1166 anchored at the beginning of the line and must match the com-
1167 plete line (no implicit `*\b*' is appended). Each pattern is
1168 tested against the line after the checks specified by H\bHI\bIS\bST\bTC\bCO\bON\bN-\b-
1169 T\bTR\bRO\bOL\bL are applied. In addition to the normal shell pattern
1170 matching characters, `&\b&' matches the previous history line. `&\b&'
1171 may be escaped using a backslash; the backslash is removed
1172 before attempting a match. The second and subsequent lines of a
1173 multi-line compound command are not tested, and are added to the
1174 history regardless of the value of H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE. The pattern
1175 matching honors the setting of the e\bex\bxt\btg\bgl\blo\bob\bb shell option.
1176 H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE
1177 The number of commands to remember in the command history (see
1178 H\bHI\bIS\bST\bTO\bOR\bRY\bY below). If the value is 0, commands are not saved in
1179 the history list. Numeric values less than zero result in every
1180 command being saved on the history list (there is no limit).
1181 The shell sets the default value to 500 after reading any
1182 startup files.
1183 H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT
1184 If this variable is set and not null, its value is used as a
1185 format string for _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be(3) to print the time stamp associated
1186 with each history entry displayed by the h\bhi\bis\bst\bto\bor\bry\by builtin. If
1187 this variable is set, time stamps are written to the history
1188 file so they may be preserved across shell sessions. This uses
1189 the history comment character to distinguish timestamps from
1190 other history lines.
1191 H\bHO\bOM\bME\bE The home directory of the current user; the default argument for
1192 the c\bcd\bd builtin command. The value of this variable is also used
1193 when performing tilde expansion.
1194 H\bHO\bOS\bST\bTF\bFI\bIL\bLE\bE
1195 Contains the name of a file in the same format as _\b/_\be_\bt_\bc_\b/_\bh_\bo_\bs_\bt_\bs
1196 that should be read when the shell needs to complete a hostname.
1197 The list of possible hostname completions may be changed while
1198 the shell is running; the next time hostname completion is
1199 attempted after the value is changed, b\bba\bas\bsh\bh adds the contents of
1200 the new file to the existing list. If H\bHO\bOS\bST\bTF\bFI\bIL\bLE\bE is set, but has
1201 no value, or does not name a readable file, b\bba\bas\bsh\bh attempts to
1202 read _\b/_\be_\bt_\bc_\b/_\bh_\bo_\bs_\bt_\bs to obtain the list of possible hostname comple-
1203 tions. When H\bHO\bOS\bST\bTF\bFI\bIL\bLE\bE is unset, the hostname list is cleared.
1204 I\bIF\bFS\bS The _\bI_\bn_\bt_\be_\br_\bn_\ba_\bl _\bF_\bi_\be_\bl_\bd _\bS_\be_\bp_\ba_\br_\ba_\bt_\bo_\br that is used for word splitting
1205 after expansion and to split lines into words with the r\bre\bea\bad\bd
1206 builtin command. The default value is ``<space><tab><new-
1207 line>''.
1208 I\bIG\bGN\bNO\bOR\bRE\bEE\bEO\bOF\bF
1209 Controls the action of an interactive shell on receipt of an E\bEO\bOF\bF
1210 character as the sole input. If set, the value is the number of
1211 consecutive E\bEO\bOF\bF characters which must be typed as the first
1212 characters on an input line before b\bba\bas\bsh\bh exits. If the variable
1213 exists but does not have a numeric value, or has no value, the
1214 default value is 10. If it does not exist, E\bEO\bOF\bF signifies the
1215 end of input to the shell.
1216 I\bIN\bNP\bPU\bUT\bTR\bRC\bC
1217 The filename for the r\bre\bea\bad\bdl\bli\bin\bne\be startup file, overriding the
1218 default of _\b~_\b/_\b._\bi_\bn_\bp_\bu_\bt_\br_\bc (see R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE below).
1219 I\bIN\bNS\bSI\bID\bDE\bE_\b_E\bEM\bMA\bAC\bCS\bS
1220 If this variable appears in the environment when the shell
1221 starts, b\bba\bas\bsh\bh assumes that it is running inside an Emacs shell
1222 buffer and may disable line editing, depending on the value of
1223 T\bTE\bER\bRM\bM.
1224 L\bLA\bAN\bNG\bG Used to determine the locale category for any category not
1225 specifically selected with a variable starting with L\bLC\bC_\b_.
1226 L\bLC\bC_\b_A\bAL\bLL\bL This variable overrides the value of L\bLA\bAN\bNG\bG and any other L\bLC\bC_\b_
1227 variable specifying a locale category.
1228 L\bLC\bC_\b_C\bCO\bOL\bLL\bLA\bAT\bTE\bE
1229 This variable determines the collation order used when sorting
1230 the results of pathname expansion, and determines the behavior
1231 of range expressions, equivalence classes, and collating
1232 sequences within pathname expansion and pattern matching.
1233 L\bLC\bC_\b_C\bCT\bTY\bYP\bPE\bE
1234 This variable determines the interpretation of characters and
1235 the behavior of character classes within pathname expansion and
1236 pattern matching.
1237 L\bLC\bC_\b_M\bME\bES\bSS\bSA\bAG\bGE\bES\bS
1238 This variable determines the locale used to translate double-
1239 quoted strings preceded by a $\b$.
1240 L\bLC\bC_\b_N\bNU\bUM\bME\bER\bRI\bIC\bC
1241 This variable determines the locale category used for number
1242 formatting.
1243 L\bLC\bC_\b_T\bTI\bIM\bME\bE
1244 This variable determines the locale category used for data and
1245 time formatting.
1246 L\bLI\bIN\bNE\bES\bS Used by the s\bse\bel\ble\bec\bct\bt compound command to determine the column
1247 length for printing selection lists. Automatically set if the
1248 c\bch\bhe\bec\bck\bkw\bwi\bin\bns\bsi\biz\bze\be option is enabled or in an interactive shell upon
1249 receipt of a S\bSI\bIG\bGW\bWI\bIN\bNC\bCH\bH.
1250 M\bMA\bAI\bIL\bL If this parameter is set to a file or directory name and the
1251 M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH variable is not set, b\bba\bas\bsh\bh informs the user of the
1252 arrival of mail in the specified file or Maildir-format direc-
1253 tory.
1254 M\bMA\bAI\bIL\bLC\bCH\bHE\bEC\bCK\bK
1255 Specifies how often (in seconds) b\bba\bas\bsh\bh checks for mail. The
1256 default is 60 seconds. When it is time to check for mail, the
1257 shell does so before displaying the primary prompt. If this
1258 variable is unset, or set to a value that is not a number
1259 greater than or equal to zero, the shell disables mail checking.
1260 M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH
1261 A colon-separated list of filenames to be checked for mail. The
1262 message to be printed when mail arrives in a particular file may
1263 be specified by separating the filename from the message with a
1264 `?'. When used in the text of the message, $\b$_\b_ expands to the
1265 name of the current mailfile. Example:
1266 M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH='/var/mail/bfox?"You have mail":~/shell-mail?"$_ has
1267 mail!"'
1268 B\bBa\bas\bsh\bh can be configured to supply a default value for this vari-
1269 able (there is no value by default), but the location of the
1270 user mail files that it uses is system dependent (e.g.,
1271 /var/mail/$\b$U\bUS\bSE\bER\bR).
1272 O\bOP\bPT\bTE\bER\bRR\bR If set to the value 1, b\bba\bas\bsh\bh displays error messages generated by
1273 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).
1274 O\bOP\bPT\bTE\bER\bRR\bR is initialized to 1 each time the shell is invoked or a
1275 shell script is executed.
1276 P\bPA\bAT\bTH\bH The search path for commands. It is a colon-separated list of
1277 directories in which the shell looks for commands (see C\bCO\bOM\bMM\bMA\bAN\bND\bD
1278 E\bEX\bXE\bEC\bCU\bUT\bTI\bIO\bON\bN below). A zero-length (null) directory name in the
1279 value of P\bPA\bAT\bTH\bH indicates the current directory. A null directory
1280 name may appear as two adjacent colons, or as an initial or
1281 trailing colon. The default path is system-dependent, and is
1282 set by the administrator who installs b\bba\bas\bsh\bh. A common value is
1283 ``/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin''.
1284 P\bPO\bOS\bSI\bIX\bXL\bLY\bY_\b_C\bCO\bOR\bRR\bRE\bEC\bCT\bT
1285 If this variable is in the environment when b\bba\bas\bsh\bh starts, the
1286 shell enters _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be before reading the startup files, as if
1287 the -\b--\b-p\bpo\bos\bsi\bix\bx invocation option had been supplied. If it is set
1288 while the shell is running, b\bba\bas\bsh\bh enables _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, as if the
1289 command _\bs_\be_\bt _\b-_\bo _\bp_\bo_\bs_\bi_\bx had been executed. When the shell enters
1290 _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, it sets this variable if it was not already set.
1291 P\bPR\bRO\bOM\bMP\bPT\bT_\b_C\bCO\bOM\bMM\bMA\bAN\bND\bD
1292 If set, the value is executed as a command prior to issuing each
1293 primary prompt.
1294 P\bPR\bRO\bOM\bMP\bPT\bT_\b_D\bDI\bIR\bRT\bTR\bRI\bIM\bM
1295 If set to a number greater than zero, the value is used as the
1296 number of trailing directory components to retain when expanding
1297 the \\b\w\bw and \\b\W\bW prompt string escapes (see P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG below).
1298 Characters removed are replaced with an ellipsis.
1299 P\bPS\bS0\b0 The value of this parameter is expanded (see P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG below)
1300 and displayed by interactive shells after reading a command and
1301 before the command is executed.
1302 P\bPS\bS1\b1 The value of this parameter is expanded (see P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG below)
1303 and used as the primary prompt string. The default value is
1304 ``\\b\s\bs-\b-\\b\v\bv\\b\$\b$ ''.
1305 P\bPS\bS2\b2 The value of this parameter is expanded as with P\bPS\bS1\b1 and used as
1306 the secondary prompt string. The default is ``>\b> ''.
1307 P\bPS\bS3\b3 The value of this parameter is used as the prompt for the s\bse\bel\ble\bec\bct\bt
1308 command (see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR above).
1309 P\bPS\bS4\b4 The value of this parameter is expanded as with P\bPS\bS1\b1 and the
1310 value is printed before each command b\bba\bas\bsh\bh displays during an
1311 execution trace. The first character of the expanded value of
1312 P\bPS\bS4\b4 is replicated multiple times, as necessary, to indicate mul-
1313 tiple levels of indirection. The default is ``+\b+ ''.
1314 S\bSH\bHE\bEL\bLL\bL The full pathname to the shell is kept in this environment vari-
1315 able. If it is not set when the shell starts, b\bba\bas\bsh\bh assigns to
1316 it the full pathname of the current user's login shell.
1317 T\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT
1318 The value of this parameter is used as a format string specify-
1319 ing how the timing information for pipelines prefixed with the
1320 t\bti\bim\bme\be reserved word should be displayed. The %\b% character intro-
1321 duces an escape sequence that is expanded to a time value or
1322 other information. The escape sequences and their meanings are
1323 as follows; the braces denote optional portions.
1324 %\b%%\b% A literal %\b%.
1325 %\b%[\b[_\bp]\b][\b[l\bl]\b]R\bR The elapsed time in seconds.
1326 %\b%[\b[_\bp]\b][\b[l\bl]\b]U\bU The number of CPU seconds spent in user mode.
1327 %\b%[\b[_\bp]\b][\b[l\bl]\b]S\bS The number of CPU seconds spent in system mode.
1328 %\b%P\bP The CPU percentage, computed as (%U + %S) / %R.
1329
1330 The optional _\bp is a digit specifying the _\bp_\br_\be_\bc_\bi_\bs_\bi_\bo_\bn, the number
1331 of fractional digits after a decimal point. A value of 0 causes
1332 no decimal point or fraction to be output. At most three places
1333 after the decimal point may be specified; values of _\bp greater
1334 than 3 are changed to 3. If _\bp is not specified, the value 3 is
1335 used.
1336
1337 The optional l\bl specifies a longer format, including minutes, of
1338 the form _\bM_\bMm_\bS_\bS._\bF_\bFs. The value of _\bp determines whether or not
1339 the fraction is included.
1340
1341 If this variable is not set, b\bba\bas\bsh\bh acts as if it had the value
1342 $\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,
1343 no timing information is displayed. A trailing newline is added
1344 when the format string is displayed.
1345 T\bTM\bMO\bOU\bUT\bT If set to a value greater than zero, T\bTM\bMO\bOU\bUT\bT is treated as the
1346 default timeout for the r\bre\bea\bad\bd builtin. The s\bse\bel\ble\bec\bct\bt command termi-
1347 nates if input does not arrive after T\bTM\bMO\bOU\bUT\bT seconds when input is
1348 coming from a terminal. In an interactive shell, the value is
1349 interpreted as the number of seconds to wait for a line of input
1350 after issuing the primary prompt. B\bBa\bas\bsh\bh terminates after waiting
1351 for that number of seconds if a complete line of input does not
1352 arrive.
1353 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
1354 b\bba\bas\bsh\bh creates temporary files for the shell's use.
1355 a\bau\but\bto\bo_\b_r\bre\bes\bsu\bum\bme\be
1356 This variable controls how the shell interacts with the user and
1357 job control. If this variable is set, single word simple com-
1358 mands without redirections are treated as candidates for resump-
1359 tion of an existing stopped job. There is no ambiguity allowed;
1360 if there is more than one job beginning with the string typed,
1361 the job most recently accessed is selected. The _\bn_\ba_\bm_\be of a
1362 stopped job, in this context, is the command line used to start
1363 it. If set to the value _\be_\bx_\ba_\bc_\bt, the string supplied must match
1364 the name of a stopped job exactly; if set to _\bs_\bu_\bb_\bs_\bt_\br_\bi_\bn_\bg, the
1365 string supplied needs to match a substring of the name of a
1366 stopped job. The _\bs_\bu_\bb_\bs_\bt_\br_\bi_\bn_\bg value provides functionality analo-
1367 gous to the %\b%?\b? job identifier (see J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL below). If set
1368 to any other value, the supplied string must be a prefix of a
1369 stopped job's name; this provides functionality analogous to the
1370 %\b%_\bs_\bt_\br_\bi_\bn_\bg job identifier.
1371 h\bhi\bis\bst\btc\bch\bha\bar\brs\bs
1372 The two or three characters which control history expansion and
1373 tokenization (see H\bHI\bIS\bST\bTO\bOR\bRY\bY E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN below). The first character
1374 is the _\bh_\bi_\bs_\bt_\bo_\br_\by _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn character, the character which signals
1375 the start of a history expansion, normally `!\b!'. The second
1376 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
1377 shorthand for re-running the previous command entered, substi-
1378 tuting one string for another in the command. The default is
1379 `^\b^'. The optional third character is the character which indi-
1380 cates that the remainder of the line is a comment when found as
1381 the first character of a word, normally `#\b#'. The history com-
1382 ment character causes history substitution to be skipped for the
1383 remaining words on the line. It does not necessarily cause the
1384 shell parser to treat the rest of the line as a comment.
1385
1386 A\bAr\brr\bra\bay\bys\bs
1387 B\bBa\bas\bsh\bh provides one-dimensional indexed and associative array variables.
1388 Any variable may be used as an indexed array; the d\bde\bec\bcl\bla\bar\bre\be builtin will
1389 explicitly declare an array. There is no maximum limit on the size of
1390 an array, nor any requirement that members be indexed or assigned con-
1391 tiguously. Indexed arrays are referenced using integers (including
1392 arithmetic expressions) and are zero-based; associative arrays are ref-
1393 erenced using arbitrary strings. Unless otherwise noted, indexed array
1394 indices must be non-negative integers.
1395
1396 An indexed array is created automatically if any variable is assigned
1397 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
1398 an arithmetic expression that must evaluate to a number. To explicitly
1399 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-
1400 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-
1401 _\bs_\bc_\br_\bi_\bp_\bt is ignored.
1402
1403 Associative arrays are created using d\bde\bec\bcl\bla\bar\bre\be -\b-A\bA _\bn_\ba_\bm_\be.
1404
1405 Attributes may be specified for an array variable using the d\bde\bec\bcl\bla\bar\bre\be and
1406 r\bre\bea\bad\bdo\bon\bnl\bly\by builtins. Each attribute applies to all members of an array.
1407
1408 Arrays are assigned to using compound assignments of the form
1409 _\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-
1410 _\bs_\bc_\br_\bi_\bp_\bt]=_\bs_\bt_\br_\bi_\bn_\bg. Indexed array assignments do not require anything but
1411 _\bs_\bt_\br_\bi_\bn_\bg. When assigning to indexed arrays, if the optional brackets and
1412 subscript are supplied, that index is assigned to; otherwise the index
1413 of the element assigned is the last index assigned to by the statement
1414 plus one. Indexing starts at zero.
1415
1416 When assigning to an associative array, the subscript is required.
1417
1418 This syntax is also accepted by the d\bde\bec\bcl\bla\bar\bre\be builtin. Individual array
1419 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
1420 introduced above. When assigning to an indexed array, if _\bn_\ba_\bm_\be is sub-
1421 scripted by a negative number, that number is interpreted as relative
1422 to one greater than the maximum index of _\bn_\ba_\bm_\be, so negative indices
1423 count back from the end of the array, and an index of -1 references the
1424 last element.
1425
1426 Any element of an array may be referenced using ${_\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]}.
1427 The braces are required to avoid conflicts with pathname expansion. If
1428 _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt is @\b@ or *\b*, the word expands to all members of _\bn_\ba_\bm_\be. These
1429 subscripts differ only when the word appears within double quotes. If
1430 the word is double-quoted, ${_\bn_\ba_\bm_\be[*]} expands to a single word with the
1431 value of each array member separated by the first character of the I\bIF\bFS\bS
1432 special variable, and ${_\bn_\ba_\bm_\be[@]} expands each element of _\bn_\ba_\bm_\be to a sep-
1433 arate word. When there are no array members, ${_\bn_\ba_\bm_\be[@]} expands to
1434 nothing. If the double-quoted expansion occurs within a word, the
1435 expansion of the first parameter is joined with the beginning part of
1436 the original word, and the expansion of the last parameter is joined
1437 with the last part of the original word. This is analogous to the
1438 expansion of the special parameters *\b* and @\b@ (see S\bSp\bpe\bec\bci\bia\bal\bl P\bPa\bar\bra\bam\bme\bet\bte\ber\brs\bs
1439 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-
1440 _\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-
1441 ments in the array. If the _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt used to reference an element of
1442 an indexed array evaluates to a number less than zero, it is inter-
1443 preted as relative to one greater than the maximum index of the array,
1444 so negative indices count back from the end of the array, and an index
1445 of -1 references the last element.
1446
1447 Referencing an array variable without a subscript is equivalent to ref-
1448 erencing the array with a subscript of 0. Any reference to a variable
1449 using a valid subscript is legal, and b\bba\bas\bsh\bh will create an array if nec-
1450 essary.
1451
1452 An array variable is considered set if a subscript has been assigned a
1453 value. The null string is a valid value.
1454
1455 It is possible to obtain the keys (indices) of an array as well as the
1456 values. ${!\b!_\bn_\ba_\bm_\be[_\b@]} and ${!\b!_\bn_\ba_\bm_\be[_\b*]} expand to the indices assigned in
1457 array variable _\bn_\ba_\bm_\be. The treatment when in double quotes is similar to
1458 the expansion of the special parameters _\b@ and _\b* within double quotes.
1459
1460 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]
1461 destroys the array element at index _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt, for both indexed and
1462 associative arrays. Negative subscripts to indexed arrays are inter-
1463 preted as described above. Unsetting the last element of an array
1464 variable does not unset the variable. u\bun\bns\bse\bet\bt _\bn_\ba_\bm_\be, where _\bn_\ba_\bm_\be is an
1465 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
1466 entire array.
1467
1468 When using a variable name with a subscript as an argument to a com-
1469 mand, such as with u\bun\bns\bse\bet\bt, without using the word expansion syntax
1470 described above, the argument is subject to pathname expansion. If
1471 pathname expansion is not desired, the argument should be quoted.
1472
1473 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
1474 specify an indexed array and a -\b-A\bA option to specify an associative
1475 array. If both options are supplied, -\b-A\bA takes precedence. The r\bre\bea\bad\bd
1476 builtin accepts a -\b-a\ba option to assign a list of words read from the
1477 standard input to an array. The s\bse\bet\bt and d\bde\bec\bcl\bla\bar\bre\be builtins display array
1478 values in a way that allows them to be reused as assignments.
1479
1480 E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN
1481 Expansion is performed on the command line after it has been split into
1482 words. There are seven kinds of expansion performed: _\bb_\br_\ba_\bc_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn,
1483 _\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-
1484 _\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.
1485
1486 The order of expansions is: brace expansion; tilde expansion, parameter
1487 and variable expansion, arithmetic expansion, and command substitution
1488 (done in a left-to-right fashion); word splitting; and pathname expan-
1489 sion.
1490
1491 On systems that can support it, there is an additional expansion avail-
1492 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
1493 tilde, parameter, variable, and arithmetic expansion and command sub-
1494 stitution.
1495
1496 After these expansions are performed, quote characters present in the
1497 original word are removed unless they have been quoted themselves
1498 (_\bq_\bu_\bo_\bt_\be _\br_\be_\bm_\bo_\bv_\ba_\bl).
1499
1500 Only brace expansion, word splitting, and pathname expansion can
1501 increase the number of words of the expansion; other expansions expand
1502 a single word to a single word. The only exceptions to this are the
1503 expansions of "$\b$@\b@" and "$\b${\b{_\bn_\ba_\bm_\be[\b[@\b@]\b]}\b}", and, in most cases, $\b$*\b* and
1504 $\b${\b{_\bn_\ba_\bm_\be[\b[*\b*]\b]}\b} as explained above (see P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS).
1505
1506 B\bBr\bra\bac\bce\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
1507 _\bB_\br_\ba_\bc_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn is a mechanism by which arbitrary strings may be gener-
1508 ated. This mechanism is similar to _\bp_\ba_\bt_\bh_\bn_\ba_\bm_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn, but the file-
1509 names generated need not exist. Patterns to be brace expanded take the
1510 form of an optional _\bp_\br_\be_\ba_\bm_\bb_\bl_\be, followed by either a series of comma-sep-
1511 arated strings or a sequence expression between a pair of braces, fol-
1512 lowed by an optional _\bp_\bo_\bs_\bt_\bs_\bc_\br_\bi_\bp_\bt. The preamble is prefixed to each
1513 string contained within the braces, and the postscript is then appended
1514 to each resulting string, expanding left to right.
1515
1516 Brace expansions may be nested. The results of each expanded string
1517 are not sorted; left to right order is preserved. For example,
1518 a{\b{d,c,b}\b}e expands into `ade ace abe'.
1519
1520 A sequence expression takes the form {\b{_\bx.\b..\b._\by[\b[.\b..\b._\bi_\bn_\bc_\br]\b]}\b}, where _\bx and _\by are
1521 either integers or single characters, and _\bi_\bn_\bc_\br, an optional increment,
1522 is an integer. When integers are supplied, the expression expands to
1523 each number between _\bx and _\by, inclusive. Supplied integers may be pre-
1524 fixed with _\b0 to force each term to have the same width. When either _\bx
1525 or _\by begins with a zero, the shell attempts to force all generated
1526 terms to contain the same number of digits, zero-padding where neces-
1527 sary. When characters are supplied, the expression expands to each
1528 character lexicographically between _\bx and _\by, inclusive, using the
1529 default C locale. Note that both _\bx and _\by must be of the same type.
1530 When the increment is supplied, it is used as the difference between
1531 each term. The default increment is 1 or -1 as appropriate.
1532
1533 Brace expansion is performed before any other expansions, and any char-
1534 acters special to other expansions are preserved in the result. It is
1535 strictly textual. B\bBa\bas\bsh\bh does not apply any syntactic interpretation to
1536 the context of the expansion or the text between the braces.
1537
1538 A correctly-formed brace expansion must contain unquoted opening and
1539 closing braces, and at least one unquoted comma or a valid sequence
1540 expression. Any incorrectly formed brace expansion is left unchanged.
1541 A {\b{ or ,\b, may be quoted with a backslash to prevent its being considered
1542 part of a brace expression. To avoid conflicts with parameter expan-
1543 sion, the string $\b${\b{ is not considered eligible for brace expansion, and
1544 inhibits brace expansion until the closing }\b}.
1545
1546 This construct is typically used as shorthand when the common prefix of
1547 the strings to be generated is longer than in the above example:
1548
1549 mkdir /usr/local/src/bash/{old,new,dist,bugs}
1550 or
1551 chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}
1552
1553 Brace expansion introduces a slight incompatibility with historical
1554 versions of s\bsh\bh. s\bsh\bh does not treat opening or closing braces specially
1555 when they appear as part of a word, and preserves them in the output.
1556 B\bBa\bas\bsh\bh removes braces from words as a consequence of brace expansion.
1557 For example, a word entered to s\bsh\bh as _\bf_\bi_\bl_\be_\b{_\b1_\b,_\b2_\b} appears identically in
1558 the output. The same word is output as _\bf_\bi_\bl_\be_\b1 _\bf_\bi_\bl_\be_\b2 after expansion by
1559 b\bba\bas\bsh\bh. If strict compatibility with s\bsh\bh is desired, start b\bba\bas\bsh\bh with the
1560 +\b+B\bB option or disable brace expansion with the +\b+B\bB option to the s\bse\bet\bt com-
1561 mand (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below).
1562
1563 T\bTi\bil\bld\bde\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
1564 If a word begins with an unquoted tilde character (`~\b~'), all of the
1565 characters preceding the first unquoted slash (or all characters, if
1566 there is no unquoted slash) are considered a _\bt_\bi_\bl_\bd_\be_\b-_\bp_\br_\be_\bf_\bi_\bx. If none of
1567 the characters in the tilde-prefix are quoted, the characters in the
1568 tilde-prefix following the tilde are treated as a possible _\bl_\bo_\bg_\bi_\bn _\bn_\ba_\bm_\be.
1569 If this login name is the null string, the tilde is replaced with the
1570 value of the shell parameter H\bHO\bOM\bME\bE. If H\bHO\bOM\bME\bE is unset, the home direc-
1571 tory of the user executing the shell is substituted instead. Other-
1572 wise, the tilde-prefix is replaced with the home directory associated
1573 with the specified login name.
1574
1575 If the tilde-prefix is a `~+', the value of the shell variable P\bPW\bWD\bD
1576 replaces the tilde-prefix. If the tilde-prefix is a `~-', the value of
1577 the shell variable O\bOL\bLD\bDP\bPW\bWD\bD, if it is set, is substituted. If the char-
1578 acters following the tilde in the tilde-prefix consist of a number _\bN,
1579 optionally prefixed by a `+' or a `-', the tilde-prefix is replaced
1580 with the corresponding element from the directory stack, as it would be
1581 displayed by the d\bdi\bir\brs\bs builtin invoked with the tilde-prefix as an argu-
1582 ment. If the characters following the tilde in the tilde-prefix con-
1583 sist of a number without a leading `+' or `-', `+' is assumed.
1584
1585 If the login name is invalid, or the tilde expansion fails, the word is
1586 unchanged.
1587
1588 Each variable assignment is checked for unquoted tilde-prefixes immedi-
1589 ately following a :\b: or the first =\b=. In these cases, tilde expansion is
1590 also performed. Consequently, one may use filenames with tildes in
1591 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
1592 expanded value.
1593
1594 Bash also performs tilde expansion on words satisfying the conditions
1595 of variable assignments (as described above under P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS) when they
1596 appear as arguments to simple commands. Bash does not do this, except
1597 for the _\bd_\be_\bc_\bl_\ba_\br_\ba_\bt_\bi_\bo_\bn commands listed above, when in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be.
1598
1599 P\bPa\bar\bra\bam\bme\bet\bte\ber\br E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
1600 The `$\b$' character introduces parameter expansion, command substitution,
1601 or arithmetic expansion. The parameter name or symbol to be expanded
1602 may be enclosed in braces, which are optional but serve to protect the
1603 variable to be expanded from characters immediately following it which
1604 could be interpreted as part of the name.
1605
1606 When braces are used, the matching ending brace is the first `}\b}' not
1607 escaped by a backslash or within a quoted string, and not within an
1608 embedded arithmetic expansion, command substitution, or parameter
1609 expansion.
1610
1611 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br}
1612 The value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is substituted. The braces are required
1613 when _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is a positional parameter with more than one
1614 digit, or when _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is followed by a character which is not
1615 to be interpreted as part of its name. The _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is a shell
1616 parameter as described above P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS) or an array reference
1617 (A\bAr\brr\bra\bay\bys\bs).
1618
1619 If the first character of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an exclamation point (!\b!), and
1620 _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is not a _\bn_\ba_\bm_\be_\br_\be_\bf, it introduces a level of indirection. B\bBa\bas\bsh\bh
1621 uses the value formed by expanding the rest of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br as the new
1622 _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br; this is then expanded and that value is used in the rest of
1623 the expansion, rather than the expansion of the original _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br.
1624 This is known as _\bi_\bn_\bd_\bi_\br_\be_\bc_\bt _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn. The value is subject to tilde
1625 expansion, parameter expansion, command substitution, and arithmetic
1626 expansion. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is a nameref, this expands to the name of the
1627 parameter referenced by _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br instead of performing the complete
1628 indirect expansion. The exceptions to this are the expansions of
1629 ${!\b!_\bp_\br_\be_\bf_\bi_\bx*\b*} and ${!\b!_\bn_\ba_\bm_\be[_\b@]} described below. The exclamation point
1630 must immediately follow the left brace in order to introduce indirec-
1631 tion.
1632
1633 In each of the cases below, _\bw_\bo_\br_\bd is subject to tilde expansion, parame-
1634 ter expansion, command substitution, and arithmetic expansion.
1635
1636 When not performing substring expansion, using the forms documented
1637 below (e.g., :\b:-\b-), b\bba\bas\bsh\bh tests for a parameter that is unset or null.
1638 Omitting the colon results in a test only for a parameter that is
1639 unset.
1640
1641 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:-\b-_\bw_\bo_\br_\bd}
1642 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-
1643 sion of _\bw_\bo_\br_\bd is substituted. Otherwise, the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
1644 is substituted.
1645 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:=\b=_\bw_\bo_\br_\bd}
1646 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
1647 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-
1648 _\be_\bt_\be_\br is then substituted. Positional parameters and special
1649 parameters may not be assigned to in this way.
1650 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:?\b?_\bw_\bo_\br_\bd}
1651 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,
1652 the expansion of _\bw_\bo_\br_\bd (or a message to that effect if _\bw_\bo_\br_\bd is
1653 not present) is written to the standard error and the shell, if
1654 it is not interactive, exits. Otherwise, the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
1655 is substituted.
1656 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:+\b+_\bw_\bo_\br_\bd}
1657 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
1658 substituted, otherwise the expansion of _\bw_\bo_\br_\bd is substituted.
1659 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:_\bo_\bf_\bf_\bs_\be_\bt}
1660 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:_\bo_\bf_\bf_\bs_\be_\bt:\b:_\bl_\be_\bn_\bg_\bt_\bh}
1661 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
1662 value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br starting at the character specified by _\bo_\bf_\bf_\b-
1663 _\bs_\be_\bt. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@, an indexed array subscripted by @\b@ or *\b*,
1664 or an associative array name, the results differ as described
1665 below. If _\bl_\be_\bn_\bg_\bt_\bh is omitted, expands to the substring of the
1666 value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br starting at the character specified by _\bo_\bf_\bf_\bs_\be_\bt
1667 and extending to the end of the value. _\bl_\be_\bn_\bg_\bt_\bh and _\bo_\bf_\bf_\bs_\be_\bt are
1668 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).
1669
1670 If _\bo_\bf_\bf_\bs_\be_\bt evaluates to a number less than zero, the value is
1671 used as an offset in characters from the end of the value of
1672 _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. If _\bl_\be_\bn_\bg_\bt_\bh evaluates to a number less than zero, it
1673 is interpreted as an offset in characters from the end of the
1674 value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br rather than a number of characters, and the
1675 expansion is the characters between _\bo_\bf_\bf_\bs_\be_\bt and that result.
1676 Note that a negative offset must be separated from the colon by
1677 at least one space to avoid being confused with the :\b:-\b- expan-
1678 sion.
1679
1680 If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@, the result is _\bl_\be_\bn_\bg_\bt_\bh positional parameters
1681 beginning at _\bo_\bf_\bf_\bs_\be_\bt. A negative _\bo_\bf_\bf_\bs_\be_\bt is taken relative to one
1682 greater than the greatest positional parameter, so an offset of
1683 -1 evaluates to the last positional parameter. It is an expan-
1684 sion error if _\bl_\be_\bn_\bg_\bt_\bh evaluates to a number less than zero.
1685
1686 If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an indexed array name subscripted by @ or *, the
1687 result is the _\bl_\be_\bn_\bg_\bt_\bh members of the array beginning with
1688 ${_\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
1689 one greater than the maximum index of the specified array. It
1690 is an expansion error if _\bl_\be_\bn_\bg_\bt_\bh evaluates to a number less than
1691 zero.
1692
1693 Substring expansion applied to an associative array produces
1694 undefined results.
1695
1696 Substring indexing is zero-based unless the positional parame-
1697 ters are used, in which case the indexing starts at 1 by
1698 default. If _\bo_\bf_\bf_\bs_\be_\bt is 0, and the positional parameters are
1699 used, $\b$0\b0 is prefixed to the list.
1700
1701 ${!\b!_\bp_\br_\be_\bf_\bi_\bx*\b*}
1702 ${!\b!_\bp_\br_\be_\bf_\bi_\bx@\b@}
1703 N\bNa\bam\bme\bes\bs m\bma\bat\btc\bch\bhi\bin\bng\bg p\bpr\bre\bef\bfi\bix\bx. Expands to the names of variables whose
1704 names begin with _\bp_\br_\be_\bf_\bi_\bx, separated by the first character of the
1705 I\bIF\bFS\bS special variable. When _\b@ is used and the expansion appears
1706 within double quotes, each variable name expands to a separate
1707 word.
1708
1709 ${!\b!_\bn_\ba_\bm_\be[_\b@]}
1710 ${!\b!_\bn_\ba_\bm_\be[_\b*]}
1711 L\bLi\bis\bst\bt o\bof\bf a\bar\brr\bra\bay\by k\bke\bey\bys\bs. If _\bn_\ba_\bm_\be is an array variable, expands to
1712 the list of array indices (keys) assigned in _\bn_\ba_\bm_\be. If _\bn_\ba_\bm_\be is
1713 not an array, expands to 0 if _\bn_\ba_\bm_\be is set and null otherwise.
1714 When _\b@ is used and the expansion appears within double quotes,
1715 each key expands to a separate word.
1716
1717 ${#\b#_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br}
1718 P\bPa\bar\bra\bam\bme\bet\bte\ber\br l\ble\ben\bng\bgt\bth\bh. The length in characters of the value of
1719 _\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
1720 substituted is the number of positional parameters. If _\bp_\ba_\br_\ba_\bm_\be_\b-
1721 _\bt_\be_\br is an array name subscripted by *\b* or @\b@, the value substi-
1722 tuted is the number of elements in the array. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is
1723 an indexed array name subscripted by a negative number, that
1724 number is interpreted as relative to one greater than the maxi-
1725 mum index of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br, so negative indices count back from the
1726 end of the array, and an index of -1 references the last ele-
1727 ment.
1728
1729 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br#\b#_\bw_\bo_\br_\bd}
1730 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br#\b##\b#_\bw_\bo_\br_\bd}
1731 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
1732 a pattern just as in pathname expansion, and matched against the
1733 expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br using the rules described under P\bPa\bat\bt-\b-
1734 t\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg below. If the pattern matches the beginning of
1735 the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br, then the result of the expansion is the
1736 expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br with the shortest matching pattern
1737 (the ``#\b#'' case) or the longest matching pattern (the ``#\b##\b#''
1738 case) deleted. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@ or *\b*, the pattern removal
1739 operation is applied to each positional parameter in turn, and
1740 the expansion is the resultant list. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an array
1741 variable subscripted with @\b@ or *\b*, the pattern removal operation
1742 is applied to each member of the array in turn, and the expan-
1743 sion is the resultant list.
1744
1745 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br%\b%_\bw_\bo_\br_\bd}
1746 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br%\b%%\b%_\bw_\bo_\br_\bd}
1747 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
1748 a pattern just as in pathname expansion, and matched against the
1749 expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br using the rules described under P\bPa\bat\bt-\b-
1750 t\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg below. If the pattern matches a trailing portion
1751 of the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br, then the result of the
1752 expansion is the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br with the shortest
1753 matching pattern (the ``%\b%'' case) or the longest matching pat-
1754 tern (the ``%\b%%\b%'' case) deleted. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@ or *\b*, the
1755 pattern removal operation is applied to each positional parame-
1756 ter in turn, and the expansion is the resultant list. If _\bp_\ba_\br_\ba_\bm_\b-
1757 _\be_\bt_\be_\br is an array variable subscripted with @\b@ or *\b*, the pattern
1758 removal operation is applied to each member of the array in
1759 turn, and the expansion is the resultant list.
1760
1761 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br/\b/_\bp_\ba_\bt_\bt_\be_\br_\bn/\b/_\bs_\bt_\br_\bi_\bn_\bg}
1762 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-
1763 tern just as in pathname expansion, _\bP_\ba_\br_\ba_\bm_\be_\bt_\be_\br is expanded and
1764 the longest match of _\bp_\ba_\bt_\bt_\be_\br_\bn against its value is replaced with
1765 _\bs_\bt_\br_\bi_\bn_\bg. The match is performed using the rules described under
1766 P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg below. If _\bp_\ba_\bt_\bt_\be_\br_\bn begins with /\b/, all matches
1767 of _\bp_\ba_\bt_\bt_\be_\br_\bn are replaced with _\bs_\bt_\br_\bi_\bn_\bg. Normally only the first
1768 match is replaced. If _\bp_\ba_\bt_\bt_\be_\br_\bn begins with #\b#, it must match at
1769 the beginning of the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. If _\bp_\ba_\bt_\bt_\be_\br_\bn
1770 begins with %\b%, it must match at the end of the expanded value of
1771 _\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
1772 and the /\b/ following _\bp_\ba_\bt_\bt_\be_\br_\bn may be omitted. If the n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh
1773 shell option is enabled, the match is performed without regard
1774 to the case of alphabetic characters. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@ or *\b*,
1775 the substitution operation is applied to each positional parame-
1776 ter in turn, and the expansion is the resultant list. If _\bp_\ba_\br_\ba_\bm_\b-
1777 _\be_\bt_\be_\br is an array variable subscripted with @\b@ or *\b*, the substitu-
1778 tion operation is applied to each member of the array in turn,
1779 and the expansion is the resultant list.
1780
1781 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br^\b^_\bp_\ba_\bt_\bt_\be_\br_\bn}
1782 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br^\b^^\b^_\bp_\ba_\bt_\bt_\be_\br_\bn}
1783 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br,\b,_\bp_\ba_\bt_\bt_\be_\br_\bn}
1784 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br,\b,,\b,_\bp_\ba_\bt_\bt_\be_\br_\bn}
1785 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-
1786 betic characters in _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. The _\bp_\ba_\bt_\bt_\be_\br_\bn is expanded to pro-
1787 duce a pattern just as in pathname expansion. Each character in
1788 the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is tested against _\bp_\ba_\bt_\bt_\be_\br_\bn, and,
1789 if it matches the pattern, its case is converted. The pattern
1790 should not attempt to match more than one character. The ^\b^
1791 operator converts lowercase letters matching _\bp_\ba_\bt_\bt_\be_\br_\bn to upper-
1792 case; the ,\b, operator converts matching uppercase letters to low-
1793 ercase. The ^\b^^\b^ and ,\b,,\b, expansions convert each matched character
1794 in the expanded value; the ^\b^ and ,\b, expansions match and convert
1795 only the first character in the expanded value. If _\bp_\ba_\bt_\bt_\be_\br_\bn is
1796 omitted, it is treated like a ?\b?, which matches every character.
1797 If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@ or *\b*, the case modification operation is
1798 applied to each positional parameter in turn, and the expansion
1799 is the resultant list. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an array variable sub-
1800 scripted with @\b@ or *\b*, the case modification operation is applied
1801 to each member of the array in turn, and the expansion is the
1802 resultant list.
1803
1804 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br@\b@_\bo_\bp_\be_\br_\ba_\bt_\bo_\br}
1805 P\bPa\bar\bra\bam\bme\bet\bte\ber\br t\btr\bra\ban\bns\bsf\bfo\bor\brm\bma\bat\bti\bio\bon\bn. The expansion is either a transforma-
1806 tion of the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br or information about _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
1807 itself, depending on the value of _\bo_\bp_\be_\br_\ba_\bt_\bo_\br. Each _\bo_\bp_\be_\br_\ba_\bt_\bo_\br is a
1808 single letter:
1809
1810 Q\bQ The expansion is a string that is the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
1811 quoted in a format that can be reused as input.
1812 E\bE The expansion is a string that is the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
1813 with backslash escape sequences expanded as with the
1814 $\b$'\b'.\b..\b..\b.'\b' quoting mechanism.
1815 P\bP The expansion is a string that is the result of expanding
1816 the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br as if it were a prompt string (see
1817 P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG below).
1818 A\bA The expansion is a string in the form of an assignment
1819 statement or d\bde\bec\bcl\bla\bar\bre\be command that, if evaluated, will
1820 recreate _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br with its attributes and value.
1821 a\ba The expansion is a string consisting of flag values rep-
1822 resenting _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br's attributes.
1823
1824 If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@ or *\b*, the operation is applied to each posi-
1825 tional parameter in turn, and the expansion is the resultant
1826 list. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an array variable subscripted with @\b@ or
1827 *\b*, the operation is applied to each member of the array in turn,
1828 and the expansion is the resultant list.
1829
1830 The result of the expansion is subject to word splitting and
1831 pathname expansion as described below.
1832
1833 C\bCo\bom\bmm\bma\ban\bnd\bd S\bSu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bn
1834 _\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-
1835 mand name. There are two forms:
1836
1837 $\b$(\b(_\bc_\bo_\bm_\bm_\ba_\bn_\bd)\b)
1838 or
1839 `\b`_\bc_\bo_\bm_\bm_\ba_\bn_\bd`\b`
1840
1841 B\bBa\bas\bsh\bh performs the expansion by executing _\bc_\bo_\bm_\bm_\ba_\bn_\bd in a subshell environ-
1842 ment and replacing the command substitution with the standard output of
1843 the command, with any trailing newlines deleted. Embedded newlines are
1844 not deleted, but they may be removed during word splitting. The com-
1845 mand substitution $\b$(\b(c\bca\bat\bt _\bf_\bi_\bl_\be)\b) can be replaced by the equivalent but
1846 faster $\b$(\b(<\b< _\bf_\bi_\bl_\be)\b).
1847
1848 When the old-style backquote form of substitution is used, backslash
1849 retains its literal meaning except when followed by $\b$, `\b`, or \\b\. The
1850 first backquote not preceded by a backslash terminates the command sub-
1851 stitution. When using the $(_\bc_\bo_\bm_\bm_\ba_\bn_\bd) form, all characters between the
1852 parentheses make up the command; none are treated specially.
1853
1854 Command substitutions may be nested. To nest when using the backquoted
1855 form, escape the inner backquotes with backslashes.
1856
1857 If the substitution appears within double quotes, word splitting and
1858 pathname expansion are not performed on the results.
1859
1860 A\bAr\bri\bit\bth\bhm\bme\bet\bti\bic\bc E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
1861 Arithmetic expansion allows the evaluation of an arithmetic expression
1862 and the substitution of the result. The format for arithmetic expan-
1863 sion is:
1864
1865 $\b$(\b((\b(_\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn)\b))\b)
1866
1867 The _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn is treated as if it were within double quotes, but a
1868 double quote inside the parentheses is not treated specially. All
1869 tokens in the expression undergo parameter and variable expansion, com-
1870 mand substitution, and quote removal. The result is treated as the
1871 arithmetic expression to be evaluated. Arithmetic expansions may be
1872 nested.
1873
1874 The evaluation is performed according to the rules listed below under
1875 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
1876 indicating failure and no substitution occurs.
1877
1878 P\bPr\bro\boc\bce\bes\bss\bs S\bSu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bn
1879 _\bP_\br_\bo_\bc_\be_\bs_\bs _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\bt_\bi_\bo_\bn allows a process's input or output to be referred
1880 to using a filename. It takes the form of <\b<(\b(_\bl_\bi_\bs_\bt)\b) or >\b>(\b(_\bl_\bi_\bs_\bt)\b). The
1881 process _\bl_\bi_\bs_\bt is run asynchronously, and its input or output appears as
1882 a filename. This filename is passed as an argument to the current com-
1883 mand as the result of the expansion. If the >\b>(\b(_\bl_\bi_\bs_\bt)\b) form is used,
1884 writing to the file will provide input for _\bl_\bi_\bs_\bt. If the <\b<(\b(_\bl_\bi_\bs_\bt)\b) form
1885 is used, the file passed as an argument should be read to obtain the
1886 output of _\bl_\bi_\bs_\bt. Process substitution is supported on systems that sup-
1887 port named pipes (_\bF_\bI_\bF_\bO_\bs) or the /\b/d\bde\bev\bv/\b/f\bfd\bd method of naming open files.
1888
1889 When available, process substitution is performed simultaneously with
1890 parameter and variable expansion, command substitution, and arithmetic
1891 expansion.
1892
1893 W\bWo\bor\brd\bd S\bSp\bpl\bli\bit\btt\bti\bin\bng\bg
1894 The shell scans the results of parameter expansion, command substitu-
1895 tion, and arithmetic expansion that did not occur within double quotes
1896 for _\bw_\bo_\br_\bd _\bs_\bp_\bl_\bi_\bt_\bt_\bi_\bn_\bg.
1897
1898 The shell treats each character of I\bIF\bFS\bS as a delimiter, and splits the
1899 results of the other expansions into words using these characters as
1900 field terminators. If I\bIF\bFS\bS is unset, or its value is exactly
1901 <\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>,
1902 and <\b<n\bne\bew\bwl\bli\bin\bne\be>\b> at the beginning and end of the results of the previous
1903 expansions are ignored, and any sequence of I\bIF\bFS\bS characters not at the
1904 beginning or end serves to delimit words. If I\bIF\bFS\bS has a value other
1905 than the default, then sequences of the whitespace characters s\bsp\bpa\bac\bce\be,
1906 t\bta\bab\bb, and n\bne\bew\bwl\bli\bin\bne\be are ignored at the beginning and end of the word, as
1907 long as the whitespace character is in the value of I\bIF\bFS\bS (an I\bIF\bFS\bS white-
1908 space character). Any character in I\bIF\bFS\bS that is not I\bIF\bFS\bS whitespace,
1909 along with any adjacent I\bIF\bFS\bS whitespace characters, delimits a field. A
1910 sequence of I\bIF\bFS\bS whitespace characters is also treated as a delimiter.
1911 If the value of I\bIF\bFS\bS is null, no word splitting occurs.
1912
1913 Explicit null arguments ("\b""\b" or '\b''\b') are retained and passed to commands
1914 as empty strings. Unquoted implicit null arguments, resulting from the
1915 expansion of parameters that have no values, are removed. If a parame-
1916 ter with no value is expanded within double quotes, a null argument
1917 results and is retained and passed to a command as an empty string.
1918 When a quoted null argument appears as part of a word whose expansion
1919 is non-null, the null argument is removed. That is, the word -d''
1920 becomes -d after word splitting and null argument removal.
1921
1922 Note that if no expansion occurs, no splitting is performed.
1923
1924 P\bPa\bat\bth\bhn\bna\bam\bme\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
1925 After word splitting, unless the -\b-f\bf option has been set, b\bba\bas\bsh\bh scans
1926 each word for the characters *\b*, ?\b?, and [\b[. If one of these characters
1927 appears, then the word is regarded as a _\bp_\ba_\bt_\bt_\be_\br_\bn, and replaced with an
1928 alphabetically sorted list of filenames matching the pattern (see P\bPa\bat\bt-\b-
1929 t\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg below). If no matching filenames are found, and the
1930 shell option n\bnu\bul\bll\blg\bgl\blo\bob\bb is not enabled, the word is left unchanged. If
1931 the n\bnu\bul\bll\blg\bgl\blo\bob\bb option is set, and no matches are found, the word is
1932 removed. If the f\bfa\bai\bil\blg\bgl\blo\bob\bb shell option is set, and no matches are
1933 found, an error message is printed and the command is not executed. If
1934 the shell option n\bno\boc\bca\bas\bse\beg\bgl\blo\bob\bb is enabled, the match is performed without
1935 regard to the case of alphabetic characters. When a pattern is used
1936 for pathname expansion, the character `\b``\b`.\b.'\b''\b' at the start of a name or
1937 immediately following a slash must be matched explicitly, unless the
1938 shell option d\bdo\bot\btg\bgl\blo\bob\bb is set. The filenames `\b``\b`.\b.'\b''\b' and `\b``\b`.\b..\b.'\b''\b' must
1939 always be matched explicitly, even if d\bdo\bot\btg\bgl\blo\bob\bb is set. In other cases,
1940 the `\b``\b`.\b.'\b''\b' character is not treated specially. When matching a path-
1941 name, the slash character must always be matched explicitly by a slash
1942 in the pattern, but in other matching contexts it can be matched by a
1943 special pattern character as described below under P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg.
1944 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
1945 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\blg\bgl\blo\bob\bb, and d\bdo\bot\btg\bgl\blo\bob\bb shell
1946 options.
1947
1948 The G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE shell variable may be used to restrict the set of file
1949 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
1950 name that also matches one of the patterns in G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE is removed
1951 from the list of matches. If the n\bno\boc\bca\bas\bse\beg\bgl\blo\bob\bb option is set, the match-
1952 ing against the patterns in G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE is performed without regard to
1953 case. The filenames `\b``\b`.\b.'\b''\b' and `\b``\b`.\b..\b.'\b''\b' are always ignored when G\bGL\bLO\bOB\bBI\bIG\bG-\b-
1954 N\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
1955 value has the effect of enabling the d\bdo\bot\btg\bgl\blo\bob\bb shell option, so all other
1956 filenames beginning with a `\b``\b`.\b.'\b''\b' will match. To get the old behavior
1957 of ignoring filenames beginning with a `\b``\b`.\b.'\b''\b', make `\b``\b`.\b.*\b*'\b''\b' one of the
1958 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
1959 is unset. The pattern matching honors the setting of the e\bex\bxt\btg\bgl\blo\bob\bb shell
1960 option.
1961
1962 P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg
1963
1964 Any character that appears in a pattern, other than the special pattern
1965 characters described below, matches itself. The NUL character may not
1966 occur in a pattern. A backslash escapes the following character; the
1967 escaping backslash is discarded when matching. The special pattern
1968 characters must be quoted if they are to be matched literally.
1969
1970 The special pattern characters have the following meanings:
1971
1972 *\b* Matches any string, including the null string. When the
1973 g\bgl\blo\bob\bbs\bst\bta\bar\br shell option is enabled, and *\b* is used in a
1974 pathname expansion context, two adjacent *\b*s used as a
1975 single pattern will match all files and zero or more
1976 directories and subdirectories. If followed by a /\b/, two
1977 adjacent *\b*s will match only directories and subdirecto-
1978 ries.
1979 ?\b? Matches any single character.
1980 [\b[.\b..\b..\b.]\b] Matches any one of the enclosed characters. A pair of
1981 characters separated by a hyphen denotes a _\br_\ba_\bn_\bg_\be _\be_\bx_\bp_\br_\be_\bs_\b-
1982 _\bs_\bi_\bo_\bn; any character that falls between those two charac-
1983 ters, inclusive, using the current locale's collating
1984 sequence and character set, is matched. If the first
1985 character following the [\b[ is a !\b! or a ^\b^ then any charac-
1986 ter not enclosed is matched. The sorting order of char-
1987 acters in range expressions is determined by the current
1988 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
1989 variables, if set. To obtain the traditional interpreta-
1990 tion of range expressions, where [\b[a\ba-\b-d\bd]\b] is equivalent to
1991 [\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
1992 enable the g\bgl\blo\bob\bba\bas\bsc\bci\bii\bir\bra\ban\bng\bge\bes\bs shell option. A -\b- may be
1993 matched by including it as the first or last character in
1994 the set. A ]\b] may be matched by including it as the first
1995 character in the set.
1996
1997 Within [\b[ and ]\b], _\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br _\bc_\bl_\ba_\bs_\bs_\be_\bs can be specified using
1998 the syntax [\b[:\b:_\bc_\bl_\ba_\bs_\bs:\b:]\b], where _\bc_\bl_\ba_\bs_\bs is one of the following
1999 classes defined in the POSIX standard:
2000 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
2001 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
2002 A character class matches any character belonging to that
2003 class. The w\bwo\bor\brd\bd character class matches letters, digits,
2004 and the character _.
2005
2006 Within [\b[ and ]\b], an _\be_\bq_\bu_\bi_\bv_\ba_\bl_\be_\bn_\bc_\be _\bc_\bl_\ba_\bs_\bs can be specified
2007 using the syntax [\b[=\b=_\bc=\b=]\b], which matches all characters with
2008 the same collation weight (as defined by the current
2009 locale) as the character _\bc.
2010
2011 Within [\b[ and ]\b], the syntax [\b[.\b._\bs_\by_\bm_\bb_\bo_\bl.\b.]\b] matches the collat-
2012 ing symbol _\bs_\by_\bm_\bb_\bo_\bl.
2013
2014 If the e\bex\bxt\btg\bgl\blo\bob\bb shell option is enabled using the s\bsh\bho\bop\bpt\bt builtin, several
2015 extended pattern matching operators are recognized. In the following
2016 description, a _\bp_\ba_\bt_\bt_\be_\br_\bn_\b-_\bl_\bi_\bs_\bt is a list of one or more patterns separated
2017 by a |\b|. Composite patterns may be formed using one or more of the fol-
2018 lowing sub-patterns:
2019
2020 ?\b?(\b(_\bp_\ba_\bt_\bt_\be_\br_\bn_\b-_\bl_\bi_\bs_\bt)\b)
2021 Matches zero or one occurrence of the given patterns
2022 *\b*(\b(_\bp_\ba_\bt_\bt_\be_\br_\bn_\b-_\bl_\bi_\bs_\bt)\b)
2023 Matches zero or more occurrences of the given patterns
2024 +\b+(\b(_\bp_\ba_\bt_\bt_\be_\br_\bn_\b-_\bl_\bi_\bs_\bt)\b)
2025 Matches one or more occurrences of the given patterns
2026 @\b@(\b(_\bp_\ba_\bt_\bt_\be_\br_\bn_\b-_\bl_\bi_\bs_\bt)\b)
2027 Matches one of the given patterns
2028 !\b!(\b(_\bp_\ba_\bt_\bt_\be_\br_\bn_\b-_\bl_\bi_\bs_\bt)\b)
2029 Matches anything except one of the given patterns
2030
2031 Complicated extended pattern matching against long strings is slow,
2032 especially when the patterns contain alternations and the strings con-
2033 tain multiple matches. Using separate matches against shorter strings,
2034 or using arrays of strings instead of a single long string, may be
2035 faster.
2036
2037 Q\bQu\buo\bot\bte\be R\bRe\bem\bmo\bov\bva\bal\bl
2038 After the preceding expansions, all unquoted occurrences of the charac-
2039 ters \\b\, '\b', and "\b" that did not result from one of the above expansions
2040 are removed.
2041
2042 R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN
2043 Before a command is executed, its input and output may be _\br_\be_\bd_\bi_\br_\be_\bc_\bt_\be_\bd
2044 using a special notation interpreted by the shell. Redirection allows
2045 commands' file handles to be duplicated, opened, closed, made to refer
2046 to different files, and can change the files the command reads from and
2047 writes to. Redirection may also be used to modify file handles in the
2048 current shell execution environment. The following redirection opera-
2049 tors may precede or appear anywhere within a _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd or may fol-
2050 low a _\bc_\bo_\bm_\bm_\ba_\bn_\bd. Redirections are processed in the order they appear,
2051 from left to right.
2052
2053 Each redirection that may be preceded by a file descriptor number may
2054 instead be preceded by a word of the form {_\bv_\ba_\br_\bn_\ba_\bm_\be}. In this case, for
2055 each redirection operator except >&- and <&-, the shell will allocate a
2056 file descriptor greater than or equal to 10 and assign it to _\bv_\ba_\br_\bn_\ba_\bm_\be.
2057 If >&- or <&- is preceded by {_\bv_\ba_\br_\bn_\ba_\bm_\be}, the value of _\bv_\ba_\br_\bn_\ba_\bm_\be defines
2058 the file descriptor to close. If {_\bv_\ba_\br_\bn_\ba_\bm_\be} is supplied, the redirect-
2059 ion persists beyond the scope of the command, allowing the shell pro-
2060 grammer to manage the file descriptor himself.
2061
2062 In the following descriptions, if the file descriptor number is omit-
2063 ted, and the first character of the redirection operator is <\b<, the re-
2064 direction refers to the standard input (file descriptor 0). If the
2065 first character of the redirection operator is >\b>, the redirection
2066 refers to the standard output (file descriptor 1).
2067
2068 The word following the redirection operator in the following descrip-
2069 tions, unless otherwise noted, is subjected to brace expansion, tilde
2070 expansion, parameter and variable expansion, command substitution,
2071 arithmetic expansion, quote removal, pathname expansion, and word
2072 splitting. If it expands to more than one word, b\bba\bas\bsh\bh reports an error.
2073
2074 Note that the order of redirections is significant. For example, the
2075 command
2076
2077 ls >\b> dirlist 2>\b>&\b&1
2078
2079 directs both standard output and standard error to the file _\bd_\bi_\br_\bl_\bi_\bs_\bt,
2080 while the command
2081
2082 ls 2>\b>&\b&1 >\b> dirlist
2083
2084 directs only the standard output to file _\bd_\bi_\br_\bl_\bi_\bs_\bt, because the standard
2085 error was duplicated from the standard output before the standard out-
2086 put was redirected to _\bd_\bi_\br_\bl_\bi_\bs_\bt.
2087
2088 B\bBa\bas\bsh\bh handles several filenames specially when they are used in redirec-
2089 tions, as described in the following table. If the operating system on
2090 which b\bba\bas\bsh\bh is running provides these special files, bash will use them;
2091 otherwise it will emulate them internally with the behavior described
2092 below.
2093
2094 /\b/d\bde\bev\bv/\b/f\bfd\bd/\b/_\bf_\bd
2095 If _\bf_\bd is a valid integer, file descriptor _\bf_\bd is dupli-
2096 cated.
2097 /\b/d\bde\bev\bv/\b/s\bst\btd\bdi\bin\bn
2098 File descriptor 0 is duplicated.
2099 /\b/d\bde\bev\bv/\b/s\bst\btd\bdo\bou\but\bt
2100 File descriptor 1 is duplicated.
2101 /\b/d\bde\bev\bv/\b/s\bst\btd\bde\ber\brr\br
2102 File descriptor 2 is duplicated.
2103 /\b/d\bde\bev\bv/\b/t\btc\bcp\bp/\b/_\bh_\bo_\bs_\bt/\b/_\bp_\bo_\br_\bt
2104 If _\bh_\bo_\bs_\bt is a valid hostname or Internet address, and _\bp_\bo_\br_\bt
2105 is an integer port number or service name, b\bba\bas\bsh\bh attempts
2106 to open the corresponding TCP socket.
2107 /\b/d\bde\bev\bv/\b/u\bud\bdp\bp/\b/_\bh_\bo_\bs_\bt/\b/_\bp_\bo_\br_\bt
2108 If _\bh_\bo_\bs_\bt is a valid hostname or Internet address, and _\bp_\bo_\br_\bt
2109 is an integer port number or service name, b\bba\bas\bsh\bh attempts
2110 to open the corresponding UDP socket.
2111
2112 A failure to open or create a file causes the redirection to fail.
2113
2114 Redirections using file descriptors greater than 9 should be used with
2115 care, as they may conflict with file descriptors the shell uses inter-
2116 nally.
2117
2118 R\bRe\bed\bdi\bir\bre\bec\bct\bti\bin\bng\bg I\bIn\bnp\bpu\but\bt
2119 Redirection of input causes the file whose name results from the expan-
2120 sion of _\bw_\bo_\br_\bd to be opened for reading on file descriptor _\bn, or the
2121 standard input (file descriptor 0) if _\bn is not specified.
2122
2123 The general format for redirecting input is:
2124
2125 [_\bn]<\b<_\bw_\bo_\br_\bd
2126
2127 R\bRe\bed\bdi\bir\bre\bec\bct\bti\bin\bng\bg O\bOu\but\btp\bpu\but\bt
2128 Redirection of output causes the file whose name results from the
2129 expansion of _\bw_\bo_\br_\bd to be opened for writing on file descriptor _\bn, or the
2130 standard output (file descriptor 1) if _\bn is not specified. If the file
2131 does not exist it is created; if it does exist it is truncated to zero
2132 size.
2133
2134 The general format for redirecting output is:
2135
2136 [_\bn]>\b>_\bw_\bo_\br_\bd
2137
2138 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
2139 builtin has been enabled, the redirection will fail if the file whose
2140 name results from the expansion of _\bw_\bo_\br_\bd exists and is a regular file.
2141 If the redirection operator is >\b>|\b|, or the redirection operator is >\b> and
2142 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-
2143 direction is attempted even if the file named by _\bw_\bo_\br_\bd exists.
2144
2145 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
2146 Redirection of output in this fashion causes the file whose name
2147 results from the expansion of _\bw_\bo_\br_\bd to be opened for appending on file
2148 descriptor _\bn, or the standard output (file descriptor 1) if _\bn is not
2149 specified. If the file does not exist it is created.
2150
2151 The general format for appending output is:
2152
2153 [_\bn]>\b>>\b>_\bw_\bo_\br_\bd
2154
2155 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
2156 This construct allows both the standard output (file descriptor 1) and
2157 the standard error output (file descriptor 2) to be redirected to the
2158 file whose name is the expansion of _\bw_\bo_\br_\bd.
2159
2160 There are two formats for redirecting standard output and standard
2161 error:
2162
2163 &\b&>\b>_\bw_\bo_\br_\bd
2164 and
2165 >\b>&\b&_\bw_\bo_\br_\bd
2166
2167 Of the two forms, the first is preferred. This is semantically equiva-
2168 lent to
2169
2170 >\b>_\bw_\bo_\br_\bd 2>\b>&\b&1
2171
2172 When using the second form, _\bw_\bo_\br_\bd may not expand to a number or -\b-. If
2173 it does, other redirection operators apply (see D\bDu\bup\bpl\bli\bic\bca\bat\bti\bin\bng\bg F\bFi\bil\ble\be
2174 D\bDe\bes\bsc\bcr\bri\bip\bpt\bto\bor\brs\bs below) for compatibility reasons.
2175
2176 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
2177 This construct allows both the standard output (file descriptor 1) and
2178 the standard error output (file descriptor 2) to be appended to the
2179 file whose name is the expansion of _\bw_\bo_\br_\bd.
2180
2181 The format for appending standard output and standard error is:
2182
2183 &\b&>\b>>\b>_\bw_\bo_\br_\bd
2184
2185 This is semantically equivalent to
2186
2187 >\b>>\b>_\bw_\bo_\br_\bd 2>\b>&\b&1
2188
2189 (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).
2190
2191 H\bHe\ber\bre\be D\bDo\boc\bcu\bum\bme\ben\bnt\bts\bs
2192 This type of redirection instructs the shell to read input from the
2193 current source until a line containing only _\bd_\be_\bl_\bi_\bm_\bi_\bt_\be_\br (with no trailing
2194 blanks) is seen. All of the lines read up to that point are then used
2195 as the standard input (or file descriptor _\bn if _\bn is specified) for a
2196 command.
2197
2198 The format of here-documents is:
2199
2200 [_\bn]<\b<<\b<[-\b-]_\bw_\bo_\br_\bd
2201 _\bh_\be_\br_\be_\b-_\bd_\bo_\bc_\bu_\bm_\be_\bn_\bt
2202 _\bd_\be_\bl_\bi_\bm_\bi_\bt_\be_\br
2203
2204 No parameter and variable expansion, command substitution, arithmetic
2205 expansion, or pathname expansion is performed on _\bw_\bo_\br_\bd. If any part of
2206 _\bw_\bo_\br_\bd is quoted, the _\bd_\be_\bl_\bi_\bm_\bi_\bt_\be_\br is the result of quote removal on _\bw_\bo_\br_\bd,
2207 and the lines in the here-document are not expanded. If _\bw_\bo_\br_\bd is
2208 unquoted, all lines of the here-document are subjected to parameter
2209 expansion, command substitution, and arithmetic expansion, the charac-
2210 ter sequence \\b\<\b<n\bne\bew\bwl\bli\bin\bne\be>\b> is ignored, and \\b\ must be used to quote the
2211 characters \\b\, $\b$, and `\b`.
2212
2213 If the redirection operator is <\b<<\b<-\b-, then all leading tab characters are
2214 stripped from input lines and the line containing _\bd_\be_\bl_\bi_\bm_\bi_\bt_\be_\br. This
2215 allows here-documents within shell scripts to be indented in a natural
2216 fashion.
2217
2218 H\bHe\ber\bre\be S\bSt\btr\bri\bin\bng\bgs\bs
2219 A variant of here documents, the format is:
2220
2221 [_\bn]<\b<<\b<<\b<_\bw_\bo_\br_\bd
2222
2223 The _\bw_\bo_\br_\bd undergoes tilde expansion, parameter and variable expansion,
2224 command substitution, arithmetic expansion, and quote removal. Path-
2225 name expansion and word splitting are not performed. The result is
2226 supplied as a single string, with a newline appended, to the command on
2227 its standard input (or file descriptor _\bn if _\bn is specified).
2228
2229 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
2230 The redirection operator
2231
2232 [_\bn]<\b<&\b&_\bw_\bo_\br_\bd
2233
2234 is used to duplicate input file descriptors. If _\bw_\bo_\br_\bd expands to one or
2235 more digits, the file descriptor denoted by _\bn is made to be a copy of
2236 that file descriptor. If the digits in _\bw_\bo_\br_\bd do not specify a file
2237 descriptor open for input, a redirection error occurs. If _\bw_\bo_\br_\bd evalu-
2238 ates to -\b-, file descriptor _\bn is closed. If _\bn is not specified, the
2239 standard input (file descriptor 0) is used.
2240
2241 The operator
2242
2243 [_\bn]>\b>&\b&_\bw_\bo_\br_\bd
2244
2245 is used similarly to duplicate output file descriptors. If _\bn is not
2246 specified, the standard output (file descriptor 1) is used. If the
2247 digits in _\bw_\bo_\br_\bd do not specify a file descriptor open for output, a re-
2248 direction error occurs. If _\bw_\bo_\br_\bd evaluates to -\b-, file descriptor _\bn is
2249 closed. As a special case, if _\bn is omitted, and _\bw_\bo_\br_\bd does not expand
2250 to one or more digits or -\b-, the standard output and standard error are
2251 redirected as described previously.
2252
2253 M\bMo\bov\bvi\bin\bng\bg F\bFi\bil\ble\be D\bDe\bes\bsc\bcr\bri\bip\bpt\bto\bor\brs\bs
2254 The redirection operator
2255
2256 [_\bn]<\b<&\b&_\bd_\bi_\bg_\bi_\bt-\b-
2257
2258 moves the file descriptor _\bd_\bi_\bg_\bi_\bt to file descriptor _\bn, or the standard
2259 input (file descriptor 0) if _\bn is not specified. _\bd_\bi_\bg_\bi_\bt is closed after
2260 being duplicated to _\bn.
2261
2262 Similarly, the redirection operator
2263
2264 [_\bn]>\b>&\b&_\bd_\bi_\bg_\bi_\bt-\b-
2265
2266 moves the file descriptor _\bd_\bi_\bg_\bi_\bt to file descriptor _\bn, or the standard
2267 output (file descriptor 1) if _\bn is not specified.
2268
2269 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
2270 The redirection operator
2271
2272 [_\bn]<\b<>\b>_\bw_\bo_\br_\bd
2273
2274 causes the file whose name is the expansion of _\bw_\bo_\br_\bd to be opened for
2275 both reading and writing on file descriptor _\bn, or on file descriptor 0
2276 if _\bn is not specified. If the file does not exist, it is created.
2277
2278 A\bAL\bLI\bIA\bAS\bSE\bES\bS
2279 _\bA_\bl_\bi_\ba_\bs_\be_\bs allow a string to be substituted for a word when it is used as
2280 the first word of a simple command. The shell maintains a list of
2281 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
2282 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
2283 simple command, if unquoted, is checked to see if it has an alias. If
2284 so, that word is replaced by the text of the alias. The characters /\b/,
2285 $\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
2286 listed above may not appear in an alias name. The replacement text may
2287 contain any valid shell input, including shell metacharacters. The
2288 first word of the replacement text is tested for aliases, but a word
2289 that is identical to an alias being expanded is not expanded a second
2290 time. This means that one may alias l\bls\bs to l\bls\bs -\b-F\bF, for instance, and
2291 b\bba\bas\bsh\bh does not try to recursively expand the replacement text. If the
2292 last character of the alias value is a _\bb_\bl_\ba_\bn_\bk, then the next command
2293 word following the alias is also checked for alias expansion.
2294
2295 Aliases are created and listed with the a\bal\bli\bia\bas\bs command, and removed with
2296 the u\bun\bna\bal\bli\bia\bas\bs command.
2297
2298 There is no mechanism for using arguments in the replacement text. If
2299 arguments are needed, a shell function should be used (see F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS
2300 below).
2301
2302 Aliases are not expanded when the shell is not interactive, unless the
2303 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
2304 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).
2305
2306 The rules concerning the definition and use of aliases are somewhat
2307 confusing. B\bBa\bas\bsh\bh always reads at least one complete line of input, and
2308 all lines that make up a compound command, before executing any of the
2309 commands on that line or the compound command. Aliases are expanded
2310 when a command is read, not when it is executed. Therefore, an alias
2311 definition appearing on the same line as another command does not take
2312 effect until the next line of input is read. The commands following
2313 the alias definition on that line are not affected by the new alias.
2314 This behavior is also an issue when functions are executed. Aliases
2315 are expanded when a function definition is read, not when the function
2316 is executed, because a function definition is itself a command. As a
2317 consequence, aliases defined in a function are not available until
2318 after that function is executed. To be safe, always put alias defini-
2319 tions on a separate line, and do not use a\bal\bli\bia\bas\bs in compound commands.
2320
2321 For almost every purpose, aliases are superseded by shell functions.
2322
2323 F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS
2324 A shell function, defined as described above under S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR,
2325 stores a series of commands for later execution. When the name of a
2326 shell function is used as a simple command name, the list of commands
2327 associated with that function name is executed. Functions are executed
2328 in the context of the current shell; no new process is created to
2329 interpret them (contrast this with the execution of a shell script).
2330 When a function is executed, the arguments to the function become the
2331 positional parameters during its execution. The special parameter #\b# is
2332 updated to reflect the change. Special parameter 0\b0 is unchanged. The
2333 first element of the F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE variable is set to the name of the func-
2334 tion while the function is executing.
2335
2336 All other aspects of the shell execution environment are identical
2337 between a function and its caller with these exceptions: the D\bDE\bEB\bBU\bUG\bG and
2338 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
2339 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
2340 given the t\btr\bra\bac\bce\be attribute (see the description of the d\bde\bec\bcl\bla\bar\bre\be builtin
2341 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
2342 builtin (in which case all functions inherit the D\bDE\bEB\bBU\bUG\bG and R\bRE\bET\bTU\bUR\bRN\bN
2343 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
2344 option has been enabled.
2345
2346 Variables local to the function may be declared with the l\blo\boc\bca\bal\bl builtin
2347 command. Ordinarily, variables and their values are shared between the
2348 function and its caller. If a variable is declared l\blo\boc\bca\bal\bl, the vari-
2349 able's visible scope is restricted to that function and its children
2350 (including the functions it calls). Local variables "shadow" variables
2351 with the same name declared at previous scopes. For instance, a local
2352 variable declared in a function hides a global variable of the same
2353 name: references and assignments refer to the local variable, leaving
2354 the global variable unmodified. When the function returns, the global
2355 variable is once again visible.
2356
2357 The shell uses _\bd_\by_\bn_\ba_\bm_\bi_\bc _\bs_\bc_\bo_\bp_\bi_\bn_\bg to control a variable's visibility
2358 within functions. With dynamic scoping, visible variables and their
2359 values are a result of the sequence of function calls that caused exe-
2360 cution to reach the current function. The value of a variable that a
2361 function sees depends on its value within its caller, if any, whether
2362 that caller is the "global" scope or another shell function. This is
2363 also the value that a local variable declaration "shadows", and the
2364 value that is restored when the function returns.
2365
2366 For example, if a variable _\bv_\ba_\br is declared as local in function _\bf_\bu_\bn_\bc_\b1,
2367 and _\bf_\bu_\bn_\bc_\b1 calls another function _\bf_\bu_\bn_\bc_\b2, references to _\bv_\ba_\br made from
2368 within _\bf_\bu_\bn_\bc_\b2 will resolve to the local variable _\bv_\ba_\br from _\bf_\bu_\bn_\bc_\b1, shadow-
2369 ing any global variable named _\bv_\ba_\br.
2370
2371 The u\bun\bns\bse\bet\bt builtin also acts using the same dynamic scope: if a variable
2372 is local to the current scope, u\bun\bns\bse\bet\bt will unset it; otherwise the unset
2373 will refer to the variable found in any calling scope as described
2374 above. If a variable at the current local scope is unset, it will
2375 remain so until it is reset in that scope or until the function
2376 returns. Once the function returns, any instance of the variable at a
2377 previous scope will become visible. If the unset acts on a variable at
2378 a previous scope, any instance of a variable with that name that had
2379 been shadowed will become visible.
2380
2381 The F\bFU\bUN\bNC\bCN\bNE\bES\bST\bT variable, if set to a numeric value greater than 0,
2382 defines a maximum function nesting level. Function invocations that
2383 exceed the limit cause the entire command to abort.
2384
2385 If the builtin command r\bre\bet\btu\bur\brn\bn is executed in a function, the function
2386 completes and execution resumes with the next command after the func-
2387 tion call. Any command associated with the R\bRE\bET\bTU\bUR\bRN\bN trap is executed
2388 before execution resumes. When a function completes, the values of the
2389 positional parameters and the special parameter #\b# are restored to the
2390 values they had prior to the function's execution.
2391
2392 Function names and definitions may be listed with the -\b-f\bf option to the
2393 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-
2394 s\bse\bet\bt will list the function names only (and optionally the source file
2395 and line number, if the e\bex\bxt\btd\bde\beb\bbu\bug\bg shell option is enabled). Functions
2396 may be exported so that subshells automatically have them defined with
2397 the -\b-f\bf option to the e\bex\bxp\bpo\bor\brt\bt builtin. A function definition may be
2398 deleted using the -\b-f\bf option to the u\bun\bns\bse\bet\bt builtin.
2399
2400 Functions may be recursive. The F\bFU\bUN\bNC\bCN\bNE\bES\bST\bT variable may be used to limit
2401 the depth of the function call stack and restrict the number of func-
2402 tion invocations. By default, no limit is imposed on the number of
2403 recursive calls.
2404
2405 A\bAR\bRI\bIT\bTH\bHM\bME\bET\bTI\bIC\bC E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN
2406 The shell allows arithmetic expressions to be evaluated, under certain
2407 circumstances (see the l\ble\bet\bt and d\bde\bec\bcl\bla\bar\bre\be builtin commands, the (\b((\b( com-
2408 pound command, and A\bAr\bri\bit\bth\bhm\bme\bet\bti\bic\bc E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn). Evaluation is done in fixed-
2409 width integers with no check for overflow, though division by 0 is
2410 trapped and flagged as an error. The operators and their precedence,
2411 associativity, and values are the same as in the C language. The fol-
2412 lowing list of operators is grouped into levels of equal-precedence
2413 operators. The levels are listed in order of decreasing precedence.
2414
2415 _\bi_\bd+\b++\b+ _\bi_\bd-\b--\b-
2416 variable post-increment and post-decrement
2417 -\b- +\b+ unary minus and plus
2418 +\b++\b+_\bi_\bd -\b--\b-_\bi_\bd
2419 variable pre-increment and pre-decrement
2420 !\b! ~\b~ logical and bitwise negation
2421 *\b**\b* exponentiation
2422 *\b* /\b/ %\b% multiplication, division, remainder
2423 +\b+ -\b- addition, subtraction
2424 <\b<<\b< >\b>>\b> left and right bitwise shifts
2425 <\b<=\b= >\b>=\b= <\b< >\b>
2426 comparison
2427 =\b==\b= !\b!=\b= equality and inequality
2428 &\b& bitwise AND
2429 ^\b^ bitwise exclusive OR
2430 |\b| bitwise OR
2431 &\b&&\b& logical AND
2432 |\b||\b| logical OR
2433 _\be_\bx_\bp_\br?\b?_\be_\bx_\bp_\br:\b:_\be_\bx_\bp_\br
2434 conditional operator
2435 =\b= *\b*=\b= /\b/=\b= %\b%=\b= +\b+=\b= -\b-=\b= <\b<<\b<=\b= >\b>>\b>=\b= &\b&=\b= ^\b^=\b= |\b|=\b=
2436 assignment
2437 _\be_\bx_\bp_\br_\b1 ,\b, _\be_\bx_\bp_\br_\b2
2438 comma
2439
2440 Shell variables are allowed as operands; parameter expansion is per-
2441 formed before the expression is evaluated. Within an expression, shell
2442 variables may also be referenced by name without using the parameter
2443 expansion syntax. A shell variable that is null or unset evaluates to
2444 0 when referenced by name without using the parameter expansion syntax.
2445 The value of a variable is evaluated as an arithmetic expression when
2446 it is referenced, or when a variable which has been given the _\bi_\bn_\bt_\be_\bg_\be_\br
2447 attribute using d\bde\bec\bcl\bla\bar\bre\be -\b-i\bi is assigned a value. A null value evaluates
2448 to 0. A shell variable need not have its _\bi_\bn_\bt_\be_\bg_\be_\br attribute turned on
2449 to be used in an expression.
2450
2451 Constants with a leading 0 are interpreted as octal numbers. A leading
2452 0x or 0X denotes hexadecimal. Otherwise, numbers take the form
2453 [_\bb_\ba_\bs_\be_\b#]n, where the optional _\bb_\ba_\bs_\be is a decimal number between 2 and 64
2454 representing the arithmetic base, and _\bn is a number in that base. If
2455 _\bb_\ba_\bs_\be_\b# is omitted, then base 10 is used. When specifying _\bn, the digits
2456 greater than 9 are represented by the lowercase letters, the uppercase
2457 letters, @, and _, in that order. If _\bb_\ba_\bs_\be is less than or equal to 36,
2458 lowercase and uppercase letters may be used interchangeably to repre-
2459 sent numbers between 10 and 35.
2460
2461 Operators are evaluated in order of precedence. Sub-expressions in
2462 parentheses are evaluated first and may override the precedence rules
2463 above.
2464
2465 C\bCO\bON\bND\bDI\bIT\bTI\bIO\bON\bNA\bAL\bL E\bEX\bXP\bPR\bRE\bES\bSS\bSI\bIO\bON\bNS\bS
2466 Conditional expressions are used by the [\b[[\b[ compound command and the
2467 t\bte\bes\bst\bt and [\b[ builtin commands to test file attributes and perform string
2468 and arithmetic comparisons. The t\bte\bes\bst\bt abd [\b[ commands determine their
2469 behavior based on the number of arguments; see the descriptions of
2470 those commands for any other command-specific actions.
2471
2472 Expressions are formed from the following unary or binary primaries.
2473 B\bBa\bas\bsh\bh handles several filenames specially when they are used in expres-
2474 sions. If the operating system on which b\bba\bas\bsh\bh is running provides these
2475 special files, bash will use them; otherwise it will emulate them
2476 internally with this behavior: If any _\bf_\bi_\bl_\be argument to one of the pri-
2477 maries is of the form _\b/_\bd_\be_\bv_\b/_\bf_\bd_\b/_\bn, then file descriptor _\bn is checked. If
2478 the _\bf_\bi_\bl_\be argument to one of the primaries is one of _\b/_\bd_\be_\bv_\b/_\bs_\bt_\bd_\bi_\bn,
2479 _\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,
2480 is checked.
2481
2482 Unless otherwise specified, primaries that operate on files follow sym-
2483 bolic links and operate on the target of the link, rather than the link
2484 itself.
2485
2486 When used with [\b[[\b[, the <\b< and >\b> operators sort lexicographically using
2487 the current locale. The t\bte\bes\bst\bt command sorts using ASCII ordering.
2488
2489 -\b-a\ba _\bf_\bi_\bl_\be
2490 True if _\bf_\bi_\bl_\be exists.
2491 -\b-b\bb _\bf_\bi_\bl_\be
2492 True if _\bf_\bi_\bl_\be exists and is a block special file.
2493 -\b-c\bc _\bf_\bi_\bl_\be
2494 True if _\bf_\bi_\bl_\be exists and is a character special file.
2495 -\b-d\bd _\bf_\bi_\bl_\be
2496 True if _\bf_\bi_\bl_\be exists and is a directory.
2497 -\b-e\be _\bf_\bi_\bl_\be
2498 True if _\bf_\bi_\bl_\be exists.
2499 -\b-f\bf _\bf_\bi_\bl_\be
2500 True if _\bf_\bi_\bl_\be exists and is a regular file.
2501 -\b-g\bg _\bf_\bi_\bl_\be
2502 True if _\bf_\bi_\bl_\be exists and is set-group-id.
2503 -\b-h\bh _\bf_\bi_\bl_\be
2504 True if _\bf_\bi_\bl_\be exists and is a symbolic link.
2505 -\b-k\bk _\bf_\bi_\bl_\be
2506 True if _\bf_\bi_\bl_\be exists and its ``sticky'' bit is set.
2507 -\b-p\bp _\bf_\bi_\bl_\be
2508 True if _\bf_\bi_\bl_\be exists and is a named pipe (FIFO).
2509 -\b-r\br _\bf_\bi_\bl_\be
2510 True if _\bf_\bi_\bl_\be exists and is readable.
2511 -\b-s\bs _\bf_\bi_\bl_\be
2512 True if _\bf_\bi_\bl_\be exists and has a size greater than zero.
2513 -\b-t\bt _\bf_\bd True if file descriptor _\bf_\bd is open and refers to a terminal.
2514 -\b-u\bu _\bf_\bi_\bl_\be
2515 True if _\bf_\bi_\bl_\be exists and its set-user-id bit is set.
2516 -\b-w\bw _\bf_\bi_\bl_\be
2517 True if _\bf_\bi_\bl_\be exists and is writable.
2518 -\b-x\bx _\bf_\bi_\bl_\be
2519 True if _\bf_\bi_\bl_\be exists and is executable.
2520 -\b-G\bG _\bf_\bi_\bl_\be
2521 True if _\bf_\bi_\bl_\be exists and is owned by the effective group id.
2522 -\b-L\bL _\bf_\bi_\bl_\be
2523 True if _\bf_\bi_\bl_\be exists and is a symbolic link.
2524 -\b-N\bN _\bf_\bi_\bl_\be
2525 True if _\bf_\bi_\bl_\be exists and has been modified since it was last
2526 read.
2527 -\b-O\bO _\bf_\bi_\bl_\be
2528 True if _\bf_\bi_\bl_\be exists and is owned by the effective user id.
2529 -\b-S\bS _\bf_\bi_\bl_\be
2530 True if _\bf_\bi_\bl_\be exists and is a socket.
2531 _\bf_\bi_\bl_\be_\b1 -\b-e\bef\bf _\bf_\bi_\bl_\be_\b2
2532 True if _\bf_\bi_\bl_\be_\b1 and _\bf_\bi_\bl_\be_\b2 refer to the same device and inode num-
2533 bers.
2534 _\bf_\bi_\bl_\be_\b1 -n\bnt\bt _\bf_\bi_\bl_\be_\b2
2535 True if _\bf_\bi_\bl_\be_\b1 is newer (according to modification date) than
2536 _\bf_\bi_\bl_\be_\b2, or if _\bf_\bi_\bl_\be_\b1 exists and _\bf_\bi_\bl_\be_\b2 does not.
2537 _\bf_\bi_\bl_\be_\b1 -o\bot\bt _\bf_\bi_\bl_\be_\b2
2538 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
2539 does not.
2540 -\b-o\bo _\bo_\bp_\bt_\bn_\ba_\bm_\be
2541 True if the shell option _\bo_\bp_\bt_\bn_\ba_\bm_\be is enabled. See the list of
2542 options under the description of the -\b-o\bo option to the s\bse\bet\bt
2543 builtin below.
2544 -\b-v\bv _\bv_\ba_\br_\bn_\ba_\bm_\be
2545 True if the shell variable _\bv_\ba_\br_\bn_\ba_\bm_\be is set (has been assigned a
2546 value).
2547 -\b-R\bR _\bv_\ba_\br_\bn_\ba_\bm_\be
2548 True if the shell variable _\bv_\ba_\br_\bn_\ba_\bm_\be is set and is a name refer-
2549 ence.
2550 -\b-z\bz _\bs_\bt_\br_\bi_\bn_\bg
2551 True if the length of _\bs_\bt_\br_\bi_\bn_\bg is zero.
2552 _\bs_\bt_\br_\bi_\bn_\bg
2553 -\b-n\bn _\bs_\bt_\br_\bi_\bn_\bg
2554 True if the length of _\bs_\bt_\br_\bi_\bn_\bg is non-zero.
2555
2556 _\bs_\bt_\br_\bi_\bn_\bg_\b1 =\b==\b= _\bs_\bt_\br_\bi_\bn_\bg_\b2
2557 _\bs_\bt_\br_\bi_\bn_\bg_\b1 =\b= _\bs_\bt_\br_\bi_\bn_\bg_\b2
2558 True if the strings are equal. =\b= should be used with the t\bte\bes\bst\bt
2559 command for POSIX conformance. When used with the [\b[[\b[ command,
2560 this performs pattern matching as described above (C\bCo\bom\bmp\bpo\bou\bun\bnd\bd C\bCo\bom\bm-\b-
2561 m\bma\ban\bnd\bds\bs).
2562
2563 _\bs_\bt_\br_\bi_\bn_\bg_\b1 !\b!=\b= _\bs_\bt_\br_\bi_\bn_\bg_\b2
2564 True if the strings are not equal.
2565
2566 _\bs_\bt_\br_\bi_\bn_\bg_\b1 <\b< _\bs_\bt_\br_\bi_\bn_\bg_\b2
2567 True if _\bs_\bt_\br_\bi_\bn_\bg_\b1 sorts before _\bs_\bt_\br_\bi_\bn_\bg_\b2 lexicographically.
2568
2569 _\bs_\bt_\br_\bi_\bn_\bg_\b1 >\b> _\bs_\bt_\br_\bi_\bn_\bg_\b2
2570 True if _\bs_\bt_\br_\bi_\bn_\bg_\b1 sorts after _\bs_\bt_\br_\bi_\bn_\bg_\b2 lexicographically.
2571
2572 _\ba_\br_\bg_\b1 O\bOP\bP _\ba_\br_\bg_\b2
2573 O\bOP\bP is one of -\b-e\beq\bq, -\b-n\bne\be, -\b-l\blt\bt, -\b-l\ble\be, -\b-g\bgt\bt, or -\b-g\bge\be. These arithmetic
2574 binary operators return true if _\ba_\br_\bg_\b1 is equal to, not equal to,
2575 less than, less than or equal to, greater than, or greater than
2576 or equal to _\ba_\br_\bg_\b2, respectively. _\bA_\br_\bg_\b1 and _\ba_\br_\bg_\b2 may be positive
2577 or negative integers. When used with the [\b[[\b[ command, _\bA_\br_\bg_\b1 and
2578 _\bA_\br_\bg_\b2 are evaluated as arithmetic expressions (see A\bAR\bRI\bIT\bTH\bHM\bME\bET\bTI\bIC\bC
2579 E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN above).
2580
2581 S\bSI\bIM\bMP\bPL\bLE\bE C\bCO\bOM\bMM\bMA\bAN\bND\bD E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN
2582 When a simple command is executed, the shell performs the following
2583 expansions, assignments, and redirections, from left to right.
2584
2585 1. The words that the parser has marked as variable assignments
2586 (those preceding the command name) and redirections are saved
2587 for later processing.
2588
2589 2. The words that are not variable assignments or redirections are
2590 expanded. If any words remain after expansion, the first word
2591 is taken to be the name of the command and the remaining words
2592 are the arguments.
2593
2594 3. Redirections are performed as described above under R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN.
2595
2596 4. The text after the =\b= in each variable assignment undergoes tilde
2597 expansion, parameter expansion, command substitution, arithmetic
2598 expansion, and quote removal before being assigned to the vari-
2599 able.
2600
2601 If no command name results, the variable assignments affect the current
2602 shell environment. Otherwise, the variables are added to the environ-
2603 ment of the executed command and do not affect the current shell envi-
2604 ronment. If any of the assignments attempts to assign a value to a
2605 readonly variable, an error occurs, and the command exits with a non-
2606 zero status.
2607
2608 If no command name results, redirections are performed, but do not
2609 affect the current shell environment. A redirection error causes the
2610 command to exit with a non-zero status.
2611
2612 If there is a command name left after expansion, execution proceeds as
2613 described below. Otherwise, the command exits. If one of the expan-
2614 sions contained a command substitution, the exit status of the command
2615 is the exit status of the last command substitution performed. If
2616 there were no command substitutions, the command exits with a status of
2617 zero.
2618
2619 C\bCO\bOM\bMM\bMA\bAN\bND\bD E\bEX\bXE\bEC\bCU\bUT\bTI\bIO\bON\bN
2620 After a command has been split into words, if it results in a simple
2621 command and an optional list of arguments, the following actions are
2622 taken.
2623
2624 If the command name contains no slashes, the shell attempts to locate
2625 it. If there exists a shell function by that name, that function is
2626 invoked as described above in F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS. If the name does not match a
2627 function, the shell searches for it in the list of shell builtins. If
2628 a match is found, that builtin is invoked.
2629
2630 If the name is neither a shell function nor a builtin, and contains no
2631 slashes, b\bba\bas\bsh\bh searches each element of the P\bPA\bAT\bTH\bH for a directory con-
2632 taining an executable file by that name. B\bBa\bas\bsh\bh uses a hash table to
2633 remember the full pathnames of executable files (see h\bha\bas\bsh\bh under S\bSH\bHE\bEL\bLL\bL
2634 B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below). A full search of the directories in P\bPA\bAT\bTH\bH is
2635 performed only if the command is not found in the hash table. If the
2636 search is unsuccessful, the shell searches for a defined shell function
2637 named c\bco\bom\bmm\bma\ban\bnd\bd_\b_n\bno\bot\bt_\b_f\bfo\bou\bun\bnd\bd_\b_h\bha\ban\bnd\bdl\ble\be. If that function exists, it is invoked
2638 in a separate execution environment with the original command and the
2639 original command's arguments as its arguments, and the function's exit
2640 status becomes the exit status of that subshell. If that function is
2641 not defined, the shell prints an error message and returns an exit sta-
2642 tus of 127.
2643
2644 If the search is successful, or if the command name contains one or
2645 more slashes, the shell executes the named program in a separate execu-
2646 tion environment. Argument 0 is set to the name given, and the remain-
2647 ing arguments to the command are set to the arguments given, if any.
2648
2649 If this execution fails because the file is not in executable format,
2650 and the file is not a directory, it is assumed to be a _\bs_\bh_\be_\bl_\bl _\bs_\bc_\br_\bi_\bp_\bt, a
2651 file containing shell commands. A subshell is spawned to execute it.
2652 This subshell reinitializes itself, so that the effect is as if a new
2653 shell had been invoked to handle the script, with the exception that
2654 the locations of commands remembered by the parent (see h\bha\bas\bsh\bh below
2655 under S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS) are retained by the child.
2656
2657 If the program is a file beginning with #\b#!\b!, the remainder of the first
2658 line specifies an interpreter for the program. The shell executes the
2659 specified interpreter on operating systems that do not handle this exe-
2660 cutable format themselves. The arguments to the interpreter consist of
2661 a single optional argument following the interpreter name on the first
2662 line of the program, followed by the name of the program, followed by
2663 the command arguments, if any.
2664
2665 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
2666 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-
2667 ing:
2668
2669 +\bo open files inherited by the shell at invocation, as modified by
2670 redirections supplied to the e\bex\bxe\bec\bc builtin
2671
2672 +\bo the current working directory as set by c\bcd\bd, p\bpu\bus\bsh\bhd\bd, or p\bpo\bop\bpd\bd, or
2673 inherited by the shell at invocation
2674
2675 +\bo the file creation mode mask as set by u\bum\bma\bas\bsk\bk or inherited from
2676 the shell's parent
2677
2678 +\bo current traps set by t\btr\bra\bap\bp
2679
2680 +\bo shell parameters that are set by variable assignment or with s\bse\bet\bt
2681 or inherited from the shell's parent in the environment
2682
2683 +\bo shell functions defined during execution or inherited from the
2684 shell's parent in the environment
2685
2686 +\bo options enabled at invocation (either by default or with com-
2687 mand-line arguments) or by s\bse\bet\bt
2688
2689 +\bo options enabled by s\bsh\bho\bop\bpt\bt
2690
2691 +\bo shell aliases defined with a\bal\bli\bia\bas\bs
2692
2693 +\bo various process IDs, including those of background jobs, the
2694 value of $\b$$\b$, and the value of P\bPP\bPI\bID\bD
2695
2696 When a simple command other than a builtin or shell function is to be
2697 executed, it is invoked in a separate execution environment that con-
2698 sists of the following. Unless otherwise noted, the values are inher-
2699 ited from the shell.
2700
2701
2702 +\bo the shell's open files, plus any modifications and additions
2703 specified by redirections to the command
2704
2705 +\bo the current working directory
2706
2707 +\bo the file creation mode mask
2708
2709 +\bo shell variables and functions marked for export, along with
2710 variables exported for the command, passed in the environment
2711
2712 +\bo traps caught by the shell are reset to the values inherited from
2713 the shell's parent, and traps ignored by the shell are ignored
2714
2715 A command invoked in this separate environment cannot affect the
2716 shell's execution environment.
2717
2718 Command substitution, commands grouped with parentheses, and asynchro-
2719 nous commands are invoked in a subshell environment that is a duplicate
2720 of the shell environment, except that traps caught by the shell are
2721 reset to the values that the shell inherited from its parent at invoca-
2722 tion. Builtin commands that are invoked as part of a pipeline are also
2723 executed in a subshell environment. Changes made to the subshell envi-
2724 ronment cannot affect the shell's execution environment.
2725
2726 Subshells spawned to execute command substitutions inherit the value of
2727 the -\b-e\be option from the parent shell. When not in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, b\bba\bas\bsh\bh
2728 clears the -\b-e\be option in such subshells.
2729
2730 If a command is followed by a &\b& and job control is not active, the
2731 default standard input for the command is the empty file _\b/_\bd_\be_\bv_\b/_\bn_\bu_\bl_\bl.
2732 Otherwise, the invoked command inherits the file descriptors of the
2733 calling shell as modified by redirections.
2734
2735 E\bEN\bNV\bVI\bIR\bRO\bON\bNM\bME\bEN\bNT\bT
2736 When a program is invoked it is given an array of strings called the
2737 _\be_\bn_\bv_\bi_\br_\bo_\bn_\bm_\be_\bn_\bt. This is a list of _\bn_\ba_\bm_\be-_\bv_\ba_\bl_\bu_\be pairs, of the form
2738 _\bn_\ba_\bm_\be=_\bv_\ba_\bl_\bu_\be.
2739
2740 The shell provides several ways to manipulate the environment. On
2741 invocation, the shell scans its own environment and creates a parameter
2742 for each name found, automatically marking it for _\be_\bx_\bp_\bo_\br_\bt to child pro-
2743 cesses. Executed commands inherit the environment. The e\bex\bxp\bpo\bor\brt\bt and
2744 d\bde\bec\bcl\bla\bar\bre\be -\b-x\bx commands allow parameters and functions to be added to and
2745 deleted from the environment. If the value of a parameter in the envi-
2746 ronment is modified, the new value becomes part of the environment,
2747 replacing the old. The environment inherited by any executed command
2748 consists of the shell's initial environment, whose values may be modi-
2749 fied in the shell, less any pairs removed by the u\bun\bns\bse\bet\bt command, plus
2750 any additions via the e\bex\bxp\bpo\bor\brt\bt and d\bde\bec\bcl\bla\bar\bre\be -\b-x\bx commands.
2751
2752 The environment for any _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd or function may be augmented
2753 temporarily by prefixing it with parameter assignments, as described
2754 above in P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS. These assignment statements affect only the envi-
2755 ronment seen by that command.
2756
2757 If the -\b-k\bk option is set (see the s\bse\bet\bt builtin command below), then _\ba_\bl_\bl
2758 parameter assignments are placed in the environment for a command, not
2759 just those that precede the command name.
2760
2761 When b\bba\bas\bsh\bh invokes an external command, the variable _\b_ is set to the
2762 full filename of the command and passed to that command in its environ-
2763 ment.
2764
2765 E\bEX\bXI\bIT\bT S\bST\bTA\bAT\bTU\bUS\bS
2766 The exit status of an executed command is the value returned by the
2767 _\bw_\ba_\bi_\bt_\bp_\bi_\bd system call or equivalent function. Exit statuses fall between
2768 0 and 255, though, as explained below, the shell may use values above
2769 125 specially. Exit statuses from shell builtins and compound commands
2770 are also limited to this range. Under certain circumstances, the shell
2771 will use special values to indicate specific failure modes.
2772
2773 For the shell's purposes, a command which exits with a zero exit status
2774 has succeeded. An exit status of zero indicates success. A non-zero
2775 exit status indicates failure. When a command terminates on a fatal
2776 signal _\bN, b\bba\bas\bsh\bh uses the value of 128+_\bN as the exit status.
2777
2778 If a command is not found, the child process created to execute it
2779 returns a status of 127. If a command is found but is not executable,
2780 the return status is 126.
2781
2782 If a command fails because of an error during expansion or redirection,
2783 the exit status is greater than zero.
2784
2785 Shell builtin commands return a status of 0 (_\bt_\br_\bu_\be) if successful, and
2786 non-zero (_\bf_\ba_\bl_\bs_\be) if an error occurs while they execute. All builtins
2787 return an exit status of 2 to indicate incorrect usage, generally
2788 invalid options or missing arguments.
2789
2790 B\bBa\bas\bsh\bh itself returns the exit status of the last command executed,
2791 unless a syntax error occurs, in which case it exits with a non-zero
2792 value. See also the e\bex\bxi\bit\bt builtin command below.
2793
2794 S\bSI\bIG\bGN\bNA\bAL\bLS\bS
2795 When b\bba\bas\bsh\bh is interactive, in the absence of any traps, it ignores
2796 S\bSI\bIG\bGT\bTE\bER\bRM\bM (so that k\bki\bil\bll\bl 0\b0 does not kill an interactive shell), and S\bSI\bIG\bGI\bIN\bNT\bT
2797 is caught and handled (so that the w\bwa\bai\bit\bt builtin is interruptible). In
2798 all cases, b\bba\bas\bsh\bh ignores S\bSI\bIG\bGQ\bQU\bUI\bIT\bT. If job control is in effect, b\bba\bas\bsh\bh
2799 ignores S\bSI\bIG\bGT\bTT\bTI\bIN\bN, S\bSI\bIG\bGT\bTT\bTO\bOU\bU, and S\bSI\bIG\bGT\bTS\bST\bTP\bP.
2800
2801 Non-builtin commands run by b\bba\bas\bsh\bh have signal handlers set to the values
2802 inherited by the shell from its parent. When job control is not in
2803 effect, asynchronous commands ignore S\bSI\bIG\bGI\bIN\bNT\bT and S\bSI\bIG\bGQ\bQU\bUI\bIT\bT in addition to
2804 these inherited handlers. Commands run as a result of command substi-
2805 tution ignore the keyboard-generated job control signals S\bSI\bIG\bGT\bTT\bTI\bIN\bN, S\bSI\bIG\bGT\bT-\b-
2806 T\bTO\bOU\bU, and S\bSI\bIG\bGT\bTS\bST\bTP\bP.
2807
2808 The shell exits by default upon receipt of a S\bSI\bIG\bGH\bHU\bUP\bP. Before exiting,
2809 an interactive shell resends the S\bSI\bIG\bGH\bHU\bUP\bP to all jobs, running or
2810 stopped. Stopped jobs are sent S\bSI\bIG\bGC\bCO\bON\bNT\bT to ensure that they receive the
2811 S\bSI\bIG\bGH\bHU\bUP\bP. To prevent the shell from sending the signal to a particular
2812 job, it should be removed from the jobs table with the d\bdi\bis\bso\bow\bwn\bn builtin
2813 (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below) or marked to not receive S\bSI\bIG\bGH\bHU\bUP\bP
2814 using d\bdi\bis\bso\bow\bwn\bn -\b-h\bh.
2815
2816 If the h\bhu\bup\bpo\bon\bne\bex\bxi\bit\bt shell option has been set with s\bsh\bho\bop\bpt\bt, b\bba\bas\bsh\bh sends a
2817 S\bSI\bIG\bGH\bHU\bUP\bP to all jobs when an interactive login shell exits.
2818
2819 If b\bba\bas\bsh\bh is waiting for a command to complete and receives a signal for
2820 which a trap has been set, the trap will not be executed until the com-
2821 mand completes. When b\bba\bas\bsh\bh is waiting for an asynchronous command via
2822 the w\bwa\bai\bit\bt builtin, the reception of a signal for which a trap has been
2823 set will cause the w\bwa\bai\bit\bt builtin to return immediately with an exit sta-
2824 tus greater than 128, immediately after which the trap is executed.
2825
2826 J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL
2827 _\bJ_\bo_\bb _\bc_\bo_\bn_\bt_\br_\bo_\bl refers to the ability to selectively stop (_\bs_\bu_\bs_\bp_\be_\bn_\bd) the
2828 execution of processes and continue (_\br_\be_\bs_\bu_\bm_\be) their execution at a later
2829 point. A user typically employs this facility via an interactive
2830 interface supplied jointly by the operating system kernel's terminal
2831 driver and b\bba\bas\bsh\bh.
2832
2833 The shell associates a _\bj_\bo_\bb with each pipeline. It keeps a table of
2834 currently executing jobs, which may be listed with the j\bjo\bob\bbs\bs command.
2835 When b\bba\bas\bsh\bh starts a job asynchronously (in the _\bb_\ba_\bc_\bk_\bg_\br_\bo_\bu_\bn_\bd), it prints a
2836 line that looks like:
2837
2838 [1] 25647
2839
2840 indicating that this job is job number 1 and that the process ID of the
2841 last process in the pipeline associated with this job is 25647. All of
2842 the processes in a single pipeline are members of the same job. B\bBa\bas\bsh\bh
2843 uses the _\bj_\bo_\bb abstraction as the basis for job control.
2844
2845 To facilitate the implementation of the user interface to job control,
2846 the operating system maintains the notion of a _\bc_\bu_\br_\br_\be_\bn_\bt _\bt_\be_\br_\bm_\bi_\bn_\ba_\bl _\bp_\br_\bo_\bc_\be_\bs_\bs
2847 _\bg_\br_\bo_\bu_\bp _\bI_\bD. Members of this process group (processes whose process group
2848 ID is equal to the current terminal process group ID) receive keyboard-
2849 generated signals such as S\bSI\bIG\bGI\bIN\bNT\bT. These processes are said to be in
2850 the _\bf_\bo_\br_\be_\bg_\br_\bo_\bu_\bn_\bd. _\bB_\ba_\bc_\bk_\bg_\br_\bo_\bu_\bn_\bd processes are those whose process group ID
2851 differs from the terminal's; such processes are immune to keyboard-gen-
2852 erated signals. Only foreground processes are allowed to read from or,
2853 if the user so specifies with stty tostop, write to the terminal.
2854 Background processes which attempt to read from (write to when stty
2855 tostop is in effect) the terminal are sent a S\bSI\bIG\bGT\bTT\bTI\bIN\bN (\b(S\bSI\bIG\bGT\bTT\bTO\bOU\bU)\b) signal
2856 by the kernel's terminal driver, which, unless caught, suspends the
2857 process.
2858
2859 If the operating system on which b\bba\bas\bsh\bh is running supports job control,
2860 b\bba\bas\bsh\bh contains facilities to use it. Typing the _\bs_\bu_\bs_\bp_\be_\bn_\bd character (typ-
2861 ically ^\b^Z\bZ, Control-Z) while a process is running causes that process to
2862 be stopped and returns control to b\bba\bas\bsh\bh. Typing the _\bd_\be_\bl_\ba_\by_\be_\bd _\bs_\bu_\bs_\bp_\be_\bn_\bd
2863 character (typically ^\b^Y\bY, Control-Y) causes the process to be stopped
2864 when it attempts to read input from the terminal, and control to be
2865 returned to b\bba\bas\bsh\bh. The user may then manipulate the state of this job,
2866 using the b\bbg\bg command to continue it in the background, the f\bfg\bg command
2867 to continue it in the foreground, or the k\bki\bil\bll\bl command to kill it. A ^\b^Z\bZ
2868 takes effect immediately, and has the additional side effect of causing
2869 pending output and typeahead to be discarded.
2870
2871 There are a number of ways to refer to a job in the shell. The charac-
2872 ter %\b% introduces a job specification (_\bj_\bo_\bb_\bs_\bp_\be_\bc). Job number _\bn may be
2873 referred to as %\b%n\bn. A job may also be referred to using a prefix of the
2874 name used to start it, or using a substring that appears in its command
2875 line. For example, %\b%c\bce\be refers to a stopped c\bce\be job. If a prefix
2876 matches more than one job, b\bba\bas\bsh\bh reports an error. Using %\b%?\b?c\bce\be, on the
2877 other hand, refers to any job containing the string c\bce\be in its command
2878 line. If the substring matches more than one job, b\bba\bas\bsh\bh reports an
2879 error. The symbols %\b%%\b% and %\b%+\b+ refer to the shell's notion of the _\bc_\bu_\br_\b-
2880 _\br_\be_\bn_\bt _\bj_\bo_\bb, which is the last job stopped while it was in the foreground
2881 or started in the background. The _\bp_\br_\be_\bv_\bi_\bo_\bu_\bs _\bj_\bo_\bb may be referenced using
2882 %\b%-\b-. If there is only a single job, %\b%+\b+ and %\b%-\b- can both be used to refer
2883 to that job. In output pertaining to jobs (e.g., the output of the
2884 j\bjo\bob\bbs\bs command), the current job is always flagged with a +\b+, and the pre-
2885 vious job with a -\b-. A single % (with no accompanying job specifica-
2886 tion) also refers to the current job.
2887
2888 Simply naming a job can be used to bring it into the foreground: %\b%1\b1 is
2889 a synonym for `\b``\b`f\bfg\bg %\b%1\b1'\b''\b', bringing job 1 from the background into the
2890 foreground. Similarly, `\b``\b`%\b%1\b1 &\b&'\b''\b' resumes job 1 in the background,
2891 equivalent to `\b``\b`b\bbg\bg %\b%1\b1'\b''\b'.
2892
2893 The shell learns immediately whenever a job changes state. Normally,
2894 b\bba\bas\bsh\bh waits until it is about to print a prompt before reporting changes
2895 in a job's status so as to not interrupt any other output. If the -\b-b\bb
2896 option to the s\bse\bet\bt builtin command is enabled, b\bba\bas\bsh\bh reports such changes
2897 immediately. Any trap on S\bSI\bIG\bGC\bCH\bHL\bLD\bD is executed for each child that
2898 exits.
2899
2900 If an attempt to exit b\bba\bas\bsh\bh is made while jobs are stopped (or, if the
2901 c\bch\bhe\bec\bck\bkj\bjo\bob\bbs\bs shell option has been enabled using the s\bsh\bho\bop\bpt\bt builtin, run-
2902 ning), the shell prints a warning message, and, if the c\bch\bhe\bec\bck\bkj\bjo\bob\bbs\bs option
2903 is enabled, lists the jobs and their statuses. The j\bjo\bob\bbs\bs command may
2904 then be used to inspect their status. If a second attempt to exit is
2905 made without an intervening command, the shell does not print another
2906 warning, and any stopped jobs are terminated.
2907
2908 When the shell is waiting for a job or process using the w\bwa\bai\bit\bt builtin,
2909 and job control is enabled, w\bwa\bai\bit\bt will return when the job changes
2910 state. The -\b-f\bf option will force w\bwa\bai\bit\bt to wait until the job or process
2911 terminates before returning.
2912
2913 P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG
2914 When executing interactively, b\bba\bas\bsh\bh displays the primary prompt P\bPS\bS1\b1 when
2915 it is ready to read a command, and the secondary prompt P\bPS\bS2\b2 when it
2916 needs more input to complete a command. B\bBa\bas\bsh\bh displays P\bPS\bS0\b0 after it
2917 reads a command but before executing it. B\bBa\bas\bsh\bh displays P\bPS\bS4\b4 as
2918 described above before tracing each command when the -\b-x\bx option is
2919 enabled. B\bBa\bas\bsh\bh allows these prompt strings to be customized by insert-
2920 ing a number of backslash-escaped special characters that are decoded
2921 as follows:
2922 \\b\a\ba an ASCII bell character (07)
2923 \\b\d\bd the date in "Weekday Month Date" format (e.g., "Tue May
2924 26")
2925 \\b\D\bD{\b{_\bf_\bo_\br_\bm_\ba_\bt}\b}
2926 the _\bf_\bo_\br_\bm_\ba_\bt is passed to _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be(3) and the result is
2927 inserted into the prompt string; an empty _\bf_\bo_\br_\bm_\ba_\bt results
2928 in a locale-specific time representation. The braces are
2929 required
2930 \\b\e\be an ASCII escape character (033)
2931 \\b\h\bh the hostname up to the first `.'
2932 \\b\H\bH the hostname
2933 \\b\j\bj the number of jobs currently managed by the shell
2934 \\b\l\bl the basename of the shell's terminal device name
2935 \\b\n\bn newline
2936 \\b\r\br carriage return
2937 \\b\s\bs the name of the shell, the basename of $\b$0\b0 (the portion
2938 following the final slash)
2939 \\b\t\bt the current time in 24-hour HH:MM:SS format
2940 \\b\T\bT the current time in 12-hour HH:MM:SS format
2941 \\b\@\b@ the current time in 12-hour am/pm format
2942 \\b\A\bA the current time in 24-hour HH:MM format
2943 \\b\u\bu the username of the current user
2944 \\b\v\bv the version of b\bba\bas\bsh\bh (e.g., 2.00)
2945 \\b\V\bV the release of b\bba\bas\bsh\bh, version + patch level (e.g., 2.00.0)
2946 \\b\w\bw the current working directory, with $\b$H\bHO\bOM\bME\bE abbreviated
2947 with a tilde (uses the value of the P\bPR\bRO\bOM\bMP\bPT\bT_\b_D\bDI\bIR\bRT\bTR\bRI\bIM\bM vari-
2948 able)
2949 \\b\W\bW the basename of the current working directory, with $\b$H\bHO\bOM\bME\bE
2950 abbreviated with a tilde
2951 \\b\!\b! the history number of this command
2952 \\b\#\b# the command number of this command
2953 \\b\$\b$ if the effective UID is 0, a #\b#, otherwise a $\b$
2954 \\b\_\bn_\bn_\bn the character corresponding to the octal number _\bn_\bn_\bn
2955 \\b\\\b\ a backslash
2956 \\b\[\b[ begin a sequence of non-printing characters, which could
2957 be used to embed a terminal control sequence into the
2958 prompt
2959 \\b\]\b] end a sequence of non-printing characters
2960
2961 The command number and the history number are usually different: the
2962 history number of a command is its position in the history list, which
2963 may include commands restored from the history file (see H\bHI\bIS\bST\bTO\bOR\bRY\bY
2964 below), while the command number is the position in the sequence of
2965 commands executed during the current shell session. After the string
2966 is decoded, it is expanded via parameter expansion, command substitu-
2967 tion, arithmetic expansion, and quote removal, subject to the value of
2968 the p\bpr\bro\bom\bmp\bpt\btv\bva\bar\brs\bs shell option (see the description of the s\bsh\bho\bop\bpt\bt command
2969 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).
2970
2971 R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE
2972 This is the library that handles reading input when using an interac-
2973 tive shell, unless the -\b--\b-n\bno\boe\bed\bdi\bit\bti\bin\bng\bg option is given at shell invocation.
2974 Line editing is also used when using the -\b-e\be option to the r\bre\bea\bad\bd builtin.
2975 By default, the line editing commands are similar to those of Emacs. A
2976 vi-style line editing interface is also available. Line editing can be
2977 enabled at any time using the -\b-o\bo e\bem\bma\bac\bcs\bs or -\b-o\bo v\bvi\bi options to the s\bse\bet\bt
2978 builtin (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below). To turn off line editing
2979 after the shell is running, use the +\b+o\bo e\bem\bma\bac\bcs\bs or +\b+o\bo v\bvi\bi options to the
2980 s\bse\bet\bt builtin.
2981
2982 R\bRe\bea\bad\bdl\bli\bin\bne\be N\bNo\bot\bta\bat\bti\bio\bon\bn
2983 In this section, the Emacs-style notation is used to denote keystrokes.
2984 Control keys are denoted by C-_\bk_\be_\by, e.g., C-n means Control-N. Simi-
2985 larly, _\bm_\be_\bt_\ba keys are denoted by M-_\bk_\be_\by, so M-x means Meta-X. (On key-
2986 boards without a _\bm_\be_\bt_\ba key, M-_\bx means ESC _\bx, i.e., press the Escape key
2987 then the _\bx key. This makes ESC the _\bm_\be_\bt_\ba _\bp_\br_\be_\bf_\bi_\bx. The combination M-C-_\bx
2988 means ESC-Control-_\bx, or press the Escape key then hold the Control key
2989 while pressing the _\bx key.)
2990
2991 Readline commands may be given numeric _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs, which normally act as
2992 a repeat count. Sometimes, however, it is the sign of the argument
2993 that is significant. Passing a negative argument to a command that
2994 acts in the forward direction (e.g., k\bki\bil\bll\bl-\b-l\bli\bin\bne\be) causes that command to
2995 act in a backward direction. Commands whose behavior with arguments
2996 deviates from this are noted below.
2997
2998 When a command is described as _\bk_\bi_\bl_\bl_\bi_\bn_\bg text, the text deleted is saved
2999 for possible future retrieval (_\by_\ba_\bn_\bk_\bi_\bn_\bg). The killed text is saved in a
3000 _\bk_\bi_\bl_\bl _\br_\bi_\bn_\bg. Consecutive kills cause the text to be accumulated into one
3001 unit, which can be yanked all at once. Commands which do not kill text
3002 separate the chunks of text on the kill ring.
3003
3004 R\bRe\bea\bad\bdl\bli\bin\bne\be I\bIn\bni\bit\bti\bia\bal\bli\biz\bza\bat\bti\bio\bon\bn
3005 Readline is customized by putting commands in an initialization file
3006 (the _\bi_\bn_\bp_\bu_\bt_\br_\bc file). The name of this file is taken from the value of
3007 the I\bIN\bNP\bPU\bUT\bTR\bRC\bC variable. If that variable is unset, the default is
3008 _\b~_\b/_\b._\bi_\bn_\bp_\bu_\bt_\br_\bc. When a program which uses the readline library starts up,
3009 the initialization file is read, and the key bindings and variables are
3010 set. There are only a few basic constructs allowed in the readline
3011 initialization file. Blank lines are ignored. Lines beginning with a
3012 #\b# are comments. Lines beginning with a $\b$ indicate conditional con-
3013 structs. Other lines denote key bindings and variable settings.
3014
3015 The default key-bindings may be changed with an _\bi_\bn_\bp_\bu_\bt_\br_\bc file. Other
3016 programs that use this library may add their own commands and bindings.
3017
3018 For example, placing
3019
3020 M-Control-u: universal-argument
3021 or
3022 C-Meta-u: universal-argument
3023 into the _\bi_\bn_\bp_\bu_\bt_\br_\bc would make M-C-u execute the readline command _\bu_\bn_\bi_\bv_\be_\br_\b-
3024 _\bs_\ba_\bl_\b-_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt.
3025
3026 The following symbolic character names are recognized: _\bR_\bU_\bB_\bO_\bU_\bT, _\bD_\bE_\bL,
3027 _\bE_\bS_\bC, _\bL_\bF_\bD, _\bN_\bE_\bW_\bL_\bI_\bN_\bE, _\bR_\bE_\bT, _\bR_\bE_\bT_\bU_\bR_\bN, _\bS_\bP_\bC, _\bS_\bP_\bA_\bC_\bE, and _\bT_\bA_\bB.
3028
3029 In addition to command names, readline allows keys to be bound to a
3030 string that is inserted when the key is pressed (a _\bm_\ba_\bc_\br_\bo).
3031
3032 R\bRe\bea\bad\bdl\bli\bin\bne\be K\bKe\bey\by B\bBi\bin\bnd\bdi\bin\bng\bgs\bs
3033 The syntax for controlling key bindings in the _\bi_\bn_\bp_\bu_\bt_\br_\bc file is simple.
3034 All that is required is the name of the command or the text of a macro
3035 and a key sequence to which it should be bound. The name may be speci-
3036 fied in one of two ways: as a symbolic key name, possibly with _\bM_\be_\bt_\ba_\b- or
3037 _\bC_\bo_\bn_\bt_\br_\bo_\bl_\b- prefixes, or as a key sequence.
3038
3039 When using the form k\bke\bey\byn\bna\bam\bme\be:_\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be or _\bm_\ba_\bc_\br_\bo, _\bk_\be_\by_\bn_\ba_\bm_\be is the name
3040 of a key spelled out in English. For example:
3041
3042 Control-u: universal-argument
3043 Meta-Rubout: backward-kill-word
3044 Control-o: "> output"
3045
3046 In the above example, _\bC_\b-_\bu is bound to the function u\bun\bni\biv\bve\ber\brs\bsa\bal\bl-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt,
3047 _\bM_\b-_\bD_\bE_\bL is bound to the function b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd, and _\bC_\b-_\bo is bound to
3048 run the macro expressed on the right hand side (that is, to insert the
3049 text ``> output'' into the line).
3050
3051 In the second form, "\b"k\bke\bey\bys\bse\beq\bq"\b":_\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be or _\bm_\ba_\bc_\br_\bo, k\bke\bey\bys\bse\beq\bq differs
3052 from k\bke\bey\byn\bna\bam\bme\be above in that strings denoting an entire key sequence may
3053 be specified by placing the sequence within double quotes. Some GNU
3054 Emacs style key escapes can be used, as in the following example, but
3055 the symbolic character names are not recognized.
3056
3057 "\C-u": universal-argument
3058 "\C-x\C-r": re-read-init-file
3059 "\e[11~": "Function Key 1"
3060
3061 In this example, _\bC_\b-_\bu is again bound to the function u\bun\bni\biv\bve\ber\brs\bsa\bal\bl-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt.
3062 _\bC_\b-_\bx _\bC_\b-_\br is bound to the function r\bre\be-\b-r\bre\bea\bad\bd-\b-i\bin\bni\bit\bt-\b-f\bfi\bil\ble\be, and _\bE_\bS_\bC _\b[ _\b1 _\b1 _\b~ is
3063 bound to insert the text ``Function Key 1''.
3064
3065 The full set of GNU Emacs style escape sequences is
3066 \\b\C\bC-\b- control prefix
3067 \\b\M\bM-\b- meta prefix
3068 \\b\e\be an escape character
3069 \\b\\\b\ backslash
3070 \\b\"\b" literal "
3071 \\b\'\b' literal '
3072
3073 In addition to the GNU Emacs style escape sequences, a second set of
3074 backslash escapes is available:
3075 \\b\a\ba alert (bell)
3076 \\b\b\bb backspace
3077 \\b\d\bd delete
3078 \\b\f\bf form feed
3079 \\b\n\bn newline
3080 \\b\r\br carriage return
3081 \\b\t\bt horizontal tab
3082 \\b\v\bv vertical tab
3083 \\b\_\bn_\bn_\bn the eight-bit character whose value is the octal value
3084 _\bn_\bn_\bn (one to three digits)
3085 \\b\x\bx_\bH_\bH the eight-bit character whose value is the hexadecimal
3086 value _\bH_\bH (one or two hex digits)
3087
3088 When entering the text of a macro, single or double quotes must be used
3089 to indicate a macro definition. Unquoted text is assumed to be a func-
3090 tion name. In the macro body, the backslash escapes described above
3091 are expanded. Backslash will quote any other character in the macro
3092 text, including " and '.
3093
3094 B\bBa\bas\bsh\bh allows the current readline key bindings to be displayed or modi-
3095 fied with the b\bbi\bin\bnd\bd builtin command. The editing mode may be switched
3096 during interactive use by using the -\b-o\bo option to the s\bse\bet\bt builtin com-
3097 mand (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below).
3098
3099 R\bRe\bea\bad\bdl\bli\bin\bne\be V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs
3100 Readline has variables that can be used to further customize its behav-
3101 ior. A variable may be set in the _\bi_\bn_\bp_\bu_\bt_\br_\bc file with a statement of the
3102 form
3103
3104 s\bse\bet\bt _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be_\b-_\bn_\ba_\bm_\be _\bv_\ba_\bl_\bu_\be
3105
3106 Except where noted, readline variables can take the values O\bOn\bn or O\bOf\bff\bf
3107 (without regard to case). Unrecognized variable names are ignored.
3108 When a variable value is read, empty or null values, "on" (case-insen-
3109 sitive), and "1" are equivalent to O\bOn\bn. All other values are equivalent
3110 to O\bOf\bff\bf. The variables and their default values are:
3111
3112 b\bbe\bel\bll\bl-\b-s\bst\bty\byl\ble\be (\b(a\bau\bud\bdi\bib\bbl\ble\be)\b)
3113 Controls what happens when readline wants to ring the terminal
3114 bell. If set to n\bno\bon\bne\be, readline never rings the bell. If set to
3115 v\bvi\bis\bsi\bib\bbl\ble\be, readline uses a visible bell if one is available. If
3116 set to a\bau\bud\bdi\bib\bbl\ble\be, readline attempts to ring the terminal's bell.
3117 b\bbi\bin\bnd\bd-\b-t\btt\bty\by-\b-s\bsp\bpe\bec\bci\bia\bal\bl-\b-c\bch\bha\bar\brs\bs (\b(O\bOn\bn)\b)
3118 If set to O\bOn\bn, readline attempts to bind the control characters
3119 treated specially by the kernel's terminal driver to their read-
3120 line equivalents.
3121 b\bbl\bli\bin\bnk\bk-\b-m\bma\bat\btc\bch\bhi\bin\bng\bg-\b-p\bpa\bar\bre\ben\bn (\b(O\bOf\bff\bf)\b)
3122 If set to O\bOn\bn, readline attempts to briefly move the cursor to an
3123 opening parenthesis when a closing parenthesis is inserted.
3124 c\bco\bol\blo\bor\bre\bed\bd-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn-\b-p\bpr\bre\bef\bfi\bix\bx (\b(O\bOf\bff\bf)\b)
3125 If set to O\bOn\bn, when listing completions, readline displays the
3126 common prefix of the set of possible completions using a differ-
3127 ent color. The color definitions are taken from the value of
3128 the L\bLS\bS_\b_C\bCO\bOL\bLO\bOR\bRS\bS environment variable.
3129 c\bco\bol\blo\bor\bre\bed\bd-\b-s\bst\bta\bat\bts\bs (\b(O\bOf\bff\bf)\b)
3130 If set to O\bOn\bn, readline displays possible completions using dif-
3131 ferent colors to indicate their file type. The color defini-
3132 tions are taken from the value of the L\bLS\bS_\b_C\bCO\bOL\bLO\bOR\bRS\bS environment
3133 variable.
3134 c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn (\b(`\b``\b`#\b#'\b''\b')\b)
3135 The string that is inserted when the readline i\bin\bns\bse\ber\brt\bt-\b-c\bco\bom\bmm\bme\ben\bnt\bt
3136 command is executed. This command is bound to M\bM-\b-#\b# in emacs mode
3137 and to #\b# in vi command mode.
3138 c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn-\b-d\bdi\bis\bsp\bpl\bla\bay\by-\b-w\bwi\bid\bdt\bth\bh (\b(-\b-1\b1)\b)
3139 The number of screen columns used to display possible matches
3140 when performing completion. The value is ignored if it is less
3141 than 0 or greater than the terminal screen width. A value of 0
3142 will cause matches to be displayed one per line. The default
3143 value is -1.
3144 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)
3145 If set to O\bOn\bn, readline performs filename matching and completion
3146 in a case-insensitive fashion.
3147 c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn-\b-m\bma\bap\bp-\b-c\bca\bas\bse\be (\b(O\bOf\bff\bf)\b)
3148 If set to O\bOn\bn, and c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn-\b-i\big\bgn\bno\bor\bre\be-\b-c\bca\bas\bse\be is enabled, readline
3149 treats hyphens (_\b-) and underscores (_\b_) as equivalent when per-
3150 forming case-insensitive filename matching and completion.
3151 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)
3152 The length in characters of the common prefix of a list of pos-
3153 sible completions that is displayed without modification. When
3154 set to a value greater than zero, common prefixes longer than
3155 this value are replaced with an ellipsis when displaying possi-
3156 ble completions.
3157 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)
3158 This determines when the user is queried about viewing the num-
3159 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-
3160 t\bti\bio\bon\bns\bs command. It may be set to any integer value greater than
3161 or equal to zero. If the number of possible completions is
3162 greater than or equal to the value of this variable, the user is
3163 asked whether or not he wishes to view them; otherwise they are
3164 simply listed on the terminal.
3165 c\bco\bon\bnv\bve\ber\brt\bt-\b-m\bme\bet\bta\ba (\b(O\bOn\bn)\b)
3166 If set to O\bOn\bn, readline will convert characters with the eighth
3167 bit set to an ASCII key sequence by stripping the eighth bit and
3168 prefixing an escape character (in effect, using escape as the
3169 _\bm_\be_\bt_\ba _\bp_\br_\be_\bf_\bi_\bx). The default is _\bO_\bn, but readline will set it to
3170 _\bO_\bf_\bf if the locale contains eight-bit characters.
3171 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)
3172 If set to O\bOn\bn, readline will inhibit word completion. Completion
3173 characters will be inserted into the line as if they had been
3174 mapped to s\bse\bel\blf\bf-\b-i\bin\bns\bse\ber\brt\bt.
3175 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)
3176 When set to O\bOn\bn, on operating systems that indicate they support
3177 it, readline echoes a character corresponding to a signal gener-
3178 ated from the keyboard.
3179 e\bed\bdi\bit\bti\bin\bng\bg-\b-m\bmo\bod\bde\be (\b(e\bem\bma\bac\bcs\bs)\b)
3180 Controls whether readline begins with a set of key bindings sim-
3181 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
3182 v\bvi\bi.
3183 e\bem\bma\bac\bcs\bs-\b-m\bmo\bod\bde\be-\b-s\bst\btr\bri\bin\bng\bg (\b(@\b@)\b)
3184 If the _\bs_\bh_\bo_\bw_\b-_\bm_\bo_\bd_\be_\b-_\bi_\bn_\b-_\bp_\br_\bo_\bm_\bp_\bt variable is enabled, this string is
3185 displayed immediately before the last line of the primary prompt
3186 when emacs editing mode is active. The value is expanded like a
3187 key binding, so the standard set of meta- and control prefixes
3188 and backslash escape sequences is available. Use the \1 and \2
3189 escapes to begin and end sequences of non-printing characters,
3190 which can be used to embed a terminal control sequence into the
3191 mode string.
3192 e\ben\bna\bab\bbl\ble\be-\b-b\bbr\bra\bac\bck\bke\bet\bte\bed\bd-\b-p\bpa\bas\bst\bte\be (\b(O\bOf\bff\bf)\b)
3193 When set to O\bOn\bn, readline will configure the terminal in a way
3194 that will enable it to insert each paste into the editing buffer
3195 as a single string of characters, instead of treating each char-
3196 acter as if it had been read from the keyboard. This can pre-
3197 vent pasted characters from being interpreted as editing com-
3198 mands.
3199 e\ben\bna\bab\bbl\ble\be-\b-k\bke\bey\byp\bpa\bad\bd (\b(O\bOf\bff\bf)\b)
3200 When set to O\bOn\bn, readline will try to enable the application key-
3201 pad when it is called. Some systems need this to enable the
3202 arrow keys.
3203 e\ben\bna\bab\bbl\ble\be-\b-m\bme\bet\bta\ba-\b-k\bke\bey\by (\b(O\bOn\bn)\b)
3204 When set to O\bOn\bn, readline will try to enable any meta modifier
3205 key the terminal claims to support when it is called. On many
3206 terminals, the meta key is used to send eight-bit characters.
3207 e\bex\bxp\bpa\ban\bnd\bd-\b-t\bti\bil\bld\bde\be (\b(O\bOf\bff\bf)\b)
3208 If set to O\bOn\bn, tilde expansion is performed when readline
3209 attempts word completion.
3210 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)
3211 If set to O\bOn\bn, the history code attempts to place point at the
3212 same location on each history line retrieved with p\bpr\bre\bev\bvi\bio\bou\bus\bs-\b-h\bhi\bis\bs-\b-
3213 t\bto\bor\bry\by or n\bne\bex\bxt\bt-\b-h\bhi\bis\bst\bto\bor\bry\by.
3214 h\bhi\bis\bst\bto\bor\bry\by-\b-s\bsi\biz\bze\be (\b(u\bun\bns\bse\bet\bt)\b)
3215 Set the maximum number of history entries saved in the history
3216 list. If set to zero, any existing history entries are deleted
3217 and no new entries are saved. If set to a value less than zero,
3218 the number of history entries is not limited. By default, the
3219 number of history entries is set to the value of the H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE
3220 shell variable. If an attempt is made to set _\bh_\bi_\bs_\bt_\bo_\br_\by_\b-_\bs_\bi_\bz_\be to a
3221 non-numeric value, the maximum number of history entries will be
3222 set to 500.
3223 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)
3224 When set to O\bOn\bn, makes readline use a single line for display,
3225 scrolling the input horizontally on a single screen line when it
3226 becomes longer than the screen width rather than wrapping to a
3227 new line.
3228 i\bin\bnp\bpu\but\bt-\b-m\bme\bet\bta\ba (\b(O\bOf\bff\bf)\b)
3229 If set to O\bOn\bn, readline will enable eight-bit input (that is, it
3230 will not strip the eighth bit from the characters it reads),
3231 regardless of what the terminal claims it can support. The name
3232 m\bme\bet\bta\ba-\b-f\bfl\bla\bag\bg is a synonym for this variable. The default is _\bO_\bf_\bf,
3233 but readline will set it to _\bO_\bn if the locale contains eight-bit
3234 characters.
3235 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)
3236 The string of characters that should terminate an incremental
3237 search without subsequently executing the character as a com-
3238 mand. If this variable has not been given a value, the charac-
3239 ters _\bE_\bS_\bC and _\bC_\b-_\bJ will terminate an incremental search.
3240 k\bke\bey\bym\bma\bap\bp (\b(e\bem\bma\bac\bcs\bs)\b)
3241 Set the current readline keymap. The set of valid keymap names
3242 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-
3243 _\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
3244 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
3245 value of e\bed\bdi\bit\bti\bin\bng\bg-\b-m\bmo\bod\bde\be also affects the default keymap.
3246 k\bke\bey\bys\bse\beq\bq-\b-t\bti\bim\bme\beo\bou\but\bt (\b(5\b50\b00\b0)\b)
3247 Specifies the duration _\br_\be_\ba_\bd_\bl_\bi_\bn_\be will wait for a character when
3248 reading an ambiguous key sequence (one that can form a complete
3249 key sequence using the input read so far, or can take additional
3250 input to complete a longer key sequence). If no input is
3251 received within the timeout, _\br_\be_\ba_\bd_\bl_\bi_\bn_\be will use the shorter but
3252 complete key sequence. The value is specified in milliseconds,
3253 so a value of 1000 means that _\br_\be_\ba_\bd_\bl_\bi_\bn_\be will wait one second for
3254 additional input. If this variable is set to a value less than
3255 or equal to zero, or to a non-numeric value, _\br_\be_\ba_\bd_\bl_\bi_\bn_\be will wait
3256 until another key is pressed to decide which key sequence to
3257 complete.
3258 m\bma\bar\brk\bk-\b-d\bdi\bir\bre\bec\bct\bto\bor\bri\bie\bes\bs (\b(O\bOn\bn)\b)
3259 If set to O\bOn\bn, completed directory names have a slash appended.
3260 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)
3261 If set to O\bOn\bn, history lines that have been modified are dis-
3262 played with a preceding asterisk (*\b*).
3263 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)
3264 If set to O\bOn\bn, completed names which are symbolic links to direc-
3265 tories have a slash appended (subject to the value of
3266 m\bma\bar\brk\bk-\b-d\bdi\bir\bre\bec\bct\bto\bor\bri\bie\bes\bs).
3267 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)
3268 This variable, when set to O\bOn\bn, causes readline to match files
3269 whose names begin with a `.' (hidden files) when performing
3270 filename completion. If set to O\bOf\bff\bf, the leading `.' must be
3271 supplied by the user in the filename to be completed.
3272 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)
3273 If set to O\bOn\bn, menu completion displays the common prefix of the
3274 list of possible completions (which may be empty) before cycling
3275 through the list.
3276 o\bou\but\btp\bpu\but\bt-\b-m\bme\bet\bta\ba (\b(O\bOf\bff\bf)\b)
3277 If set to O\bOn\bn, readline will display characters with the eighth
3278 bit set directly rather than as a meta-prefixed escape sequence.
3279 The default is _\bO_\bf_\bf, but readline will set it to _\bO_\bn if the locale
3280 contains eight-bit characters.
3281 p\bpa\bag\bge\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(O\bOn\bn)\b)
3282 If set to O\bOn\bn, readline uses an internal _\bm_\bo_\br_\be-like pager to dis-
3283 play a screenful of possible completions at a time.
3284 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)
3285 If set to O\bOn\bn, readline will display completions with matches
3286 sorted horizontally in alphabetical order, rather than down the
3287 screen.
3288 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)
3289 If set to O\bOn\bn, readline will undo all changes to history lines
3290 before returning when a\bac\bcc\bce\bep\bpt\bt-\b-l\bli\bin\bne\be is executed. By default, his-
3291 tory lines may be modified and retain individual undo lists
3292 across calls to r\bre\bea\bad\bdl\bli\bin\bne\be.
3293 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)
3294 This alters the default behavior of the completion functions.
3295 If set to O\bOn\bn, words which have more than one possible completion
3296 cause the matches to be listed immediately instead of ringing
3297 the bell.
3298 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)
3299 This alters the default behavior of the completion functions in
3300 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
3301 which have more than one possible completion without any possi-
3302 ble partial completion (the possible completions don't share a
3303 common prefix) cause the matches to be listed immediately
3304 instead of ringing the bell.
3305 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)
3306 If set to O\bOn\bn, add a string to the beginning of the prompt indi-
3307 cating the editing mode: emacs, vi command, or vi insertion.
3308 The mode strings are user-settable (e.g., _\be_\bm_\ba_\bc_\bs_\b-_\bm_\bo_\bd_\be_\b-_\bs_\bt_\br_\bi_\bn_\bg).
3309 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)
3310 If set to O\bOn\bn, this alters the default completion behavior when
3311 inserting a single match into the line. It's only active when
3312 performing completion in the middle of a word. If enabled,
3313 readline does not insert characters from the completion that
3314 match characters after point in the word being completed, so
3315 portions of the word following the cursor are not duplicated.
3316 v\bvi\bi-\b-c\bcm\bmd\bd-\b-m\bmo\bod\bde\be-\b-s\bst\btr\bri\bin\bng\bg (\b((\b(c\bcm\bmd\bd)\b))\b)
3317 If the _\bs_\bh_\bo_\bw_\b-_\bm_\bo_\bd_\be_\b-_\bi_\bn_\b-_\bp_\br_\bo_\bm_\bp_\bt variable is enabled, this string is
3318 displayed immediately before the last line of the primary prompt
3319 when vi editing mode is active and in command mode. The value
3320 is expanded like a key binding, so the standard set of meta- and
3321 control prefixes and backslash escape sequences is available.
3322 Use the \1 and \2 escapes to begin and end sequences of non-
3323 printing characters, which can be used to embed a terminal con-
3324 trol sequence into the mode string.
3325 v\bvi\bi-\b-i\bin\bns\bs-\b-m\bmo\bod\bde\be-\b-s\bst\btr\bri\bin\bng\bg (\b((\b(i\bin\bns\bs)\b))\b)
3326 If the _\bs_\bh_\bo_\bw_\b-_\bm_\bo_\bd_\be_\b-_\bi_\bn_\b-_\bp_\br_\bo_\bm_\bp_\bt variable is enabled, this string is
3327 displayed immediately before the last line of the primary prompt
3328 when vi editing mode is active and in insertion mode. The value
3329 is expanded like a key binding, so the standard set of meta- and
3330 control prefixes and backslash escape sequences is available.
3331 Use the \1 and \2 escapes to begin and end sequences of non-
3332 printing characters, which can be used to embed a terminal con-
3333 trol sequence into the mode string.
3334 v\bvi\bis\bsi\bib\bbl\ble\be-\b-s\bst\bta\bat\bts\bs (\b(O\bOf\bff\bf)\b)
3335 If set to O\bOn\bn, a character denoting a file's type as reported by
3336 _\bs_\bt_\ba_\bt(2) is appended to the filename when listing possible com-
3337 pletions.
3338
3339 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
3340 Readline implements a facility similar in spirit to the conditional
3341 compilation features of the C preprocessor which allows key bindings
3342 and variable settings to be performed as the result of tests. There
3343 are four parser directives used.
3344
3345 $\b$i\bif\bf The $\b$i\bif\bf construct allows bindings to be made based on the edit-
3346 ing mode, the terminal being used, or the application using
3347 readline. The text of the test, after any comparison operator,
3348 extends to the end of the line; unless otherwise noted, no
3349 characters are required to isolate it.
3350
3351 m\bmo\bod\bde\be The m\bmo\bod\bde\be=\b= form of the $\b$i\bif\bf directive is used to test
3352 whether readline is in emacs or vi mode. This may be
3353 used in conjunction with the s\bse\bet\bt k\bke\bey\bym\bma\bap\bp command, for
3354 instance, to set bindings in the _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\bd_\ba_\br_\bd and
3355 _\be_\bm_\ba_\bc_\bs_\b-_\bc_\bt_\bl_\bx keymaps only if readline is starting out in
3356 emacs mode.
3357
3358 t\bte\ber\brm\bm The t\bte\ber\brm\bm=\b= form may be used to include terminal-specific
3359 key bindings, perhaps to bind the key sequences output by
3360 the terminal's function keys. The word on the right side
3361 of the =\b= is tested against both the full name of the ter-
3362 minal and the portion of the terminal name before the
3363 first -\b-. This allows _\bs_\bu_\bn to match both _\bs_\bu_\bn and _\bs_\bu_\bn_\b-_\bc_\bm_\bd,
3364 for instance.
3365
3366 v\bve\ber\brs\bsi\bio\bon\bn
3367 The v\bve\ber\brs\bsi\bio\bon\bn test may be used to perform comparisons
3368 against specific readline versions. The v\bve\ber\brs\bsi\bio\bon\bn expands
3369 to the current readline version. The set of comparison
3370 operators includes =\b=, (and =\b==\b=), !\b!=\b=, <\b<=\b=, >\b>=\b=, <\b<, and >\b>.
3371 The version number supplied on the right side of the
3372 operator consists of a major version number, an optional
3373 decimal point, and an optional minor version (e.g., 7\b7.\b.1\b1).
3374 If the minor version is omitted, it is assumed to be 0\b0.
3375 The operator may be separated from the string v\bve\ber\brs\bsi\bio\bon\bn and
3376 from the version number argument by whitespace.
3377
3378 a\bap\bpp\bpl\bli\bic\bca\bat\bti\bio\bon\bn
3379 The a\bap\bpp\bpl\bli\bic\bca\bat\bti\bio\bon\bn construct is used to include application-
3380 specific settings. Each program using the readline
3381 library sets the _\ba_\bp_\bp_\bl_\bi_\bc_\ba_\bt_\bi_\bo_\bn _\bn_\ba_\bm_\be, and an initialization
3382 file can test for a particular value. This could be used
3383 to bind key sequences to functions useful for a specific
3384 program. For instance, the following command adds a key
3385 sequence that quotes the current or previous word in
3386 b\bba\bas\bsh\bh:
3387
3388 $\b$i\bif\bf Bash
3389 # Quote the current or previous word
3390 "\C-xq": "\eb\"\ef\""
3391 $\b$e\ben\bnd\bdi\bif\bf
3392
3393 _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be
3394 The _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be construct provides simple equality tests for
3395 readline variables and values. The permitted comparison
3396 operators are _\b=, _\b=_\b=, and _\b!_\b=. The variable name must be
3397 separated from the comparison operator by whitespace; the
3398 operator may be separated from the value on the right
3399 hand side by whitespace. Both string and boolean vari-
3400 ables may be tested. Boolean variables must be tested
3401 against the values _\bo_\bn and _\bo_\bf_\bf.
3402
3403 $\b$e\ben\bnd\bdi\bif\bf This command, as seen in the previous example, terminates an $\b$i\bif\bf
3404 command.
3405
3406 $\b$e\bel\bls\bse\be Commands in this branch of the $\b$i\bif\bf directive are executed if the
3407 test fails.
3408
3409 $\b$i\bin\bnc\bcl\blu\bud\bde\be
3410 This directive takes a single filename as an argument and reads
3411 commands and bindings from that file. For example, the follow-
3412 ing directive would read _\b/_\be_\bt_\bc_\b/_\bi_\bn_\bp_\bu_\bt_\br_\bc:
3413
3414 $\b$i\bin\bnc\bcl\blu\bud\bde\be _\b/_\be_\bt_\bc_\b/_\bi_\bn_\bp_\bu_\bt_\br_\bc
3415
3416 S\bSe\bea\bar\brc\bch\bhi\bin\bng\bg
3417 Readline provides commands for searching through the command history
3418 (see H\bHI\bIS\bST\bTO\bOR\bRY\bY below) for lines containing a specified string. There are
3419 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.
3420
3421 Incremental searches begin before the user has finished typing the
3422 search string. As each character of the search string is typed, read-
3423 line displays the next entry from the history matching the string typed
3424 so far. An incremental search requires only as many characters as
3425 needed to find the desired history entry. The characters present in
3426 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
3427 incremental search. If that variable has not been assigned a value the
3428 Escape and Control-J characters will terminate an incremental search.
3429 Control-G will abort an incremental search and restore the original
3430 line. When the search is terminated, the history entry containing the
3431 search string becomes the current line.
3432
3433 To find other matching entries in the history list, type Control-S or
3434 Control-R as appropriate. This will search backward or forward in the
3435 history for the next entry matching the search string typed so far.
3436 Any other key sequence bound to a readline command will terminate the
3437 search and execute that command. For instance, a _\bn_\be_\bw_\bl_\bi_\bn_\be will termi-
3438 nate the search and accept the line, thereby executing the command from
3439 the history list.
3440
3441 Readline remembers the last incremental search string. If two Control-
3442 Rs are typed without any intervening characters defining a new search
3443 string, any remembered search string is used.
3444
3445 Non-incremental searches read the entire search string before starting
3446 to search for matching history lines. The search string may be typed
3447 by the user or be part of the contents of the current line.
3448
3449 R\bRe\bea\bad\bdl\bli\bin\bne\be C\bCo\bom\bmm\bma\ban\bnd\bd N\bNa\bam\bme\bes\bs
3450 The following is a list of the names of the commands and the default
3451 key sequences to which they are bound. Command names without an accom-
3452 panying key sequence are unbound by default. In the following descrip-
3453 tions, _\bp_\bo_\bi_\bn_\bt refers to the current cursor position, and _\bm_\ba_\br_\bk refers to
3454 a cursor position saved by the s\bse\bet\bt-\b-m\bma\bar\brk\bk command. The text between the
3455 point and mark is referred to as the _\br_\be_\bg_\bi_\bo_\bn.
3456
3457 C\bCo\bom\bmm\bma\ban\bnd\bds\bs f\bfo\bor\br M\bMo\bov\bvi\bin\bng\bg
3458 b\bbe\beg\bgi\bin\bnn\bni\bin\bng\bg-\b-o\bof\bf-\b-l\bli\bin\bne\be (\b(C\bC-\b-a\ba)\b)
3459 Move to the start of the current line.
3460 e\ben\bnd\bd-\b-o\bof\bf-\b-l\bli\bin\bne\be (\b(C\bC-\b-e\be)\b)
3461 Move to the end of the line.
3462 f\bfo\bor\brw\bwa\bar\brd\bd-\b-c\bch\bha\bar\br (\b(C\bC-\b-f\bf)\b)
3463 Move forward a character.
3464 b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-c\bch\bha\bar\br (\b(C\bC-\b-b\bb)\b)
3465 Move back a character.
3466 f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-f\bf)\b)
3467 Move forward to the end of the next word. Words are composed of
3468 alphanumeric characters (letters and digits).
3469 b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-b\bb)\b)
3470 Move back to the start of the current or previous word. Words
3471 are composed of alphanumeric characters (letters and digits).
3472 s\bsh\bhe\bel\bll\bl-\b-f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd
3473 Move forward to the end of the next word. Words are delimited
3474 by non-quoted shell metacharacters.
3475 s\bsh\bhe\bel\bll\bl-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd
3476 Move back to the start of the current or previous word. Words
3477 are delimited by non-quoted shell metacharacters.
3478 p\bpr\bre\bev\bvi\bio\bou\bus\bs-\b-s\bsc\bcr\bre\bee\ben\bn-\b-l\bli\bin\bne\be
3479 Attempt to move point to the same physical screen column on the
3480 previous physical screen line. This will not have the desired
3481 effect if the current Readline line does not take up more than
3482 one physical line or if point is not greater than the length of
3483 the prompt plus the screen width.
3484 n\bne\bex\bxt\bt-\b-s\bsc\bcr\bre\bee\ben\bn-\b-l\bli\bin\bne\be
3485 Attempt to move point to the same physical screen column on the
3486 next physical screen line. This will not have the desired effect
3487 if the current Readline line does not take up more than one
3488 physical line or if the length of the current Readline line is
3489 not greater than the length of the prompt plus the screen width.
3490 c\bcl\ble\bea\bar\br-\b-s\bsc\bcr\bre\bee\ben\bn (\b(C\bC-\b-l\bl)\b)
3491 Clear the screen leaving the current line at the top of the
3492 screen. With an argument, refresh the current line without
3493 clearing the screen.
3494 r\bre\bed\bdr\bra\baw\bw-\b-c\bcu\bur\brr\bre\ben\bnt\bt-\b-l\bli\bin\bne\be
3495 Refresh the current line.
3496
3497 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
3498 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)
3499 Accept the line regardless of where the cursor is. If this line
3500 is non-empty, add it to the history list according to the state
3501 of the H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL variable. If the line is a modified history
3502 line, then restore the history line to its original state.
3503 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)
3504 Fetch the previous command from the history list, moving back in
3505 the list.
3506 n\bne\bex\bxt\bt-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(C\bC-\b-n\bn)\b)
3507 Fetch the next command from the history list, moving forward in
3508 the list.
3509 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)
3510 Move to the first line in the history.
3511 e\ben\bnd\bd-\b-o\bof\bf-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(M\bM-\b->\b>)\b)
3512 Move to the end of the input history, i.e., the line currently
3513 being entered.
3514 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)
3515 Search backward starting at the current line and moving `up'
3516 through the history as necessary. This is an incremental
3517 search.
3518 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)
3519 Search forward starting at the current line and moving `down'
3520 through the history as necessary. This is an incremental
3521 search.
3522 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)
3523 Search backward through the history starting at the current line
3524 using a non-incremental search for a string supplied by the
3525 user.
3526 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)
3527 Search forward through the history using a non-incremental
3528 search for a string supplied by the user.
3529 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
3530 Search forward through the history for the string of characters
3531 between the start of the current line and the point. This is a
3532 non-incremental search.
3533 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
3534 Search backward through the history for the string of characters
3535 between the start of the current line and the point. This is a
3536 non-incremental search.
3537 h\bhi\bis\bst\bto\bor\bry\by-\b-s\bsu\bub\bbs\bst\btr\bri\bin\bng\bg-\b-s\bse\bea\bar\brc\bch\bh-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd
3538 Search backward through the history for the string of characters
3539 between the start of the current line and the current cursor
3540 position (the _\bp_\bo_\bi_\bn_\bt). The search string may match anywhere in a
3541 history line. This is a non-incremental search.
3542 h\bhi\bis\bst\bto\bor\bry\by-\b-s\bsu\bub\bbs\bst\btr\bri\bin\bng\bg-\b-s\bse\bea\bar\brc\bch\bh-\b-f\bfo\bor\brw\bwa\bar\brd\bd
3543 Search forward through the history for the string of characters
3544 between the start of the current line and the point. The search
3545 string may match anywhere in a history line. This is a non-
3546 incremental search.
3547 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)
3548 Insert the first argument to the previous command (usually the
3549 second word on the previous line) at point. With an argument _\bn,
3550 insert the _\bnth word from the previous command (the words in the
3551 previous command begin with word 0). A negative argument
3552 inserts the _\bnth word from the end of the previous command. Once
3553 the argument _\bn is computed, the argument is extracted as if the
3554 "!_\bn" history expansion had been specified.
3555 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)
3556 Insert the last argument to the previous command (the last word
3557 of the previous history entry). With a numeric argument, behave
3558 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
3559 move back through the history list, inserting the last word (or
3560 the word specified by the argument to the first call) of each
3561 line in turn. Any numeric argument supplied to these successive
3562 calls determines the direction to move through the history. A
3563 negative argument switches the direction through the history
3564 (back or forward). The history expansion facilities are used to
3565 extract the last word, as if the "!$" history expansion had been
3566 specified.
3567 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)
3568 Expand the line as the shell does. This performs alias and his-
3569 tory expansion as well as all of the shell word expansions. See
3570 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.
3571 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)
3572 Perform history expansion on the current line. See H\bHI\bIS\bST\bTO\bOR\bRY\bY
3573 E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN below for a description of history expansion.
3574 m\bma\bag\bgi\bic\bc-\b-s\bsp\bpa\bac\bce\be
3575 Perform history expansion on the current line and insert a
3576 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
3577 expansion.
3578 a\bal\bli\bia\bas\bs-\b-e\bex\bxp\bpa\ban\bnd\bd-\b-l\bli\bin\bne\be
3579 Perform alias expansion on the current line. See A\bAL\bLI\bIA\bAS\bSE\bES\bS above
3580 for a description of alias expansion.
3581 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
3582 Perform history and alias expansion on the current line.
3583 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)
3584 A synonym for y\bya\ban\bnk\bk-\b-l\bla\bas\bst\bt-\b-a\bar\brg\bg.
3585 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)
3586 Accept the current line for execution and fetch the next line
3587 relative to the current line from the history for editing. A
3588 numeric argument, if supplied, specifies the history entry to
3589 use instead of the current line.
3590 e\bed\bdi\bit\bt-\b-a\ban\bnd\bd-\b-e\bex\bxe\bec\bcu\but\bte\be-\b-c\bco\bom\bmm\bma\ban\bnd\bd (\b(C\bC-\b-x\bx C\bC-\b-e\be)\b)
3591 Invoke an editor on the current command line, and execute the
3592 result as shell commands. B\bBa\bas\bsh\bh attempts to invoke $\b$V\bVI\bIS\bSU\bUA\bAL\bL,
3593 $\b$E\bED\bDI\bIT\bTO\bOR\bR, and _\be_\bm_\ba_\bc_\bs as the editor, in that order.
3594
3595 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
3596 _\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)
3597 The character indicating end-of-file as set, for example, by
3598 ``stty''. If this character is read when there are no charac-
3599 ters on the line, and point is at the beginning of the line,
3600 Readline interprets it as the end of input and returns E\bEO\bOF\bF.
3601 d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br (\b(C\bC-\b-d\bd)\b)
3602 Delete the character at point. If this function is bound to the
3603 same character as the tty E\bEO\bOF\bF character, as C\bC-\b-d\bd commonly is, see
3604 above for the effects.
3605 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)
3606 Delete the character behind the cursor. When given a numeric
3607 argument, save the deleted text on the kill ring.
3608 f\bfo\bor\brw\bwa\bar\brd\bd-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br
3609 Delete the character under the cursor, unless the cursor is at
3610 the end of the line, in which case the character behind the cur-
3611 sor is deleted.
3612 q\bqu\buo\bot\bte\bed\bd-\b-i\bin\bns\bse\ber\brt\bt (\b(C\bC-\b-q\bq,\b, C\bC-\b-v\bv)\b)
3613 Add the next character typed to the line verbatim. This is how
3614 to insert characters like C\bC-\b-q\bq, for example.
3615 t\bta\bab\bb-\b-i\bin\bns\bse\ber\brt\bt (\b(C\bC-\b-v\bv T\bTA\bAB\bB)\b)
3616 Insert a tab character.
3617 s\bse\bel\blf\bf-\b-i\bin\bns\bse\ber\brt\bt (\b(a\ba,\b, b\bb,\b, A\bA,\b, 1\b1,\b, !\b!,\b, .\b..\b..\b.)\b)
3618 Insert the character typed.
3619 t\btr\bra\ban\bns\bsp\bpo\bos\bse\be-\b-c\bch\bha\bar\brs\bs (\b(C\bC-\b-t\bt)\b)
3620 Drag the character before point forward over the character at
3621 point, moving point forward as well. If point is at the end of
3622 the line, then this transposes the two characters before point.
3623 Negative arguments have no effect.
3624 t\btr\bra\ban\bns\bsp\bpo\bos\bse\be-\b-w\bwo\bor\brd\bds\bs (\b(M\bM-\b-t\bt)\b)
3625 Drag the word before point past the word after point, moving
3626 point over that word as well. If point is at the end of the
3627 line, this transposes the last two words on the line.
3628 u\bup\bpc\bca\bas\bse\be-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-u\bu)\b)
3629 Uppercase the current (or following) word. With a negative
3630 argument, uppercase the previous word, but do not move point.
3631 d\bdo\bow\bwn\bnc\bca\bas\bse\be-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-l\bl)\b)
3632 Lowercase the current (or following) word. With a negative
3633 argument, lowercase the previous word, but do not move point.
3634 c\bca\bap\bpi\bit\bta\bal\bli\biz\bze\be-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-c\bc)\b)
3635 Capitalize the current (or following) word. With a negative
3636 argument, capitalize the previous word, but do not move point.
3637 o\bov\bve\ber\brw\bwr\bri\bit\bte\be-\b-m\bmo\bod\bde\be
3638 Toggle overwrite mode. With an explicit positive numeric argu-
3639 ment, switches to overwrite mode. With an explicit non-positive
3640 numeric argument, switches to insert mode. This command affects
3641 only e\bem\bma\bac\bcs\bs mode; v\bvi\bi mode does overwrite differently. Each call
3642 to _\br_\be_\ba_\bd_\bl_\bi_\bn_\be_\b(_\b) starts in insert mode. In overwrite mode, charac-
3643 ters bound to s\bse\bel\blf\bf-\b-i\bin\bns\bse\ber\brt\bt replace the text at point rather than
3644 pushing the text to the right. Characters bound to b\bba\bac\bck\bk-\b-
3645 w\bwa\bar\brd\bd-\b-d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br replace the character before point with a
3646 space. By default, this command is unbound.
3647
3648 K\bKi\bil\bll\bli\bin\bng\bg a\ban\bnd\bd Y\bYa\ban\bnk\bki\bin\bng\bg
3649 k\bki\bil\bll\bl-\b-l\bli\bin\bne\be (\b(C\bC-\b-k\bk)\b)
3650 Kill the text from point to the end of the line.
3651 b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-k\bki\bil\bll\bl-\b-l\bli\bin\bne\be (\b(C\bC-\b-x\bx R\bRu\bub\bbo\bou\but\bt)\b)
3652 Kill backward to the beginning of the line.
3653 u\bun\bni\bix\bx-\b-l\bli\bin\bne\be-\b-d\bdi\bis\bsc\bca\bar\brd\bd (\b(C\bC-\b-u\bu)\b)
3654 Kill backward from point to the beginning of the line. The
3655 killed text is saved on the kill-ring.
3656 k\bki\bil\bll\bl-\b-w\bwh\bho\bol\ble\be-\b-l\bli\bin\bne\be
3657 Kill all characters on the current line, no matter where point
3658 is.
3659 k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-d\bd)\b)
3660 Kill from point to the end of the current word, or if between
3661 words, to the end of the next word. Word boundaries are the
3662 same as those used by f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
3663 b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-R\bRu\bub\bbo\bou\but\bt)\b)
3664 Kill the word behind point. Word boundaries are the same as
3665 those used by b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
3666 s\bsh\bhe\bel\bll\bl-\b-k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd
3667 Kill from point to the end of the current word, or if between
3668 words, to the end of the next word. Word boundaries are the
3669 same as those used by s\bsh\bhe\bel\bll\bl-\b-f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
3670 s\bsh\bhe\bel\bll\bl-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd
3671 Kill the word behind point. Word boundaries are the same as
3672 those used by s\bsh\bhe\bel\bll\bl-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
3673 u\bun\bni\bix\bx-\b-w\bwo\bor\brd\bd-\b-r\bru\bub\bbo\bou\but\bt (\b(C\bC-\b-w\bw)\b)
3674 Kill the word behind point, using white space as a word bound-
3675 ary. The killed text is saved on the kill-ring.
3676 u\bun\bni\bix\bx-\b-f\bfi\bil\ble\ben\bna\bam\bme\be-\b-r\bru\bub\bbo\bou\but\bt
3677 Kill the word behind point, using white space and the slash
3678 character as the word boundaries. The killed text is saved on
3679 the kill-ring.
3680 d\bde\bel\ble\bet\bte\be-\b-h\bho\bor\bri\biz\bzo\bon\bnt\bta\bal\bl-\b-s\bsp\bpa\bac\bce\be (\b(M\bM-\b-\\b\)\b)
3681 Delete all spaces and tabs around point.
3682 k\bki\bil\bll\bl-\b-r\bre\beg\bgi\bio\bon\bn
3683 Kill the text in the current region.
3684 c\bco\bop\bpy\by-\b-r\bre\beg\bgi\bio\bon\bn-\b-a\bas\bs-\b-k\bki\bil\bll\bl
3685 Copy the text in the region to the kill buffer.
3686 c\bco\bop\bpy\by-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd
3687 Copy the word before point to the kill buffer. The word bound-
3688 aries are the same as b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
3689 c\bco\bop\bpy\by-\b-f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd
3690 Copy the word following point to the kill buffer. The word
3691 boundaries are the same as f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
3692 y\bya\ban\bnk\bk (\b(C\bC-\b-y\by)\b)
3693 Yank the top of the kill ring into the buffer at point.
3694 y\bya\ban\bnk\bk-\b-p\bpo\bop\bp (\b(M\bM-\b-y\by)\b)
3695 Rotate the kill ring, and yank the new top. Only works follow-
3696 ing y\bya\ban\bnk\bk or y\bya\ban\bnk\bk-\b-p\bpo\bop\bp.
3697
3698 N\bNu\bum\bme\ber\bri\bic\bc A\bAr\brg\bgu\bum\bme\ben\bnt\bts\bs
3699 d\bdi\big\bgi\bit\bt-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt (\b(M\bM-\b-0\b0,\b, M\bM-\b-1\b1,\b, .\b..\b..\b.,\b, M\bM-\b--\b-)\b)
3700 Add this digit to the argument already accumulating, or start a
3701 new argument. M-- starts a negative argument.
3702 u\bun\bni\biv\bve\ber\brs\bsa\bal\bl-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt
3703 This is another way to specify an argument. If this command is
3704 followed by one or more digits, optionally with a leading minus
3705 sign, those digits define the argument. If the command is fol-
3706 lowed by digits, executing u\bun\bni\biv\bve\ber\brs\bsa\bal\bl-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt again ends the
3707 numeric argument, but is otherwise ignored. As a special case,
3708 if this command is immediately followed by a character that is
3709 neither a digit nor minus sign, the argument count for the next
3710 command is multiplied by four. The argument count is initially
3711 one, so executing this function the first time makes the argu-
3712 ment count four, a second time makes the argument count sixteen,
3713 and so on.
3714
3715 C\bCo\bom\bmp\bpl\ble\bet\bti\bin\bng\bg
3716 c\bco\bom\bmp\bpl\ble\bet\bte\be (\b(T\bTA\bAB\bB)\b)
3717 Attempt to perform completion on the text before point. B\bBa\bas\bsh\bh
3718 attempts completion treating the text as a variable (if the text
3719 begins with $\b$), username (if the text begins with ~\b~), hostname
3720 (if the text begins with @\b@), or command (including aliases and
3721 functions) in turn. If none of these produces a match, filename
3722 completion is attempted.
3723 p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(M\bM-\b-?\b?)\b)
3724 List the possible completions of the text before point.
3725 i\bin\bns\bse\ber\brt\bt-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(M\bM-\b-*\b*)\b)
3726 Insert all completions of the text before point that would have
3727 been generated by p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs.
3728 m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be
3729 Similar to c\bco\bom\bmp\bpl\ble\bet\bte\be, but replaces the word to be completed with
3730 a single match from the list of possible completions. Repeated
3731 execution of m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be steps through the list of possible
3732 completions, inserting each match in turn. At the end of the
3733 list of completions, the bell is rung (subject to the setting of
3734 b\bbe\bel\bll\bl-\b-s\bst\bty\byl\ble\be) and the original text is restored. An argument of _\bn
3735 moves _\bn positions forward in the list of matches; a negative
3736 argument may be used to move backward through the list. This
3737 command is intended to be bound to T\bTA\bAB\bB, but is unbound by
3738 default.
3739 m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd
3740 Identical to m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be, but moves backward through the list
3741 of possible completions, as if m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be had been given a
3742 negative argument. This command is unbound by default.
3743 d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br-\b-o\bor\br-\b-l\bli\bis\bst\bt
3744 Deletes the character under the cursor if not at the beginning
3745 or end of the line (like d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br). If at the end of the
3746 line, behaves identically to p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs. This command
3747 is unbound by default.
3748 c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-f\bfi\bil\ble\ben\bna\bam\bme\be (\b(M\bM-\b-/\b/)\b)
3749 Attempt filename completion on the text before point.
3750 p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-f\bfi\bil\ble\ben\bna\bam\bme\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(C\bC-\b-x\bx /\b/)\b)
3751 List the possible completions of the text before point, treating
3752 it as a filename.
3753 c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-u\bus\bse\ber\brn\bna\bam\bme\be (\b(M\bM-\b-~\b~)\b)
3754 Attempt completion on the text before point, treating it as a
3755 username.
3756 p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-u\bus\bse\ber\brn\bna\bam\bme\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(C\bC-\b-x\bx ~\b~)\b)
3757 List the possible completions of the text before point, treating
3758 it as a username.
3759 c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-v\bva\bar\bri\bia\bab\bbl\ble\be (\b(M\bM-\b-$\b$)\b)
3760 Attempt completion on the text before point, treating it as a
3761 shell variable.
3762 p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-v\bva\bar\bri\bia\bab\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(C\bC-\b-x\bx $\b$)\b)
3763 List the possible completions of the text before point, treating
3764 it as a shell variable.
3765 c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-h\bho\bos\bst\btn\bna\bam\bme\be (\b(M\bM-\b-@\b@)\b)
3766 Attempt completion on the text before point, treating it as a
3767 hostname.
3768 p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-h\bho\bos\bst\btn\bna\bam\bme\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(C\bC-\b-x\bx @\b@)\b)
3769 List the possible completions of the text before point, treating
3770 it as a hostname.
3771 c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-c\bco\bom\bmm\bma\ban\bnd\bd (\b(M\bM-\b-!\b!)\b)
3772 Attempt completion on the text before point, treating it as a
3773 command name. Command completion attempts to match the text
3774 against aliases, reserved words, shell functions, shell
3775 builtins, and finally executable filenames, in that order.
3776 p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-c\bco\bom\bmm\bma\ban\bnd\bd-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(C\bC-\b-x\bx !\b!)\b)
3777 List the possible completions of the text before point, treating
3778 it as a command name.
3779 d\bdy\byn\bna\bam\bmi\bic\bc-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(M\bM-\b-T\bTA\bAB\bB)\b)
3780 Attempt completion on the text before point, comparing the text
3781 against lines from the history list for possible completion
3782 matches.
3783 d\bda\bab\bbb\bbr\bre\bev\bv-\b-e\bex\bxp\bpa\ban\bnd\bd
3784 Attempt menu completion on the text before point, comparing the
3785 text against lines from the history list for possible completion
3786 matches.
3787 c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-i\bin\bnt\bto\bo-\b-b\bbr\bra\bac\bce\bes\bs (\b(M\bM-\b-{\b{)\b)
3788 Perform filename completion and insert the list of possible com-
3789 pletions enclosed within braces so the list is available to the
3790 shell (see B\bBr\bra\bac\bce\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn above).
3791
3792 K\bKe\bey\byb\bbo\boa\bar\brd\bd M\bMa\bac\bcr\bro\bos\bs
3793 s\bst\bta\bar\brt\bt-\b-k\bkb\bbd\bd-\b-m\bma\bac\bcr\bro\bo (\b(C\bC-\b-x\bx (\b()\b)
3794 Begin saving the characters typed into the current keyboard
3795 macro.
3796 e\ben\bnd\bd-\b-k\bkb\bbd\bd-\b-m\bma\bac\bcr\bro\bo (\b(C\bC-\b-x\bx )\b))\b)
3797 Stop saving the characters typed into the current keyboard macro
3798 and store the definition.
3799 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)
3800 Re-execute the last keyboard macro defined, by making the char-
3801 acters in the macro appear as if typed at the keyboard.
3802 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)
3803 Print the last keyboard macro defined in a format suitable for
3804 the _\bi_\bn_\bp_\bu_\bt_\br_\bc file.
3805
3806 M\bMi\bis\bsc\bce\bel\bll\bla\ban\bne\beo\bou\bus\bs
3807 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)
3808 Read in the contents of the _\bi_\bn_\bp_\bu_\bt_\br_\bc file, and incorporate any
3809 bindings or variable assignments found there.
3810 a\bab\bbo\bor\brt\bt (\b(C\bC-\b-g\bg)\b)
3811 Abort the current editing command and ring the terminal's bell
3812 (subject to the setting of b\bbe\bel\bll\bl-\b-s\bst\bty\byl\ble\be).
3813 d\bdo\bo-\b-l\blo\bow\bwe\ber\brc\bca\bas\bse\be-\b-v\bve\ber\brs\bsi\bio\bon\bn (\b(M\bM-\b-A\bA,\b, M\bM-\b-B\bB,\b, M\bM-\b-_\bx,\b, .\b..\b..\b.)\b)
3814 If the metafied character _\bx is uppercase, run the command that
3815 is bound to the corresponding metafied lowercase character. The
3816 behavior is undefined if _\bx is already lowercase.
3817 p\bpr\bre\bef\bfi\bix\bx-\b-m\bme\bet\bta\ba (\b(E\bES\bSC\bC)\b)
3818 Metafy the next character typed. E\bES\bSC\bC f\bf is equivalent to M\bMe\bet\bta\ba-\b-f\bf.
3819 u\bun\bnd\bdo\bo (\b(C\bC-\b-_\b_,\b, C\bC-\b-x\bx C\bC-\b-u\bu)\b)
3820 Incremental undo, separately remembered for each line.
3821 r\bre\bev\bve\ber\brt\bt-\b-l\bli\bin\bne\be (\b(M\bM-\b-r\br)\b)
3822 Undo all changes made to this line. This is like executing the
3823 u\bun\bnd\bdo\bo command enough times to return the line to its initial
3824 state.
3825 t\bti\bil\bld\bde\be-\b-e\bex\bxp\bpa\ban\bnd\bd (\b(M\bM-\b-&\b&)\b)
3826 Perform tilde expansion on the current word.
3827 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)
3828 Set the mark to the point. If a numeric argument is supplied,
3829 the mark is set to that position.
3830 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)
3831 Swap the point with the mark. The current cursor position is
3832 set to the saved position, and the old cursor position is saved
3833 as the mark.
3834 c\bch\bha\bar\bra\bac\bct\bte\ber\br-\b-s\bse\bea\bar\brc\bch\bh (\b(C\bC-\b-]\b])\b)
3835 A character is read and point is moved to the next occurrence of
3836 that character. A negative count searches for previous occur-
3837 rences.
3838 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)
3839 A character is read and point is moved to the previous occur-
3840 rence of that character. A negative count searches for subse-
3841 quent occurrences.
3842 s\bsk\bki\bip\bp-\b-c\bcs\bsi\bi-\b-s\bse\beq\bqu\bue\ben\bnc\bce\be
3843 Read enough characters to consume a multi-key sequence such as
3844 those defined for keys like Home and End. Such sequences begin
3845 with a Control Sequence Indicator (CSI), usually ESC-[. If this
3846 sequence is bound to "\[", keys producing such sequences will
3847 have no effect unless explicitly bound to a readline command,
3848 instead of inserting stray characters into the editing buffer.
3849 This is unbound by default, but usually bound to ESC-[.
3850 i\bin\bns\bse\ber\brt\bt-\b-c\bco\bom\bmm\bme\ben\bnt\bt (\b(M\bM-\b-#\b#)\b)
3851 Without a numeric argument, the value of the readline c\bco\bom\bm-\b-
3852 m\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn variable is inserted at the beginning of the current
3853 line. If a numeric argument is supplied, this command acts as a
3854 toggle: if the characters at the beginning of the line do not
3855 match the value of c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn, the value is inserted, other-
3856 wise the characters in c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn are deleted from the begin-
3857 ning of the line. In either case, the line is accepted as if a
3858 newline had been typed. The default value of c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn
3859 causes this command to make the current line a shell comment.
3860 If a numeric argument causes the comment character to be
3861 removed, the line will be executed by the shell.
3862 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)
3863 The word before point is treated as a pattern for pathname
3864 expansion, with an asterisk implicitly appended. This pattern
3865 is used to generate a list of matching filenames for possible
3866 completions.
3867 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)
3868 The word before point is treated as a pattern for pathname
3869 expansion, and the list of matching filenames is inserted,
3870 replacing the word. If a numeric argument is supplied, an
3871 asterisk is appended before pathname expansion.
3872 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)
3873 The list of expansions that would have been generated by
3874 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
3875 numeric argument is supplied, an asterisk is appended before
3876 pathname expansion.
3877 d\bdu\bum\bmp\bp-\b-f\bfu\bun\bnc\bct\bti\bio\bon\bns\bs
3878 Print all of the functions and their key bindings to the read-
3879 line output stream. If a numeric argument is supplied, the out-
3880 put is formatted in such a way that it can be made part of an
3881 _\bi_\bn_\bp_\bu_\bt_\br_\bc file.
3882 d\bdu\bum\bmp\bp-\b-v\bva\bar\bri\bia\bab\bbl\ble\bes\bs
3883 Print all of the settable readline variables and their values to
3884 the readline output stream. If a numeric argument is supplied,
3885 the output is formatted in such a way that it can be made part
3886 of an _\bi_\bn_\bp_\bu_\bt_\br_\bc file.
3887 d\bdu\bum\bmp\bp-\b-m\bma\bac\bcr\bro\bos\bs
3888 Print all of the readline key sequences bound to macros and the
3889 strings they output. If a numeric argument is supplied, the
3890 output is formatted in such a way that it can be made part of an
3891 _\bi_\bn_\bp_\bu_\bt_\br_\bc file.
3892 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)
3893 Display version information about the current instance of b\bba\bas\bsh\bh.
3894
3895 P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn
3896 When word completion is attempted for an argument to a command for
3897 which a completion specification (a _\bc_\bo_\bm_\bp_\bs_\bp_\be_\bc) has been defined using
3898 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 program-
3899 mable completion facilities are invoked.
3900
3901 First, the command name is identified. If the command word is the
3902 empty string (completion attempted at the beginning of an empty line),
3903 any compspec defined with the -\b-E\bE option to c\bco\bom\bmp\bpl\ble\bet\bte\be is used. If a
3904 compspec has been defined for that command, the compspec is used to
3905 generate the list of possible completions for the word. If the command
3906 word is a full pathname, a compspec for the full pathname is searched
3907 for first. If no compspec is found for the full pathname, an attempt
3908 is made to find a compspec for the portion following the final slash.
3909 If those searches do not result in a compspec, any compspec defined
3910 with the -\b-D\bD option to c\bco\bom\bmp\bpl\ble\bet\bte\be is used as the default. If there is no
3911 default compspec, b\bba\bas\bsh\bh attempts alias expansion on the command word as
3912 a final resort, and attempts to find a compspec for the command word
3913 from any successful expansion.
3914
3915 Once a compspec has been found, it is used to generate the list of
3916 matching words. If a compspec is not found, the default b\bba\bas\bsh\bh comple-
3917 tion as described above under C\bCo\bom\bmp\bpl\ble\bet\bti\bin\bng\bg is performed.
3918
3919 First, the actions specified by the compspec are used. Only matches
3920 which are prefixed by the word being completed are returned. When the
3921 -\b-f\bf or -\b-d\bd option is used for filename or directory name completion, the
3922 shell variable F\bFI\bIG\bGN\bNO\bOR\bRE\bE is used to filter the matches.
3923
3924 Any completions specified by a pathname expansion pattern to the -\b-G\bG
3925 option are generated next. The words generated by the pattern need not
3926 match the word being completed. The G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE shell variable is not
3927 used to filter the matches, but the F\bFI\bIG\bGN\bNO\bOR\bRE\bE variable is used.
3928
3929 Next, the string specified as the argument to the -\b-W\bW option is consid-
3930 ered. The string is first split using the characters in the I\bIF\bFS\bS spe-
3931 cial variable as delimiters. Shell quoting is honored. Each word is
3932 then expanded using brace expansion, tilde expansion, parameter and
3933 variable expansion, command substitution, and arithmetic expansion, as
3934 described above under E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN. The results are split using the rules
3935 described above under W\bWo\bor\brd\bd S\bSp\bpl\bli\bit\btt\bti\bin\bng\bg. The results of the expansion are
3936 prefix-matched against the word being completed, and the matching words
3937 become the possible completions.
3938
3939 After these matches have been generated, any shell function or command
3940 specified with the -\b-F\bF and -\b-C\bC options is invoked. When the command or
3941 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
3942 variables are assigned values as described above under S\bSh\bhe\bel\bll\bl V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs.
3943 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
3944 variables are also set. When the function or command is invoked, the
3945 first argument ($\b$1\b1) is the name of the command whose arguments are
3946 being completed, the second argument ($\b$2\b2) is the word being completed,
3947 and the third argument ($\b$3\b3) is the word preceding the word being com-
3948 pleted on the current command line. No filtering of the generated com-
3949 pletions against the word being completed is performed; the function or
3950 command has complete freedom in generating the matches.
3951
3952 Any function specified with -\b-F\bF is invoked first. The function may use
3953 any of the shell facilities, including the c\bco\bom\bmp\bpg\bge\ben\bn builtin described
3954 below, to generate the matches. It must put the possible completions
3955 in the C\bCO\bOM\bMP\bPR\bRE\bEP\bPL\bLY\bY array variable, one per array element.
3956
3957 Next, any command specified with the -\b-C\bC option is invoked in an envi-
3958 ronment equivalent to command substitution. It should print a list of
3959 completions, one per line, to the standard output. Backslash may be
3960 used to escape a newline, if necessary.
3961
3962 After all of the possible completions are generated, any filter speci-
3963 fied with the -\b-X\bX option is applied to the list. The filter is a pat-
3964 tern as used for pathname expansion; a &\b& in the pattern is replaced
3965 with the text of the word being completed. A literal &\b& may be escaped
3966 with a backslash; the backslash is removed before attempting a match.
3967 Any completion that matches the pattern will be removed from the list.
3968 A leading !\b! negates the pattern; in this case any completion not match-
3969 ing the pattern will be removed. If the n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh shell option is
3970 enabled, the match is performed without regard to the case of alpha-
3971 betic characters.
3972
3973 Finally, any prefix and suffix specified with the -\b-P\bP and -\b-S\bS options are
3974 added to each member of the completion list, and the result is returned
3975 to the readline completion code as the list of possible completions.
3976
3977 If the previously-applied actions do not generate any matches, and the
3978 -\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
3979 defined, directory name completion is attempted.
3980
3981 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
3982 was defined, directory name completion is attempted and any matches are
3983 added to the results of the other actions.
3984
3985 By default, if a compspec is found, whatever it generates is returned
3986 to the completion code as the full set of possible completions. The
3987 default b\bba\bas\bsh\bh completions are not attempted, and the readline default of
3988 filename completion is disabled. If the -\b-o\bo b\bba\bas\bsh\bhd\bde\bef\bfa\bau\bul\blt\bt option was sup-
3989 plied to c\bco\bom\bmp\bpl\ble\bet\bte\be when the compspec was defined, the b\bba\bas\bsh\bh default com-
3990 pletions are attempted if the compspec generates no matches. If the -\b-o\bo
3991 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,
3992 readline's default completion will be performed if the compspec (and,
3993 if attempted, the default b\bba\bas\bsh\bh completions) generate no matches.
3994
3995 When a compspec indicates that directory name completion is desired,
3996 the programmable completion functions force readline to append a slash
3997 to completed names which are symbolic links to directories, subject to
3998 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
3999 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.
4000
4001 There is some support for dynamically modifying completions. This is
4002 most useful when used in combination with a default completion speci-
4003 fied with c\bco\bom\bmp\bpl\ble\bet\bte\be -\b-D\bD. It's possible for shell functions executed as
4004 completion handlers to indicate that completion should be retried by
4005 returning an exit status of 124. If a shell function returns 124, and
4006 changes the compspec associated with the command on which completion is
4007 being attempted (supplied as the first argument when the function is
4008 executed), programmable completion restarts from the beginning, with an
4009 attempt to find a new compspec for that command. This allows a set of
4010 completions to be built dynamically as completion is attempted, rather
4011 than being loaded all at once.
4012
4013 For instance, assuming that there is a library of compspecs, each kept
4014 in a file corresponding to the name of the command, the following
4015 default completion function would load completions dynamically:
4016
4017 _completion_loader()
4018 {
4019 . "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124
4020 }
4021 complete -D -F _completion_loader -o bashdefault -o default
4022
4023
4024 H\bHI\bIS\bST\bTO\bOR\bRY\bY
4025 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
4026 provides access to the _\bc_\bo_\bm_\bm_\ba_\bn_\bd _\bh_\bi_\bs_\bt_\bo_\br_\by, the list of commands previously
4027 typed. The value of the H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE variable is used as the number of
4028 commands to save in a history list. The text of the last H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE com-
4029 mands (default 500) is saved. The shell stores each command in the
4030 history list prior to parameter and variable expansion (see E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN
4031 above) but after history expansion is performed, subject to the values
4032 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.
4033
4034 On startup, the history is initialized from the file named by the vari-
4035 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
4036 of H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is truncated, if necessary, to contain no more than the
4037 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-
4038 S\bSI\bIZ\bZE\bE is unset, or set to null, a non-numeric value, or a numeric value
4039 less than zero, the history file is not truncated. When the history
4040 file is read, lines beginning with the history comment character fol-
4041 lowed immediately by a digit are interpreted as timestamps for the fol-
4042 lowing history line. These timestamps are optionally displayed depend-
4043 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
4044 history enabled exits, the last $\b$H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE lines are copied from the
4045 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
4046 (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
4047 lines are appended to the history file, otherwise the history file is
4048 overwritten. If H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is unset, or if the history file is
4049 unwritable, the history is not saved. If the H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT variable
4050 is set, time stamps are written to the history file, marked with the
4051 history comment character, so they may be preserved across shell ses-
4052 sions. This uses the history comment character to distinguish time-
4053 stamps from other history lines. After saving the history, the history
4054 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-
4055 F\bFI\bIL\bLE\bES\bSI\bIZ\bZE\bE is unset, or set to null, a non-numeric value, or a numeric
4056 value less than zero, the history file is not truncated.
4057
4058 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
4059 to list or edit and re-execute a portion of the history list. The h\bhi\bis\bs-\b-
4060 t\bto\bor\bry\by builtin may be used to display or modify the history list and
4061 manipulate the history file. When using command-line editing, search
4062 commands are available in each editing mode that provide access to the
4063 history list.
4064
4065 The shell allows control over which commands are saved on the history
4066 list. The H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL and H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE variables may be set to cause the
4067 shell to save only a subset of the commands entered. The c\bcm\bmd\bdh\bhi\bis\bst\bt shell
4068 option, if enabled, causes the shell to attempt to save each line of a
4069 multi-line command in the same history entry, adding semicolons where
4070 necessary to preserve syntactic correctness. The l\bli\bit\bth\bhi\bis\bst\bt shell option
4071 causes the shell to save the command with embedded newlines instead of
4072 semicolons. See the description of the s\bsh\bho\bop\bpt\bt builtin below under S\bSH\bHE\bEL\bLL\bL
4073 B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS for information on setting and unsetting shell
4074 options.
4075
4076 H\bHI\bIS\bST\bTO\bOR\bRY\bY E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN
4077 The shell supports a history expansion feature that is similar to the
4078 history expansion in c\bcs\bsh\bh. This section describes what syntax features
4079 are available. This feature is enabled by default for interactive
4080 shells, and can be disabled using the +\b+H\bH option to the s\bse\bet\bt builtin com-
4081 mand (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below). Non-interactive shells do not
4082 perform history expansion by default.
4083
4084 History expansions introduce words from the history list into the input
4085 stream, making it easy to repeat commands, insert the arguments to a
4086 previous command into the current input line, or fix errors in previous
4087 commands quickly.
4088
4089 History expansion is performed immediately after a complete line is
4090 read, before the shell breaks it into words, and is performed on each
4091 line individually without taking quoting on previous lines into
4092 account. It takes place in two parts. The first is to determine which
4093 line from the history list to use during substitution. The second is
4094 to select portions of that line for inclusion into the current one.
4095 The line selected from the history is the _\be_\bv_\be_\bn_\bt, and the portions of
4096 that line that are acted upon are _\bw_\bo_\br_\bd_\bs. Various _\bm_\bo_\bd_\bi_\bf_\bi_\be_\br_\bs are avail-
4097 able to manipulate the selected words. The line is broken into words
4098 in the same fashion as when reading input, so that several _\bm_\be_\bt_\ba_\bc_\bh_\ba_\br_\ba_\bc_\b-
4099 _\bt_\be_\br-separated words surrounded by quotes are considered one word. His-
4100 tory expansions are introduced by the appearance of the history expan-
4101 sion character, which is !\b! by default. Only backslash (\\b\) and single
4102 quotes can quote the history expansion character, but the history
4103 expansion character is also treated as quoted if it immediately pre-
4104 cedes the closing double quote in a double-quoted string.
4105
4106 Several characters inhibit history expansion if found immediately fol-
4107 lowing the history expansion character, even if it is unquoted: space,
4108 tab, newline, carriage return, and =\b=. If the e\bex\bxt\btg\bgl\blo\bob\bb shell option is
4109 enabled, (\b( will also inhibit expansion.
4110
4111 Several shell options settable with the s\bsh\bho\bop\bpt\bt builtin may be used to
4112 tailor the behavior of history expansion. If the h\bhi\bis\bst\btv\bve\ber\bri\bif\bfy\by shell
4113 option is enabled (see the description of the s\bsh\bho\bop\bpt\bt builtin below), and
4114 r\bre\bea\bad\bdl\bli\bin\bne\be is being used, history substitutions are not immediately
4115 passed to the shell parser. Instead, the expanded line is reloaded
4116 into the r\bre\bea\bad\bdl\bli\bin\bne\be editing buffer for further modification. If r\bre\bea\bad\bdl\bli\bin\bne\be
4117 is being used, and the h\bhi\bis\bst\btr\bre\bee\bed\bdi\bit\bt shell option is enabled, a failed
4118 history substitution will be reloaded into the r\bre\bea\bad\bdl\bli\bin\bne\be editing buffer
4119 for correction. The -\b-p\bp option to the h\bhi\bis\bst\bto\bor\bry\by builtin command may be
4120 used to see what a history expansion will do before using it. The -\b-s\bs
4121 option to the h\bhi\bis\bst\bto\bor\bry\by builtin may be used to add commands to the end of
4122 the history list without actually executing them, so that they are
4123 available for subsequent recall.
4124
4125 The shell allows control of the various characters used by the history
4126 expansion mechanism (see the description of h\bhi\bis\bst\btc\bch\bha\bar\brs\bs above under S\bSh\bhe\bel\bll\bl
4127 V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs). The shell uses the history comment character to mark his-
4128 tory timestamps when writing the history file.
4129
4130 E\bEv\bve\ben\bnt\bt D\bDe\bes\bsi\big\bgn\bna\bat\bto\bor\brs\bs
4131 An event designator is a reference to a command line entry in the his-
4132 tory list. Unless the reference is absolute, events are relative to
4133 the current position in the history list.
4134
4135 !\b! Start a history substitution, except when followed by a b\bbl\bla\ban\bnk\bk,
4136 newline, carriage return, = or ( (when the e\bex\bxt\btg\bgl\blo\bob\bb shell option
4137 is enabled using the s\bsh\bho\bop\bpt\bt builtin).
4138 !\b!_\bn Refer to command line _\bn.
4139 !\b!-\b-_\bn Refer to the current command minus _\bn.
4140 !\b!!\b! Refer to the previous command. This is a synonym for `!-1'.
4141 !\b!_\bs_\bt_\br_\bi_\bn_\bg
4142 Refer to the most recent command preceding the current position
4143 in the history list starting with _\bs_\bt_\br_\bi_\bn_\bg.
4144 !\b!?\b?_\bs_\bt_\br_\bi_\bn_\bg[\b[?\b?]\b]
4145 Refer to the most recent command preceding the current position
4146 in the history list containing _\bs_\bt_\br_\bi_\bn_\bg. The trailing ?\b? may be
4147 omitted if _\bs_\bt_\br_\bi_\bn_\bg is followed immediately by a newline.
4148 ^\b^_\bs_\bt_\br_\bi_\bn_\bg_\b1^\b^_\bs_\bt_\br_\bi_\bn_\bg_\b2^\b^
4149 Quick substitution. Repeat the previous command, replacing
4150 _\bs_\bt_\br_\bi_\bn_\bg_\b1 with _\bs_\bt_\br_\bi_\bn_\bg_\b2. Equivalent to ``!!:s/_\bs_\bt_\br_\bi_\bn_\bg_\b1/_\bs_\bt_\br_\bi_\bn_\bg_\b2/''
4151 (see M\bMo\bod\bdi\bif\bfi\bie\ber\brs\bs below).
4152 !\b!#\b# The entire command line typed so far.
4153
4154 W\bWo\bor\brd\bd D\bDe\bes\bsi\big\bgn\bna\bat\bto\bor\brs\bs
4155 Word designators are used to select desired words from the event. A :\b:
4156 separates the event specification from the word designator. It may be
4157 omitted if the word designator begins with a ^\b^, $\b$, *\b*, -\b-, or %\b%. Words
4158 are numbered from the beginning of the line, with the first word being
4159 denoted by 0 (zero). Words are inserted into the current line sepa-
4160 rated by single spaces.
4161
4162 0\b0 (\b(z\bze\ber\bro\bo)\b)
4163 The zeroth word. For the shell, this is the command word.
4164 _\bn The _\bnth word.
4165 ^\b^ The first argument. That is, word 1.
4166 $\b$ The last word. This is usually the last argument, but will
4167 expand to the zeroth word if there is only one word in the line.
4168 %\b% The word matched by the most recent `?_\bs_\bt_\br_\bi_\bn_\bg?' search.
4169 _\bx-\b-_\by A range of words; `-_\by' abbreviates `0-_\by'.
4170 *\b* All of the words but the zeroth. This is a synonym for `_\b1_\b-_\b$'.
4171 It is not an error to use *\b* if there is just one word in the
4172 event; the empty string is returned in that case.
4173 x\bx*\b* Abbreviates _\bx_\b-_\b$.
4174 x\bx-\b- Abbreviates _\bx_\b-_\b$ like x\bx*\b*, but omits the last word.
4175
4176 If a word designator is supplied without an event specification, the
4177 previous command is used as the event.
4178
4179 M\bMo\bod\bdi\bif\bfi\bie\ber\brs\bs
4180 After the optional word designator, there may appear a sequence of one
4181 or more of the following modifiers, each preceded by a `:'.
4182
4183 h\bh Remove a trailing filename component, leaving only the head.
4184 t\bt Remove all leading filename components, leaving the tail.
4185 r\br Remove a trailing suffix of the form _\b._\bx_\bx_\bx, leaving the basename.
4186 e\be Remove all but the trailing suffix.
4187 p\bp Print the new command but do not execute it.
4188 q\bq Quote the substituted words, escaping further substitutions.
4189 x\bx Quote the substituted words as with q\bq, but break into words at
4190 b\bbl\bla\ban\bnk\bks\bs and newlines.
4191 s\bs/\b/_\bo_\bl_\bd/\b/_\bn_\be_\bw/\b/
4192 Substitute _\bn_\be_\bw for the first occurrence of _\bo_\bl_\bd in the event
4193 line. Any delimiter can be used in place of /. The final
4194 delimiter is optional if it is the last character of the event
4195 line. The delimiter may be quoted in _\bo_\bl_\bd and _\bn_\be_\bw with a single
4196 backslash. If & appears in _\bn_\be_\bw, it is replaced by _\bo_\bl_\bd. A sin-
4197 gle backslash will quote the &. If _\bo_\bl_\bd is null, it is set to
4198 the last _\bo_\bl_\bd substituted, or, if no previous history substitu-
4199 tions took place, the last _\bs_\bt_\br_\bi_\bn_\bg in a !\b!?\b?_\bs_\bt_\br_\bi_\bn_\bg[\b[?\b?]\b] search.
4200 &\b& Repeat the previous substitution.
4201 g\bg Cause changes to be applied over the entire event line. This is
4202 used in conjunction with `:\b:s\bs' (e.g., `:\b:g\bgs\bs/\b/_\bo_\bl_\bd/\b/_\bn_\be_\bw/\b/') or `:\b:&\b&'.
4203 If used with `:\b:s\bs', any delimiter can be used in place of /, and
4204 the final delimiter is optional if it is the last character of
4205 the event line. An a\ba may be used as a synonym for g\bg.
4206 G\bG Apply the following `s\bs' modifier once to each word in the event
4207 line.
4208
4209 S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
4210 Unless otherwise noted, each builtin command documented in this section
4211 as accepting options preceded by -\b- accepts -\b--\b- to signify the end of the
4212 options. The :\b:, t\btr\bru\bue\be, f\bfa\bal\bls\bse\be, and t\bte\bes\bst\bt/[\b[ builtins do not accept options
4213 and do not treat -\b--\b- specially. The e\bex\bxi\bit\bt, l\blo\bog\bgo\bou\but\bt, r\bre\bet\btu\bur\brn\bn, b\bbr\bre\bea\bak\bk, c\bco\bon\bn-\b-
4214 t\bti\bin\bnu\bue\be, l\ble\bet\bt, and s\bsh\bhi\bif\bft\bt builtins accept and process arguments beginning
4215 with -\b- without requiring -\b--\b-. Other builtins that accept arguments but
4216 are not specified as accepting options interpret arguments beginning
4217 with -\b- as invalid options and require -\b--\b- to prevent this interpreta-
4218 tion.
4219 :\b: [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
4220 No effect; the command does nothing beyond expanding _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs
4221 and performing any specified redirections. The return status is
4222 zero.
4223
4224 .\b. _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
4225 s\bso\bou\bur\brc\bce\be _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
4226 Read and execute commands from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be in the current shell
4227 environment and return the exit status of the last command exe-
4228 cuted from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be. If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be does not contain a slash,
4229 filenames in P\bPA\bAT\bTH\bH are used to find the directory containing
4230 _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be. The file searched for in P\bPA\bAT\bTH\bH need not be executable.
4231 When b\bba\bas\bsh\bh is not in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, the current directory is
4232 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
4233 to the s\bsh\bho\bop\bpt\bt builtin command is turned off, the P\bPA\bAT\bTH\bH is not
4234 searched. If any _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs are supplied, they become the posi-
4235 tional parameters when _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is executed. Otherwise the
4236 positional parameters are unchanged. If the -\b-T\bT option is
4237 enabled, s\bso\bou\bur\brc\bce\be inherits any trap on D\bDE\bEB\bBU\bUG\bG; if it is not, any
4238 D\bDE\bEB\bBU\bUG\bG trap string is saved and restored around the call to
4239 s\bso\bou\bur\brc\bce\be, and s\bso\bou\bur\brc\bce\be unsets the D\bDE\bEB\bBU\bUG\bG trap while it executes. If
4240 -\b-T\bT is not set, and the sourced file changes the D\bDE\bEB\bBU\bUG\bG trap, the
4241 new value is retained when s\bso\bou\bur\brc\bce\be completes. The return status
4242 is the status of the last command exited within the script (0 if
4243 no commands are executed), and false if _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is not found or
4244 cannot be read.
4245
4246 a\bal\bli\bia\bas\bs [-\b-p\bp] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ...]
4247 A\bAl\bli\bia\bas\bs with no arguments or with the -\b-p\bp option prints the list of
4248 aliases in the form a\bal\bli\bia\bas\bs _\bn_\ba_\bm_\be=_\bv_\ba_\bl_\bu_\be on standard output. When
4249 arguments are supplied, an alias is defined for each _\bn_\ba_\bm_\be whose
4250 _\bv_\ba_\bl_\bu_\be is given. A trailing space in _\bv_\ba_\bl_\bu_\be causes the next word
4251 to be checked for alias substitution when the alias is expanded.
4252 For each _\bn_\ba_\bm_\be in the argument list for which no _\bv_\ba_\bl_\bu_\be is sup-
4253 plied, the name and value of the alias is printed. A\bAl\bli\bia\bas\bs
4254 returns true unless a _\bn_\ba_\bm_\be is given for which no alias has been
4255 defined.
4256
4257 b\bbg\bg [_\bj_\bo_\bb_\bs_\bp_\be_\bc ...]
4258 Resume each suspended job _\bj_\bo_\bb_\bs_\bp_\be_\bc in the background, as if it
4259 had been started with &\b&. If _\bj_\bo_\bb_\bs_\bp_\be_\bc is not present, the shell's
4260 notion of the _\bc_\bu_\br_\br_\be_\bn_\bt _\bj_\bo_\bb is used. b\bbg\bg _\bj_\bo_\bb_\bs_\bp_\be_\bc returns 0 unless
4261 run when job control is disabled or, when run with job control
4262 enabled, any specified _\bj_\bo_\bb_\bs_\bp_\be_\bc was not found or was started
4263 without job control.
4264
4265 b\bbi\bin\bnd\bd [-\b-m\bm _\bk_\be_\by_\bm_\ba_\bp] [-\b-l\blp\bps\bsv\bvP\bPS\bSV\bVX\bX]
4266 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]
4267 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
4268 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
4269 b\bbi\bin\bnd\bd [-\b-m\bm _\bk_\be_\by_\bm_\ba_\bp] _\bk_\be_\by_\bs_\be_\bq:_\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be
4270 b\bbi\bin\bnd\bd [-\b-m\bm _\bk_\be_\by_\bm_\ba_\bp] _\bk_\be_\by_\bs_\be_\bq:_\br_\be_\ba_\bd_\bl_\bi_\bn_\be_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd
4271 Display current r\bre\bea\bad\bdl\bli\bin\bne\be key and function bindings, bind a key
4272 sequence to a r\bre\bea\bad\bdl\bli\bin\bne\be function or macro, or set a r\bre\bea\bad\bdl\bli\bin\bne\be
4273 variable. Each non-option argument is a command as it would
4274 appear in _\b._\bi_\bn_\bp_\bu_\bt_\br_\bc, but each binding or command must be passed
4275 as a separate argument; e.g., '"\C-x\C-r": re-read-init-file'.
4276 Options, if supplied, have the following meanings:
4277 -\b-m\bm _\bk_\be_\by_\bm_\ba_\bp
4278 Use _\bk_\be_\by_\bm_\ba_\bp as the keymap to be affected by the subsequent
4279 bindings. Acceptable _\bk_\be_\by_\bm_\ba_\bp names are _\be_\bm_\ba_\bc_\bs_\b, _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\b-
4280 _\bd_\ba_\br_\bd_\b, _\be_\bm_\ba_\bc_\bs_\b-_\bm_\be_\bt_\ba_\b, _\be_\bm_\ba_\bc_\bs_\b-_\bc_\bt_\bl_\bx_\b, _\bv_\bi_\b, _\bv_\bi_\b-_\bm_\bo_\bv_\be_\b, _\bv_\bi_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd,
4281 and _\bv_\bi_\b-_\bi_\bn_\bs_\be_\br_\bt. _\bv_\bi is equivalent to _\bv_\bi_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd (_\bv_\bi_\b-_\bm_\bo_\bv_\be
4282 is also a synonym); _\be_\bm_\ba_\bc_\bs is equivalent to _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\b-
4283 _\bd_\ba_\br_\bd.
4284 -\b-l\bl List the names of all r\bre\bea\bad\bdl\bli\bin\bne\be functions.
4285 -\b-p\bp Display r\bre\bea\bad\bdl\bli\bin\bne\be function names and bindings in such a
4286 way that they can be re-read.
4287 -\b-P\bP List current r\bre\bea\bad\bdl\bli\bin\bne\be function names and bindings.
4288 -\b-s\bs Display r\bre\bea\bad\bdl\bli\bin\bne\be key sequences bound to macros and the
4289 strings they output in such a way that they can be re-
4290 read.
4291 -\b-S\bS Display r\bre\bea\bad\bdl\bli\bin\bne\be key sequences bound to macros and the
4292 strings they output.
4293 -\b-v\bv Display r\bre\bea\bad\bdl\bli\bin\bne\be variable names and values in such a way
4294 that they can be re-read.
4295 -\b-V\bV List current r\bre\bea\bad\bdl\bli\bin\bne\be variable names and values.
4296 -\b-f\bf _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
4297 Read key bindings from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be.
4298 -\b-q\bq _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn
4299 Query about which keys invoke the named _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn.
4300 -\b-u\bu _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn
4301 Unbind all keys bound to the named _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn.
4302 -\b-r\br _\bk_\be_\by_\bs_\be_\bq
4303 Remove any current binding for _\bk_\be_\by_\bs_\be_\bq.
4304 -\b-x\bx _\bk_\be_\by_\bs_\be_\bq:\b:_\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd
4305 Cause _\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd to be executed whenever _\bk_\be_\by_\bs_\be_\bq is
4306 entered. When _\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd is executed, the shell sets
4307 the R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_L\bLI\bIN\bNE\bE variable to the contents of the r\bre\bea\bad\bd-\b-
4308 l\bli\bin\bne\be line buffer and the R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_P\bPO\bOI\bIN\bNT\bT variable to the
4309 current location of the insertion point. If the executed
4310 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-
4311 L\bLI\bIN\bNE\bE_\b_P\bPO\bOI\bIN\bNT\bT, those new values will be reflected in the
4312 editing state.
4313 -\b-X\bX List all key sequences bound to shell commands and the
4314 associated commands in a format that can be reused as
4315 input.
4316
4317 The return value is 0 unless an unrecognized option is given or
4318 an error occurred.
4319
4320 b\bbr\bre\bea\bak\bk [_\bn]
4321 Exit from within a f\bfo\bor\br, w\bwh\bhi\bil\ble\be, u\bun\bnt\bti\bil\bl, or s\bse\bel\ble\bec\bct\bt loop. If _\bn is
4322 specified, break _\bn levels. _\bn must be >= 1. If _\bn is greater
4323 than the number of enclosing loops, all enclosing loops are
4324 exited. The return value is 0 unless _\bn is not greater than or
4325 equal to 1.
4326
4327 b\bbu\bui\bil\blt\bti\bin\bn _\bs_\bh_\be_\bl_\bl_\b-_\bb_\bu_\bi_\bl_\bt_\bi_\bn [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
4328 Execute the specified shell builtin, passing it _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs, and
4329 return its exit status. This is useful when defining a function
4330 whose name is the same as a shell builtin, retaining the func-
4331 tionality of the builtin within the function. The c\bcd\bd builtin is
4332 commonly redefined this way. The return status is false if
4333 _\bs_\bh_\be_\bl_\bl_\b-_\bb_\bu_\bi_\bl_\bt_\bi_\bn is not a shell builtin command.
4334
4335 c\bca\bal\bll\ble\ber\br [_\be_\bx_\bp_\br]
4336 Returns the context of any active subroutine call (a shell func-
4337 tion or a script executed with the .\b. or s\bso\bou\bur\brc\bce\be builtins). With-
4338 out _\be_\bx_\bp_\br, c\bca\bal\bll\ble\ber\br displays the line number and source filename of
4339 the current subroutine call. If a non-negative integer is sup-
4340 plied as _\be_\bx_\bp_\br, c\bca\bal\bll\ble\ber\br displays the line number, subroutine name,
4341 and source file corresponding to that position in the current
4342 execution call stack. This extra information may be used, for
4343 example, to print a stack trace. The current frame is frame 0.
4344 The return value is 0 unless the shell is not executing a sub-
4345 routine call or _\be_\bx_\bp_\br does not correspond to a valid position in
4346 the call stack.
4347
4348 c\bcd\bd [-\b-L\bL|[-\b-P\bP [-\b-e\be]] [-@]] [_\bd_\bi_\br]
4349 Change the current directory to _\bd_\bi_\br. if _\bd_\bi_\br is not supplied,
4350 the value of the H\bHO\bOM\bME\bE shell variable is the default. Any addi-
4351 tional arguments following _\bd_\bi_\br are ignored. The variable C\bCD\bDP\bPA\bAT\bTH\bH
4352 defines the search path for the directory containing _\bd_\bi_\br: each
4353 directory name in C\bCD\bDP\bPA\bAT\bTH\bH is searched for _\bd_\bi_\br. Alternative
4354 directory names in C\bCD\bDP\bPA\bAT\bTH\bH are separated by a colon (:). A null
4355 directory name in C\bCD\bDP\bPA\bAT\bTH\bH is the same as the current directory,
4356 i.e., ``.\b.''. If _\bd_\bi_\br begins with a slash (/), then C\bCD\bDP\bPA\bAT\bTH\bH is not
4357 used. The -\b-P\bP option causes c\bcd\bd to use the physical directory
4358 structure by resolving symbolic links while traversing _\bd_\bi_\br and
4359 before processing instances of _\b._\b. in _\bd_\bi_\br (see also the -\b-P\bP option
4360 to the s\bse\bet\bt builtin command); the -\b-L\bL option forces symbolic links
4361 to be followed by resolving the link after processing instances
4362 of _\b._\b. in _\bd_\bi_\br. If _\b._\b. appears in _\bd_\bi_\br, it is processed by removing
4363 the immediately previous pathname component from _\bd_\bi_\br, back to a
4364 slash or the beginning of _\bd_\bi_\br. If the -\b-e\be option is supplied
4365 with -\b-P\bP, and the current working directory cannot be success-
4366 fully determined after a successful directory change, c\bcd\bd will
4367 return an unsuccessful status. On systems that support it, the
4368 -\b-@\b@ option presents the extended attributes associated with a
4369 file as a directory. An argument of -\b- is converted to $\b$O\bOL\bLD\bDP\bPW\bWD\bD
4370 before the directory change is attempted. If a non-empty direc-
4371 tory name from C\bCD\bDP\bPA\bAT\bTH\bH is used, or if -\b- is the first argument,
4372 and the directory change is successful, the absolute pathname of
4373 the new working directory is written to the standard output.
4374 The return value is true if the directory was successfully
4375 changed; false otherwise.
4376
4377 c\bco\bom\bmm\bma\ban\bnd\bd [-\b-p\bpV\bVv\bv] _\bc_\bo_\bm_\bm_\ba_\bn_\bd [_\ba_\br_\bg ...]
4378 Run _\bc_\bo_\bm_\bm_\ba_\bn_\bd with _\ba_\br_\bg_\bs suppressing the normal shell function
4379 lookup. Only builtin commands or commands found in the P\bPA\bAT\bTH\bH are
4380 executed. If the -\b-p\bp option is given, the search for _\bc_\bo_\bm_\bm_\ba_\bn_\bd is
4381 performed using a default value for P\bPA\bAT\bTH\bH that is guaranteed to
4382 find all of the standard utilities. If either the -\b-V\bV or -\b-v\bv
4383 option is supplied, a description of _\bc_\bo_\bm_\bm_\ba_\bn_\bd is printed. The -\b-v\bv
4384 option causes a single word indicating the command or filename
4385 used to invoke _\bc_\bo_\bm_\bm_\ba_\bn_\bd to be displayed; the -\b-V\bV option produces a
4386 more verbose description. If the -\b-V\bV or -\b-v\bv option is supplied,
4387 the exit status is 0 if _\bc_\bo_\bm_\bm_\ba_\bn_\bd was found, and 1 if not. If
4388 neither option is supplied and an error occurred or _\bc_\bo_\bm_\bm_\ba_\bn_\bd can-
4389 not be found, the exit status is 127. Otherwise, the exit sta-
4390 tus of the c\bco\bom\bmm\bma\ban\bnd\bd builtin is the exit status of _\bc_\bo_\bm_\bm_\ba_\bn_\bd.
4391
4392 c\bco\bom\bmp\bpg\bge\ben\bn [_\bo_\bp_\bt_\bi_\bo_\bn] [_\bw_\bo_\br_\bd]
4393 Generate possible completion matches for _\bw_\bo_\br_\bd according to the
4394 _\bo_\bp_\bt_\bi_\bo_\bns, which may be any option accepted by the c\bco\bom\bmp\bpl\ble\bet\bte\be
4395 builtin with the exception of -\b-p\bp and -\b-r\br, and write the matches
4396 to the standard output. When using the -\b-F\bF or -\b-C\bC options, the
4397 various shell variables set by the programmable completion
4398 facilities, while available, will not have useful values.
4399
4400 The matches will be generated in the same way as if the program-
4401 mable completion code had generated them directly from a comple-
4402 tion specification with the same flags. If _\bw_\bo_\br_\bd is specified,
4403 only those completions matching _\bw_\bo_\br_\bd will be displayed.
4404
4405 The return value is true unless an invalid option is supplied,
4406 or no matches were generated.
4407
4408 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\bEI\bI] [-\b-A\bA _\ba_\bc_\bt_\bi_\bo_\bn] [-\b-G\bG _\bg_\bl_\bo_\bb_\b-
4409 _\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]
4410 [-\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.]
4411 c\bco\bom\bmp\bpl\ble\bet\bte\be -\b-p\bpr\br [-\b-D\bDE\bEI\bI] [_\bn_\ba_\bm_\be ...]
4412 Specify how arguments to each _\bn_\ba_\bm_\be should be completed. If the
4413 -\b-p\bp option is supplied, or if no options are supplied, existing
4414 completion specifications are printed in a way that allows them
4415 to be reused as input. The -\b-r\br option removes a completion spec-
4416 ification for each _\bn_\ba_\bm_\be, or, if no _\bn_\ba_\bm_\bes are supplied, all com-
4417 pletion specifications. The -\b-D\bD option indicates that other sup-
4418 plied options and actions should apply to the ``default'' com-
4419 mand completion; that is, completion attempted on a command for
4420 which no completion has previously been defined. The -\b-E\bE option
4421 indicates that other supplied options and actions should apply
4422 to ``empty'' command completion; that is, completion attempted
4423 on a blank line. The -\b-I\bI option indicates that other supplied
4424 options and actions should apply to completion on the inital
4425 non-assignment word on the line, or after a command delimiter
4426 such as ;\b; or |\b|, which is usually command name completion. If
4427 multiple options are supplied, the -\b-D\bD option takes precedence
4428 over -\b-E\bE, and both take precedence over -\b-I\bI. If any of -\b-D\bD, -\b-E\bE, or
4429 -\b-I\bI are supplied, any other _\bn_\ba_\bm_\be arguments are ignored; these
4430 completions only apply to the case specified by the option.
4431
4432 The process of applying these completion specifications when
4433 word completion is attempted is described above under P\bPr\bro\bog\bgr\bra\bam\bm-\b-
4434 m\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn.
4435
4436 Other options, if specified, have the following meanings. The
4437 arguments to the -\b-G\bG, -\b-W\bW, and -\b-X\bX options (and, if necessary, the
4438 -\b-P\bP and -\b-S\bS options) should be quoted to protect them from expan-
4439 sion before the c\bco\bom\bmp\bpl\ble\bet\bte\be builtin is invoked.
4440 -\b-o\bo _\bc_\bo_\bm_\bp_\b-_\bo_\bp_\bt_\bi_\bo_\bn
4441 The _\bc_\bo_\bm_\bp_\b-_\bo_\bp_\bt_\bi_\bo_\bn controls several aspects of the comp-
4442 spec's behavior beyond the simple generation of comple-
4443 tions. _\bc_\bo_\bm_\bp_\b-_\bo_\bp_\bt_\bi_\bo_\bn may be one of:
4444 b\bba\bas\bsh\bhd\bde\bef\bfa\bau\bul\blt\bt
4445 Perform the rest of the default b\bba\bas\bsh\bh completions
4446 if the compspec generates no matches.
4447 d\bde\bef\bfa\bau\bul\blt\bt Use readline's default filename completion if
4448 the compspec generates no matches.
4449 d\bdi\bir\brn\bna\bam\bme\bes\bs
4450 Perform directory name completion if the comp-
4451 spec generates no matches.
4452 f\bfi\bil\ble\ben\bna\bam\bme\bes\bs
4453 Tell readline that the compspec generates file-
4454 names, so it can perform any filename-specific
4455 processing (like adding a slash to directory
4456 names, quoting special characters, or suppress-
4457 ing trailing spaces). Intended to be used with
4458 shell functions.
4459 n\bno\boq\bqu\buo\bot\bte\be Tell readline not to quote the completed words
4460 if they are filenames (quoting filenames is the
4461 default).
4462 n\bno\bos\bso\bor\brt\bt Tell readline not to sort the list of possible
4463 completions alphabetically.
4464 n\bno\bos\bsp\bpa\bac\bce\be Tell readline not to append a space (the
4465 default) to words completed at the end of the
4466 line.
4467 p\bpl\blu\bus\bsd\bdi\bir\brs\bs
4468 After any matches defined by the compspec are
4469 generated, directory name completion is
4470 attempted and any matches are added to the
4471 results of the other actions.
4472 -\b-A\bA _\ba_\bc_\bt_\bi_\bo_\bn
4473 The _\ba_\bc_\bt_\bi_\bo_\bn may be one of the following to generate a
4474 list of possible completions:
4475 a\bal\bli\bia\bas\bs Alias names. May also be specified as -\b-a\ba.
4476 a\bar\brr\bra\bay\byv\bva\bar\br
4477 Array variable names.
4478 b\bbi\bin\bnd\bdi\bin\bng\bg R\bRe\bea\bad\bdl\bli\bin\bne\be key binding names.
4479 b\bbu\bui\bil\blt\bti\bin\bn Names of shell builtin commands. May also be
4480 specified as -\b-b\bb.
4481 c\bco\bom\bmm\bma\ban\bnd\bd Command names. May also be specified as -\b-c\bc.
4482 d\bdi\bir\bre\bec\bct\bto\bor\bry\by
4483 Directory names. May also be specified as -\b-d\bd.
4484 d\bdi\bis\bsa\bab\bbl\ble\bed\bd
4485 Names of disabled shell builtins.
4486 e\ben\bna\bab\bbl\ble\bed\bd Names of enabled shell builtins.
4487 e\bex\bxp\bpo\bor\brt\bt Names of exported shell variables. May also be
4488 specified as -\b-e\be.
4489 f\bfi\bil\ble\be File names. May also be specified as -\b-f\bf.
4490 f\bfu\bun\bnc\bct\bti\bio\bon\bn
4491 Names of shell functions.
4492 g\bgr\bro\bou\bup\bp Group names. May also be specified as -\b-g\bg.
4493 h\bhe\bel\blp\bpt\bto\bop\bpi\bic\bc
4494 Help topics as accepted by the h\bhe\bel\blp\bp builtin.
4495 h\bho\bos\bst\btn\bna\bam\bme\be
4496 Hostnames, as taken from the file specified by
4497 the H\bHO\bOS\bST\bTF\bFI\bIL\bLE\bE shell variable.
4498 j\bjo\bob\bb Job names, if job control is active. May also
4499 be specified as -\b-j\bj.
4500 k\bke\bey\byw\bwo\bor\brd\bd Shell reserved words. May also be specified as
4501 -\b-k\bk.
4502 r\bru\bun\bnn\bni\bin\bng\bg Names of running jobs, if job control is active.
4503 s\bse\ber\brv\bvi\bic\bce\be Service names. May also be specified as -\b-s\bs.
4504 s\bse\bet\bto\bop\bpt\bt Valid arguments for the -\b-o\bo option to the s\bse\bet\bt
4505 builtin.
4506 s\bsh\bho\bop\bpt\bt Shell option names as accepted by the s\bsh\bho\bop\bpt\bt
4507 builtin.
4508 s\bsi\big\bgn\bna\bal\bl Signal names.
4509 s\bst\bto\bop\bpp\bpe\bed\bd Names of stopped jobs, if job control is active.
4510 u\bus\bse\ber\br User names. May also be specified as -\b-u\bu.
4511 v\bva\bar\bri\bia\bab\bbl\ble\be
4512 Names of all shell variables. May also be spec-
4513 ified as -\b-v\bv.
4514 -\b-C\bC _\bc_\bo_\bm_\bm_\ba_\bn_\bd
4515 _\bc_\bo_\bm_\bm_\ba_\bn_\bd is executed in a subshell environment, and its
4516 output is used as the possible completions.
4517 -\b-F\bF _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn
4518 The shell function _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn is executed in the current
4519 shell environment. When the function is executed, the
4520 first argument ($\b$1\b1) is the name of the command whose
4521 arguments are being completed, the second argument ($\b$2\b2)
4522 is the word being completed, and the third argument ($\b$3\b3)
4523 is the word preceding the word being completed on the
4524 current command line. When it finishes, the possible
4525 completions are retrieved from the value of the C\bCO\bOM\bMP\bPR\bRE\bE-\b-
4526 P\bPL\bLY\bY array variable.
4527 -\b-G\bG _\bg_\bl_\bo_\bb_\bp_\ba_\bt
4528 The pathname expansion pattern _\bg_\bl_\bo_\bb_\bp_\ba_\bt is expanded to
4529 generate the possible completions.
4530 -\b-P\bP _\bp_\br_\be_\bf_\bi_\bx
4531 _\bp_\br_\be_\bf_\bi_\bx is added at the beginning of each possible com-
4532 pletion after all other options have been applied.
4533 -\b-S\bS _\bs_\bu_\bf_\bf_\bi_\bx
4534 _\bs_\bu_\bf_\bf_\bi_\bx is appended to each possible completion after all
4535 other options have been applied.
4536 -\b-W\bW _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt
4537 The _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt is split using the characters in the I\bIF\bFS\bS
4538 special variable as delimiters, and each resultant word
4539 is expanded. Shell quoting is honored within _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt,
4540 in order to provide a mechanism for the words to contain
4541 shell metacharacters or characters in the value of I\bIF\bFS\bS.
4542 The possible completions are the members of the resul-
4543 tant list which match the word being completed.
4544 -\b-X\bX _\bf_\bi_\bl_\bt_\be_\br_\bp_\ba_\bt
4545 _\bf_\bi_\bl_\bt_\be_\br_\bp_\ba_\bt is a pattern as used for pathname expansion.
4546 It is applied to the list of possible completions gener-
4547 ated by the preceding options and arguments, and each
4548 completion matching _\bf_\bi_\bl_\bt_\be_\br_\bp_\ba_\bt is removed from the list.
4549 A leading !\b! in _\bf_\bi_\bl_\bt_\be_\br_\bp_\ba_\bt negates the pattern; in this
4550 case, any completion not matching _\bf_\bi_\bl_\bt_\be_\br_\bp_\ba_\bt is removed.
4551
4552 The return value is true unless an invalid option is supplied,
4553 an option other than -\b-p\bp or -\b-r\br is supplied without a _\bn_\ba_\bm_\be argu-
4554 ment, an attempt is made to remove a completion specification
4555 for a _\bn_\ba_\bm_\be for which no specification exists, or an error occurs
4556 adding a completion specification.
4557
4558 c\bco\bom\bmp\bpo\bop\bpt\bt [-\b-o\bo _\bo_\bp_\bt_\bi_\bo_\bn] [-\b-D\bDE\bEI\bI] [+\b+o\bo _\bo_\bp_\bt_\bi_\bo_\bn] [_\bn_\ba_\bm_\be]
4559 Modify completion options for each _\bn_\ba_\bm_\be according to the
4560 _\bo_\bp_\bt_\bi_\bo_\bns, or for the currently-executing completion if no _\bn_\ba_\bm_\bes
4561 are supplied. If no _\bo_\bp_\bt_\bi_\bo_\bns are given, display the completion
4562 options for each _\bn_\ba_\bm_\be or the current completion. The possible
4563 values of _\bo_\bp_\bt_\bi_\bo_\bn are those valid for the c\bco\bom\bmp\bpl\ble\bet\bte\be builtin
4564 described above. The -\b-D\bD option indicates that other supplied
4565 options should apply to the ``default'' command completion; that
4566 is, completion attempted on a command for which no completion
4567 has previously been defined. The -\b-E\bE option indicates that other
4568 supplied options should apply to ``empty'' command completion;
4569 that is, completion attempted on a blank line. The -\b-I\bI option
4570 indicates that other supplied options should apply to completion
4571 on the inital non-assignment word on the line, or after a com-
4572 mand delimiter such as ;\b; or |\b|, which is usually command name
4573 completion.
4574
4575 The return value is true unless an invalid option is supplied,
4576 an attempt is made to modify the options for a _\bn_\ba_\bm_\be for which no
4577 completion specification exists, or an output error occurs.
4578
4579 c\bco\bon\bnt\bti\bin\bnu\bue\be [_\bn]
4580 Resume the next iteration of the enclosing f\bfo\bor\br, w\bwh\bhi\bil\ble\be, u\bun\bnt\bti\bil\bl, or
4581 s\bse\bel\ble\bec\bct\bt loop. If _\bn is specified, resume at the _\bnth enclosing
4582 loop. _\bn must be >= 1. If _\bn is greater than the number of
4583 enclosing loops, the last enclosing loop (the ``top-level''
4584 loop) is resumed. The return value is 0 unless _\bn is not greater
4585 than or equal to 1.
4586
4587 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] ...]
4588 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] ...]
4589 Declare variables and/or give them attributes. If no _\bn_\ba_\bm_\bes are
4590 given then display the values of variables. The -\b-p\bp option will
4591 display the attributes and values of each _\bn_\ba_\bm_\be. When -\b-p\bp is used
4592 with _\bn_\ba_\bm_\be arguments, additional options, other than -\b-f\bf and -\b-F\bF,
4593 are ignored. When -\b-p\bp is supplied without _\bn_\ba_\bm_\be arguments, it
4594 will display the attributes and values of all variables having
4595 the attributes specified by the additional options. If no other
4596 options are supplied with -\b-p\bp, d\bde\bec\bcl\bla\bar\bre\be will display the
4597 attributes and values of all shell variables. The -\b-f\bf option
4598 will restrict the display to shell functions. The -\b-F\bF option
4599 inhibits the display of function definitions; only the function
4600 name and attributes are printed. If the e\bex\bxt\btd\bde\beb\bbu\bug\bg shell option
4601 is enabled using s\bsh\bho\bop\bpt\bt, the source file name and line number
4602 where each _\bn_\ba_\bm_\be is defined are displayed as well. The -\b-F\bF option
4603 implies -\b-f\bf. The -\b-g\bg option forces variables to be created or
4604 modified at the global scope, even when d\bde\bec\bcl\bla\bar\bre\be is executed in a
4605 shell function. It is ignored in all other cases. The follow-
4606 ing options can be used to restrict output to variables with the
4607 specified attribute or to give variables attributes:
4608 -\b-a\ba Each _\bn_\ba_\bm_\be is an indexed array variable (see A\bAr\brr\bra\bay\bys\bs
4609 above).
4610 -\b-A\bA Each _\bn_\ba_\bm_\be is an associative array variable (see A\bAr\brr\bra\bay\bys\bs
4611 above).
4612 -\b-f\bf Use function names only.
4613 -\b-i\bi The variable is treated as an integer; arithmetic evalua-
4614 tion (see A\bAR\bRI\bIT\bTH\bHM\bME\bET\bTI\bIC\bC E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN above) is performed when
4615 the variable is assigned a value.
4616 -\b-l\bl When the variable is assigned a value, all upper-case
4617 characters are converted to lower-case. The upper-case
4618 attribute is disabled.
4619 -\b-n\bn Give each _\bn_\ba_\bm_\be the _\bn_\ba_\bm_\be_\br_\be_\bf attribute, making it a name
4620 reference to another variable. That other variable is
4621 defined by the value of _\bn_\ba_\bm_\be. All references, assign-
4622 ments, and attribute modifications to _\bn_\ba_\bm_\be, except those
4623 using or changing the -\b-n\bn attribute itself, are performed
4624 on the variable referenced by _\bn_\ba_\bm_\be's value. The nameref
4625 attribute cannot be applied to array variables.
4626 -\b-r\br Make _\bn_\ba_\bm_\bes readonly. These names cannot then be assigned
4627 values by subsequent assignment statements or unset.
4628 -\b-t\bt Give each _\bn_\ba_\bm_\be the _\bt_\br_\ba_\bc_\be attribute. Traced functions
4629 inherit the D\bDE\bEB\bBU\bUG\bG and R\bRE\bET\bTU\bUR\bRN\bN traps from the calling
4630 shell. The trace attribute has no special meaning for
4631 variables.
4632 -\b-u\bu When the variable is assigned a value, all lower-case
4633 characters are converted to upper-case. The lower-case
4634 attribute is disabled.
4635 -\b-x\bx Mark _\bn_\ba_\bm_\bes for export to subsequent commands via the
4636 environment.
4637
4638 Using `+' instead of `-' turns off the attribute instead, with
4639 the exceptions that +\b+a\ba and +\b+A\bA may not be used to destroy array
4640 variables and +\b+r\br will not remove the readonly attribute. When
4641 used in a function, d\bde\bec\bcl\bla\bar\bre\be and t\bty\byp\bpe\bes\bse\bet\bt make each _\bn_\ba_\bm_\be local, as
4642 with the l\blo\boc\bca\bal\bl command, unless the -\b-g\bg option is supplied. If a
4643 variable name is followed by =_\bv_\ba_\bl_\bu_\be, the value of the variable
4644 is set to _\bv_\ba_\bl_\bu_\be. When using -\b-a\ba or -\b-A\bA and the compound assign-
4645 ment syntax to create array variables, additional attributes do
4646 not take effect until subsequent assignments. The return value
4647 is 0 unless an invalid option is encountered, an attempt is made
4648 to define a function using ``-f foo=bar'', an attempt is made to
4649 assign a value to a readonly variable, an attempt is made to
4650 assign a value to an array variable without using the compound
4651 assignment syntax (see A\bAr\brr\bra\bay\bys\bs above), one of the _\bn_\ba_\bm_\be_\bs is not a
4652 valid shell variable name, an attempt is made to turn off read-
4653 only status for a readonly variable, an attempt is made to turn
4654 off array status for an array variable, or an attempt is made to
4655 display a non-existent function with -\b-f\bf.
4656
4657 d\bdi\bir\brs\bs [\b[-\b-c\bcl\blp\bpv\bv]\b] [\b[+\b+_\bn]\b] [\b[-\b-_\bn]\b]
4658 Without options, displays the list of currently remembered
4659 directories. The default display is on a single line with
4660 directory names separated by spaces. Directories are added to
4661 the list with the p\bpu\bus\bsh\bhd\bd command; the p\bpo\bop\bpd\bd command removes
4662 entries from the list. The current directory is always the
4663 first directory in the stack.
4664 -\b-c\bc Clears the directory stack by deleting all of the
4665 entries.
4666 -\b-l\bl Produces a listing using full pathnames; the default
4667 listing format uses a tilde to denote the home directory.
4668 -\b-p\bp Print the directory stack with one entry per line.
4669 -\b-v\bv Print the directory stack with one entry per line, pre-
4670 fixing each entry with its index in the stack.
4671 +\b+_\bn Displays the _\bnth entry counting from the left of the list
4672 shown by d\bdi\bir\brs\bs when invoked without options, starting with
4673 zero.
4674 -\b-_\bn Displays the _\bnth entry counting from the right of the
4675 list shown by d\bdi\bir\brs\bs when invoked without options, starting
4676 with zero.
4677
4678 The return value is 0 unless an invalid option is supplied or _\bn
4679 indexes beyond the end of the directory stack.
4680
4681 d\bdi\bis\bso\bow\bwn\bn [-\b-a\bar\br] [-\b-h\bh] [_\bj_\bo_\bb_\bs_\bp_\be_\bc ... | _\bp_\bi_\bd ... ]
4682 Without options, remove each _\bj_\bo_\bb_\bs_\bp_\be_\bc from the table of active
4683 jobs. If _\bj_\bo_\bb_\bs_\bp_\be_\bc is not present, and neither the -\b-a\ba nor the -\b-r\br
4684 option is supplied, the _\bc_\bu_\br_\br_\be_\bn_\bt _\bj_\bo_\bb is used. If the -\b-h\bh option
4685 is given, each _\bj_\bo_\bb_\bs_\bp_\be_\bc is not removed from the table, but is
4686 marked so that S\bSI\bIG\bGH\bHU\bUP\bP is not sent to the job if the shell
4687 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
4688 means to remove or mark all jobs; the -\b-r\br option without a _\bj_\bo_\bb_\b-
4689 _\bs_\bp_\be_\bc argument restricts operation to running jobs. The return
4690 value is 0 unless a _\bj_\bo_\bb_\bs_\bp_\be_\bc does not specify a valid job.
4691
4692 e\bec\bch\bho\bo [-\b-n\bne\beE\bE] [_\ba_\br_\bg ...]
4693 Output the _\ba_\br_\bgs, separated by spaces, followed by a newline.
4694 The return status is 0 unless a write error occurs. If -\b-n\bn is
4695 specified, the trailing newline is suppressed. If the -\b-e\be option
4696 is given, interpretation of the following backslash-escaped
4697 characters is enabled. The -\b-E\bE option disables the interpreta-
4698 tion of these escape characters, even on systems where they are
4699 interpreted by default. The x\bxp\bpg\bg_\b_e\bec\bch\bho\bo shell option may be used
4700 to dynamically determine whether or not e\bec\bch\bho\bo expands these
4701 escape characters by default. e\bec\bch\bho\bo does not interpret -\b--\b- to
4702 mean the end of options. e\bec\bch\bho\bo interprets the following escape
4703 sequences:
4704 \\b\a\ba alert (bell)
4705 \\b\b\bb backspace
4706 \\b\c\bc suppress further output
4707 \\b\e\be
4708 \\b\E\bE an escape character
4709 \\b\f\bf form feed
4710 \\b\n\bn new line
4711 \\b\r\br carriage return
4712 \\b\t\bt horizontal tab
4713 \\b\v\bv vertical tab
4714 \\b\\\b\ backslash
4715 \\b\0\b0_\bn_\bn_\bn the eight-bit character whose value is the octal value
4716 _\bn_\bn_\bn (zero to three octal digits)
4717 \\b\x\bx_\bH_\bH the eight-bit character whose value is the hexadecimal
4718 value _\bH_\bH (one or two hex digits)
4719 \\b\u\bu_\bH_\bH_\bH_\bH the Unicode (ISO/IEC 10646) character whose value is the
4720 hexadecimal value _\bH_\bH_\bH_\bH (one to four hex digits)
4721 \\b\U\bU_\bH_\bH_\bH_\bH_\bH_\bH_\bH_\bH
4722 the Unicode (ISO/IEC 10646) character whose value is the
4723 hexadecimal value _\bH_\bH_\bH_\bH_\bH_\bH_\bH_\bH (one to eight hex digits)
4724
4725 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 ...]
4726 Enable and disable builtin shell commands. Disabling a builtin
4727 allows a disk command which has the same name as a shell builtin
4728 to be executed without specifying a full pathname, even though
4729 the shell normally searches for builtins before disk commands.
4730 If -\b-n\bn is used, each _\bn_\ba_\bm_\be is disabled; otherwise, _\bn_\ba_\bm_\be_\bs are
4731 enabled. For example, to use the t\bte\bes\bst\bt binary found via the P\bPA\bAT\bTH\bH
4732 instead of the shell builtin version, run ``enable -n test''.
4733 The -\b-f\bf option means to load the new builtin command _\bn_\ba_\bm_\be from
4734 shared object _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be, on systems that support dynamic loading.
4735 The -\b-d\bd option will delete a builtin previously loaded with -\b-f\bf.
4736 If no _\bn_\ba_\bm_\be arguments are given, or if the -\b-p\bp option is supplied,
4737 a list of shell builtins is printed. With no other option argu-
4738 ments, the list consists of all enabled shell builtins. If -\b-n\bn
4739 is supplied, only disabled builtins are printed. If -\b-a\ba is sup-
4740 plied, the list printed includes all builtins, with an indica-
4741 tion of whether or not each is enabled. If -\b-s\bs is supplied, the
4742 output is restricted to the POSIX _\bs_\bp_\be_\bc_\bi_\ba_\bl builtins. The return
4743 value is 0 unless a _\bn_\ba_\bm_\be is not a shell builtin or there is an
4744 error loading a new builtin from a shared object.
4745
4746 e\bev\bva\bal\bl [_\ba_\br_\bg ...]
4747 The _\ba_\br_\bgs are read and concatenated together into a single com-
4748 mand. This command is then read and executed by the shell, and
4749 its exit status is returned as the value of e\bev\bva\bal\bl. If there are
4750 no _\ba_\br_\bg_\bs, or only null arguments, e\bev\bva\bal\bl returns 0.
4751
4752 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]]
4753 If _\bc_\bo_\bm_\bm_\ba_\bn_\bd is specified, it replaces the shell. No new process
4754 is created. The _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs become the arguments to _\bc_\bo_\bm_\bm_\ba_\bn_\bd. If
4755 the -\b-l\bl option is supplied, the shell places a dash at the begin-
4756 ning of the zeroth argument passed to _\bc_\bo_\bm_\bm_\ba_\bn_\bd. This is what
4757 _\bl_\bo_\bg_\bi_\bn(1) does. The -\b-c\bc option causes _\bc_\bo_\bm_\bm_\ba_\bn_\bd to be executed with
4758 an empty environment. If -\b-a\ba is supplied, the shell passes _\bn_\ba_\bm_\be
4759 as the zeroth argument to the executed command. If _\bc_\bo_\bm_\bm_\ba_\bn_\bd can-
4760 not be executed for some reason, a non-interactive shell exits,
4761 unless the e\bex\bxe\bec\bcf\bfa\bai\bil\bl shell option is enabled. In that case, it
4762 returns failure. An interactive shell returns failure if the
4763 file cannot be executed. A subshell exits unconditionally if
4764 e\bex\bxe\bec\bc fails. If _\bc_\bo_\bm_\bm_\ba_\bn_\bd is not specified, any redirections take
4765 effect in the current shell, and the return status is 0. If
4766 there is a redirection error, the return status is 1.
4767
4768 e\bex\bxi\bit\bt [_\bn]
4769 Cause the shell to exit with a status of _\bn. If _\bn is omitted,
4770 the exit status is that of the last command executed. A trap on
4771 E\bEX\bXI\bIT\bT is executed before the shell terminates.
4772
4773 e\bex\bxp\bpo\bor\brt\bt [-\b-f\bfn\bn] [_\bn_\ba_\bm_\be[=_\bw_\bo_\br_\bd]] ...
4774 e\bex\bxp\bpo\bor\brt\bt -\b-p\bp
4775 The supplied _\bn_\ba_\bm_\be_\bs are marked for automatic export to the envi-
4776 ronment of subsequently executed commands. If the -\b-f\bf option is
4777 given, the _\bn_\ba_\bm_\be_\bs refer to functions. If no _\bn_\ba_\bm_\be_\bs are given, or
4778 if the -\b-p\bp option is supplied, a list of names of all exported
4779 variables is printed. The -\b-n\bn option causes the export property
4780 to be removed from each _\bn_\ba_\bm_\be. If a variable name is followed by
4781 =_\bw_\bo_\br_\bd, the value of the variable is set to _\bw_\bo_\br_\bd. e\bex\bxp\bpo\bor\brt\bt returns
4782 an exit status of 0 unless an invalid option is encountered, one
4783 of the _\bn_\ba_\bm_\be_\bs is not a valid shell variable name, or -\b-f\bf is sup-
4784 plied with a _\bn_\ba_\bm_\be that is not a function.
4785
4786 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]
4787 f\bfc\bc -\b-s\bs [_\bp_\ba_\bt=_\br_\be_\bp] [_\bc_\bm_\bd]
4788 The first form selects a range of commands from _\bf_\bi_\br_\bs_\bt to _\bl_\ba_\bs_\bt
4789 from the history list and displays or edits and re-executes
4790 them. _\bF_\bi_\br_\bs_\bt and _\bl_\ba_\bs_\bt may be specified as a string (to locate
4791 the last command beginning with that string) or as a number (an
4792 index into the history list, where a negative number is used as
4793 an offset from the current command number). If _\bl_\ba_\bs_\bt is not
4794 specified, it is set to the current command for listing (so that
4795 ``fc -l -10'' prints the last 10 commands) and to _\bf_\bi_\br_\bs_\bt other-
4796 wise. If _\bf_\bi_\br_\bs_\bt is not specified, it is set to the previous com-
4797 mand for editing and -16 for listing.
4798
4799 The -\b-n\bn option suppresses the command numbers when listing. The
4800 -\b-r\br option reverses the order of the commands. If the -\b-l\bl option
4801 is given, the commands are listed on standard output. Other-
4802 wise, the editor given by _\be_\bn_\ba_\bm_\be is invoked on a file containing
4803 those commands. If _\be_\bn_\ba_\bm_\be is not given, the value of the F\bFC\bCE\bED\bDI\bIT\bT
4804 variable is used, and the value of E\bED\bDI\bIT\bTO\bOR\bR if F\bFC\bCE\bED\bDI\bIT\bT is not set.
4805 If neither variable is set, _\bv_\bi is used. When editing is com-
4806 plete, the edited commands are echoed and executed.
4807
4808 In the second form, _\bc_\bo_\bm_\bm_\ba_\bn_\bd is re-executed after each instance
4809 of _\bp_\ba_\bt is replaced by _\br_\be_\bp. _\bC_\bo_\bm_\bm_\ba_\bn_\bd is interpreted the same as
4810 _\bf_\bi_\br_\bs_\bt above. A useful alias to use with this is ``r="fc -s"'',
4811 so that typing ``r cc'' runs the last command beginning with
4812 ``cc'' and typing ``r'' re-executes the last command.
4813
4814 If the first form is used, the return value is 0 unless an
4815 invalid option is encountered or _\bf_\bi_\br_\bs_\bt or _\bl_\ba_\bs_\bt specify history
4816 lines out of range. If the -\b-e\be option is supplied, the return
4817 value is the value of the last command executed or failure if an
4818 error occurs with the temporary file of commands. If the second
4819 form is used, the return status is that of the command re-exe-
4820 cuted, unless _\bc_\bm_\bd does not specify a valid history line, in
4821 which case f\bfc\bc returns failure.
4822
4823 f\bfg\bg [_\bj_\bo_\bb_\bs_\bp_\be_\bc]
4824 Resume _\bj_\bo_\bb_\bs_\bp_\be_\bc in the foreground, and make it the current job.
4825 If _\bj_\bo_\bb_\bs_\bp_\be_\bc is not present, the shell's notion of the _\bc_\bu_\br_\br_\be_\bn_\bt _\bj_\bo_\bb
4826 is used. The return value is that of the command placed into
4827 the foreground, or failure if run when job control is disabled
4828 or, when run with job control enabled, if _\bj_\bo_\bb_\bs_\bp_\be_\bc does not spec-
4829 ify a valid job or _\bj_\bo_\bb_\bs_\bp_\be_\bc specifies a job that was started
4830 without job control.
4831
4832 g\bge\bet\bto\bop\bpt\bts\bs _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg _\bn_\ba_\bm_\be [_\ba_\br_\bg_\bs]
4833 g\bge\bet\bto\bop\bpt\bts\bs is used by shell procedures to parse positional parame-
4834 ters. _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg contains the option characters to be recog-
4835 nized; if a character is followed by a colon, the option is
4836 expected to have an argument, which should be separated from it
4837 by white space. The colon and question mark characters may not
4838 be used as option characters. Each time it is invoked, g\bge\bet\bto\bop\bpt\bts\bs
4839 places the next option in the shell variable _\bn_\ba_\bm_\be, initializing
4840 _\bn_\ba_\bm_\be if it does not exist, and the index of the next argument to
4841 be processed into the variable O\bOP\bPT\bTI\bIN\bND\bD. O\bOP\bPT\bTI\bIN\bND\bD is initialized to
4842 1 each time the shell or a shell script is invoked. When an
4843 option requires an argument, g\bge\bet\bto\bop\bpt\bts\bs places that argument into
4844 the variable O\bOP\bPT\bTA\bAR\bRG\bG. The shell does not reset O\bOP\bPT\bTI\bIN\bND\bD automati-
4845 cally; it must be manually reset between multiple calls to
4846 g\bge\bet\bto\bop\bpt\bts\bs within the same shell invocation if a new set of parame-
4847 ters is to be used.
4848
4849 When the end of options is encountered, g\bge\bet\bto\bop\bpt\bts\bs exits with a
4850 return value greater than zero. O\bOP\bPT\bTI\bIN\bND\bD is set to the index of
4851 the first non-option argument, and _\bn_\ba_\bm_\be is set to ?.
4852
4853 g\bge\bet\bto\bop\bpt\bts\bs normally parses the positional parameters, but if more
4854 arguments are given in _\ba_\br_\bg_\bs, g\bge\bet\bto\bop\bpt\bts\bs parses those instead.
4855
4856 g\bge\bet\bto\bop\bpt\bts\bs can report errors in two ways. If the first character
4857 of _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg is a colon, _\bs_\bi_\bl_\be_\bn_\bt error reporting is used. In
4858 normal operation, diagnostic messages are printed when invalid
4859 options or missing option arguments are encountered. If the
4860 variable O\bOP\bPT\bTE\bER\bRR\bR is set to 0, no error messages will be dis-
4861 played, even if the first character of _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg is not a colon.
4862
4863 If an invalid option is seen, g\bge\bet\bto\bop\bpt\bts\bs places ? into _\bn_\ba_\bm_\be and, if
4864 not silent, prints an error message and unsets O\bOP\bPT\bTA\bAR\bRG\bG. If
4865 g\bge\bet\bto\bop\bpt\bts\bs is silent, the option character found is placed in
4866 O\bOP\bPT\bTA\bAR\bRG\bG and no diagnostic message is printed.
4867
4868 If a required argument is not found, and g\bge\bet\bto\bop\bpt\bts\bs is not silent,
4869 a question mark (?\b?) is placed in _\bn_\ba_\bm_\be, O\bOP\bPT\bTA\bAR\bRG\bG is unset, and a
4870 diagnostic message is printed. If g\bge\bet\bto\bop\bpt\bts\bs is silent, then a
4871 colon (:\b:) is placed in _\bn_\ba_\bm_\be and O\bOP\bPT\bTA\bAR\bRG\bG is set to the option
4872 character found.
4873
4874 g\bge\bet\bto\bop\bpt\bts\bs returns true if an option, specified or unspecified, is
4875 found. It returns false if the end of options is encountered or
4876 an error occurs.
4877
4878 h\bha\bas\bsh\bh [-\b-l\blr\br] [-\b-p\bp _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be] [-\b-d\bdt\bt] [_\bn_\ba_\bm_\be]
4879 Each time h\bha\bas\bsh\bh is invoked, the full pathname of the command _\bn_\ba_\bm_\be
4880 is determined by searching the directories in $\b$P\bPA\bAT\bTH\bH and remem-
4881 bered. Any previously-remembered pathname is discarded. If the
4882 -\b-p\bp option is supplied, no path search is performed, and _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
4883 is used as the full filename of the command. The -\b-r\br option
4884 causes the shell to forget all remembered locations. The -\b-d\bd
4885 option causes the shell to forget the remembered location of
4886 each _\bn_\ba_\bm_\be. If the -\b-t\bt option is supplied, the full pathname to
4887 which each _\bn_\ba_\bm_\be corresponds is printed. If multiple _\bn_\ba_\bm_\be argu-
4888 ments are supplied with -\b-t\bt, the _\bn_\ba_\bm_\be is printed before the
4889 hashed full pathname. The -\b-l\bl option causes output to be dis-
4890 played in a format that may be reused as input. If no arguments
4891 are given, or if only -\b-l\bl is supplied, information about remem-
4892 bered commands is printed. The return status is true unless a
4893 _\bn_\ba_\bm_\be is not found or an invalid option is supplied.
4894
4895 h\bhe\bel\blp\bp [-\b-d\bdm\bms\bs] [_\bp_\ba_\bt_\bt_\be_\br_\bn]
4896 Display helpful information about builtin commands. If _\bp_\ba_\bt_\bt_\be_\br_\bn
4897 is specified, h\bhe\bel\blp\bp gives detailed help on all commands matching
4898 _\bp_\ba_\bt_\bt_\be_\br_\bn; otherwise help for all the builtins and shell control
4899 structures is printed.
4900 -\b-d\bd Display a short description of each _\bp_\ba_\bt_\bt_\be_\br_\bn
4901 -\b-m\bm Display the description of each _\bp_\ba_\bt_\bt_\be_\br_\bn in a manpage-like
4902 format
4903 -\b-s\bs Display only a short usage synopsis for each _\bp_\ba_\bt_\bt_\be_\br_\bn
4904
4905 The return status is 0 unless no command matches _\bp_\ba_\bt_\bt_\be_\br_\bn.
4906
4907 h\bhi\bis\bst\bto\bor\bry\by [\b[_\bn]\b]
4908 h\bhi\bis\bst\bto\bor\bry\by -\b-c\bc
4909 h\bhi\bis\bst\bto\bor\bry\by -\b-d\bd _\bo_\bf_\bf_\bs_\be_\bt
4910 h\bhi\bis\bst\bto\bor\bry\by -\b-d\bd _\bs_\bt_\ba_\br_\bt-_\be_\bn_\bd
4911 h\bhi\bis\bst\bto\bor\bry\by -\b-a\ban\bnr\brw\bw [_\bf_\bi_\bl_\be_\bn_\ba_\bm_\be]
4912 h\bhi\bis\bst\bto\bor\bry\by -\b-p\bp _\ba_\br_\bg [_\ba_\br_\bg _\b._\b._\b.]
4913 h\bhi\bis\bst\bto\bor\bry\by -\b-s\bs _\ba_\br_\bg [_\ba_\br_\bg _\b._\b._\b.]
4914 With no options, display the command history list with line num-
4915 bers. Lines listed with a *\b* have been modified. An argument of
4916 _\bn lists only the last _\bn lines. If the shell variable H\bHI\bIS\bST\bTT\bTI\bIM\bME\bE-\b-
4917 F\bFO\bOR\bRM\bMA\bAT\bT is set and not null, it is used as a format string for
4918 _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be(3) to display the time stamp associated with each dis-
4919 played history entry. No intervening blank is printed between
4920 the formatted time stamp and the history line. If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is
4921 supplied, it is used as the name of the history file; if not,
4922 the value of H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is used. Options, if supplied, have the
4923 following meanings:
4924 -\b-c\bc Clear the history list by deleting all the entries.
4925 -\b-d\bd _\bo_\bf_\bf_\bs_\be_\bt
4926 Delete the history entry at position _\bo_\bf_\bf_\bs_\be_\bt. If _\bo_\bf_\bf_\bs_\be_\bt
4927 is negative, it is interpreted as relative to one greater
4928 than the last history position, so negative indices count
4929 back from the end of the history, and an index of -1
4930 refers to the current h\bhi\bis\bst\bto\bor\bry\by -\b-d\bd command.
4931 -\b-d\bd _\bs_\bt_\ba_\br_\bt-_\be_\bn_\bd
4932 Delete the history entries between positions _\bs_\bt_\ba_\br_\bt and
4933 _\be_\bn_\bd, inclusive. Positive and negative values for _\bs_\bt_\ba_\br_\bt
4934 and _\be_\bn_\bd are interpreted as described above.
4935 -\b-a\ba Append the ``new'' history lines to the history file.
4936 These are history lines entered since the beginning of
4937 the current b\bba\bas\bsh\bh session, but not already appended to the
4938 history file.
4939 -\b-n\bn Read the history lines not already read from the history
4940 file into the current history list. These are lines
4941 appended to the history file since the beginning of the
4942 current b\bba\bas\bsh\bh session.
4943 -\b-r\br Read the contents of the history file and append them to
4944 the current history list.
4945 -\b-w\bw Write the current history list to the history file, over-
4946 writing the history file's contents.
4947 -\b-p\bp Perform history substitution on the following _\ba_\br_\bg_\bs and
4948 display the result on the standard output. Does not
4949 store the results in the history list. Each _\ba_\br_\bg must be
4950 quoted to disable normal history expansion.
4951 -\b-s\bs Store the _\ba_\br_\bg_\bs in the history list as a single entry.
4952 The last command in the history list is removed before
4953 the _\ba_\br_\bg_\bs are added.
4954
4955 If the H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT variable is set, the time stamp informa-
4956 tion associated with each history entry is written to the his-
4957 tory file, marked with the history comment character. When the
4958 history file is read, lines beginning with the history comment
4959 character followed immediately by a digit are interpreted as
4960 timestamps for the following history entry. The return value is
4961 0 unless an invalid option is encountered, an error occurs while
4962 reading or writing the history file, an invalid _\bo_\bf_\bf_\bs_\be_\bt is sup-
4963 plied as an argument to -\b-d\bd, or the history expansion supplied as
4964 an argument to -\b-p\bp fails.
4965
4966 j\bjo\bob\bbs\bs [-\b-l\bln\bnp\bpr\brs\bs] [ _\bj_\bo_\bb_\bs_\bp_\be_\bc ... ]
4967 j\bjo\bob\bbs\bs -\b-x\bx _\bc_\bo_\bm_\bm_\ba_\bn_\bd [ _\ba_\br_\bg_\bs ... ]
4968 The first form lists the active jobs. The options have the fol-
4969 lowing meanings:
4970 -\b-l\bl List process IDs in addition to the normal information.
4971 -\b-n\bn Display information only about jobs that have changed
4972 status since the user was last notified of their status.
4973 -\b-p\bp List only the process ID of the job's process group
4974 leader.
4975 -\b-r\br Display only running jobs.
4976 -\b-s\bs Display only stopped jobs.
4977
4978 If _\bj_\bo_\bb_\bs_\bp_\be_\bc is given, output is restricted to information about
4979 that job. The return status is 0 unless an invalid option is
4980 encountered or an invalid _\bj_\bo_\bb_\bs_\bp_\be_\bc is supplied.
4981
4982 If the -\b-x\bx option is supplied, j\bjo\bob\bbs\bs replaces any _\bj_\bo_\bb_\bs_\bp_\be_\bc found in
4983 _\bc_\bo_\bm_\bm_\ba_\bn_\bd or _\ba_\br_\bg_\bs with the corresponding process group ID, and
4984 executes _\bc_\bo_\bm_\bm_\ba_\bn_\bd passing it _\ba_\br_\bg_\bs, returning its exit status.
4985
4986 k\bki\bil\bll\bl [-\b-s\bs _\bs_\bi_\bg_\bs_\bp_\be_\bc | -\b-n\bn _\bs_\bi_\bg_\bn_\bu_\bm | -\b-_\bs_\bi_\bg_\bs_\bp_\be_\bc] [_\bp_\bi_\bd | _\bj_\bo_\bb_\bs_\bp_\be_\bc] ...
4987 k\bki\bil\bll\bl -\b-l\bl|-\b-L\bL [_\bs_\bi_\bg_\bs_\bp_\be_\bc | _\be_\bx_\bi_\bt_\b__\bs_\bt_\ba_\bt_\bu_\bs]
4988 Send the signal named by _\bs_\bi_\bg_\bs_\bp_\be_\bc or _\bs_\bi_\bg_\bn_\bu_\bm to the processes
4989 named by _\bp_\bi_\bd or _\bj_\bo_\bb_\bs_\bp_\be_\bc. _\bs_\bi_\bg_\bs_\bp_\be_\bc is either a case-insensitive
4990 signal name such as S\bSI\bIG\bGK\bKI\bIL\bLL\bL (with or without the S\bSI\bIG\bG prefix) or
4991 a signal number; _\bs_\bi_\bg_\bn_\bu_\bm is a signal number. If _\bs_\bi_\bg_\bs_\bp_\be_\bc is not
4992 present, then S\bSI\bIG\bGT\bTE\bER\bRM\bM is assumed. An argument of -\b-l\bl lists the
4993 signal names. If any arguments are supplied when -\b-l\bl is given,
4994 the names of the signals corresponding to the arguments are
4995 listed, and the return status is 0. The _\be_\bx_\bi_\bt_\b__\bs_\bt_\ba_\bt_\bu_\bs argument to
4996 -\b-l\bl is a number specifying either a signal number or the exit
4997 status of a process terminated by a signal. The -\b-L\bL option is
4998 equivalent to -\b-l\bl. k\bki\bil\bll\bl returns true if at least one signal was
4999 successfully sent, or false if an error occurs or an invalid
5000 option is encountered.
5001
5002 l\ble\bet\bt _\ba_\br_\bg [_\ba_\br_\bg ...]
5003 Each _\ba_\br_\bg is an arithmetic expression to be evaluated (see A\bAR\bRI\bIT\bTH\bH-\b-
5004 M\bME\bET\bTI\bIC\bC E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN above). If the last _\ba_\br_\bg evaluates to 0, l\ble\bet\bt
5005 returns 1; 0 is returned otherwise.
5006
5007 l\blo\boc\bca\bal\bl [_\bo_\bp_\bt_\bi_\bo_\bn] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ... | - ]
5008 For each argument, a local variable named _\bn_\ba_\bm_\be is created, and
5009 assigned _\bv_\ba_\bl_\bu_\be. The _\bo_\bp_\bt_\bi_\bo_\bn can be any of the options accepted
5010 by d\bde\bec\bcl\bla\bar\bre\be. When l\blo\boc\bca\bal\bl is used within a function, it causes the
5011 variable _\bn_\ba_\bm_\be to have a visible scope restricted to that func-
5012 tion and its children. If _\bn_\ba_\bm_\be is -, the set of shell options
5013 is made local to the function in which l\blo\boc\bca\bal\bl is invoked: shell
5014 options changed using the s\bse\bet\bt builtin inside the function are
5015 restored to their original values when the function returns.
5016 With no operands, l\blo\boc\bca\bal\bl writes a list of local variables to the
5017 standard output. It is an error to use l\blo\boc\bca\bal\bl when not within a
5018 function. The return status is 0 unless l\blo\boc\bca\bal\bl is used outside a
5019 function, an invalid _\bn_\ba_\bm_\be is supplied, or _\bn_\ba_\bm_\be is a readonly
5020 variable.
5021
5022 l\blo\bog\bgo\bou\but\bt Exit a login shell.
5023
5024 m\bma\bap\bpf\bfi\bil\ble\be [-\b-d\bd _\bd_\be_\bl_\bi_\bm] [-\b-n\bn _\bc_\bo_\bu_\bn_\bt] [-\b-O\bO _\bo_\br_\bi_\bg_\bi_\bn] [-\b-s\bs _\bc_\bo_\bu_\bn_\bt] [-\b-t\bt] [-\b-u\bu _\bf_\bd] [-\b-C\bC
5025 _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk] [-\b-c\bc _\bq_\bu_\ba_\bn_\bt_\bu_\bm] [_\ba_\br_\br_\ba_\by]
5026 r\bre\bea\bad\bda\bar\brr\bra\bay\by [-\b-d\bd _\bd_\be_\bl_\bi_\bm] [-\b-n\bn _\bc_\bo_\bu_\bn_\bt] [-\b-O\bO _\bo_\br_\bi_\bg_\bi_\bn] [-\b-s\bs _\bc_\bo_\bu_\bn_\bt] [-\b-t\bt] [-\b-u\bu _\bf_\bd] [-\b-C\bC
5027 _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk] [-\b-c\bc _\bq_\bu_\ba_\bn_\bt_\bu_\bm] [_\ba_\br_\br_\ba_\by]
5028 Read lines from the standard input into the indexed array vari-
5029 able _\ba_\br_\br_\ba_\by, or from file descriptor _\bf_\bd if the -\b-u\bu option is sup-
5030 plied. The variable M\bMA\bAP\bPF\bFI\bIL\bLE\bE is the default _\ba_\br_\br_\ba_\by. Options, if
5031 supplied, have the following meanings:
5032 -\b-d\bd The first character of _\bd_\be_\bl_\bi_\bm is used to terminate each
5033 input line, rather than newline. If _\bd_\be_\bl_\bi_\bm is the empty
5034 string, m\bma\bap\bpf\bfi\bil\ble\be will terminate a line when it reads a NUL
5035 character.
5036 -\b-n\bn Copy at most _\bc_\bo_\bu_\bn_\bt lines. If _\bc_\bo_\bu_\bn_\bt is 0, all lines are
5037 copied.
5038 -\b-O\bO Begin assigning to _\ba_\br_\br_\ba_\by at index _\bo_\br_\bi_\bg_\bi_\bn. The default
5039 index is 0.
5040 -\b-s\bs Discard the first _\bc_\bo_\bu_\bn_\bt lines read.
5041 -\b-t\bt Remove a trailing _\bd_\be_\bl_\bi_\bm (default newline) from each line
5042 read.
5043 -\b-u\bu Read lines from file descriptor _\bf_\bd instead of the stan-
5044 dard input.
5045 -\b-C\bC Evaluate _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk each time _\bq_\bu_\ba_\bn_\bt_\bu_\bm lines are read. The
5046 -\b-c\bc option specifies _\bq_\bu_\ba_\bn_\bt_\bu_\bm.
5047 -\b-c\bc Specify the number of lines read between each call to
5048 _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk.
5049
5050 If -\b-C\bC is specified without -\b-c\bc, the default quantum is 5000.
5051 When _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk is evaluated, it is supplied the index of the next
5052 array element to be assigned and the line to be assigned to that
5053 element as additional arguments. _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk is evaluated after
5054 the line is read but before the array element is assigned.
5055
5056 If not supplied with an explicit origin, m\bma\bap\bpf\bfi\bil\ble\be will clear
5057 _\ba_\br_\br_\ba_\by before assigning to it.
5058
5059 m\bma\bap\bpf\bfi\bil\ble\be returns successfully unless an invalid option or option
5060 argument is supplied, _\ba_\br_\br_\ba_\by is invalid or unassignable, or if
5061 _\ba_\br_\br_\ba_\by is not an indexed array.
5062
5063 p\bpo\bop\bpd\bd [-n\bn] [+_\bn] [-_\bn]
5064 Removes entries from the directory stack. With no arguments,
5065 removes the top directory from the stack, and performs a c\bcd\bd to
5066 the new top directory. Arguments, if supplied, have the follow-
5067 ing meanings:
5068 -\b-n\bn Suppresses the normal change of directory when removing
5069 directories from the stack, so that only the stack is
5070 manipulated.
5071 +\b+_\bn Removes the _\bnth entry counting from the left of the list
5072 shown by d\bdi\bir\brs\bs, starting with zero. For example: ``popd
5073 +0'' removes the first directory, ``popd +1'' the second.
5074 -\b-_\bn Removes the _\bnth entry counting from the right of the list
5075 shown by d\bdi\bir\brs\bs, starting with zero. For example: ``popd
5076 -0'' removes the last directory, ``popd -1'' the next to
5077 last.
5078
5079 If the p\bpo\bop\bpd\bd command is successful, a d\bdi\bir\brs\bs is performed as well,
5080 and the return status is 0. p\bpo\bop\bpd\bd returns false if an invalid
5081 option is encountered, the directory stack is empty, a non-exis-
5082 tent directory stack entry is specified, or the directory change
5083 fails.
5084
5085 p\bpr\bri\bin\bnt\btf\bf [-\b-v\bv _\bv_\ba_\br] _\bf_\bo_\br_\bm_\ba_\bt [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
5086 Write the formatted _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs to the standard output under the
5087 control of the _\bf_\bo_\br_\bm_\ba_\bt. The -\b-v\bv option causes the output to be
5088 assigned to the variable _\bv_\ba_\br rather than being printed to the
5089 standard output.
5090
5091 The _\bf_\bo_\br_\bm_\ba_\bt is a character string which contains three types of
5092 objects: plain characters, which are simply copied to standard
5093 output, character escape sequences, which are converted and
5094 copied to the standard output, and format specifications, each
5095 of which causes printing of the next successive _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt. In
5096 addition to the standard _\bp_\br_\bi_\bn_\bt_\bf(1) format specifications, p\bpr\bri\bin\bnt\btf\bf
5097 interprets the following extensions:
5098 %\b%b\bb causes p\bpr\bri\bin\bnt\btf\bf to expand backslash escape sequences in the
5099 corresponding _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt in the same way as e\bec\bch\bho\bo -\b-e\be.
5100 %\b%q\bq causes p\bpr\bri\bin\bnt\btf\bf to output the corresponding _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt in a
5101 format that can be reused as shell input.
5102 %\b%(\b(_\bd_\ba_\bt_\be_\bf_\bm_\bt)\b)T\bT
5103 causes p\bpr\bri\bin\bnt\btf\bf to output the date-time string resulting
5104 from using _\bd_\ba_\bt_\be_\bf_\bm_\bt as a format string for _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be(3).
5105 The corresponding _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt is an integer representing the
5106 number of seconds since the epoch. Two special argument
5107 values may be used: -1 represents the current time, and
5108 -2 represents the time the shell was invoked. If no
5109 argument is specified, conversion behaves as if -1 had
5110 been given. This is an exception to the usual p\bpr\bri\bin\bnt\btf\bf
5111 behavior.
5112
5113 Arguments to non-string format specifiers are treated as C con-
5114 stants, except that a leading plus or minus sign is allowed, and
5115 if the leading character is a single or double quote, the value
5116 is the ASCII value of the following character.
5117
5118 The _\bf_\bo_\br_\bm_\ba_\bt is reused as necessary to consume all of the _\ba_\br_\bg_\bu_\b-
5119 _\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,
5120 the extra format specifications behave as if a zero value or
5121 null string, as appropriate, had been supplied. The return
5122 value is zero on success, non-zero on failure.
5123
5124 p\bpu\bus\bsh\bhd\bd [-\b-n\bn] [+_\bn] [-_\bn]
5125 p\bpu\bus\bsh\bhd\bd [-\b-n\bn] [_\bd_\bi_\br]
5126 Adds a directory to the top of the directory stack, or rotates
5127 the stack, making the new top of the stack the current working
5128 directory. With no arguments, p\bpu\bus\bsh\bhd\bd exchanges the top two
5129 directories and returns 0, unless the directory stack is empty.
5130 Arguments, if supplied, have the following meanings:
5131 -\b-n\bn Suppresses the normal change of directory when rotating
5132 or adding directories to the stack, so that only the
5133 stack is manipulated.
5134 +\b+_\bn Rotates the stack so that the _\bnth directory (counting
5135 from the left of the list shown by d\bdi\bir\brs\bs, starting with
5136 zero) is at the top.
5137 -\b-_\bn Rotates the stack so that the _\bnth directory (counting
5138 from the right of the list shown by d\bdi\bir\brs\bs, starting with
5139 zero) is at the top.
5140 _\bd_\bi_\br Adds _\bd_\bi_\br to the directory stack at the top, making it the
5141 new current working directory as if it had been supplied
5142 as the argument to the c\bcd\bd builtin.
5143
5144 If the p\bpu\bus\bsh\bhd\bd command is successful, a d\bdi\bir\brs\bs is performed as well.
5145 If the first form is used, p\bpu\bus\bsh\bhd\bd returns 0 unless the cd to _\bd_\bi_\br
5146 fails. With the second form, p\bpu\bus\bsh\bhd\bd returns 0 unless the direc-
5147 tory stack is empty, a non-existent directory stack element is
5148 specified, or the directory change to the specified new current
5149 directory fails.
5150
5151 p\bpw\bwd\bd [-\b-L\bLP\bP]
5152 Print the absolute pathname of the current working directory.
5153 The pathname printed contains no symbolic links if the -\b-P\bP option
5154 is supplied or the -\b-o\bo p\bph\bhy\bys\bsi\bic\bca\bal\bl option to the s\bse\bet\bt builtin command
5155 is enabled. If the -\b-L\bL option is used, the pathname printed may
5156 contain symbolic links. The return status is 0 unless an error
5157 occurs while reading the name of the current directory or an
5158 invalid option is supplied.
5159
5160 r\bre\bea\bad\bd [-\b-e\ber\brs\bs] [-\b-a\ba _\ba_\bn_\ba_\bm_\be] [-\b-d\bd _\bd_\be_\bl_\bi_\bm] [-\b-i\bi _\bt_\be_\bx_\bt] [-\b-n\bn _\bn_\bc_\bh_\ba_\br_\bs] [-\b-N\bN _\bn_\bc_\bh_\ba_\br_\bs] [-\b-p\bp
5161 _\bp_\br_\bo_\bm_\bp_\bt] [-\b-t\bt _\bt_\bi_\bm_\be_\bo_\bu_\bt] [-\b-u\bu _\bf_\bd] [_\bn_\ba_\bm_\be ...]
5162 One line is read from the standard input, or from the file
5163 descriptor _\bf_\bd supplied as an argument to the -\b-u\bu option, split
5164 into words as described above under W\bWo\bor\brd\bd S\bSp\bpl\bli\bit\btt\bti\bin\bng\bg, and the
5165 first word is assigned to the first _\bn_\ba_\bm_\be, the second word to the
5166 second _\bn_\ba_\bm_\be, and so on. If there are more words than names, the
5167 remaining words and their intervening delimiters are assigned to
5168 the last _\bn_\ba_\bm_\be. If there are fewer words read from the input
5169 stream than names, the remaining names are assigned empty val-
5170 ues. The characters in I\bIF\bFS\bS are used to split the line into
5171 words using the same rules the shell uses for expansion
5172 (described above under W\bWo\bor\brd\bd S\bSp\bpl\bli\bit\btt\bti\bin\bng\bg). The backslash character
5173 (\\b\) may be used to remove any special meaning for the next char-
5174 acter read and for line continuation. Options, if supplied,
5175 have the following meanings:
5176 -\b-a\ba _\ba_\bn_\ba_\bm_\be
5177 The words are assigned to sequential indices of the array
5178 variable _\ba_\bn_\ba_\bm_\be, starting at 0. _\ba_\bn_\ba_\bm_\be is unset before any
5179 new values are assigned. Other _\bn_\ba_\bm_\be arguments are
5180 ignored.
5181 -\b-d\bd _\bd_\be_\bl_\bi_\bm
5182 The first character of _\bd_\be_\bl_\bi_\bm is used to terminate the
5183 input line, rather than newline. If _\bd_\be_\bl_\bi_\bm is the empty
5184 string, r\bre\bea\bad\bd will terminate a line when it reads a NUL
5185 character.
5186 -\b-e\be If the standard input is coming from a terminal, r\bre\bea\bad\bdl\bli\bin\bne\be
5187 (see R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE above) is used to obtain the line. Read-
5188 line uses the current (or default, if line editing was
5189 not previously active) editing settings, but uses Read-
5190 line's default filename completion.
5191 -\b-i\bi _\bt_\be_\bx_\bt
5192 If r\bre\bea\bad\bdl\bli\bin\bne\be is being used to read the line, _\bt_\be_\bx_\bt is
5193 placed into the editing buffer before editing begins.
5194 -\b-n\bn _\bn_\bc_\bh_\ba_\br_\bs
5195 r\bre\bea\bad\bd returns after reading _\bn_\bc_\bh_\ba_\br_\bs characters rather than
5196 waiting for a complete line of input, but honors a delim-
5197 iter if fewer than _\bn_\bc_\bh_\ba_\br_\bs characters are read before the
5198 delimiter.
5199 -\b-N\bN _\bn_\bc_\bh_\ba_\br_\bs
5200 r\bre\bea\bad\bd returns after reading exactly _\bn_\bc_\bh_\ba_\br_\bs characters
5201 rather than waiting for a complete line of input, unless
5202 EOF is encountered or r\bre\bea\bad\bd times out. Delimiter charac-
5203 ters encountered in the input are not treated specially
5204 and do not cause r\bre\bea\bad\bd to return until _\bn_\bc_\bh_\ba_\br_\bs characters
5205 are read. The result is not split on the characters in
5206 I\bIF\bFS\bS; the intent is that the variable is assigned exactly
5207 the characters read (with the exception of backslash; see
5208 the -\b-r\br option below).
5209 -\b-p\bp _\bp_\br_\bo_\bm_\bp_\bt
5210 Display _\bp_\br_\bo_\bm_\bp_\bt on standard error, without a trailing new-
5211 line, before attempting to read any input. The prompt is
5212 displayed only if input is coming from a terminal.
5213 -\b-r\br Backslash does not act as an escape character. The back-
5214 slash is considered to be part of the line. In particu-
5215 lar, a backslash-newline pair may not then be used as a
5216 line continuation.
5217 -\b-s\bs Silent mode. If input is coming from a terminal, charac-
5218 ters are not echoed.
5219 -\b-t\bt _\bt_\bi_\bm_\be_\bo_\bu_\bt
5220 Cause r\bre\bea\bad\bd to time out and return failure if a complete
5221 line of input (or a specified number of characters) is
5222 not read within _\bt_\bi_\bm_\be_\bo_\bu_\bt seconds. _\bt_\bi_\bm_\be_\bo_\bu_\bt may be a deci-
5223 mal number with a fractional portion following the deci-
5224 mal point. This option is only effective if r\bre\bea\bad\bd is
5225 reading input from a terminal, pipe, or other special
5226 file; it has no effect when reading from regular files.
5227 If r\bre\bea\bad\bd times out, r\bre\bea\bad\bd saves any partial input read into
5228 the specified variable _\bn_\ba_\bm_\be. If _\bt_\bi_\bm_\be_\bo_\bu_\bt is 0, r\bre\bea\bad\bd
5229 returns immediately, without trying to read any data.
5230 The exit status is 0 if input is available on the speci-
5231 fied file descriptor, non-zero otherwise. The exit sta-
5232 tus is greater than 128 if the timeout is exceeded.
5233 -\b-u\bu _\bf_\bd Read input from file descriptor _\bf_\bd.
5234
5235 If no _\bn_\ba_\bm_\be_\bs are supplied, the line read is assigned to the vari-
5236 able R\bRE\bEP\bPL\bLY\bY. The exit status is zero, unless end-of-file is
5237 encountered, r\bre\bea\bad\bd times out (in which case the status is greater
5238 than 128), a variable assignment error (such as assigning to a
5239 readonly variable) occurs, or an invalid file descriptor is sup-
5240 plied as the argument to -\b-u\bu.
5241
5242 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] ...]
5243 The given _\bn_\ba_\bm_\be_\bs are marked readonly; the values of these _\bn_\ba_\bm_\be_\bs
5244 may not be changed by subsequent assignment. If the -\b-f\bf option
5245 is supplied, the functions corresponding to the _\bn_\ba_\bm_\be_\bs are so
5246 marked. The -\b-a\ba option restricts the variables to indexed
5247 arrays; the -\b-A\bA option restricts the variables to associative
5248 arrays. If both options are supplied, -\b-A\bA takes precedence. If
5249 no _\bn_\ba_\bm_\be arguments are given, or if the -\b-p\bp option is supplied, a
5250 list of all readonly names is printed. The other options may be
5251 used to restrict the output to a subset of the set of readonly
5252 names. The -\b-p\bp option causes output to be displayed in a format
5253 that may be reused as input. If a variable name is followed by
5254 =_\bw_\bo_\br_\bd, the value of the variable is set to _\bw_\bo_\br_\bd. The return
5255 status is 0 unless an invalid option is encountered, one of the
5256 _\bn_\ba_\bm_\be_\bs is not a valid shell variable name, or -\b-f\bf is supplied with
5257 a _\bn_\ba_\bm_\be that is not a function.
5258
5259 r\bre\bet\btu\bur\brn\bn [_\bn]
5260 Causes a function to stop executing and return the value speci-
5261 fied by _\bn to its caller. If _\bn is omitted, the return status is
5262 that of the last command executed in the function body. If
5263 r\bre\bet\btu\bur\brn\bn is executed by a trap handler, the last command used to
5264 determine the status is the last command executed before the
5265 trap handler. If r\bre\bet\btu\bur\brn\bn is executed during a D\bDE\bEB\bBU\bUG\bG trap, the
5266 last command used to determine the status is the last command
5267 executed by the trap handler before r\bre\bet\btu\bur\brn\bn was invoked. If
5268 r\bre\bet\btu\bur\brn\bn is used outside a function, but during execution of a
5269 script by the .\b. (s\bso\bou\bur\brc\bce\be) command, it causes the shell to stop
5270 executing that script and return either _\bn or the exit status of
5271 the last command executed within the script as the exit status
5272 of the script. If _\bn is supplied, the return value is its least
5273 significant 8 bits. The return status is non-zero if r\bre\bet\btu\bur\brn\bn is
5274 supplied a non-numeric argument, or is used outside a function
5275 and not during execution of a script by .\b. or s\bso\bou\bur\brc\bce\be. Any com-
5276 mand associated with the R\bRE\bET\bTU\bUR\bRN\bN trap is executed before execu-
5277 tion resumes after the function or script.
5278
5279 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 ...]
5280 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 ...]
5281 Without options, the name and value of each shell variable are
5282 displayed in a format that can be reused as input for setting or
5283 resetting the currently-set variables. Read-only variables can-
5284 not be reset. In _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, only shell variables are listed.
5285 The output is sorted according to the current locale. When
5286 options are specified, they set or unset shell attributes. Any
5287 arguments remaining after option processing are treated as val-
5288 ues for the positional parameters and are assigned, in order, to
5289 $\b$1\b1, $\b$2\b2, .\b..\b..\b. $\b$_\bn. Options, if specified, have the following
5290 meanings:
5291 -\b-a\ba Each variable or function that is created or modified is
5292 given the export attribute and marked for export to the
5293 environment of subsequent commands.
5294 -\b-b\bb Report the status of terminated background jobs immedi-
5295 ately, rather than before the next primary prompt. This
5296 is effective only when job control is enabled.
5297 -\b-e\be Exit immediately if a _\bp_\bi_\bp_\be_\bl_\bi_\bn_\be (which may consist of a
5298 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
5299 (see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR above), exits with a non-zero status.
5300 The shell does not exit if the command that fails is
5301 part of the command list immediately following a w\bwh\bhi\bil\ble\be
5302 or u\bun\bnt\bti\bil\bl keyword, part of the test following the i\bif\bf or
5303 e\bel\bli\bif\bf reserved words, part of any command executed in a
5304 &\b&&\b& or |\b||\b| list except the command following the final &\b&&\b&
5305 or |\b||\b|, any command in a pipeline but the last, or if the
5306 command's return value is being inverted with !\b!. If a
5307 compound command other than a subshell returns a non-
5308 zero status because a command failed while -\b-e\be was being
5309 ignored, the shell does not exit. A trap on E\bER\bRR\bR, if
5310 set, is executed before the shell exits. This option
5311 applies to the shell environment and each subshell envi-
5312 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
5313 above), and may cause subshells to exit before executing
5314 all the commands in the subshell.
5315
5316 If a compound command or shell function executes in a
5317 context where -\b-e\be is being ignored, none of the commands
5318 executed within the compound command or function body
5319 will be affected by the -\b-e\be setting, even if -\b-e\be is set
5320 and a command returns a failure status. If a compound
5321 command or shell function sets -\b-e\be while executing in a
5322 context where -\b-e\be is ignored, that setting will not have
5323 any effect until the compound command or the command
5324 containing the function call completes.
5325 -\b-f\bf Disable pathname expansion.
5326 -\b-h\bh Remember the location of commands as they are looked up
5327 for execution. This is enabled by default.
5328 -\b-k\bk All arguments in the form of assignment statements are
5329 placed in the environment for a command, not just those
5330 that precede the command name.
5331 -\b-m\bm Monitor mode. Job control is enabled. This option is
5332 on by default for interactive shells on systems that
5333 support it (see J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL above). All processes run
5334 in a separate process group. When a background job com-
5335 pletes, the shell prints a line containing its exit sta-
5336 tus.
5337 -\b-n\bn Read commands but do not execute them. This may be used
5338 to check a shell script for syntax errors. This is
5339 ignored by interactive shells.
5340 -\b-o\bo _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be
5341 The _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be can be one of the following:
5342 a\bal\bll\ble\bex\bxp\bpo\bor\brt\bt
5343 Same as -\b-a\ba.
5344 b\bbr\bra\bac\bce\bee\bex\bxp\bpa\ban\bnd\bd
5345 Same as -\b-B\bB.
5346 e\bem\bma\bac\bcs\bs Use an emacs-style command line editing inter-
5347 face. This is enabled by default when the shell
5348 is interactive, unless the shell is started with
5349 the -\b--\b-n\bno\boe\bed\bdi\bit\bti\bin\bng\bg option. This also affects the
5350 editing interface used for r\bre\bea\bad\bd -\b-e\be.
5351 e\ber\brr\bre\bex\bxi\bit\bt Same as -\b-e\be.
5352 e\ber\brr\brt\btr\bra\bac\bce\be
5353 Same as -\b-E\bE.
5354 f\bfu\bun\bnc\bct\btr\bra\bac\bce\be
5355 Same as -\b-T\bT.
5356 h\bha\bas\bsh\bha\bal\bll\bl Same as -\b-h\bh.
5357 h\bhi\bis\bst\bte\bex\bxp\bpa\ban\bnd\bd
5358 Same as -\b-H\bH.
5359 h\bhi\bis\bst\bto\bor\bry\by Enable command history, as described above under
5360 H\bHI\bIS\bST\bTO\bOR\bRY\bY. This option is on by default in inter-
5361 active shells.
5362 i\big\bgn\bno\bor\bre\bee\beo\bof\bf
5363 The effect is as if the shell command
5364 ``IGNOREEOF=10'' had been executed (see S\bSh\bhe\bel\bll\bl
5365 V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs above).
5366 k\bke\bey\byw\bwo\bor\brd\bd Same as -\b-k\bk.
5367 m\bmo\bon\bni\bit\bto\bor\br Same as -\b-m\bm.
5368 n\bno\boc\bcl\blo\bob\bbb\bbe\ber\br
5369 Same as -\b-C\bC.
5370 n\bno\boe\bex\bxe\bec\bc Same as -\b-n\bn.
5371 n\bno\bog\bgl\blo\bob\bb Same as -\b-f\bf.
5372 n\bno\bol\blo\bog\bg Currently ignored.
5373 n\bno\bot\bti\bif\bfy\by Same as -\b-b\bb.
5374 n\bno\bou\bun\bns\bse\bet\bt Same as -\b-u\bu.
5375 o\bon\bne\bec\bcm\bmd\bd Same as -\b-t\bt.
5376 p\bph\bhy\bys\bsi\bic\bca\bal\bl
5377 Same as -\b-P\bP.
5378 p\bpi\bip\bpe\bef\bfa\bai\bil\bl
5379 If set, the return value of a pipeline is the
5380 value of the last (rightmost) command to exit
5381 with a non-zero status, or zero if all commands
5382 in the pipeline exit successfully. This option
5383 is disabled by default.
5384 p\bpo\bos\bsi\bix\bx Change the behavior of b\bba\bas\bsh\bh where the default
5385 operation differs from the POSIX standard to
5386 match the standard (_\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be). See S\bSE\bEE\bE A\bAL\bLS\bSO\bO
5387 below for a reference to a document that details
5388 how posix mode affects bash's behavior.
5389 p\bpr\bri\biv\bvi\bil\ble\beg\bge\bed\bd
5390 Same as -\b-p\bp.
5391 v\bve\ber\brb\bbo\bos\bse\be Same as -\b-v\bv.
5392 v\bvi\bi Use a vi-style command line editing interface.
5393 This also affects the editing interface used for
5394 r\bre\bea\bad\bd -\b-e\be.
5395 x\bxt\btr\bra\bac\bce\be Same as -\b-x\bx.
5396 If -\b-o\bo is supplied with no _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be, the values of the
5397 current options are printed. If +\b+o\bo is supplied with no
5398 _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be, a series of s\bse\bet\bt commands to recreate the
5399 current option settings is displayed on the standard
5400 output.
5401 -\b-p\bp Turn on _\bp_\br_\bi_\bv_\bi_\bl_\be_\bg_\be_\bd mode. In this mode, the $\b$E\bEN\bNV\bV and
5402 $\b$B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV files are not processed, shell functions are
5403 not inherited from the environment, and the S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS,
5404 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
5405 appear in the environment, are ignored. If the shell is
5406 started with the effective user (group) id not equal to
5407 the real user (group) id, and the -\b-p\bp option is not sup-
5408 plied, these actions are taken and the effective user id
5409 is set to the real user id. If the -\b-p\bp option is sup-
5410 plied at startup, the effective user id is not reset.
5411 Turning this option off causes the effective user and
5412 group ids to be set to the real user and group ids.
5413 -\b-t\bt Exit after reading and executing one command.
5414 -\b-u\bu Treat unset variables and parameters other than the spe-
5415 cial parameters "@" and "*" as an error when performing
5416 parameter expansion. If expansion is attempted on an
5417 unset variable or parameter, the shell prints an error
5418 message, and, if not interactive, exits with a non-zero
5419 status.
5420 -\b-v\bv Print shell input lines as they are read.
5421 -\b-x\bx After expanding each _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd, f\bfo\bor\br command, c\bca\bas\bse\be
5422 command, s\bse\bel\ble\bec\bct\bt command, or arithmetic f\bfo\bor\br command, dis-
5423 play the expanded value of P\bPS\bS4\b4, followed by the command
5424 and its expanded arguments or associated word list.
5425 -\b-B\bB The shell performs brace expansion (see B\bBr\bra\bac\bce\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
5426 above). This is on by default.
5427 -\b-C\bC If set, b\bba\bas\bsh\bh does not overwrite an existing file with
5428 the >\b>, >\b>&\b&, and <\b<>\b> redirection operators. This may be
5429 overridden when creating output files by using the redi-
5430 rection operator >\b>|\b| instead of >\b>.
5431 -\b-E\bE If set, any trap on E\bER\bRR\bR is inherited by shell functions,
5432 command substitutions, and commands executed in a sub-
5433 shell environment. The E\bER\bRR\bR trap is normally not inher-
5434 ited in such cases.
5435 -\b-H\bH Enable !\b! style history substitution. This option is on
5436 by default when the shell is interactive.
5437 -\b-P\bP If set, the shell does not resolve symbolic links when
5438 executing commands such as c\bcd\bd that change the current
5439 working directory. It uses the physical directory
5440 structure instead. By default, b\bba\bas\bsh\bh follows the logical
5441 chain of directories when performing commands which
5442 change the current directory.
5443 -\b-T\bT If set, any traps on D\bDE\bEB\bBU\bUG\bG and R\bRE\bET\bTU\bUR\bRN\bN are inherited by
5444 shell functions, command substitutions, and commands
5445 executed in a subshell environment. The D\bDE\bEB\bBU\bUG\bG and
5446 R\bRE\bET\bTU\bUR\bRN\bN traps are normally not inherited in such cases.
5447 -\b--\b- If no arguments follow this option, then the positional
5448 parameters are unset. Otherwise, the positional parame-
5449 ters are set to the _\ba_\br_\bgs, even if some of them begin
5450 with a -\b-.
5451 -\b- Signal the end of options, cause all remaining _\ba_\br_\bgs to
5452 be assigned to the positional parameters. The -\b-x\bx and -\b-v\bv
5453 options are turned off. If there are no _\ba_\br_\bgs, the posi-
5454 tional parameters remain unchanged.
5455
5456 The options are off by default unless otherwise noted. Using +
5457 rather than - causes these options to be turned off. The
5458 options can also be specified as arguments to an invocation of
5459 the shell. The current set of options may be found in $\b$-\b-. The
5460 return status is always true unless an invalid option is encoun-
5461 tered.
5462
5463 s\bsh\bhi\bif\bft\bt [_\bn]
5464 The positional parameters from _\bn+1 ... are renamed to $\b$1\b1 .\b..\b..\b..\b.
5465 Parameters represented by the numbers $\b$#\b# down to $\b$#\b#-_\bn+1 are
5466 unset. _\bn must be a non-negative number less than or equal to
5467 $\b$#\b#. If _\bn is 0, no parameters are changed. If _\bn is not given,
5468 it is assumed to be 1. If _\bn is greater than $\b$#\b#, the positional
5469 parameters are not changed. The return status is greater than
5470 zero if _\bn is greater than $\b$#\b# or less than zero; otherwise 0.
5471
5472 s\bsh\bho\bop\bpt\bt [-\b-p\bpq\bqs\bsu\bu] [-\b-o\bo] [_\bo_\bp_\bt_\bn_\ba_\bm_\be ...]
5473 Toggle the values of settings controlling optional shell behav-
5474 ior. The settings can be either those listed below, or, if the
5475 -\b-o\bo option is used, those available with the -\b-o\bo option to the s\bse\bet\bt
5476 builtin command. With no options, or with the -\b-p\bp option, a list
5477 of all settable options is displayed, with an indication of
5478 whether or not each is set; if _\bo_\bp_\bt_\bn_\ba_\bm_\be_\bs are supplied, the output
5479 is restricted to those options. The -\b-p\bp option causes output to
5480 be displayed in a form that may be reused as input. Other
5481 options have the following meanings:
5482 -\b-s\bs Enable (set) each _\bo_\bp_\bt_\bn_\ba_\bm_\be.
5483 -\b-u\bu Disable (unset) each _\bo_\bp_\bt_\bn_\ba_\bm_\be.
5484 -\b-q\bq Suppresses normal output (quiet mode); the return status
5485 indicates whether the _\bo_\bp_\bt_\bn_\ba_\bm_\be is set or unset. If multi-
5486 ple _\bo_\bp_\bt_\bn_\ba_\bm_\be arguments are given with -\b-q\bq, the return sta-
5487 tus is zero if all _\bo_\bp_\bt_\bn_\ba_\bm_\be_\bs are enabled; non-zero other-
5488 wise.
5489 -\b-o\bo Restricts the values of _\bo_\bp_\bt_\bn_\ba_\bm_\be to be those defined for
5490 the -\b-o\bo option to the s\bse\bet\bt builtin.
5491
5492 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
5493 shows only those options which are set or unset, respectively.
5494 Unless otherwise noted, the s\bsh\bho\bop\bpt\bt options are disabled (unset)
5495 by default.
5496
5497 The return status when listing options is zero if all _\bo_\bp_\bt_\bn_\ba_\bm_\be_\bs
5498 are enabled, non-zero otherwise. When setting or unsetting
5499 options, the return status is zero unless an _\bo_\bp_\bt_\bn_\ba_\bm_\be is not a
5500 valid shell option.
5501
5502 The list of s\bsh\bho\bop\bpt\bt options is:
5503
5504 a\bas\bss\bso\boc\bc_\b_e\bex\bxp\bpa\ban\bnd\bd_\b_o\bon\bnc\bce\be
5505 If set, the shell suppresses multiple evaluation of
5506 associative array subscripts during arithmetic expres-
5507 sion evaluation and while executing builtins that can
5508 perform variable assignments.
5509 a\bau\but\bto\boc\bcd\bd If set, a command name that is the name of a directory
5510 is executed as if it were the argument to the c\bcd\bd com-
5511 mand. This option is only used by interactive shells.
5512 c\bcd\bda\bab\bbl\ble\be_\b_v\bva\bar\brs\bs
5513 If set, an argument to the c\bcd\bd builtin command that is
5514 not a directory is assumed to be the name of a variable
5515 whose value is the directory to change to.
5516 c\bcd\bds\bsp\bpe\bel\bll\bl If set, minor errors in the spelling of a directory com-
5517 ponent in a c\bcd\bd command will be corrected. The errors
5518 checked for are transposed characters, a missing charac-
5519 ter, and one character too many. If a correction is
5520 found, the corrected filename is printed, and the com-
5521 mand proceeds. This option is only used by interactive
5522 shells.
5523 c\bch\bhe\bec\bck\bkh\bha\bas\bsh\bh
5524 If set, b\bba\bas\bsh\bh checks that a command found in the hash ta-
5525 ble exists before trying to execute it. If a hashed
5526 command no longer exists, a normal path search is per-
5527 formed.
5528 c\bch\bhe\bec\bck\bkj\bjo\bob\bbs\bs
5529 If set, b\bba\bas\bsh\bh lists the status of any stopped and running
5530 jobs before exiting an interactive shell. If any jobs
5531 are running, this causes the exit to be deferred until a
5532 second exit is attempted without an intervening command
5533 (see J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL above). The shell always postpones
5534 exiting if any jobs are stopped.
5535 c\bch\bhe\bec\bck\bkw\bwi\bin\bns\bsi\biz\bze\be
5536 If set, b\bba\bas\bsh\bh checks the window size after each external
5537 (non-builtin) command and, if necessary, updates the
5538 values of L\bLI\bIN\bNE\bES\bS and C\bCO\bOL\bLU\bUM\bMN\bNS\bS. This option is enabled by
5539 default.
5540 c\bcm\bmd\bdh\bhi\bis\bst\bt If set, b\bba\bas\bsh\bh attempts to save all lines of a multiple-
5541 line command in the same history entry. This allows
5542 easy re-editing of multi-line commands. This option is
5543 enabled by default, but only has an effect if command
5544 history is enabled, as described above under H\bHI\bIS\bST\bTO\bOR\bRY\bY.
5545 c\bco\bom\bmp\bpa\bat\bt3\b31\b1
5546 If set, b\bba\bas\bsh\bh changes its behavior to that of version 3.1
5547 with respect to quoted arguments to the [\b[[\b[ conditional
5548 command's =\b=~\b~ operator and locale-specific string compar-
5549 ison when using the [\b[[\b[ conditional command's <\b< and >\b>
5550 operators. Bash versions prior to bash-4.1 use ASCII
5551 collation and _\bs_\bt_\br_\bc_\bm_\bp(3); bash-4.1 and later use the cur-
5552 rent locale's collation sequence and _\bs_\bt_\br_\bc_\bo_\bl_\bl(3).
5553 c\bco\bom\bmp\bpa\bat\bt3\b32\b2
5554 If set, b\bba\bas\bsh\bh changes its behavior to that of version 3.2
5555 with respect to locale-specific string comparison when
5556 using the [\b[[\b[ conditional command's <\b< and >\b> operators
5557 (see previous item) and the effect of interrupting a
5558 command list. Bash versions 3.2 and earlier continue
5559 with the next command in the list after one terminates
5560 due to an interrupt.
5561 c\bco\bom\bmp\bpa\bat\bt4\b40\b0
5562 If set, b\bba\bas\bsh\bh changes its behavior to that of version 4.0
5563 with respect to locale-specific string comparison when
5564 using the [\b[[\b[ conditional command's <\b< and >\b> operators
5565 (see description of c\bco\bom\bmp\bpa\bat\bt3\b31\b1) and the effect of inter-
5566 rupting a command list. Bash versions 4.0 and later
5567 interrupt the list as if the shell received the inter-
5568 rupt; previous versions continue with the next command
5569 in the list.
5570 c\bco\bom\bmp\bpa\bat\bt4\b41\b1
5571 If set, b\bba\bas\bsh\bh, when in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, treats a single quote
5572 in a double-quoted parameter expansion as a special
5573 character. The single quotes must match (an even num-
5574 ber) and the characters between the single quotes are
5575 considered quoted. This is the behavior of posix mode
5576 through version 4.1. The default bash behavior remains
5577 as in previous versions.
5578 c\bco\bom\bmp\bpa\bat\bt4\b42\b2
5579 If set, b\bba\bas\bsh\bh does not process the replacement string in
5580 the pattern substitution word expansion using quote
5581 removal.
5582 c\bco\bom\bmp\bpa\bat\bt4\b43\b3
5583 If set, b\bba\bas\bsh\bh does not print a warning message if an
5584 attempt is made to use a quoted compound array assign-
5585 ment as an argument to d\bde\bec\bcl\bla\bar\bre\be, makes word expansion
5586 errors non-fatal errors that cause the current command
5587 to fail (the default behavior is to make them fatal
5588 errors that cause the shell to exit), and does not reset
5589 the loop state when a shell function is executed (this
5590 allows b\bbr\bre\bea\bak\bk or c\bco\bon\bnt\bti\bin\bnu\bue\be in a shell function to affect
5591 loops in the caller's context).
5592 c\bco\bom\bmp\bpa\bat\bt4\b44\b4
5593 If set, b\bba\bas\bsh\bh saves the positional parameters to
5594 BASH_ARGV and BASH_ARGC before they are used, regardless
5595 of whether or not extended debugging mode is enabled.
5596 c\bco\bom\bmp\bpl\ble\bet\bte\be_\b_f\bfu\bul\bll\blq\bqu\buo\bot\bte\be
5597 If set, b\bba\bas\bsh\bh quotes all shell metacharacters in file-
5598 names and directory names when performing completion.
5599 If not set, b\bba\bas\bsh\bh removes metacharacters such as the dol-
5600 lar sign from the set of characters that will be quoted
5601 in completed filenames when these metacharacters appear
5602 in shell variable references in words to be completed.
5603 This means that dollar signs in variable names that
5604 expand to directories will not be quoted; however, any
5605 dollar signs appearing in filenames will not be quoted,
5606 either. This is active only when bash is using back-
5607 slashes to quote completed filenames. This variable is
5608 set by default, which is the default bash behavior in
5609 versions through 4.2.
5610 d\bdi\bir\bre\bex\bxp\bpa\ban\bnd\bd
5611 If set, b\bba\bas\bsh\bh replaces directory names with the results
5612 of word expansion when performing filename completion.
5613 This changes the contents of the readline editing buf-
5614 fer. If not set, b\bba\bas\bsh\bh attempts to preserve what the
5615 user typed.
5616 d\bdi\bir\brs\bsp\bpe\bel\bll\bl
5617 If set, b\bba\bas\bsh\bh attempts spelling correction on directory
5618 names during word completion if the directory name ini-
5619 tially supplied does not exist.
5620 d\bdo\bot\btg\bgl\blo\bob\bb If set, b\bba\bas\bsh\bh includes filenames beginning with a `.' in
5621 the results of pathname expansion. The filenames `\b``\b`.\b.'\b''\b'
5622 and `\b``\b`.\b..\b.'\b''\b' must always be matched explicitly, even if
5623 d\bdo\bot\btg\bgl\blo\bob\bb is set.
5624 e\bex\bxe\bec\bcf\bfa\bai\bil\bl
5625 If set, a non-interactive shell will not exit if it can-
5626 not execute the file specified as an argument to the
5627 e\bex\bxe\bec\bc builtin command. An interactive shell does not
5628 exit if e\bex\bxe\bec\bc fails.
5629 e\bex\bxp\bpa\ban\bnd\bd_\b_a\bal\bli\bia\bas\bse\bes\bs
5630 If set, aliases are expanded as described above under
5631 A\bAL\bLI\bIA\bAS\bSE\bES\bS. This option is enabled by default for interac-
5632 tive shells.
5633 e\bex\bxt\btd\bde\beb\bbu\bug\bg
5634 If set at shell invocation, arrange to execute the
5635 debugger profile before the shell starts, identical to
5636 the -\b--\b-d\bde\beb\bbu\bug\bgg\bge\ber\br option. If set after invocation, behav-
5637 ior intended for use by debuggers is enabled:
5638 1\b1.\b. The -\b-F\bF option to the d\bde\bec\bcl\bla\bar\bre\be builtin displays the
5639 source file name and line number corresponding to
5640 each function name supplied as an argument.
5641 2\b2.\b. If the command run by the D\bDE\bEB\bBU\bUG\bG trap returns a
5642 non-zero value, the next command is skipped and
5643 not executed.
5644 3\b3.\b. If the command run by the D\bDE\bEB\bBU\bUG\bG trap returns a
5645 value of 2, and the shell is executing in a sub-
5646 routine (a shell function or a shell script exe-
5647 cuted by the .\b. or s\bso\bou\bur\brc\bce\be builtins), the shell
5648 simulates a call to r\bre\bet\btu\bur\brn\bn.
5649 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
5650 in their descriptions above.
5651 5\b5.\b. Function tracing is enabled: command substitu-
5652 tion, shell functions, and subshells invoked with
5653 (\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.
5654 6\b6.\b. Error tracing is enabled: command substitution,
5655 shell functions, and subshells invoked with (\b(
5656 _\bc_\bo_\bm_\bm_\ba_\bn_\bd )\b) inherit the E\bER\bRR\bR trap.
5657 e\bex\bxt\btg\bgl\blo\bob\bb If set, the extended pattern matching features described
5658 above under P\bPa\bat\bth\bhn\bna\bam\bme\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn are enabled.
5659 e\bex\bxt\btq\bqu\buo\bot\bte\be
5660 If set, $\b$'_\bs_\bt_\br_\bi_\bn_\bg' and $\b$"_\bs_\bt_\br_\bi_\bn_\bg" quoting is performed
5661 within $\b${\b{_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br}\b} expansions enclosed in double
5662 quotes. This option is enabled by default.
5663 f\bfa\bai\bil\blg\bgl\blo\bob\bb
5664 If set, patterns which fail to match filenames during
5665 pathname expansion result in an expansion error.
5666 f\bfo\bor\brc\bce\be_\b_f\bfi\big\bgn\bno\bor\bre\be
5667 If set, the suffixes specified by the F\bFI\bIG\bGN\bNO\bOR\bRE\bE shell
5668 variable cause words to be ignored when performing word
5669 completion even if the ignored words are the only possi-
5670 ble completions. See S\bSH\bHE\bEL\bLL\bL V\bVA\bAR\bRI\bIA\bAB\bBL\bLE\bES\bS above for a
5671 description of F\bFI\bIG\bGN\bNO\bOR\bRE\bE. This option is enabled by
5672 default.
5673 g\bgl\blo\bob\bba\bas\bsc\bci\bii\bir\bra\ban\bng\bge\bes\bs
5674 If set, range expressions used in pattern matching
5675 bracket expressions (see P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg above) behave
5676 as if in the traditional C locale when performing com-
5677 parisons. That is, the current locale's collating
5678 sequence is not taken into account, so b\bb will not col-
5679 late between A\bA and B\bB, and upper-case and lower-case
5680 ASCII characters will collate together.
5681 g\bgl\blo\bob\bbs\bst\bta\bar\br
5682 If set, the pattern *\b**\b* used in a pathname expansion con-
5683 text will match all files and zero or more directories
5684 and subdirectories. If the pattern is followed by a /\b/,
5685 only directories and subdirectories match.
5686 g\bgn\bnu\bu_\b_e\ber\brr\brf\bfm\bmt\bt
5687 If set, shell error messages are written in the standard
5688 GNU error message format.
5689 h\bhi\bis\bst\bta\bap\bpp\bpe\ben\bnd\bd
5690 If set, the history list is appended to the file named
5691 by the value of the H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE variable when the shell
5692 exits, rather than overwriting the file.
5693 h\bhi\bis\bst\btr\bre\bee\bed\bdi\bit\bt
5694 If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, a user is given the
5695 opportunity to re-edit a failed history substitution.
5696 h\bhi\bis\bst\btv\bve\ber\bri\bif\bfy\by
5697 If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, the results of his-
5698 tory substitution are not immediately passed to the
5699 shell parser. Instead, the resulting line is loaded
5700 into the r\bre\bea\bad\bdl\bli\bin\bne\be editing buffer, allowing further modi-
5701 fication.
5702 h\bho\bos\bst\btc\bco\bom\bmp\bpl\ble\bet\bte\be
5703 If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, b\bba\bas\bsh\bh will attempt to
5704 perform hostname completion when a word containing a @\b@
5705 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
5706 above). This is enabled by default.
5707 h\bhu\bup\bpo\bon\bne\bex\bxi\bit\bt
5708 If set, b\bba\bas\bsh\bh will send S\bSI\bIG\bGH\bHU\bUP\bP to all jobs when an inter-
5709 active login shell exits.
5710 i\bin\bnh\bhe\ber\bri\bit\bt_\b_e\ber\brr\bre\bex\bxi\bit\bt
5711 If set, command substitution inherits the value of the
5712 e\ber\brr\bre\bex\bxi\bit\bt option, instead of unsetting it in the subshell
5713 environment. This option is enabled when _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be is
5714 enabled.
5715 i\bin\bnt\bte\ber\bra\bac\bct\bti\biv\bve\be_\b_c\bco\bom\bmm\bme\ben\bnt\bts\bs
5716 If set, allow a word beginning with #\b# to cause that word
5717 and all remaining characters on that line to be ignored
5718 in an interactive shell (see C\bCO\bOM\bMM\bME\bEN\bNT\bTS\bS above). This
5719 option is enabled by default.
5720 l\bla\bas\bst\btp\bpi\bip\bpe\be
5721 If set, and job control is not active, the shell runs
5722 the last command of a pipeline not executed in the back-
5723 ground in the current shell environment.
5724 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
5725 commands are saved to the history with embedded newlines
5726 rather than using semicolon separators where possible.
5727 l\blo\boc\bca\bal\blv\bva\bar\br_\b_i\bin\bnh\bhe\ber\bri\bit\bt
5728 If set, local variables inherit the value and attributes
5729 of a variable of the same name that exists at a previous
5730 scope before any new value is assigned. The nameref
5731 attribute is not inherited.
5732 l\blo\boc\bca\bal\blv\bva\bar\br_\b_u\bun\bns\bse\bet\bt
5733 If set, calling u\bun\bns\bse\bet\bt on local variables in previous
5734 function scopes marks them so subsequent lookups find
5735 them unset until that function returns. This is identi-
5736 cal to the behavior of unsetting local variables at the
5737 current function scope.
5738 l\blo\bog\bgi\bin\bn_\b_s\bsh\bhe\bel\bll\bl
5739 The shell sets this option if it is started as a login
5740 shell (see I\bIN\bNV\bVO\bOC\bCA\bAT\bTI\bIO\bON\bN above). The value may not be
5741 changed.
5742 m\bma\bai\bil\blw\bwa\bar\brn\bn
5743 If set, and a file that b\bba\bas\bsh\bh is checking for mail has
5744 been accessed since the last time it was checked, the
5745 message ``The mail in _\bm_\ba_\bi_\bl_\bf_\bi_\bl_\be has been read'' is dis-
5746 played.
5747 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
5748 If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, b\bba\bas\bsh\bh will not
5749 attempt to search the P\bPA\bAT\bTH\bH for possible completions when
5750 completion is attempted on an empty line.
5751 n\bno\boc\bca\bas\bse\beg\bgl\blo\bob\bb
5752 If set, b\bba\bas\bsh\bh matches filenames in a case-insensitive
5753 fashion when performing pathname expansion (see P\bPa\bat\bth\bhn\bna\bam\bme\be
5754 E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn above).
5755 n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh
5756 If set, b\bba\bas\bsh\bh matches patterns in a case-insensitive
5757 fashion when performing matching while executing c\bca\bas\bse\be or
5758 [\b[[\b[ conditional commands, when performing pattern substi-
5759 tution word expansions, or when filtering possible com-
5760 pletions as part of programmable completion.
5761 n\bnu\bul\bll\blg\bgl\blo\bob\bb
5762 If set, b\bba\bas\bsh\bh allows patterns which match no files (see
5763 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,
5764 rather than themselves.
5765 p\bpr\bro\bog\bgc\bco\bom\bmp\bp
5766 If set, the programmable completion facilities (see P\bPr\bro\bo-\b-
5767 g\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn above) are enabled. This option is
5768 enabled by default.
5769 p\bpr\bro\bog\bgc\bco\bom\bmp\bp_\b_a\bal\bli\bia\bas\bs
5770 If set, and programmable completion is enabled, b\bba\bas\bsh\bh
5771 treats a command name that doesn't have any completions
5772 as a possible alias and attempts alias expansion. If it
5773 has an alias, b\bba\bas\bsh\bh attempts programmable completion
5774 using the command word resulting from the expanded
5775 alias.
5776 p\bpr\bro\bom\bmp\bpt\btv\bva\bar\brs\bs
5777 If set, prompt strings undergo parameter expansion, com-
5778 mand substitution, arithmetic expansion, and quote
5779 removal after being expanded as described in P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG
5780 above. This option is enabled by default.
5781 r\bre\bes\bst\btr\bri\bic\bct\bte\bed\bd_\b_s\bsh\bhe\bel\bll\bl
5782 The shell sets this option if it is started in
5783 restricted mode (see R\bRE\bES\bST\bTR\bRI\bIC\bCT\bTE\bED\bD S\bSH\bHE\bEL\bLL\bL below). The value
5784 may not be changed. This is not reset when the startup
5785 files are executed, allowing the startup files to dis-
5786 cover whether or not a shell is restricted.
5787 s\bsh\bhi\bif\bft\bt_\b_v\bve\ber\brb\bbo\bos\bse\be
5788 If set, the s\bsh\bhi\bif\bft\bt builtin prints an error message when
5789 the shift count exceeds the number of positional parame-
5790 ters.
5791 s\bso\bou\bur\brc\bce\bep\bpa\bat\bth\bh
5792 If set, the s\bso\bou\bur\brc\bce\be (.\b.) builtin uses the value of P\bPA\bAT\bTH\bH to
5793 find the directory containing the file supplied as an
5794 argument. This option is enabled by default.
5795 x\bxp\bpg\bg_\b_e\bec\bch\bho\bo
5796 If set, the e\bec\bch\bho\bo builtin expands backslash-escape
5797 sequences by default.
5798
5799 s\bsu\bus\bsp\bpe\ben\bnd\bd [-\b-f\bf]
5800 Suspend the execution of this shell until it receives a S\bSI\bIG\bGC\bCO\bON\bNT\bT
5801 signal. A login shell cannot be suspended; the -\b-f\bf option can be
5802 used to override this and force the suspension. The return sta-
5803 tus is 0 unless the shell is a login shell and -\b-f\bf is not sup-
5804 plied, or if job control is not enabled.
5805
5806 t\bte\bes\bst\bt _\be_\bx_\bp_\br
5807 [\b[ _\be_\bx_\bp_\br ]\b]
5808 Return a status of 0 (true) or 1 (false) depending on the evalu-
5809 ation of the conditional expression _\be_\bx_\bp_\br. Each operator and op-
5810 erand must be a separate argument. Expressions are composed of
5811 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.
5812 t\bte\bes\bst\bt does not accept any options, nor does it accept and ignore
5813 an argument of -\b--\b- as signifying the end of options.
5814
5815 Expressions may be combined using the following operators,
5816 listed in decreasing order of precedence. The evaluation
5817 depends on the number of arguments; see below. Operator prece-
5818 dence is used when there are five or more arguments.
5819 !\b! _\be_\bx_\bp_\br True if _\be_\bx_\bp_\br is false.
5820 (\b( _\be_\bx_\bp_\br )\b)
5821 Returns the value of _\be_\bx_\bp_\br. This may be used to override
5822 the normal precedence of operators.
5823 _\be_\bx_\bp_\br_\b1 -a\ba _\be_\bx_\bp_\br_\b2
5824 True if both _\be_\bx_\bp_\br_\b1 and _\be_\bx_\bp_\br_\b2 are true.
5825 _\be_\bx_\bp_\br_\b1 -o\bo _\be_\bx_\bp_\br_\b2
5826 True if either _\be_\bx_\bp_\br_\b1 or _\be_\bx_\bp_\br_\b2 is true.
5827
5828 t\bte\bes\bst\bt and [\b[ evaluate conditional expressions using a set of rules
5829 based on the number of arguments.
5830
5831 0 arguments
5832 The expression is false.
5833 1 argument
5834 The expression is true if and only if the argument is not
5835 null.
5836 2 arguments
5837 If the first argument is !\b!, the expression is true if and
5838 only if the second argument is null. If the first argu-
5839 ment is one of the unary conditional operators listed
5840 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
5841 true if the unary test is true. If the first argument is
5842 not a valid unary conditional operator, the expression is
5843 false.
5844 3 arguments
5845 The following conditions are applied in the order listed.
5846 If the second argument is one of the binary conditional
5847 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
5848 result of the expression is the result of the binary test
5849 using the first and third arguments as operands. The -\b-a\ba
5850 and -\b-o\bo operators are considered binary operators when
5851 there are three arguments. If the first argument is !\b!,
5852 the value is the negation of the two-argument test using
5853 the second and third arguments. If the first argument is
5854 exactly (\b( and the third argument is exactly )\b), the result
5855 is the one-argument test of the second argument. Other-
5856 wise, the expression is false.
5857 4 arguments
5858 If the first argument is !\b!, the result is the negation of
5859 the three-argument expression composed of the remaining
5860 arguments. Otherwise, the expression is parsed and eval-
5861 uated according to precedence using the rules listed
5862 above.
5863 5 or more arguments
5864 The expression is parsed and evaluated according to
5865 precedence using the rules listed above.
5866
5867 When used with t\bte\bes\bst\bt or [\b[, the <\b< and >\b> operators sort lexico-
5868 graphically using ASCII ordering.
5869
5870 t\bti\bim\bme\bes\bs Print the accumulated user and system times for the shell and
5871 for processes run from the shell. The return status is 0.
5872
5873 t\btr\bra\bap\bp [-\b-l\blp\bp] [[_\ba_\br_\bg] _\bs_\bi_\bg_\bs_\bp_\be_\bc ...]
5874 The command _\ba_\br_\bg is to be read and executed when the shell
5875 receives signal(s) _\bs_\bi_\bg_\bs_\bp_\be_\bc. If _\ba_\br_\bg is absent (and there is a
5876 single _\bs_\bi_\bg_\bs_\bp_\be_\bc) or -\b-, each specified signal is reset to its
5877 original disposition (the value it had upon entrance to the
5878 shell). If _\ba_\br_\bg is the null string the signal specified by each
5879 _\bs_\bi_\bg_\bs_\bp_\be_\bc is ignored by the shell and by the commands it invokes.
5880 If _\ba_\br_\bg is not present and -\b-p\bp has been supplied, then the trap
5881 commands associated with each _\bs_\bi_\bg_\bs_\bp_\be_\bc are displayed. If no
5882 arguments are supplied or if only -\b-p\bp is given, t\btr\bra\bap\bp prints the
5883 list of commands associated with each signal. The -\b-l\bl option
5884 causes the shell to print a list of signal names and their cor-
5885 responding numbers. Each _\bs_\bi_\bg_\bs_\bp_\be_\bc is either a signal name
5886 defined in <_\bs_\bi_\bg_\bn_\ba_\bl_\b._\bh>, or a signal number. Signal names are
5887 case insensitive and the S\bSI\bIG\bG prefix is optional.
5888
5889 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
5890 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-
5891 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,
5892 _\bs_\be_\bl_\be_\bc_\bt command, every arithmetic _\bf_\bo_\br command, and before the
5893 first command executes in a shell function (see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR
5894 above). Refer to the description of the e\bex\bxt\btd\bde\beb\bbu\bug\bg option to the
5895 s\bsh\bho\bop\bpt\bt builtin for details of its effect on the D\bDE\bEB\bBU\bUG\bG trap. If a
5896 _\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
5897 function or a script executed with the .\b. or s\bso\bou\bur\brc\bce\be builtins fin-
5898 ishes executing.
5899
5900 If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is E\bER\bRR\bR, the command _\ba_\br_\bg is executed whenever a
5901 pipeline (which may consist of a single simple command), a list,
5902 or a compound command returns a non-zero exit status, subject to
5903 the following conditions. The E\bER\bRR\bR trap is not executed if the
5904 failed command is part of the command list immediately following
5905 a w\bwh\bhi\bil\ble\be or u\bun\bnt\bti\bil\bl keyword, part of the test in an _\bi_\bf statement,
5906 part of a command executed in a &\b&&\b& or |\b||\b| list except the command
5907 following the final &\b&&\b& or |\b||\b|, any command in a pipeline but the
5908 last, or if the command's return value is being inverted using
5909 !\b!. These are the same conditions obeyed by the e\ber\brr\bre\bex\bxi\bit\bt (-\b-e\be)
5910 option.
5911
5912 Signals ignored upon entry to the shell cannot be trapped or
5913 reset. Trapped signals that are not being ignored are reset to
5914 their original values in a subshell or subshell environment when
5915 one is created. The return status is false if any _\bs_\bi_\bg_\bs_\bp_\be_\bc is
5916 invalid; otherwise t\btr\bra\bap\bp returns true.
5917
5918 t\bty\byp\bpe\be [-\b-a\baf\bft\btp\bpP\bP] _\bn_\ba_\bm_\be [_\bn_\ba_\bm_\be ...]
5919 With no options, indicate how each _\bn_\ba_\bm_\be would be interpreted if
5920 used as a command name. If the -\b-t\bt option is used, t\bty\byp\bpe\be prints a
5921 string which is one of _\ba_\bl_\bi_\ba_\bs, _\bk_\be_\by_\bw_\bo_\br_\bd, _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn, _\bb_\bu_\bi_\bl_\bt_\bi_\bn, or
5922 _\bf_\bi_\bl_\be if _\bn_\ba_\bm_\be is an alias, shell reserved word, function,
5923 builtin, or disk file, respectively. If the _\bn_\ba_\bm_\be is not found,
5924 then nothing is printed, and an exit status of false is
5925 returned. If the -\b-p\bp option is used, t\bty\byp\bpe\be either returns the
5926 name of the disk file that would be executed if _\bn_\ba_\bm_\be were speci-
5927 fied as a command name, or nothing if ``type -t name'' would not
5928 return _\bf_\bi_\bl_\be. The -\b-P\bP option forces a P\bPA\bAT\bTH\bH search for each _\bn_\ba_\bm_\be,
5929 even if ``type -t name'' would not return _\bf_\bi_\bl_\be. If a command is
5930 hashed, -\b-p\bp and -\b-P\bP print the hashed value, which is not necessar-
5931 ily the file that appears first in P\bPA\bAT\bTH\bH. If the -\b-a\ba option is
5932 used, t\bty\byp\bpe\be prints all of the places that contain an executable
5933 named _\bn_\ba_\bm_\be. This includes aliases and functions, if and only if
5934 the -\b-p\bp option is not also used. The table of hashed commands is
5935 not consulted when using -\b-a\ba. The -\b-f\bf option suppresses shell
5936 function lookup, as with the c\bco\bom\bmm\bma\ban\bnd\bd builtin. t\bty\byp\bpe\be returns true
5937 if all of the arguments are found, false if any are not found.
5938
5939 u\bul\bli\bim\bmi\bit\bt [-\b-H\bHS\bSa\bab\bbc\bcd\bde\bef\bfi\bik\bkl\blm\bmn\bnp\bpq\bqr\brs\bst\btu\buv\bvx\bxP\bPT\bT [_\bl_\bi_\bm_\bi_\bt]]
5940 Provides control over the resources available to the shell and
5941 to processes started by it, on systems that allow such control.
5942 The -\b-H\bH and -\b-S\bS options specify that the hard or soft limit is set
5943 for the given resource. A hard limit cannot be increased by a
5944 non-root user once it is set; a soft limit may be increased up
5945 to the value of the hard limit. If neither -\b-H\bH nor -\b-S\bS is speci-
5946 fied, both the soft and hard limits are set. The value of _\bl_\bi_\bm_\bi_\bt
5947 can be a number in the unit specified for the resource or one of
5948 the special values h\bha\bar\brd\bd, s\bso\bof\bft\bt, or u\bun\bnl\bli\bim\bmi\bit\bte\bed\bd, which stand for the
5949 current hard limit, the current soft limit, and no limit,
5950 respectively. If _\bl_\bi_\bm_\bi_\bt is omitted, the current value of the
5951 soft limit of the resource is printed, unless the -\b-H\bH option is
5952 given. When more than one resource is specified, the limit name
5953 and unit are printed before the value. Other options are inter-
5954 preted as follows:
5955 -\b-a\ba All current limits are reported
5956 -\b-b\bb The maximum socket buffer size
5957 -\b-c\bc The maximum size of core files created
5958 -\b-d\bd The maximum size of a process's data segment
5959 -\b-e\be The maximum scheduling priority ("nice")
5960 -\b-f\bf The maximum size of files written by the shell and its
5961 children
5962 -\b-i\bi The maximum number of pending signals
5963 -\b-k\bk The maximum number of kqueues that may be allocated
5964 -\b-l\bl The maximum size that may be locked into memory
5965 -\b-m\bm The maximum resident set size (many systems do not honor
5966 this limit)
5967 -\b-n\bn The maximum number of open file descriptors (most systems
5968 do not allow this value to be set)
5969 -\b-p\bp The pipe size in 512-byte blocks (this may not be set)
5970 -\b-q\bq The maximum number of bytes in POSIX message queues
5971 -\b-r\br The maximum real-time scheduling priority
5972 -\b-s\bs The maximum stack size
5973 -\b-t\bt The maximum amount of cpu time in seconds
5974 -\b-u\bu The maximum number of processes available to a single
5975 user
5976 -\b-v\bv The maximum amount of virtual memory available to the
5977 shell and, on some systems, to its children
5978 -\b-x\bx The maximum number of file locks
5979 -\b-P\bP The maximum number of pseudoterminals
5980 -\b-T\bT The maximum number of threads
5981
5982 If _\bl_\bi_\bm_\bi_\bt is given, and the -\b-a\ba option is not used, _\bl_\bi_\bm_\bi_\bt is the
5983 new value of the specified resource. If no option is given,
5984 then -\b-f\bf is assumed. Values are in 1024-byte increments, except
5985 for -\b-t\bt, which is in seconds; -\b-p\bp, which is in units of 512-byte
5986 blocks; -\b-P\bP, -\b-T\bT, -\b-b\bb, -\b-k\bk, -\b-n\bn, and -\b-u\bu, which are unscaled values;
5987 and, when in posix mode, -\b-c\bc and -\b-f\bf, which are in 512-byte incre-
5988 ments. The return status is 0 unless an invalid option or argu-
5989 ment is supplied, or an error occurs while setting a new limit.
5990
5991 u\bum\bma\bas\bsk\bk [-\b-p\bp] [-\b-S\bS] [_\bm_\bo_\bd_\be]
5992 The user file-creation mask is set to _\bm_\bo_\bd_\be. If _\bm_\bo_\bd_\be begins with
5993 a digit, it is interpreted as an octal number; otherwise it is
5994 interpreted as a symbolic mode mask similar to that accepted by
5995 _\bc_\bh_\bm_\bo_\bd(1). If _\bm_\bo_\bd_\be is omitted, the current value of the mask is
5996 printed. The -\b-S\bS option causes the mask to be printed in sym-
5997 bolic form; the default output is an octal number. If the -\b-p\bp
5998 option is supplied, and _\bm_\bo_\bd_\be is omitted, the output is in a form
5999 that may be reused as input. The return status is 0 if the mode
6000 was successfully changed or if no _\bm_\bo_\bd_\be argument was supplied,
6001 and false otherwise.
6002
6003 u\bun\bna\bal\bli\bia\bas\bs [-a\ba] [_\bn_\ba_\bm_\be ...]
6004 Remove each _\bn_\ba_\bm_\be from the list of defined aliases. If -\b-a\ba is
6005 supplied, all alias definitions are removed. The return value
6006 is true unless a supplied _\bn_\ba_\bm_\be is not a defined alias.
6007
6008 u\bun\bns\bse\bet\bt [-f\bfv\bv] [-n\bn] [_\bn_\ba_\bm_\be ...]
6009 For each _\bn_\ba_\bm_\be, remove the corresponding variable or function.
6010 If the -\b-v\bv option is given, each _\bn_\ba_\bm_\be refers to a shell variable,
6011 and that variable is removed. Read-only variables may not be
6012 unset. If -\b-f\bf is specified, each _\bn_\ba_\bm_\be refers to a shell func-
6013 tion, and the function definition is removed. If the -\b-n\bn option
6014 is supplied, and _\bn_\ba_\bm_\be is a variable with the _\bn_\ba_\bm_\be_\br_\be_\bf attribute,
6015 _\bn_\ba_\bm_\be will be unset rather than the variable it references. -\b-n\bn
6016 has no effect if the -\b-f\bf option is supplied. If no options are
6017 supplied, each _\bn_\ba_\bm_\be refers to a variable; if there is no vari-
6018 able by that name, any function with that name is unset. Each
6019 unset variable or function is removed from the environment
6020 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-
6021 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
6022 unset, they lose their special properties, even if they are sub-
6023 sequently reset. The exit status is true unless a _\bn_\ba_\bm_\be is read-
6024 only.
6025
6026 w\bwa\bai\bit\bt [-\b-f\bfn\bn] [_\bi_\bd _\b._\b._\b.]
6027 Wait for each specified child process and return its termination
6028 status. Each _\bi_\bd may be a process ID or a job specification; if
6029 a job spec is given, all processes in that job's pipeline are
6030 waited for. If _\bi_\bd is not given, all currently active child pro-
6031 cesses are waited for, and the return status is zero. If the -\b-n\bn
6032 option is supplied, w\bwa\bai\bit\bt waits for any job to terminate and
6033 returns its exit status. If the -\b-f\bf option is supplied, and job
6034 control is enabled, w\bwa\bai\bit\bt forces _\bi_\bd to terminate before returning
6035 its status, instead of returning when it changes status. If _\bi_\bd
6036 specifies a non-existent process or job, the return status is
6037 127. Otherwise, the return status is the exit status of the
6038 last process or job waited for.
6039
6040 R\bRE\bES\bST\bTR\bRI\bIC\bCT\bTE\bED\bD S\bSH\bHE\bEL\bLL\bL
6041 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
6042 invocation, the shell becomes restricted. A restricted shell is used
6043 to set up an environment more controlled than the standard shell. It
6044 behaves identically to b\bba\bas\bsh\bh with the exception that the following are
6045 disallowed or not performed:
6046
6047 +\bo changing directories with c\bcd\bd
6048
6049 +\bo setting or unsetting the values of S\bSH\bHE\bEL\bLL\bL, P\bPA\bAT\bTH\bH, E\bEN\bNV\bV, or B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV
6050
6051 +\bo specifying command names containing /\b/
6052
6053 +\bo specifying a filename containing a /\b/ as an argument to the .\b.
6054 builtin command
6055
6056 +\bo specifying a filename containing a slash as an argument to the
6057 -\b-p\bp option to the h\bha\bas\bsh\bh builtin command
6058
6059 +\bo importing function definitions from the shell environment at
6060 startup
6061
6062 +\bo parsing the value of S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS from the shell environment at
6063 startup
6064
6065 +\bo redirecting output using the >, >|, <>, >&, &>, and >> redirect-
6066 ion operators
6067
6068 +\bo using the e\bex\bxe\bec\bc builtin command to replace the shell with another
6069 command
6070
6071 +\bo adding or deleting builtin commands with the -\b-f\bf and -\b-d\bd options
6072 to the e\ben\bna\bab\bbl\ble\be builtin command
6073
6074 +\bo using the e\ben\bna\bab\bbl\ble\be builtin command to enable disabled shell
6075 builtins
6076
6077 +\bo specifying the -\b-p\bp option to the c\bco\bom\bmm\bma\ban\bnd\bd builtin command
6078
6079 +\bo turning off restricted mode with s\bse\bet\bt +\b+r\br or s\bse\bet\bt +\b+o\bo r\bre\bes\bst\btr\bri\bic\bct\bte\bed\bd.
6080
6081 These restrictions are enforced after any startup files are read.
6082
6083 When a command that is found to be a shell script is executed (see C\bCO\bOM\bM-\b-
6084 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
6085 spawned to execute the script.
6086
6087 S\bSE\bEE\bE A\bAL\bLS\bSO\bO
6088 _\bB_\ba_\bs_\bh _\bR_\be_\bf_\be_\br_\be_\bn_\bc_\be _\bM_\ba_\bn_\bu_\ba_\bl, Brian Fox and Chet Ramey
6089 _\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
6090 _\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
6091 _\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-
6092 _\bt_\bi_\be_\bs, IEEE --
6093 http://pubs.opengroup.org/onlinepubs/9699919799/
6094 http://tiswww.case.edu/~chet/bash/POSIX -- a description of posix mode
6095 _\bs_\bh(1), _\bk_\bs_\bh(1), _\bc_\bs_\bh(1)
6096 _\be_\bm_\ba_\bc_\bs(1), _\bv_\bi(1)
6097 _\br_\be_\ba_\bd_\bl_\bi_\bn_\be(3)
6098
6099 F\bFI\bIL\bLE\bES\bS
6100 _\b/_\bb_\bi_\bn_\b/_\bb_\ba_\bs_\bh
6101 The b\bba\bas\bsh\bh executable
6102 _\b/_\be_\bt_\bc_\b/_\bp_\br_\bo_\bf_\bi_\bl_\be
6103 The systemwide initialization file, executed for login shells
6104 _\b~_\b/_\b._\bb_\ba_\bs_\bh_\b__\bp_\br_\bo_\bf_\bi_\bl_\be
6105 The personal initialization file, executed for login shells
6106 _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc
6107 The individual per-interactive-shell startup file
6108 _\b~_\b/_\b._\bb_\ba_\bs_\bh_\b__\bl_\bo_\bg_\bo_\bu_\bt
6109 The individual login shell cleanup file, executed when a login
6110 shell exits
6111 _\b~_\b/_\b._\bi_\bn_\bp_\bu_\bt_\br_\bc
6112 Individual _\br_\be_\ba_\bd_\bl_\bi_\bn_\be initialization file
6113
6114 A\bAU\bUT\bTH\bHO\bOR\bRS\bS
6115 Brian Fox, Free Software Foundation
6116 bfox@gnu.org
6117
6118 Chet Ramey, Case Western Reserve University
6119 chet.ramey@case.edu
6120
6121 B\bBU\bUG\bG R\bRE\bEP\bPO\bOR\bRT\bTS\bS
6122 If you find a bug in b\bba\bas\bsh\bh,\b, you should report it. But first, you should
6123 make sure that it really is a bug, and that it appears in the latest
6124 version of b\bba\bas\bsh\bh. The latest version is always available from
6125 _\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/.
6126
6127 Once you have determined that a bug actually exists, use the _\bb_\ba_\bs_\bh_\bb_\bu_\bg
6128 command to submit a bug report. If you have a fix, you are encouraged
6129 to mail that as well! Suggestions and `philosophical' bug reports may
6130 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
6131 g\bgn\bnu\bu.\b.b\bba\bas\bsh\bh.\b.b\bbu\bug\bg.
6132
6133 ALL bug reports should include:
6134
6135 The version number of b\bba\bas\bsh\bh
6136 The hardware and operating system
6137 The compiler used to compile
6138 A description of the bug behaviour
6139 A short script or `recipe' which exercises the bug
6140
6141 _\bb_\ba_\bs_\bh_\bb_\bu_\bg inserts the first three items automatically into the template
6142 it provides for filing a bug report.
6143
6144 Comments and bug reports concerning this manual page should be directed
6145 to _\bc_\bh_\be_\bt_\b._\br_\ba_\bm_\be_\by_\b@_\bc_\ba_\bs_\be_\b._\be_\bd_\bu.
6146
6147 B\bBU\bUG\bGS\bS
6148 It's too big and too slow.
6149
6150 There are some subtle differences between b\bba\bas\bsh\bh and traditional versions
6151 of s\bsh\bh, mostly because of the P\bPO\bOS\bSI\bIX\bX specification.
6152
6153 Aliases are confusing in some uses.
6154
6155 Shell builtin commands and functions are not stoppable/restartable.
6156
6157 Compound commands and command sequences of the form `a ; b ; c' are not
6158 handled gracefully when process suspension is attempted. When a
6159 process is stopped, the shell immediately executes the next command in
6160 the sequence. It suffices to place the sequence of commands between
6161 parentheses to force it into a subshell, which may be stopped as a
6162 unit.
6163
6164 Array variables may not (yet) be exported.
6165
6166 There may be only one active coprocess at a time.
6167
6168
6169
6170 GNU Bash 5.0 2018 December 7 BASH(1)