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