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