]> git.ipfire.org Git - thirdparty/bash.git/blob - doc/bash.0
Bash-4.1 distribution source
[thirdparty/bash.git] / doc / bash.0
1 BASH(1) 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] [file]
10
11 C\bCO\bOP\bPY\bYR\bRI\bIG\bGH\bHT\bT
12 Bash is Copyright (C) 1989-2009 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 In addition to the single-character shell options documented in the
25 description of the s\bse\bet\bt builtin command, b\bba\bas\bsh\bh interprets the following
26 options when it is invoked:
27
28 -\b-c\bc _\bs_\bt_\br_\bi_\bn_\bg If the -\b-c\bc option is present, then commands are read from
29 _\bs_\bt_\br_\bi_\bn_\bg. If there are arguments after the _\bs_\bt_\br_\bi_\bn_\bg, they are
30 assigned to the positional parameters, starting with $\b$0\b0.
31 -\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.
32 -\b-l\bl Make b\bba\bas\bsh\bh act as if it had been invoked as a login shell (see
33 I\bIN\bNV\bVO\bOC\bCA\bAT\bTI\bIO\bON\bN below).
34 -\b-r\br If the -\b-r\br option is present, the shell becomes _\br_\be_\bs_\bt_\br_\bi_\bc_\bt_\be_\bd
35 (see R\bRE\bES\bST\bTR\bRI\bIC\bCT\bTE\bED\bD S\bSH\bHE\bEL\bLL\bL below).
36 -\b-s\bs If the -\b-s\bs option is present, or if no arguments remain after
37 option processing, then commands are read from the standard
38 input. This option allows the positional parameters to be
39 set when invoking an interactive shell.
40 -\b-D\bD A list of all double-quoted strings preceded by $\b$ is printed
41 on the standard output. These are the strings that are sub-
42 ject to language translation when the current locale is not C\bC
43 or P\bPO\bOS\bSI\bIX\bX. This implies the -\b-n\bn option; no commands will be
44 executed.
45 [\b[-\b-+\b+]\b]O\bO [\b[_\bs_\bh_\bo_\bp_\bt_\b__\bo_\bp_\bt_\bi_\bo_\bn]\b]
46 _\bs_\bh_\bo_\bp_\bt_\b__\bo_\bp_\bt_\bi_\bo_\bn is one of the shell options accepted by the
47 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
48 _\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
49 unsets it. If _\bs_\bh_\bo_\bp_\bt_\b__\bo_\bp_\bt_\bi_\bo_\bn is not supplied, the names and
50 values of the shell options accepted by s\bsh\bho\bop\bpt\bt are printed on
51 the standard output. If the invocation option is +\b+O\bO, the
52 output is displayed in a format that may be reused as input.
53 -\b--\b- A -\b--\b- signals the end of options and disables further option
54 processing. Any arguments after the -\b--\b- are treated as file-
55 names and arguments. An argument of -\b- is equivalent to -\b--\b-.
56
57 B\bBa\bas\bsh\bh also interprets a number of multi-character options. These
58 options must appear on the command line before the single-character
59 options to be recognized.
60
61 -\b--\b-d\bde\beb\bbu\bug\bgg\bge\ber\br
62 Arrange for the debugger profile to be executed before the shell
63 starts. Turns on extended debugging mode (see the description
64 of the e\bex\bxt\btd\bde\beb\bbu\bug\bg option to the s\bsh\bho\bop\bpt\bt builtin below) and shell
65 function tracing (see the description of the -\b-o\bo f\bfu\bun\bnc\bct\btr\bra\bac\bce\be option
66 to the s\bse\bet\bt builtin below).
67 -\b--\b-d\bdu\bum\bmp\bp-\b-p\bpo\bo-\b-s\bst\btr\bri\bin\bng\bgs\bs
68 Equivalent to -\b-D\bD, but the output is in the GNU _\bg_\be_\bt_\bt_\be_\bx_\bt p\bpo\bo (por-
69 table object) file format.
70 -\b--\b-d\bdu\bum\bmp\bp-\b-s\bst\btr\bri\bin\bng\bgs\bs
71 Equivalent to -\b-D\bD.
72 -\b--\b-h\bhe\bel\blp\bp Display a usage message on standard output and exit success-
73 fully.
74 -\b--\b-i\bin\bni\bit\bt-\b-f\bfi\bil\ble\be _\bf_\bi_\bl_\be
75 -\b--\b-r\brc\bcf\bfi\bil\ble\be _\bf_\bi_\bl_\be
76 Execute commands from _\bf_\bi_\bl_\be instead of the standard personal ini-
77 tialization file _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc if the shell is interactive (see
78 I\bIN\bNV\bVO\bOC\bCA\bAT\bTI\bIO\bON\bN below).
79
80 -\b--\b-l\blo\bog\bgi\bin\bn
81 Equivalent to -\b-l\bl.
82
83 -\b--\b-n\bno\boe\bed\bdi\bit\bti\bin\bng\bg
84 Do not use the GNU r\bre\bea\bad\bdl\bli\bin\bne\be library to read command lines when
85 the shell is interactive.
86
87 -\b--\b-n\bno\bop\bpr\bro\bof\bfi\bil\ble\be
88 Do not read either the system-wide startup file _\b/_\be_\bt_\bc_\b/_\bp_\br_\bo_\bf_\bi_\bl_\be or
89 any of the personal initialization files _\b~_\b/_\b._\bb_\ba_\bs_\bh_\b__\bp_\br_\bo_\bf_\bi_\bl_\be,
90 _\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
91 files when it is invoked as a login shell (see I\bIN\bNV\bVO\bOC\bCA\bAT\bTI\bIO\bON\bN
92 below).
93
94 -\b--\b-n\bno\bor\brc\bc Do not read and execute the personal initialization file
95 _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc if the shell is interactive. This option is on by
96 default if the shell is invoked as s\bsh\bh.
97
98 -\b--\b-p\bpo\bos\bsi\bix\bx
99 Change the behavior of b\bba\bas\bsh\bh where the default operation differs
100 from the POSIX standard to match the standard (_\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be).
101
102 -\b--\b-r\bre\bes\bst\btr\bri\bic\bct\bte\bed\bd
103 The shell becomes restricted (see R\bRE\bES\bST\bTR\bRI\bIC\bCT\bTE\bED\bD S\bSH\bHE\bEL\bLL\bL below).
104
105 -\b--\b-v\bve\ber\brb\bbo\bos\bse\be
106 Equivalent to -\b-v\bv.
107
108 -\b--\b-v\bve\ber\brs\bsi\bio\bon\bn
109 Show version information for this instance of b\bba\bas\bsh\bh on the stan-
110 dard output and exit successfully.
111
112 A\bAR\bRG\bGU\bUM\bME\bEN\bNT\bTS\bS
113 If arguments remain after option processing, and neither the -\b-c\bc nor the
114 -\b-s\bs option has been supplied, the first argument is assumed to be the
115 name of a file containing shell commands. If b\bba\bas\bsh\bh is invoked in this
116 fashion, $\b$0\b0 is set to the name of the file, and the positional parame-
117 ters are set to the remaining arguments. B\bBa\bas\bsh\bh reads and executes com-
118 mands from this file, then exits. B\bBa\bas\bsh\bh's exit status is the exit sta-
119 tus of the last command executed in the script. If no commands are
120 executed, the exit status is 0. An attempt is first made to open the
121 file in the current directory, and, if no file is found, then the shell
122 searches the directories in P\bPA\bAT\bTH\bH for the script.
123
124 I\bIN\bNV\bVO\bOC\bCA\bAT\bTI\bIO\bON\bN
125 A _\bl_\bo_\bg_\bi_\bn _\bs_\bh_\be_\bl_\bl is one whose first character of argument zero is a -\b-, or
126 one started with the -\b--\b-l\blo\bog\bgi\bin\bn option.
127
128 An _\bi_\bn_\bt_\be_\br_\ba_\bc_\bt_\bi_\bv_\be shell is one started without non-option arguments and
129 without the -\b-c\bc option whose standard input and error are both connected
130 to terminals (as determined by _\bi_\bs_\ba_\bt_\bt_\by(3)), or one started with the -\b-i\bi
131 option. P\bPS\bS1\b1 is set and $\b$-\b- includes i\bi if b\bba\bas\bsh\bh is interactive, allowing
132 a shell script or a startup file to test this state.
133
134 The following paragraphs describe how b\bba\bas\bsh\bh executes its startup files.
135 If any of the files exist but cannot be read, b\bba\bas\bsh\bh reports an error.
136 Tildes are expanded in file names as described below under T\bTi\bil\bld\bde\be E\bEx\bxp\bpa\ban\bn-\b-
137 s\bsi\bio\bon\bn in the E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN section.
138
139 When b\bba\bas\bsh\bh is invoked as an interactive login shell, or as a non-inter-
140 active shell with the -\b--\b-l\blo\bog\bgi\bin\bn option, it first reads and executes com-
141 mands from the file _\b/_\be_\bt_\bc_\b/_\bp_\br_\bo_\bf_\bi_\bl_\be, if that file exists. After reading
142 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,
143 in that order, and reads and executes commands from the first one that
144 exists and is readable. The -\b--\b-n\bno\bop\bpr\bro\bof\bfi\bil\ble\be option may be used when the
145 shell is started to inhibit this behavior.
146
147 When a login shell exits, b\bba\bas\bsh\bh reads and executes commands from the
148 file _\b~_\b/_\b._\bb_\ba_\bs_\bh_\b__\bl_\bo_\bg_\bo_\bu_\bt, if it exists.
149
150 When an interactive shell that is not a login shell is started, b\bba\bas\bsh\bh
151 reads and executes commands from _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc, if that file exists. This
152 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
153 will force b\bba\bas\bsh\bh to read and execute commands from _\bf_\bi_\bl_\be instead of
154 _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc.
155
156 When b\bba\bas\bsh\bh is started non-interactively, to run a shell script, for
157 example, it looks for the variable B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV in the environment, expands
158 its value if it appears there, and uses the expanded value as the name
159 of a file to read and execute. B\bBa\bas\bsh\bh behaves as if the following com-
160 mand were executed:
161 if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
162 but the value of the P\bPA\bAT\bTH\bH variable is not used to search for the file
163 name.
164
165 If b\bba\bas\bsh\bh is invoked with the name s\bsh\bh, it tries to mimic the startup
166 behavior of historical versions of s\bsh\bh as closely as possible, while
167 conforming to the POSIX standard as well. When invoked as an interac-
168 tive login shell, or a non-interactive shell with the -\b--\b-l\blo\bog\bgi\bin\bn option,
169 it first attempts to read and execute commands from _\b/_\be_\bt_\bc_\b/_\bp_\br_\bo_\bf_\bi_\bl_\be and
170 _\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
171 inhibit this behavior. When invoked as an interactive shell with the
172 name s\bsh\bh, b\bba\bas\bsh\bh looks for the variable E\bEN\bNV\bV, expands its value if it is
173 defined, and uses the expanded value as the name of a file to read and
174 execute. Since a shell invoked as s\bsh\bh does not attempt to read and exe-
175 cute commands from any other startup files, the -\b--\b-r\brc\bcf\bfi\bil\ble\be option has no
176 effect. A non-interactive shell invoked with the name s\bsh\bh does not
177 attempt to read any other startup files. When invoked as s\bsh\bh, b\bba\bas\bsh\bh
178 enters _\bp_\bo_\bs_\bi_\bx mode after the startup files are read.
179
180 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
181 option, it follows the POSIX standard for startup files. In this mode,
182 interactive shells expand the E\bEN\bNV\bV variable and commands are read and
183 executed from the file whose name is the expanded value. No other
184 startup files are read.
185
186 B\bBa\bas\bsh\bh attempts to determine when it is being run with its standard input
187 connected to a a network connection, as if by the remote shell daemon,
188 usually _\br_\bs_\bh_\bd, or the secure shell daemon _\bs_\bs_\bh_\bd. If b\bba\bas\bsh\bh determines it
189 is being run in this fashion, it reads and executes commands from
190 _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc, if that file exists and is readable. It will not do this if
191 invoked as s\bsh\bh. The -\b--\b-n\bno\bor\brc\bc option may be used to inhibit this behavior,
192 and the -\b--\b-r\brc\bcf\bfi\bil\ble\be option may be used to force another file to be read,
193 but _\br_\bs_\bh_\bd does not generally invoke the shell with those options or
194 allow them to be specified.
195
196 If the shell is started with the effective user (group) id not equal to
197 the real user (group) id, and the -\b-p\bp option is not supplied, no startup
198 files are read, shell functions are not inherited from the environment,
199 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
200 appear in the environment, are ignored, and the effective user id is
201 set to the real user id. If the -\b-p\bp option is supplied at invocation,
202 the startup behavior is the same, but the effective user id is not
203 reset.
204
205 D\bDE\bEF\bFI\bIN\bNI\bIT\bTI\bIO\bON\bNS\bS
206 The following definitions are used throughout the rest of this docu-
207 ment.
208 b\bbl\bla\ban\bnk\bk A space or tab.
209 w\bwo\bor\brd\bd A sequence of characters considered as a single unit by the
210 shell. Also known as a t\bto\bok\bke\ben\bn.
211 n\bna\bam\bme\be A _\bw_\bo_\br_\bd consisting only of alphanumeric characters and under-
212 scores, and beginning with an alphabetic character or an under-
213 score. Also referred to as an i\bid\bde\ben\bnt\bti\bif\bfi\bie\ber\br.
214 m\bme\bet\bta\bac\bch\bha\bar\bra\bac\bct\bte\ber\br
215 A character that, when unquoted, separates words. One of the
216 following:
217 |\b| &\b& ;\b; (\b( )\b) <\b< >\b> s\bsp\bpa\bac\bce\be t\bta\bab\bb
218 c\bco\bon\bnt\btr\bro\bol\bl o\bop\bpe\ber\bra\bat\bto\bor\br
219 A _\bt_\bo_\bk_\be_\bn that performs a control function. It is one of the fol-
220 lowing symbols:
221 |\b||\b| &\b& &\b&&\b& ;\b; ;\b;;\b; (\b( )\b) |\b| |\b|&\b& <\b<n\bne\bew\bwl\bli\bin\bne\be>\b>
222
223 R\bRE\bES\bSE\bER\bRV\bVE\bED\bD W\bWO\bOR\bRD\bDS\bS
224 _\bR_\be_\bs_\be_\br_\bv_\be_\bd _\bw_\bo_\br_\bd_\bs are words that have a special meaning to the shell. The
225 following words are recognized as reserved when unquoted and either the
226 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
227 word of a c\bca\bas\bse\be or f\bfo\bor\br command:
228
229 !\b! c\bca\bas\bse\be d\bdo\bo d\bdo\bon\bne\be e\bel\bli\bif\bf e\bel\bls\bse\be e\bes\bsa\bac\bc f\bfi\bi f\bfo\bor\br f\bfu\bun\bnc\bct\bti\bio\bon\bn i\bif\bf i\bin\bn s\bse\bel\ble\bec\bct\bt t\bth\bhe\ben\bn u\bun\bnt\bti\bil\bl
230 w\bwh\bhi\bil\ble\be {\b{ }\b} t\bti\bim\bme\be [\b[[\b[ ]\b]]\b]
231
232 S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR
233 S\bSi\bim\bmp\bpl\ble\be C\bCo\bom\bmm\bma\ban\bnd\bds\bs
234 A _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd is a sequence of optional variable assignments fol-
235 lowed by b\bbl\bla\ban\bnk\bk-separated words and redirections, and terminated by a
236 _\bc_\bo_\bn_\bt_\br_\bo_\bl _\bo_\bp_\be_\br_\ba_\bt_\bo_\br. The first word specifies the command to be executed,
237 and is passed as argument zero. The remaining words are passed as
238 arguments to the invoked command.
239
240 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
241 the command is terminated by signal _\bn.
242
243 P\bPi\bip\bpe\bel\bli\bin\bne\bes\bs
244 A _\bp_\bi_\bp_\be_\bl_\bi_\bn_\be is a sequence of one or more commands separated by one of
245 the control operators |\b| or |\b|&\b&. The format for a pipeline is:
246
247 [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 ... ]
248
249 The standard output of _\bc_\bo_\bm_\bm_\ba_\bn_\bd is connected via a pipe to the standard
250 input of _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2. This connection is performed before any redirec-
251 tions specified by the command (see R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN below). If |\b|&\b& is used,
252 the standard error of _\bc_\bo_\bm_\bm_\ba_\bn_\bd is connected to _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2's standard input
253 through the pipe; it is shorthand for 2\b2>\b>&\b&1\b1 |\b|. This implicit redirect-
254 ion of the standard error is performed after any redirections specified
255 by the command.
256
257 The return status of a pipeline is the exit status of the last command,
258 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
259 pipeline's return status is the value of the last (rightmost) command
260 to exit with a non-zero status, or zero if all commands exit success-
261 fully. If the reserved word !\b! precedes a pipeline, the exit status of
262 that pipeline is the logical negation of the exit status as described
263 above. The shell waits for all commands in the pipeline to terminate
264 before returning a value.
265
266 If the t\bti\bim\bme\be reserved word precedes a pipeline, the elapsed as well as
267 user and system time consumed by its execution are reported when the
268 pipeline terminates. The -\b-p\bp option changes the output format to that
269 specified by POSIX. The T\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT variable may be set to a format
270 string that specifies how the timing information should be displayed;
271 see the description of T\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT under S\bSh\bhe\bel\bll\bl V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs below.
272
273 Each command in a pipeline is executed as a separate process (i.e., in
274 a subshell).
275
276 L\bLi\bis\bst\bts\bs
277 A _\bl_\bi_\bs_\bt is a sequence of one or more pipelines separated by one of the
278 operators ;\b;, &\b&, &\b&&\b&, or |\b||\b|, and optionally terminated by one of ;\b;, &\b&, or
279 <\b<n\bne\bew\bwl\bli\bin\bne\be>\b>.
280
281 Of these list operators, &\b&&\b& and |\b||\b| have equal precedence, followed by ;\b;
282 and &\b&, which have equal precedence.
283
284 A sequence of one or more newlines may appear in a _\bl_\bi_\bs_\bt instead of a
285 semicolon to delimit commands.
286
287 If a command is terminated by the control operator &\b&, the shell exe-
288 cutes the command in the _\bb_\ba_\bc_\bk_\bg_\br_\bo_\bu_\bn_\bd in a subshell. The shell does not
289 wait for the command to finish, and the return status is 0. Commands
290 separated by a ;\b; are executed sequentially; the shell waits for each
291 command to terminate in turn. The return status is the exit status of
292 the last command executed.
293
294 AND and OR lists are sequences of one of more pipelines separated by
295 the &\b&&\b& and |\b||\b| control operators, respectively. AND and OR lists are
296 executed with left associativity. An AND list has the form
297
298 _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b1 &\b&&\b& _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2
299
300 _\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
301 of zero.
302
303 An OR list has the form
304
305 _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b1 |\b||\b| _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\b2
306
307
308 _\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
309 status. The return status of AND and OR lists is the exit status of
310 the last command executed in the list.
311
312 C\bCo\bom\bmp\bpo\bou\bun\bnd\bd C\bCo\bom\bmm\bma\ban\bnd\bds\bs
313 A _\bc_\bo_\bm_\bp_\bo_\bu_\bn_\bd _\bc_\bo_\bm_\bm_\ba_\bn_\bd is one of the following:
314
315 (_\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-
316 T\bTI\bIO\bON\bN E\bEN\bNV\bVI\bIR\bRO\bON\bNM\bME\bEN\bNT\bT below). Variable assignments and builtin com-
317 mands that affect the shell's environment do not remain in
318 effect after the command completes. The return status is the
319 exit status of _\bl_\bi_\bs_\bt.
320
321 { _\bl_\bi_\bs_\bt; }
322 _\bl_\bi_\bs_\bt is simply executed in the current shell environment. _\bl_\bi_\bs_\bt
323 must be terminated with a newline or semicolon. This is known
324 as a _\bg_\br_\bo_\bu_\bp _\bc_\bo_\bm_\bm_\ba_\bn_\bd. The return status is the exit status of
325 _\bl_\bi_\bs_\bt. Note that unlike the metacharacters (\b( and )\b), {\b{ and }\b} are
326 _\br_\be_\bs_\be_\br_\bv_\be_\bd _\bw_\bo_\br_\bd_\bs and must occur where a reserved word is permitted
327 to be recognized. Since they do not cause a word break, they
328 must be separated from _\bl_\bi_\bs_\bt by whitespace or another shell
329 metacharacter.
330
331 ((_\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn))
332 The _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn is evaluated according to the rules described
333 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-
334 sion is non-zero, the return status is 0; otherwise the return
335 status is 1. This is exactly equivalent to l\ble\bet\bt "\b"_\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn"\b".
336
337 [\b[[\b[ _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn ]\b]]\b]
338 Return a status of 0 or 1 depending on the evaluation of the
339 conditional expression _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn. Expressions are composed of
340 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.
341 Word splitting and pathname expansion are not performed on the
342 words between the [\b[[\b[ and ]\b]]\b]; tilde expansion, parameter and
343 variable expansion, arithmetic expansion, command substitution,
344 process substitution, and quote removal are performed. Condi-
345 tional operators such as -\b-f\bf must be unquoted to be recognized as
346 primaries.
347
348 When used with [\b[[\b[, The <\b< and >\b> operators sort lexicographically
349 using the current locale.
350
351 When the =\b==\b= and !\b!=\b= operators are used, the string to the right
352 of the operator is considered a pattern and matched according to
353 the rules described below under P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg. If the shell
354 option n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh is enabled, the match is performed without
355 regard to the case of alphabetic characters. The return value
356 is 0 if the string matches (=\b==\b=) or does not match (!\b!=\b=) the pat-
357 tern, and 1 otherwise. Any part of the pattern may be quoted to
358 force it to be matched as a string.
359
360 An additional binary operator, =\b=~\b~, is available, with the same
361 precedence as =\b==\b= and !\b!=\b=. When it is used, the string to the
362 right of the operator is considered an extended regular expres-
363 sion and matched accordingly (as in _\br_\be_\bg_\be_\bx(3)). The return value
364 is 0 if the string matches the pattern, and 1 otherwise. If the
365 regular expression is syntactically incorrect, the conditional
366 expression's return value is 2. If the shell option n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh
367 is enabled, the match is performed without regard to the case of
368 alphabetic characters. Any part of the pattern may be quoted to
369 force it to be matched as a string. Substrings matched by
370 parenthesized subexpressions within the regular expression are
371 saved in the array variable B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH. The element of
372 B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH with index 0 is the portion of the string matching
373 the entire regular expression. The element of B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH with
374 index _\bn is the portion of the string matching the _\bnth parenthe-
375 sized subexpression.
376
377 Expressions may be combined using the following operators,
378 listed in decreasing order of precedence:
379
380 (\b( _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn )\b)
381 Returns the value of _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn. This may be used to
382 override the normal precedence of operators.
383 !\b! _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn
384 True if _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn is false.
385 _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b1 &\b&&\b& _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b2
386 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.
387 _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b1 |\b||\b| _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b2
388 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.
389
390 The &\b&&\b& and |\b||\b| operators do not evaluate _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b2 if the value
391 of _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\b1 is sufficient to determine the return value of
392 the entire conditional expression.
393
394 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
395 The list of words following i\bin\bn is expanded, generating a list of
396 items. The variable _\bn_\ba_\bm_\be is set to each element of this list in
397 turn, and _\bl_\bi_\bs_\bt is executed each time. If the i\bin\bn _\bw_\bo_\br_\bd is omit-
398 ted, the f\bfo\bor\br command executes _\bl_\bi_\bs_\bt once for each positional
399 parameter that is set (see P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS below). The return status
400 is the exit status of the last command that executes. If the
401 expansion of the items following i\bin\bn results in an empty list, no
402 commands are executed, and the return status is 0.
403
404 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
405 First, the arithmetic expression _\be_\bx_\bp_\br_\b1 is evaluated according to
406 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
407 arithmetic expression _\be_\bx_\bp_\br_\b2 is then evaluated repeatedly until
408 it evaluates to zero. Each time _\be_\bx_\bp_\br_\b2 evaluates to a non-zero
409 value, _\bl_\bi_\bs_\bt is executed and the arithmetic expression _\be_\bx_\bp_\br_\b3 is
410 evaluated. If any expression is omitted, it behaves as if it
411 evaluates to 1. The return value is the exit status of the last
412 command in _\bl_\bi_\bs_\bt that is executed, or false if any of the expres-
413 sions is invalid.
414
415 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
416 The list of words following i\bin\bn is expanded, generating a list of
417 items. The set of expanded words is printed on the standard
418 error, each preceded by a number. If the i\bin\bn _\bw_\bo_\br_\bd is omitted,
419 the positional parameters are printed (see P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS below).
420 The P\bPS\bS3\b3 prompt is then displayed and a line read from the stan-
421 dard input. If the line consists of a number corresponding to
422 one of the displayed words, then the value of _\bn_\ba_\bm_\be is set to
423 that word. If the line is empty, the words and prompt are dis-
424 played again. If EOF is read, the command completes. Any other
425 value read causes _\bn_\ba_\bm_\be to be set to null. The line read is
426 saved in the variable R\bRE\bEP\bPL\bLY\bY. The _\bl_\bi_\bs_\bt is executed after each
427 selection until a b\bbr\bre\bea\bak\bk command is executed. The exit status of
428 s\bse\bel\ble\bec\bct\bt is the exit status of the last command executed in _\bl_\bi_\bs_\bt,
429 or zero if no commands were executed.
430
431 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
432 A c\bca\bas\bse\be command first expands _\bw_\bo_\br_\bd, and tries to match it against
433 each _\bp_\ba_\bt_\bt_\be_\br_\bn in turn, using the same matching rules as for path-
434 name expansion (see P\bPa\bat\bth\bhn\bna\bam\bme\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn below). The _\bw_\bo_\br_\bd is
435 expanded using tilde expansion, parameter and variable expan-
436 sion, arithmetic substitution, command substitution, process
437 substitution and quote removal. Each _\bp_\ba_\bt_\bt_\be_\br_\bn examined is
438 expanded using tilde expansion, parameter and variable expan-
439 sion, arithmetic substitution, command substitution, and process
440 substitution. If the shell option n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh is enabled, the
441 match is performed without regard to the case of alphabetic
442 characters. When a match is found, the corresponding _\bl_\bi_\bs_\bt is
443 executed. If the ;\b;;\b; operator is used, no subsequent matches are
444 attempted after the first pattern match. Using ;\b;&\b& in place of
445 ;\b;;\b; causes execution to continue with the _\bl_\bi_\bs_\bt associated with
446 the next set of patterns. Using ;\b;;\b;&\b& in place of ;\b;;\b; causes the
447 shell to test the next pattern list in the statement, if any,
448 and execute any associated _\bl_\bi_\bs_\bt on a successful match. The exit
449 status is zero if no pattern matches. Otherwise, it is the exit
450 status of the last command executed in _\bl_\bi_\bs_\bt.
451
452 i\bif\bf _\bl_\bi_\bs_\bt; t\bth\bhe\ben\bn _\bl_\bi_\bs_\bt_\b; [ e\bel\bli\bif\bf _\bl_\bi_\bs_\bt; t\bth\bhe\ben\bn _\bl_\bi_\bs_\bt; ] ... [ e\bel\bls\bse\be _\bl_\bi_\bs_\bt; ] f\bfi\bi
453 The i\bif\bf _\bl_\bi_\bs_\bt is executed. If its exit status is zero, the t\bth\bhe\ben\bn
454 _\bl_\bi_\bs_\bt is executed. Otherwise, each e\bel\bli\bif\bf _\bl_\bi_\bs_\bt is executed in
455 turn, and if its exit status is zero, the corresponding t\bth\bhe\ben\bn
456 _\bl_\bi_\bs_\bt is executed and the command completes. Otherwise, the e\bel\bls\bse\be
457 _\bl_\bi_\bs_\bt is executed, if present. The exit status is the exit sta-
458 tus of the last command executed, or zero if no condition tested
459 true.
460
461 w\bwh\bhi\bil\ble\be _\bl_\bi_\bs_\bt; d\bdo\bo _\bl_\bi_\bs_\bt; d\bdo\bon\bne\be
462 u\bun\bnt\bti\bil\bl _\bl_\bi_\bs_\bt; d\bdo\bo _\bl_\bi_\bs_\bt; d\bdo\bon\bne\be
463 The w\bwh\bhi\bil\ble\be command continuously executes the d\bdo\bo _\bl_\bi_\bs_\bt as long as
464 the last command in _\bl_\bi_\bs_\bt returns an exit status of zero. The
465 u\bun\bnt\bti\bil\bl command is identical to the w\bwh\bhi\bil\ble\be command, except that the
466 test is negated; the d\bdo\bo _\bl_\bi_\bs_\bt is executed as long as the last
467 command in _\bl_\bi_\bs_\bt returns a non-zero exit status. The exit status
468 of the w\bwh\bhi\bil\ble\be and u\bun\bnt\bti\bil\bl commands is the exit status of the last
469 d\bdo\bo _\bl_\bi_\bs_\bt command executed, or zero if none was executed.
470
471 C\bCo\bop\bpr\bro\boc\bce\bes\bss\bse\bes\bs
472 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
473 coprocess is executed asynchronously in a subshell, as if the command
474 had been terminated with the &\b& control operator, with a two-way pipe
475 established between the executing shell and the coprocess.
476
477 The format for a coprocess is:
478
479 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]
480
481 This creates a coprocess named _\bN_\bA_\bM_\bE. If _\bN_\bA_\bM_\bE is not supplied, the
482 default name is _\bC_\bO_\bP_\bR_\bO_\bC. _\bN_\bA_\bM_\bE must not be supplied if _\bc_\bo_\bm_\bm_\ba_\bn_\bd is a _\bs_\bi_\bm_\b-
483 _\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd (see above); otherwise, it is interpreted as the first word
484 of the simple command. When the coproc is executed, the shell creates
485 an array variable (see A\bAr\brr\bra\bay\bys\bs below) named _\bN_\bA_\bM_\bE in the context of the
486 executing shell. The standard output of _\bc_\bo_\bm_\bm_\ba_\bn_\bd is connected via a
487 pipe to a file descriptor in the executing shell, and that file
488 descriptor is assigned to _\bN_\bA_\bM_\bE[0]. The standard input of _\bc_\bo_\bm_\bm_\ba_\bn_\bd is
489 connected via a pipe to a file descriptor in the executing shell, and
490 that file descriptor is assigned to _\bN_\bA_\bM_\bE[1]. This pipe is established
491 before any redirections specified by the command (see R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN
492 below). The file descriptors can be utilized as arguments to shell
493 commands and redirections using standard word expansions. The process
494 id of the shell spawned to execute the coprocess is available as the
495 value of the variable _\bN_\bA_\bM_\bE_PID. The w\bwa\bai\bit\bt builtin command may be used
496 to wait for the coprocess to terminate.
497
498 The return status of a coprocess is the exit status of _\bc_\bo_\bm_\bm_\ba_\bn_\bd.
499
500 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
501 A shell function is an object that is called like a simple command and
502 executes a compound command with a new set of positional parameters.
503 Shell functions are declared as follows:
504
505 [ 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]
506 This defines a function named _\bn_\ba_\bm_\be. The reserved word f\bfu\bun\bnc\bct\bti\bio\bon\bn
507 is optional. If the f\bfu\bun\bnc\bct\bti\bio\bon\bn reserved word is supplied, the
508 parentheses are optional. The _\bb_\bo_\bd_\by of the function is the com-
509 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).
510 That command is usually a _\bl_\bi_\bs_\bt of commands between { and }, but
511 may be any command listed under C\bCo\bom\bmp\bpo\bou\bun\bnd\bd C\bCo\bom\bmm\bma\ban\bnd\bds\bs above. _\bc_\bo_\bm_\b-
512 _\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
513 of a simple command. Any redirections (see R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN below)
514 specified when a function is defined are performed when the
515 function is executed. The exit status of a function definition
516 is zero unless a syntax error occurs or a readonly function with
517 the same name already exists. When executed, the exit status of
518 a function is the exit status of the last command executed in
519 the body. (See F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS below.)
520
521 C\bCO\bOM\bMM\bME\bEN\bNT\bTS\bS
522 In a non-interactive shell, or an interactive shell in which the i\bin\bnt\bte\ber\br-\b-
523 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
524 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
525 all remaining characters on that line to be ignored. An interactive
526 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
527 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-
528 tive shells.
529
530 Q\bQU\bUO\bOT\bTI\bIN\bNG\bG
531 _\bQ_\bu_\bo_\bt_\bi_\bn_\bg is used to remove the special meaning of certain characters or
532 words to the shell. Quoting can be used to disable special treatment
533 for special characters, to prevent reserved words from being recognized
534 as such, and to prevent parameter expansion.
535
536 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
537 meaning to the shell and must be quoted if it is to represent itself.
538
539 When the command history expansion facilities are being used (see H\bHI\bIS\bS-\b-
540 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
541 be quoted to prevent history expansion.
542
543 There are three quoting mechanisms: the _\be_\bs_\bc_\ba_\bp_\be _\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br, single
544 quotes, and double quotes.
545
546 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
547 literal value of the next character that follows, with the exception of
548 <newline>. If a \\b\<newline> pair appears, and the backslash is not
549 itself quoted, the \\b\<newline> is treated as a line continuation (that
550 is, it is removed from the input stream and effectively ignored).
551
552 Enclosing characters in single quotes preserves the literal value of
553 each character within the quotes. A single quote may not occur between
554 single quotes, even when preceded by a backslash.
555
556 Enclosing characters in double quotes preserves the literal value of
557 all characters within the quotes, with the exception of $\b$, `\b`, \\b\, and,
558 when history expansion is enabled, !\b!. The characters $\b$ and `\b` retain
559 their special meaning within double quotes. The backslash retains its
560 special meaning only when followed by one of the following characters:
561 $\b$, `\b`, "\b", \\b\, or <\b<n\bne\bew\bwl\bli\bin\bne\be>\b>. A double quote may be quoted within double
562 quotes by preceding it with a backslash. If enabled, history expansion
563 will be performed unless an !\b! appearing in double quotes is escaped
564 using a backslash. The backslash preceding the !\b! is not removed.
565
566 The special parameters *\b* and @\b@ have special meaning when in double
567 quotes (see P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS below).
568
569 Words of the form $\b$'_\bs_\bt_\br_\bi_\bn_\bg' are treated specially. The word expands to
570 _\bs_\bt_\br_\bi_\bn_\bg, with backslash-escaped characters replaced as specified by the
571 ANSI C standard. Backslash escape sequences, if present, are decoded
572 as follows:
573 \\b\a\ba alert (bell)
574 \\b\b\bb backspace
575 \\b\e\be
576 \\b\E\bE an escape character
577 \\b\f\bf form feed
578 \\b\n\bn new line
579 \\b\r\br carriage return
580 \\b\t\bt horizontal tab
581 \\b\v\bv vertical tab
582 \\b\\\b\ backslash
583 \\b\'\b' single quote
584 \\b\"\b" double quote
585 \\b\_\bn_\bn_\bn the eight-bit character whose value is the octal value
586 _\bn_\bn_\bn (one to three digits)
587 \\b\x\bx_\bH_\bH the eight-bit character whose value is the hexadecimal
588 value _\bH_\bH (one or two hex digits)
589 \\b\c\bc_\bx a control-_\bx character
590
591 The expanded result is single-quoted, as if the dollar sign had not
592 been present.
593
594 A double-quoted string preceded by a dollar sign ($\b$"_\bs_\bt_\br_\bi_\bn_\bg") will cause
595 the string to be translated according to the current locale. If the
596 current locale is C\bC or P\bPO\bOS\bSI\bIX\bX, the dollar sign is ignored. If the
597 string is translated and replaced, the replacement is double-quoted.
598
599 P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS
600 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-
601 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-
602 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
603 _\bv_\ba_\bl_\bu_\be and zero or more _\ba_\bt_\bt_\br_\bi_\bb_\bu_\bt_\be_\bs. Attributes are assigned using the
604 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).
605
606 A parameter is set if it has been assigned a value. The null string is
607 a valid value. Once a variable is set, it may be unset only by using
608 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).
609
610 A _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be may be assigned to by a statement of the form
611
612 _\bn_\ba_\bm_\be=[_\bv_\ba_\bl_\bu_\be]
613
614 If _\bv_\ba_\bl_\bu_\be is not given, the variable is assigned the null string. All
615 _\bv_\ba_\bl_\bu_\be_\bs undergo tilde expansion, parameter and variable expansion, com-
616 mand substitution, arithmetic expansion, and quote removal (see E\bEX\bXP\bPA\bAN\bN-\b-
617 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
618 is evaluated as an arithmetic expression even if the $((...)) expansion
619 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
620 performed, with the exception of "\b"$\b$@\b@"\b" as explained below under S\bSp\bpe\bec\bci\bia\bal\bl
621 P\bPa\bar\bra\bam\bme\bet\bte\ber\brs\bs. Pathname expansion is not performed. Assignment state-
622 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,
623 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.
624
625 In the context where an assignment statement is assigning a value to a
626 shell variable or array index, the += operator can be used to append to
627 or add to the variable's previous value. When += is applied to a vari-
628 able for which the integer attribute has been set, _\bv_\ba_\bl_\bu_\be is evaluated
629 as an arithmetic expression and added to the variable's current value,
630 which is also evaluated. When += is applied to an array variable using
631 compound assignment (see A\bAr\brr\bra\bay\bys\bs below), the variable's value is not
632 unset (as it is when using =), and new values are appended to the array
633 beginning at one greater than the array's maximum index (for indexed
634 arrays) or added as additional key-value pairs in an associative array.
635 When applied to a string-valued variable, _\bv_\ba_\bl_\bu_\be is expanded and
636 appended to the variable's value.
637
638 P\bPo\bos\bsi\bit\bti\bio\bon\bna\bal\bl P\bPa\bar\bra\bam\bme\bet\bte\ber\brs\bs
639 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,
640 other than the single digit 0. Positional parameters are assigned from
641 the shell's arguments when it is invoked, and may be reassigned using
642 the s\bse\bet\bt builtin command. Positional parameters may not be assigned to
643 with assignment statements. The positional parameters are temporarily
644 replaced when a shell function is executed (see F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS below).
645
646 When a positional parameter consisting of more than a single digit is
647 expanded, it must be enclosed in braces (see E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN below).
648
649 S\bSp\bpe\bec\bci\bia\bal\bl P\bPa\bar\bra\bam\bme\bet\bte\ber\brs\bs
650 The shell treats several parameters specially. These parameters may
651 only be referenced; assignment to them is not allowed.
652 *\b* Expands to the positional parameters, starting from one. When
653 the expansion occurs within double quotes, it expands to a sin-
654 gle word with the value of each parameter separated by the first
655 character of the I\bIF\bFS\bS special variable. That is, "$\b$*\b*" is equiva-
656 lent to "$\b$1\b1_\bc$\b$2\b2_\bc.\b..\b..\b.", where _\bc is the first character of the value
657 of the I\bIF\bFS\bS variable. If I\bIF\bFS\bS is unset, the parameters are sepa-
658 rated by spaces. If I\bIF\bFS\bS is null, the parameters are joined
659 without intervening separators.
660 @\b@ Expands to the positional parameters, starting from one. When
661 the expansion occurs within double quotes, each parameter
662 expands to a separate word. That is, "$\b$@\b@" is equivalent to "$\b$1\b1"
663 "$\b$2\b2" ... If the double-quoted expansion occurs within a word,
664 the expansion of the first parameter is joined with the begin-
665 ning part of the original word, and the expansion of the last
666 parameter is joined with the last part of the original word.
667 When there are no positional parameters, "$\b$@\b@" and $\b$@\b@ expand to
668 nothing (i.e., they are removed).
669 #\b# Expands to the number of positional parameters in decimal.
670 ?\b? Expands to the exit status of the most recently executed fore-
671 ground pipeline.
672 -\b- Expands to the current option flags as specified upon invoca-
673 tion, by the s\bse\bet\bt builtin command, or those set by the shell
674 itself (such as the -\b-i\bi option).
675 $\b$ Expands to the process ID of the shell. In a () subshell, it
676 expands to the process ID of the current shell, not the sub-
677 shell.
678 !\b! Expands to the process ID of the most recently executed back-
679 ground (asynchronous) command.
680 0\b0 Expands to the name of the shell or shell script. This is set
681 at shell initialization. If b\bba\bas\bsh\bh is invoked with a file of com-
682 mands, $\b$0\b0 is set to the name of that file. If b\bba\bas\bsh\bh is started
683 with the -\b-c\bc option, then $\b$0\b0 is set to the first argument after
684 the string to be executed, if one is present. Otherwise, it is
685 set to the file name used to invoke b\bba\bas\bsh\bh, as given by argument
686 zero.
687 _\b_ At shell startup, set to the absolute pathname used to invoke
688 the shell or shell script being executed as passed in the envi-
689 ronment or argument list. Subsequently, expands to the last
690 argument to the previous command, after expansion. Also set to
691 the full pathname used to invoke each command executed and
692 placed in the environment exported to that command. When check-
693 ing mail, this parameter holds the name of the mail file cur-
694 rently being checked.
695
696 S\bSh\bhe\bel\bll\bl V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs
697 The following variables are set by the shell:
698
699 B\bBA\bAS\bSH\bH Expands to the full file name used to invoke this instance of
700 b\bba\bas\bsh\bh.
701 B\bBA\bAS\bSH\bHO\bOP\bPT\bTS\bS
702 A colon-separated list of enabled shell options. Each word in
703 the list is a valid argument for the -\b-s\bs option to the s\bsh\bho\bop\bpt\bt
704 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
705 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
706 this variable is in the environment when b\bba\bas\bsh\bh starts up, each
707 shell option in the list will be enabled before reading any
708 startup files. This variable is read-only.
709 B\bBA\bAS\bSH\bHP\bPI\bID\bD
710 Expands to the process id of the current b\bba\bas\bsh\bh process. This
711 differs from $\b$$\b$ under certain circumstances, such as subshells
712 that do not require b\bba\bas\bsh\bh to be re-initialized.
713 B\bBA\bAS\bSH\bH_\b_A\bAL\bLI\bIA\bAS\bSE\bES\bS
714 An associative array variable whose members correspond to the
715 internal list of aliases as maintained by the a\bal\bli\bia\bas\bs builtin Ele-
716 ments added to this array appear in the alias list; unsetting
717 array elements cause aliases to be removed from the alias list.
718 B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGC\bC
719 An array variable whose values are the number of parameters in
720 each frame of the current b\bba\bas\bsh\bh execution call stack. The number
721 of parameters to the current subroutine (shell function or
722 script executed with .\b. or s\bso\bou\bur\brc\bce\be) is at the top of the stack.
723 When a subroutine is executed, the number of parameters passed
724 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
725 extended debugging mode (see the description of the e\bex\bxt\btd\bde\beb\bbu\bug\bg
726 option to the s\bsh\bho\bop\bpt\bt builtin below)
727 B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV
728 An array variable containing all of the parameters in the cur-
729 rent b\bba\bas\bsh\bh execution call stack. The final parameter of the last
730 subroutine call is at the top of the stack; the first parameter
731 of the initial call is at the bottom. When a subroutine is exe-
732 cuted, the parameters supplied are pushed onto B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV. The
733 shell sets B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV only when in extended debugging mode (see
734 the description of the e\bex\bxt\btd\bde\beb\bbu\bug\bg option to the s\bsh\bho\bop\bpt\bt builtin
735 below)
736 B\bBA\bAS\bSH\bH_\b_C\bCM\bMD\bDS\bS
737 An associative array variable whose members correspond to the
738 internal hash table of commands as maintained by the h\bha\bas\bsh\bh
739 builtin. Elements added to this array appear in the hash table;
740 unsetting array elements cause commands to be removed from the
741 hash table.
742 B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMM\bMA\bAN\bND\bD
743 The command currently being executed or about to be executed,
744 unless the shell is executing a command as the result of a trap,
745 in which case it is the command executing at the time of the
746 trap.
747 B\bBA\bAS\bSH\bH_\b_E\bEX\bXE\bEC\bCU\bUT\bTI\bIO\bON\bN_\b_S\bST\bTR\bRI\bIN\bNG\bG
748 The command argument to the -\b-c\bc invocation option.
749 B\bBA\bAS\bSH\bH_\b_L\bLI\bIN\bNE\bEN\bNO\bO
750 An array variable whose members are the line numbers in source
751 files corresponding to each member of F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE.
752 $\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 where
753 $\b${\b{F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE[\b[_\b$_\bi]\b]}\b} was called (or $\b${\b{B\bBA\bAS\bSH\bH_\b_L\bLI\bIN\bNE\bEN\bNO\bO[\b[_\b$_\bi_\b-_\b1]\b]}\b} if refer-
754 enced within another shell function). The corresponding source
755 file name is $\b${\b{B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE[\b[_\b$_\bi]\b]}\b}. Use L\bLI\bIN\bNE\bEN\bNO\bO to obtain the cur-
756 rent line number.
757 B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH
758 An array variable whose members are assigned by the =\b=~\b~ binary
759 operator to the [\b[[\b[ conditional command. The element with index
760 0 is the portion of the string matching the entire regular
761 expression. The element with index _\bn is the portion of the
762 string matching the _\bnth parenthesized subexpression. This vari-
763 able is read-only.
764 B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE
765 An array variable whose members are the source filenames corre-
766 sponding to the elements in the F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE array variable.
767 B\bBA\bAS\bSH\bH_\b_S\bSU\bUB\bBS\bSH\bHE\bEL\bLL\bL
768 Incremented by one each time a subshell or subshell environment
769 is spawned. The initial value is 0.
770 B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO
771 A readonly array variable whose members hold version information
772 for this instance of b\bba\bas\bsh\bh. The values assigned to the array
773 members are as follows:
774 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).
775 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).
776 B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO[\b[2]\b] The patch level.
777 B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO[\b[3]\b] The build version.
778 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).
779 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.
780
781 B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIO\bON\bN
782 Expands to a string describing the version of this instance of
783 b\bba\bas\bsh\bh.
784
785 C\bCO\bOM\bMP\bP_\b_C\bCW\bWO\bOR\bRD\bD
786 An index into $\b${\b{C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDS\bS}\b} of the word containing the current
787 cursor position. This variable is available only in shell func-
788 tions invoked by the programmable completion facilities (see
789 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).
790
791 C\bCO\bOM\bMP\bP_\b_K\bKE\bEY\bY
792 The key (or final key of a key sequence) used to invoke the cur-
793 rent completion function.
794
795 C\bCO\bOM\bMP\bP_\b_L\bLI\bIN\bNE\bE
796 The current command line. This variable is available only in
797 shell functions and external commands invoked by the pro-
798 grammable completion facilities (see P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn
799 below).
800
801 C\bCO\bOM\bMP\bP_\b_P\bPO\bOI\bIN\bNT\bT
802 The index of the current cursor position relative to the begin-
803 ning of the current command. If the current cursor position is
804 at the end of the current command, the value of this variable is
805 equal to $\b${\b{#\b#C\bCO\bOM\bMP\bP_\b_L\bLI\bIN\bNE\bE}\b}. This variable is available only in
806 shell functions and external commands invoked by the pro-
807 grammable completion facilities (see P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn
808 below).
809
810 C\bCO\bOM\bMP\bP_\b_T\bTY\bYP\bPE\bE
811 Set to an integer value corresponding to the type of completion
812 attempted that caused a completion function to be called: _\bT_\bA_\bB,
813 for normal completion, _\b?, for listing completions after succes-
814 sive tabs, _\b!, for listing alternatives on partial word comple-
815 tion, _\b@, to list completions if the word is not unmodified, or
816 _\b%, for menu completion. This variable is available only in
817 shell functions and external commands invoked by the pro-
818 grammable completion facilities (see P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn
819 below).
820
821 C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS
822 The set of characters that the r\bre\bea\bad\bdl\bli\bin\bne\be library treats as word
823 separators when performing word completion. If C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS
824 is unset, it loses its special properties, even if it is subse-
825 quently reset.
826
827 C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDS\bS
828 An array variable (see A\bAr\brr\bra\bay\bys\bs below) consisting of the individ-
829 ual words in the current command line. The line is split into
830 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
831 described above. This variable is available only in shell func-
832 tions invoked by the programmable completion facilities (see
833 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).
834
835 D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK
836 An array variable (see A\bAr\brr\bra\bay\bys\bs below) containing the current con-
837 tents of the directory stack. Directories appear in the stack
838 in the order they are displayed by the d\bdi\bir\brs\bs builtin. Assigning
839 to members of this array variable may be used to modify directo-
840 ries already in the stack, but the p\bpu\bus\bsh\bhd\bd and p\bpo\bop\bpd\bd builtins must
841 be used to add and remove directories. Assignment to this vari-
842 able will not change the current directory. If D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK is
843 unset, it loses its special properties, even if it is subse-
844 quently reset.
845
846 E\bEU\bUI\bID\bD Expands to the effective user ID of the current user, initial-
847 ized at shell startup. This variable is readonly.
848
849 F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE
850 An array variable containing the names of all shell functions
851 currently in the execution call stack. The element with index 0
852 is the name of any currently-executing shell function. The bot-
853 tom-most element is "main". This variable exists only when a
854 shell function is executing. Assignments to F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE have no
855 effect and return an error status. If F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE is unset, it
856 loses its special properties, even if it is subsequently reset.
857
858 G\bGR\bRO\bOU\bUP\bPS\bS An array variable containing the list of groups of which the
859 current user is a member. Assignments to G\bGR\bRO\bOU\bUP\bPS\bS have no effect
860 and return an error status. If G\bGR\bRO\bOU\bUP\bPS\bS is unset, it loses its
861 special properties, even if it is subsequently reset.
862
863 H\bHI\bIS\bST\bTC\bCM\bMD\bD
864 The history number, or index in the history list, of the current
865 command. If H\bHI\bIS\bST\bTC\bCM\bMD\bD is unset, it loses its special properties,
866 even if it is subsequently reset.
867
868 H\bHO\bOS\bST\bTN\bNA\bAM\bME\bE
869 Automatically set to the name of the current host.
870
871 H\bHO\bOS\bST\bTT\bTY\bYP\bPE\bE
872 Automatically set to a string that uniquely describes the type
873 of machine on which b\bba\bas\bsh\bh is executing. The default is system-
874 dependent.
875
876 L\bLI\bIN\bNE\bEN\bNO\bO Each time this parameter is referenced, the shell substitutes a
877 decimal number representing the current sequential line number
878 (starting with 1) within a script or function. When not in a
879 script or function, the value substituted is not guaranteed to
880 be meaningful. If L\bLI\bIN\bNE\bEN\bNO\bO is unset, it loses its special proper-
881 ties, even if it is subsequently reset.
882
883 M\bMA\bAC\bCH\bHT\bTY\bYP\bPE\bE
884 Automatically set to a string that fully describes the system
885 type on which b\bba\bas\bsh\bh is executing, in the standard GNU _\bc_\bp_\bu_\b-_\bc_\bo_\bm_\b-
886 _\bp_\ba_\bn_\by_\b-_\bs_\by_\bs_\bt_\be_\bm format. The default is system-dependent.
887
888 O\bOL\bLD\bDP\bPW\bWD\bD The previous working directory as set by the c\bcd\bd command.
889
890 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
891 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).
892
893 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
894 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).
895
896 O\bOS\bST\bTY\bYP\bPE\bE Automatically set to a string that describes the operating sys-
897 tem on which b\bba\bas\bsh\bh is executing. The default is system-depen-
898 dent.
899
900 P\bPI\bIP\bPE\bES\bST\bTA\bAT\bTU\bUS\bS
901 An array variable (see A\bAr\brr\bra\bay\bys\bs below) containing a list of exit
902 status values from the processes in the most-recently-executed
903 foreground pipeline (which may contain only a single command).
904
905 P\bPP\bPI\bID\bD The process ID of the shell's parent. This variable is read-
906 only.
907
908 P\bPW\bWD\bD The current working directory as set by the c\bcd\bd command.
909
910 R\bRA\bAN\bND\bDO\bOM\bM Each time this parameter is referenced, a random integer between
911 0 and 32767 is generated. The sequence of random numbers may be
912 initialized by assigning a value to R\bRA\bAN\bND\bDO\bOM\bM. If R\bRA\bAN\bND\bDO\bOM\bM is unset,
913 it loses its special properties, even if it is subsequently
914 reset.
915
916 R\bRE\bEP\bPL\bLY\bY Set to the line of input read by the r\bre\bea\bad\bd builtin command when
917 no arguments are supplied.
918
919 S\bSE\bEC\bCO\bON\bND\bDS\bS
920 Each time this parameter is referenced, the number of seconds
921 since shell invocation is returned. If a value is assigned to
922 S\bSE\bEC\bCO\bON\bND\bDS\bS, the value returned upon subsequent references is the
923 number of seconds since the assignment plus the value assigned.
924 If S\bSE\bEC\bCO\bON\bND\bDS\bS is unset, it loses its special properties, even if it
925 is subsequently reset.
926
927 S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS
928 A colon-separated list of enabled shell options. Each word in
929 the list is a valid argument for the -\b-o\bo option to the s\bse\bet\bt
930 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
931 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
932 this variable is in the environment when b\bba\bas\bsh\bh starts up, each
933 shell option in the list will be enabled before reading any
934 startup files. This variable is read-only.
935
936 S\bSH\bHL\bLV\bVL\bL Incremented by one each time an instance of b\bba\bas\bsh\bh is started.
937
938 U\bUI\bID\bD Expands to the user ID of the current user, initialized at shell
939 startup. This variable is readonly.
940
941 The following variables are used by the shell. In some cases, b\bba\bas\bsh\bh
942 assigns a default value to a variable; these cases are noted below.
943
944 B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV
945 If this parameter is set when b\bba\bas\bsh\bh is executing a shell script,
946 its value is interpreted as a filename containing commands to
947 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
948 subjected to parameter expansion, command substitution, and
949 arithmetic expansion before being interpreted as a file name.
950 P\bPA\bAT\bTH\bH is not used to search for the resultant file name.
951 C\bCD\bDP\bPA\bAT\bTH\bH The search path for the c\bcd\bd command. This is a colon-separated
952 list of directories in which the shell looks for destination
953 directories specified by the c\bcd\bd command. A sample value is
954 ".:~:/usr".
955 B\bBA\bAS\bSH\bH_\b_X\bXT\bTR\bRA\bAC\bCE\bEF\bFD\bD
956 If set to an integer corresponding to a valid file descriptor,
957 b\bba\bas\bsh\bh will write the trace output generated when _\bs_\be_\bt _\b-_\bx is
958 enabled to that file descriptor. The file descriptor is closed
959 when B\bBA\bAS\bSH\bH_\b_X\bXT\bTR\bRA\bAC\bCE\bEF\bFD\bD is unset or assigned a new value. Unsetting
960 B\bBA\bAS\bSH\bH_\b_X\bXT\bTR\bRA\bAC\bCE\bEF\bFD\bD or assigning it the empty string causes the trace
961 output to be sent to the standard error. Note that setting
962 B\bBA\bAS\bSH\bH_\b_X\bXT\bTR\bRA\bAC\bCE\bEF\bFD\bD to 2 (the standard error file descriptor) and then
963 unsetting it will result in the standard error being closed.
964 C\bCO\bOL\bLU\bUM\bMN\bNS\bS
965 Used by the s\bse\bel\ble\bec\bct\bt builtin command to determine the terminal
966 width when printing selection lists. Automatically set upon
967 receipt of a SIGWINCH.
968 C\bCO\bOM\bMP\bPR\bRE\bEP\bPL\bLY\bY
969 An array variable from which b\bba\bas\bsh\bh reads the possible completions
970 generated by a shell function invoked by the programmable com-
971 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).
972 E\bEM\bMA\bAC\bCS\bS If b\bba\bas\bsh\bh finds this variable in the environment when the shell
973 starts with value "t", it assumes that the shell is running in
974 an emacs shell buffer and disables line editing.
975 F\bFC\bCE\bED\bDI\bIT\bT The default editor for the f\bfc\bc builtin command.
976 F\bFI\bIG\bGN\bNO\bOR\bRE\bE
977 A colon-separated list of suffixes to ignore when performing
978 filename completion (see R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE below). A filename whose suf-
979 fix matches one of the entries in F\bFI\bIG\bGN\bNO\bOR\bRE\bE is excluded from the
980 list of matched filenames. A sample value is ".o:~".
981 G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE
982 A colon-separated list of patterns defining the set of filenames
983 to be ignored by pathname expansion. If a filename matched by a
984 pathname expansion pattern also matches one of the patterns in
985 G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE, it is removed from the list of matches.
986 H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL
987 A colon-separated list of values controlling how commands are
988 saved on the history list. If the list of values includes
989 _\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
990 saved in the history list. A value of _\bi_\bg_\bn_\bo_\br_\be_\bd_\bu_\bp_\bs causes lines
991 matching the previous history entry to not be saved. A value of
992 _\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
993 of _\be_\br_\ba_\bs_\be_\bd_\bu_\bp_\bs causes all previous lines matching the current line
994 to be removed from the history list before that line is saved.
995 Any value not in the above list is ignored. If H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL is
996 unset, or does not include a valid value, all lines read by the
997 shell parser are saved on the history list, subject to the value
998 of H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE. The second and subsequent lines of a multi-line
999 compound command are not tested, and are added to the history
1000 regardless of the value of H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL.
1001 H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE
1002 The name of the file in which command history is saved (see H\bHI\bIS\bS-\b-
1003 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,
1004 the command history is not saved when an interactive shell
1005 exits.
1006 H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bES\bSI\bIZ\bZE\bE
1007 The maximum number of lines contained in the history file. When
1008 this variable is assigned a value, the history file is trun-
1009 cated, if necessary, by removing the oldest entries, to contain
1010 no more than that number of lines. The default value is 500.
1011 The history file is also truncated to this size after writing it
1012 when an interactive shell exits.
1013 H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE
1014 A colon-separated list of patterns used to decide which command
1015 lines should be saved on the history list. Each pattern is
1016 anchored at the beginning of the line and must match the com-
1017 plete line (no implicit `*\b*' is appended). Each pattern is
1018 tested against the line after the checks specified by H\bHI\bIS\bST\bTC\bCO\bON\bN-\b-
1019 T\bTR\bRO\bOL\bL are applied. In addition to the normal shell pattern
1020 matching characters, `&\b&' matches the previous history line. `&\b&'
1021 may be escaped using a backslash; the backslash is removed
1022 before attempting a match. The second and subsequent lines of a
1023 multi-line compound command are not tested, and are added to the
1024 history regardless of the value of H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE.
1025 H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE
1026 The number of commands to remember in the command history (see
1027 H\bHI\bIS\bST\bTO\bOR\bRY\bY below). The default value is 500.
1028 H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT
1029 If this variable is set and not null, its value is used as a
1030 format string for _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be(3) to print the time stamp associated
1031 with each history entry displayed by the h\bhi\bis\bst\bto\bor\bry\by builtin. If
1032 this variable is set, time stamps are written to the history
1033 file so they may be preserved across shell sessions. This uses
1034 the history comment character to distinguish timestamps from
1035 other history lines.
1036 H\bHO\bOM\bME\bE The home directory of the current user; the default argument for
1037 the c\bcd\bd builtin command. The value of this variable is also used
1038 when performing tilde expansion.
1039 H\bHO\bOS\bST\bTF\bFI\bIL\bLE\bE
1040 Contains the name of a file in the same format as _\b/_\be_\bt_\bc_\b/_\bh_\bo_\bs_\bt_\bs
1041 that should be read when the shell needs to complete a hostname.
1042 The list of possible hostname completions may be changed while
1043 the shell is running; the next time hostname completion is
1044 attempted after the value is changed, b\bba\bas\bsh\bh adds the contents of
1045 the new file to the existing list. If H\bHO\bOS\bST\bTF\bFI\bIL\bLE\bE is set, but has
1046 no value, or does not name a readable file, b\bba\bas\bsh\bh attempts to
1047 read _\b/_\be_\bt_\bc_\b/_\bh_\bo_\bs_\bt_\bs to obtain the list of possible hostname comple-
1048 tions. When H\bHO\bOS\bST\bTF\bFI\bIL\bLE\bE is unset, the hostname list is cleared.
1049 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
1050 after expansion and to split lines into words with the r\bre\bea\bad\bd
1051 builtin command. The default value is ``<space><tab><new-
1052 line>''.
1053 I\bIG\bGN\bNO\bOR\bRE\bEE\bEO\bOF\bF
1054 Controls the action of an interactive shell on receipt of an E\bEO\bOF\bF
1055 character as the sole input. If set, the value is the number of
1056 consecutive E\bEO\bOF\bF characters which must be typed as the first
1057 characters on an input line before b\bba\bas\bsh\bh exits. If the variable
1058 exists but does not have a numeric value, or has no value, the
1059 default value is 10. If it does not exist, E\bEO\bOF\bF signifies the
1060 end of input to the shell.
1061 I\bIN\bNP\bPU\bUT\bTR\bRC\bC
1062 The filename for the r\bre\bea\bad\bdl\bli\bin\bne\be startup file, overriding the
1063 default of _\b~_\b/_\b._\bi_\bn_\bp_\bu_\bt_\br_\bc (see R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE below).
1064 L\bLA\bAN\bNG\bG Used to determine the locale category for any category not
1065 specifically selected with a variable starting with L\bLC\bC_\b_.
1066 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_
1067 variable specifying a locale category.
1068 L\bLC\bC_\b_C\bCO\bOL\bLL\bLA\bAT\bTE\bE
1069 This variable determines the collation order used when sorting
1070 the results of pathname expansion, and determines the behavior
1071 of range expressions, equivalence classes, and collating
1072 sequences within pathname expansion and pattern matching.
1073 L\bLC\bC_\b_C\bCT\bTY\bYP\bPE\bE
1074 This variable determines the interpretation of characters and
1075 the behavior of character classes within pathname expansion and
1076 pattern matching.
1077 L\bLC\bC_\b_M\bME\bES\bSS\bSA\bAG\bGE\bES\bS
1078 This variable determines the locale used to translate double-
1079 quoted strings preceded by a $\b$.
1080 L\bLC\bC_\b_N\bNU\bUM\bME\bER\bRI\bIC\bC
1081 This variable determines the locale category used for number
1082 formatting.
1083 L\bLI\bIN\bNE\bES\bS Used by the s\bse\bel\ble\bec\bct\bt builtin command to determine the column
1084 length for printing selection lists. Automatically set upon
1085 receipt of a S\bSI\bIG\bGW\bWI\bIN\bNC\bCH\bH.
1086 M\bMA\bAI\bIL\bL If this parameter is set to a file name and the M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH vari-
1087 able is not set, b\bba\bas\bsh\bh informs the user of the arrival of mail in
1088 the specified file.
1089 M\bMA\bAI\bIL\bLC\bCH\bHE\bEC\bCK\bK
1090 Specifies how often (in seconds) b\bba\bas\bsh\bh checks for mail. The
1091 default is 60 seconds. When it is time to check for mail, the
1092 shell does so before displaying the primary prompt. If this
1093 variable is unset, or set to a value that is not a number
1094 greater than or equal to zero, the shell disables mail checking.
1095 M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH
1096 A colon-separated list of file names to be checked for mail.
1097 The message to be printed when mail arrives in a particular file
1098 may be specified by separating the file name from the message
1099 with a `?'. When used in the text of the message, $\b$_\b_ expands to
1100 the name of the current mailfile. Example:
1101 M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH='/var/mail/bfox?"You have mail":~/shell-mail?"$_ has
1102 mail!"'
1103 B\bBa\bas\bsh\bh supplies a default value for this variable, but the loca-
1104 tion of the user mail files that it uses is system dependent
1105 (e.g., /var/mail/$\b$U\bUS\bSE\bER\bR).
1106 O\bOP\bPT\bTE\bER\bRR\bR If set to the value 1, b\bba\bas\bsh\bh displays error messages generated by
1107 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).
1108 O\bOP\bPT\bTE\bER\bRR\bR is initialized to 1 each time the shell is invoked or a
1109 shell script is executed.
1110 P\bPA\bAT\bTH\bH The search path for commands. It is a colon-separated list of
1111 directories in which the shell looks for commands (see C\bCO\bOM\bMM\bMA\bAN\bND\bD
1112 E\bEX\bXE\bEC\bCU\bUT\bTI\bIO\bON\bN below). A zero-length (null) directory name in the
1113 value of P\bPA\bAT\bTH\bH indicates the current directory. A null directory
1114 name may appear as two adjacent colons, or as an initial or
1115 trailing colon. The default path is system-dependent, and is
1116 set by the administrator who installs b\bba\bas\bsh\bh. A common value is
1117 ``/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin''.
1118 P\bPO\bOS\bSI\bIX\bXL\bLY\bY_\b_C\bCO\bOR\bRR\bRE\bEC\bCT\bT
1119 If this variable is in the environment when b\bba\bas\bsh\bh starts, the
1120 shell enters _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be before reading the startup files, as if
1121 the -\b--\b-p\bpo\bos\bsi\bix\bx invocation option had been supplied. If it is set
1122 while the shell is running, b\bba\bas\bsh\bh enables _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, as if the
1123 command _\bs_\be_\bt _\b-_\bo _\bp_\bo_\bs_\bi_\bx had been executed.
1124 P\bPR\bRO\bOM\bMP\bPT\bT_\b_C\bCO\bOM\bMM\bMA\bAN\bND\bD
1125 If set, the value is executed as a command prior to issuing each
1126 primary prompt.
1127 P\bPR\bRO\bOM\bMP\bPT\bT_\b_D\bDI\bIR\bRT\bTR\bRI\bIM\bM
1128 If set to a number greater than zero, the value is used as the
1129 number of trailing directory components to retain when expanding
1130 the \\b\w\bw and \\b\W\bW prompt string escapes (see P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG below).
1131 Characters removed are replaced with an ellipsis.
1132 P\bPS\bS1\b1 The value of this parameter is expanded (see P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG below)
1133 and used as the primary prompt string. The default value is
1134 ``\\b\s\bs-\b-\\b\v\bv\\b\$\b$ ''.
1135 P\bPS\bS2\b2 The value of this parameter is expanded as with P\bPS\bS1\b1 and used as
1136 the secondary prompt string. The default is ``>\b> ''.
1137 P\bPS\bS3\b3 The value of this parameter is used as the prompt for the s\bse\bel\ble\bec\bct\bt
1138 command (see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR above).
1139 P\bPS\bS4\b4 The value of this parameter is expanded as with P\bPS\bS1\b1 and the
1140 value is printed before each command b\bba\bas\bsh\bh displays during an
1141 execution trace. The first character of P\bPS\bS4\b4 is replicated mul-
1142 tiple times, as necessary, to indicate multiple levels of indi-
1143 rection. The default is ``+\b+ ''.
1144 S\bSH\bHE\bEL\bLL\bL The full pathname to the shell is kept in this environment vari-
1145 able. If it is not set when the shell starts, b\bba\bas\bsh\bh assigns to
1146 it the full pathname of the current user's login shell.
1147 T\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT
1148 The value of this parameter is used as a format string specify-
1149 ing how the timing information for pipelines prefixed with the
1150 t\bti\bim\bme\be reserved word should be displayed. The %\b% character intro-
1151 duces an escape sequence that is expanded to a time value or
1152 other information. The escape sequences and their meanings are
1153 as follows; the braces denote optional portions.
1154 %\b%%\b% A literal %\b%.
1155 %\b%[\b[_\bp]\b][\b[l\bl]\b]R\bR The elapsed time in seconds.
1156 %\b%[\b[_\bp]\b][\b[l\bl]\b]U\bU The number of CPU seconds spent in user mode.
1157 %\b%[\b[_\bp]\b][\b[l\bl]\b]S\bS The number of CPU seconds spent in system mode.
1158 %\b%P\bP The CPU percentage, computed as (%U + %S) / %R.
1159
1160 The optional _\bp is a digit specifying the _\bp_\br_\be_\bc_\bi_\bs_\bi_\bo_\bn, the number
1161 of fractional digits after a decimal point. A value of 0 causes
1162 no decimal point or fraction to be output. At most three places
1163 after the decimal point may be specified; values of _\bp greater
1164 than 3 are changed to 3. If _\bp is not specified, the value 3 is
1165 used.
1166
1167 The optional l\bl specifies a longer format, including minutes, of
1168 the form _\bM_\bMm_\bS_\bS._\bF_\bFs. The value of _\bp determines whether or not
1169 the fraction is included.
1170
1171 If this variable is not set, b\bba\bas\bsh\bh acts as if it had the value
1172 $\b$'\b'\\b\n\bnr\bre\bea\bal\bl\\b\t\bt%\b%3\b3l\blR\bR\\b\n\bnu\bus\bse\ber\br\\b\t\bt%\b%3\b3l\blU\bU\\b\n\bns\bsy\bys\bs%\b%3\b3l\blS\bS'\b'. If the value is null, no
1173 timing information is displayed. A trailing newline is added
1174 when the format string is displayed.
1175
1176 T\bTM\bMO\bOU\bUT\bT If set to a value greater than zero, T\bTM\bMO\bOU\bUT\bT is treated as the
1177 default timeout for the r\bre\bea\bad\bd builtin. The s\bse\bel\ble\bec\bct\bt command termi-
1178 nates if input does not arrive after T\bTM\bMO\bOU\bUT\bT seconds when input is
1179 coming from a terminal. In an interactive shell, the value is
1180 interpreted as the number of seconds to wait for input after
1181 issuing the primary prompt. B\bBa\bas\bsh\bh terminates after waiting for
1182 that number of seconds if input does not arrive.
1183
1184 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
1185 B\bBa\bas\bsh\bh creates temporary files for the shell's use.
1186
1187 a\bau\but\bto\bo_\b_r\bre\bes\bsu\bum\bme\be
1188 This variable controls how the shell interacts with the user and
1189 job control. If this variable is set, single word simple com-
1190 mands without redirections are treated as candidates for resump-
1191 tion of an existing stopped job. There is no ambiguity allowed;
1192 if there is more than one job beginning with the string typed,
1193 the job most recently accessed is selected. The _\bn_\ba_\bm_\be of a
1194 stopped job, in this context, is the command line used to start
1195 it. If set to the value _\be_\bx_\ba_\bc_\bt, the string supplied must match
1196 the name of a stopped job exactly; if set to _\bs_\bu_\bb_\bs_\bt_\br_\bi_\bn_\bg, the
1197 string supplied needs to match a substring of the name of a
1198 stopped job. The _\bs_\bu_\bb_\bs_\bt_\br_\bi_\bn_\bg value provides functionality analo-
1199 gous to the %\b%?\b? job identifier (see J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL below). If set
1200 to any other value, the supplied string must be a prefix of a
1201 stopped job's name; this provides functionality analogous to the
1202 %\b%_\bs_\bt_\br_\bi_\bn_\bg job identifier.
1203
1204 h\bhi\bis\bst\btc\bch\bha\bar\brs\bs
1205 The two or three characters which control history expansion and
1206 tokenization (see H\bHI\bIS\bST\bTO\bOR\bRY\bY E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN below). The first character
1207 is the _\bh_\bi_\bs_\bt_\bo_\br_\by _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn character, the character which signals
1208 the start of a history expansion, normally `!\b!'. The second
1209 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
1210 shorthand for re-running the previous command entered, substi-
1211 tuting one string for another in the command. The default is
1212 `^\b^'. The optional third character is the character which indi-
1213 cates that the remainder of the line is a comment when found as
1214 the first character of a word, normally `#\b#'. The history com-
1215 ment character causes history substitution to be skipped for the
1216 remaining words on the line. It does not necessarily cause the
1217 shell parser to treat the rest of the line as a comment.
1218
1219 A\bAr\brr\bra\bay\bys\bs
1220 B\bBa\bas\bsh\bh provides one-dimensional indexed and associative array variables.
1221 Any variable may be used as an indexed array; the d\bde\bec\bcl\bla\bar\bre\be builtin will
1222 explicitly declare an array. There is no maximum limit on the size of
1223 an array, nor any requirement that members be indexed or assigned con-
1224 tiguously. Indexed arrays are referenced using integers (including
1225 arithmetic expressions) and are zero-based; associative arrays are
1226 referenced using arbitrary strings.
1227
1228 An indexed array is created automatically if any variable is assigned
1229 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
1230 an arithmetic expression that must evaluate to a number greater than or
1231 equal to zero. To explicitly declare an indexed array, use d\bde\bec\bcl\bla\bar\bre\be -\b-a\ba
1232 _\bn_\ba_\bm_\be (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below). d\bde\bec\bcl\bla\bar\bre\be -\b-a\ba _\bn_\ba_\bm_\be[\b[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]\b] is
1233 also accepted; the _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt is ignored.
1234
1235 Associative arrays are created using d\bde\bec\bcl\bla\bar\bre\be -\b-A\bA _\bn_\ba_\bm_\be.
1236
1237 Attributes may be specified for an array variable using the d\bde\bec\bcl\bla\bar\bre\be and
1238 r\bre\bea\bad\bdo\bon\bnl\bly\by builtins. Each attribute applies to all members of an array.
1239
1240 Arrays are assigned to using compound assignments of the form
1241 _\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-
1242 _\bs_\bc_\br_\bi_\bp_\bt]=_\bs_\bt_\br_\bi_\bn_\bg. Indexed array assignments do not require the bracket
1243 and subscript. When assigning to indexed arrays, if the optional
1244 brackets and subscript are supplied, that index is assigned to; other-
1245 wise the index of the element assigned is the last index assigned to by
1246 the statement plus one. Indexing starts at zero.
1247
1248 When assigning to an associative array, the subscript is required.
1249
1250 This syntax is also accepted by the d\bde\bec\bcl\bla\bar\bre\be builtin. Individual array
1251 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
1252 introduced above.
1253
1254 Any element of an array may be referenced using ${_\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]}.
1255 The braces are required to avoid conflicts with pathname expansion. If
1256 _\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
1257 subscripts differ only when the word appears within double quotes. If
1258 the word is double-quoted, ${_\bn_\ba_\bm_\be[*]} expands to a single word with the
1259 value of each array member separated by the first character of the I\bIF\bFS\bS
1260 special variable, and ${_\bn_\ba_\bm_\be[@]} expands each element of _\bn_\ba_\bm_\be to a sep-
1261 arate word. When there are no array members, ${_\bn_\ba_\bm_\be[@]} expands to
1262 nothing. If the double-quoted expansion occurs within a word, the
1263 expansion of the first parameter is joined with the beginning part of
1264 the original word, and the expansion of the last parameter is joined
1265 with the last part of the original word. This is analogous to the
1266 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
1267 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-
1268 _\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-
1269 ments in the array. Referencing an array variable without a subscript
1270 is equivalent to referencing the array with a subscript of 0.
1271
1272 An array variable is considered set if a subscript has been assigned a
1273 value. The null string is a valid value.
1274
1275 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]
1276 destroys the array element at index _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt. Care must be taken to
1277 avoid unwanted side effects caused by pathname expansion. u\bun\bns\bse\bet\bt _\bn_\ba_\bm_\be,
1278 where _\bn_\ba_\bm_\be is an array, or u\bun\bns\bse\bet\bt _\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt], where _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt is *\b*
1279 or @\b@, removes the entire array.
1280
1281 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
1282 specify an indexed array and a -\b-A\bA option to specify an associative
1283 array. The r\bre\bea\bad\bd builtin accepts a -\b-a\ba option to assign a list of words
1284 read from the standard input to an array. The s\bse\bet\bt and d\bde\bec\bcl\bla\bar\bre\be builtins
1285 display array values in a way that allows them to be reused as assign-
1286 ments.
1287
1288 E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN
1289 Expansion is performed on the command line after it has been split into
1290 words. There are seven kinds of expansion performed: _\bb_\br_\ba_\bc_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn,
1291 _\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-
1292 _\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.
1293
1294 The order of expansions is: brace expansion, tilde expansion, parame-
1295 ter, variable and arithmetic expansion and command substitution (done
1296 in a left-to-right fashion), word splitting, and pathname expansion.
1297
1298 On systems that can support it, there is an additional expansion avail-
1299 able: _\bp_\br_\bo_\bc_\be_\bs_\bs _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\bt_\bi_\bo_\bn.
1300
1301 Only brace expansion, word splitting, and pathname expansion can change
1302 the number of words of the expansion; other expansions expand a single
1303 word to a single word. The only exceptions to this are the expansions
1304 of "$\b$@\b@" and "$\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).
1305
1306 B\bBr\bra\bac\bce\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
1307 _\bB_\br_\ba_\bc_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn is a mechanism by which arbitrary strings may be gener-
1308 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-
1309 names generated need not exist. Patterns to be brace expanded take the
1310 form of an optional _\bp_\br_\be_\ba_\bm_\bb_\bl_\be, followed by either a series of comma-sep-
1311 arated strings or a sequence expression between a pair of braces, fol-
1312 lowed by an optional _\bp_\bo_\bs_\bt_\bs_\bc_\br_\bi_\bp_\bt. The preamble is prefixed to each
1313 string contained within the braces, and the postscript is then appended
1314 to each resulting string, expanding left to right.
1315
1316 Brace expansions may be nested. The results of each expanded string
1317 are not sorted; left to right order is preserved. For example,
1318 a{\b{d,c,b}\b}e expands into `ade ace abe'.
1319
1320 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
1321 either integers or single characters, and _\bi_\bn_\bc_\br, an optional increment,
1322 is an integer. When integers are supplied, the expression expands to
1323 each number between _\bx and _\by, inclusive. Supplied integers may be pre-
1324 fixed with _\b0 to force each term to have the same width. When either _\bx
1325 or _\by begins with a zero, the shell attempts to force all generated
1326 terms to contain the same number of digits, zero-padding where neces-
1327 sary. When characters are supplied, the expression expands to each
1328 character lexicographically between _\bx and _\by, inclusive. Note that both
1329 _\bx and _\by must be of the same type. When the increment is supplied, it
1330 is used as the difference between each term. The default increment is
1331 1 or -1 as appropriate.
1332
1333 Brace expansion is performed before any other expansions, and any char-
1334 acters special to other expansions are preserved in the result. It is
1335 strictly textual. B\bBa\bas\bsh\bh does not apply any syntactic interpretation to
1336 the context of the expansion or the text between the braces.
1337
1338 A correctly-formed brace expansion must contain unquoted opening and
1339 closing braces, and at least one unquoted comma or a valid sequence
1340 expression. Any incorrectly formed brace expansion is left unchanged.
1341 A {\b{ or ,\b, may be quoted with a backslash to prevent its being considered
1342 part of a brace expression. To avoid conflicts with parameter expan-
1343 sion, the string $\b${\b{ is not considered eligible for brace expansion.
1344
1345 This construct is typically used as shorthand when the common prefix of
1346 the strings to be generated is longer than in the above example:
1347
1348 mkdir /usr/local/src/bash/{old,new,dist,bugs}
1349 or
1350 chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}
1351
1352 Brace expansion introduces a slight incompatibility with historical
1353 versions of s\bsh\bh. s\bsh\bh does not treat opening or closing braces specially
1354 when they appear as part of a word, and preserves them in the output.
1355 B\bBa\bas\bsh\bh removes braces from words as a consequence of brace expansion.
1356 For example, a word entered to s\bsh\bh as _\bf_\bi_\bl_\be_\b{_\b1_\b,_\b2_\b} appears identically in
1357 the output. The same word is output as _\bf_\bi_\bl_\be_\b1 _\bf_\bi_\bl_\be_\b2 after expansion by
1358 b\bba\bas\bsh\bh. If strict compatibility with s\bsh\bh is desired, start b\bba\bas\bsh\bh with the
1359 +\b+B\bB option or disable brace expansion with the +\b+B\bB option to the s\bse\bet\bt com-
1360 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).
1361
1362 T\bTi\bil\bld\bde\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
1363 If a word begins with an unquoted tilde character (`~\b~'), all of the
1364 characters preceding the first unquoted slash (or all characters, if
1365 there is no unquoted slash) are considered a _\bt_\bi_\bl_\bd_\be_\b-_\bp_\br_\be_\bf_\bi_\bx. If none of
1366 the characters in the tilde-prefix are quoted, the characters in the
1367 tilde-prefix following the tilde are treated as a possible _\bl_\bo_\bg_\bi_\bn _\bn_\ba_\bm_\be.
1368 If this login name is the null string, the tilde is replaced with the
1369 value of the shell parameter H\bHO\bOM\bME\bE. If H\bHO\bOM\bME\bE is unset, the home direc-
1370 tory of the user executing the shell is substituted instead. Other-
1371 wise, the tilde-prefix is replaced with the home directory associated
1372 with the specified login name.
1373
1374 If the tilde-prefix is a `~+', the value of the shell variable P\bPW\bWD\bD
1375 replaces the tilde-prefix. If the tilde-prefix is a `~-', the value of
1376 the shell variable O\bOL\bLD\bDP\bPW\bWD\bD, if it is set, is substituted. If the char-
1377 acters following the tilde in the tilde-prefix consist of a number _\bN,
1378 optionally prefixed by a `+' or a `-', the tilde-prefix is replaced
1379 with the corresponding element from the directory stack, as it would be
1380 displayed by the d\bdi\bir\brs\bs builtin invoked with the tilde-prefix as an argu-
1381 ment. If the characters following the tilde in the tilde-prefix con-
1382 sist of a number without a leading `+' or `-', `+' is assumed.
1383
1384 If the login name is invalid, or the tilde expansion fails, the word is
1385 unchanged.
1386
1387 Each variable assignment is checked for unquoted tilde-prefixes immedi-
1388 ately following a :\b: or the first =\b=. In these cases, tilde expansion is
1389 also performed. Consequently, one may use file names with tildes in
1390 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
1391 expanded value.
1392
1393 P\bPa\bar\bra\bam\bme\bet\bte\ber\br E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
1394 The `$\b$' character introduces parameter expansion, command substitution,
1395 or arithmetic expansion. The parameter name or symbol to be expanded
1396 may be enclosed in braces, which are optional but serve to protect the
1397 variable to be expanded from characters immediately following it which
1398 could be interpreted as part of the name.
1399
1400 When braces are used, the matching ending brace is the first `}\b}' not
1401 escaped by a backslash or within a quoted string, and not within an
1402 embedded arithmetic expansion, command substitution, or parameter
1403 expansion.
1404
1405 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br}
1406 The value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is substituted. The braces are required
1407 when _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is a positional parameter with more than one
1408 digit, or when _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is followed by a character which is not
1409 to be interpreted as part of its name.
1410
1411 If the first character of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an exclamation point (!\b!), a
1412 level of variable indirection is introduced. B\bBa\bas\bsh\bh uses the value of
1413 the variable formed from the rest of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br as the name of the vari-
1414 able; this variable is then expanded and that value is used in the rest
1415 of the substitution, rather than the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br itself. This
1416 is known as _\bi_\bn_\bd_\bi_\br_\be_\bc_\bt _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn. The exceptions to this are the expan-
1417 sions of ${!_\bp_\br_\be_\bf_\bi_\bx*} and ${!\b!_\bn_\ba_\bm_\be[_\b@]} described below. The exclamation
1418 point must immediately follow the left brace in order to introduce
1419 indirection.
1420
1421 In each of the cases below, _\bw_\bo_\br_\bd is subject to tilde expansion, parame-
1422 ter expansion, command substitution, and arithmetic expansion.
1423
1424 When not performing substring expansion, using the forms documented
1425 below, b\bba\bas\bsh\bh tests for a parameter that is unset or null. Omitting the
1426 colon results in a test only for a parameter that is unset.
1427
1428 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:-\b-_\bw_\bo_\br_\bd}
1429 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-
1430 sion of _\bw_\bo_\br_\bd is substituted. Otherwise, the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
1431 is substituted.
1432 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:=\b=_\bw_\bo_\br_\bd}
1433 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
1434 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-
1435 _\be_\bt_\be_\br is then substituted. Positional parameters and special
1436 parameters may not be assigned to in this way.
1437 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:?\b?_\bw_\bo_\br_\bd}
1438 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,
1439 the expansion of _\bw_\bo_\br_\bd (or a message to that effect if _\bw_\bo_\br_\bd is
1440 not present) is written to the standard error and the shell, if
1441 it is not interactive, exits. Otherwise, the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
1442 is substituted.
1443 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:+\b+_\bw_\bo_\br_\bd}
1444 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
1445 substituted, otherwise the expansion of _\bw_\bo_\br_\bd is substituted.
1446 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:_\bo_\bf_\bf_\bs_\be_\bt}
1447 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:_\bo_\bf_\bf_\bs_\be_\bt:\b:_\bl_\be_\bn_\bg_\bt_\bh}
1448 S\bSu\bub\bbs\bst\btr\bri\bin\bng\bg E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn.\b. Expands to up to _\bl_\be_\bn_\bg_\bt_\bh characters of
1449 _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br starting at the character specified by _\bo_\bf_\bf_\bs_\be_\bt. If
1450 _\bl_\be_\bn_\bg_\bt_\bh is omitted, expands to the substring of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br start-
1451 ing at the character specified by _\bo_\bf_\bf_\bs_\be_\bt. _\bl_\be_\bn_\bg_\bt_\bh and _\bo_\bf_\bf_\bs_\be_\bt are
1452 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).
1453 _\bl_\be_\bn_\bg_\bt_\bh must evaluate to a number greater than or equal to zero.
1454 If _\bo_\bf_\bf_\bs_\be_\bt evaluates to a number less than zero, the value is
1455 used as an offset from the end of the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. If
1456 _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@, the result is _\bl_\be_\bn_\bg_\bt_\bh positional parameters
1457 beginning at _\bo_\bf_\bf_\bs_\be_\bt. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an indexed array name sub-
1458 scripted by @ or *, the result is the _\bl_\be_\bn_\bg_\bt_\bh members of the
1459 array beginning with ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br[_\bo_\bf_\bf_\bs_\be_\bt]}. A negative _\bo_\bf_\bf_\bs_\be_\bt is
1460 taken relative to one greater than the maximum index of the
1461 specified array. Substring expansion applied to an associative
1462 array produces undefined results. Note that a negative offset
1463 must be separated from the colon by at least one space to avoid
1464 being confused with the :- expansion. Substring indexing is
1465 zero-based unless the positional parameters are used, in which
1466 case the indexing starts at 1 by default. If _\bo_\bf_\bf_\bs_\be_\bt is 0, and
1467 the positional parameters are used, $\b$0\b0 is prefixed to the list.
1468
1469 ${!\b!_\bp_\br_\be_\bf_\bi_\bx*\b*}
1470 ${!\b!_\bp_\br_\be_\bf_\bi_\bx@\b@}
1471 N\bNa\bam\bme\bes\bs m\bma\bat\btc\bch\bhi\bin\bng\bg p\bpr\bre\bef\bfi\bix\bx.\b. Expands to the names of variables whose
1472 names begin with _\bp_\br_\be_\bf_\bi_\bx, separated by the first character of the
1473 I\bIF\bFS\bS special variable. When _\b@ is used and the expansion appears
1474 within double quotes, each variable name expands to a separate
1475 word.
1476
1477 ${!\b!_\bn_\ba_\bm_\be[_\b@]}
1478 ${!\b!_\bn_\ba_\bm_\be[_\b*]}
1479 L\bLi\bis\bst\bt o\bof\bf a\bar\brr\bra\bay\by k\bke\bey\bys\bs.\b. If _\bn_\ba_\bm_\be is an array variable, expands to
1480 the list of array indices (keys) assigned in _\bn_\ba_\bm_\be. If _\bn_\ba_\bm_\be is
1481 not an array, expands to 0 if _\bn_\ba_\bm_\be is set and null otherwise.
1482 When _\b@ is used and the expansion appears within double quotes,
1483 each key expands to a separate word.
1484
1485 ${#\b#_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br}
1486 P\bPa\bar\bra\bam\bme\bet\bte\ber\br l\ble\ben\bng\bgt\bth\bh.\b. The length in characters of the value of
1487 _\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
1488 substituted is the number of positional parameters. If _\bp_\ba_\br_\ba_\bm_\be_\b-
1489 _\bt_\be_\br is an array name subscripted by *\b* or @\b@, the value substi-
1490 tuted is the number of elements in the array.
1491
1492 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br#\b#_\bw_\bo_\br_\bd}
1493 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br#\b##\b#_\bw_\bo_\br_\bd}
1494 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.\b. The _\bw_\bo_\br_\bd is expanded to produce
1495 a pattern just as in pathname expansion. If the pattern matches
1496 the beginning of the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br, then the result of the
1497 expansion is the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br with the shortest
1498 matching pattern (the ``#\b#'' case) or the longest matching pat-
1499 tern (the ``#\b##\b#'' case) deleted. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@ or *\b*, the
1500 pattern removal operation is applied to each positional parame-
1501 ter in turn, and the expansion is the resultant list. If _\bp_\ba_\br_\ba_\bm_\b-
1502 _\be_\bt_\be_\br is an array variable subscripted with @\b@ or *\b*, the pattern
1503 removal operation is applied to each member of the array in
1504 turn, and the expansion is the resultant list.
1505
1506 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br%\b%_\bw_\bo_\br_\bd}
1507 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br%\b%%\b%_\bw_\bo_\br_\bd}
1508 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.\b. The _\bw_\bo_\br_\bd is expanded to produce
1509 a pattern just as in pathname expansion. If the pattern matches
1510 a trailing portion of the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br, then the
1511 result of the expansion is the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br with
1512 the shortest matching pattern (the ``%\b%'' case) or the longest
1513 matching pattern (the ``%\b%%\b%'' case) deleted. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@
1514 or *\b*, the pattern removal operation is applied to each posi-
1515 tional parameter in turn, and the expansion is the resultant
1516 list. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an array variable subscripted with @\b@ or
1517 *\b*, the pattern removal operation is applied to each member of
1518 the array in turn, and the expansion is the resultant list.
1519
1520 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br/\b/_\bp_\ba_\bt_\bt_\be_\br_\bn/\b/_\bs_\bt_\br_\bi_\bn_\bg}
1521 P\bPa\bat\btt\bte\ber\brn\bn s\bsu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bn.\b. The _\bp_\ba_\bt_\bt_\be_\br_\bn is expanded to produce a pat-
1522 tern just as in pathname expansion. _\bP_\ba_\br_\ba_\bm_\be_\bt_\be_\br is expanded and
1523 the longest match of _\bp_\ba_\bt_\bt_\be_\br_\bn against its value is replaced with
1524 _\bs_\bt_\br_\bi_\bn_\bg. If _\bp_\ba_\bt_\bt_\be_\br_\bn begins with /\b/, all matches of _\bp_\ba_\bt_\bt_\be_\br_\bn are
1525 replaced with _\bs_\bt_\br_\bi_\bn_\bg. Normally only the first match is
1526 replaced. If _\bp_\ba_\bt_\bt_\be_\br_\bn begins with #\b#, it must match at the begin-
1527 ning of the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. If _\bp_\ba_\bt_\bt_\be_\br_\bn begins with
1528 %\b%, it must match at the end of the expanded value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br.
1529 If _\bs_\bt_\br_\bi_\bn_\bg is null, matches of _\bp_\ba_\bt_\bt_\be_\br_\bn are deleted and the /\b/ fol-
1530 lowing _\bp_\ba_\bt_\bt_\be_\br_\bn may be omitted. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@ or *\b*, the sub-
1531 stitution operation is applied to each positional parameter in
1532 turn, and the expansion is the resultant list. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is
1533 an array variable subscripted with @\b@ or *\b*, the substitution
1534 operation is applied to each member of the array in turn, and
1535 the expansion is the resultant list.
1536
1537 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br^\b^_\bp_\ba_\bt_\bt_\be_\br_\bn}
1538 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br^\b^^\b^_\bp_\ba_\bt_\bt_\be_\br_\bn}
1539 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br,\b,_\bp_\ba_\bt_\bt_\be_\br_\bn}
1540 ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br,\b,,\b,_\bp_\ba_\bt_\bt_\be_\br_\bn}
1541 C\bCa\bas\bse\be m\bmo\bod\bdi\bif\bfi\bic\bca\bat\bti\bio\bon\bn.\b. This expansion modifies the case of alpha-
1542 betic characters in _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. The _\bp_\ba_\bt_\bt_\be_\br_\bn is expanded to pro-
1543 duce a pattern just as in pathname expansion. The ^\b^ operator
1544 converts lowercase letters matching _\bp_\ba_\bt_\bt_\be_\br_\bn to uppercase; the ,\b,
1545 operator converts matching uppercase letters to lowercase. The
1546 ^\b^^\b^ and ,\b,,\b, expansions convert each matched character in the
1547 expanded value; the ^\b^ and ,\b, expansions match and convert only
1548 the first character in the expanded value.. If _\bp_\ba_\bt_\bt_\be_\br_\bn is omit-
1549 ted, it is treated like a ?\b?, which matches every character. If
1550 _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@ or *\b*, the case modification operation is applied
1551 to each positional parameter in turn, and the expansion is the
1552 resultant list. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an array variable subscripted
1553 with @\b@ or *\b*, the case modification operation is applied to each
1554 member of the array in turn, and the expansion is the resultant
1555 list.
1556
1557 C\bCo\bom\bmm\bma\ban\bnd\bd S\bSu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bn
1558 _\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-
1559 mand name. There are two forms:
1560
1561
1562 $\b$(\b(_\bc_\bo_\bm_\bm_\ba_\bn_\bd)\b)
1563 or
1564 `\b`_\bc_\bo_\bm_\bm_\ba_\bn_\bd`\b`
1565
1566 B\bBa\bas\bsh\bh performs the expansion by executing _\bc_\bo_\bm_\bm_\ba_\bn_\bd and replacing the com-
1567 mand substitution with the standard output of the command, with any
1568 trailing newlines deleted. Embedded newlines are not deleted, but they
1569 may be removed during word splitting. The command substitution $\b$(\b(c\bca\bat\bt
1570 _\bf_\bi_\bl_\be)\b) can be replaced by the equivalent but faster $\b$(\b(<\b< _\bf_\bi_\bl_\be)\b).
1571
1572 When the old-style backquote form of substitution is used, backslash
1573 retains its literal meaning except when followed by $\b$, `\b`, or \\b\. The
1574 first backquote not preceded by a backslash terminates the command sub-
1575 stitution. When using the $(_\bc_\bo_\bm_\bm_\ba_\bn_\bd) form, all characters between the
1576 parentheses make up the command; none are treated specially.
1577
1578 Command substitutions may be nested. To nest when using the backquoted
1579 form, escape the inner backquotes with backslashes.
1580
1581 If the substitution appears within double quotes, word splitting and
1582 pathname expansion are not performed on the results.
1583
1584 A\bAr\bri\bit\bth\bhm\bme\bet\bti\bic\bc E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
1585 Arithmetic expansion allows the evaluation of an arithmetic expression
1586 and the substitution of the result. The format for arithmetic expan-
1587 sion is:
1588
1589 $\b$(\b((\b(_\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn)\b))\b)
1590
1591 The _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn is treated as if it were within double quotes, but a
1592 double quote inside the parentheses is not treated specially. All
1593 tokens in the expression undergo parameter expansion, string expansion,
1594 command substitution, and quote removal. Arithmetic expansions may be
1595 nested.
1596
1597 The evaluation is performed according to the rules listed below under
1598 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
1599 indicating failure and no substitution occurs.
1600
1601 P\bPr\bro\boc\bce\bes\bss\bs S\bSu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bn
1602 _\bP_\br_\bo_\bc_\be_\bs_\bs _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\bt_\bi_\bo_\bn is supported on systems that support named pipes
1603 (_\bF_\bI_\bF_\bO_\bs) or the /\b/d\bde\bev\bv/\b/f\bfd\bd method of naming open files. It takes the form
1604 of <\b<(\b(_\bl_\bi_\bs_\bt)\b) or >\b>(\b(_\bl_\bi_\bs_\bt)\b). The process _\bl_\bi_\bs_\bt is run with its input or out-
1605 put connected to a _\bF_\bI_\bF_\bO or some file in /\b/d\bde\bev\bv/\b/f\bfd\bd. The name of this file
1606 is passed as an argument to the current command as the result of the
1607 expansion. If the >\b>(\b(_\bl_\bi_\bs_\bt)\b) form is used, writing to the file will pro-
1608 vide input for _\bl_\bi_\bs_\bt. If the <\b<(\b(_\bl_\bi_\bs_\bt)\b) form is used, the file passed as
1609 an argument should be read to obtain the output of _\bl_\bi_\bs_\bt.
1610
1611 When available, process substitution is performed simultaneously with
1612 parameter and variable expansion, command substitution, and arithmetic
1613 expansion.
1614
1615 W\bWo\bor\brd\bd S\bSp\bpl\bli\bit\btt\bti\bin\bng\bg
1616 The shell scans the results of parameter expansion, command substitu-
1617 tion, and arithmetic expansion that did not occur within double quotes
1618 for _\bw_\bo_\br_\bd _\bs_\bp_\bl_\bi_\bt_\bt_\bi_\bn_\bg.
1619
1620 The shell treats each character of I\bIF\bFS\bS as a delimiter, and splits the
1621 results of the other expansions into words on these characters. If I\bIF\bFS\bS
1622 is unset, or its value is exactly <\b<s\bsp\bpa\bac\bce\be>\b><\b<t\bta\bab\bb>\b><\b<n\bne\bew\bwl\bli\bin\bne\be>\b>, the default,
1623 then sequences of <\b<s\bsp\bpa\bac\bce\be>\b>, <\b<t\bta\bab\bb>\b>, and <\b<n\bne\bew\bwl\bli\bin\bne\be>\b> at the beginning and
1624 end of the results of the previous expansions are ignored, and any
1625 sequence of I\bIF\bFS\bS characters not at the beginning or end serves to
1626 delimit words. If I\bIF\bFS\bS has a value other than the default, then
1627 sequences of the whitespace characters s\bsp\bpa\bac\bce\be and t\bta\bab\bb are ignored at the
1628 beginning and end of the word, as long as the whitespace character is
1629 in the value of I\bIF\bFS\bS (an I\bIF\bFS\bS whitespace character). Any character in
1630 I\bIF\bFS\bS that is not I\bIF\bFS\bS whitespace, along with any adjacent I\bIF\bFS\bS whitespace
1631 characters, delimits a field. A sequence of I\bIF\bFS\bS whitespace characters
1632 is also treated as a delimiter. If the value of I\bIF\bFS\bS is null, no word
1633 splitting occurs.
1634
1635 Explicit null arguments ("\b""\b" or '\b''\b') are retained. Unquoted implicit
1636 null arguments, resulting from the expansion of parameters that have no
1637 values, are removed. If a parameter with no value is expanded within
1638 double quotes, a null argument results and is retained.
1639
1640 Note that if no expansion occurs, no splitting is performed.
1641
1642 P\bPa\bat\bth\bhn\bna\bam\bme\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
1643 After word splitting, unless the -\b-f\bf option has been set, b\bba\bas\bsh\bh scans
1644 each word for the characters *\b*, ?\b?, and [\b[. If one of these characters
1645 appears, then the word is regarded as a _\bp_\ba_\bt_\bt_\be_\br_\bn, and replaced with an
1646 alphabetically sorted list of file names matching the pattern. If no
1647 matching file names are found, and the shell option n\bnu\bul\bll\blg\bgl\blo\bob\bb is not
1648 enabled, the word is left unchanged. If the n\bnu\bul\bll\blg\bgl\blo\bob\bb option is set,
1649 and no matches are found, the word is removed. If the f\bfa\bai\bil\blg\bgl\blo\bob\bb shell
1650 option is set, and no matches are found, an error message is printed
1651 and the command is not executed. If the shell option n\bno\boc\bca\bas\bse\beg\bgl\blo\bob\bb is
1652 enabled, the match is performed without regard to the case of alpha-
1653 betic characters. When a pattern is used for pathname expansion, the
1654 character `\b``\b`.\b.'\b''\b' at the start of a name or immediately following a
1655 slash must be matched explicitly, unless the shell option d\bdo\bot\btg\bgl\blo\bob\bb is
1656 set. When matching a pathname, the slash character must always be
1657 matched explicitly. In other cases, the `\b``\b`.\b.'\b''\b' character is not
1658 treated specially. See the description of s\bsh\bho\bop\bpt\bt below under S\bSH\bHE\bEL\bLL\bL
1659 B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS for a description of the n\bno\boc\bca\bas\bse\beg\bgl\blo\bob\bb, n\bnu\bul\bll\blg\bgl\blo\bob\bb, f\bfa\bai\bil\bl-\b-
1660 g\bgl\blo\bob\bb, and d\bdo\bot\btg\bgl\blo\bob\bb shell options.
1661
1662 The G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE shell variable may be used to restrict the set of file
1663 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
1664 name that also matches one of the patterns in G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE is removed
1665 from the list of matches. The file names `\b``\b`.\b.'\b''\b' and `\b``\b`.\b..\b.'\b''\b' are always
1666 ignored when G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE is set and not null. However, setting G\bGL\bLO\bOB\bBI\bIG\bG-\b-
1667 N\bNO\bOR\bRE\bE to a non-null value has the effect of enabling the d\bdo\bot\btg\bgl\blo\bob\bb shell
1668 option, so all other file names beginning with a `\b``\b`.\b.'\b''\b' will match. To
1669 get the old behavior of ignoring file names beginning with a `\b``\b`.\b.'\b''\b',
1670 make `\b``\b`.\b.*\b*'\b''\b' one of the patterns in G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE. The d\bdo\bot\btg\bgl\blo\bob\bb option is
1671 disabled when G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE is unset.
1672
1673 P\bPa\bat\btt\bte\ber\brn\bn M\bMa\bat\btc\bch\bhi\bin\bng\bg
1674
1675 Any character that appears in a pattern, other than the special pattern
1676 characters described below, matches itself. The NUL character may not
1677 occur in a pattern. A backslash escapes the following character; the
1678 escaping backslash is discarded when matching. The special pattern
1679 characters must be quoted if they are to be matched literally.
1680
1681 The special pattern characters have the following meanings:
1682
1683 *\b* Matches any string, including the null string. When the g\bgl\blo\bob\bb-\b-
1684 s\bst\bta\bar\br shell option is enabled, and *\b* is used in a pathname expan-
1685 sion context, two adjacent *\b*s used as a single pattern will
1686 match all files and zero or more directories and subdirectories.
1687 If followed by a /\b/, two adjacent *\b*s will match only directories
1688 and subdirectories.
1689 ?\b? Matches any single character.
1690 [\b[.\b..\b..\b.]\b] Matches any one of the enclosed characters. A pair of charac-
1691 ters separated by a hyphen denotes a _\br_\ba_\bn_\bg_\be _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn; any char-
1692 acter that sorts between those two characters, inclusive, using
1693 the current locale's collating sequence and character set, is
1694 matched. If the first character following the [\b[ is a !\b! or a ^\b^
1695 then any character not enclosed is matched. The sorting order
1696 of characters in range expressions is determined by the current
1697 locale and the value of the L\bLC\bC_\b_C\bCO\bOL\bLL\bLA\bAT\bTE\bE shell variable, if set.
1698 A -\b- may be matched by including it as the first or last charac-
1699 ter in the set. A ]\b] may be matched by including it as the first
1700 character in the set.
1701
1702 Within [\b[ and ]\b], _\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br _\bc_\bl_\ba_\bs_\bs_\be_\bs can be specified using the
1703 syntax [\b[:\b:_\bc_\bl_\ba_\bs_\bs:\b:]\b], where _\bc_\bl_\ba_\bs_\bs is one of the following classes
1704 defined in the POSIX standard:
1705 a\bal\bln\bnu\bum\bm a\bal\blp\bph\bha\ba a\bas\bsc\bci\bii\bi b\bbl\bla\ban\bnk\bk c\bcn\bnt\btr\brl\bl d\bdi\big\bgi\bit\bt g\bgr\bra\bap\bph\bh l\blo\bow\bwe\ber\br p\bpr\bri\bin\bnt\bt p\bpu\bun\bnc\bct\bt
1706 s\bsp\bpa\bac\bce\be u\bup\bpp\bpe\ber\br w\bwo\bor\brd\bd x\bxd\bdi\big\bgi\bit\bt
1707 A character class matches any character belonging to that class.
1708 The w\bwo\bor\brd\bd character class matches letters, digits, and the char-
1709 acter _.
1710
1711 Within [\b[ and ]\b], an _\be_\bq_\bu_\bi_\bv_\ba_\bl_\be_\bn_\bc_\be _\bc_\bl_\ba_\bs_\bs can be specified using the
1712 syntax [\b[=\b=_\bc=\b=]\b], which matches all characters with the same colla-
1713 tion weight (as defined by the current locale) as the character
1714 _\bc.
1715
1716 Within [\b[ and ]\b], the syntax [\b[.\b._\bs_\by_\bm_\bb_\bo_\bl.\b.]\b] matches the collating sym-
1717 bol _\bs_\by_\bm_\bb_\bo_\bl.
1718
1719 If the e\bex\bxt\btg\bgl\blo\bob\bb shell option is enabled using the s\bsh\bho\bop\bpt\bt builtin, several
1720 extended pattern matching operators are recognized. In the following
1721 description, a _\bp_\ba_\bt_\bt_\be_\br_\bn_\b-_\bl_\bi_\bs_\bt is a list of one or more patterns separated
1722 by a |\b|. Composite patterns may be formed using one or more of the fol-
1723 lowing sub-patterns:
1724
1725 ?\b?(\b(_\bp_\ba_\bt_\bt_\be_\br_\bn_\b-_\bl_\bi_\bs_\bt)\b)
1726 Matches zero or one occurrence of the given patterns
1727 *\b*(\b(_\bp_\ba_\bt_\bt_\be_\br_\bn_\b-_\bl_\bi_\bs_\bt)\b)
1728 Matches zero or more occurrences of the given patterns
1729 +\b+(\b(_\bp_\ba_\bt_\bt_\be_\br_\bn_\b-_\bl_\bi_\bs_\bt)\b)
1730 Matches one or more occurrences of the given patterns
1731 @\b@(\b(_\bp_\ba_\bt_\bt_\be_\br_\bn_\b-_\bl_\bi_\bs_\bt)\b)
1732 Matches one of the given patterns
1733 !\b!(\b(_\bp_\ba_\bt_\bt_\be_\br_\bn_\b-_\bl_\bi_\bs_\bt)\b)
1734 Matches anything except one of the given patterns
1735
1736 Q\bQu\buo\bot\bte\be R\bRe\bem\bmo\bov\bva\bal\bl
1737 After the preceding expansions, all unquoted occurrences of the charac-
1738 ters \\b\, '\b', and "\b" that did not result from one of the above expansions
1739 are removed.
1740
1741 R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN
1742 Before a command is executed, its input and output may be _\br_\be_\bd_\bi_\br_\be_\bc_\bt_\be_\bd
1743 using a special notation interpreted by the shell. Redirection may
1744 also be used to open and close files for the current shell execution
1745 environment. The following redirection operators may precede or appear
1746 anywhere within a _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd or may follow a _\bc_\bo_\bm_\bm_\ba_\bn_\bd. Redirections
1747 are processed in the order they appear, from left to right.
1748
1749 Each redirection that may be preceded by a file descriptor number may
1750 instead be preceded by a word of the form {_\bv_\ba_\br_\bn_\ba_\bm_\be}. In this case, for
1751 each redirection operator except >&- and <&-, the shell will allocate a
1752 file descriptor greater than 10 and assign it to _\bv_\ba_\br_\bn_\ba_\bm_\be. If >&- or
1753 <&- is preceded by {_\bv_\ba_\br_\bn_\ba_\bm_\be}, the value of _\bv_\ba_\br_\bn_\ba_\bm_\be defines the file
1754 descriptor to close.
1755
1756 In the following descriptions, if the file descriptor number is omit-
1757 ted, and the first character of the redirection operator is <\b<, the re-
1758 direction refers to the standard input (file descriptor 0). If the
1759 first character of the redirection operator is >\b>, the redirection
1760 refers to the standard output (file descriptor 1).
1761
1762 The word following the redirection operator in the following descrip-
1763 tions, unless otherwise noted, is subjected to brace expansion, tilde
1764 expansion, parameter expansion, command substitution, arithmetic expan-
1765 sion, quote removal, pathname expansion, and word splitting. If it
1766 expands to more than one word, b\bba\bas\bsh\bh reports an error.
1767
1768 Note that the order of redirections is significant. For example, the
1769 command
1770
1771 ls >\b> dirlist 2>\b>&\b&1
1772
1773 directs both standard output and standard error to the file _\bd_\bi_\br_\bl_\bi_\bs_\bt,
1774 while the command
1775
1776 ls 2>\b>&\b&1 >\b> dirlist
1777
1778 directs only the standard output to file _\bd_\bi_\br_\bl_\bi_\bs_\bt, because the standard
1779 error was duplicated from the standard output before the standard out-
1780 put was redirected to _\bd_\bi_\br_\bl_\bi_\bs_\bt.
1781
1782 B\bBa\bas\bsh\bh handles several filenames specially when they are used in redirec-
1783 tions, as described in the following table:
1784
1785 /\b/d\bde\bev\bv/\b/f\bfd\bd/\b/_\bf_\bd
1786 If _\bf_\bd is a valid integer, file descriptor _\bf_\bd is dupli-
1787 cated.
1788 /\b/d\bde\bev\bv/\b/s\bst\btd\bdi\bin\bn
1789 File descriptor 0 is duplicated.
1790 /\b/d\bde\bev\bv/\b/s\bst\btd\bdo\bou\but\bt
1791 File descriptor 1 is duplicated.
1792 /\b/d\bde\bev\bv/\b/s\bst\btd\bde\ber\brr\br
1793 File descriptor 2 is duplicated.
1794 /\b/d\bde\bev\bv/\b/t\btc\bcp\bp/\b/_\bh_\bo_\bs_\bt/\b/_\bp_\bo_\br_\bt
1795 If _\bh_\bo_\bs_\bt is a valid hostname or Internet address, and _\bp_\bo_\br_\bt
1796 is an integer port number or service name, b\bba\bas\bsh\bh attempts
1797 to open a TCP connection to the corresponding socket.
1798 /\b/d\bde\bev\bv/\b/u\bud\bdp\bp/\b/_\bh_\bo_\bs_\bt/\b/_\bp_\bo_\br_\bt
1799 If _\bh_\bo_\bs_\bt is a valid hostname or Internet address, and _\bp_\bo_\br_\bt
1800 is an integer port number or service name, b\bba\bas\bsh\bh attempts
1801 to open a UDP connection to the corresponding socket.
1802
1803 A failure to open or create a file causes the redirection to fail.
1804
1805 Redirections using file descriptors greater than 9 should be used with
1806 care, as they may conflict with file descriptors the shell uses inter-
1807 nally.
1808
1809 R\bRe\bed\bdi\bir\bre\bec\bct\bti\bin\bng\bg I\bIn\bnp\bpu\but\bt
1810 Redirection of input causes the file whose name results from the expan-
1811 sion of _\bw_\bo_\br_\bd to be opened for reading on file descriptor _\bn, or the
1812 standard input (file descriptor 0) if _\bn is not specified.
1813
1814 The general format for redirecting input is:
1815
1816 [_\bn]<\b<_\bw_\bo_\br_\bd
1817
1818 R\bRe\bed\bdi\bir\bre\bec\bct\bti\bin\bng\bg O\bOu\but\btp\bpu\but\bt
1819 Redirection of output causes the file whose name results from the
1820 expansion of _\bw_\bo_\br_\bd to be opened for writing on file descriptor _\bn, or the
1821 standard output (file descriptor 1) if _\bn is not specified. If the file
1822 does not exist it is created; if it does exist it is truncated to zero
1823 size.
1824
1825 The general format for redirecting output is:
1826
1827 [_\bn]>\b>_\bw_\bo_\br_\bd
1828
1829 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
1830 builtin has been enabled, the redirection will fail if the file whose
1831 name results from the expansion of _\bw_\bo_\br_\bd exists and is a regular file.
1832 If the redirection operator is >\b>|\b|, or the redirection operator is >\b> and
1833 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-
1834 direction is attempted even if the file named by _\bw_\bo_\br_\bd exists.
1835
1836 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
1837 Redirection of output in this fashion causes the file whose name
1838 results from the expansion of _\bw_\bo_\br_\bd to be opened for appending on file
1839 descriptor _\bn, or the standard output (file descriptor 1) if _\bn is not
1840 specified. If the file does not exist it is created.
1841
1842 The general format for appending output is:
1843
1844 [_\bn]>\b>>\b>_\bw_\bo_\br_\bd
1845
1846
1847 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
1848 This construct allows both the standard output (file descriptor 1) and
1849 the standard error output (file descriptor 2) to be redirected to the
1850 file whose name is the expansion of _\bw_\bo_\br_\bd.
1851
1852 There are two formats for redirecting standard output and standard
1853 error:
1854
1855 &\b&>\b>_\bw_\bo_\br_\bd
1856 and
1857 >\b>&\b&_\bw_\bo_\br_\bd
1858
1859 Of the two forms, the first is preferred. This is semantically equiva-
1860 lent to
1861
1862 >\b>_\bw_\bo_\br_\bd 2>\b>&\b&1
1863
1864
1865 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
1866 This construct allows both the standard output (file descriptor 1) and
1867 the standard error output (file descriptor 2) to be appended to the
1868 file whose name is the expansion of _\bw_\bo_\br_\bd.
1869
1870 The format for appending standard output and standard error is:
1871
1872 &\b&>\b>>\b>_\bw_\bo_\br_\bd
1873
1874 This is semantically equivalent to
1875
1876 >\b>>\b>_\bw_\bo_\br_\bd 2>\b>&\b&1
1877
1878 H\bHe\ber\bre\be D\bDo\boc\bcu\bum\bme\ben\bnt\bts\bs
1879 This type of redirection instructs the shell to read input from the
1880 current source until a line containing only _\bd_\be_\bl_\bi_\bm_\bi_\bt_\be_\br (with no trailing
1881 blanks) is seen. All of the lines read up to that point are then used
1882 as the standard input for a command.
1883
1884 The format of here-documents is:
1885
1886 <\b<<\b<[-\b-]_\bw_\bo_\br_\bd
1887 _\bh_\be_\br_\be_\b-_\bd_\bo_\bc_\bu_\bm_\be_\bn_\bt
1888 _\bd_\be_\bl_\bi_\bm_\bi_\bt_\be_\br
1889
1890 No parameter expansion, command substitution, arithmetic expansion, or
1891 pathname expansion is performed on _\bw_\bo_\br_\bd. If any characters in _\bw_\bo_\br_\bd are
1892 quoted, the _\bd_\be_\bl_\bi_\bm_\bi_\bt_\be_\br is the result of quote removal on _\bw_\bo_\br_\bd, and the
1893 lines in the here-document are not expanded. If _\bw_\bo_\br_\bd is unquoted, all
1894 lines of the here-document are subjected to parameter expansion, com-
1895 mand substitution, and arithmetic expansion. In the latter case, the
1896 character sequence \\b\<\b<n\bne\bew\bwl\bli\bin\bne\be>\b> is ignored, and \\b\ must be used to quote
1897 the characters \\b\, $\b$, and `\b`.
1898
1899 If the redirection operator is <\b<<\b<-\b-, then all leading tab characters are
1900 stripped from input lines and the line containing _\bd_\be_\bl_\bi_\bm_\bi_\bt_\be_\br. This
1901 allows here-documents within shell scripts to be indented in a natural
1902 fashion.
1903
1904 H\bHe\ber\bre\be S\bSt\btr\bri\bin\bng\bgs\bs
1905 A variant of here documents, the format is:
1906
1907 <\b<<\b<<\b<_\bw_\bo_\br_\bd
1908
1909 The _\bw_\bo_\br_\bd is expanded and supplied to the command on its standard input.
1910
1911 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
1912 The redirection operator
1913
1914 [_\bn]<\b<&\b&_\bw_\bo_\br_\bd
1915
1916 is used to duplicate input file descriptors. If _\bw_\bo_\br_\bd expands to one or
1917 more digits, the file descriptor denoted by _\bn is made to be a copy of
1918 that file descriptor. If the digits in _\bw_\bo_\br_\bd do not specify a file
1919 descriptor open for input, a redirection error occurs. If _\bw_\bo_\br_\bd evalu-
1920 ates to -\b-, file descriptor _\bn is closed. If _\bn is not specified, the
1921 standard input (file descriptor 0) is used.
1922
1923 The operator
1924
1925 [_\bn]>\b>&\b&_\bw_\bo_\br_\bd
1926
1927 is used similarly to duplicate output file descriptors. If _\bn is not
1928 specified, the standard output (file descriptor 1) is used. If the
1929 digits in _\bw_\bo_\br_\bd do not specify a file descriptor open for output, a re-
1930 direction error occurs. As a special case, if _\bn is omitted, and _\bw_\bo_\br_\bd
1931 does not expand to one or more digits, the standard output and standard
1932 error are redirected as described previously.
1933
1934 M\bMo\bov\bvi\bin\bng\bg F\bFi\bil\ble\be D\bDe\bes\bsc\bcr\bri\bip\bpt\bto\bor\brs\bs
1935 The redirection operator
1936
1937 [_\bn]<\b<&\b&_\bd_\bi_\bg_\bi_\bt-\b-
1938
1939 moves the file descriptor _\bd_\bi_\bg_\bi_\bt to file descriptor _\bn, or the standard
1940 input (file descriptor 0) if _\bn is not specified. _\bd_\bi_\bg_\bi_\bt is closed after
1941 being duplicated to _\bn.
1942
1943 Similarly, the redirection operator
1944
1945 [_\bn]>\b>&\b&_\bd_\bi_\bg_\bi_\bt-\b-
1946
1947 moves the file descriptor _\bd_\bi_\bg_\bi_\bt to file descriptor _\bn, or the standard
1948 output (file descriptor 1) if _\bn is not specified.
1949
1950 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
1951 The redirection operator
1952
1953 [_\bn]<\b<>\b>_\bw_\bo_\br_\bd
1954
1955 causes the file whose name is the expansion of _\bw_\bo_\br_\bd to be opened for
1956 both reading and writing on file descriptor _\bn, or on file descriptor 0
1957 if _\bn is not specified. If the file does not exist, it is created.
1958
1959 A\bAL\bLI\bIA\bAS\bSE\bES\bS
1960 _\bA_\bl_\bi_\ba_\bs_\be_\bs allow a string to be substituted for a word when it is used as
1961 the first word of a simple command. The shell maintains a list of
1962 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
1963 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
1964 simple command, if unquoted, is checked to see if it has an alias. If
1965 so, that word is replaced by the text of the alias. The characters /\b/,
1966 $\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
1967 listed above may not appear in an alias name. The replacement text may
1968 contain any valid shell input, including shell metacharacters. The
1969 first word of the replacement text is tested for aliases, but a word
1970 that is identical to an alias being expanded is not expanded a second
1971 time. This means that one may alias l\bls\bs to l\bls\bs -\b-F\bF, for instance, and
1972 b\bba\bas\bsh\bh does not try to recursively expand the replacement text. If the
1973 last character of the alias value is a _\bb_\bl_\ba_\bn_\bk, then the next command
1974 word following the alias is also checked for alias expansion.
1975
1976 Aliases are created and listed with the a\bal\bli\bia\bas\bs command, and removed with
1977 the u\bun\bna\bal\bli\bia\bas\bs command.
1978
1979 There is no mechanism for using arguments in the replacement text. If
1980 arguments are needed, a shell function should be used (see F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS
1981 below).
1982
1983 Aliases are not expanded when the shell is not interactive, unless the
1984 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
1985 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).
1986
1987 The rules concerning the definition and use of aliases are somewhat
1988 confusing. B\bBa\bas\bsh\bh always reads at least one complete line of input
1989 before executing any of the commands on that line. Aliases are
1990 expanded when a command is read, not when it is executed. Therefore,
1991 an alias definition appearing on the same line as another command does
1992 not take effect until the next line of input is read. The commands
1993 following the alias definition on that line are not affected by the new
1994 alias. This behavior is also an issue when functions are executed.
1995 Aliases are expanded when a function definition is read, not when the
1996 function is executed, because a function definition is itself a com-
1997 pound command. As a consequence, aliases defined in a function are not
1998 available until after that function is executed. To be safe, always
1999 put alias definitions on a separate line, and do not use a\bal\bli\bia\bas\bs in com-
2000 pound commands.
2001
2002 For almost every purpose, aliases are superseded by shell functions.
2003
2004 F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS
2005 A shell function, defined as described above under S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR,
2006 stores a series of commands for later execution. When the name of a
2007 shell function is used as a simple command name, the list of commands
2008 associated with that function name is executed. Functions are executed
2009 in the context of the current shell; no new process is created to
2010 interpret them (contrast this with the execution of a shell script).
2011 When a function is executed, the arguments to the function become the
2012 positional parameters during its execution. The special parameter #\b# is
2013 updated to reflect the change. Special parameter 0 is unchanged. The
2014 first element of the F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE variable is set to the name of the func-
2015 tion while the function is executing.
2016
2017 All other aspects of the shell execution environment are identical
2018 between a function and its caller with these exceptions: the D\bDE\bEB\bBU\bUG\bG and
2019 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
2020 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
2021 given the t\btr\bra\bac\bce\be attribute (see the description of the d\bde\bec\bcl\bla\bar\bre\be builtin
2022 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
2023 builtin (in which case all functions inherit the D\bDE\bEB\bBU\bUG\bG and R\bRE\bET\bTU\bUR\bRN\bN
2024 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
2025 option has been enabled.
2026
2027 Variables local to the function may be declared with the l\blo\boc\bca\bal\bl builtin
2028 command. Ordinarily, variables and their values are shared between the
2029 function and its caller.
2030
2031 If the builtin command r\bre\bet\btu\bur\brn\bn is executed in a function, the function
2032 completes and execution resumes with the next command after the func-
2033 tion call. Any command associated with the R\bRE\bET\bTU\bUR\bRN\bN trap is executed
2034 before execution resumes. When a function completes, the values of the
2035 positional parameters and the special parameter #\b# are restored to the
2036 values they had prior to the function's execution.
2037
2038 Function names and definitions may be listed with the -\b-f\bf option to the
2039 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-
2040 s\bse\bet\bt will list the function names only (and optionally the source file
2041 and line number, if the e\bex\bxt\btd\bde\beb\bbu\bug\bg shell option is enabled). Functions
2042 may be exported so that subshells automatically have them defined with
2043 the -\b-f\bf option to the e\bex\bxp\bpo\bor\brt\bt builtin. A function definition may be
2044 deleted using the -\b-f\bf option to the u\bun\bns\bse\bet\bt builtin. Note that shell
2045 functions and variables with the same name may result in multiple iden-
2046 tically-named entries in the environment passed to the shell's chil-
2047 dren. Care should be taken in cases where this may cause a problem.
2048
2049 Functions may be recursive. No limit is imposed on the number of
2050 recursive calls.
2051
2052 A\bAR\bRI\bIT\bTH\bHM\bME\bET\bTI\bIC\bC E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN
2053 The shell allows arithmetic expressions to be evaluated, under certain
2054 circumstances (see the l\ble\bet\bt and d\bde\bec\bcl\bla\bar\bre\be builtin commands and A\bAr\bri\bit\bth\bhm\bme\bet\bti\bic\bc
2055 E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn). Evaluation is done in fixed-width integers with no check
2056 for overflow, though division by 0 is trapped and flagged as an error.
2057 The operators and their precedence, associativity, and values are the
2058 same as in the C language. The following list of operators is grouped
2059 into levels of equal-precedence operators. The levels are listed in
2060 order of decreasing precedence.
2061
2062 _\bi_\bd+\b++\b+ _\bi_\bd-\b--\b-
2063 variable post-increment and post-decrement
2064 +\b++\b+_\bi_\bd -\b--\b-_\bi_\bd
2065 variable pre-increment and pre-decrement
2066 -\b- +\b+ unary minus and plus
2067 !\b! ~\b~ logical and bitwise negation
2068 *\b**\b* exponentiation
2069 *\b* /\b/ %\b% multiplication, division, remainder
2070 +\b+ -\b- addition, subtraction
2071 <\b<<\b< >\b>>\b> left and right bitwise shifts
2072 <\b<=\b= >\b>=\b= <\b< >\b>
2073 comparison
2074 =\b==\b= !\b!=\b= equality and inequality
2075 &\b& bitwise AND
2076 ^\b^ bitwise exclusive OR
2077 |\b| bitwise OR
2078 &\b&&\b& logical AND
2079 |\b||\b| logical OR
2080 _\be_\bx_\bp_\br?\b?_\be_\bx_\bp_\br:\b:_\be_\bx_\bp_\br
2081 conditional operator
2082 =\b= *\b*=\b= /\b/=\b= %\b%=\b= +\b+=\b= -\b-=\b= <\b<<\b<=\b= >\b>>\b>=\b= &\b&=\b= ^\b^=\b= |\b|=\b=
2083 assignment
2084 _\be_\bx_\bp_\br_\b1 ,\b, _\be_\bx_\bp_\br_\b2
2085 comma
2086
2087 Shell variables are allowed as operands; parameter expansion is per-
2088 formed before the expression is evaluated. Within an expression, shell
2089 variables may also be referenced by name without using the parameter
2090 expansion syntax. A shell variable that is null or unset evaluates to
2091 0 when referenced by name without using the parameter expansion syntax.
2092 The value of a variable is evaluated as an arithmetic expression when
2093 it is referenced, or when a variable which has been given the _\bi_\bn_\bt_\be_\bg_\be_\br
2094 attribute using d\bde\bec\bcl\bla\bar\bre\be -\b-i\bi is assigned a value. A null value evaluates
2095 to 0. A shell variable need not have its integer attribute turned on
2096 to be used in an expression.
2097
2098 Constants with a leading 0 are interpreted as octal numbers. A leading
2099 0x or 0X denotes hexadecimal. Otherwise, numbers take the form
2100 [_\bb_\ba_\bs_\be_\b#]n, where _\bb_\ba_\bs_\be is a decimal number between 2 and 64 representing
2101 the arithmetic base, and _\bn is a number in that base. If _\bb_\ba_\bs_\be_\b# is omit-
2102 ted, then base 10 is used. The digits greater than 9 are represented
2103 by the lowercase letters, the uppercase letters, @, and _, in that
2104 order. If _\bb_\ba_\bs_\be is less than or equal to 36, lowercase and uppercase
2105 letters may be used interchangeably to represent numbers between 10 and
2106 35.
2107
2108 Operators are evaluated in order of precedence. Sub-expressions in
2109 parentheses are evaluated first and may override the precedence rules
2110 above.
2111
2112 C\bCO\bON\bND\bDI\bIT\bTI\bIO\bON\bNA\bAL\bL E\bEX\bXP\bPR\bRE\bES\bSS\bSI\bIO\bON\bNS\bS
2113 Conditional expressions are used by the [\b[[\b[ compound command and the
2114 t\bte\bes\bst\bt and [\b[ builtin commands to test file attributes and perform string
2115 and arithmetic comparisons. Expressions are formed from the following
2116 unary or binary primaries. If any _\bf_\bi_\bl_\be argument to one of the pri-
2117 maries is of the form _\b/_\bd_\be_\bv_\b/_\bf_\bd_\b/_\bn, then file descriptor _\bn is checked. If
2118 the _\bf_\bi_\bl_\be argument to one of the primaries is one of _\b/_\bd_\be_\bv_\b/_\bs_\bt_\bd_\bi_\bn,
2119 _\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,
2120 is checked.
2121
2122 Unless otherwise specified, primaries that operate on files follow sym-
2123 bolic links and operate on the target of the link, rather than the link
2124 itself.
2125
2126 When used with [\b[[\b[, The <\b< and >\b> operators sort lexicographically using
2127 the current locale.
2128
2129 -\b-a\ba _\bf_\bi_\bl_\be
2130 True if _\bf_\bi_\bl_\be exists.
2131 -\b-b\bb _\bf_\bi_\bl_\be
2132 True if _\bf_\bi_\bl_\be exists and is a block special file.
2133 -\b-c\bc _\bf_\bi_\bl_\be
2134 True if _\bf_\bi_\bl_\be exists and is a character special file.
2135 -\b-d\bd _\bf_\bi_\bl_\be
2136 True if _\bf_\bi_\bl_\be exists and is a directory.
2137 -\b-e\be _\bf_\bi_\bl_\be
2138 True if _\bf_\bi_\bl_\be exists.
2139 -\b-f\bf _\bf_\bi_\bl_\be
2140 True if _\bf_\bi_\bl_\be exists and is a regular file.
2141 -\b-g\bg _\bf_\bi_\bl_\be
2142 True if _\bf_\bi_\bl_\be exists and is set-group-id.
2143 -\b-h\bh _\bf_\bi_\bl_\be
2144 True if _\bf_\bi_\bl_\be exists and is a symbolic link.
2145 -\b-k\bk _\bf_\bi_\bl_\be
2146 True if _\bf_\bi_\bl_\be exists and its ``sticky'' bit is set.
2147 -\b-p\bp _\bf_\bi_\bl_\be
2148 True if _\bf_\bi_\bl_\be exists and is a named pipe (FIFO).
2149 -\b-r\br _\bf_\bi_\bl_\be
2150 True if _\bf_\bi_\bl_\be exists and is readable.
2151 -\b-s\bs _\bf_\bi_\bl_\be
2152 True if _\bf_\bi_\bl_\be exists and has a size greater than zero.
2153 -\b-t\bt _\bf_\bd True if file descriptor _\bf_\bd is open and refers to a terminal.
2154 -\b-u\bu _\bf_\bi_\bl_\be
2155 True if _\bf_\bi_\bl_\be exists and its set-user-id bit is set.
2156 -\b-w\bw _\bf_\bi_\bl_\be
2157 True if _\bf_\bi_\bl_\be exists and is writable.
2158 -\b-x\bx _\bf_\bi_\bl_\be
2159 True if _\bf_\bi_\bl_\be exists and is executable.
2160 -\b-O\bO _\bf_\bi_\bl_\be
2161 True if _\bf_\bi_\bl_\be exists and is owned by the effective user id.
2162 -\b-G\bG _\bf_\bi_\bl_\be
2163 True if _\bf_\bi_\bl_\be exists and is owned by the effective group id.
2164 -\b-L\bL _\bf_\bi_\bl_\be
2165 True if _\bf_\bi_\bl_\be exists and is a symbolic link.
2166 -\b-S\bS _\bf_\bi_\bl_\be
2167 True if _\bf_\bi_\bl_\be exists and is a socket.
2168 -\b-N\bN _\bf_\bi_\bl_\be
2169 True if _\bf_\bi_\bl_\be exists and has been modified since it was last
2170 read.
2171 _\bf_\bi_\bl_\be_\b1 -n\bnt\bt _\bf_\bi_\bl_\be_\b2
2172 True if _\bf_\bi_\bl_\be_\b1 is newer (according to modification date) than
2173 _\bf_\bi_\bl_\be_\b2, or if _\bf_\bi_\bl_\be_\b1 exists and _\bf_\bi_\bl_\be_\b2 does not.
2174 _\bf_\bi_\bl_\be_\b1 -o\bot\bt _\bf_\bi_\bl_\be_\b2
2175 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
2176 does not.
2177 _\bf_\bi_\bl_\be_\b1 -\b-e\bef\bf _\bf_\bi_\bl_\be_\b2
2178 True if _\bf_\bi_\bl_\be_\b1 and _\bf_\bi_\bl_\be_\b2 refer to the same device and inode num-
2179 bers.
2180 -\b-o\bo _\bo_\bp_\bt_\bn_\ba_\bm_\be
2181 True if shell option _\bo_\bp_\bt_\bn_\ba_\bm_\be is enabled. See the list of
2182 options under the description of the -\b-o\bo option to the s\bse\bet\bt
2183 builtin below.
2184 -\b-z\bz _\bs_\bt_\br_\bi_\bn_\bg
2185 True if the length of _\bs_\bt_\br_\bi_\bn_\bg is zero.
2186 _\bs_\bt_\br_\bi_\bn_\bg
2187 -\b-n\bn _\bs_\bt_\br_\bi_\bn_\bg
2188 True if the length of _\bs_\bt_\br_\bi_\bn_\bg is non-zero.
2189
2190 _\bs_\bt_\br_\bi_\bn_\bg_\b1 =\b==\b= _\bs_\bt_\br_\bi_\bn_\bg_\b2
2191 _\bs_\bt_\br_\bi_\bn_\bg_\b1 =\b= _\bs_\bt_\br_\bi_\bn_\bg_\b2
2192 True if the strings are equal. =\b= should be used with the t\bte\bes\bst\bt
2193 command for POSIX conformance.
2194
2195 _\bs_\bt_\br_\bi_\bn_\bg_\b1 !\b!=\b= _\bs_\bt_\br_\bi_\bn_\bg_\b2
2196 True if the strings are not equal.
2197
2198 _\bs_\bt_\br_\bi_\bn_\bg_\b1 <\b< _\bs_\bt_\br_\bi_\bn_\bg_\b2
2199 True if _\bs_\bt_\br_\bi_\bn_\bg_\b1 sorts before _\bs_\bt_\br_\bi_\bn_\bg_\b2 lexicographically.
2200
2201 _\bs_\bt_\br_\bi_\bn_\bg_\b1 >\b> _\bs_\bt_\br_\bi_\bn_\bg_\b2
2202 True if _\bs_\bt_\br_\bi_\bn_\bg_\b1 sorts after _\bs_\bt_\br_\bi_\bn_\bg_\b2 lexicographically.
2203
2204 _\ba_\br_\bg_\b1 O\bOP\bP _\ba_\br_\bg_\b2
2205 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
2206 binary operators return true if _\ba_\br_\bg_\b1 is equal to, not equal to,
2207 less than, less than or equal to, greater than, or greater than
2208 or equal to _\ba_\br_\bg_\b2, respectively. _\bA_\br_\bg_\b1 and _\ba_\br_\bg_\b2 may be positive
2209 or negative integers.
2210
2211 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
2212 When a simple command is executed, the shell performs the following
2213 expansions, assignments, and redirections, from left to right.
2214
2215 1. The words that the parser has marked as variable assignments
2216 (those preceding the command name) and redirections are saved
2217 for later processing.
2218
2219 2. The words that are not variable assignments or redirections are
2220 expanded. If any words remain after expansion, the first word
2221 is taken to be the name of the command and the remaining words
2222 are the arguments.
2223
2224 3. Redirections are performed as described above under R\bRE\bED\bDI\bIR\bRE\bEC\bCT\bTI\bIO\bON\bN.
2225
2226 4. The text after the =\b= in each variable assignment undergoes tilde
2227 expansion, parameter expansion, command substitution, arithmetic
2228 expansion, and quote removal before being assigned to the vari-
2229 able.
2230
2231 If no command name results, the variable assignments affect the current
2232 shell environment. Otherwise, the variables are added to the environ-
2233 ment of the executed command and do not affect the current shell envi-
2234 ronment. If any of the assignments attempts to assign a value to a
2235 readonly variable, an error occurs, and the command exits with a non-
2236 zero status.
2237
2238 If no command name results, redirections are performed, but do not
2239 affect the current shell environment. A redirection error causes the
2240 command to exit with a non-zero status.
2241
2242 If there is a command name left after expansion, execution proceeds as
2243 described below. Otherwise, the command exits. If one of the expan-
2244 sions contained a command substitution, the exit status of the command
2245 is the exit status of the last command substitution performed. If
2246 there were no command substitutions, the command exits with a status of
2247 zero.
2248
2249 C\bCO\bOM\bMM\bMA\bAN\bND\bD E\bEX\bXE\bEC\bCU\bUT\bTI\bIO\bON\bN
2250 After a command has been split into words, if it results in a simple
2251 command and an optional list of arguments, the following actions are
2252 taken.
2253
2254 If the command name contains no slashes, the shell attempts to locate
2255 it. If there exists a shell function by that name, that function is
2256 invoked as described above in F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS. If the name does not match a
2257 function, the shell searches for it in the list of shell builtins. If
2258 a match is found, that builtin is invoked.
2259
2260 If the name is neither a shell function nor a builtin, and contains no
2261 slashes, b\bba\bas\bsh\bh searches each element of the P\bPA\bAT\bTH\bH for a directory con-
2262 taining an executable file by that name. B\bBa\bas\bsh\bh uses a hash table to
2263 remember the full pathnames of executable files (see h\bha\bas\bsh\bh under S\bSH\bHE\bEL\bLL\bL
2264 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
2265 performed only if the command is not found in the hash table. If the
2266 search is unsuccessful, the shell searches for a defined shell function
2267 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
2268 with the original command and the original command's arguments as its
2269 arguments, and the function's exit status becomes the exit status of
2270 the shell. If that function is not defined, the shell prints an error
2271 message and returns an exit status of 127.
2272
2273 If the search is successful, or if the command name contains one or
2274 more slashes, the shell executes the named program in a separate execu-
2275 tion environment. Argument 0 is set to the name given, and the remain-
2276 ing arguments to the command are set to the arguments given, if any.
2277
2278 If this execution fails because the file is not in executable format,
2279 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
2280 file containing shell commands. A subshell is spawned to execute it.
2281 This subshell reinitializes itself, so that the effect is as if a new
2282 shell had been invoked to handle the script, with the exception that
2283 the locations of commands remembered by the parent (see h\bha\bas\bsh\bh below
2284 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.
2285
2286 If the program is a file beginning with #\b#!\b!, the remainder of the first
2287 line specifies an interpreter for the program. The shell executes the
2288 specified interpreter on operating systems that do not handle this exe-
2289 cutable format themselves. The arguments to the interpreter consist of
2290 a single optional argument following the interpreter name on the first
2291 line of the program, followed by the name of the program, followed by
2292 the command arguments, if any.
2293
2294 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
2295 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-
2296 ing:
2297
2298
2299 +\bo open files inherited by the shell at invocation, as modified by
2300 redirections supplied to the e\bex\bxe\bec\bc builtin
2301
2302 +\bo the current working directory as set by c\bcd\bd, p\bpu\bus\bsh\bhd\bd, or p\bpo\bop\bpd\bd, or
2303 inherited by the shell at invocation
2304
2305 +\bo the file creation mode mask as set by u\bum\bma\bas\bsk\bk or inherited from
2306 the shell's parent
2307
2308 +\bo current traps set by t\btr\bra\bap\bp
2309
2310 +\bo shell parameters that are set by variable assignment or with s\bse\bet\bt
2311 or inherited from the shell's parent in the environment
2312
2313 +\bo shell functions defined during execution or inherited from the
2314 shell's parent in the environment
2315
2316 +\bo options enabled at invocation (either by default or with com-
2317 mand-line arguments) or by s\bse\bet\bt
2318
2319 +\bo options enabled by s\bsh\bho\bop\bpt\bt
2320
2321 +\bo shell aliases defined with a\bal\bli\bia\bas\bs
2322
2323 +\bo various process IDs, including those of background jobs, the
2324 value of $\b$$\b$, and the value of P\bPP\bPI\bID\bD
2325
2326 When a simple command other than a builtin or shell function is to be
2327 executed, it is invoked in a separate execution environment that con-
2328 sists of the following. Unless otherwise noted, the values are inher-
2329 ited from the shell.
2330
2331
2332 +\bo the shell's open files, plus any modifications and additions
2333 specified by redirections to the command
2334
2335 +\bo the current working directory
2336
2337 +\bo the file creation mode mask
2338
2339 +\bo shell variables and functions marked for export, along with
2340 variables exported for the command, passed in the environment
2341
2342 +\bo traps caught by the shell are reset to the values inherited from
2343 the shell's parent, and traps ignored by the shell are ignored
2344
2345 A command invoked in this separate environment cannot affect the
2346 shell's execution environment.
2347
2348 Command substitution, commands grouped with parentheses, and asynchro-
2349 nous commands are invoked in a subshell environment that is a duplicate
2350 of the shell environment, except that traps caught by the shell are
2351 reset to the values that the shell inherited from its parent at invoca-
2352 tion. Builtin commands that are invoked as part of a pipeline are also
2353 executed in a subshell environment. Changes made to the subshell envi-
2354 ronment cannot affect the shell's execution environment.
2355
2356 Subshells spawned to execute command substitutions inherit the value of
2357 the -\b-e\be option from the parent shell. When not in posix mode, Bash
2358 clears the -\b-e\be option in such subshells.
2359
2360 If a command is followed by a &\b& and job control is not active, the
2361 default standard input for the command is the empty file _\b/_\bd_\be_\bv_\b/_\bn_\bu_\bl_\bl.
2362 Otherwise, the invoked command inherits the file descriptors of the
2363 calling shell as modified by redirections.
2364
2365 E\bEN\bNV\bVI\bIR\bRO\bON\bNM\bME\bEN\bNT\bT
2366 When a program is invoked it is given an array of strings called the
2367 _\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
2368 _\bn_\ba_\bm_\be=_\bv_\ba_\bl_\bu_\be.
2369
2370 The shell provides several ways to manipulate the environment. On
2371 invocation, the shell scans its own environment and creates a parameter
2372 for each name found, automatically marking it for _\be_\bx_\bp_\bo_\br_\bt to child pro-
2373 cesses. Executed commands inherit the environment. The e\bex\bxp\bpo\bor\brt\bt and
2374 d\bde\bec\bcl\bla\bar\bre\be -\b-x\bx commands allow parameters and functions to be added to and
2375 deleted from the environment. If the value of a parameter in the envi-
2376 ronment is modified, the new value becomes part of the environment,
2377 replacing the old. The environment inherited by any executed command
2378 consists of the shell's initial environment, whose values may be modi-
2379 fied in the shell, less any pairs removed by the u\bun\bns\bse\bet\bt command, plus
2380 any additions via the e\bex\bxp\bpo\bor\brt\bt and d\bde\bec\bcl\bla\bar\bre\be -\b-x\bx commands.
2381
2382 The environment for any _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd or function may be augmented
2383 temporarily by prefixing it with parameter assignments, as described
2384 above in P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS. These assignment statements affect only the envi-
2385 ronment seen by that command.
2386
2387 If the -\b-k\bk option is set (see the s\bse\bet\bt builtin command below), then _\ba_\bl_\bl
2388 parameter assignments are placed in the environment for a command, not
2389 just those that precede the command name.
2390
2391 When b\bba\bas\bsh\bh invokes an external command, the variable _\b_ is set to the
2392 full file name of the command and passed to that command in its envi-
2393 ronment.
2394
2395 E\bEX\bXI\bIT\bT S\bST\bTA\bAT\bTU\bUS\bS
2396 The exit status of an executed command is the value returned by the
2397 _\bw_\ba_\bi_\bt_\bp_\bi_\bd system call or equivalent function. Exit statuses fall between
2398 0 and 255, though, as explained below, the shell may use values above
2399 125 specially. Exit statuses from shell builtins and compound commands
2400 are also limited to this range. Under certain circumstances, the shell
2401 will use special values to indicate specific failure modes.
2402
2403 For the shell's purposes, a command which exits with a zero exit status
2404 has succeeded. An exit status of zero indicates success. A non-zero
2405 exit status indicates failure. When a command terminates on a fatal
2406 signal _\bN, b\bba\bas\bsh\bh uses the value of 128+_\bN as the exit status.
2407
2408 If a command is not found, the child process created to execute it
2409 returns a status of 127. If a command is found but is not executable,
2410 the return status is 126.
2411
2412 If a command fails because of an error during expansion or redirection,
2413 the exit status is greater than zero.
2414
2415 Shell builtin commands return a status of 0 (_\bt_\br_\bu_\be) if successful, and
2416 non-zero (_\bf_\ba_\bl_\bs_\be) if an error occurs while they execute. All builtins
2417 return an exit status of 2 to indicate incorrect usage.
2418
2419 B\bBa\bas\bsh\bh itself returns the exit status of the last command executed,
2420 unless a syntax error occurs, in which case it exits with a non-zero
2421 value. See also the e\bex\bxi\bit\bt builtin command below.
2422
2423 S\bSI\bIG\bGN\bNA\bAL\bLS\bS
2424 When b\bba\bas\bsh\bh is interactive, in the absence of any traps, it ignores
2425 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
2426 is caught and handled (so that the w\bwa\bai\bit\bt builtin is interruptible). In
2427 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
2428 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.
2429
2430 Non-builtin commands run by b\bba\bas\bsh\bh have signal handlers set to the values
2431 inherited by the shell from its parent. When job control is not in
2432 effect, asynchronous commands ignore S\bSI\bIG\bGI\bIN\bNT\bT and S\bSI\bIG\bGQ\bQU\bUI\bIT\bT in addition to
2433 these inherited handlers. Commands run as a result of command substi-
2434 tution ignore the keyboard-generated job control signals S\bSI\bIG\bGT\bTT\bTI\bIN\bN, S\bSI\bIG\bGT\bT-\b-
2435 T\bTO\bOU\bU, and S\bSI\bIG\bGT\bTS\bST\bTP\bP.
2436
2437 The shell exits by default upon receipt of a S\bSI\bIG\bGH\bHU\bUP\bP. Before exiting,
2438 an interactive shell resends the S\bSI\bIG\bGH\bHU\bUP\bP to all jobs, running or
2439 stopped. Stopped jobs are sent S\bSI\bIG\bGC\bCO\bON\bNT\bT to ensure that they receive the
2440 S\bSI\bIG\bGH\bHU\bUP\bP. To prevent the shell from sending the signal to a particular
2441 job, it should be removed from the jobs table with the d\bdi\bis\bso\bow\bwn\bn builtin
2442 (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
2443 using d\bdi\bis\bso\bow\bwn\bn -\b-h\bh.
2444
2445 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
2446 S\bSI\bIG\bGH\bHU\bUP\bP to all jobs when an interactive login shell exits.
2447
2448 If b\bba\bas\bsh\bh is waiting for a command to complete and receives a signal for
2449 which a trap has been set, the trap will not be executed until the com-
2450 mand completes. When b\bba\bas\bsh\bh is waiting for an asynchronous command via
2451 the w\bwa\bai\bit\bt builtin, the reception of a signal for which a trap has been
2452 set will cause the w\bwa\bai\bit\bt builtin to return immediately with an exit sta-
2453 tus greater than 128, immediately after which the trap is executed.
2454
2455 J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL
2456 _\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
2457 execution of processes and continue (_\br_\be_\bs_\bu_\bm_\be) their execution at a later
2458 point. A user typically employs this facility via an interactive
2459 interface supplied jointly by the operating system kernel's terminal
2460 driver and b\bba\bas\bsh\bh.
2461
2462 The shell associates a _\bj_\bo_\bb with each pipeline. It keeps a table of
2463 currently executing jobs, which may be listed with the j\bjo\bob\bbs\bs command.
2464 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
2465 line that looks like:
2466
2467 [1] 25647
2468
2469 indicating that this job is job number 1 and that the process ID of the
2470 last process in the pipeline associated with this job is 25647. All of
2471 the processes in a single pipeline are members of the same job. B\bBa\bas\bsh\bh
2472 uses the _\bj_\bo_\bb abstraction as the basis for job control.
2473
2474 To facilitate the implementation of the user interface to job control,
2475 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
2476 _\bg_\br_\bo_\bu_\bp _\bI_\bD. Members of this process group (processes whose process group
2477 ID is equal to the current terminal process group ID) receive keyboard-
2478 generated signals such as S\bSI\bIG\bGI\bIN\bNT\bT. These processes are said to be in
2479 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
2480 differs from the terminal's; such processes are immune to keyboard-gen-
2481 erated signals. Only foreground processes are allowed to read from or,
2482 if the user so specifies with stty tostop, write to the terminal.
2483 Background processes which attempt to read from (write to when stty
2484 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
2485 by the kernel's terminal driver, which, unless caught, suspends the
2486 process.
2487
2488 If the operating system on which b\bba\bas\bsh\bh is running supports job control,
2489 b\bba\bas\bsh\bh contains facilities to use it. Typing the _\bs_\bu_\bs_\bp_\be_\bn_\bd character (typ-
2490 ically ^\b^Z\bZ, Control-Z) while a process is running causes that process to
2491 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
2492 character (typically ^\b^Y\bY, Control-Y) causes the process to be stopped
2493 when it attempts to read input from the terminal, and control to be
2494 returned to b\bba\bas\bsh\bh. The user may then manipulate the state of this job,
2495 using the b\bbg\bg command to continue it in the background, the f\bfg\bg command
2496 to continue it in the foreground, or the k\bki\bil\bll\bl command to kill it. A ^\b^Z\bZ
2497 takes effect immediately, and has the additional side effect of causing
2498 pending output and typeahead to be discarded.
2499
2500 There are a number of ways to refer to a job in the shell. The charac-
2501 ter %\b% introduces a job specification (_\bj_\bo_\bb_\bs_\bp_\be_\bc). Job number _\bn may be
2502 referred to as %\b%n\bn. A job may also be referred to using a prefix of the
2503 name used to start it, or using a substring that appears in its command
2504 line. For example, %\b%c\bce\be refers to a stopped c\bce\be job. If a prefix
2505 matches more than one job, b\bba\bas\bsh\bh reports an error. Using %\b%?\b?c\bce\be, on the
2506 other hand, refers to any job containing the string c\bce\be in its command
2507 line. If the substring matches more than one job, b\bba\bas\bsh\bh reports an
2508 error. The symbols %\b%%\b% and %\b%+\b+ refer to the shell's notion of the _\bc_\bu_\br_\b-
2509 _\br_\be_\bn_\bt _\bj_\bo_\bb, which is the last job stopped while it was in the foreground
2510 or started in the background. The _\bp_\br_\be_\bv_\bi_\bo_\bu_\bs _\bj_\bo_\bb may be referenced using
2511 %\b%-\b-. If there is only a single job, %\b%+\b+ and %\b%-\b- can both be used to refer
2512 to that job. In output pertaining to jobs (e.g., the output of the
2513 j\bjo\bob\bbs\bs command), the current job is always flagged with a +\b+, and the pre-
2514 vious job with a -\b-. A single % (with no accompanying job specifica-
2515 tion) also refers to the current job.
2516
2517 Simply naming a job can be used to bring it into the foreground: %\b%1\b1 is
2518 a synonym for `\b``\b`f\bfg\bg %\b%1\b1'\b''\b', bringing job 1 from the background into the
2519 foreground. Similarly, `\b``\b`%\b%1\b1 &\b&'\b''\b' resumes job 1 in the background,
2520 equivalent to `\b``\b`b\bbg\bg %\b%1\b1'\b''\b'.
2521
2522 The shell learns immediately whenever a job changes state. Normally,
2523 b\bba\bas\bsh\bh waits until it is about to print a prompt before reporting changes
2524 in a job's status so as to not interrupt any other output. If the -\b-b\bb
2525 option to the s\bse\bet\bt builtin command is enabled, b\bba\bas\bsh\bh reports such changes
2526 immediately. Any trap on S\bSI\bIG\bGC\bCH\bHL\bLD\bD is executed for each child that
2527 exits.
2528
2529 If an attempt to exit b\bba\bas\bsh\bh is made while jobs are stopped (or, if the
2530 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-
2531 ning), the shell prints a warning message, and, if the c\bch\bhe\bec\bck\bkj\bjo\bob\bbs\bs option
2532 is enabled, lists the jobs and their statuses. The j\bjo\bob\bbs\bs command may
2533 then be used to inspect their status. If a second attempt to exit is
2534 made without an intervening command, the shell does not print another
2535 warning, and any stopped jobs are terminated.
2536
2537 P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG
2538 When executing interactively, b\bba\bas\bsh\bh displays the primary prompt P\bPS\bS1\b1 when
2539 it is ready to read a command, and the secondary prompt P\bPS\bS2\b2 when it
2540 needs more input to complete a command. B\bBa\bas\bsh\bh allows these prompt
2541 strings to be customized by inserting a number of backslash-escaped
2542 special characters that are decoded as follows:
2543 \\b\a\ba an ASCII bell character (07)
2544 \\b\d\bd the date in "Weekday Month Date" format (e.g., "Tue May
2545 26")
2546 \\b\D\bD{\b{_\bf_\bo_\br_\bm_\ba_\bt}\b}
2547 the _\bf_\bo_\br_\bm_\ba_\bt is passed to _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be(3) and the result is
2548 inserted into the prompt string; an empty _\bf_\bo_\br_\bm_\ba_\bt results
2549 in a locale-specific time representation. The braces are
2550 required
2551 \\b\e\be an ASCII escape character (033)
2552 \\b\h\bh the hostname up to the first `.'
2553 \\b\H\bH the hostname
2554 \\b\j\bj the number of jobs currently managed by the shell
2555 \\b\l\bl the basename of the shell's terminal device name
2556 \\b\n\bn newline
2557 \\b\r\br carriage return
2558 \\b\s\bs the name of the shell, the basename of $\b$0\b0 (the portion
2559 following the final slash)
2560 \\b\t\bt the current time in 24-hour HH:MM:SS format
2561 \\b\T\bT the current time in 12-hour HH:MM:SS format
2562 \\b\@\b@ the current time in 12-hour am/pm format
2563 \\b\A\bA the current time in 24-hour HH:MM format
2564 \\b\u\bu the username of the current user
2565 \\b\v\bv the version of b\bba\bas\bsh\bh (e.g., 2.00)
2566 \\b\V\bV the release of b\bba\bas\bsh\bh, version + patch level (e.g., 2.00.0)
2567 \\b\w\bw the current working directory, with $\b$H\bHO\bOM\bME\bE abbreviated
2568 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-
2569 able)
2570 \\b\W\bW the basename of the current working directory, with $\b$H\bHO\bOM\bME\bE
2571 abbreviated with a tilde
2572 \\b\!\b! the history number of this command
2573 \\b\#\b# the command number of this command
2574 \\b\$\b$ if the effective UID is 0, a #\b#, otherwise a $\b$
2575 \\b\_\bn_\bn_\bn the character corresponding to the octal number _\bn_\bn_\bn
2576 \\b\\\b\ a backslash
2577 \\b\[\b[ begin a sequence of non-printing characters, which could
2578 be used to embed a terminal control sequence into the
2579 prompt
2580 \\b\]\b] end a sequence of non-printing characters
2581
2582 The command number and the history number are usually different: the
2583 history number of a command is its position in the history list, which
2584 may include commands restored from the history file (see H\bHI\bIS\bST\bTO\bOR\bRY\bY
2585 below), while the command number is the position in the sequence of
2586 commands executed during the current shell session. After the string
2587 is decoded, it is expanded via parameter expansion, command substitu-
2588 tion, arithmetic expansion, and quote removal, subject to the value of
2589 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
2590 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).
2591
2592 R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE
2593 This is the library that handles reading input when using an interac-
2594 tive shell, unless the -\b--\b-n\bno\boe\bed\bdi\bit\bti\bin\bng\bg option is given at shell invocation.
2595 Line editing is also used when using the -\b-e\be option to the r\bre\bea\bad\bd builtin.
2596 By default, the line editing commands are similar to those of emacs. A
2597 vi-style line editing interface is also available. Line editing can be
2598 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
2599 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
2600 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
2601 s\bse\bet\bt builtin.
2602
2603 R\bRe\bea\bad\bdl\bli\bin\bne\be N\bNo\bot\bta\bat\bti\bio\bon\bn
2604 In this section, the emacs-style notation is used to denote keystrokes.
2605 Control keys are denoted by C-_\bk_\be_\by, e.g., C-n means Control-N. Simi-
2606 larly, _\bm_\be_\bt_\ba keys are denoted by M-_\bk_\be_\by, so M-x means Meta-X. (On key-
2607 boards without a _\bm_\be_\bt_\ba key, M-_\bx means ESC _\bx, i.e., press the Escape key
2608 then the _\bx key. This makes ESC the _\bm_\be_\bt_\ba _\bp_\br_\be_\bf_\bi_\bx. The combination M-C-_\bx
2609 means ESC-Control-_\bx, or press the Escape key then hold the Control key
2610 while pressing the _\bx key.)
2611
2612 Readline commands may be given numeric _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs, which normally act as
2613 a repeat count. Sometimes, however, it is the sign of the argument
2614 that is significant. Passing a negative argument to a command that
2615 acts in the forward direction (e.g., k\bki\bil\bll\bl-\b-l\bli\bin\bne\be) causes that command to
2616 act in a backward direction. Commands whose behavior with arguments
2617 deviates from this are noted below.
2618
2619 When a command is described as _\bk_\bi_\bl_\bl_\bi_\bn_\bg text, the text deleted is saved
2620 for possible future retrieval (_\by_\ba_\bn_\bk_\bi_\bn_\bg). The killed text is saved in a
2621 _\bk_\bi_\bl_\bl _\br_\bi_\bn_\bg. Consecutive kills cause the text to be accumulated into one
2622 unit, which can be yanked all at once. Commands which do not kill text
2623 separate the chunks of text on the kill ring.
2624
2625 R\bRe\bea\bad\bdl\bli\bin\bne\be I\bIn\bni\bit\bti\bia\bal\bli\biz\bza\bat\bti\bio\bon\bn
2626 Readline is customized by putting commands in an initialization file
2627 (the _\bi_\bn_\bp_\bu_\bt_\br_\bc file). The name of this file is taken from the value of
2628 the I\bIN\bNP\bPU\bUT\bTR\bRC\bC variable. If that variable is unset, the default is
2629 _\b~_\b/_\b._\bi_\bn_\bp_\bu_\bt_\br_\bc. When a program which uses the readline library starts up,
2630 the initialization file is read, and the key bindings and variables are
2631 set. There are only a few basic constructs allowed in the readline
2632 initialization file. Blank lines are ignored. Lines beginning with a
2633 #\b# are comments. Lines beginning with a $\b$ indicate conditional con-
2634 structs. Other lines denote key bindings and variable settings.
2635
2636 The default key-bindings may be changed with an _\bi_\bn_\bp_\bu_\bt_\br_\bc file. Other
2637 programs that use this library may add their own commands and bindings.
2638
2639 For example, placing
2640
2641 M-Control-u: universal-argument
2642 or
2643 C-Meta-u: universal-argument
2644 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-
2645 _\bs_\ba_\bl_\b-_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt.
2646
2647 The following symbolic character names are recognized: _\bR_\bU_\bB_\bO_\bU_\bT, _\bD_\bE_\bL,
2648 _\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.
2649
2650 In addition to command names, readline allows keys to be bound to a
2651 string that is inserted when the key is pressed (a _\bm_\ba_\bc_\br_\bo).
2652
2653 R\bRe\bea\bad\bdl\bli\bin\bne\be K\bKe\bey\by B\bBi\bin\bnd\bdi\bin\bng\bgs\bs
2654 The syntax for controlling key bindings in the _\bi_\bn_\bp_\bu_\bt_\br_\bc file is simple.
2655 All that is required is the name of the command or the text of a macro
2656 and a key sequence to which it should be bound. The name may be speci-
2657 fied in one of two ways: as a symbolic key name, possibly with _\bM_\be_\bt_\ba_\b- or
2658 _\bC_\bo_\bn_\bt_\br_\bo_\bl_\b- prefixes, or as a key sequence.
2659
2660 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
2661 of a key spelled out in English. For example:
2662
2663 Control-u: universal-argument
2664 Meta-Rubout: backward-kill-word
2665 Control-o: "> output"
2666
2667 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,
2668 _\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
2669 run the macro expressed on the right hand side (that is, to insert the
2670 text ``> output'' into the line).
2671
2672 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
2673 from k\bke\bey\byn\bna\bam\bme\be above in that strings denoting an entire key sequence may
2674 be specified by placing the sequence within double quotes. Some GNU
2675 Emacs style key escapes can be used, as in the following example, but
2676 the symbolic character names are not recognized.
2677
2678 "\C-u": universal-argument
2679 "\C-x\C-r": re-read-init-file
2680 "\e[11~": "Function Key 1"
2681
2682 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.
2683 _\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
2684 bound to insert the text ``Function Key 1''.
2685
2686 The full set of GNU Emacs style escape sequences is
2687 \\b\C\bC-\b- control prefix
2688 \\b\M\bM-\b- meta prefix
2689 \\b\e\be an escape character
2690 \\b\\\b\ backslash
2691 \\b\"\b" literal "
2692 \\b\'\b' literal '
2693
2694 In addition to the GNU Emacs style escape sequences, a second set of
2695 backslash escapes is available:
2696 \\b\a\ba alert (bell)
2697 \\b\b\bb backspace
2698 \\b\d\bd delete
2699 \\b\f\bf form feed
2700 \\b\n\bn newline
2701 \\b\r\br carriage return
2702 \\b\t\bt horizontal tab
2703 \\b\v\bv vertical tab
2704 \\b\_\bn_\bn_\bn the eight-bit character whose value is the octal value
2705 _\bn_\bn_\bn (one to three digits)
2706 \\b\x\bx_\bH_\bH the eight-bit character whose value is the hexadecimal
2707 value _\bH_\bH (one or two hex digits)
2708
2709 When entering the text of a macro, single or double quotes must be used
2710 to indicate a macro definition. Unquoted text is assumed to be a func-
2711 tion name. In the macro body, the backslash escapes described above
2712 are expanded. Backslash will quote any other character in the macro
2713 text, including " and '.
2714
2715 B\bBa\bas\bsh\bh allows the current readline key bindings to be displayed or modi-
2716 fied with the b\bbi\bin\bnd\bd builtin command. The editing mode may be switched
2717 during interactive use by using the -\b-o\bo option to the s\bse\bet\bt builtin com-
2718 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).
2719
2720 R\bRe\bea\bad\bdl\bli\bin\bne\be V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs
2721 Readline has variables that can be used to further customize its behav-
2722 ior. A variable may be set in the _\bi_\bn_\bp_\bu_\bt_\br_\bc file with a statement of the
2723 form
2724
2725 s\bse\bet\bt _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be_\b-_\bn_\ba_\bm_\be _\bv_\ba_\bl_\bu_\be
2726
2727 Except where noted, readline variables can take the values O\bOn\bn or O\bOf\bff\bf
2728 (without regard to case). Unrecognized variable names are ignored.
2729 When a variable value is read, empty or null values, "on" (case-insen-
2730 sitive), and "1" are equivalent to O\bOn\bn. All other values are equivalent
2731 to O\bOf\bff\bf. The variables and their default values are:
2732
2733 b\bbe\bel\bll\bl-\b-s\bst\bty\byl\ble\be (\b(a\bau\bud\bdi\bib\bbl\ble\be)\b)
2734 Controls what happens when readline wants to ring the terminal
2735 bell. If set to n\bno\bon\bne\be, readline never rings the bell. If set to
2736 v\bvi\bis\bsi\bib\bbl\ble\be, readline uses a visible bell if one is available. If
2737 set to a\bau\bud\bdi\bib\bbl\ble\be, readline attempts to ring the terminal's bell.
2738 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)
2739 If set to O\bOn\bn, readline attempts to bind the control characters
2740 treated specially by the kernel's terminal driver to their read-
2741 line equivalents.
2742 c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn (\b(`\b``\b`#\b#'\b''\b')\b)
2743 The string that is inserted when the readline i\bin\bns\bse\ber\brt\bt-\b-c\bco\bom\bmm\bme\ben\bnt\bt
2744 command is executed. This command is bound to M\bM-\b-#\b# in emacs mode
2745 and to #\b# in vi command mode.
2746 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)
2747 If set to O\bOn\bn, readline performs filename matching and completion
2748 in a case-insensitive fashion.
2749 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)
2750 The length in characters of the common prefix of a list of pos-
2751 sible completions that is displayed without modification. When
2752 set to a value greater than zero, common prefixes longer than
2753 this value are replaced with an ellipsis when displaying possi-
2754 ble completions.
2755 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)
2756 This determines when the user is queried about viewing the num-
2757 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-
2758 t\bti\bio\bon\bns\bs command. It may be set to any integer value greater than
2759 or equal to zero. If the number of possible completions is
2760 greater than or equal to the value of this variable, the user is
2761 asked whether or not he wishes to view them; otherwise they are
2762 simply listed on the terminal.
2763 c\bco\bon\bnv\bve\ber\brt\bt-\b-m\bme\bet\bta\ba (\b(O\bOn\bn)\b)
2764 If set to O\bOn\bn, readline will convert characters with the eighth
2765 bit set to an ASCII key sequence by stripping the eighth bit and
2766 prefixing an escape character (in effect, using escape as the
2767 _\bm_\be_\bt_\ba _\bp_\br_\be_\bf_\bi_\bx).
2768 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)
2769 If set to O\bOn\bn, readline will inhibit word completion. Completion
2770 characters will be inserted into the line as if they had been
2771 mapped to s\bse\bel\blf\bf-\b-i\bin\bns\bse\ber\brt\bt.
2772 e\bed\bdi\bit\bti\bin\bng\bg-\b-m\bmo\bod\bde\be (\b(e\bem\bma\bac\bcs\bs)\b)
2773 Controls whether readline begins with a set of key bindings sim-
2774 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
2775 v\bvi\bi.
2776 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)
2777 When set to O\bOn\bn, on operating systems that indicate they support
2778 it, readline echoes a character corresponding to a signal gener-
2779 ated from the keyboard.
2780 e\ben\bna\bab\bbl\ble\be-\b-k\bke\bey\byp\bpa\bad\bd (\b(O\bOf\bff\bf)\b)
2781 When set to O\bOn\bn, readline will try to enable the application key-
2782 pad when it is called. Some systems need this to enable the
2783 arrow keys.
2784 e\ben\bna\bab\bbl\ble\be-\b-m\bme\bet\bta\ba-\b-k\bke\bey\by (\b(O\bOn\bn)\b)
2785 When set to O\bOn\bn, readline will try to enable any meta modifier
2786 key the terminal claims to support when it is called. On many
2787 terminals, the meta key is used to send eight-bit characters.
2788 e\bex\bxp\bpa\ban\bnd\bd-\b-t\bti\bil\bld\bde\be (\b(O\bOf\bff\bf)\b)
2789 If set to o\bon\bn, tilde expansion is performed when readline
2790 attempts word completion.
2791 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)
2792 If set to o\bon\bn, the history code attempts to place point at the
2793 same location on each history line retrieved with p\bpr\bre\bev\bvi\bio\bou\bus\bs-\b-h\bhi\bis\bs-\b-
2794 t\bto\bor\bry\by or n\bne\bex\bxt\bt-\b-h\bhi\bis\bst\bto\bor\bry\by.
2795 h\bhi\bis\bst\bto\bor\bry\by-\b-s\bsi\biz\bze\be (\b(0\b0)\b)
2796 Set the maximum number of history entries saved in the history
2797 list. If set to zero, the number of entries in the history list
2798 is not limited.
2799 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)
2800 When set to O\bOn\bn, makes readline use a single line for display,
2801 scrolling the input horizontally on a single screen line when it
2802 becomes longer than the screen width rather than wrapping to a
2803 new line.
2804 i\bin\bnp\bpu\but\bt-\b-m\bme\bet\bta\ba (\b(O\bOf\bff\bf)\b)
2805 If set to O\bOn\bn, readline will enable eight-bit input (that is, it
2806 will not strip the high bit from the characters it reads),
2807 regardless of what the terminal claims it can support. The name
2808 m\bme\bet\bta\ba-\b-f\bfl\bla\bag\bg is a synonym for this variable.
2809 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)
2810 The string of characters that should terminate an incremental
2811 search without subsequently executing the character as a com-
2812 mand. If this variable has not been given a value, the charac-
2813 ters _\bE_\bS_\bC and _\bC_\b-_\bJ will terminate an incremental search.
2814 k\bke\bey\bym\bma\bap\bp (\b(e\bem\bma\bac\bcs\bs)\b)
2815 Set the current readline keymap. The set of valid keymap names
2816 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-
2817 _\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
2818 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
2819 value of e\bed\bdi\bit\bti\bin\bng\bg-\b-m\bmo\bod\bde\be also affects the default keymap.
2820 m\bma\bar\brk\bk-\b-d\bdi\bir\bre\bec\bct\bto\bor\bri\bie\bes\bs (\b(O\bOn\bn)\b)
2821 If set to O\bOn\bn, completed directory names have a slash appended.
2822 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)
2823 If set to O\bOn\bn, history lines that have been modified are dis-
2824 played with a preceding asterisk (*\b*).
2825 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)
2826 If set to O\bOn\bn, completed names which are symbolic links to direc-
2827 tories have a slash appended (subject to the value of
2828 m\bma\bar\brk\bk-\b-d\bdi\bir\bre\bec\bct\bto\bor\bri\bie\bes\bs).
2829 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)
2830 This variable, when set to O\bOn\bn, causes readline to match files
2831 whose names begin with a `.' (hidden files) when performing
2832 filename completion, unless the leading `.' is supplied by the
2833 user in the filename to be completed.
2834 o\bou\but\btp\bpu\but\bt-\b-m\bme\bet\bta\ba (\b(O\bOf\bff\bf)\b)
2835 If set to O\bOn\bn, readline will display characters with the eighth
2836 bit set directly rather than as a meta-prefixed escape sequence.
2837 p\bpa\bag\bge\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(O\bOn\bn)\b)
2838 If set to O\bOn\bn, readline uses an internal _\bm_\bo_\br_\be-like pager to dis-
2839 play a screenful of possible completions at a time.
2840 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)
2841 If set to O\bOn\bn, readline will display completions with matches
2842 sorted horizontally in alphabetical order, rather than down the
2843 screen.
2844 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)
2845 If set to o\bon\bn, readline will undo all changes to history lines
2846 before returning when a\bac\bcc\bce\bep\bpt\bt-\b-l\bli\bin\bne\be is executed. By default, his-
2847 tory lines may be modified and retain individual undo lists
2848 across calls to r\bre\bea\bad\bdl\bli\bin\bne\be.
2849 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)
2850 This alters the default behavior of the completion functions.
2851 If set to o\bon\bn, words which have more than one possible completion
2852 cause the matches to be listed immediately instead of ringing
2853 the bell.
2854 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)
2855 This alters the default behavior of the completion functions in
2856 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
2857 which have more than one possible completion without any possi-
2858 ble partial completion (the possible completions don't share a
2859 common prefix) cause the matches to be listed immediately
2860 instead of ringing the bell.
2861 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)
2862 If set to O\bOn\bn, this alters the default completion behavior when
2863 inserting a single match into the line. It's only active when
2864 performing completion in the middle of a word. If enabled,
2865 readline does not insert characters from the completion that
2866 match characters after point in the word being completed, so
2867 portions of the word following the cursor are not duplicated.
2868 v\bvi\bis\bsi\bib\bbl\ble\be-\b-s\bst\bta\bat\bts\bs (\b(O\bOf\bff\bf)\b)
2869 If set to O\bOn\bn, a character denoting a file's type as reported by
2870 _\bs_\bt_\ba_\bt(2) is appended to the filename when listing possible com-
2871 pletions.
2872
2873 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
2874 Readline implements a facility similar in spirit to the conditional
2875 compilation features of the C preprocessor which allows key bindings
2876 and variable settings to be performed as the result of tests. There
2877 are four parser directives used.
2878
2879 $\b$i\bif\bf The $\b$i\bif\bf construct allows bindings to be made based on the edit-
2880 ing mode, the terminal being used, or the application using
2881 readline. The text of the test extends to the end of the line;
2882 no characters are required to isolate it.
2883
2884 m\bmo\bod\bde\be The m\bmo\bod\bde\be=\b= form of the $\b$i\bif\bf directive is used to test
2885 whether readline is in emacs or vi mode. This may be
2886 used in conjunction with the s\bse\bet\bt k\bke\bey\bym\bma\bap\bp command, for
2887 instance, to set bindings in the _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\bd_\ba_\br_\bd and
2888 _\be_\bm_\ba_\bc_\bs_\b-_\bc_\bt_\bl_\bx keymaps only if readline is starting out in
2889 emacs mode.
2890
2891 t\bte\ber\brm\bm The t\bte\ber\brm\bm=\b= form may be used to include terminal-specific
2892 key bindings, perhaps to bind the key sequences output by
2893 the terminal's function keys. The word on the right side
2894 of the =\b= is tested against the both full name of the ter-
2895 minal and the portion of the terminal name before the
2896 first -\b-. This allows _\bs_\bu_\bn to match both _\bs_\bu_\bn and _\bs_\bu_\bn_\b-_\bc_\bm_\bd,
2897 for instance.
2898
2899 a\bap\bpp\bpl\bli\bic\bca\bat\bti\bio\bon\bn
2900 The a\bap\bpp\bpl\bli\bic\bca\bat\bti\bio\bon\bn construct is used to include application-
2901 specific settings. Each program using the readline
2902 library sets the _\ba_\bp_\bp_\bl_\bi_\bc_\ba_\bt_\bi_\bo_\bn _\bn_\ba_\bm_\be, and an initialization
2903 file can test for a particular value. This could be used
2904 to bind key sequences to functions useful for a specific
2905 program. For instance, the following command adds a key
2906 sequence that quotes the current or previous word in
2907 Bash:
2908
2909 $\b$i\bif\bf Bash
2910 # Quote the current or previous word
2911 "\C-xq": "\eb\"\ef\""
2912 $\b$e\ben\bnd\bdi\bif\bf
2913
2914 $\b$e\ben\bnd\bdi\bif\bf This command, as seen in the previous example, terminates an $\b$i\bif\bf
2915 command.
2916
2917 $\b$e\bel\bls\bse\be Commands in this branch of the $\b$i\bif\bf directive are executed if the
2918 test fails.
2919
2920 $\b$i\bin\bnc\bcl\blu\bud\bde\be
2921 This directive takes a single filename as an argument and reads
2922 commands and bindings from that file. For example, the follow-
2923 ing directive would read _\b/_\be_\bt_\bc_\b/_\bi_\bn_\bp_\bu_\bt_\br_\bc:
2924
2925 $\b$i\bin\bnc\bcl\blu\bud\bde\be _\b/_\be_\bt_\bc_\b/_\bi_\bn_\bp_\bu_\bt_\br_\bc
2926
2927 S\bSe\bea\bar\brc\bch\bhi\bin\bng\bg
2928 Readline provides commands for searching through the command history
2929 (see H\bHI\bIS\bST\bTO\bOR\bRY\bY below) for lines containing a specified string. There are
2930 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.
2931
2932 Incremental searches begin before the user has finished typing the
2933 search string. As each character of the search string is typed, read-
2934 line displays the next entry from the history matching the string typed
2935 so far. An incremental search requires only as many characters as
2936 needed to find the desired history entry. The characters present in
2937 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
2938 incremental search. If that variable has not been assigned a value the
2939 Escape and Control-J characters will terminate an incremental search.
2940 Control-G will abort an incremental search and restore the original
2941 line. When the search is terminated, the history entry containing the
2942 search string becomes the current line.
2943
2944 To find other matching entries in the history list, type Control-S or
2945 Control-R as appropriate. This will search backward or forward in the
2946 history for the next entry matching the search string typed so far.
2947 Any other key sequence bound to a readline command will terminate the
2948 search and execute that command. For instance, a _\bn_\be_\bw_\bl_\bi_\bn_\be will termi-
2949 nate the search and accept the line, thereby executing the command from
2950 the history list.
2951
2952 Readline remembers the last incremental search string. If two Control-
2953 Rs are typed without any intervening characters defining a new search
2954 string, any remembered search string is used.
2955
2956 Non-incremental searches read the entire search string before starting
2957 to search for matching history lines. The search string may be typed
2958 by the user or be part of the contents of the current line.
2959
2960 R\bRe\bea\bad\bdl\bli\bin\bne\be C\bCo\bom\bmm\bma\ban\bnd\bd N\bNa\bam\bme\bes\bs
2961 The following is a list of the names of the commands and the default
2962 key sequences to which they are bound. Command names without an accom-
2963 panying key sequence are unbound by default. In the following descrip-
2964 tions, _\bp_\bo_\bi_\bn_\bt refers to the current cursor position, and _\bm_\ba_\br_\bk refers to
2965 a cursor position saved by the s\bse\bet\bt-\b-m\bma\bar\brk\bk command. The text between the
2966 point and mark is referred to as the _\br_\be_\bg_\bi_\bo_\bn.
2967
2968 C\bCo\bom\bmm\bma\ban\bnd\bds\bs f\bfo\bor\br M\bMo\bov\bvi\bin\bng\bg
2969 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)
2970 Move to the start of the current line.
2971 e\ben\bnd\bd-\b-o\bof\bf-\b-l\bli\bin\bne\be (\b(C\bC-\b-e\be)\b)
2972 Move to the end of the line.
2973 f\bfo\bor\brw\bwa\bar\brd\bd-\b-c\bch\bha\bar\br (\b(C\bC-\b-f\bf)\b)
2974 Move forward a character.
2975 b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-c\bch\bha\bar\br (\b(C\bC-\b-b\bb)\b)
2976 Move back a character.
2977 f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-f\bf)\b)
2978 Move forward to the end of the next word. Words are composed of
2979 alphanumeric characters (letters and digits).
2980 b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-b\bb)\b)
2981 Move back to the start of the current or previous word. Words
2982 are composed of alphanumeric characters (letters and digits).
2983 s\bsh\bhe\bel\bll\bl-\b-f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd
2984 Move forward to the end of the next word. Words are delimited
2985 by non-quoted shell metacharacters.
2986 s\bsh\bhe\bel\bll\bl-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd
2987 Move back to the start of the current or previous word. Words
2988 are delimited by non-quoted shell metacharacters.
2989 c\bcl\ble\bea\bar\br-\b-s\bsc\bcr\bre\bee\ben\bn (\b(C\bC-\b-l\bl)\b)
2990 Clear the screen leaving the current line at the top of the
2991 screen. With an argument, refresh the current line without
2992 clearing the screen.
2993 r\bre\bed\bdr\bra\baw\bw-\b-c\bcu\bur\brr\bre\ben\bnt\bt-\b-l\bli\bin\bne\be
2994 Refresh the current line.
2995
2996 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
2997 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)
2998 Accept the line regardless of where the cursor is. If this line
2999 is non-empty, add it to the history list according to the state
3000 of the H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL variable. If the line is a modified history
3001 line, then restore the history line to its original state.
3002 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)
3003 Fetch the previous command from the history list, moving back in
3004 the list.
3005 n\bne\bex\bxt\bt-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(C\bC-\b-n\bn)\b)
3006 Fetch the next command from the history list, moving forward in
3007 the list.
3008 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)
3009 Move to the first line in the history.
3010 e\ben\bnd\bd-\b-o\bof\bf-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(M\bM-\b->\b>)\b)
3011 Move to the end of the input history, i.e., the line currently
3012 being entered.
3013 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)
3014 Search backward starting at the current line and moving `up'
3015 through the history as necessary. This is an incremental
3016 search.
3017 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)
3018 Search forward starting at the current line and moving `down'
3019 through the history as necessary. This is an incremental
3020 search.
3021 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)
3022 Search backward through the history starting at the current line
3023 using a non-incremental search for a string supplied by the
3024 user.
3025 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)
3026 Search forward through the history using a non-incremental
3027 search for a string supplied by the user.
3028 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
3029 Search forward through the history for the string of characters
3030 between the start of the current line and the point. This is a
3031 non-incremental search.
3032 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
3033 Search backward through the history for the string of characters
3034 between the start of the current line and the point. This is a
3035 non-incremental search.
3036 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)
3037 Insert the first argument to the previous command (usually the
3038 second word on the previous line) at point. With an argument _\bn,
3039 insert the _\bnth word from the previous command (the words in the
3040 previous command begin with word 0). A negative argument
3041 inserts the _\bnth word from the end of the previous command. Once
3042 the argument _\bn is computed, the argument is extracted as if the
3043 "!_\bn" history expansion had been specified.
3044 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)
3045 Insert the last argument to the previous command (the last word
3046 of the previous history entry). With an argument, behave
3047 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
3048 move back through the history list, inserting the last argument
3049 of each line in turn. The history expansion facilities are used
3050 to extract the last argument, as if the "!$" history expansion
3051 had been specified.
3052 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)
3053 Expand the line as the shell does. This performs alias and his-
3054 tory expansion as well as all of the shell word expansions. See
3055 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.
3056 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)
3057 Perform history expansion on the current line. See H\bHI\bIS\bST\bTO\bOR\bRY\bY
3058 E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN below for a description of history expansion.
3059 m\bma\bag\bgi\bic\bc-\b-s\bsp\bpa\bac\bce\be
3060 Perform history expansion on the current line and insert a
3061 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
3062 expansion.
3063 a\bal\bli\bia\bas\bs-\b-e\bex\bxp\bpa\ban\bnd\bd-\b-l\bli\bin\bne\be
3064 Perform alias expansion on the current line. See A\bAL\bLI\bIA\bAS\bSE\bES\bS above
3065 for a description of alias expansion.
3066 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
3067 Perform history and alias expansion on the current line.
3068 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)
3069 A synonym for y\bya\ban\bnk\bk-\b-l\bla\bas\bst\bt-\b-a\bar\brg\bg.
3070 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)
3071 Accept the current line for execution and fetch the next line
3072 relative to the current line from the history for editing. Any
3073 argument is ignored.
3074 e\bed\bdi\bit\bt-\b-a\ban\bnd\bd-\b-e\bex\bxe\bec\bcu\but\bte\be-\b-c\bco\bom\bmm\bma\ban\bnd\bd (\b(C\bC-\b-x\bxC\bC-\b-e\be)\b)
3075 Invoke an editor on the current command line, and execute the
3076 result as shell commands. B\bBa\bas\bsh\bh attempts to invoke $\b$V\bVI\bIS\bSU\bUA\bAL\bL,
3077 $\b$E\bED\bDI\bIT\bTO\bOR\bR, and _\be_\bm_\ba_\bc_\bs as the editor, in that order.
3078
3079 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
3080 d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br (\b(C\bC-\b-d\bd)\b)
3081 Delete the character at point. If point is at the beginning of
3082 the line, there are no characters in the line, and the last
3083 character typed was not bound to d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br, then return E\bEO\bOF\bF.
3084 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)
3085 Delete the character behind the cursor. When given a numeric
3086 argument, save the deleted text on the kill ring.
3087 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
3088 Delete the character under the cursor, unless the cursor is at
3089 the end of the line, in which case the character behind the cur-
3090 sor is deleted.
3091 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)
3092 Add the next character typed to the line verbatim. This is how
3093 to insert characters like C\bC-\b-q\bq, for example.
3094 t\bta\bab\bb-\b-i\bin\bns\bse\ber\brt\bt (\b(C\bC-\b-v\bv T\bTA\bAB\bB)\b)
3095 Insert a tab character.
3096 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)
3097 Insert the character typed.
3098 t\btr\bra\ban\bns\bsp\bpo\bos\bse\be-\b-c\bch\bha\bar\brs\bs (\b(C\bC-\b-t\bt)\b)
3099 Drag the character before point forward over the character at
3100 point, moving point forward as well. If point is at the end of
3101 the line, then this transposes the two characters before point.
3102 Negative arguments have no effect.
3103 t\btr\bra\ban\bns\bsp\bpo\bos\bse\be-\b-w\bwo\bor\brd\bds\bs (\b(M\bM-\b-t\bt)\b)
3104 Drag the word before point past the word after point, moving
3105 point over that word as well. If point is at the end of the
3106 line, this transposes the last two words on the line.
3107 u\bup\bpc\bca\bas\bse\be-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-u\bu)\b)
3108 Uppercase the current (or following) word. With a negative
3109 argument, uppercase the previous word, but do not move point.
3110 d\bdo\bow\bwn\bnc\bca\bas\bse\be-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-l\bl)\b)
3111 Lowercase the current (or following) word. With a negative
3112 argument, lowercase the previous word, but do not move point.
3113 c\bca\bap\bpi\bit\bta\bal\bli\biz\bze\be-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-c\bc)\b)
3114 Capitalize the current (or following) word. With a negative
3115 argument, capitalize the previous word, but do not move point.
3116 o\bov\bve\ber\brw\bwr\bri\bit\bte\be-\b-m\bmo\bod\bde\be
3117 Toggle overwrite mode. With an explicit positive numeric argu-
3118 ment, switches to overwrite mode. With an explicit non-positive
3119 numeric argument, switches to insert mode. This command affects
3120 only e\bem\bma\bac\bcs\bs mode; v\bvi\bi mode does overwrite differently. Each call
3121 to _\br_\be_\ba_\bd_\bl_\bi_\bn_\be_\b(_\b) starts in insert mode. In overwrite mode, charac-
3122 ters bound to s\bse\bel\blf\bf-\b-i\bin\bns\bse\ber\brt\bt replace the text at point rather than
3123 pushing the text to the right. Characters bound to b\bba\bac\bck\bk-\b-
3124 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
3125 space. By default, this command is unbound.
3126
3127 K\bKi\bil\bll\bli\bin\bng\bg a\ban\bnd\bd Y\bYa\ban\bnk\bki\bin\bng\bg
3128 k\bki\bil\bll\bl-\b-l\bli\bin\bne\be (\b(C\bC-\b-k\bk)\b)
3129 Kill the text from point to the end of the line.
3130 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)
3131 Kill backward to the beginning of the line.
3132 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)
3133 Kill backward from point to the beginning of the line. The
3134 killed text is saved on the kill-ring.
3135 k\bki\bil\bll\bl-\b-w\bwh\bho\bol\ble\be-\b-l\bli\bin\bne\be
3136 Kill all characters on the current line, no matter where point
3137 is.
3138 k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-d\bd)\b)
3139 Kill from point to the end of the current word, or if between
3140 words, to the end of the next word. Word boundaries are the
3141 same as those used by f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
3142 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)
3143 Kill the word behind point. Word boundaries are the same as
3144 those used by b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
3145 s\bsh\bhe\bel\bll\bl-\b-k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-d\bd)\b)
3146 Kill from point to the end of the current word, or if between
3147 words, to the end of the next word. Word boundaries are the
3148 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.
3149 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 (\b(M\bM-\b-R\bRu\bub\bbo\bou\but\bt)\b)
3150 Kill the word behind point. Word boundaries are the same as
3151 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.
3152 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)
3153 Kill the word behind point, using white space as a word bound-
3154 ary. The killed text is saved on the kill-ring.
3155 u\bun\bni\bix\bx-\b-f\bfi\bil\ble\ben\bna\bam\bme\be-\b-r\bru\bub\bbo\bou\but\bt
3156 Kill the word behind point, using white space and the slash
3157 character as the word boundaries. The killed text is saved on
3158 the kill-ring.
3159 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)
3160 Delete all spaces and tabs around point.
3161 k\bki\bil\bll\bl-\b-r\bre\beg\bgi\bio\bon\bn
3162 Kill the text in the current region.
3163 c\bco\bop\bpy\by-\b-r\bre\beg\bgi\bio\bon\bn-\b-a\bas\bs-\b-k\bki\bil\bll\bl
3164 Copy the text in the region to the kill buffer.
3165 c\bco\bop\bpy\by-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd
3166 Copy the word before point to the kill buffer. The word bound-
3167 aries are the same as b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
3168 c\bco\bop\bpy\by-\b-f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd
3169 Copy the word following point to the kill buffer. The word
3170 boundaries are the same as f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
3171 y\bya\ban\bnk\bk (\b(C\bC-\b-y\by)\b)
3172 Yank the top of the kill ring into the buffer at point.
3173 y\bya\ban\bnk\bk-\b-p\bpo\bop\bp (\b(M\bM-\b-y\by)\b)
3174 Rotate the kill ring, and yank the new top. Only works follow-
3175 ing y\bya\ban\bnk\bk or y\bya\ban\bnk\bk-\b-p\bpo\bop\bp.
3176
3177 N\bNu\bum\bme\ber\bri\bic\bc A\bAr\brg\bgu\bum\bme\ben\bnt\bts\bs
3178 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)
3179 Add this digit to the argument already accumulating, or start a
3180 new argument. M-- starts a negative argument.
3181 u\bun\bni\biv\bve\ber\brs\bsa\bal\bl-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt
3182 This is another way to specify an argument. If this command is
3183 followed by one or more digits, optionally with a leading minus
3184 sign, those digits define the argument. If the command is fol-
3185 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
3186 numeric argument, but is otherwise ignored. As a special case,
3187 if this command is immediately followed by a character that is
3188 neither a digit or minus sign, the argument count for the next
3189 command is multiplied by four. The argument count is initially
3190 one, so executing this function the first time makes the argu-
3191 ment count four, a second time makes the argument count sixteen,
3192 and so on.
3193
3194 C\bCo\bom\bmp\bpl\ble\bet\bti\bin\bng\bg
3195 c\bco\bom\bmp\bpl\ble\bet\bte\be (\b(T\bTA\bAB\bB)\b)
3196 Attempt to perform completion on the text before point. B\bBa\bas\bsh\bh
3197 attempts completion treating the text as a variable (if the text
3198 begins with $\b$), username (if the text begins with ~\b~), hostname
3199 (if the text begins with @\b@), or command (including aliases and
3200 functions) in turn. If none of these produces a match, filename
3201 completion is attempted.
3202 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)
3203 List the possible completions of the text before point.
3204 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)
3205 Insert all completions of the text before point that would have
3206 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.
3207 m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be
3208 Similar to c\bco\bom\bmp\bpl\ble\bet\bte\be, but replaces the word to be completed with
3209 a single match from the list of possible completions. Repeated
3210 execution of m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be steps through the list of possible
3211 completions, inserting each match in turn. At the end of the
3212 list of completions, the bell is rung (subject to the setting of
3213 b\bbe\bel\bll\bl-\b-s\bst\bty\byl\ble\be) and the original text is restored. An argument of _\bn
3214 moves _\bn positions forward in the list of matches; a negative
3215 argument may be used to move backward through the list. This
3216 command is intended to be bound to T\bTA\bAB\bB, but is unbound by
3217 default.\bc\bc
3218 m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-k\bkr\brd\bd
3219 Identicw\bw\bal to m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be, but moves backward through the list
3220 of possible completions, as if m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be had been given a
3221 negative argument. This command is unbound by default.
3222 d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br-\b-o\bor\br-\b-l\bli\bis\bst\bt
3223 Deletes the character under the cursor if not at the beginning
3224 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
3225 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
3226 is unbound by default.
3227 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)
3228 Attempt filename completion on the text before point.
3229 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)
3230 List the possible completions of the text before point, treating
3231 it as a filename.
3232 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)
3233 Attempt completion on the text before point, treating it as a
3234 username.
3235 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)
3236 List the possible completions of the text before point, treating
3237 it as a username.
3238 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)
3239 Attempt completion on the text before point, treating it as a
3240 shell variable.
3241 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)
3242 List the possible completions of the text before point, treating
3243 it as a shell variable.
3244 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)
3245 Attempt completion on the text before point, treating it as a
3246 hostname.
3247 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)
3248 List the possible completions of the text before point, treating
3249 it as a hostname.
3250 c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-c\bco\bom\bmm\bma\ban\bnd\bd (\b(M\bM-\b-!\b!)\b)
3251 Attempt completion on the text before point, treating it as a
3252 command name. Command completion attempts to match the text
3253 against aliases, reserved words, shell functions, shell
3254 builtins, and finally executable filenames, in that order.
3255 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)
3256 List the possible completions of the text before point, treating
3257 it as a command name.
3258 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)
3259 Attempt completion on the text before point, comparing the text
3260 against lines from the history list for possible completion
3261 matches.
3262 d\bda\bab\bbb\bbr\bre\bev\bv-\b-e\bex\bxp\bpa\ban\bnd\bd
3263 Attempt menu completion on the text before point, comparing the
3264 text against lines from the history list for possible completion
3265 matches.
3266 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)
3267 Perform filename completion and insert the list of possible com-
3268 pletions enclosed within braces so the list is available to the
3269 shell (see B\bBr\bra\bac\bce\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn above).
3270
3271 K\bKe\bey\byb\bbo\boa\bar\brd\bd M\bMa\bac\bcr\bro\bos\bs
3272 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)
3273 Begin saving the characters typed into the current keyboard
3274 macro.
3275 e\ben\bnd\bd-\b-k\bkb\bbd\bd-\b-m\bma\bac\bcr\bro\bo (\b(C\bC-\b-x\bx )\b))\b)
3276 Stop saving the characters typed into the current keyboard macro
3277 and store the definition.
3278 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)
3279 Re-execute the last keyboard macro defined, by making the char-
3280 acters in the macro appear as if typed at the keyboard.
3281
3282 M\bMi\bis\bsc\bce\bel\bll\bla\ban\bne\beo\bou\bus\bs
3283 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)
3284 Read in the contents of the _\bi_\bn_\bp_\bu_\bt_\br_\bc file, and incorporate any
3285 bindings or variable assignments found there.
3286 a\bab\bbo\bor\brt\bt (\b(C\bC-\b-g\bg)\b)
3287 Abort the current editing command and ring the terminal's bell
3288 (subject to the setting of b\bbe\bel\bll\bl-\b-s\bst\bty\byl\ble\be).
3289 d\bdo\bo-\b-u\bup\bpp\bpe\ber\brc\bca\bas\bse\be-\b-v\bve\ber\brs\bsi\bio\bon\bn (\b(M\bM-\b-a\ba,\b, M\bM-\b-b\bb,\b, M\bM-\b-_\bx,\b, .\b..\b..\b.)\b)
3290 If the metafied character _\bx is lowercase, run the command that
3291 is bound to the corresponding uppercase character.
3292 p\bpr\bre\bef\bfi\bix\bx-\b-m\bme\bet\bta\ba (\b(E\bES\bSC\bC)\b)
3293 Metafy the next character typed. E\bES\bSC\bC f\bf is equivalent to M\bMe\bet\bta\ba-\b-f\bf.
3294 u\bun\bnd\bdo\bo (\b(C\bC-\b-_\b_,\b, C\bC-\b-x\bx C\bC-\b-u\bu)\b)
3295 Incremental undo, separately remembered for each line.
3296 r\bre\bev\bve\ber\brt\bt-\b-l\bli\bin\bne\be (\b(M\bM-\b-r\br)\b)
3297 Undo all changes made to this line. This is like executing the
3298 u\bun\bnd\bdo\bo command enough times to return the line to its initial
3299 state.
3300 t\bti\bil\bld\bde\be-\b-e\bex\bxp\bpa\ban\bnd\bd (\b(M\bM-\b-&\b&)\b)
3301 Perform tilde expansion on the current word.
3302 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)
3303 Set the mark to the point. If a numeric argument is supplied,
3304 the mark is set to that position.
3305 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)
3306 Swap the point with the mark. The current cursor position is
3307 set to the saved position, and the old cursor position is saved
3308 as the mark.
3309 c\bch\bha\bar\bra\bac\bct\bte\ber\br-\b-s\bse\bea\bar\brc\bch\bh (\b(C\bC-\b-]\b])\b)
3310 A character is read and point is moved to the next occurrence of
3311 that character. A negative count searches for previous occur-
3312 rences.
3313 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)
3314 A character is read and point is moved to the previous occur-
3315 rence of that character. A negative count searches for subse-
3316 quent occurrences.
3317 s\bsk\bki\bip\bp-\b-c\bcs\bsi\bi-\b-s\bse\beq\bqu\bue\ben\bnc\bce\be (\b()\b)
3318 Read enough characters to consume a multi-key sequence such as
3319 those defined for keys like Home and End. Such sequences begin
3320 with a Control Sequence Indicator (CSI), usually ESC-[. If this
3321 sequence is bound to "\[", keys producing such sequences will
3322 have no effect unless explicitly bound to a readline command,
3323 instead of inserting stray characters into the editing buffer.
3324 This is unbound by default, but usually bound to ESC-[.
3325 i\bin\bns\bse\ber\brt\bt-\b-c\bco\bom\bmm\bme\ben\bnt\bt (\b(M\bM-\b-#\b#)\b)
3326 Without a numeric argument, the value of the readline c\bco\bom\bm-\b-
3327 m\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn variable is inserted at the beginning of the current
3328 line. If a numeric argument is supplied, this command acts as a
3329 toggle: if the characters at the beginning of the line do not
3330 match the value of c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn, the value is inserted, other-
3331 wise the characters in c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn are deleted from the begin-
3332 ning of the line. In either case, the line is accepted as if a
3333 newline had been typed. The default value of c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn
3334 causes this command to make the current line a shell comment.
3335 If a numeric argument causes the comment character to be
3336 removed, the line will be executed by the shell.
3337 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)
3338 The word before point is treated as a pattern for pathname
3339 expansion, with an asterisk implicitly appended. This pattern
3340 is used to generate a list of matching file names for possible
3341 completions.
3342 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)
3343 The word before point is treated as a pattern for pathname
3344 expansion, and the list of matching file names is inserted,
3345 replacing the word. If a numeric argument is supplied, an
3346 asterisk is appended before pathname expansion.
3347 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)
3348 The list of expansions that would have been generated by
3349 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
3350 numeric argument is supplied, an asterisk is appended before
3351 pathname expansion.
3352 d\bdu\bum\bmp\bp-\b-f\bfu\bun\bnc\bct\bti\bio\bon\bns\bs
3353 Print all of the functions and their key bindings to the read-
3354 line output stream. If a numeric argument is supplied, the out-
3355 put is formatted in such a way that it can be made part of an
3356 _\bi_\bn_\bp_\bu_\bt_\br_\bc file.
3357 d\bdu\bum\bmp\bp-\b-v\bva\bar\bri\bia\bab\bbl\ble\bes\bs
3358 Print all of the settable readline variables and their values to
3359 the readline output stream. If a numeric argument is supplied,
3360 the output is formatted in such a way that it can be made part
3361 of an _\bi_\bn_\bp_\bu_\bt_\br_\bc file.
3362 d\bdu\bum\bmp\bp-\b-m\bma\bac\bcr\bro\bos\bs
3363 Print all of the readline key sequences bound to macros and the
3364 strings they output. If a numeric argument is supplied, the
3365 output is formatted in such a way that it can be made part of an
3366 _\bi_\bn_\bp_\bu_\bt_\br_\bc file.
3367 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)
3368 Display version information about the current instance of b\bba\bas\bsh\bh.
3369
3370 P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn
3371 When word completion is attempted for an argument to a command for
3372 which a completion specification (a _\bc_\bo_\bm_\bp_\bs_\bp_\be_\bc) has been defined using
3373 the c\bco\bom\bmp\bpl\ble\bet\bte\be builtin (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below), the pro-
3374 grammable completion facilities are invoked.
3375
3376 First, the command name is identified. If the command word is the
3377 empty string (completion attempted at the beginning of an empty line),
3378 any compspec defined with the -\b-E\bE option to c\bco\bom\bmp\bpl\ble\bet\bte\be is used. If a
3379 compspec has been defined for that command, the compspec is used to
3380 generate the list of possible completions for the word. If the command
3381 word is a full pathname, a compspec for the full pathname is searched
3382 for first. If no compspec is found for the full pathname, an attempt
3383 is made to find a compspec for the portion following the final slash.
3384 If those searches to not result in a compspec, any compspec defined
3385 with the -\b-D\bD option to c\bco\bom\bmp\bpl\ble\bet\bte\be is used as the default.
3386
3387 Once a compspec has been found, it is used to generate the list of
3388 matching words. If a compspec is not found, the default b\bba\bas\bsh\bh comple-
3389 tion as described above under C\bCo\bom\bmp\bpl\ble\bet\bti\bin\bng\bg is performed.
3390
3391 First, the actions specified by the compspec are used. Only matches
3392 which are prefixed by the word being completed are returned. When the
3393 -\b-f\bf or -\b-d\bd option is used for filename or directory name completion, the
3394 shell variable F\bFI\bIG\bGN\bNO\bOR\bRE\bE is used to filter the matches.
3395
3396 Any completions specified by a pathname expansion pattern to the -\b-G\bG
3397 option are generated next. The words generated by the pattern need not
3398 match the word being completed. The G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE shell variable is not
3399 used to filter the matches, but the F\bFI\bIG\bGN\bNO\bOR\bRE\bE variable is used.
3400
3401 Next, the string specified as the argument to the -\b-W\bW option is consid-
3402 ered. The string is first split using the characters in the I\bIF\bFS\bS spe-
3403 cial variable as delimiters. Shell quoting is honored. Each word is
3404 then expanded using brace expansion, tilde expansion, parameter and
3405 variable expansion, command substitution, and arithmetic expansion, as
3406 described above under E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN. The results are split using the rules
3407 described above under W\bWo\bor\brd\bd S\bSp\bpl\bli\bit\btt\bti\bin\bng\bg. The results of the expansion are
3408 prefix-matched against the word being completed, and the matching words
3409 become the possible completions.
3410
3411 After these matches have been generated, any shell function or command
3412 specified with the -\b-F\bF and -\b-C\bC options is invoked. When the command or
3413 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
3414 variables are assigned values as described above under S\bSh\bhe\bel\bll\bl V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs.
3415 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
3416 variables are also set. When the function or command is invoked, the
3417 first argument is the name of the command whose arguments are being
3418 completed, the second argument is the word being completed, and the
3419 third argument is the word preceding the word being completed on the
3420 current command line. No filtering of the generated completions
3421 against the word being completed is performed; the function or command
3422 has complete freedom in generating the matches.
3423
3424 Any function specified with -\b-F\bF is invoked first. The function may use
3425 any of the shell facilities, including the c\bco\bom\bmp\bpg\bge\ben\bn builtin described
3426 below, to generate the matches. It must put the possible completions
3427 in the C\bCO\bOM\bMP\bPR\bRE\bEP\bPL\bLY\bY array variable.
3428
3429 Next, any command specified with the -\b-C\bC option is invoked in an envi-
3430 ronment equivalent to command substitution. It should print a list of
3431 completions, one per line, to the standard output. Backslash may be
3432 used to escape a newline, if necessary.
3433
3434 After all of the possible completions are generated, any filter speci-
3435 fied with the -\b-X\bX option is applied to the list. The filter is a pat-
3436 tern as used for pathname expansion; a &\b& in the pattern is replaced
3437 with the text of the word being completed. A literal &\b& may be escaped
3438 with a backslash; the backslash is removed before attempting a match.
3439 Any completion that matches the pattern will be removed from the list.
3440 A leading !\b! negates the pattern; in this case any completion not match-
3441 ing the pattern will be removed.
3442
3443 Finally, any prefix and suffix specified with the -\b-P\bP and -\b-S\bS options are
3444 added to each member of the completion list, and the result is returned
3445 to the readline completion code as the list of possible completions.
3446
3447 If the previously-applied actions do not generate any matches, and the
3448 -\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
3449 defined, directory name completion is attempted.
3450
3451 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
3452 was defined, directory name completion is attempted and any matches are
3453 added to the results of the other actions.
3454
3455 By default, if a compspec is found, whatever it generates is returned
3456 to the completion code as the full set of possible completions. The
3457 default b\bba\bas\bsh\bh completions are not attempted, and the readline default of
3458 filename completion is disabled. If the -\b-o\bo b\bba\bas\bsh\bhd\bde\bef\bfa\bau\bul\blt\bt option was sup-
3459 plied to c\bco\bom\bmp\bpl\ble\bet\bte\be when the compspec was defined, the b\bba\bas\bsh\bh default com-
3460 pletions are attempted if the compspec generates no matches. If the -\b-o\bo
3461 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,
3462 readline's default completion will be performed if the compspec (and,
3463 if attempted, the default b\bba\bas\bsh\bh completions) generate no matches.
3464
3465 When a compspec indicates that directory name completion is desired,
3466 the programmable completion functions force readline to append a slash
3467 to completed names which are symbolic links to directories, subject to
3468 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
3469 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.
3470
3471 There is some support for dynamically modifying completions. This is
3472 most useful when used in combination with a default completion speci-
3473 fied with c\bco\bom\bmp\bpl\ble\bet\bte\be -\b-D\bD. It's possible for shell functions executed as
3474 completion handlers to indicate that completion should be retried by
3475 returning an exit status of 124. If a shell function returns 124, and
3476 changes the compspec associated with the command on which completion is
3477 being attempted (supplied as the first argument when the function is
3478 executed), programmable completion restarts from the beginning, with an
3479 attempt to find a compspec for that command. This allows a set of com-
3480 pletions to be built dynamically as completion is attempted, rather
3481 than being loaded all at once.
3482
3483 For instance, assuming that there is a library of compspecs, each kept
3484 in a file corresponding to the name of the command, the following
3485 default completion function would load completions dynamically:
3486
3487 _completion_loader()
3488 {
3489 . "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124
3490 }
3491 complete -D -F _completion_loader
3492
3493
3494 H\bHI\bIS\bST\bTO\bOR\bRY\bY
3495 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
3496 provides access to the _\bc_\bo_\bm_\bm_\ba_\bn_\bd _\bh_\bi_\bs_\bt_\bo_\br_\by, the list of commands previously
3497 typed. The value of the H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE variable is used as the number of
3498 commands to save in a history list. The text of the last H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE com-
3499 mands (default 500) is saved. The shell stores each command in the
3500 history list prior to parameter and variable expansion (see E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN
3501 above) but after history expansion is performed, subject to the values
3502 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.
3503
3504 On startup, the history is initialized from the file named by the vari-
3505 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
3506 of H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is truncated, if necessary, to contain no more than the
3507 number of lines specified by the value of H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bES\bSI\bIZ\bZE\bE. When the his-
3508 tory file is read, lines beginning with the history comment character
3509 followed immediately by a digit are interpreted as timestamps for the
3510 preceding history line. These timestamps are optionally displayed
3511 depending on the value of the H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT variable. When an inter-
3512 active shell exits, the last $\b$H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE lines are copied from the his-
3513 tory list to $\b$H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE. If the h\bhi\bis\bst\bta\bap\bpp\bpe\ben\bnd\bd shell option is enabled (see
3514 the description of s\bsh\bho\bop\bpt\bt under S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below), the lines
3515 are appended to the history file, otherwise the history file is over-
3516 written. If H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is unset, or if the history file is unwritable,
3517 the history is not saved. If the H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT variable is set, time
3518 stamps are written to the history file, marked with the history comment
3519 character, so they may be preserved across shell sessions. This uses
3520 the history comment character to distinguish timestamps from other his-
3521 tory lines. After saving the history, the history file is truncated to
3522 contain no more than H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bES\bSI\bIZ\bZE\bE lines. If H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bES\bSI\bIZ\bZE\bE is not set,
3523 no truncation is performed.
3524
3525 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
3526 to list or edit and re-execute a portion of the history list. The h\bhi\bis\bs-\b-
3527 t\bto\bor\bry\by builtin may be used to display or modify the history list and
3528 manipulate the history file. When using command-line editing, search
3529 commands are available in each editing mode that provide access to the
3530 history list.
3531
3532 The shell allows control over which commands are saved on the history
3533 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
3534 shell to save only a subset of the commands entered. The c\bcm\bmd\bdh\bhi\bis\bst\bt shell
3535 option, if enabled, causes the shell to attempt to save each line of a
3536 multi-line command in the same history entry, adding semicolons where
3537 necessary to preserve syntactic correctness. The l\bli\bit\bth\bhi\bis\bst\bt shell option
3538 causes the shell to save the command with embedded newlines instead of
3539 semicolons. See the description of the s\bsh\bho\bop\bpt\bt builtin below under S\bSH\bHE\bEL\bLL\bL
3540 B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS for information on setting and unsetting shell
3541 options.
3542
3543 H\bHI\bIS\bST\bTO\bOR\bRY\bY E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN
3544 The shell supports a history expansion feature that is similar to the
3545 history expansion in c\bcs\bsh\bh.\b. This section describes what syntax features
3546 are available. This feature is enabled by default for interactive
3547 shells, and can be disabled using the +\b+H\bH option to the s\bse\bet\bt builtin com-
3548 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
3549 perform history expansion by default.
3550
3551 History expansions introduce words from the history list into the input
3552 stream, making it easy to repeat commands, insert the arguments to a
3553 previous command into the current input line, or fix errors in previous
3554 commands quickly.
3555
3556 History expansion is performed immediately after a complete line is
3557 read, before the shell breaks it into words. It takes place in two
3558 parts. The first is to determine which line from the history list to
3559 use during substitution. The second is to select portions of that line
3560 for inclusion into the current one. The line selected from the history
3561 is the _\be_\bv_\be_\bn_\bt, and the portions of that line that are acted upon are
3562 _\bw_\bo_\br_\bd_\bs. Various _\bm_\bo_\bd_\bi_\bf_\bi_\be_\br_\bs are available to manipulate the selected
3563 words. The line is broken into words in the same fashion as when read-
3564 ing input, so that several _\bm_\be_\bt_\ba_\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br-separated words surrounded by
3565 quotes are considered one word. History expansions are introduced by
3566 the appearance of the history expansion character, which is !\b! by
3567 default. Only backslash (\\b\) and single quotes can quote the history
3568 expansion character.
3569
3570 Several characters inhibit history expansion if found immediately fol-
3571 lowing the history expansion character, even if it is unquoted: space,
3572 tab, newline, carriage return, and =\b=. If the e\bex\bxt\btg\bgl\blo\bob\bb shell option is
3573 enabled, (\b( will also inhibit expansion.
3574
3575 Several shell options settable with the s\bsh\bho\bop\bpt\bt builtin may be used to
3576 tailor the behavior of history expansion. If the h\bhi\bis\bst\btv\bve\ber\bri\bif\bfy\by shell
3577 option is enabled (see the description of the s\bsh\bho\bop\bpt\bt builtin below), and
3578 r\bre\bea\bad\bdl\bli\bin\bne\be is being used, history substitutions are not immediately
3579 passed to the shell parser. Instead, the expanded line is reloaded
3580 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
3581 is being used, and the h\bhi\bis\bst\btr\bre\bee\bed\bdi\bit\bt shell option is enabled, a failed
3582 history substitution will be reloaded into the r\bre\bea\bad\bdl\bli\bin\bne\be editing buffer
3583 for correction. The -\b-p\bp option to the h\bhi\bis\bst\bto\bor\bry\by builtin command may be
3584 used to see what a history expansion will do before using it. The -\b-s\bs
3585 option to the h\bhi\bis\bst\bto\bor\bry\by builtin may be used to add commands to the end of
3586 the history list without actually executing them, so that they are
3587 available for subsequent recall.
3588
3589 The shell allows control of the various characters used by the history
3590 expansion mechanism (see the description of h\bhi\bis\bst\btc\bch\bha\bar\brs\bs above under S\bSh\bhe\bel\bll\bl
3591 V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs). The shell uses the history comment character to mark his-
3592 tory timestamps when writing the history file.
3593
3594 E\bEv\bve\ben\bnt\bt D\bDe\bes\bsi\big\bgn\bna\bat\bto\bor\brs\bs
3595 An event designator is a reference to a command line entry in the his-
3596 tory list.
3597
3598 !\b! Start a history substitution, except when followed by a b\bbl\bla\ban\bnk\bk,
3599 newline, carriage return, = or ( (when the e\bex\bxt\btg\bgl\blo\bob\bb shell option
3600 is enabled using the s\bsh\bho\bop\bpt\bt builtin).
3601 !\b!_\bn Refer to command line _\bn.
3602 !\b!-\b-_\bn Refer to the current command line minus _\bn.
3603 !\b!!\b! Refer to the previous command. This is a synonym for `!-1'.
3604 !\b!_\bs_\bt_\br_\bi_\bn_\bg
3605 Refer to the most recent command starting with _\bs_\bt_\br_\bi_\bn_\bg.
3606 !\b!?\b?_\bs_\bt_\br_\bi_\bn_\bg[\b[?\b?]\b]
3607 Refer to the most recent command containing _\bs_\bt_\br_\bi_\bn_\bg. The trail-
3608 ing ?\b? may be omitted if _\bs_\bt_\br_\bi_\bn_\bg is followed immediately by a new-
3609 line.
3610 ^\b^_\bs_\bt_\br_\bi_\bn_\bg_\b1^\b^_\bs_\bt_\br_\bi_\bn_\bg_\b2^\b^
3611 Quick substitution. Repeat the last command, replacing _\bs_\bt_\br_\bi_\bn_\bg_\b1
3612 with _\bs_\bt_\br_\bi_\bn_\bg_\b2. Equivalent to ``!!:s/_\bs_\bt_\br_\bi_\bn_\bg_\b1/_\bs_\bt_\br_\bi_\bn_\bg_\b2/'' (see M\bMo\bod\bd-\b-
3613 i\bif\bfi\bie\ber\brs\bs below).
3614 !\b!#\b# The entire command line typed so far.
3615
3616 W\bWo\bor\brd\bd D\bDe\bes\bsi\big\bgn\bna\bat\bto\bor\brs\bs
3617 Word designators are used to select desired words from the event. A :\b:
3618 separates the event specification from the word designator. It may be
3619 omitted if the word designator begins with a ^\b^, $\b$, *\b*, -\b-, or %\b%. Words
3620 are numbered from the beginning of the line, with the first word being
3621 denoted by 0 (zero). Words are inserted into the current line sepa-
3622 rated by single spaces.
3623
3624 0\b0 (\b(z\bze\ber\bro\bo)\b)
3625 The zeroth word. For the shell, this is the command word.
3626 _\bn The _\bnth word.
3627 ^\b^ The first argument. That is, word 1.
3628 $\b$ The last argument.
3629 %\b% The word matched by the most recent `?_\bs_\bt_\br_\bi_\bn_\bg?' search.
3630 _\bx-\b-_\by A range of words; `-_\by' abbreviates `0-_\by'.
3631 *\b* All of the words but the zeroth. This is a synonym for `_\b1_\b-_\b$'.
3632 It is not an error to use *\b* if there is just one word in the
3633 event; the empty string is returned in that case.
3634 x\bx*\b* Abbreviates _\bx_\b-_\b$.
3635 x\bx-\b- Abbreviates _\bx_\b-_\b$ like x\bx*\b*, but omits the last word.
3636
3637 If a word designator is supplied without an event specification, the
3638 previous command is used as the event.
3639
3640 M\bMo\bod\bdi\bif\bfi\bie\ber\brs\bs
3641 After the optional word designator, there may appear a sequence of one
3642 or more of the following modifiers, each preceded by a `:'.
3643
3644 h\bh Remove a trailing file name component, leaving only the head.
3645 t\bt Remove all leading file name components, leaving the tail.
3646 r\br Remove a trailing suffix of the form _\b._\bx_\bx_\bx, leaving the basename.
3647 e\be Remove all but the trailing suffix.
3648 p\bp Print the new command but do not execute it.
3649 q\bq Quote the substituted words, escaping further substitutions.
3650 x\bx Quote the substituted words as with q\bq, but break into words at
3651 b\bbl\bla\ban\bnk\bks\bs and newlines.
3652 s\bs/\b/_\bo_\bl_\bd/\b/_\bn_\be_\bw/\b/
3653 Substitute _\bn_\be_\bw for the first occurrence of _\bo_\bl_\bd in the event
3654 line. Any delimiter can be used in place of /. The final
3655 delimiter is optional if it is the last character of the event
3656 line. The delimiter may be quoted in _\bo_\bl_\bd and _\bn_\be_\bw with a single
3657 backslash. If & appears in _\bn_\be_\bw, it is replaced by _\bo_\bl_\bd. A sin-
3658 gle backslash will quote the &. If _\bo_\bl_\bd is null, it is set to
3659 the last _\bo_\bl_\bd substituted, or, if no previous history substitu-
3660 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.
3661 &\b& Repeat the previous substitution.
3662 g\bg Cause changes to be applied over the entire event line. This is
3663 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&'.
3664 If used with `:\b:s\bs', any delimiter can be used in place of /, and
3665 the final delimiter is optional if it is the last character of
3666 the event line. An a\ba may be used as a synonym for g\bg.
3667 G\bG Apply the following `s\bs' modifier once to each word in the event
3668 line.
3669
3670 S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
3671 Unless otherwise noted, each builtin command documented in this section
3672 as accepting options preceded by -\b- accepts -\b--\b- to signify the end of the
3673 options. The :\b:, t\btr\bru\bue\be, f\bfa\bal\bls\bse\be, and t\bte\bes\bst\bt builtins do not accept options
3674 and do not treat -\b--\b- specially. The e\bex\bxi\bit\bt, l\blo\bog\bgo\bou\but\bt, b\bbr\bre\bea\bak\bk, c\bco\bon\bnt\bti\bin\bnu\bue\be, l\ble\bet\bt,
3675 and s\bsh\bhi\bif\bft\bt builtins accept and process arguments beginning with -\b- with-
3676 out requiring -\b--\b-. Other builtins that accept arguments but are not
3677 specified as accepting options interpret arguments beginning with -\b- as
3678 invalid options and require -\b--\b- to prevent this interpretation.
3679 :\b: [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
3680 No effect; the command does nothing beyond expanding _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs
3681 and performing any specified redirections. A zero exit code is
3682 returned.
3683
3684 .\b. _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
3685 s\bso\bou\bur\brc\bce\be _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
3686 Read and execute commands from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be in the current shell
3687 environment and return the exit status of the last command exe-
3688 cuted from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be. If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be does not contain a slash, file
3689 names in P\bPA\bAT\bTH\bH are used to find the directory containing _\bf_\bi_\bl_\be_\b-
3690 _\bn_\ba_\bm_\be. The file searched for in P\bPA\bAT\bTH\bH need not be executable.
3691 When b\bba\bas\bsh\bh is not in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, the current directory is
3692 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
3693 to the s\bsh\bho\bop\bpt\bt builtin command is turned off, the P\bPA\bAT\bTH\bH is not
3694 searched. If any _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs are supplied, they become the posi-
3695 tional parameters when _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is executed. Otherwise the
3696 positional parameters are unchanged. The return status is the
3697 status of the last command exited within the script (0 if no
3698 commands are executed), and false if _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is not found or
3699 cannot be read.
3700
3701 a\bal\bli\bia\bas\bs [-\b-p\bp] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ...]
3702 A\bAl\bli\bia\bas\bs with no arguments or with the -\b-p\bp option prints the list of
3703 aliases in the form a\bal\bli\bia\bas\bs _\bn_\ba_\bm_\be=_\bv_\ba_\bl_\bu_\be on standard output. When
3704 arguments are supplied, an alias is defined for each _\bn_\ba_\bm_\be whose
3705 _\bv_\ba_\bl_\bu_\be is given. A trailing space in _\bv_\ba_\bl_\bu_\be causes the next word
3706 to be checked for alias substitution when the alias is expanded.
3707 For each _\bn_\ba_\bm_\be in the argument list for which no _\bv_\ba_\bl_\bu_\be is sup-
3708 plied, the name and value of the alias is printed. A\bAl\bli\bia\bas\bs
3709 returns true unless a _\bn_\ba_\bm_\be is given for which no alias has been
3710 defined.
3711
3712 b\bbg\bg [_\bj_\bo_\bb_\bs_\bp_\be_\bc ...]
3713 Resume each suspended job _\bj_\bo_\bb_\bs_\bp_\be_\bc in the background, as if it
3714 had been started with &\b&. If _\bj_\bo_\bb_\bs_\bp_\be_\bc is not present, the shell's
3715 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
3716 run when job control is disabled or, when run with job control
3717 enabled, any specified _\bj_\bo_\bb_\bs_\bp_\be_\bc was not found or was started
3718 without job control.
3719
3720 b\bbi\bin\bnd\bd [-\b-m\bm _\bk_\be_\by_\bm_\ba_\bp] [-\b-l\blp\bps\bsv\bvP\bPS\bSV\bV]
3721 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]
3722 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
3723 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
3724 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
3725 b\bbi\bin\bnd\bd _\br_\be_\ba_\bd_\bl_\bi_\bn_\be_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd
3726 Display current r\bre\bea\bad\bdl\bli\bin\bne\be key and function bindings, bind a key
3727 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
3728 variable. Each non-option argument is a command as it would
3729 appear in _\b._\bi_\bn_\bp_\bu_\bt_\br_\bc, but each binding or command must be passed
3730 as a separate argument; e.g., '"\C-x\C-r": re-read-init-file'.
3731 Options, if supplied, have the following meanings:
3732 -\b-m\bm _\bk_\be_\by_\bm_\ba_\bp
3733 Use _\bk_\be_\by_\bm_\ba_\bp as the keymap to be affected by the subsequent
3734 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-
3735 _\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,
3736 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
3737 equivalent to _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\bd_\ba_\br_\bd.
3738 -\b-l\bl List the names of all r\bre\bea\bad\bdl\bli\bin\bne\be functions.
3739 -\b-p\bp Display r\bre\bea\bad\bdl\bli\bin\bne\be function names and bindings in such a
3740 way that they can be re-read.
3741 -\b-P\bP List current r\bre\bea\bad\bdl\bli\bin\bne\be function names and bindings.
3742 -\b-s\bs Display r\bre\bea\bad\bdl\bli\bin\bne\be key sequences bound to macros and the
3743 strings they output in such a way that they can be re-
3744 read.
3745 -\b-S\bS Display r\bre\bea\bad\bdl\bli\bin\bne\be key sequences bound to macros and the
3746 strings they output.
3747 -\b-v\bv Display r\bre\bea\bad\bdl\bli\bin\bne\be variable names and values in such a way
3748 that they can be re-read.
3749 -\b-V\bV List current r\bre\bea\bad\bdl\bli\bin\bne\be variable names and values.
3750 -\b-f\bf _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
3751 Read key bindings from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be.
3752 -\b-q\bq _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn
3753 Query about which keys invoke the named _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn.
3754 -\b-u\bu _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn
3755 Unbind all keys bound to the named _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn.
3756 -\b-r\br _\bk_\be_\by_\bs_\be_\bq
3757 Remove any current binding for _\bk_\be_\by_\bs_\be_\bq.
3758 -\b-x\bx _\bk_\be_\by_\bs_\be_\bq:\b:_\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd
3759 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
3760 entered. When _\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd is executed, the shell sets
3761 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-
3762 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
3763 current location of the insertion point. If the executed
3764 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-
3765 L\bLI\bIN\bNE\bE_\b_P\bPO\bOI\bIN\bNT\bT, those new values will be reflected in the
3766 editing state.
3767
3768 The return value is 0 unless an unrecognized option is given or
3769 an error occurred.
3770
3771 b\bbr\bre\bea\bak\bk [_\bn]
3772 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
3773 specified, break _\bn levels. _\bn must be >= 1. If _\bn is greater
3774 than the number of enclosing loops, all enclosing loops are
3775 exited. The return value is 0 unless _\bn is not greater than or
3776 equal to 1.
3777
3778 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]
3779 Execute the specified shell builtin, passing it _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs, and
3780 return its exit status. This is useful when defining a function
3781 whose name is the same as a shell builtin, retaining the func-
3782 tionality of the builtin within the function. The c\bcd\bd builtin is
3783 commonly redefined this way. The return status is false if
3784 _\bs_\bh_\be_\bl_\bl_\b-_\bb_\bu_\bi_\bl_\bt_\bi_\bn is not a shell builtin command.
3785
3786 c\bca\bal\bll\ble\ber\br [_\be_\bx_\bp_\br]
3787 Returns the context of any active subroutine call (a shell func-
3788 tion or a script executed with the .\b. or s\bso\bou\bur\brc\bce\be builtins. With-
3789 out _\be_\bx_\bp_\br, c\bca\bal\bll\ble\ber\br displays the line number and source filename of
3790 the current subroutine call. If a non-negative integer is sup-
3791 plied as _\be_\bx_\bp_\br, c\bca\bal\bll\ble\ber\br displays the line number, subroutine name,
3792 and source file corresponding to that position in the current
3793 execution call stack. This extra information may be used, for
3794 example, to print a stack trace. The current frame is frame 0.
3795 The return value is 0 unless the shell is not executing a sub-
3796 routine call or _\be_\bx_\bp_\br does not correspond to a valid position in
3797 the call stack.
3798
3799 c\bcd\bd [-\b-L\bL|\b|-\b-P\bP] [_\bd_\bi_\br]
3800 Change the current directory to _\bd_\bi_\br. The variable H\bHO\bOM\bME\bE is the
3801 default _\bd_\bi_\br. The variable C\bCD\bDP\bPA\bAT\bTH\bH defines the search path for
3802 the directory containing _\bd_\bi_\br. Alternative directory names in
3803 C\bCD\bDP\bPA\bAT\bTH\bH are separated by a colon (:). A null directory name in
3804 C\bCD\bDP\bPA\bAT\bTH\bH is the same as the current directory, i.e., ``.\b.''. If
3805 _\bd_\bi_\br begins with a slash (/), then C\bCD\bDP\bPA\bAT\bTH\bH is not used. The -\b-P\bP
3806 option says to use the physical directory structure instead of
3807 following symbolic links (see also the -\b-P\bP option to the s\bse\bet\bt
3808 builtin command); the -\b-L\bL option forces symbolic links to be fol-
3809 lowed. An argument of -\b- is equivalent to $\b$O\bOL\bLD\bDP\bPW\bWD\bD. If a non-
3810 empty directory name from C\bCD\bDP\bPA\bAT\bTH\bH is used, or if -\b- is the first
3811 argument, and the directory change is successful, the absolute
3812 pathname of the new working directory is written to the standard
3813 output. The return value is true if the directory was success-
3814 fully changed; false otherwise.
3815
3816 c\bco\bom\bmm\bma\ban\bnd\bd [-\b-p\bpV\bVv\bv] _\bc_\bo_\bm_\bm_\ba_\bn_\bd [_\ba_\br_\bg ...]
3817 Run _\bc_\bo_\bm_\bm_\ba_\bn_\bd with _\ba_\br_\bg_\bs suppressing the normal shell function
3818 lookup. Only builtin commands or commands found in the P\bPA\bAT\bTH\bH are
3819 executed. If the -\b-p\bp option is given, the search for _\bc_\bo_\bm_\bm_\ba_\bn_\bd is
3820 performed using a default value for P\bPA\bAT\bTH\bH that is guaranteed to
3821 find all of the standard utilities. If either the -\b-V\bV or -\b-v\bv
3822 option is supplied, a description of _\bc_\bo_\bm_\bm_\ba_\bn_\bd is printed. The -\b-v\bv
3823 option causes a single word indicating the command or file name
3824 used to invoke _\bc_\bo_\bm_\bm_\ba_\bn_\bd to be displayed; the -\b-V\bV option produces a
3825 more verbose description. If the -\b-V\bV or -\b-v\bv option is supplied,
3826 the exit status is 0 if _\bc_\bo_\bm_\bm_\ba_\bn_\bd was found, and 1 if not. If
3827 neither option is supplied and an error occurred or _\bc_\bo_\bm_\bm_\ba_\bn_\bd can-
3828 not be found, the exit status is 127. Otherwise, the exit sta-
3829 tus of the c\bco\bom\bmm\bma\ban\bnd\bd builtin is the exit status of _\bc_\bo_\bm_\bm_\ba_\bn_\bd.
3830
3831 c\bco\bom\bmp\bpg\bge\ben\bn [_\bo_\bp_\bt_\bi_\bo_\bn] [_\bw_\bo_\br_\bd]
3832 Generate possible completion matches for _\bw_\bo_\br_\bd according to the
3833 _\bo_\bp_\bt_\bi_\bo_\bns, which may be any option accepted by the c\bco\bom\bmp\bpl\ble\bet\bte\be
3834 builtin with the exception of -\b-p\bp and -\b-r\br, and write the matches
3835 to the standard output. When using the -\b-F\bF or -\b-C\bC options, the
3836 various shell variables set by the programmable completion
3837 facilities, while available, will not have useful values.
3838
3839 The matches will be generated in the same way as if the pro-
3840 grammable completion code had generated them directly from a
3841 completion specification with the same flags. If _\bw_\bo_\br_\bd is speci-
3842 fied, only those completions matching _\bw_\bo_\br_\bd will be displayed.
3843
3844 The return value is true unless an invalid option is supplied,
3845 or no matches were generated.
3846
3847 c\bco\bom\bmp\bpl\ble\bet\bte\be [-\b-a\bab\bbc\bcd\bde\bef\bfg\bgj\bjk\bks\bsu\buv\bv] [-\b-o\bo _\bc_\bo_\bm_\bp_\b-_\bo_\bp_\bt_\bi_\bo_\bn] [-\b-D\bDE\bE] [-\b-A\bA _\ba_\bc_\bt_\bi_\bo_\bn] [-\b-G\bG _\bg_\bl_\bo_\bb_\b-
3848 _\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]
3849 [-\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.]
3850 c\bco\bom\bmp\bpl\ble\bet\bte\be -\b-p\bpr\br [-\b-D\bDE\bE] [_\bn_\ba_\bm_\be ...]
3851 Specify how arguments to each _\bn_\ba_\bm_\be should be completed. If the
3852 -\b-p\bp option is supplied, or if no options are supplied, existing
3853 completion specifications are printed in a way that allows them
3854 to be reused as input. The -\b-r\br option removes a completion spec-
3855 ification for each _\bn_\ba_\bm_\be, or, if no _\bn_\ba_\bm_\bes are supplied, all com-
3856 pletion specifications. The -\b-D\bD option indicates that the
3857 remaining options and actions should apply to the ``default''
3858 command completion; that is, completion attempted on a command
3859 for which no completion has previously been defined. The -\b-E\bE
3860 option indicates that the remaining options and actions should
3861 apply to ``empty'' command completion; that is, completion
3862 attempted on a blank line.
3863
3864 The process of applying these completion specifications when
3865 word completion is attempted is described above under P\bPr\bro\bo-\b-
3866 g\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn.
3867
3868 Other options, if specified, have the following meanings. The
3869 arguments to the -\b-G\bG, -\b-W\bW, and -\b-X\bX options (and, if necessary, the
3870 -\b-P\bP and -\b-S\bS options) should be quoted to protect them from expan-
3871 sion before the c\bco\bom\bmp\bpl\ble\bet\bte\be builtin is invoked.
3872 -\b-o\bo _\bc_\bo_\bm_\bp_\b-_\bo_\bp_\bt_\bi_\bo_\bn
3873 The _\bc_\bo_\bm_\bp_\b-_\bo_\bp_\bt_\bi_\bo_\bn controls several aspects of the comp-
3874 spec's behavior beyond the simple generation of comple-
3875 tions. _\bc_\bo_\bm_\bp_\b-_\bo_\bp_\bt_\bi_\bo_\bn may be one of:
3876 b\bba\bas\bsh\bhd\bde\bef\bfa\bau\bul\blt\bt
3877 Perform the rest of the default b\bba\bas\bsh\bh completions
3878 if the compspec generates no matches.
3879 d\bde\bef\bfa\bau\bul\blt\bt Use readline's default filename completion if
3880 the compspec generates no matches.
3881 d\bdi\bir\brn\bna\bam\bme\bes\bs
3882 Perform directory name completion if the comp-
3883 spec generates no matches.
3884 f\bfi\bil\ble\ben\bna\bam\bme\bes\bs
3885 Tell readline that the compspec generates file-
3886 names, so it can perform any filename-specific
3887 processing (like adding a slash to directory
3888 names, quoting special characters, or suppress-
3889 ing trailing spaces). Intended to be used with
3890 shell functions.
3891 n\bno\bos\bsp\bpa\bac\bce\be Tell readline not to append a space (the
3892 default) to words completed at the end of the
3893 line.
3894 p\bpl\blu\bus\bsd\bdi\bir\brs\bs
3895 After any matches defined by the compspec are
3896 generated, directory name completion is
3897 attempted and any matches are added to the
3898 results of the other actions.
3899 -\b-A\bA _\ba_\bc_\bt_\bi_\bo_\bn
3900 The _\ba_\bc_\bt_\bi_\bo_\bn may be one of the following to generate a
3901 list of possible completions:
3902 a\bal\bli\bia\bas\bs Alias names. May also be specified as -\b-a\ba.
3903 a\bar\brr\bra\bay\byv\bva\bar\br
3904 Array variable names.
3905 b\bbi\bin\bnd\bdi\bin\bng\bg R\bRe\bea\bad\bdl\bli\bin\bne\be key binding names.
3906 b\bbu\bui\bil\blt\bti\bin\bn Names of shell builtin commands. May also be
3907 specified as -\b-b\bb.
3908 c\bco\bom\bmm\bma\ban\bnd\bd Command names. May also be specified as -\b-c\bc.
3909 d\bdi\bir\bre\bec\bct\bto\bor\bry\by
3910 Directory names. May also be specified as -\b-d\bd.
3911 d\bdi\bis\bsa\bab\bbl\ble\bed\bd
3912 Names of disabled shell builtins.
3913 e\ben\bna\bab\bbl\ble\bed\bd Names of enabled shell builtins.
3914 e\bex\bxp\bpo\bor\brt\bt Names of exported shell variables. May also be
3915 specified as -\b-e\be.
3916 f\bfi\bil\ble\be File names. May also be specified as -\b-f\bf.
3917 f\bfu\bun\bnc\bct\bti\bio\bon\bn
3918 Names of shell functions.
3919 g\bgr\bro\bou\bup\bp Group names. May also be specified as -\b-g\bg.
3920 h\bhe\bel\blp\bpt\bto\bop\bpi\bic\bc
3921 Help topics as accepted by the h\bhe\bel\blp\bp builtin.
3922 h\bho\bos\bst\btn\bna\bam\bme\be
3923 Hostnames, as taken from the file specified by
3924 the H\bHO\bOS\bST\bTF\bFI\bIL\bLE\bE shell variable.
3925 j\bjo\bob\bb Job names, if job control is active. May also
3926 be specified as -\b-j\bj.
3927 k\bke\bey\byw\bwo\bor\brd\bd Shell reserved words. May also be specified as
3928 -\b-k\bk.
3929 r\bru\bun\bnn\bni\bin\bng\bg Names of running jobs, if job control is active.
3930 s\bse\ber\brv\bvi\bic\bce\be Service names. May also be specified as -\b-s\bs.
3931 s\bse\bet\bto\bop\bpt\bt Valid arguments for the -\b-o\bo option to the s\bse\bet\bt
3932 builtin.
3933 s\bsh\bho\bop\bpt\bt Shell option names as accepted by the s\bsh\bho\bop\bpt\bt
3934 builtin.
3935 s\bsi\big\bgn\bna\bal\bl Signal names.
3936 s\bst\bto\bop\bpp\bpe\bed\bd Names of stopped jobs, if job control is active.
3937 u\bus\bse\ber\br User names. May also be specified as -\b-u\bu.
3938 v\bva\bar\bri\bia\bab\bbl\ble\be
3939 Names of all shell variables. May also be spec-
3940 ified as -\b-v\bv.
3941 -\b-G\bG _\bg_\bl_\bo_\bb_\bp_\ba_\bt
3942 The pathname expansion pattern _\bg_\bl_\bo_\bb_\bp_\ba_\bt is expanded to
3943 generate the possible completions.
3944 -\b-W\bW _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt
3945 The _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt is split using the characters in the I\bIF\bFS\bS
3946 special variable as delimiters, and each resultant word
3947 is expanded. The possible completions are the members
3948 of the resultant list which match the word being com-
3949 pleted.
3950 -\b-C\bC _\bc_\bo_\bm_\bm_\ba_\bn_\bd
3951 _\bc_\bo_\bm_\bm_\ba_\bn_\bd is executed in a subshell environment, and its
3952 output is used as the possible completions.
3953 -\b-F\bF _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn
3954 The shell function _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn is executed in the current
3955 shell environment. When it finishes, the possible com-
3956 pletions are retrieved from the value of the C\bCO\bOM\bMP\bPR\bRE\bEP\bPL\bLY\bY
3957 array variable.
3958 -\b-X\bX _\bf_\bi_\bl_\bt_\be_\br_\bp_\ba_\bt
3959 _\bf_\bi_\bl_\bt_\be_\br_\bp_\ba_\bt is a pattern as used for pathname expansion.
3960 It is applied to the list of possible completions gener-
3961 ated by the preceding options and arguments, and each
3962 completion matching _\bf_\bi_\bl_\bt_\be_\br_\bp_\ba_\bt is removed from the list.
3963 A leading !\b! in _\bf_\bi_\bl_\bt_\be_\br_\bp_\ba_\bt negates the pattern; in this
3964 case, any completion not matching _\bf_\bi_\bl_\bt_\be_\br_\bp_\ba_\bt is removed.
3965 -\b-P\bP _\bp_\br_\be_\bf_\bi_\bx
3966 _\bp_\br_\be_\bf_\bi_\bx is added at the beginning of each possible com-
3967 pletion after all other options have been applied.
3968 -\b-S\bS _\bs_\bu_\bf_\bf_\bi_\bx
3969 _\bs_\bu_\bf_\bf_\bi_\bx is appended to each possible completion after all
3970 other options have been applied.
3971
3972 The return value is true unless an invalid option is supplied,
3973 an option other than -\b-p\bp or -\b-r\br is supplied without a _\bn_\ba_\bm_\be argu-
3974 ment, an attempt is made to remove a completion specification
3975 for a _\bn_\ba_\bm_\be for which no specification exists, or an error occurs
3976 adding a completion specification.
3977
3978 c\bco\bom\bmp\bpo\bop\bpt\bt [-\b-o\bo _\bo_\bp_\bt_\bi_\bo_\bn] [-\b-D\bDE\bE] [+\b+o\bo _\bo_\bp_\bt_\bi_\bo_\bn] [_\bn_\ba_\bm_\be]
3979 Modify completion options for each _\bn_\ba_\bm_\be according to the
3980 _\bo_\bp_\bt_\bi_\bo_\bns, or for the currently-execution completion if no _\bn_\ba_\bm_\bes
3981 are supplied. If no _\bo_\bp_\bt_\bi_\bo_\bns are given, display the completion
3982 options for each _\bn_\ba_\bm_\be or the current completion. The possible
3983 values of _\bo_\bp_\bt_\bi_\bo_\bn are those valid for the c\bco\bom\bmp\bpl\ble\bet\bte\be builtin
3984 described above. The -\b-D\bD option indicates that the remaining
3985 options should apply to the ``default'' command completion; that
3986 is, completion attempted on a command for which no completion
3987 has previously been defined. The -\b-E\bE option indicates that the
3988 remaining options should apply to ``empty'' command completion;
3989 that is, completion attempted on a blank line.
3990
3991 The return value is true unless an invalid option is supplied, an
3992 attempt is made to modify the options for a _\bn_\ba_\bm_\be for which no comple-
3993 tion specification exists, or an output error occurs.
3994
3995 c\bco\bon\bnt\bti\bin\bnu\bue\be [_\bn]
3996 Resume the next iteration of the enclosing f\bfo\bor\br, w\bwh\bhi\bil\ble\be, u\bun\bnt\bti\bil\bl, or
3997 s\bse\bel\ble\bec\bct\bt loop. If _\bn is specified, resume at the _\bnth enclosing
3998 loop. _\bn must be >= 1. If _\bn is greater than the number of
3999 enclosing loops, the last enclosing loop (the ``top-level''
4000 loop) is resumed. The return value is 0 unless _\bn is not greater
4001 than or equal to 1.
4002
4003 d\bde\bec\bcl\bla\bar\bre\be [-\b-a\baA\bAf\bfF\bFi\bil\blr\brt\btu\bux\bx] [-\b-p\bp] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ...]
4004 t\bty\byp\bpe\bes\bse\bet\bt [-\b-a\baA\bAf\bfF\bFi\bil\blr\brt\btu\bux\bx] [-\b-p\bp] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ...]
4005 Declare variables and/or give them attributes. If no _\bn_\ba_\bm_\bes are
4006 given then display the values of variables. The -\b-p\bp option will
4007 display the attributes and values of each _\bn_\ba_\bm_\be. When -\b-p\bp is used
4008 with _\bn_\ba_\bm_\be arguments, additional options are ignored. When -\b-p\bp is
4009 supplied without _\bn_\ba_\bm_\be arguments, it will display the attributes
4010 and values of all variables having the attributes specified by
4011 the additional options. If no other options are supplied with
4012 -\b-p\bp, d\bde\bec\bcl\bla\bar\bre\be will display the attributes and values of all shell
4013 variables. The -\b-f\bf option will restrict the display to shell
4014 functions. The -\b-F\bF option inhibits the display of function defi-
4015 nitions; only the function name and attributes are printed. If
4016 the e\bex\bxt\btd\bde\beb\bbu\bug\bg shell option is enabled using s\bsh\bho\bop\bpt\bt, the source
4017 file name and line number where the function is defined are dis-
4018 played as well. The -\b-F\bF option implies -\b-f\bf. The following
4019 options can be used to restrict output to variables with the
4020 specified attribute or to give variables attributes:
4021 -\b-a\ba Each _\bn_\ba_\bm_\be is an indexed array variable (see A\bAr\brr\bra\bay\bys\bs
4022 above).
4023 -\b-A\bA Each _\bn_\ba_\bm_\be is an associative array variable (see A\bAr\brr\bra\bay\bys\bs
4024 above).
4025 -\b-f\bf Use function names only.
4026 -\b-i\bi The variable is treated as an integer; arithmetic evalua-
4027 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
4028 the variable is assigned a value.
4029 -\b-l\bl When the variable is assigned a value, all upper-case
4030 characters are converted to lower-case. The upper-case
4031 attribute is disabled.
4032 -\b-r\br Make _\bn_\ba_\bm_\bes readonly. These names cannot then be assigned
4033 values by subsequent assignment statements or unset.
4034 -\b-t\bt Give each _\bn_\ba_\bm_\be the _\bt_\br_\ba_\bc_\be attribute. Traced functions
4035 inherit the D\bDE\bEB\bBU\bUG\bG and R\bRE\bET\bTU\bUR\bRN\bN traps from the calling
4036 shell. The trace attribute has no special meaning for
4037 variables.
4038 -\b-u\bu When the variable is assigned a value, all lower-case
4039 characters are converted to upper-case. The lower-case
4040 attribute is disabled.
4041 -\b-x\bx Mark _\bn_\ba_\bm_\bes for export to subsequent commands via the
4042 environment.
4043
4044 Using `+' instead of `-' turns off the attribute instead, with
4045 the exceptions that +\b+a\ba may not be used to destroy an array vari-
4046 able and +\b+r\br will not remove the readonly attribute. When used
4047 in a function, makes each _\bn_\ba_\bm_\be local, as with the l\blo\boc\bca\bal\bl command.
4048 If a variable name is followed by =_\bv_\ba_\bl_\bu_\be, the value of the vari-
4049 able is set to _\bv_\ba_\bl_\bu_\be. The return value is 0 unless an invalid
4050 option is encountered, an attempt is made to define a function
4051 using ``-f foo=bar'', an attempt is made to assign a value to a
4052 readonly variable, an attempt is made to assign a value to an
4053 array variable without using the compound assignment syntax (see
4054 A\bAr\brr\bra\bay\bys\bs above), one of the _\bn_\ba_\bm_\be_\bs is not a valid shell variable
4055 name, an attempt is made to turn off readonly status for a read-
4056 only variable, an attempt is made to turn off array status for
4057 an array variable, or an attempt is made to display a non-exis-
4058 tent function with -\b-f\bf.
4059
4060 d\bdi\bir\brs\bs [\b[+\b+_\bn]\b] [\b[-\b-_\bn]\b] [\b[-\b-c\bcp\bpl\blv\bv]\b]
4061 Without options, displays the list of currently remembered
4062 directories. The default display is on a single line with
4063 directory names separated by spaces. Directories are added to
4064 the list with the p\bpu\bus\bsh\bhd\bd command; the p\bpo\bop\bpd\bd command removes
4065 entries from the list.
4066 +\b+_\bn Displays the _\bnth entry counting from the left of the list
4067 shown by d\bdi\bir\brs\bs when invoked without options, starting with
4068 zero.
4069 -\b-_\bn Displays the _\bnth entry counting from the right of the
4070 list shown by d\bdi\bir\brs\bs when invoked without options, starting
4071 with zero.
4072 -\b-c\bc Clears the directory stack by deleting all of the
4073 entries.
4074 -\b-l\bl Produces a longer listing; the default listing format
4075 uses a tilde to denote the home directory.
4076 -\b-p\bp Print the directory stack with one entry per line.
4077 -\b-v\bv Print the directory stack with one entry per line, pre-
4078 fixing each entry with its index in the stack.
4079
4080 The return value is 0 unless an invalid option is supplied or _\bn
4081 indexes beyond the end of the directory stack.
4082
4083 d\bdi\bis\bso\bow\bwn\bn [-\b-a\bar\br] [-\b-h\bh] [_\bj_\bo_\bb_\bs_\bp_\be_\bc ...]
4084 Without options, each _\bj_\bo_\bb_\bs_\bp_\be_\bc is removed from the table of
4085 active jobs. If _\bj_\bo_\bb_\bs_\bp_\be_\bc is not present, and neither -\b-a\ba nor -\b-r\br
4086 is supplied, the shell's notion of the _\bc_\bu_\br_\br_\be_\bn_\bt _\bj_\bo_\bb is used. If
4087 the -\b-h\bh option is given, each _\bj_\bo_\bb_\bs_\bp_\be_\bc is not removed from the ta-
4088 ble, but is marked so that S\bSI\bIG\bGH\bHU\bUP\bP is not sent to the job if the
4089 shell receives a S\bSI\bIG\bGH\bHU\bUP\bP. If no _\bj_\bo_\bb_\bs_\bp_\be_\bc is present, and neither
4090 the -\b-a\ba nor the -\b-r\br option is supplied, the _\bc_\bu_\br_\br_\be_\bn_\bt _\bj_\bo_\bb is used.
4091 If no _\bj_\bo_\bb_\bs_\bp_\be_\bc is supplied, the -\b-a\ba option means to remove or mark
4092 all jobs; the -\b-r\br option without a _\bj_\bo_\bb_\bs_\bp_\be_\bc argument restricts
4093 operation to running jobs. The return value is 0 unless a _\bj_\bo_\bb_\b-
4094 _\bs_\bp_\be_\bc does not specify a valid job.
4095
4096 e\bec\bch\bho\bo [-\b-n\bne\beE\bE] [_\ba_\br_\bg ...]
4097 Output the _\ba_\br_\bgs, separated by spaces, followed by a newline.
4098 The return status is always 0. If -\b-n\bn is specified, the trailing
4099 newline is suppressed. If the -\b-e\be option is given, interpreta-
4100 tion of the following backslash-escaped characters is enabled.
4101 The -\b-E\bE option disables the interpretation of these escape char-
4102 acters, even on systems where they are interpreted by default.
4103 The x\bxp\bpg\bg_\b_e\bec\bch\bho\bo shell option may be used to dynamically determine
4104 whether or not e\bec\bch\bho\bo expands these escape characters by default.
4105 e\bec\bch\bho\bo does not interpret -\b--\b- to mean the end of options. e\bec\bch\bho\bo
4106 interprets the following escape sequences:
4107 \\b\a\ba alert (bell)
4108 \\b\b\bb backspace
4109 \\b\c\bc suppress further output
4110 \\b\e\be an escape character
4111 \\b\f\bf form feed
4112 \\b\n\bn new line
4113 \\b\r\br carriage return
4114 \\b\t\bt horizontal tab
4115 \\b\v\bv vertical tab
4116 \\b\\\b\ backslash
4117 \\b\0\b0_\bn_\bn_\bn the eight-bit character whose value is the octal value
4118 _\bn_\bn_\bn (zero to three octal digits)
4119 \\b\x\bx_\bH_\bH the eight-bit character whose value is the hexadecimal
4120 value _\bH_\bH (one or two hex digits)
4121
4122 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 ...]
4123 Enable and disable builtin shell commands. Disabling a builtin
4124 allows a disk command which has the same name as a shell builtin
4125 to be executed without specifying a full pathname, even though
4126 the shell normally searches for builtins before disk commands.
4127 If -\b-n\bn is used, each _\bn_\ba_\bm_\be is disabled; otherwise, _\bn_\ba_\bm_\be_\bs are
4128 enabled. For example, to use the t\bte\bes\bst\bt binary found via the P\bPA\bAT\bTH\bH
4129 instead of the shell builtin version, run ``enable -n test''.
4130 The -\b-f\bf option means to load the new builtin command _\bn_\ba_\bm_\be from
4131 shared object _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be, on systems that support dynamic loading.
4132 The -\b-d\bd option will delete a builtin previously loaded with -\b-f\bf.
4133 If no _\bn_\ba_\bm_\be arguments are given, or if the -\b-p\bp option is supplied,
4134 a list of shell builtins is printed. With no other option argu-
4135 ments, the list consists of all enabled shell builtins. If -\b-n\bn
4136 is supplied, only disabled builtins are printed. If -\b-a\ba is sup-
4137 plied, the list printed includes all builtins, with an indica-
4138 tion of whether or not each is enabled. If -\b-s\bs is supplied, the
4139 output is restricted to the POSIX _\bs_\bp_\be_\bc_\bi_\ba_\bl builtins. The return
4140 value is 0 unless a _\bn_\ba_\bm_\be is not a shell builtin or there is an
4141 error loading a new builtin from a shared object.
4142
4143 e\bev\bva\bal\bl [_\ba_\br_\bg ...]
4144 The _\ba_\br_\bgs are read and concatenated together into a single com-
4145 mand. This command is then read and executed by the shell, and
4146 its exit status is returned as the value of e\bev\bva\bal\bl. If there are
4147 no _\ba_\br_\bg_\bs, or only null arguments, e\bev\bva\bal\bl returns 0.
4148
4149 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]]
4150 If _\bc_\bo_\bm_\bm_\ba_\bn_\bd is specified, it replaces the shell. No new process
4151 is created. The _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs become the arguments to _\bc_\bo_\bm_\bm_\ba_\bn_\bd. If
4152 the -\b-l\bl option is supplied, the shell places a dash at the begin-
4153 ning of the zeroth argument passed to _\bc_\bo_\bm_\bm_\ba_\bn_\bd. This is what
4154 _\bl_\bo_\bg_\bi_\bn(1) does. The -\b-c\bc option causes _\bc_\bo_\bm_\bm_\ba_\bn_\bd to be executed with
4155 an empty environment. If -\b-a\ba is supplied, the shell passes _\bn_\ba_\bm_\be
4156 as the zeroth argument to the executed command. If _\bc_\bo_\bm_\bm_\ba_\bn_\bd can-
4157 not be executed for some reason, a non-interactive shell exits,
4158 unless the shell option e\bex\bxe\bec\bcf\bfa\bai\bil\bl is enabled, in which case it
4159 returns failure. An interactive shell returns failure if the
4160 file cannot be executed. If _\bc_\bo_\bm_\bm_\ba_\bn_\bd is not specified, any redi-
4161 rections take effect in the current shell, and the return status
4162 is 0. If there is a redirection error, the return status is 1.
4163
4164 e\bex\bxi\bit\bt [_\bn]
4165 Cause the shell to exit with a status of _\bn. If _\bn is omitted,
4166 the exit status is that of the last command executed. A trap on
4167 E\bEX\bXI\bIT\bT is executed before the shell terminates.
4168
4169 e\bex\bxp\bpo\bor\brt\bt [-\b-f\bfn\bn] [_\bn_\ba_\bm_\be[=_\bw_\bo_\br_\bd]] ...
4170 e\bex\bxp\bpo\bor\brt\bt -\b-p\bp
4171 The supplied _\bn_\ba_\bm_\be_\bs are marked for automatic export to the envi-
4172 ronment of subsequently executed commands. If the -\b-f\bf option is
4173 given, the _\bn_\ba_\bm_\be_\bs refer to functions. If no _\bn_\ba_\bm_\be_\bs are given, or
4174 if the -\b-p\bp option is supplied, a list of all names that are
4175 exported in this shell is printed. The -\b-n\bn option causes the
4176 export property to be removed from each _\bn_\ba_\bm_\be. If a variable
4177 name is followed by =_\bw_\bo_\br_\bd, the value of the variable is set to
4178 _\bw_\bo_\br_\bd. e\bex\bxp\bpo\bor\brt\bt returns an exit status of 0 unless an invalid
4179 option is encountered, one of the _\bn_\ba_\bm_\be_\bs is not a valid shell
4180 variable name, or -\b-f\bf is supplied with a _\bn_\ba_\bm_\be that is not a func-
4181 tion.
4182
4183 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]
4184 f\bfc\bc -\b-s\bs [_\bp_\ba_\bt=_\br_\be_\bp] [_\bc_\bm_\bd]
4185 Fix Command. In the first form, a range of commands from _\bf_\bi_\br_\bs_\bt
4186 to _\bl_\ba_\bs_\bt is selected from the history list. _\bF_\bi_\br_\bs_\bt and _\bl_\ba_\bs_\bt may
4187 be specified as a string (to locate the last command beginning
4188 with that string) or as a number (an index into the history
4189 list, where a negative number is used as an offset from the cur-
4190 rent command number). If _\bl_\ba_\bs_\bt is not specified it is set to the
4191 current command for listing (so that ``fc -l -10'' prints the
4192 last 10 commands) and to _\bf_\bi_\br_\bs_\bt otherwise. If _\bf_\bi_\br_\bs_\bt is not spec-
4193 ified it is set to the previous command for editing and -16 for
4194 listing.
4195
4196 The -\b-n\bn option suppresses the command numbers when listing. The
4197 -\b-r\br option reverses the order of the commands. If the -\b-l\bl option
4198 is given, the commands are listed on standard output. Other-
4199 wise, the editor given by _\be_\bn_\ba_\bm_\be is invoked on a file containing
4200 those commands. If _\be_\bn_\ba_\bm_\be is not given, the value of the F\bFC\bCE\bED\bDI\bIT\bT
4201 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.
4202 If neither variable is set, _\bv_\bi is used. When editing is com-
4203 plete, the edited commands are echoed and executed.
4204
4205 In the second form, _\bc_\bo_\bm_\bm_\ba_\bn_\bd is re-executed after each instance
4206 of _\bp_\ba_\bt is replaced by _\br_\be_\bp. A useful alias to use with this is
4207 ``r="fc -s"'', so that typing ``r cc'' runs the last command
4208 beginning with ``cc'' and typing ``r'' re-executes the last com-
4209 mand.
4210
4211 If the first form is used, the return value is 0 unless an
4212 invalid option is encountered or _\bf_\bi_\br_\bs_\bt or _\bl_\ba_\bs_\bt specify history
4213 lines out of range. If the -\b-e\be option is supplied, the return
4214 value is the value of the last command executed or failure if an
4215 error occurs with the temporary file of commands. If the second
4216 form is used, the return status is that of the command re-exe-
4217 cuted, unless _\bc_\bm_\bd does not specify a valid history line, in
4218 which case f\bfc\bc returns failure.
4219
4220 f\bfg\bg [_\bj_\bo_\bb_\bs_\bp_\be_\bc]
4221 Resume _\bj_\bo_\bb_\bs_\bp_\be_\bc in the foreground, and make it the current job.
4222 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
4223 is used. The return value is that of the command placed into
4224 the foreground, or failure if run when job control is disabled
4225 or, when run with job control enabled, if _\bj_\bo_\bb_\bs_\bp_\be_\bc does not spec-
4226 ify a valid job or _\bj_\bo_\bb_\bs_\bp_\be_\bc specifies a job that was started
4227 without job control.
4228
4229 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]
4230 g\bge\bet\bto\bop\bpt\bts\bs is used by shell procedures to parse positional parame-
4231 ters. _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg contains the option characters to be recog-
4232 nized; if a character is followed by a colon, the option is
4233 expected to have an argument, which should be separated from it
4234 by white space. The colon and question mark characters may not
4235 be used as option characters. Each time it is invoked, g\bge\bet\bto\bop\bpt\bts\bs
4236 places the next option in the shell variable _\bn_\ba_\bm_\be, initializing
4237 _\bn_\ba_\bm_\be if it does not exist, and the index of the next argument to
4238 be processed into the variable O\bOP\bPT\bTI\bIN\bND\bD. O\bOP\bPT\bTI\bIN\bND\bD is initialized to
4239 1 each time the shell or a shell script is invoked. When an
4240 option requires an argument, g\bge\bet\bto\bop\bpt\bts\bs places that argument into
4241 the variable O\bOP\bPT\bTA\bAR\bRG\bG. The shell does not reset O\bOP\bPT\bTI\bIN\bND\bD automati-
4242 cally; it must be manually reset between multiple calls to
4243 g\bge\bet\bto\bop\bpt\bts\bs within the same shell invocation if a new set of parame-
4244 ters is to be used.
4245
4246 When the end of options is encountered, g\bge\bet\bto\bop\bpt\bts\bs exits with a
4247 return value greater than zero. O\bOP\bPT\bTI\bIN\bND\bD is set to the index of
4248 the first non-option argument, and n\bna\bam\bme\be is set to ?.
4249
4250 g\bge\bet\bto\bop\bpt\bts\bs normally parses the positional parameters, but if more
4251 arguments are given in _\ba_\br_\bg_\bs, g\bge\bet\bto\bop\bpt\bts\bs parses those instead.
4252
4253 g\bge\bet\bto\bop\bpt\bts\bs can report errors in two ways. If the first character
4254 of _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg is a colon, _\bs_\bi_\bl_\be_\bn_\bt error reporting is used. In
4255 normal operation diagnostic messages are printed when invalid
4256 options or missing option arguments are encountered. If the
4257 variable O\bOP\bPT\bTE\bER\bRR\bR is set to 0, no error messages will be dis-
4258 played, even if the first character of _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg is not a colon.
4259
4260 If an invalid option is seen, g\bge\bet\bto\bop\bpt\bts\bs places ? into _\bn_\ba_\bm_\be and, if
4261 not silent, prints an error message and unsets O\bOP\bPT\bTA\bAR\bRG\bG. If
4262 g\bge\bet\bto\bop\bpt\bts\bs is silent, the option character found is placed in
4263 O\bOP\bPT\bTA\bAR\bRG\bG and no diagnostic message is printed.
4264
4265 If a required argument is not found, and g\bge\bet\bto\bop\bpt\bts\bs is not silent,
4266 a question mark (?\b?) is placed in _\bn_\ba_\bm_\be, O\bOP\bPT\bTA\bAR\bRG\bG is unset, and a
4267 diagnostic message is printed. If g\bge\bet\bto\bop\bpt\bts\bs is silent, then a
4268 colon (:\b:) is placed in _\bn_\ba_\bm_\be and O\bOP\bPT\bTA\bAR\bRG\bG is set to the option
4269 character found.
4270
4271 g\bge\bet\bto\bop\bpt\bts\bs returns true if an option, specified or unspecified, is
4272 found. It returns false if the end of options is encountered or
4273 an error occurs.
4274
4275 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]
4276 For each _\bn_\ba_\bm_\be, the full file name of the command is determined
4277 by searching the directories in $\b$P\bPA\bAT\bTH\bH and remembered. If the -\b-p\bp
4278 option is supplied, no path search is performed, and _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is
4279 used as the full file name of the command. The -\b-r\br option causes
4280 the shell to forget all remembered locations. The -\b-d\bd option
4281 causes the shell to forget the remembered location of each _\bn_\ba_\bm_\be.
4282 If the -\b-t\bt option is supplied, the full pathname to which each
4283 _\bn_\ba_\bm_\be corresponds is printed. If multiple _\bn_\ba_\bm_\be arguments are
4284 supplied with -\b-t\bt, the _\bn_\ba_\bm_\be is printed before the hashed full
4285 pathname. The -\b-l\bl option causes output to be displayed in a for-
4286 mat that may be reused as input. If no arguments are given, or
4287 if only -\b-l\bl is supplied, information about remembered commands is
4288 printed. The return status is true unless a _\bn_\ba_\bm_\be is not found
4289 or an invalid option is supplied.
4290
4291 h\bhe\bel\blp\bp [-\b-d\bdm\bms\bs] [_\bp_\ba_\bt_\bt_\be_\br_\bn]
4292 Display helpful information about builtin commands. If _\bp_\ba_\bt_\bt_\be_\br_\bn
4293 is specified, h\bhe\bel\blp\bp gives detailed help on all commands matching
4294 _\bp_\ba_\bt_\bt_\be_\br_\bn; otherwise help for all the builtins and shell control
4295 structures is printed.
4296 -\b-d\bd Display a short description of each _\bp_\ba_\bt_\bt_\be_\br_\bn
4297 -\b-m\bm Display the description of each _\bp_\ba_\bt_\bt_\be_\br_\bn in a manpage-like
4298 format
4299 -\b-s\bs Display only a short usage synopsis for each _\bp_\ba_\bt_\bt_\be_\br_\bn
4300 The return status is 0 unless no command matches _\bp_\ba_\bt_\bt_\be_\br_\bn.
4301
4302 h\bhi\bis\bst\bto\bor\bry\by [\b[_\bn]\b]
4303 h\bhi\bis\bst\bto\bor\bry\by -\b-c\bc
4304 h\bhi\bis\bst\bto\bor\bry\by -\b-d\bd _\bo_\bf_\bf_\bs_\be_\bt
4305 h\bhi\bis\bst\bto\bor\bry\by -\b-a\ban\bnr\brw\bw [_\bf_\bi_\bl_\be_\bn_\ba_\bm_\be]
4306 h\bhi\bis\bst\bto\bor\bry\by -\b-p\bp _\ba_\br_\bg [_\ba_\br_\bg _\b._\b._\b.]
4307 h\bhi\bis\bst\bto\bor\bry\by -\b-s\bs _\ba_\br_\bg [_\ba_\br_\bg _\b._\b._\b.]
4308 With no options, display the command history list with line num-
4309 bers. Lines listed with a *\b* have been modified. An argument of
4310 _\bn lists only the last _\bn lines. If the shell variable H\bHI\bIS\bST\bTT\bTI\bIM\bME\bE-\b-
4311 F\bFO\bOR\bRM\bMA\bAT\bT is set and not null, it is used as a format string for
4312 _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be(3) to display the time stamp associated with each dis-
4313 played history entry. No intervening blank is printed between
4314 the formatted time stamp and the history line. If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is
4315 supplied, it is used as the name of the history file; if not,
4316 the value of H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is used. Options, if supplied, have the
4317 following meanings:
4318 -\b-c\bc Clear the history list by deleting all the entries.
4319 -\b-d\bd _\bo_\bf_\bf_\bs_\be_\bt
4320 Delete the history entry at position _\bo_\bf_\bf_\bs_\be_\bt.
4321 -\b-a\ba Append the ``new'' history lines (history lines entered
4322 since the beginning of the current b\bba\bas\bsh\bh session) to the
4323 history file.
4324 -\b-n\bn Read the history lines not already read from the history
4325 file into the current history list. These are lines
4326 appended to the history file since the beginning of the
4327 current b\bba\bas\bsh\bh session.
4328 -\b-r\br Read the contents of the history file and use them as the
4329 current history.
4330 -\b-w\bw Write the current history to the history file, overwrit-
4331 ing the history file's contents.
4332 -\b-p\bp Perform history substitution on the following _\ba_\br_\bg_\bs and
4333 display the result on the standard output. Does not
4334 store the results in the history list. Each _\ba_\br_\bg must be
4335 quoted to disable normal history expansion.
4336 -\b-s\bs Store the _\ba_\br_\bg_\bs in the history list as a single entry.
4337 The last command in the history list is removed before
4338 the _\ba_\br_\bg_\bs are added.
4339
4340 If the H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT variable is set, the time stamp informa-
4341 tion associated with each history entry is written to the his-
4342 tory file, marked with the history comment character. When the
4343 history file is read, lines beginning with the history comment
4344 character followed immediately by a digit are interpreted as
4345 timestamps for the previous history line. The return value is 0
4346 unless an invalid option is encountered, an error occurs while
4347 reading or writing the history file, an invalid _\bo_\bf_\bf_\bs_\be_\bt is sup-
4348 plied as an argument to -\b-d\bd, or the history expansion supplied as
4349 an argument to -\b-p\bp fails.
4350
4351 j\bjo\bob\bbs\bs [-\b-l\bln\bnp\bpr\brs\bs] [ _\bj_\bo_\bb_\bs_\bp_\be_\bc ... ]
4352 j\bjo\bob\bbs\bs -\b-x\bx _\bc_\bo_\bm_\bm_\ba_\bn_\bd [ _\ba_\br_\bg_\bs ... ]
4353 The first form lists the active jobs. The options have the fol-
4354 lowing meanings:
4355 -\b-l\bl List process IDs in addition to the normal information.
4356 -\b-p\bp List only the process ID of the job's process group
4357 leader.
4358 -\b-n\bn Display information only about jobs that have changed
4359 status since the user was last notified of their status.
4360 -\b-r\br Restrict output to running jobs.
4361 -\b-s\bs Restrict output to stopped jobs.
4362
4363 If _\bj_\bo_\bb_\bs_\bp_\be_\bc is given, output is restricted to information about
4364 that job. The return status is 0 unless an invalid option is
4365 encountered or an invalid _\bj_\bo_\bb_\bs_\bp_\be_\bc is supplied.
4366
4367 If the -\b-x\bx option is supplied, j\bjo\bob\bbs\bs replaces any _\bj_\bo_\bb_\bs_\bp_\be_\bc found in
4368 _\bc_\bo_\bm_\bm_\ba_\bn_\bd or _\ba_\br_\bg_\bs with the corresponding process group ID, and
4369 executes _\bc_\bo_\bm_\bm_\ba_\bn_\bd passing it _\ba_\br_\bg_\bs, returning its exit status.
4370
4371 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] ...
4372 k\bki\bil\bll\bl -\b-l\bl [_\bs_\bi_\bg_\bs_\bp_\be_\bc | _\be_\bx_\bi_\bt_\b__\bs_\bt_\ba_\bt_\bu_\bs]
4373 Send the signal named by _\bs_\bi_\bg_\bs_\bp_\be_\bc or _\bs_\bi_\bg_\bn_\bu_\bm to the processes
4374 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
4375 signal name such as S\bSI\bIG\bGK\bKI\bIL\bLL\bL (with or without the S\bSI\bIG\bG prefix) or
4376 a signal number; _\bs_\bi_\bg_\bn_\bu_\bm is a signal number. If _\bs_\bi_\bg_\bs_\bp_\be_\bc is not
4377 present, then S\bSI\bIG\bGT\bTE\bER\bRM\bM is assumed. An argument of -\b-l\bl lists the
4378 signal names. If any arguments are supplied when -\b-l\bl is given,
4379 the names of the signals corresponding to the arguments are
4380 listed, and the return status is 0. The _\be_\bx_\bi_\bt_\b__\bs_\bt_\ba_\bt_\bu_\bs argument to
4381 -\b-l\bl is a number specifying either a signal number or the exit
4382 status of a process terminated by a signal. k\bki\bil\bll\bl returns true
4383 if at least one signal was successfully sent, or false if an
4384 error occurs or an invalid option is encountered.
4385
4386 l\ble\bet\bt _\ba_\br_\bg [_\ba_\br_\bg ...]
4387 Each _\ba_\br_\bg is an arithmetic expression to be evaluated (see A\bAR\bRI\bIT\bTH\bH-\b-
4388 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
4389 returns 1; 0 is returned otherwise.
4390
4391 l\blo\boc\bca\bal\bl [_\bo_\bp_\bt_\bi_\bo_\bn] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ...]
4392 For each argument, a local variable named _\bn_\ba_\bm_\be is created, and
4393 assigned _\bv_\ba_\bl_\bu_\be. The _\bo_\bp_\bt_\bi_\bo_\bn can be any of the options accepted
4394 by d\bde\bec\bcl\bla\bar\bre\be. When l\blo\boc\bca\bal\bl is used within a function, it causes the
4395 variable _\bn_\ba_\bm_\be to have a visible scope restricted to that func-
4396 tion and its children. With no operands, l\blo\boc\bca\bal\bl writes a list of
4397 local variables to the standard output. It is an error to use
4398 l\blo\boc\bca\bal\bl when not within a function. The return status is 0 unless
4399 l\blo\boc\bca\bal\bl is used outside a function, an invalid _\bn_\ba_\bm_\be is supplied,
4400 or _\bn_\ba_\bm_\be is a readonly variable.
4401
4402 l\blo\bog\bgo\bou\but\bt Exit a login shell.
4403
4404 m\bma\bap\bpf\bfi\bil\ble\be [-\b-n\bn _\bc_\bo_\bu_\bn_\bt] [-\b-O\bO _\bo_\br_\bi_\bg_\bi_\bn] [-\b-s\bs _\bc_\bo_\bu_\bn_\bt] [-\b-t\bt] [-\b-u\bu _\bf_\bd] [-\b-C\bC _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk]
4405 [-\b-c\bc _\bq_\bu_\ba_\bn_\bt_\bu_\bm] [_\ba_\br_\br_\ba_\by]
4406 r\bre\bea\bad\bda\bar\brr\bra\bay\by [-\b-n\bn _\bc_\bo_\bu_\bn_\bt] [-\b-O\bO _\bo_\br_\bi_\bg_\bi_\bn] [-\b-s\bs _\bc_\bo_\bu_\bn_\bt] [-\b-t\bt] [-\b-u\bu _\bf_\bd] [-\b-C\bC _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk]
4407 [-\b-c\bc _\bq_\bu_\ba_\bn_\bt_\bu_\bm] [_\ba_\br_\br_\ba_\by]
4408 Read lines from the standard input into the indexed array vari-
4409 able _\ba_\br_\br_\ba_\by, or from file descriptor _\bf_\bd if the -\b-u\bu option is sup-
4410 plied. The variable M\bMA\bAP\bPF\bFI\bIL\bLE\bE is the default _\ba_\br_\br_\ba_\by. Options, if
4411 supplied, have the following meanings:
4412 -\b-n\bn Copy at most _\bc_\bo_\bu_\bn_\bt lines. If _\bc_\bo_\bu_\bn_\bt is 0, all lines are
4413 copied.
4414 -\b-O\bO Begin assigning to _\ba_\br_\br_\ba_\by at index _\bo_\br_\bi_\bg_\bi_\bn. The default
4415 index is 0.
4416 -\b-s\bs Discard the first _\bc_\bo_\bu_\bn_\bt lines read.
4417 -\b-t\bt Remove a trailing newline from each line read.
4418 -\b-u\bu Read lines from file descriptor _\bf_\bd instead of the stan-
4419 dard input.
4420 -\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
4421 -\b-c\bc option specifies _\bq_\bu_\ba_\bn_\bt_\bu_\bm.
4422 -\b-c\bc Specify the number of lines read between each call to
4423 _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk.
4424
4425 If -\b-C\bC is specified without -\b-c\bc, the default quantum is 5000.
4426 When _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk is evaluated, it is supplied the index of the next
4427 array element to be assigned as an additional argument. _\bc_\ba_\bl_\bl_\b-
4428 _\bb_\ba_\bc_\bk is evaluated after the line is read but before the array
4429 element is assigned.
4430
4431 If not supplied with an explicit origin, m\bma\bap\bpf\bfi\bil\ble\be will clear
4432 _\ba_\br_\br_\ba_\by before assigning to it.
4433
4434 m\bma\bap\bpf\bfi\bil\ble\be returns successfully unless an invalid option or option
4435 argument is supplied, _\ba_\br_\br_\ba_\by is invalid or unassignable, or if
4436 _\ba_\br_\br_\ba_\by is not an indexed array.
4437
4438 p\bpo\bop\bpd\bd [-n\bn] [+_\bn] [-_\bn]
4439 Removes entries from the directory stack. With no arguments,
4440 removes the top directory from the stack, and performs a c\bcd\bd to
4441 the new top directory. Arguments, if supplied, have the follow-
4442 ing meanings:
4443 -\b-n\bn Suppresses the normal change of directory when removing
4444 directories from the stack, so that only the stack is
4445 manipulated.
4446 +\b+_\bn Removes the _\bnth entry counting from the left of the list
4447 shown by d\bdi\bir\brs\bs, starting with zero. For example: ``popd
4448 +0'' removes the first directory, ``popd +1'' the second.
4449 -\b-_\bn Removes the _\bnth entry counting from the right of the list
4450 shown by d\bdi\bir\brs\bs, starting with zero. For example: ``popd
4451 -0'' removes the last directory, ``popd -1'' the next to
4452 last.
4453
4454 If the p\bpo\bop\bpd\bd command is successful, a d\bdi\bir\brs\bs is performed as well,
4455 and the return status is 0. p\bpo\bop\bpd\bd returns false if an invalid
4456 option is encountered, the directory stack is empty, a non-exis-
4457 tent directory stack entry is specified, or the directory change
4458 fails.
4459
4460 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]
4461 Write the formatted _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs to the standard output under the
4462 control of the _\bf_\bo_\br_\bm_\ba_\bt. The _\bf_\bo_\br_\bm_\ba_\bt is a character string which
4463 contains three types of objects: plain characters, which are
4464 simply copied to standard output, character escape sequences,
4465 which are converted and copied to the standard output, and for-
4466 mat specifications, each of which causes printing of the next
4467 successive _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt. In addition to the standard _\bp_\br_\bi_\bn_\bt_\bf(1) for-
4468 mats, %\b%b\bb causes p\bpr\bri\bin\bnt\btf\bf to expand backslash escape sequences in
4469 the corresponding _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt (except that \\b\c\bc terminates output,
4470 backslashes in \\b\'\b', \\b\"\b", and \\b\?\b? are not removed, and octal escapes
4471 beginning with \\b\0\b0 may contain up to four digits), and %\b%q\bq causes
4472 p\bpr\bri\bin\bnt\btf\bf to output the corresponding _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt in a format that can
4473 be reused as shell input.
4474
4475 The -\b-v\bv option causes the output to be assigned to the variable
4476 _\bv_\ba_\br rather than being printed to the standard output.
4477
4478 The _\bf_\bo_\br_\bm_\ba_\bt is reused as necessary to consume all of the _\ba_\br_\bg_\bu_\b-
4479 _\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,
4480 the extra format specifications behave as if a zero value or
4481 null string, as appropriate, had been supplied. The return
4482 value is zero on success, non-zero on failure.
4483
4484 p\bpu\bus\bsh\bhd\bd [-\b-n\bn] [+_\bn] [-_\bn]
4485 p\bpu\bus\bsh\bhd\bd [-\b-n\bn] [_\bd_\bi_\br]
4486 Adds a directory to the top of the directory stack, or rotates
4487 the stack, making the new top of the stack the current working
4488 directory. With no arguments, exchanges the top two directories
4489 and returns 0, unless the directory stack is empty. Arguments,
4490 if supplied, have the following meanings:
4491 -\b-n\bn Suppresses the normal change of directory when adding
4492 directories to the stack, so that only the stack is
4493 manipulated.
4494 +\b+_\bn Rotates the stack so that the _\bnth directory (counting
4495 from the left of the list shown by d\bdi\bir\brs\bs, starting with
4496 zero) is at the top.
4497 -\b-_\bn Rotates the stack so that the _\bnth directory (counting
4498 from the right of the list shown by d\bdi\bir\brs\bs, starting with
4499 zero) is at the top.
4500 _\bd_\bi_\br Adds _\bd_\bi_\br to the directory stack at the top, making it the
4501 new current working directory.
4502
4503 If the p\bpu\bus\bsh\bhd\bd command is successful, a d\bdi\bir\brs\bs is performed as well.
4504 If the first form is used, p\bpu\bus\bsh\bhd\bd returns 0 unless the cd to _\bd_\bi_\br
4505 fails. With the second form, p\bpu\bus\bsh\bhd\bd returns 0 unless the direc-
4506 tory stack is empty, a non-existent directory stack element is
4507 specified, or the directory change to the specified new current
4508 directory fails.
4509
4510 p\bpw\bwd\bd [-\b-L\bLP\bP]
4511 Print the absolute pathname of the current working directory.
4512 The pathname printed contains no symbolic links if the -\b-P\bP option
4513 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
4514 is enabled. If the -\b-L\bL option is used, the pathname printed may
4515 contain symbolic links. The return status is 0 unless an error
4516 occurs while reading the name of the current directory or an
4517 invalid option is supplied.
4518
4519 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
4520 _\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 ...]
4521 One line is read from the standard input, or from the file
4522 descriptor _\bf_\bd supplied as an argument to the -\b-u\bu option, and the
4523 first word is assigned to the first _\bn_\ba_\bm_\be, the second word to the
4524 second _\bn_\ba_\bm_\be, and so on, with leftover words and their interven-
4525 ing separators assigned to the last _\bn_\ba_\bm_\be. If there are fewer
4526 words read from the input stream than names, the remaining names
4527 are assigned empty values. The characters in I\bIF\bFS\bS are used to
4528 split the line into words. The backslash character (\\b\) may be
4529 used to remove any special meaning for the next character read
4530 and for line continuation. Options, if supplied, have the fol-
4531 lowing meanings:
4532 -\b-a\ba _\ba_\bn_\ba_\bm_\be
4533 The words are assigned to sequential indices of the array
4534 variable _\ba_\bn_\ba_\bm_\be, starting at 0. _\ba_\bn_\ba_\bm_\be is unset before any
4535 new values are assigned. Other _\bn_\ba_\bm_\be arguments are
4536 ignored.
4537 -\b-d\bd _\bd_\be_\bl_\bi_\bm
4538 The first character of _\bd_\be_\bl_\bi_\bm is used to terminate the
4539 input line, rather than newline.
4540 -\b-e\be If the standard input is coming from a terminal, r\bre\bea\bad\bdl\bli\bin\bne\be
4541 (see R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE above) is used to obtain the line. Read-
4542 line uses the current (or default, if line editing was
4543 not previously active) editing settings.
4544 -\b-i\bi _\bt_\be_\bx_\bt
4545 If r\bre\bea\bad\bdl\bli\bin\bne\be is being used to read the line, _\bt_\be_\bx_\bt is
4546 placed into the editing buffer before editing begins.
4547 -\b-n\bn _\bn_\bc_\bh_\ba_\br_\bs
4548 r\bre\bea\bad\bd returns after reading _\bn_\bc_\bh_\ba_\br_\bs characters rather than
4549 waiting for a complete line of input, but honor a delim-
4550 iter if fewer than _\bn_\bc_\bh_\ba_\br_\bs characters are read before the
4551 delimiter.
4552 -\b-N\bN _\bn_\bc_\bh_\ba_\br_\bs
4553 r\bre\bea\bad\bd returns after reading exactly _\bn_\bc_\bh_\ba_\br_\bs characters
4554 rather than waiting for a complete line of input, unless
4555 EOF is encountered or r\bre\bea\bad\bd times out. Delimiter charac-
4556 ters encountered in the input are not treated specially
4557 and do not cause r\bre\bea\bad\bd to return until _\bn_\bc_\bh_\ba_\br_\bs characters
4558 are read.
4559 -\b-p\bp _\bp_\br_\bo_\bm_\bp_\bt
4560 Display _\bp_\br_\bo_\bm_\bp_\bt on standard error, without a trailing new-
4561 line, before attempting to read any input. The prompt is
4562 displayed only if input is coming from a terminal.
4563 -\b-r\br Backslash does not act as an escape character. The back-
4564 slash is considered to be part of the line. In particu-
4565 lar, a backslash-newline pair may not be used as a line
4566 continuation.
4567 -\b-s\bs Silent mode. If input is coming from a terminal, charac-
4568 ters are not echoed.
4569 -\b-t\bt _\bt_\bi_\bm_\be_\bo_\bu_\bt
4570 Cause r\bre\bea\bad\bd to time out and return failure if a complete
4571 line of input is not read within _\bt_\bi_\bm_\be_\bo_\bu_\bt seconds. _\bt_\bi_\bm_\be_\b-
4572 _\bo_\bu_\bt may be a decimal number with a fractional portion
4573 following the decimal point. This option is only effec-
4574 tive if r\bre\bea\bad\bd is reading input from a terminal, pipe, or
4575 other special file; it has no effect when reading from
4576 regular files. If _\bt_\bi_\bm_\be_\bo_\bu_\bt is 0, r\bre\bea\bad\bd returns success if
4577 input is available on the specified file descriptor,
4578 failure otherwise. The exit status is greater than 128
4579 if the timeout is exceeded.
4580 -\b-u\bu _\bf_\bd Read input from file descriptor _\bf_\bd.
4581
4582 If no _\bn_\ba_\bm_\be_\bs are supplied, the line read is assigned to the vari-
4583 able R\bRE\bEP\bPL\bLY\bY. The return code is zero, unless end-of-file is
4584 encountered, r\bre\bea\bad\bd times out (in which case the return code is
4585 greater than 128), or an invalid file descriptor is supplied as
4586 the argument to -\b-u\bu.
4587
4588 r\bre\bea\bad\bdo\bon\bnl\bly\by [-\b-a\baA\bAp\bpf\bf] [_\bn_\ba_\bm_\be[=_\bw_\bo_\br_\bd] ...]
4589 The given _\bn_\ba_\bm_\be_\bs are marked readonly; the values of these _\bn_\ba_\bm_\be_\bs
4590 may not be changed by subsequent assignment. If the -\b-f\bf option
4591 is supplied, the functions corresponding to the _\bn_\ba_\bm_\be_\bs are so
4592 marked. The -\b-a\ba option restricts the variables to indexed
4593 arrays; the -\b-A\bA option restricts the variables to associative
4594 arrays. If no _\bn_\ba_\bm_\be arguments are given, or if the -\b-p\bp option is
4595 supplied, a list of all readonly names is printed. The -\b-p\bp
4596 option causes output to be displayed in a format that may be
4597 reused as input. If a variable name is followed by =_\bw_\bo_\br_\bd, the
4598 value of the variable is set to _\bw_\bo_\br_\bd. The return status is 0
4599 unless an invalid option is encountered, one of the _\bn_\ba_\bm_\be_\bs is not
4600 a valid shell variable name, or -\b-f\bf is supplied with a _\bn_\ba_\bm_\be that
4601 is not a function.
4602
4603 r\bre\bet\btu\bur\brn\bn [_\bn]
4604 Causes a function to exit with the return value specified by _\bn.
4605 If _\bn is omitted, the return status is that of the last command
4606 executed in the function body. If used outside a function, but
4607 during execution of a script by the .\b. (s\bso\bou\bur\brc\bce\be) command, it
4608 causes the shell to stop executing that script and return either
4609 _\bn or the exit status of the last command executed within the
4610 script as the exit status of the script. If used outside a
4611 function and not during execution of a script by .\b., the return
4612 status is false. Any command associated with the R\bRE\bET\bTU\bUR\bRN\bN trap is
4613 executed before execution resumes after the function or script.
4614
4615 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] [_\ba_\br_\bg ...]
4616 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] [_\ba_\br_\bg ...]
4617 Without options, the name and value of each shell variable are
4618 displayed in a format that can be reused as input for setting or
4619 resetting the currently-set variables. Read-only variables can-
4620 not be reset. In _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, only shell variables are listed.
4621 The output is sorted according to the current locale. When
4622 options are specified, they set or unset shell attributes. Any
4623 arguments remaining after option processing are treated as val-
4624 ues for the positional parameters and are assigned, in order, to
4625 $\b$1\b1, $\b$2\b2, .\b..\b..\b. $\b$_\bn. Options, if specified, have the following
4626 meanings:
4627 -\b-a\ba Automatically mark variables and functions which are
4628 modified or created for export to the environment of
4629 subsequent commands.
4630 -\b-b\bb Report the status of terminated background jobs immedi-
4631 ately, rather than before the next primary prompt. This
4632 is effective only when job control is enabled.
4633 -\b-e\be Exit immediately if a _\bp_\bi_\bp_\be_\bl_\bi_\bn_\be (which may consist of a
4634 single _\bs_\bi_\bm_\bp_\bl_\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd), a _\bs_\bu_\bb_\bs_\bh_\be_\bl_\bl command enclosed in
4635 parentheses, or one of the commands executed as part of
4636 a command list enclosed by braces (see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR
4637 above) exits with a non-zero status. The shell does not
4638 exit if the command that fails is part of the command
4639 list immediately following a w\bwh\bhi\bil\ble\be or u\bun\bnt\bti\bil\bl keyword,
4640 part of the test following the i\bif\bf or e\bel\bli\bif\bf reserved
4641 words, part of any command executed in a &\b&&\b& or |\b||\b| list
4642 except the command following the final &\b&&\b& or |\b||\b|, any
4643 command in a pipeline but the last, or if the command's
4644 return value is being inverted with !\b!. A trap on E\bER\bRR\bR,
4645 if set, is executed before the shell exits. This option
4646 applies to the shell environment and each subshell envi-
4647 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
4648 above), and may cause subshells to exit before executing
4649 all the commands in the subshell.
4650 -\b-f\bf Disable pathname expansion.
4651 -\b-h\bh Remember the location of commands as they are looked up
4652 for execution. This is enabled by default.
4653 -\b-k\bk All arguments in the form of assignment statements are
4654 placed in the environment for a command, not just those
4655 that precede the command name.
4656 -\b-m\bm Monitor mode. Job control is enabled. This option is
4657 on by default for interactive shells on systems that
4658 support it (see J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL above). Background pro-
4659 cesses run in a separate process group and a line con-
4660 taining their exit status is printed upon their comple-
4661 tion.
4662 -\b-n\bn Read commands but do not execute them. This may be used
4663 to check a shell script for syntax errors. This is
4664 ignored by interactive shells.
4665 -\b-o\bo _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be
4666 The _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be can be one of the following:
4667 a\bal\bll\ble\bex\bxp\bpo\bor\brt\bt
4668 Same as -\b-a\ba.
4669 b\bbr\bra\bac\bce\bee\bex\bxp\bpa\ban\bnd\bd
4670 Same as -\b-B\bB.
4671 e\bem\bma\bac\bcs\bs Use an emacs-style command line editing inter-
4672 face. This is enabled by default when the shell
4673 is interactive, unless the shell is started with
4674 the -\b--\b-n\bno\boe\bed\bdi\bit\bti\bin\bng\bg option. This also affects the
4675 editing interface used for r\bre\bea\bad\bd -\b-e\be.
4676 e\ber\brr\bre\bex\bxi\bit\bt Same as -\b-e\be.
4677 e\ber\brr\brt\btr\bra\bac\bce\be
4678 Same as -\b-E\bE.
4679 f\bfu\bun\bnc\bct\btr\bra\bac\bce\be
4680 Same as -\b-T\bT.
4681 h\bha\bas\bsh\bha\bal\bll\bl Same as -\b-h\bh.
4682 h\bhi\bis\bst\bte\bex\bxp\bpa\ban\bnd\bd
4683 Same as -\b-H\bH.
4684 h\bhi\bis\bst\bto\bor\bry\by Enable command history, as described above under
4685 H\bHI\bIS\bST\bTO\bOR\bRY\bY. This option is on by default in inter-
4686 active shells.
4687 i\big\bgn\bno\bor\bre\bee\beo\bof\bf
4688 The effect is as if the shell command
4689 ``IGNOREEOF=10'' had been executed (see S\bSh\bhe\bel\bll\bl
4690 V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs above).
4691 k\bke\bey\byw\bwo\bor\brd\bd Same as -\b-k\bk.
4692 m\bmo\bon\bni\bit\bto\bor\br Same as -\b-m\bm.
4693 n\bno\boc\bcl\blo\bob\bbb\bbe\ber\br
4694 Same as -\b-C\bC.
4695 n\bno\boe\bex\bxe\bec\bc Same as -\b-n\bn.
4696 n\bno\bog\bgl\blo\bob\bb Same as -\b-f\bf.
4697 n\bno\bol\blo\bog\bg Currently ignored.
4698 n\bno\bot\bti\bif\bfy\by Same as -\b-b\bb.
4699 n\bno\bou\bun\bns\bse\bet\bt Same as -\b-u\bu.
4700 o\bon\bne\bec\bcm\bmd\bd Same as -\b-t\bt.
4701 p\bph\bhy\bys\bsi\bic\bca\bal\bl
4702 Same as -\b-P\bP.
4703 p\bpi\bip\bpe\bef\bfa\bai\bil\bl
4704 If set, the return value of a pipeline is the
4705 value of the last (rightmost) command to exit
4706 with a non-zero status, or zero if all commands
4707 in the pipeline exit successfully. This option
4708 is disabled by default.
4709 p\bpo\bos\bsi\bix\bx Change the behavior of b\bba\bas\bsh\bh where the default
4710 operation differs from the POSIX standard to
4711 match the standard (_\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be).
4712 p\bpr\bri\biv\bvi\bil\ble\beg\bge\bed\bd
4713 Same as -\b-p\bp.
4714 v\bve\ber\brb\bbo\bos\bse\be Same as -\b-v\bv.
4715 v\bvi\bi Use a vi-style command line editing interface.
4716 This also affects the editing interface used for
4717 r\bre\bea\bad\bd -\b-e\be.
4718 x\bxt\btr\bra\bac\bce\be Same as -\b-x\bx.
4719 If -\b-o\bo is supplied with no _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be, the values of the
4720 current options are printed. If +\b+o\bo is supplied with no
4721 _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be, a series of s\bse\bet\bt commands to recreate the
4722 current option settings is displayed on the standard
4723 output.
4724 -\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
4725 $\b$B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV files are not processed, shell functions are
4726 not inherited from the environment, and the S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS,
4727 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
4728 appear in the environment, are ignored. If the shell is
4729 started with the effective user (group) id not equal to
4730 the real user (group) id, and the -\b-p\bp option is not sup-
4731 plied, these actions are taken and the effective user id
4732 is set to the real user id. If the -\b-p\bp option is sup-
4733 plied at startup, the effective user id is not reset.
4734 Turning this option off causes the effective user and
4735 group ids to be set to the real user and group ids.
4736 -\b-t\bt Exit after reading and executing one command.
4737 -\b-u\bu Treat unset variables and parameters other than the spe-
4738 cial parameters "@" and "*" as an error when performing
4739 parameter expansion. If expansion is attempted on an
4740 unset variable or parameter, the shell prints an error
4741 message, and, if not interactive, exits with a non-zero
4742 status.
4743 -\b-v\bv Print shell input lines as they are read.
4744 -\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
4745 command, s\bse\bel\ble\bec\bct\bt command, or arithmetic f\bfo\bor\br command, dis-
4746 play the expanded value of P\bPS\bS4\b4, followed by the command
4747 and its expanded arguments or associated word list.
4748 -\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
4749 above). This is on by default.
4750 -\b-C\bC If set, b\bba\bas\bsh\bh does not overwrite an existing file with
4751 the >\b>, >\b>&\b&, and <\b<>\b> redirection operators. This may be
4752 overridden when creating output files by using the redi-
4753 rection operator >\b>|\b| instead of >\b>.
4754 -\b-E\bE If set, any trap on E\bER\bRR\bR is inherited by shell functions,
4755 command substitutions, and commands executed in a sub-
4756 shell environment. The E\bER\bRR\bR trap is normally not inher-
4757 ited in such cases.
4758 -\b-H\bH Enable !\b! style history substitution. This option is on
4759 by default when the shell is interactive.
4760 -\b-P\bP If set, the shell does not follow symbolic links when
4761 executing commands such as c\bcd\bd that change the current
4762 working directory. It uses the physical directory
4763 structure instead. By default, b\bba\bas\bsh\bh follows the logical
4764 chain of directories when performing commands which
4765 change the current directory.
4766 -\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
4767 shell functions, command substitutions, and commands
4768 executed in a subshell environment. The D\bDE\bEB\bBU\bUG\bG and
4769 R\bRE\bET\bTU\bUR\bRN\bN traps are normally not inherited in such cases.
4770 -\b--\b- If no arguments follow this option, then the positional
4771 parameters are unset. Otherwise, the positional parame-
4772 ters are set to the _\ba_\br_\bgs, even if some of them begin
4773 with a -\b-.
4774 -\b- Signal the end of options, cause all remaining _\ba_\br_\bgs to
4775 be assigned to the positional parameters. The -\b-x\bx and -\b-v\bv
4776 options are turned off. If there are no _\ba_\br_\bgs, the posi-
4777 tional parameters remain unchanged.
4778
4779 The options are off by default unless otherwise noted. Using +
4780 rather than - causes these options to be turned off. The
4781 options can also be specified as arguments to an invocation of
4782 the shell. The current set of options may be found in $\b$-\b-. The
4783 return status is always true unless an invalid option is encoun-
4784 tered.
4785
4786 s\bsh\bhi\bif\bft\bt [_\bn]
4787 The positional parameters from _\bn+1 ... are renamed to $\b$1\b1 .\b..\b..\b..\b.
4788 Parameters represented by the numbers $\b$#\b# down to $\b$#\b#-_\bn+1 are
4789 unset. _\bn must be a non-negative number less than or equal to
4790 $\b$#\b#. If _\bn is 0, no parameters are changed. If _\bn is not given,
4791 it is assumed to be 1. If _\bn is greater than $\b$#\b#, the positional
4792 parameters are not changed. The return status is greater than
4793 zero if _\bn is greater than $\b$#\b# or less than zero; otherwise 0.
4794
4795 s\bsh\bho\bop\bpt\bt [-\b-p\bpq\bqs\bsu\bu] [-\b-o\bo] [_\bo_\bp_\bt_\bn_\ba_\bm_\be ...]
4796 Toggle the values of variables controlling optional shell behav-
4797 ior. With no options, or with the -\b-p\bp option, a list of all set-
4798 table options is displayed, with an indication of whether or not
4799 each is set. The -\b-p\bp option causes output to be displayed in a
4800 form that may be reused as input. Other options have the fol-
4801 lowing meanings:
4802 -\b-s\bs Enable (set) each _\bo_\bp_\bt_\bn_\ba_\bm_\be.
4803 -\b-u\bu Disable (unset) each _\bo_\bp_\bt_\bn_\ba_\bm_\be.
4804 -\b-q\bq Suppresses normal output (quiet mode); the return status
4805 indicates whether the _\bo_\bp_\bt_\bn_\ba_\bm_\be is set or unset. If multi-
4806 ple _\bo_\bp_\bt_\bn_\ba_\bm_\be arguments are given with -\b-q\bq, the return sta-
4807 tus is zero if all _\bo_\bp_\bt_\bn_\ba_\bm_\be_\bs are enabled; non-zero other-
4808 wise.
4809 -\b-o\bo Restricts the values of _\bo_\bp_\bt_\bn_\ba_\bm_\be to be those defined for
4810 the -\b-o\bo option to the s\bse\bet\bt builtin.
4811
4812 If either -\b-s\bs or -\b-u\bu is used with no _\bo_\bp_\bt_\bn_\ba_\bm_\be arguments, the dis-
4813 play is limited to those options which are set or unset, respec-
4814 tively. Unless otherwise noted, the s\bsh\bho\bop\bpt\bt options are disabled
4815 (unset) by default.
4816
4817 The return status when listing options is zero if all _\bo_\bp_\bt_\bn_\ba_\bm_\be_\bs
4818 are enabled, non-zero otherwise. When setting or unsetting
4819 options, the return status is zero unless an _\bo_\bp_\bt_\bn_\ba_\bm_\be is not a
4820 valid shell option.
4821
4822 The list of s\bsh\bho\bop\bpt\bt options is:
4823
4824 a\bau\but\bto\boc\bcd\bd If set, a command name that is the name of a directory
4825 is executed as if it were the argument to the c\bcd\bd com-
4826 mand. This option is only used by interactive shells.
4827 c\bcd\bda\bab\bbl\ble\be_\b_v\bva\bar\brs\bs
4828 If set, an argument to the c\bcd\bd builtin command that is
4829 not a directory is assumed to be the name of a variable
4830 whose value is the directory to change to.
4831 c\bcd\bds\bsp\bpe\bel\bll\bl If set, minor errors in the spelling of a directory com-
4832 ponent in a c\bcd\bd command will be corrected. The errors
4833 checked for are transposed characters, a missing charac-
4834 ter, and one character too many. If a correction is
4835 found, the corrected file name is printed, and the com-
4836 mand proceeds. This option is only used by interactive
4837 shells.
4838 c\bch\bhe\bec\bck\bkh\bha\bas\bsh\bh
4839 If set, b\bba\bas\bsh\bh checks that a command found in the hash ta-
4840 ble exists before trying to execute it. If a hashed
4841 command no longer exists, a normal path search is per-
4842 formed.
4843 c\bch\bhe\bec\bck\bkj\bjo\bob\bbs\bs
4844 If set, b\bba\bas\bsh\bh lists the status of any stopped and running
4845 jobs before exiting an interactive shell. If any jobs
4846 are running, this causes the exit to be deferred until a
4847 second exit is attempted without an intervening command
4848 (see J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL above). The shell always postpones
4849 exiting if any jobs are stopped.
4850 c\bch\bhe\bec\bck\bkw\bwi\bin\bns\bsi\biz\bze\be
4851 If set, b\bba\bas\bsh\bh checks the window size after each command
4852 and, if necessary, updates the values of L\bLI\bIN\bNE\bES\bS and C\bCO\bOL\bL-\b-
4853 U\bUM\bMN\bNS\bS.
4854 c\bcm\bmd\bdh\bhi\bis\bst\bt If set, b\bba\bas\bsh\bh attempts to save all lines of a multiple-
4855 line command in the same history entry. This allows
4856 easy re-editing of multi-line commands.
4857 c\bco\bom\bmp\bpa\bat\bt3\b31\b1
4858 If set, b\bba\bas\bsh\bh changes its behavior to that of version 3.1
4859 with respect to quoted arguments to the conditional com-
4860 mand's =~ operator.
4861 c\bco\bom\bmp\bpa\bat\bt3\b32\b2
4862 If set, b\bba\bas\bsh\bh changes its behavior to that of version 3.2
4863 with respect to locale-specific string comparison when
4864 using the conditional command's < and > operators.
4865 c\bco\bom\bmp\bpa\bat\bt4\b40\b0
4866 If set, b\bba\bas\bsh\bh changes its behavior to that of version 4.0
4867 with respect to locale-specific string comparison when
4868 using the conditional command's < and > operators and
4869 the effect of interrupting a command list.
4870 d\bdi\bir\brs\bsp\bpe\bel\bll\bl
4871 If set, b\bba\bas\bsh\bh attempts spelling correction on directory
4872 names during word completion if the directory name ini-
4873 tially supplied does not exist.
4874 d\bdo\bot\btg\bgl\blo\bob\bb If set, b\bba\bas\bsh\bh includes filenames beginning with a `.' in
4875 the results of pathname expansion.
4876 e\bex\bxe\bec\bcf\bfa\bai\bil\bl
4877 If set, a non-interactive shell will not exit if it can-
4878 not execute the file specified as an argument to the
4879 e\bex\bxe\bec\bc builtin command. An interactive shell does not
4880 exit if e\bex\bxe\bec\bc fails.
4881 e\bex\bxp\bpa\ban\bnd\bd_\b_a\bal\bli\bia\bas\bse\bes\bs
4882 If set, aliases are expanded as described above under
4883 A\bAL\bLI\bIA\bAS\bSE\bES\bS. This option is enabled by default for interac-
4884 tive shells.
4885 e\bex\bxt\btd\bde\beb\bbu\bug\bg
4886 If set, behavior intended for use by debuggers is
4887 enabled:
4888 1\b1.\b. The -\b-F\bF option to the d\bde\bec\bcl\bla\bar\bre\be builtin displays the
4889 source file name and line number corresponding to
4890 each function name supplied as an argument.
4891 2\b2.\b. If the command run by the D\bDE\bEB\bBU\bUG\bG trap returns a
4892 non-zero value, the next command is skipped and
4893 not executed.
4894 3\b3.\b. If the command run by the D\bDE\bEB\bBU\bUG\bG trap returns a
4895 value of 2, and the shell is executing in a sub-
4896 routine (a shell function or a shell script exe-
4897 cuted by the .\b. or s\bso\bou\bur\brc\bce\be builtins), a call to
4898 r\bre\bet\btu\bur\brn\bn is simulated.
4899 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
4900 in their descriptions above.
4901 5\b5.\b. Function tracing is enabled: command substitu-
4902 tion, shell functions, and subshells invoked with
4903 (\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.
4904 6\b6.\b. Error tracing is enabled: command substitution,
4905 shell functions, and subshells invoked with (\b(
4906 _\bc_\bo_\bm_\bm_\ba_\bn_\bd )\b) inherit the E\bER\bRR\bRO\bOR\bR trap.
4907 e\bex\bxt\btg\bgl\blo\bob\bb If set, the extended pattern matching features described
4908 above under P\bPa\bat\bth\bhn\bna\bam\bme\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn are enabled.
4909 e\bex\bxt\btq\bqu\buo\bot\bte\be
4910 If set, $\b$'_\bs_\bt_\br_\bi_\bn_\bg' and $\b$"_\bs_\bt_\br_\bi_\bn_\bg" quoting is performed
4911 within $\b${\b{_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br}\b} expansions enclosed in double
4912 quotes. This option is enabled by default.
4913 f\bfa\bai\bil\blg\bgl\blo\bob\bb
4914 If set, patterns which fail to match filenames during
4915 pathname expansion result in an expansion error.
4916 f\bfo\bor\brc\bce\be_\b_f\bfi\big\bgn\bno\bor\bre\be
4917 If set, the suffixes specified by the F\bFI\bIG\bGN\bNO\bOR\bRE\bE shell
4918 variable cause words to be ignored when performing word
4919 completion even if the ignored words are the only possi-
4920 ble completions. See S\bSH\bHE\bEL\bLL\bL V\bVA\bAR\bRI\bIA\bAB\bBL\bLE\bES\bS above for a
4921 description of F\bFI\bIG\bGN\bNO\bOR\bRE\bE. This option is enabled by
4922 default.
4923 g\bgl\blo\bob\bbs\bst\bta\bar\br
4924 If set, the pattern *\b**\b* used in a pathname expansion con-
4925 text will match a files and zero or more directories and
4926 subdirectories. If the pattern is followed by a /\b/, only
4927 directories and subdirectories match.
4928 g\bgn\bnu\bu_\b_e\ber\brr\brf\bfm\bmt\bt
4929 If set, shell error messages are written in the standard
4930 GNU error message format.
4931 h\bhi\bis\bst\bta\bap\bpp\bpe\ben\bnd\bd
4932 If set, the history list is appended to the file named
4933 by the value of the H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE variable when the shell
4934 exits, rather than overwriting the file.
4935 h\bhi\bis\bst\btr\bre\bee\bed\bdi\bit\bt
4936 If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, a user is given the
4937 opportunity to re-edit a failed history substitution.
4938 h\bhi\bis\bst\btv\bve\ber\bri\bif\bfy\by
4939 If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, the results of his-
4940 tory substitution are not immediately passed to the
4941 shell parser. Instead, the resulting line is loaded
4942 into the r\bre\bea\bad\bdl\bli\bin\bne\be editing buffer, allowing further modi-
4943 fication.
4944 h\bho\bos\bst\btc\bco\bom\bmp\bpl\ble\bet\bte\be
4945 If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, b\bba\bas\bsh\bh will attempt to
4946 perform hostname completion when a word containing a @\b@
4947 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
4948 above). This is enabled by default.
4949 h\bhu\bup\bpo\bon\bne\bex\bxi\bit\bt
4950 If set, b\bba\bas\bsh\bh will send S\bSI\bIG\bGH\bHU\bUP\bP to all jobs when an inter-
4951 active login shell exits.
4952 i\bin\bnt\bte\ber\bra\bac\bct\bti\biv\bve\be_\b_c\bco\bom\bmm\bme\ben\bnt\bts\bs
4953 If set, allow a word beginning with #\b# to cause that word
4954 and all remaining characters on that line to be ignored
4955 in an interactive shell (see C\bCO\bOM\bMM\bME\bEN\bNT\bTS\bS above). This
4956 option is enabled by default.
4957 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
4958 commands are saved to the history with embedded newlines
4959 rather than using semicolon separators where possible.
4960 l\blo\bog\bgi\bin\bn_\b_s\bsh\bhe\bel\bll\bl
4961 The shell sets this option if it is started as a login
4962 shell (see I\bIN\bNV\bVO\bOC\bCA\bAT\bTI\bIO\bON\bN above). The value may not be
4963 changed.
4964 m\bma\bai\bil\blw\bwa\bar\brn\bn
4965 If set, and a file that b\bba\bas\bsh\bh is checking for mail has
4966 been accessed since the last time it was checked, the
4967 message ``The mail in _\bm_\ba_\bi_\bl_\bf_\bi_\bl_\be has been read'' is dis-
4968 played.
4969 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
4970 If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, b\bba\bas\bsh\bh will not
4971 attempt to search the P\bPA\bAT\bTH\bH for possible completions when
4972 completion is attempted on an empty line.
4973 n\bno\boc\bca\bas\bse\beg\bgl\blo\bob\bb
4974 If set, b\bba\bas\bsh\bh matches filenames in a case-insensitive
4975 fashion when performing pathname expansion (see P\bPa\bat\bth\bhn\bna\bam\bme\be
4976 E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn above).
4977 n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh
4978 If set, b\bba\bas\bsh\bh matches patterns in a case-insensitive
4979 fashion when performing matching while executing c\bca\bas\bse\be or
4980 [\b[[\b[ conditional commands.
4981 n\bnu\bul\bll\blg\bgl\blo\bob\bb
4982 If set, b\bba\bas\bsh\bh allows patterns which match no files (see
4983 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,
4984 rather than themselves.
4985 p\bpr\bro\bog\bgc\bco\bom\bmp\bp
4986 If set, the programmable completion facilities (see P\bPr\bro\bo-\b-
4987 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
4988 enabled by default.
4989 p\bpr\bro\bom\bmp\bpt\btv\bva\bar\brs\bs
4990 If set, prompt strings undergo parameter expansion, com-
4991 mand substitution, arithmetic expansion, and quote
4992 removal after being expanded as described in P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG
4993 above. This option is enabled by default.
4994 r\bre\bes\bst\btr\bri\bic\bct\bte\bed\bd_\b_s\bsh\bhe\bel\bll\bl
4995 The shell sets this option if it is started in
4996 restricted mode (see R\bRE\bES\bST\bTR\bRI\bIC\bCT\bTE\bED\bD S\bSH\bHE\bEL\bLL\bL below). The value
4997 may not be changed. This is not reset when the startup
4998 files are executed, allowing the startup files to dis-
4999 cover whether or not a shell is restricted.
5000 s\bsh\bhi\bif\bft\bt_\b_v\bve\ber\brb\bbo\bos\bse\be
5001 If set, the s\bsh\bhi\bif\bft\bt builtin prints an error message when
5002 the shift count exceeds the number of positional parame-
5003 ters.
5004 s\bso\bou\bur\brc\bce\bep\bpa\bat\bth\bh
5005 If set, the s\bso\bou\bur\brc\bce\be (.\b.) builtin uses the value of P\bPA\bAT\bTH\bH to
5006 find the directory containing the file supplied as an
5007 argument. This option is enabled by default.
5008 x\bxp\bpg\bg_\b_e\bec\bch\bho\bo
5009 If set, the e\bec\bch\bho\bo builtin expands backslash-escape
5010 sequences by default.
5011 s\bsu\bus\bsp\bpe\ben\bnd\bd [-\b-f\bf]
5012 Suspend the execution of this shell until it receives a S\bSI\bIG\bGC\bCO\bON\bNT\bT
5013 signal. A login shell cannot be suspended; the -\b-f\bf option can be
5014 used to override this and force the suspension. The return sta-
5015 tus is 0 unless the shell is a login shell and -\b-f\bf is not sup-
5016 plied, or if job control is not enabled.
5017 t\bte\bes\bst\bt _\be_\bx_\bp_\br
5018 [\b[ _\be_\bx_\bp_\br ]\b]
5019 Return a status of 0 or 1 depending on the evaluation of the
5020 conditional expression _\be_\bx_\bp_\br. Each operator and operand must be
5021 a separate argument. Expressions are composed of the primaries
5022 described above under C\bCO\bON\bND\bDI\bIT\bTI\bIO\bON\bNA\bAL\bL E\bEX\bXP\bPR\bRE\bES\bSS\bSI\bIO\bON\bNS\bS. t\bte\bes\bst\bt does not
5023 accept any options, nor does it accept and ignore an argument of
5024 -\b--\b- as signifying the end of options.
5025
5026 Expressions may be combined using the following operators,
5027 listed in decreasing order of precedence. The evaluation
5028 depends on the number of arguments; see below.
5029 !\b! _\be_\bx_\bp_\br True if _\be_\bx_\bp_\br is false.
5030 (\b( _\be_\bx_\bp_\br )\b)
5031 Returns the value of _\be_\bx_\bp_\br. This may be used to override
5032 the normal precedence of operators.
5033 _\be_\bx_\bp_\br_\b1 -a\ba _\be_\bx_\bp_\br_\b2
5034 True if both _\be_\bx_\bp_\br_\b1 and _\be_\bx_\bp_\br_\b2 are true.
5035 _\be_\bx_\bp_\br_\b1 -o\bo _\be_\bx_\bp_\br_\b2
5036 True if either _\be_\bx_\bp_\br_\b1 or _\be_\bx_\bp_\br_\b2 is true.
5037
5038 t\bte\bes\bst\bt and [\b[ evaluate conditional expressions using a set of rules
5039 based on the number of arguments.
5040
5041 0 arguments
5042 The expression is false.
5043 1 argument
5044 The expression is true if and only if the argument is not
5045 null.
5046 2 arguments
5047 If the first argument is !\b!, the expression is true if and
5048 only if the second argument is null. If the first argu-
5049 ment is one of the unary conditional operators listed
5050 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
5051 true if the unary test is true. If the first argument is
5052 not a valid unary conditional operator, the expression is
5053 false.
5054 3 arguments
5055 If the second argument is one of the binary conditional
5056 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
5057 result of the expression is the result of the binary test
5058 using the first and third arguments as operands. The -\b-a\ba
5059 and -\b-o\bo operators are considered binary operators when
5060 there are three arguments. If the first argument is !\b!,
5061 the value is the negation of the two-argument test using
5062 the second and third arguments. If the first argument is
5063 exactly (\b( and the third argument is exactly )\b), the result
5064 is the one-argument test of the second argument. Other-
5065 wise, the expression is false.
5066 4 arguments
5067 If the first argument is !\b!, the result is the negation of
5068 the three-argument expression composed of the remaining
5069 arguments. Otherwise, the expression is parsed and eval-
5070 uated according to precedence using the rules listed
5071 above.
5072 5 or more arguments
5073 The expression is parsed and evaluated according to
5074 precedence using the rules listed above.
5075
5076 t\bti\bim\bme\bes\bs Print the accumulated user and system times for the shell and
5077 for processes run from the shell. The return status is 0.
5078
5079 t\btr\bra\bap\bp [-\b-l\blp\bp] [[_\ba_\br_\bg] _\bs_\bi_\bg_\bs_\bp_\be_\bc ...]
5080 The command _\ba_\br_\bg is to be read and executed when the shell
5081 receives signal(s) _\bs_\bi_\bg_\bs_\bp_\be_\bc. If _\ba_\br_\bg is absent (and there is a
5082 single _\bs_\bi_\bg_\bs_\bp_\be_\bc) or -\b-, each specified signal is reset to its
5083 original disposition (the value it had upon entrance to the
5084 shell). If _\ba_\br_\bg is the null string the signal specified by each
5085 _\bs_\bi_\bg_\bs_\bp_\be_\bc is ignored by the shell and by the commands it invokes.
5086 If _\ba_\br_\bg is not present and -\b-p\bp has been supplied, then the trap
5087 commands associated with each _\bs_\bi_\bg_\bs_\bp_\be_\bc are displayed. If no
5088 arguments are supplied or if only -\b-p\bp is given, t\btr\bra\bap\bp prints the
5089 list of commands associated with each signal. The -\b-l\bl option
5090 causes the shell to print a list of signal names and their cor-
5091 responding numbers. Each _\bs_\bi_\bg_\bs_\bp_\be_\bc is either a signal name
5092 defined in <_\bs_\bi_\bg_\bn_\ba_\bl_\b._\bh>, or a signal number. Signal names are
5093 case insensitive and the SIG prefix is optional.
5094
5095 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
5096 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-
5097 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,
5098 _\bs_\be_\bl_\be_\bc_\bt command, every arithmetic _\bf_\bo_\br command, and before the
5099 first command executes in a shell function (see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR
5100 above). Refer to the description of the e\bex\bxt\btd\bde\beb\bbu\bug\bg option to the
5101 s\bsh\bho\bop\bpt\bt builtin for details of its effect on the D\bDE\bEB\bBU\bUG\bG trap. If a
5102 _\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
5103 function or a script executed with the .\b. or s\bso\bou\bur\brc\bce\be builtins fin-
5104 ishes executing.
5105
5106 If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is E\bER\bRR\bR, the command _\ba_\br_\bg is executed whenever a sim-
5107 ple command has a non-zero exit status, subject to the following
5108 conditions. The E\bER\bRR\bR trap is not executed if the failed command
5109 is part of the command list immediately following a w\bwh\bhi\bil\ble\be or
5110 u\bun\bnt\bti\bil\bl keyword, part of the test in an _\bi_\bf statement, part of a
5111 command executed in a &\b&&\b& or |\b||\b| list, or if the command's return
5112 value is being inverted via !\b!. These are the same conditions
5113 obeyed by the e\ber\brr\bre\bex\bxi\bit\bt option.
5114
5115 Signals ignored upon entry to the shell cannot be trapped or
5116 reset. Trapped signals that are not being ignored are reset to
5117 their original values in a subshell or subshell environment when
5118 one is created. The return status is false if any _\bs_\bi_\bg_\bs_\bp_\be_\bc is
5119 invalid; otherwise t\btr\bra\bap\bp returns true.
5120
5121 t\bty\byp\bpe\be [-\b-a\baf\bft\btp\bpP\bP] _\bn_\ba_\bm_\be [_\bn_\ba_\bm_\be ...]
5122 With no options, indicate how each _\bn_\ba_\bm_\be would be interpreted if
5123 used as a command name. If the -\b-t\bt option is used, t\bty\byp\bpe\be prints a
5124 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
5125 _\bf_\bi_\bl_\be if _\bn_\ba_\bm_\be is an alias, shell reserved word, function,
5126 builtin, or disk file, respectively. If the _\bn_\ba_\bm_\be is not found,
5127 then nothing is printed, and an exit status of false is
5128 returned. If the -\b-p\bp option is used, t\bty\byp\bpe\be either returns the
5129 name of the disk file that would be executed if _\bn_\ba_\bm_\be were speci-
5130 fied as a command name, or nothing if ``type -t name'' would not
5131 return _\bf_\bi_\bl_\be. The -\b-P\bP option forces a P\bPA\bAT\bTH\bH search for each _\bn_\ba_\bm_\be,
5132 even if ``type -t name'' would not return _\bf_\bi_\bl_\be. If a command is
5133 hashed, -\b-p\bp and -\b-P\bP print the hashed value, not necessarily the
5134 file that appears first in P\bPA\bAT\bTH\bH. If the -\b-a\ba option is used, t\bty\byp\bpe\be
5135 prints all of the places that contain an executable named _\bn_\ba_\bm_\be.
5136 This includes aliases and functions, if and only if the -\b-p\bp
5137 option is not also used. The table of hashed commands is not
5138 consulted when using -\b-a\ba. The -\b-f\bf option suppresses shell func-
5139 tion lookup, as with the c\bco\bom\bmm\bma\ban\bnd\bd builtin. t\bty\byp\bpe\be returns true if
5140 all of the arguments are found, false if any are not found.
5141
5142 u\bul\bli\bim\bmi\bit\bt [-\b-H\bHS\bST\bTa\bab\bbc\bcd\bde\bef\bfi\bil\blm\bmn\bnp\bpq\bqr\brs\bst\btu\buv\bvx\bx [_\bl_\bi_\bm_\bi_\bt]]
5143 Provides control over the resources available to the shell and
5144 to processes started by it, on systems that allow such control.
5145 The -\b-H\bH and -\b-S\bS options specify that the hard or soft limit is set
5146 for the given resource. A hard limit cannot be increased by a
5147 non-root user once it is set; a soft limit may be increased up
5148 to the value of the hard limit. If neither -\b-H\bH nor -\b-S\bS is speci-
5149 fied, both the soft and hard limits are set. The value of _\bl_\bi_\bm_\bi_\bt
5150 can be a number in the unit specified for the resource or one of
5151 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
5152 current hard limit, the current soft limit, and no limit,
5153 respectively. If _\bl_\bi_\bm_\bi_\bt is omitted, the current value of the
5154 soft limit of the resource is printed, unless the -\b-H\bH option is
5155 given. When more than one resource is specified, the limit name
5156 and unit are printed before the value. Other options are inter-
5157 preted as follows:
5158 -\b-a\ba All current limits are reported
5159 -\b-b\bb The maximum socket buffer size
5160 -\b-c\bc The maximum size of core files created
5161 -\b-d\bd The maximum size of a process's data segment
5162 -\b-e\be The maximum scheduling priority ("nice")
5163 -\b-f\bf The maximum size of files written by the shell and its
5164 children
5165 -\b-i\bi The maximum number of pending signals
5166 -\b-l\bl The maximum size that may be locked into memory
5167 -\b-m\bm The maximum resident set size (many systems do not honor
5168 this limit)
5169 -\b-n\bn The maximum number of open file descriptors (most systems
5170 do not allow this value to be set)
5171 -\b-p\bp The pipe size in 512-byte blocks (this may not be set)
5172 -\b-q\bq The maximum number of bytes in POSIX message queues
5173 -\b-r\br The maximum real-time scheduling priority
5174 -\b-s\bs The maximum stack size
5175 -\b-t\bt The maximum amount of cpu time in seconds
5176 -\b-u\bu The maximum number of processes available to a single
5177 user
5178 -\b-v\bv The maximum amount of virtual memory available to the
5179 shell
5180 -\b-x\bx The maximum number of file locks
5181 -\b-T\bT The maximum number of threads
5182
5183 If _\bl_\bi_\bm_\bi_\bt is given, it is the new value of the specified resource
5184 (the -\b-a\ba option is display only). If no option is given, then -\b-f\bf
5185 is assumed. Values are in 1024-byte increments, except for -\b-t\bt,
5186 which is in seconds, -\b-p\bp, which is in units of 512-byte blocks,
5187 and -\b-T\bT, -\b-b\bb, -\b-n\bn, and -\b-u\bu, which are unscaled values. The return
5188 status is 0 unless an invalid option or argument is supplied, or
5189 an error occurs while setting a new limit.
5190
5191 u\bum\bma\bas\bsk\bk [-\b-p\bp] [-\b-S\bS] [_\bm_\bo_\bd_\be]
5192 The user file-creation mask is set to _\bm_\bo_\bd_\be. If _\bm_\bo_\bd_\be begins with
5193 a digit, it is interpreted as an octal number; otherwise it is
5194 interpreted as a symbolic mode mask similar to that accepted by
5195 _\bc_\bh_\bm_\bo_\bd(1). If _\bm_\bo_\bd_\be is omitted, the current value of the mask is
5196 printed. The -\b-S\bS option causes the mask to be printed in sym-
5197 bolic form; the default output is an octal number. If the -\b-p\bp
5198 option is supplied, and _\bm_\bo_\bd_\be is omitted, the output is in a form
5199 that may be reused as input. The return status is 0 if the mode
5200 was successfully changed or if no _\bm_\bo_\bd_\be argument was supplied,
5201 and false otherwise.
5202
5203 u\bun\bna\bal\bli\bia\bas\bs [-a\ba] [_\bn_\ba_\bm_\be ...]
5204 Remove each _\bn_\ba_\bm_\be from the list of defined aliases. If -\b-a\ba is
5205 supplied, all alias definitions are removed. The return value
5206 is true unless a supplied _\bn_\ba_\bm_\be is not a defined alias.
5207
5208 u\bun\bns\bse\bet\bt [-f\bfv\bv] [_\bn_\ba_\bm_\be ...]
5209 For each _\bn_\ba_\bm_\be, remove the corresponding variable or function.
5210 If no options are supplied, or the -\b-v\bv option is given, each _\bn_\ba_\bm_\be
5211 refers to a shell variable. Read-only variables may not be
5212 unset. If -\b-f\bf is specified, each _\bn_\ba_\bm_\be refers to a shell func-
5213 tion, and the function definition is removed. Each unset vari-
5214 able or function is removed from the environment passed to sub-
5215 sequent commands. If any of C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS, R\bRA\bAN\bND\bDO\bOM\bM, S\bSE\bEC\bCO\bON\bND\bDS\bS,
5216 L\bLI\bIN\bNE\bEN\bNO\bO, H\bHI\bIS\bST\bTC\bCM\bMD\bD, F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE, G\bGR\bRO\bOU\bUP\bPS\bS, or D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK are unset, they
5217 lose their special properties, even if they are subsequently
5218 reset. The exit status is true unless a _\bn_\ba_\bm_\be is readonly.
5219
5220 w\bwa\bai\bit\bt [_\bn _\b._\b._\b.]
5221 Wait for each specified process and return its termination sta-
5222 tus. Each _\bn may be a process ID or a job specification; if a
5223 job spec is given, all processes in that job's pipeline are
5224 waited for. If _\bn is not given, all currently active child pro-
5225 cesses are waited for, and the return status is zero. If _\bn
5226 specifies a non-existent process or job, the return status is
5227 127. Otherwise, the return status is the exit status of the
5228 last process or job waited for.
5229
5230 R\bRE\bES\bST\bTR\bRI\bIC\bCT\bTE\bED\bD S\bSH\bHE\bEL\bLL\bL
5231 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
5232 invocation, the shell becomes restricted. A restricted shell is used
5233 to set up an environment more controlled than the standard shell. It
5234 behaves identically to b\bba\bas\bsh\bh with the exception that the following are
5235 disallowed or not performed:
5236
5237 +\bo changing directories with c\bcd\bd
5238
5239 +\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
5240
5241 +\bo specifying command names containing /\b/
5242
5243 +\bo specifying a file name containing a /\b/ as an argument to the .\b.
5244 builtin command
5245
5246 +\bo Specifying a filename containing a slash as an argument to the
5247 -\b-p\bp option to the h\bha\bas\bsh\bh builtin command
5248
5249 +\bo importing function definitions from the shell environment at
5250 startup
5251
5252 +\bo parsing the value of S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS from the shell environment at
5253 startup
5254
5255 +\bo redirecting output using the >, >|, <>, >&, &>, and >> redirect-
5256 ion operators
5257
5258 +\bo using the e\bex\bxe\bec\bc builtin command to replace the shell with another
5259 command
5260
5261 +\bo adding or deleting builtin commands with the -\b-f\bf and -\b-d\bd options
5262 to the e\ben\bna\bab\bbl\ble\be builtin command
5263
5264 +\bo Using the e\ben\bna\bab\bbl\ble\be builtin command to enable disabled shell
5265 builtins
5266
5267 +\bo specifying the -\b-p\bp option to the c\bco\bom\bmm\bma\ban\bnd\bd builtin command
5268
5269 +\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.
5270
5271 These restrictions are enforced after any startup files are read.
5272
5273 When a command that is found to be a shell script is executed (see C\bCO\bOM\bM-\b-
5274 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
5275 spawned to execute the script.
5276
5277 S\bSE\bEE\bE A\bAL\bLS\bSO\bO
5278 _\bB_\ba_\bs_\bh _\bR_\be_\bf_\be_\br_\be_\bn_\bc_\be _\bM_\ba_\bn_\bu_\ba_\bl, Brian Fox and Chet Ramey
5279 _\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
5280 _\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
5281 _\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-
5282 _\bt_\bi_\be_\bs, IEEE
5283 _\bs_\bh(1), _\bk_\bs_\bh(1), _\bc_\bs_\bh(1)
5284 _\be_\bm_\ba_\bc_\bs(1), _\bv_\bi(1)
5285 _\br_\be_\ba_\bd_\bl_\bi_\bn_\be(3)
5286
5287 F\bFI\bIL\bLE\bES\bS
5288 _\b/_\bb_\bi_\bn_\b/_\bb_\ba_\bs_\bh
5289 The b\bba\bas\bsh\bh executable
5290 _\b/_\be_\bt_\bc_\b/_\bp_\br_\bo_\bf_\bi_\bl_\be
5291 The systemwide initialization file, executed for login shells
5292 _\b~_\b/_\b._\bb_\ba_\bs_\bh_\b__\bp_\br_\bo_\bf_\bi_\bl_\be
5293 The personal initialization file, executed for login shells
5294 _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc
5295 The individual per-interactive-shell startup file
5296 _\b~_\b/_\b._\bb_\ba_\bs_\bh_\b__\bl_\bo_\bg_\bo_\bu_\bt
5297 The individual login shell cleanup file, executed when a login
5298 shell exits
5299 _\b~_\b/_\b._\bi_\bn_\bp_\bu_\bt_\br_\bc
5300 Individual _\br_\be_\ba_\bd_\bl_\bi_\bn_\be initialization file
5301
5302 A\bAU\bUT\bTH\bHO\bOR\bRS\bS
5303 Brian Fox, Free Software Foundation
5304 bfox@gnu.org
5305
5306 Chet Ramey, Case Western Reserve University
5307 chet.ramey@case.edu
5308
5309 B\bBU\bUG\bG R\bRE\bEP\bPO\bOR\bRT\bTS\bS
5310 If you find a bug in b\bba\bas\bsh\bh,\b, you should report it. But first, you should
5311 make sure that it really is a bug, and that it appears in the latest
5312 version of b\bba\bas\bsh\bh. The latest version is always available from
5313 _\bf_\bt_\bp_\b:_\b/_\b/_\bf_\bt_\bp_\b._\bg_\bn_\bu_\b._\bo_\br_\bg_\b/_\bp_\bu_\bb_\b/_\bb_\ba_\bs_\bh_\b/.
5314
5315 Once you have determined that a bug actually exists, use the _\bb_\ba_\bs_\bh_\bb_\bu_\bg
5316 command to submit a bug report. If you have a fix, you are encouraged
5317 to mail that as well! Suggestions and `philosophical' bug reports may
5318 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
5319 g\bgn\bnu\bu.\b.b\bba\bas\bsh\bh.\b.b\bbu\bug\bg.
5320
5321 ALL bug reports should include:
5322
5323 The version number of b\bba\bas\bsh\bh
5324 The hardware and operating system
5325 The compiler used to compile
5326 A description of the bug behaviour
5327 A short script or `recipe' which exercises the bug
5328
5329 _\bb_\ba_\bs_\bh_\bb_\bu_\bg inserts the first three items automatically into the template
5330 it provides for filing a bug report.
5331
5332 Comments and bug reports concerning this manual page should be directed
5333 to _\bc_\bh_\be_\bt_\b@_\bp_\bo_\b._\bc_\bw_\br_\bu_\b._\be_\bd_\bu.
5334
5335 B\bBU\bUG\bGS\bS
5336 It's too big and too slow.
5337
5338 There are some subtle differences between b\bba\bas\bsh\bh and traditional versions
5339 of s\bsh\bh, mostly because of the P\bPO\bOS\bSI\bIX\bX specification.
5340
5341 Aliases are confusing in some uses.
5342
5343 Shell builtin commands and functions are not stoppable/restartable.
5344
5345 Compound commands and command sequences of the form `a ; b ; c' are not
5346 handled gracefully when process suspension is attempted. When a
5347 process is stopped, the shell immediately executes the next command in
5348 the sequence. It suffices to place the sequence of commands between
5349 parentheses to force it into a subshell, which may be stopped as a
5350 unit.
5351
5352 Array variables may not (yet) be exported.
5353
5354 There may be only one active coprocess at a time.
5355
5356
5357
5358 GNU Bash-4.1 2009 December 29 BASH(1)