]> git.ipfire.org Git - thirdparty/bash.git/blob - doc/builtins.0
Imported from ../bash-4.0.tar.gz.
[thirdparty/bash.git] / doc / builtins.0
1 BASH_BUILTINS(1) BASH_BUILTINS(1)
2
3
4
5 N\bNA\bAM\bME\bE
6 bash, :, ., [, alias, bg, bind, break, builtin, caller, cd, command,
7 compgen, complete, compopt, continue, declare, dirs, disown, echo,
8 enable, eval, exec, exit, export, false, fc, fg, getopts, hash, help,
9 history, jobs, kill, let, local, logout, mapfile, popd, printf, pushd,
10 pwd, read, readonly, return, set, shift, shopt, source, suspend, test,
11 times, trap, true, type, typeset, ulimit, umask, unalias, unset, wait -
12 bash built-in commands, see b\bba\bas\bsh\bh(1)
13
14 B\bBA\bAS\bSH\bH B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
15 Unless otherwise noted, each builtin command documented in this section
16 as accepting options preceded by -\b- accepts -\b--\b- to signify the end of the
17 options. For example, the :\b:, t\btr\bru\bue\be, f\bfa\bal\bls\bse\be, and t\bte\bes\bst\bt builtins do not
18 accept options.
19 :\b: [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
20 No effect; the command does nothing beyond expanding _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs
21 and performing any specified redirections. A zero exit code is
22 returned.
23
24 .\b. _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
25 s\bso\bou\bur\brc\bce\be _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
26 Read and execute commands from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be in the current shell
27 environment and return the exit status of the last command exe-
28 cuted from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be. If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be does not contain a slash, file
29 names in P\bPA\bAT\bTH\bH are used to find the directory containing _\bf_\bi_\bl_\be_\b-
30 _\bn_\ba_\bm_\be. The file searched for in P\bPA\bAT\bTH\bH need not be executable.
31 When b\bba\bas\bsh\bh is not in _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, the current directory is
32 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
33 to the s\bsh\bho\bop\bpt\bt builtin command is turned off, the P\bPA\bAT\bTH\bH is not
34 searched. If any _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs are supplied, they become the posi-
35 tional parameters when _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is executed. Otherwise the
36 positional parameters are unchanged. The return status is the
37 status of the last command exited within the script (0 if no
38 commands are executed), and false if _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is not found or
39 cannot be read.
40
41 a\bal\bli\bia\bas\bs [-\b-p\bp] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ...]
42 A\bAl\bli\bia\bas\bs with no arguments or with the -\b-p\bp option prints the list of
43 aliases in the form a\bal\bli\bia\bas\bs _\bn_\ba_\bm_\be=_\bv_\ba_\bl_\bu_\be on standard output. When
44 arguments are supplied, an alias is defined for each _\bn_\ba_\bm_\be whose
45 _\bv_\ba_\bl_\bu_\be is given. A trailing space in _\bv_\ba_\bl_\bu_\be causes the next word
46 to be checked for alias substitution when the alias is expanded.
47 For each _\bn_\ba_\bm_\be in the argument list for which no _\bv_\ba_\bl_\bu_\be is sup-
48 plied, the name and value of the alias is printed. A\bAl\bli\bia\bas\bs
49 returns true unless a _\bn_\ba_\bm_\be is given for which no alias has been
50 defined.
51
52 b\bbg\bg [_\bj_\bo_\bb_\bs_\bp_\be_\bc ...]
53 Resume each suspended job _\bj_\bo_\bb_\bs_\bp_\be_\bc in the background, as if it
54 had been started with &\b&. If _\bj_\bo_\bb_\bs_\bp_\be_\bc is not present, the shell's
55 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
56 run when job control is disabled or, when run with job control
57 enabled, any specified _\bj_\bo_\bb_\bs_\bp_\be_\bc was not found or was started
58 without job control.
59
60 b\bbi\bin\bnd\bd [-\b-m\bm _\bk_\be_\by_\bm_\ba_\bp] [-\b-l\blp\bps\bsv\bvP\bPS\bSV\bV]
61 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]
62 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
63 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
64 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
65 b\bbi\bin\bnd\bd _\br_\be_\ba_\bd_\bl_\bi_\bn_\be_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd
66 Display current r\bre\bea\bad\bdl\bli\bin\bne\be key and function bindings, bind a key
67 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
68 variable. Each non-option argument is a command as it would
69 appear in _\b._\bi_\bn_\bp_\bu_\bt_\br_\bc, but each binding or command must be passed
70 as a separate argument; e.g., '"\C-x\C-r": re-read-init-file'.
71 Options, if supplied, have the following meanings:
72 -\b-m\bm _\bk_\be_\by_\bm_\ba_\bp
73 Use _\bk_\be_\by_\bm_\ba_\bp as the keymap to be affected by the subsequent
74 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-
75 _\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,
76 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
77 equivalent to _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\bd_\ba_\br_\bd.
78 -\b-l\bl List the names of all r\bre\bea\bad\bdl\bli\bin\bne\be functions.
79 -\b-p\bp Display r\bre\bea\bad\bdl\bli\bin\bne\be function names and bindings in such a
80 way that they can be re-read.
81 -\b-P\bP List current r\bre\bea\bad\bdl\bli\bin\bne\be function names and bindings.
82 -\b-s\bs Display r\bre\bea\bad\bdl\bli\bin\bne\be key sequences bound to macros and the
83 strings they output in such a way that they can be re-
84 read.
85 -\b-S\bS Display r\bre\bea\bad\bdl\bli\bin\bne\be key sequences bound to macros and the
86 strings they output.
87 -\b-v\bv Display r\bre\bea\bad\bdl\bli\bin\bne\be variable names and values in such a way
88 that they can be re-read.
89 -\b-V\bV List current r\bre\bea\bad\bdl\bli\bin\bne\be variable names and values.
90 -\b-f\bf _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
91 Read key bindings from _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be.
92 -\b-q\bq _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn
93 Query about which keys invoke the named _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn.
94 -\b-u\bu _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn
95 Unbind all keys bound to the named _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn.
96 -\b-r\br _\bk_\be_\by_\bs_\be_\bq
97 Remove any current binding for _\bk_\be_\by_\bs_\be_\bq.
98 -\b-x\bx _\bk_\be_\by_\bs_\be_\bq:\b:_\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd
99 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
100 entered. When _\bs_\bh_\be_\bl_\bl_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd is executed, the shell sets
101 the R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_L\bLI\bIN\bNE\bE variable to the contents of the r\bre\bea\bad\bd-\b-
102 l\bli\bin\bne\be line buffer and the R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_P\bPO\bOI\bIN\bNT\bT variable to the
103 current location of the insertion point. If the executed
104 command changes the value of R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE_\b_L\bLI\bIN\bNE\bE or R\bRE\bEA\bAD\bD-\b-
105 L\bLI\bIN\bNE\bE_\b_P\bPO\bOI\bIN\bNT\bT, those new values will be reflected in the
106 editing state.
107
108 The return value is 0 unless an unrecognized option is given or
109 an error occurred.
110
111 b\bbr\bre\bea\bak\bk [_\bn]
112 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
113 specified, break _\bn levels. _\bn must be >= 1. If _\bn is greater
114 than the number of enclosing loops, all enclosing loops are
115 exited. The return value is 0 unless _\bn is not greater than or
116 equal to 1.
117
118 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]
119 Execute the specified shell builtin, passing it _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs, and
120 return its exit status. This is useful when defining a function
121 whose name is the same as a shell builtin, retaining the func-
122 tionality of the builtin within the function. The c\bcd\bd builtin is
123 commonly redefined this way. The return status is false if
124 _\bs_\bh_\be_\bl_\bl_\b-_\bb_\bu_\bi_\bl_\bt_\bi_\bn is not a shell builtin command.
125
126 c\bca\bal\bll\ble\ber\br [_\be_\bx_\bp_\br]
127 Returns the context of any active subroutine call (a shell func-
128 tion or a script executed with the .\b. or s\bso\bou\bur\brc\bce\be builtins. With-
129 out _\be_\bx_\bp_\br, c\bca\bal\bll\ble\ber\br displays the line number and source filename of
130 the current subroutine call. If a non-negative integer is sup-
131 plied as _\be_\bx_\bp_\br, c\bca\bal\bll\ble\ber\br displays the line number, subroutine name,
132 and source file corresponding to that position in the current
133 execution call stack. This extra information may be used, for
134 example, to print a stack trace. The current frame is frame 0.
135 The return value is 0 unless the shell is not executing a sub-
136 routine call or _\be_\bx_\bp_\br does not correspond to a valid position in
137 the call stack.
138
139 c\bcd\bd [-\b-L\bL|\b|-\b-P\bP] [_\bd_\bi_\br]
140 Change the current directory to _\bd_\bi_\br. The variable H\bHO\bOM\bME\bE is the
141 default _\bd_\bi_\br. The variable C\bCD\bDP\bPA\bAT\bTH\bH defines the search path for
142 the directory containing _\bd_\bi_\br. Alternative directory names in
143 C\bCD\bDP\bPA\bAT\bTH\bH are separated by a colon (:). A null directory name in
144 C\bCD\bDP\bPA\bAT\bTH\bH is the same as the current directory, i.e., ``.\b.''. If
145 _\bd_\bi_\br begins with a slash (/), then C\bCD\bDP\bPA\bAT\bTH\bH is not used. The -\b-P\bP
146 option says to use the physical directory structure instead of
147 following symbolic links (see also the -\b-P\bP option to the s\bse\bet\bt
148 builtin command); the -\b-L\bL option forces symbolic links to be fol-
149 lowed. An argument of -\b- is equivalent to $\b$O\bOL\bLD\bDP\bPW\bWD\bD. If a non-
150 empty directory name from C\bCD\bDP\bPA\bAT\bTH\bH is used, or if -\b- is the first
151 argument, and the directory change is successful, the absolute
152 pathname of the new working directory is written to the standard
153 output. The return value is true if the directory was success-
154 fully changed; false otherwise.
155
156 c\bco\bom\bmm\bma\ban\bnd\bd [-\b-p\bpV\bVv\bv] _\bc_\bo_\bm_\bm_\ba_\bn_\bd [_\ba_\br_\bg ...]
157 Run _\bc_\bo_\bm_\bm_\ba_\bn_\bd with _\ba_\br_\bg_\bs suppressing the normal shell function
158 lookup. Only builtin commands or commands found in the P\bPA\bAT\bTH\bH are
159 executed. If the -\b-p\bp option is given, the search for _\bc_\bo_\bm_\bm_\ba_\bn_\bd is
160 performed using a default value for P\bPA\bAT\bTH\bH that is guaranteed to
161 find all of the standard utilities. If either the -\b-V\bV or -\b-v\bv
162 option is supplied, a description of _\bc_\bo_\bm_\bm_\ba_\bn_\bd is printed. The -\b-v\bv
163 option causes a single word indicating the command or file name
164 used to invoke _\bc_\bo_\bm_\bm_\ba_\bn_\bd to be displayed; the -\b-V\bV option produces a
165 more verbose description. If the -\b-V\bV or -\b-v\bv option is supplied,
166 the exit status is 0 if _\bc_\bo_\bm_\bm_\ba_\bn_\bd was found, and 1 if not. If
167 neither option is supplied and an error occurred or _\bc_\bo_\bm_\bm_\ba_\bn_\bd can-
168 not be found, the exit status is 127. Otherwise, the exit sta-
169 tus of the c\bco\bom\bmm\bma\ban\bnd\bd builtin is the exit status of _\bc_\bo_\bm_\bm_\ba_\bn_\bd.
170
171 c\bco\bom\bmp\bpg\bge\ben\bn [_\bo_\bp_\bt_\bi_\bo_\bn] [_\bw_\bo_\br_\bd]
172 Generate possible completion matches for _\bw_\bo_\br_\bd according to the
173 _\bo_\bp_\bt_\bi_\bo_\bns, which may be any option accepted by the c\bco\bom\bmp\bpl\ble\bet\bte\be
174 builtin with the exception of -\b-p\bp and -\b-r\br, and write the matches
175 to the standard output. When using the -\b-F\bF or -\b-C\bC options, the
176 various shell variables set by the programmable completion
177 facilities, while available, will not have useful values.
178
179 The matches will be generated in the same way as if the pro-
180 grammable completion code had generated them directly from a
181 completion specification with the same flags. If _\bw_\bo_\br_\bd is speci-
182 fied, only those completions matching _\bw_\bo_\br_\bd will be displayed.
183
184 The return value is true unless an invalid option is supplied,
185 or no matches were generated.
186
187 c\bco\bom\bmp\bpl\ble\bet\bte\be [-\b-a\bab\bbc\bcd\bde\bef\bfg\bgj\bjk\bks\bsu\buv\bv] [-\b-o\bo _\bc_\bo_\bm_\bp_\b-_\bo_\bp_\bt_\bi_\bo_\bn] [-\b-E\bE] [-\b-A\bA _\ba_\bc_\bt_\bi_\bo_\bn] [-\b-G\bG _\bg_\bl_\bo_\bb_\bp_\ba_\bt]
188 [-\b-W\bW _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt] [-\b-F\bF _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn] [-\b-C\bC _\bc_\bo_\bm_\bm_\ba_\bn_\bd]
189 [-\b-X\bX _\bf_\bi_\bl_\bt_\be_\br_\bp_\ba_\bt] [-\b-P\bP _\bp_\br_\be_\bf_\bi_\bx] [-\b-S\bS _\bs_\bu_\bf_\bf_\bi_\bx] _\bn_\ba_\bm_\be [_\bn_\ba_\bm_\be _\b._\b._\b.]
190 c\bco\bom\bmp\bpl\ble\bet\bte\be -\b-p\bpr\br [-\b-E\bE] [_\bn_\ba_\bm_\be ...]
191 Specify how arguments to each _\bn_\ba_\bm_\be should be completed. If the
192 -\b-p\bp option is supplied, or if no options are supplied, existing
193 completion specifications are printed in a way that allows them
194 to be reused as input. The -\b-r\br option removes a completion spec-
195 ification for each _\bn_\ba_\bm_\be, or, if no _\bn_\ba_\bm_\bes are supplied, all com-
196 pletion specifications. The -\b-E\bE option indicates that the
197 remaining options and actions should apply to ``empty'' command
198 completion; that is, completion attempted on a blank line.
199
200 The process of applying these completion specifications when
201 word completion is attempted is described above under P\bPr\bro\bo-\b-
202 g\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn.
203
204 Other options, if specified, have the following meanings. The
205 arguments to the -\b-G\bG, -\b-W\bW, and -\b-X\bX options (and, if necessary, the
206 -\b-P\bP and -\b-S\bS options) should be quoted to protect them from expan-
207 sion before the c\bco\bom\bmp\bpl\ble\bet\bte\be builtin is invoked.
208 -\b-o\bo _\bc_\bo_\bm_\bp_\b-_\bo_\bp_\bt_\bi_\bo_\bn
209 The _\bc_\bo_\bm_\bp_\b-_\bo_\bp_\bt_\bi_\bo_\bn controls several aspects of the comp-
210 spec's behavior beyond the simple generation of comple-
211 tions. _\bc_\bo_\bm_\bp_\b-_\bo_\bp_\bt_\bi_\bo_\bn may be one of:
212 b\bba\bas\bsh\bhd\bde\bef\bfa\bau\bul\blt\bt
213 Perform the rest of the default b\bba\bas\bsh\bh completions
214 if the compspec generates no matches.
215 d\bde\bef\bfa\bau\bul\blt\bt Use readline's default filename completion if
216 the compspec generates no matches.
217 d\bdi\bir\brn\bna\bam\bme\bes\bs
218 Perform directory name completion if the comp-
219 spec generates no matches.
220 f\bfi\bil\ble\ben\bna\bam\bme\bes\bs
221 Tell readline that the compspec generates file-
222 names, so it can perform any filename-specific
223 processing (like adding a slash to directory
224 names, quoting special characters, or suppress-
225 ing trailing spaces). Intended to be used with
226 shell functions.
227 n\bno\bos\bsp\bpa\bac\bce\be Tell readline not to append a space (the
228 default) to words completed at the end of the
229 line.
230 p\bpl\blu\bus\bsd\bdi\bir\brs\bs
231 After any matches defined by the compspec are
232 generated, directory name completion is
233 attempted and any matches are added to the
234 results of the other actions.
235 -\b-A\bA _\ba_\bc_\bt_\bi_\bo_\bn
236 The _\ba_\bc_\bt_\bi_\bo_\bn may be one of the following to generate a
237 list of possible completions:
238 a\bal\bli\bia\bas\bs Alias names. May also be specified as -\b-a\ba.
239 a\bar\brr\bra\bay\byv\bva\bar\br
240 Array variable names.
241 b\bbi\bin\bnd\bdi\bin\bng\bg R\bRe\bea\bad\bdl\bli\bin\bne\be key binding names.
242 b\bbu\bui\bil\blt\bti\bin\bn Names of shell builtin commands. May also be
243 specified as -\b-b\bb.
244 c\bco\bom\bmm\bma\ban\bnd\bd Command names. May also be specified as -\b-c\bc.
245 d\bdi\bir\bre\bec\bct\bto\bor\bry\by
246 Directory names. May also be specified as -\b-d\bd.
247 d\bdi\bis\bsa\bab\bbl\ble\bed\bd
248 Names of disabled shell builtins.
249 e\ben\bna\bab\bbl\ble\bed\bd Names of enabled shell builtins.
250 e\bex\bxp\bpo\bor\brt\bt Names of exported shell variables. May also be
251 specified as -\b-e\be.
252 f\bfi\bil\ble\be File names. May also be specified as -\b-f\bf.
253 f\bfu\bun\bnc\bct\bti\bio\bon\bn
254 Names of shell functions.
255 g\bgr\bro\bou\bup\bp Group names. May also be specified as -\b-g\bg.
256 h\bhe\bel\blp\bpt\bto\bop\bpi\bic\bc
257 Help topics as accepted by the h\bhe\bel\blp\bp builtin.
258 h\bho\bos\bst\btn\bna\bam\bme\be
259 Hostnames, as taken from the file specified by
260 the H\bHO\bOS\bST\bTF\bFI\bIL\bLE\bE shell variable.
261 j\bjo\bob\bb Job names, if job control is active. May also
262 be specified as -\b-j\bj.
263 k\bke\bey\byw\bwo\bor\brd\bd Shell reserved words. May also be specified as
264 -\b-k\bk.
265 r\bru\bun\bnn\bni\bin\bng\bg Names of running jobs, if job control is active.
266 s\bse\ber\brv\bvi\bic\bce\be Service names. May also be specified as -\b-s\bs.
267 s\bse\bet\bto\bop\bpt\bt Valid arguments for the -\b-o\bo option to the s\bse\bet\bt
268 builtin.
269 s\bsh\bho\bop\bpt\bt Shell option names as accepted by the s\bsh\bho\bop\bpt\bt
270 builtin.
271 s\bsi\big\bgn\bna\bal\bl Signal names.
272 s\bst\bto\bop\bpp\bpe\bed\bd Names of stopped jobs, if job control is active.
273 u\bus\bse\ber\br User names. May also be specified as -\b-u\bu.
274 v\bva\bar\bri\bia\bab\bbl\ble\be
275 Names of all shell variables. May also be spec-
276 ified as -\b-v\bv.
277 -\b-G\bG _\bg_\bl_\bo_\bb_\bp_\ba_\bt
278 The filename expansion pattern _\bg_\bl_\bo_\bb_\bp_\ba_\bt is expanded to
279 generate the possible completions.
280 -\b-W\bW _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt
281 The _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt is split using the characters in the I\bIF\bFS\bS
282 special variable as delimiters, and each resultant word
283 is expanded. The possible completions are the members
284 of the resultant list which match the word being com-
285 pleted.
286 -\b-C\bC _\bc_\bo_\bm_\bm_\ba_\bn_\bd
287 _\bc_\bo_\bm_\bm_\ba_\bn_\bd is executed in a subshell environment, and its
288 output is used as the possible completions.
289 -\b-F\bF _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn
290 The shell function _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn is executed in the current
291 shell environment. When it finishes, the possible com-
292 pletions are retrieved from the value of the C\bCO\bOM\bMP\bPR\bRE\bEP\bPL\bLY\bY
293 array variable.
294 -\b-X\bX _\bf_\bi_\bl_\bt_\be_\br_\bp_\ba_\bt
295 _\bf_\bi_\bl_\bt_\be_\br_\bp_\ba_\bt is a pattern as used for filename expansion.
296 It is applied to the list of possible completions gener-
297 ated by the preceding options and arguments, and each
298 completion matching _\bf_\bi_\bl_\bt_\be_\br_\bp_\ba_\bt is removed from the list.
299 A leading !\b! in _\bf_\bi_\bl_\bt_\be_\br_\bp_\ba_\bt negates the pattern; in this
300 case, any completion not matching _\bf_\bi_\bl_\bt_\be_\br_\bp_\ba_\bt is removed.
301 -\b-P\bP _\bp_\br_\be_\bf_\bi_\bx
302 _\bp_\br_\be_\bf_\bi_\bx is added at the beginning of each possible com-
303 pletion after all other options have been applied.
304 -\b-S\bS _\bs_\bu_\bf_\bf_\bi_\bx
305 _\bs_\bu_\bf_\bf_\bi_\bx is appended to each possible completion after all
306 other options have been applied.
307
308 The return value is true unless an invalid option is supplied,
309 an option other than -\b-p\bp or -\b-r\br is supplied without a _\bn_\ba_\bm_\be argu-
310 ment, an attempt is made to remove a completion specification
311 for a _\bn_\ba_\bm_\be for which no specification exists, or an error occurs
312 adding a completion specification.
313
314 c\bco\bom\bmp\bpo\bop\bpt\bt [-\b-o\bo _\bo_\bp_\bt_\bi_\bo_\bn] [+\b+o\bo _\bo_\bp_\bt_\bi_\bo_\bn] [_\bn_\ba_\bm_\be]
315 Modify completion options for each _\bn_\ba_\bm_\be according to the
316 _\bo_\bp_\bt_\bi_\bo_\bns, or for the currently-execution completion if no _\bn_\ba_\bm_\bes
317 are supplied. If no _\bo_\bp_\bt_\bi_\bo_\bns are given, display the completion
318 options for each _\bn_\ba_\bm_\be or the current completion. The possible
319 values of _\bo_\bp_\bt_\bi_\bo_\bn are those valid for the c\bco\bom\bmp\bpl\ble\bet\bte\be builtin
320 described above.
321
322 The return value is true unless an invalid option is supplied, an
323 attempt is made to modify the options for a _\bn_\ba_\bm_\be for which no comple-
324 tion specification exists, or an output error occurs.
325
326 c\bco\bon\bnt\bti\bin\bnu\bue\be [_\bn]
327 Resume the next iteration of the enclosing f\bfo\bor\br, w\bwh\bhi\bil\ble\be, u\bun\bnt\bti\bil\bl, or
328 s\bse\bel\ble\bec\bct\bt loop. If _\bn is specified, resume at the _\bnth enclosing
329 loop. _\bn must be >= 1. If _\bn is greater than the number of
330 enclosing loops, the last enclosing loop (the ``top-level''
331 loop) is resumed. The return value is 0 unless _\bn is not greater
332 than or equal to 1.
333
334 d\bde\bec\bcl\bla\bar\bre\be [-\b-a\baA\bAf\bfF\bFi\bil\blr\brt\btu\bux\bx] [-\b-p\bp] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ...]
335 t\bty\byp\bpe\bes\bse\bet\bt [-\b-a\baA\bAf\bfF\bFi\bil\blr\brt\btu\bux\bx] [-\b-p\bp] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ...]
336 Declare variables and/or give them attributes. If no _\bn_\ba_\bm_\bes are
337 given then display the values of variables. The -\b-p\bp option will
338 display the attributes and values of each _\bn_\ba_\bm_\be. When -\b-p\bp is used
339 with _\bn_\ba_\bm_\be arguments, additional options are ignored. When -\b-p\bp is
340 supplied without _\bn_\ba_\bm_\be arguments, it will display the attributes
341 and values of all variables having the attributes specified by
342 the additional options. If no other options are supplied with
343 -\b-p\bp, d\bde\bec\bcl\bla\bar\bre\be will display the attributes and values of all shell
344 variables. The -\b-f\bf option will restrict the display to shell
345 functions. The -\b-F\bF option inhibits the display of function defi-
346 nitions; only the function name and attributes are printed. If
347 the e\bex\bxt\btd\bde\beb\bbu\bug\bg shell option is enabled using s\bsh\bho\bop\bpt\bt, the source
348 file name and line number where the function is defined are dis-
349 played as well. The -\b-F\bF option implies -\b-f\bf. The following
350 options can be used to restrict output to variables with the
351 specified attribute or to give variables attributes:
352 -\b-a\ba Each _\bn_\ba_\bm_\be is an indexed array variable (see A\bAr\brr\bra\bay\bys\bs
353 above).
354 -\b-A\bA Each _\bn_\ba_\bm_\be is an associative array variable (see A\bAr\brr\bra\bay\bys\bs
355 above).
356 -\b-f\bf Use function names only.
357 -\b-i\bi The variable is treated as an integer; arithmetic evalua-
358 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
359 variable is assigned a value.
360 -\b-l\bl When the variable is assigned a value, all upper-case
361 characters are converted to lower-case. The upper-case
362 attribute is disabled.
363 -\b-r\br Make _\bn_\ba_\bm_\bes readonly. These names cannot then be assigned
364 values by subsequent assignment statements or unset.
365 -\b-t\bt Give each _\bn_\ba_\bm_\be the _\bt_\br_\ba_\bc_\be attribute. Traced functions
366 inherit the D\bDE\bEB\bBU\bUG\bG and R\bRE\bET\bTU\bUR\bRN\bN traps from the calling
367 shell. The trace attribute has no special meaning for
368 variables.
369 -\b-u\bu When the variable is assigned a value, all lower-case
370 characters are converted to upper-case. The lower-case
371 attribute is disabled.
372 -\b-x\bx Mark _\bn_\ba_\bm_\bes for export to subsequent commands via the
373 environment.
374
375 Using `+' instead of `-' turns off the attribute instead, with
376 the exceptions that +\b+a\ba may not be used to destroy an array vari-
377 able and +\b+r\br w\bwi\bil\bll\bl n\bno\bot\bt r\bre\bem\bmo\bov\bve\be t\bth\bhe\be r\bre\bea\bad\bdo\bon\bnl\bly\by a\bat\btt\btr\bri\bib\bbu\but\bte\be.\b. W\bWh\bhe\ben\bn u\bus\bse\bed\bd
378 i\bin\bn a\ba f\bfu\bun\bnc\bct\bti\bio\bon\bn,\b, m\bma\bak\bke\bes\bs e\bea\bac\bch\bh _\bn_\ba_\bm_\be l\blo\boc\bca\bal\bl,\b, a\bas\bs w\bwi\bit\bth\bh t\bth\bhe\be l\blo\boc\bca\bal\bl command.
379 If a variable name is followed by =_\bv_\ba_\bl_\bu_\be, the value of the vari-
380 able is set to _\bv_\ba_\bl_\bu_\be. The return value is 0 unless an invalid
381 option is encountered, an attempt is made to define a function
382 using ``-f foo=bar'', an attempt is made to assign a value to a
383 readonly variable, an attempt is made to assign a value to an
384 array variable without using the compound assignment syntax (see
385 A\bAr\brr\bra\bay\bys\bs above), one of the _\bn_\ba_\bm_\be_\bs is not a valid shell variable
386 name, an attempt is made to turn off readonly status for a read-
387 only variable, an attempt is made to turn off array status for
388 an array variable, or an attempt is made to display a non-exis-
389 tent function with -\b-f\bf.
390
391 d\bdi\bir\brs\bs [\b[+\b+_\bn]\b] [\b[-\b-_\bn]\b] [\b[-\b-c\bcp\bpl\blv\bv]\b]
392 Without options, displays the list of currently remembered
393 directories. The default display is on a single line with
394 directory names separated by spaces. Directories are added to
395 the list with the p\bpu\bus\bsh\bhd\bd command; the p\bpo\bop\bpd\bd command removes
396 entries from the list.
397 +\b+_\bn Displays the _\bnth entry counting from the left of the list
398 shown by d\bdi\bir\brs\bs when invoked without options, starting with
399 zero.
400 -\b-_\bn Displays the _\bnth entry counting from the right of the
401 list shown by d\bdi\bir\brs\bs when invoked without options, starting
402 with zero.
403 -\b-c\bc Clears the directory stack by deleting all of the
404 entries.
405 -\b-l\bl Produces a longer listing; the default listing format
406 uses a tilde to denote the home directory.
407 -\b-p\bp Print the directory stack with one entry per line.
408 -\b-v\bv Print the directory stack with one entry per line, pre-
409 fixing each entry with its index in the stack.
410
411 The return value is 0 unless an invalid option is supplied or _\bn
412 indexes beyond the end of the directory stack.
413
414 d\bdi\bis\bso\bow\bwn\bn [-\b-a\bar\br] [-\b-h\bh] [_\bj_\bo_\bb_\bs_\bp_\be_\bc ...]
415 Without options, each _\bj_\bo_\bb_\bs_\bp_\be_\bc is removed from the table of
416 active jobs. If _\bj_\bo_\bb_\bs_\bp_\be_\bc is not present, and neither -\b-a\ba n\bno\bor\br -\b-r\br
417 i\bis\bs s\bsu\bup\bpp\bpl\bli\bie\bed\bd,\b, t\bth\bhe\be s\bsh\bhe\bel\bll\bl'\b's\bs n\bno\bot\bti\bio\bon\bn o\bof\bf t\bth\bhe\be _\bc_\bu_\br_\br_\be_\bn_\bt _\bj_\bo_\bb i\bis\bs u\bus\bse\bed\bd.\b. I\bIf\bf
418 t\bth\bhe\be -\b-h\bh o\bop\bpt\bti\bio\bon\bn i\bis\bs g\bgi\biv\bve\ben\bn,\b, e\bea\bac\bch\bh _\bj_\bo_\bb_\bs_\bp_\be_\bc is not removed from the ta-
419 ble, but is marked so that S\bSI\bIG\bGH\bHU\bUP\bP is not sent to the job if the
420 shell receives a S\bSI\bIG\bGH\bHU\bUP\bP. If no _\bj_\bo_\bb_\bs_\bp_\be_\bc is present, and neither
421 the -\b-a\ba nor the -\b-r\br option is supplied, the _\bc_\bu_\br_\br_\be_\bn_\bt _\bj_\bo_\bb is used.
422 If no _\bj_\bo_\bb_\bs_\bp_\be_\bc is supplied, the -\b-a\ba option means to remove or mark
423 all jobs; the -\b-r\br option without a _\bj_\bo_\bb_\bs_\bp_\be_\bc argument restricts
424 operation to running jobs. The return value is 0 unless a _\bj_\bo_\bb_\b-
425 _\bs_\bp_\be_\bc does not specify a valid job.
426
427 e\bec\bch\bho\bo [-\b-n\bne\beE\bE] [_\ba_\br_\bg ...]
428 Output the _\ba_\br_\bgs, separated by spaces, followed by a newline.
429 The return status is always 0. If -\b-n\bn is specified, the trailing
430 newline is suppressed. If the -\b-e\be option is given, interpreta-
431 tion of the following backslash-escaped characters is enabled.
432 The -\b-E\bE option disables the interpretation of these escape char-
433 acters, even on systems where they are interpreted by default.
434 The x\bxp\bpg\bg_\b_e\bec\bch\bho\bo shell option may be used to dynamically determine
435 whether or not e\bec\bch\bho\bo expands these escape characters by default.
436 e\bec\bch\bho\bo does not interpret -\b--\b- to mean the end of options. e\bec\bch\bho\bo
437 interprets the following escape sequences:
438 \\b\a\ba alert (bell)
439 \\b\b\bb backspace
440 \\b\c\bc suppress further output
441 \\b\e\be an escape character
442 \\b\f\bf form feed
443 \\b\n\bn new line
444 \\b\r\br carriage return
445 \\b\t\bt horizontal tab
446 \\b\v\bv vertical tab
447 \\b\\\b\ backslash
448 \\b\0\b0_\bn_\bn_\bn the eight-bit character whose value is the octal value
449 _\bn_\bn_\bn (zero to three octal digits)
450 \\b\x\bx_\bH_\bH the eight-bit character whose value is the hexadecimal
451 value _\bH_\bH (one or two hex digits)
452
453 e\ben\bna\bab\bbl\ble\be [-\b-a\ba] [-\b-d\bdn\bnp\bps\bs] [-\b-f\bf _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be] [_\bn_\ba_\bm_\be ...]
454 Enable and disable builtin shell commands. Disabling a builtin
455 allows a disk command which has the same name as a shell builtin
456 to be executed without specifying a full pathname, even though
457 the shell normally searches for builtins before disk commands.
458 If -\b-n\bn is used, each _\bn_\ba_\bm_\be is disabled; otherwise, _\bn_\ba_\bm_\be_\bs are
459 enabled. For example, to use the t\bte\bes\bst\bt binary found via the P\bPA\bAT\bTH\bH
460 instead of the shell builtin version, run ``enable -n test''.
461 The -\b-f\bf option means to load the new builtin command _\bn_\ba_\bm_\be from
462 shared object _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be, on systems that support dynamic loading.
463 The -\b-d\bd option will delete a builtin previously loaded with -\b-f\bf.
464 If no _\bn_\ba_\bm_\be arguments are given, or if the -\b-p\bp option is supplied,
465 a list of shell builtins is printed. With no other option argu-
466 ments, the list consists of all enabled shell builtins. If -\b-n\bn
467 is supplied, only disabled builtins are printed. If -\b-a\ba is sup-
468 plied, the list printed includes all builtins, with an indica-
469 tion of whether or not each is enabled. If -\b-s\bs is supplied, the
470 output is restricted to the POSIX _\bs_\bp_\be_\bc_\bi_\ba_\bl builtins. The return
471 value is 0 unless a _\bn_\ba_\bm_\be is not a shell builtin or there is an
472 error loading a new builtin from a shared object.
473
474 e\bev\bva\bal\bl [_\ba_\br_\bg ...]
475 The _\ba_\br_\bgs are read and concatenated together into a single com-
476 mand. This command is then read and executed by the shell, and
477 its exit status is returned as the value of e\bev\bva\bal\bl. If there are
478 no _\ba_\br_\bg_\bs, or only null arguments, e\bev\bva\bal\bl returns 0.
479
480 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]]
481 If _\bc_\bo_\bm_\bm_\ba_\bn_\bd is specified, it replaces the shell. No new process
482 is created. The _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs become the arguments to _\bc_\bo_\bm_\bm_\ba_\bn_\bd. If
483 the -\b-l\bl option is supplied, the shell places a dash at the begin-
484 ning of the zeroth argument passed to _\bc_\bo_\bm_\bm_\ba_\bn_\bd. This is what
485 _\bl_\bo_\bg_\bi_\bn(1) does. The -\b-c\bc option causes _\bc_\bo_\bm_\bm_\ba_\bn_\bd to be executed with
486 an empty environment. If -\b-a\ba is supplied, the shell passes _\bn_\ba_\bm_\be
487 as the zeroth argument to the executed command. If _\bc_\bo_\bm_\bm_\ba_\bn_\bd can-
488 not be executed for some reason, a non-interactive shell exits,
489 unless the shell option e\bex\bxe\bec\bcf\bfa\bai\bil\bl is enabled, in which case it
490 returns failure. An interactive shell returns failure if the
491 file cannot be executed. If _\bc_\bo_\bm_\bm_\ba_\bn_\bd is not specified, any redi-
492 rections take effect in the current shell, and the return status
493 is 0. If there is a redirection error, the return status is 1.
494
495 e\bex\bxi\bit\bt [_\bn]
496 Cause the shell to exit with a status of _\bn. If _\bn is omitted,
497 the exit status is that of the last command executed. A trap on
498 E\bEX\bXI\bIT\bT is executed before the shell terminates.
499
500 e\bex\bxp\bpo\bor\brt\bt [-\b-f\bfn\bn] [_\bn_\ba_\bm_\be[=_\bw_\bo_\br_\bd]] ...
501 e\bex\bxp\bpo\bor\brt\bt -\b-p\bp
502 The supplied _\bn_\ba_\bm_\be_\bs are marked for automatic export to the envi-
503 ronment of subsequently executed commands. If the -\b-f\bf option is
504 given, the _\bn_\ba_\bm_\be_\bs refer to functions. If no _\bn_\ba_\bm_\be_\bs are given, or
505 if the -\b-p\bp option is supplied, a list of all names that are
506 exported in this shell is printed. The -\b-n\bn option causes the
507 export property to be removed from each _\bn_\ba_\bm_\be. If a variable
508 name is followed by =_\bw_\bo_\br_\bd, the value of the variable is set to
509 _\bw_\bo_\br_\bd. e\bex\bxp\bpo\bor\brt\bt returns an exit status of 0 unless an invalid
510 option is encountered, one of the _\bn_\ba_\bm_\be_\bs is not a valid shell
511 variable name, or -\b-f\bf is supplied with a _\bn_\ba_\bm_\be that is not a func-
512 tion.
513
514 f\bfc\bc [-\b-e\be _\be_\bn_\ba_\bm_\be] [-\b-l\bln\bnr\br] [_\bf_\bi_\br_\bs_\bt] [_\bl_\ba_\bs_\bt]
515 f\bfc\bc -\b-s\bs [_\bp_\ba_\bt=_\br_\be_\bp] [_\bc_\bm_\bd]
516 Fix Command. In the first form, a range of commands from _\bf_\bi_\br_\bs_\bt
517 to _\bl_\ba_\bs_\bt is selected from the history list. _\bF_\bi_\br_\bs_\bt and _\bl_\ba_\bs_\bt may
518 be specified as a string (to locate the last command beginning
519 with that string) or as a number (an index into the history
520 list, where a negative number is used as an offset from the cur-
521 rent command number). If _\bl_\ba_\bs_\bt is not specified it is set to the
522 current command for listing (so that ``fc -l -10'' prints the
523 last 10 commands) and to _\bf_\bi_\br_\bs_\bt otherwise. If _\bf_\bi_\br_\bs_\bt is not spec-
524 ified it is set to the previous command for editing and -16 for
525 listing.
526
527 The -\b-n\bn option suppresses the command numbers when listing. The
528 -\b-r\br option reverses the order of the commands. If the -\b-l\bl option
529 is given, the commands are listed on standard output. Other-
530 wise, the editor given by _\be_\bn_\ba_\bm_\be is invoked on a file containing
531 those commands. If _\be_\bn_\ba_\bm_\be is not given, the value of the F\bFC\bCE\bED\bDI\bIT\bT
532 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.
533 If neither variable is set, is used. When editing is complete,
534 the edited commands are echoed and executed.
535
536 In the second form, _\bc_\bo_\bm_\bm_\ba_\bn_\bd is re-executed after each instance
537 of _\bp_\ba_\bt is replaced by _\br_\be_\bp. A useful alias to use with this is
538 ``r="fc -s"'', so that typing ``r cc'' runs the last command
539 beginning with ``cc'' and typing ``r'' re-executes the last com-
540 mand.
541
542 If the first form is used, the return value is 0 unless an
543 invalid option is encountered or _\bf_\bi_\br_\bs_\bt or _\bl_\ba_\bs_\bt specify history
544 lines out of range. If the -\b-e\be option is supplied, the return
545 value is the value of the last command executed or failure if an
546 error occurs with the temporary file of commands. If the second
547 form is used, the return status is that of the command re-exe-
548 cuted, unless _\bc_\bm_\bd does not specify a valid history line, in
549 which case f\bfc\bc returns failure.
550
551 f\bfg\bg [_\bj_\bo_\bb_\bs_\bp_\be_\bc]
552 Resume _\bj_\bo_\bb_\bs_\bp_\be_\bc in the foreground, and make it the current job.
553 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
554 is used. The return value is that of the command placed into
555 the foreground, or failure if run when job control is disabled
556 or, when run with job control enabled, if _\bj_\bo_\bb_\bs_\bp_\be_\bc does not spec-
557 ify a valid job or _\bj_\bo_\bb_\bs_\bp_\be_\bc specifies a job that was started
558 without job control.
559
560 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]
561 g\bge\bet\bto\bop\bpt\bts\bs is used by shell procedures to parse positional parame-
562 ters. _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg contains the option characters to be recog-
563 nized; if a character is followed by a colon, the option is
564 expected to have an argument, which should be separated from it
565 by white space. The colon and question mark characters may not
566 be used as option characters. Each time it is invoked, g\bge\bet\bto\bop\bpt\bts\bs
567 places the next option in the shell variable _\bn_\ba_\bm_\be, initializing
568 _\bn_\ba_\bm_\be if it does not exist, and the index of the next argument to
569 be processed into the variable O\bOP\bPT\bTI\bIN\bND\bD. O\bOP\bPT\bTI\bIN\bND\bD is initialized to
570 1 each time the shell or a shell script is invoked. When an
571 option requires an argument, g\bge\bet\bto\bop\bpt\bts\bs places that argument into
572 the variable O\bOP\bPT\bTA\bAR\bRG\bG. The shell does not reset O\bOP\bPT\bTI\bIN\bND\bD automati-
573 cally; it must be manually reset between multiple calls to
574 g\bge\bet\bto\bop\bpt\bts\bs within the same shell invocation if a new set of parame-
575 ters is to be used.
576
577 When the end of options is encountered, g\bge\bet\bto\bop\bpt\bts\bs exits with a
578 return value greater than zero. O\bOP\bPT\bTI\bIN\bND\bD is set to the index of
579 the first non-option argument, and n\bna\bam\bme\be is set to ?.
580
581 g\bge\bet\bto\bop\bpt\bts\bs normally parses the positional parameters, but if more
582 arguments are given in _\ba_\br_\bg_\bs, g\bge\bet\bto\bop\bpt\bts\bs parses those instead.
583
584 g\bge\bet\bto\bop\bpt\bts\bs can report errors in two ways. If the first character
585 of _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg is a colon, _\bs_\bi_\bl_\be_\bn_\bt error reporting is used. In
586 normal operation diagnostic messages are printed when invalid
587 options or missing option arguments are encountered. If the
588 variable O\bOP\bPT\bTE\bER\bRR\bR is set to 0, no error messages will be dis-
589 played, even if the first character of _\bo_\bp_\bt_\bs_\bt_\br_\bi_\bn_\bg is not a colon.
590
591 If an invalid option is seen, g\bge\bet\bto\bop\bpt\bts\bs places ? into _\bn_\ba_\bm_\be and, if
592 not silent, prints an error message and unsets O\bOP\bPT\bTA\bAR\bRG\bG. If
593 g\bge\bet\bto\bop\bpt\bts\bs is silent, the option character found is placed in
594 O\bOP\bPT\bTA\bAR\bRG\bG and no diagnostic message is printed.
595
596 If a required argument is not found, and g\bge\bet\bto\bop\bpt\bts\bs is not silent,
597 a question mark (?\b?) is placed in _\bn_\ba_\bm_\be, O\bOP\bPT\bTA\bAR\bRG\bG is unset, and a
598 diagnostic message is printed. If g\bge\bet\bto\bop\bpt\bts\bs is silent, then a
599 colon (:\b:) is placed in _\bn_\ba_\bm_\be and O\bOP\bPT\bTA\bAR\bRG\bG is set to the option
600 character found.
601
602 g\bge\bet\bto\bop\bpt\bts\bs returns true if an option, specified or unspecified, is
603 found. It returns false if the end of options is encountered or
604 an error occurs.
605
606 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]
607 For each _\bn_\ba_\bm_\be, the full file name of the command is determined
608 by searching the directories in $\b$P\bPA\bAT\bTH\bH and remembered. If the -\b-p\bp
609 option is supplied, no path search is performed, and _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is
610 used as the full file name of the command. The -\b-r\br option causes
611 the shell to forget all remembered locations. The -\b-d\bd option
612 causes the shell to forget the remembered location of each _\bn_\ba_\bm_\be.
613 If the -\b-t\bt option is supplied, the full pathname to which each
614 _\bn_\ba_\bm_\be corresponds is printed. If multiple _\bn_\ba_\bm_\be arguments are
615 supplied with -\b-t\bt, the _\bn_\ba_\bm_\be is printed before the hashed full
616 pathname. The -\b-l\bl option causes output to be displayed in a for-
617 mat that may be reused as input. If no arguments are given, or
618 if only -\b-l\bl is supplied, information about remembered commands is
619 printed. The return status is true unless a _\bn_\ba_\bm_\be is not found
620 or an invalid option is supplied.
621
622 h\bhe\bel\blp\bp [-\b-d\bdm\bms\bs] [_\bp_\ba_\bt_\bt_\be_\br_\bn]
623 Display helpful information about builtin commands. If _\bp_\ba_\bt_\bt_\be_\br_\bn
624 is specified, h\bhe\bel\blp\bp gives detailed help on all commands matching
625 _\bp_\ba_\bt_\bt_\be_\br_\bn; otherwise help for all the builtins and shell control
626 structures is printed.
627 -\b-d\bd Display a short description of each _\bp_\ba_\bt_\bt_\be_\br_\bn
628 -\b-m\bm Display the description of each _\bp_\ba_\bt_\bt_\be_\br_\bn in a manpage-like
629 format
630 -\b-s\bs Display only a short usage synopsis for each _\bp_\ba_\bt_\bt_\be_\br_\bn
631 The return status is 0 unless no command matches _\bp_\ba_\bt_\bt_\be_\br_\bn.
632
633 h\bhi\bis\bst\bto\bor\bry\by [\b[_\bn]\b]
634 h\bhi\bis\bst\bto\bor\bry\by -\b-c\bc
635 h\bhi\bis\bst\bto\bor\bry\by -\b-d\bd _\bo_\bf_\bf_\bs_\be_\bt
636 h\bhi\bis\bst\bto\bor\bry\by -\b-a\ban\bnr\brw\bw [_\bf_\bi_\bl_\be_\bn_\ba_\bm_\be]
637 h\bhi\bis\bst\bto\bor\bry\by -\b-p\bp _\ba_\br_\bg [_\ba_\br_\bg _\b._\b._\b.]
638 h\bhi\bis\bst\bto\bor\bry\by -\b-s\bs _\ba_\br_\bg [_\ba_\br_\bg _\b._\b._\b.]
639 With no options, display the command history list with line num-
640 bers. Lines listed with a *\b* have been modified. An argument of
641 _\bn lists only the last _\bn lines. If the shell variable H\bHI\bIS\bST\bTT\bTI\bIM\bME\bE-\b-
642 F\bFO\bOR\bRM\bMA\bAT\bT is set and not null, it is used as a format string for
643 _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be(3) to display the time stamp associated with each dis-
644 played history entry. No intervening blank is printed between
645 the formatted time stamp and the history line. If _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be is
646 supplied, it is used as the name of the history file; if not,
647 the value of H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE is used. Options, if supplied, have the
648 following meanings:
649 -\b-c\bc Clear the history list by deleting all the entries.
650 -\b-d\bd _\bo_\bf_\bf_\bs_\be_\bt
651 Delete the history entry at position _\bo_\bf_\bf_\bs_\be_\bt.
652 -\b-a\ba Append the ``new'' history lines (history lines entered
653 since the beginning of the current b\bba\bas\bsh\bh session) to the
654 history file.
655 -\b-n\bn Read the history lines not already read from the history
656 file into the current history list. These are lines
657 appended to the history file since the beginning of the
658 current b\bba\bas\bsh\bh session.
659 -\b-r\br Read the contents of the history file and use them as the
660 current history.
661 -\b-w\bw Write the current history to the history file, overwrit-
662 ing the history file's contents.
663 -\b-p\bp Perform history substitution on the following _\ba_\br_\bg_\bs and
664 display the result on the standard output. Does not
665 store the results in the history list. Each _\ba_\br_\bg must be
666 quoted to disable normal history expansion.
667 -\b-s\bs Store the _\ba_\br_\bg_\bs in the history list as a single entry.
668 The last command in the history list is removed before
669 the _\ba_\br_\bg_\bs are added.
670
671 If the H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT is set, the time stamp information associ-
672 ated with each history entry is written to the history file,
673 marked with the history comment character. When the history
674 file is read, lines beginning with the history comment character
675 followed immediately by a digit are interpreted as timestamps
676 for the previous history line. The return value is 0 unless an
677 invalid option is encountered, an error occurs while reading or
678 writing the history file, an invalid _\bo_\bf_\bf_\bs_\be_\bt is supplied as an
679 argument to -\b-d\bd, or the history expansion supplied as an argument
680 to -\b-p\bp fails.
681
682 j\bjo\bob\bbs\bs [-\b-l\bln\bnp\bpr\brs\bs] [ _\bj_\bo_\bb_\bs_\bp_\be_\bc ... ]
683 j\bjo\bob\bbs\bs -\b-x\bx _\bc_\bo_\bm_\bm_\ba_\bn_\bd [ _\ba_\br_\bg_\bs ... ]
684 The first form lists the active jobs. The options have the fol-
685 lowing meanings:
686 -\b-l\bl List process IDs in addition to the normal information.
687 -\b-p\bp List only the process ID of the job's process group
688 leader.
689 -\b-n\bn Display information only about jobs that have changed
690 status since the user was last notified of their status.
691 -\b-r\br Restrict output to running jobs.
692 -\b-s\bs Restrict output to stopped jobs.
693
694 If _\bj_\bo_\bb_\bs_\bp_\be_\bc is given, output is restricted to information about
695 that job. The return status is 0 unless an invalid option is
696 encountered or an invalid _\bj_\bo_\bb_\bs_\bp_\be_\bc is supplied.
697
698 If the -\b-x\bx option is supplied, j\bjo\bob\bbs\bs replaces any _\bj_\bo_\bb_\bs_\bp_\be_\bc found in
699 _\bc_\bo_\bm_\bm_\ba_\bn_\bd or _\ba_\br_\bg_\bs with the corresponding process group ID, and
700 executes _\bc_\bo_\bm_\bm_\ba_\bn_\bd passing it _\ba_\br_\bg_\bs, returning its exit status.
701
702 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] ...
703 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]
704 Send the signal named by _\bs_\bi_\bg_\bs_\bp_\be_\bc or _\bs_\bi_\bg_\bn_\bu_\bm to the processes
705 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
706 signal name such as S\bSI\bIG\bGK\bKI\bIL\bLL\bL (with or without the S\bSI\bIG\bG prefix) or
707 a signal number; _\bs_\bi_\bg_\bn_\bu_\bm is a signal number. If _\bs_\bi_\bg_\bs_\bp_\be_\bc is not
708 present, then S\bSI\bIG\bGT\bTE\bER\bRM\bM is assumed. An argument of -\b-l\bl lists the
709 signal names. If any arguments are supplied when -\b-l\bl is given,
710 the names of the signals corresponding to the arguments are
711 listed, and the return status is 0. The _\be_\bx_\bi_\bt_\b__\bs_\bt_\ba_\bt_\bu_\bs argument to
712 -\b-l\bl is a number specifying either a signal number or the exit
713 status of a process terminated by a signal. k\bki\bil\bll\bl returns true
714 if at least one signal was successfully sent, or false if an
715 error occurs or an invalid option is encountered.
716
717 l\ble\bet\bt _\ba_\br_\bg [_\ba_\br_\bg ...]
718 Each _\ba_\br_\bg is an arithmetic expression to be evaluated (see A\bAR\bRI\bIT\bTH\bH-\b-
719 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
720 1; 0 is returned otherwise.
721
722 l\blo\boc\bca\bal\bl [_\bo_\bp_\bt_\bi_\bo_\bn] [_\bn_\ba_\bm_\be[=_\bv_\ba_\bl_\bu_\be] ...]
723 For each argument, a local variable named _\bn_\ba_\bm_\be is created, and
724 assigned _\bv_\ba_\bl_\bu_\be. The _\bo_\bp_\bt_\bi_\bo_\bn can be any of the options accepted
725 by d\bde\bec\bcl\bla\bar\bre\be. When l\blo\boc\bca\bal\bl is used within a function, it causes the
726 variable _\bn_\ba_\bm_\be to have a visible scope restricted to that func-
727 tion and its children. With no operands, l\blo\boc\bca\bal\bl writes a list of
728 local variables to the standard output. It is an error to use
729 l\blo\boc\bca\bal\bl when not within a function. The return status is 0 unless
730 l\blo\boc\bca\bal\bl is used outside a function, an invalid _\bn_\ba_\bm_\be is supplied,
731 or _\bn_\ba_\bm_\be is a readonly variable.
732
733 l\blo\bog\bgo\bou\but\bt Exit a login shell.
734
735 m\bma\bap\bpf\bfi\bil\ble\be [-\b-n\bn _\bc_\bo_\bu_\bn_\bt] [-\b-O\bO _\bo_\br_\bi_\bg_\bi_\bn] [-\b-s\bs _\bc_\bo_\bu_\bn_\bt] [-\b-t\bt] [-\b-u\bu _\bf_\bd] [-\b-C\bC _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk]
736 [-\b-c\bc _\bq_\bu_\ba_\bn_\bt_\bu_\bm] [_\ba_\br_\br_\ba_\by]
737 r\bre\bea\bad\bda\bar\brr\bra\bay\by [-\b-n\bn _\bc_\bo_\bu_\bn_\bt] [-\b-O\bO _\bo_\br_\bi_\bg_\bi_\bn] [-\b-s\bs _\bc_\bo_\bu_\bn_\bt] [-\b-t\bt] [-\b-u\bu _\bf_\bd] [-\b-C\bC _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk]
738 [-\b-c\bc _\bq_\bu_\ba_\bn_\bt_\bu_\bm] [_\ba_\br_\br_\ba_\by]
739 Read lines from the standard input into array variable _\ba_\br_\br_\ba_\by, or
740 from file descriptor _\bf_\bd if the -\b-u\bu option is supplied. The vari-
741 able M\bMA\bAP\bPF\bFI\bIL\bLE\bE is the default _\ba_\br_\br_\ba_\by. Options, if supplied, have
742 the following meanings:
743 -\b-n\bn Copy at most _\bc_\bo_\bu_\bn_\bt lines. If _\bc_\bo_\bu_\bn_\bt is 0, all lines are
744 copied.
745 -\b-O\bO Begin assigning to _\ba_\br_\br_\ba_\by at index _\bo_\br_\bi_\bg_\bi_\bn. The default
746 index is 0.
747 -\b-s\bs Discard the first _\bc_\bo_\bu_\bn_\bt lines read.
748 -\b-t\bt Remove a trailing line from each line read.
749 -\b-u\bu Read lines from file descriptor _\bf_\bd instead of the stan-
750 dard input.
751 -\b-C\bC Evaluate _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk each time _\bq_\bu_\ba_\bn_\bt_\bu_\bm lines are read. The
752 -\b-c\bc option specifies _\bq_\bu_\ba_\bn_\bt_\bu_\bm.
753 -\b-c\bc Specify the number of lines read between each call to
754 _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk.
755
756 If -\b-C\bC is specified without -\b-c\bc, the default quantum is 5000.
757 When _\bc_\ba_\bl_\bl_\bb_\ba_\bc_\bk is evaluated, it is supplied the index of the next
758 array element to be assigned as an additional argument. _\bc_\ba_\bl_\bl_\b-
759 _\bb_\ba_\bc_\bk is evaluated after the line is read but before the array
760 element is assigned.
761
762 If not supplied with an explicit origin, m\bma\bap\bpf\bfi\bil\ble\be will clear
763 _\ba_\br_\br_\ba_\by before assigning to it.
764
765 m\bma\bap\bpf\bfi\bil\ble\be returns successfully unless an invalid option or option
766 argument is supplied, or _\ba_\br_\br_\ba_\by is invalid or unassignable.
767
768 p\bpo\bop\bpd\bd [-n\bn] [+_\bn] [-_\bn]
769 Removes entries from the directory stack. With no arguments,
770 removes the top directory from the stack, and performs a c\bcd\bd to
771 the new top directory. Arguments, if supplied, have the follow-
772 ing meanings:
773 -\b-n\bn Suppresses the normal change of directory when removing
774 directories from the stack, so that only the stack is
775 manipulated.
776 +\b+_\bn Removes the _\bnth entry counting from the left of the list
777 shown by d\bdi\bir\brs\bs, starting with zero. For example: ``popd
778 +0'' removes the first directory, ``popd +1'' the second.
779 -\b-_\bn Removes the _\bnth entry counting from the right of the list
780 shown by d\bdi\bir\brs\bs, starting with zero. For example: ``popd
781 -0'' removes the last directory, ``popd -1'' the next to
782 last.
783
784 If the p\bpo\bop\bpd\bd command is successful, a d\bdi\bir\brs\bs is performed as well,
785 and the return status is 0. p\bpo\bop\bpd\bd returns false if an invalid
786 option is encountered, the directory stack is empty, a non-exis-
787 tent directory stack entry is specified, or the directory change
788 fails.
789
790 p\bpr\bri\bin\bnt\btf\bf [-\b-v\bv _\bv_\ba_\br] _\bf_\bo_\br_\bm_\ba_\bt [_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
791 Write the formatted _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs to the standard output under the
792 control of the _\bf_\bo_\br_\bm_\ba_\bt. The _\bf_\bo_\br_\bm_\ba_\bt is a character string which
793 contains three types of objects: plain characters, which are
794 simply copied to standard output, character escape sequences,
795 which are converted and copied to the standard output, and for-
796 mat specifications, each of which causes printing of the next
797 successive _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt. In addition to the standard _\bp_\br_\bi_\bn_\bt_\bf(1) for-
798 mats, %\b%b\bb causes p\bpr\bri\bin\bnt\btf\bf to expand backslash escape sequences in
799 the corresponding _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt (except that \\b\c\bc terminates output,
800 backslashes in \\b\'\b', \\b\"\b", and \\b\?\b? are not removed, and octal escapes
801 beginning with \\b\0\b0 may contain up to four digits), and %\b%q\bq causes
802 p\bpr\bri\bin\bnt\btf\bf to output the corresponding _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt in a format that can
803 be reused as shell input.
804
805 The -\b-v\bv option causes the output to be assigned to the variable
806 _\bv_\ba_\br rather than being printed to the standard output.
807
808 The _\bf_\bo_\br_\bm_\ba_\bt is reused as necessary to consume all of the _\ba_\br_\bg_\bu_\b-
809 _\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,
810 the extra format specifications behave as if a zero value or
811 null string, as appropriate, had been supplied. The return
812 value is zero on success, non-zero on failure.
813
814 p\bpu\bus\bsh\bhd\bd [-\b-n\bn] [+_\bn] [-_\bn]
815 p\bpu\bus\bsh\bhd\bd [-\b-n\bn] [_\bd_\bi_\br]
816 Adds a directory to the top of the directory stack, or rotates
817 the stack, making the new top of the stack the current working
818 directory. With no arguments, exchanges the top two directories
819 and returns 0, unless the directory stack is empty. Arguments,
820 if supplied, have the following meanings:
821 -\b-n\bn Suppresses the normal change of directory when adding
822 directories to the stack, so that only the stack is
823 manipulated.
824 +\b+_\bn Rotates the stack so that the _\bnth directory (counting
825 from the left of the list shown by d\bdi\bir\brs\bs, starting with
826 zero) is at the top.
827 -\b-_\bn Rotates the stack so that the _\bnth directory (counting
828 from the right of the list shown by d\bdi\bir\brs\bs, starting with
829 zero) is at the top.
830 _\bd_\bi_\br Adds _\bd_\bi_\br to the directory stack at the top, making it the
831 new current working directory.
832
833 If the p\bpu\bus\bsh\bhd\bd command is successful, a d\bdi\bir\brs\bs is performed as well.
834 If the first form is used, p\bpu\bus\bsh\bhd\bd returns 0 unless the cd to _\bd_\bi_\br
835 fails. With the second form, p\bpu\bus\bsh\bhd\bd returns 0 unless the direc-
836 tory stack is empty, a non-existent directory stack element is
837 specified, or the directory change to the specified new current
838 directory fails.
839
840 p\bpw\bwd\bd [-\b-L\bLP\bP]
841 Print the absolute pathname of the current working directory.
842 The pathname printed contains no symbolic links if the -\b-P\bP option
843 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
844 is enabled. If the -\b-L\bL option is used, the pathname printed may
845 contain symbolic links. The return status is 0 unless an error
846 occurs while reading the name of the current directory or an
847 invalid option is supplied.
848
849 r\bre\bea\bad\bd [-\b-e\ber\brs\bs] [-\b-a\ba _\ba_\bn_\ba_\bm_\be] [-\b-d\bd _\bd_\be_\bl_\bi_\bm] [-\b- _\bt_\be_\bx_\bt] [-\b-n\bn _\bn_\bc_\bh_\ba_\br_\bs] [-\b-p\bp _\bp_\br_\bo_\bm_\bp_\bt] [-\b-t\bt
850 _\bt_\bi_\bm_\be_\bo_\bu_\bt] [-\b-u\bu _\bf_\bd] [_\bn_\ba_\bm_\be ...]
851 One line is read from the standard input, or from the file
852 descriptor _\bf_\bd supplied as an argument to the -\b-u\bu option, and the
853 first word is assigned to the first _\bn_\ba_\bm_\be, the second word to the
854 second _\bn_\ba_\bm_\be, and so on, with leftover words and their interven-
855 ing separators assigned to the last _\bn_\ba_\bm_\be. If there are fewer
856 words read from the input stream than names, the remaining names
857 are assigned empty values. The characters in I\bIF\bFS\bS are used to
858 split the line into words. The backslash character (\\b\) may be
859 used to remove any special meaning for the next character read
860 and for line continuation. Options, if supplied, have the fol-
861 lowing meanings:
862 -\b-a\ba _\ba_\bn_\ba_\bm_\be
863 The words are assigned to sequential indices of the array
864 variable _\ba_\bn_\ba_\bm_\be, starting at 0. _\ba_\bn_\ba_\bm_\be is unset before any
865 new values are assigned. Other _\bn_\ba_\bm_\be arguments are
866 ignored.
867 -\b-d\bd _\bd_\be_\bl_\bi_\bm
868 The first character of _\bd_\be_\bl_\bi_\bm is used to terminate the
869 input line, rather than newline.
870 -\b-e\be If the standard input is coming from a terminal, r\bre\bea\bad\bdl\bli\bin\bne\be
871 (see R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE above) is used to obtain the line. Read-
872 line uses the current (or default, if line editing was
873 not previously active) editing settings.
874 -\b-i\bi _\bt_\be_\bx_\bt
875 If r\bre\bea\bad\bdl\bli\bin\bne\be is being used to read the line, _\bt_\be_\bx_\bt is
876 placed into the editing buffer before editing begins.
877 -\b-n\bn _\bn_\bc_\bh_\ba_\br_\bs
878 r\bre\bea\bad\bd returns after reading _\bn_\bc_\bh_\ba_\br_\bs characters rather than
879 waiting for a complete line of input.
880 -\b-p\bp _\bp_\br_\bo_\bm_\bp_\bt
881 Display _\bp_\br_\bo_\bm_\bp_\bt on standard error, without a trailing new-
882 line, before attempting to read any input. The prompt is
883 displayed only if input is coming from a terminal.
884 -\b-r\br Backslash does not act as an escape character. The back-
885 slash is considered to be part of the line. In particu-
886 lar, a backslash-newline pair may not be used as a line
887 continuation.
888 -\b-s\bs Silent mode. If input is coming from a terminal, charac-
889 ters are not echoed.
890 -\b-t\bt _\bt_\bi_\bm_\be_\bo_\bu_\bt
891 Cause r\bre\bea\bad\bd to time out and return failure if a complete
892 line of input is not read within _\bt_\bi_\bm_\be_\bo_\bu_\bt seconds. _\bt_\bi_\bm_\be_\b-
893 _\bo_\bu_\bt may be a decimal number with a fractional portion
894 following the decimal point. This option is only effec-
895 tive if r\bre\bea\bad\bd is reading input from a terminal, pipe, or
896 other special file; it has no effect when reading from
897 regular files. If _\bt_\bi_\bm_\be_\bo_\bu_\bt is 0, r\bre\bea\bad\bd returns success if
898 input is available on the specified file descriptor,
899 failure otherwise. The exit status is greater than 128
900 if the timeout is exceeded.
901 -\b-u\bu _\bf_\bd Read input from file descriptor _\bf_\bd.
902
903 If no _\bn_\ba_\bm_\be_\bs are supplied, the line read is assigned to the vari-
904 able R\bRE\bEP\bPL\bLY\bY. The return code is zero, unless end-of-file is
905 encountered, r\bre\bea\bad\bd times out (in which case the return code is
906 greater than 128), or an invalid file descriptor is supplied as
907 the argument to -\b-u\bu.
908
909 r\bre\bea\bad\bdo\bon\bnl\bly\by [-\b-a\baA\bAp\bpf\bf] [_\bn_\ba_\bm_\be[=_\bw_\bo_\br_\bd] ...]
910 The given _\bn_\ba_\bm_\be_\bs are marked readonly; the values of these _\bn_\ba_\bm_\be_\bs
911 may not be changed by subsequent assignment. If the -\b-f\bf option
912 is supplied, the functions corresponding to the _\bn_\ba_\bm_\be_\bs are so
913 marked. The -\b-a\ba option restricts the variables to indexed
914 arrays; the -\b-A\bA option restricts the variables to associative
915 arrays. If no _\bn_\ba_\bm_\be arguments are given, or if the -\b-p\bp option is
916 supplied, a list of all readonly names is printed. The -\b-p\bp
917 option causes output to be displayed in a format that may be
918 reused as input. If a variable name is followed by =_\bw_\bo_\br_\bd, the
919 value of the variable is set to _\bw_\bo_\br_\bd. The return status is 0
920 unless an invalid option is encountered, one of the _\bn_\ba_\bm_\be_\bs is not
921 a valid shell variable name, or -\b-f\bf is supplied with a _\bn_\ba_\bm_\be that
922 is not a function.
923
924 r\bre\bet\btu\bur\brn\bn [_\bn]
925 Causes a function to exit with the return value specified by _\bn.
926 If _\bn is omitted, the return status is that of the last command
927 executed in the function body. If used outside a function, but
928 during execution of a script by the .\b. (s\bso\bou\bur\brc\bce\be) command, it
929 causes the shell to stop executing that script and return either
930 _\bn or the exit status of the last command executed within the
931 script as the exit status of the script. If used outside a
932 function and not during execution of a script by .\b., the return
933 status is false. Any command associated with the R\bRE\bET\bTU\bUR\bRN\bN trap is
934 executed before execution resumes after the function or script.
935
936 s\bse\bet\bt [-\b--\b-a\bab\bbe\bef\bfh\bhk\bkm\bmn\bnp\bpt\btu\buv\bvx\bxB\bBC\bCE\bEH\bHP\bPT\bT] [-\b-o\bo _\bo_\bp_\bt_\bi_\bo_\bn] [_\ba_\br_\bg ...]
937 s\bse\bet\bt [+\b+a\bab\bbe\bef\bfh\bhk\bkm\bmn\bnp\bpt\btu\buv\bvx\bxB\bBC\bCE\bEH\bHP\bPT\bT] [+\b+o\bo _\bo_\bp_\bt_\bi_\bo_\bn] [_\ba_\br_\bg ...]
938 Without options, the name and value of each shell variable are
939 displayed in a format that can be reused as input for setting or
940 resetting the currently-set variables. Read-only variables can-
941 not be reset. In _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, only shell variables are listed.
942 The output is sorted according to the current locale. When
943 options are specified, they set or unset shell attributes. Any
944 arguments remaining after option processing are treated as val-
945 ues for the positional parameters and are assigned, in order, to
946 $\b$1\b1, $\b$2\b2, .\b..\b..\b. $\b$_\bn. Options, if specified, have the following
947 meanings:
948 -\b-a\ba Automatically mark variables and functions which are
949 modified or created for export to the environment of
950 subsequent commands.
951 -\b-b\bb Report the status of terminated background jobs immedi-
952 ately, rather than before the next primary prompt. This
953 is effective only when job control is enabled.
954 -\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
955 above) exits with a non-zero status. The shell does not
956 exit if the command that fails is part of the command
957 list immediately following a w\bwh\bhi\bil\ble\be or u\bun\bnt\bti\bil\bl keyword,
958 part of the test in an i\bif\bf statement, part of a command
959 executed in a &\b&&\b& or |\b||\b| list, any command in a pipeline
960 but the last, or if the command's return value is being
961 inverted via !\b!. Failing simple commands that are part
962 of shell functions or command lists enclosed in braces
963 or parentheses satisfying the above conditions do not
964 cause the shell to exit. A trap on E\bER\bRR\bR, if set, is exe-
965 cuted before the shell exits.
966 -\b-f\bf Disable pathname expansion.
967 -\b-h\bh Remember the location of commands as they are looked up
968 for execution. This is enabled by default.
969 -\b-k\bk All arguments in the form of assignment statements are
970 placed in the environment for a command, not just those
971 that precede the command name.
972 -\b-m\bm Monitor mode. Job control is enabled. This option is
973 on by default for interactive shells on systems that
974 support it (see J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL above). Background pro-
975 cesses run in a separate process group and a line con-
976 taining their exit status is printed upon their comple-
977 tion.
978 -\b-n\bn Read commands but do not execute them. This may be used
979 to check a shell script for syntax errors. This is
980 ignored by interactive shells.
981 -\b-o\bo _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be
982 The _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be can be one of the following:
983 a\bal\bll\ble\bex\bxp\bpo\bor\brt\bt
984 Same as -\b-a\ba.
985 b\bbr\bra\bac\bce\bee\bex\bxp\bpa\ban\bnd\bd
986 Same as -\b-B\bB.
987 e\bem\bma\bac\bcs\bs Use an emacs-style command line editing inter-
988 face. This is enabled by default when the shell
989 is interactive, unless the shell is started with
990 the -\b--\b-n\bno\boe\bed\bdi\bit\bti\bin\bng\bg option. This also affects the
991 editing interface used for r\bre\bea\bad\bd -\b-e\be.
992 e\ber\brr\brt\btr\bra\bac\bce\be
993 Same as -\b-E\bE.
994 f\bfu\bun\bnc\bct\btr\bra\bac\bce\be
995 Same as -\b-T\bT.
996 e\ber\brr\bre\bex\bxi\bit\bt Same as -\b-e\be.
997 h\bha\bas\bsh\bha\bal\bll\bl Same as -\b-h\bh.
998 h\bhi\bis\bst\bte\bex\bxp\bpa\ban\bnd\bd
999 Same as -\b-H\bH.
1000 h\bhi\bis\bst\bto\bor\bry\by Enable command history, as described above under
1001 H\bHI\bIS\bST\bTO\bOR\bRY\bY. This option is on by default in inter-
1002 active shells.
1003 i\big\bgn\bno\bor\bre\bee\beo\bof\bf
1004 The effect is as if the shell command
1005 ``IGNOREEOF=10'' had been executed (see S\bSh\bhe\bel\bll\bl
1006 V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs above).
1007 k\bke\bey\byw\bwo\bor\brd\bd Same as -\b-k\bk.
1008 m\bmo\bon\bni\bit\bto\bor\br Same as -\b-m\bm.
1009 n\bno\boc\bcl\blo\bob\bbb\bbe\ber\br
1010 Same as -\b-C\bC.
1011 n\bno\boe\bex\bxe\bec\bc Same as -\b-n\bn.
1012 n\bno\bog\bgl\blo\bob\bb Same as -\b-f\bf.
1013 n\bno\bol\blo\bog\bg Currently ignored.
1014 n\bno\bot\bti\bif\bfy\by Same as -\b-b\bb.
1015 n\bno\bou\bun\bns\bse\bet\bt Same as -\b-u\bu.
1016 o\bon\bne\bec\bcm\bmd\bd Same as -\b-t\bt.
1017 p\bph\bhy\bys\bsi\bic\bca\bal\bl
1018 Same as -\b-P\bP.
1019 p\bpi\bip\bpe\bef\bfa\bai\bil\bl
1020 If set, the return value of a pipeline is the
1021 value of the last (rightmost) command to exit
1022 with a non-zero status, or zero if all commands
1023 in the pipeline exit successfully. This option
1024 is disabled by default.
1025 p\bpo\bos\bsi\bix\bx Change the behavior of b\bba\bas\bsh\bh where the default
1026 operation differs from the POSIX standard to
1027 match the standard (_\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be).
1028 p\bpr\bri\biv\bvi\bil\ble\beg\bge\bed\bd
1029 Same as -\b-p\bp.
1030 v\bve\ber\brb\bbo\bos\bse\be Same as -\b-v\bv.
1031 v\bvi\bi Use a vi-style command line editing interface.
1032 This also affects the editing interface used for
1033 r\bre\bea\bad\bd -\b-e\be.
1034 x\bxt\btr\bra\bac\bce\be Same as -\b-x\bx.
1035 If -\b-o\bo is supplied with no _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be, the values of the
1036 current options are printed. If +\b+o\bo is supplied with no
1037 _\bo_\bp_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be, a series of s\bse\bet\bt commands to recreate the
1038 current option settings is displayed on the standard
1039 output.
1040 -\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
1041 $\b$B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV files are not processed, shell functions are
1042 not inherited from the environment, and the S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS,
1043 C\bCD\bDP\bPA\bAT\bTH\bH, and G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE variables, if they appear in the
1044 environment, are ignored. If the shell is started with
1045 the effective user (group) id not equal to the real user
1046 (group) id, and the -\b-p\bp option is not supplied, these
1047 actions are taken and the effective user id is set to
1048 the real user id. If the -\b-p\bp option is supplied at
1049 startup, the effective user id is not reset. Turning
1050 this option off causes the effective user and group ids
1051 to be set to the real user and group ids.
1052 -\b-t\bt Exit after reading and executing one command.
1053 -\b-u\bu Treat unset variables as an error when performing param-
1054 eter expansion. If expansion is attempted on an unset
1055 variable, the shell prints an error message, and, if not
1056 interactive, exits with a non-zero status.
1057 -\b-v\bv Print shell input lines as they are read.
1058 -\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
1059 command, s\bse\bel\ble\bec\bct\bt command, or arithmetic f\bfo\bor\br command, dis-
1060 play the expanded value of P\bPS\bS4\b4, followed by the command
1061 and its expanded arguments or associated word list.
1062 -\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
1063 above). This is on by default.
1064 -\b-C\bC If set, b\bba\bas\bsh\bh does not overwrite an existing file with
1065 the >\b>, >\b>&\b&, and <\b<>\b> redirection operators. This may be
1066 overridden when creating output files by using the redi-
1067 rection operator >\b>|\b| instead of >\b>.
1068 -\b-E\bE If set, any trap on E\bER\bRR\bR is inherited by shell functions,
1069 command substitutions, and commands executed in a sub-
1070 shell environment. The E\bER\bRR\bR trap is normally not inher-
1071 ited in such cases.
1072 -\b-H\bH Enable !\b! style history substitution. This option is on
1073 by default when the shell is interactive.
1074 -\b-P\bP If set, the shell does not follow symbolic links when
1075 executing commands such as c\bcd\bd that change the current
1076 working directory. It uses the physical directory
1077 structure instead. By default, b\bba\bas\bsh\bh follows the logical
1078 chain of directories when performing commands which
1079 change the current directory.
1080 -\b-T\bT If set, any traps on D\bDE\bEB\bBU\bUG\bG and R\bRE\bET\bTU\bUR\bRN\bN are inherited by
1081 shell functions, command substitutions, and commands
1082 executed in a subshell environment. The D\bDE\bEB\bBU\bUG\bG and
1083 R\bRE\bET\bTU\bUR\bRN\bN traps are normally not inherited in such cases.
1084 -\b--\b- If no arguments follow this option, then the positional
1085 parameters are unset. Otherwise, the positional parame-
1086 ters are set to the _\ba_\br_\bgs, even if some of them begin
1087 with a -\b-.
1088 -\b- Signal the end of options, cause all remaining _\ba_\br_\bgs to
1089 be assigned to the positional parameters. The -\b-x\bx and -\b-v\bv
1090 options are turned off. If there are no _\ba_\br_\bgs, the posi-
1091 tional parameters remain unchanged.
1092
1093 The options are off by default unless otherwise noted. Using +
1094 rather than - causes these options to be turned off. The
1095 options can also be specified as arguments to an invocation of
1096 the shell. The current set of options may be found in $\b$-\b-. The
1097 return status is always true unless an invalid option is encoun-
1098 tered.
1099
1100 s\bsh\bhi\bif\bft\bt [_\bn]
1101 The positional parameters from _\bn+1 ... are renamed to $\b$1\b1 .\b..\b..\b..\b.
1102 Parameters represented by the numbers $\b$#\b# down to $\b$#\b#-_\bn+1 are
1103 unset. _\bn must be a non-negative number less than or equal to
1104 $\b$#\b#. If _\bn is 0, no parameters are changed. If _\bn is not given,
1105 it is assumed to be 1. If _\bn is greater than $\b$#\b#, the positional
1106 parameters are not changed. The return status is greater than
1107 zero if _\bn is greater than $\b$#\b# or less than zero; otherwise 0.
1108
1109 s\bsh\bho\bop\bpt\bt [-\b-p\bpq\bqs\bsu\bu] [-\b-o\bo] [_\bo_\bp_\bt_\bn_\ba_\bm_\be ...]
1110 Toggle the values of variables controlling optional shell behav-
1111 ior. With no options, or with the -\b-p\bp option, a list of all set-
1112 table options is displayed, with an indication of whether or not
1113 each is set. The -\b-p\bp option causes output to be displayed in a
1114 form that may be reused as input. Other options have the fol-
1115 lowing meanings:
1116 -\b-s\bs Enable (set) each _\bo_\bp_\bt_\bn_\ba_\bm_\be.
1117 -\b-u\bu Disable (unset) each _\bo_\bp_\bt_\bn_\ba_\bm_\be.
1118 -\b-q\bq Suppresses normal output (quiet mode); the return status
1119 indicates whether the _\bo_\bp_\bt_\bn_\ba_\bm_\be is set or unset. If multi-
1120 ple _\bo_\bp_\bt_\bn_\ba_\bm_\be arguments are given with -\b-q\bq, the return sta-
1121 tus is zero if all _\bo_\bp_\bt_\bn_\ba_\bm_\be_\bs are enabled; non-zero other-
1122 wise.
1123 -\b-o\bo Restricts the values of _\bo_\bp_\bt_\bn_\ba_\bm_\be to be those defined for
1124 the -\b-o\bo option to the s\bse\bet\bt builtin.
1125
1126 If either -\b-s\bs or -\b-u\bu is used with no _\bo_\bp_\bt_\bn_\ba_\bm_\be arguments, the dis-
1127 play is limited to those options which are set or unset, respec-
1128 tively. Unless otherwise noted, the s\bsh\bho\bop\bpt\bt options are disabled
1129 (unset) by default.
1130
1131 The return status when listing options is zero if all _\bo_\bp_\bt_\bn_\ba_\bm_\be_\bs
1132 are enabled, non-zero otherwise. When setting or unsetting
1133 options, the return status is zero unless an _\bo_\bp_\bt_\bn_\ba_\bm_\be is not a
1134 valid shell option.
1135
1136 The list of s\bsh\bho\bop\bpt\bt options is:
1137
1138 a\bau\but\bto\boc\bcd\bd If set, a command name that is the name of a directory
1139 is executed as if it were the argument to the c\bcd\bd com-
1140 mand. This option is only used by interactive shells.
1141 c\bcd\bda\bab\bbl\ble\be_\b_v\bva\bar\brs\bs
1142 If set, an argument to the c\bcd\bd builtin command that is
1143 not a directory is assumed to be the name of a variable
1144 whose value is the directory to change to.
1145 c\bcd\bds\bsp\bpe\bel\bll\bl If set, minor errors in the spelling of a directory com-
1146 ponent in a c\bcd\bd command will be corrected. The errors
1147 checked for are transposed characters, a missing charac-
1148 ter, and one character too many. If a correction is
1149 found, the corrected file name is printed, and the com-
1150 mand proceeds. This option is only used by interactive
1151 shells.
1152 c\bch\bhe\bec\bck\bkh\bha\bas\bsh\bh
1153 If set, b\bba\bas\bsh\bh checks that a command found in the hash ta-
1154 ble exists before trying to execute it. If a hashed
1155 command no longer exists, a normal path search is per-
1156 formed.
1157 c\bch\bhe\bec\bck\bkj\bjo\bob\bbs\bs
1158 If set, b\bba\bas\bsh\bh lists the status of any stopped and running
1159 jobs before exiting an interactive shell. If any jobs
1160 are running, this causes the exit to be deferred until a
1161 second exit is attempted without an intervening command
1162 (see J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL above). The shell always postpones
1163 exiting if any jobs are stopped.
1164 c\bch\bhe\bec\bck\bkw\bwi\bin\bns\bsi\biz\bze\be
1165 If set, b\bba\bas\bsh\bh checks the window size after each command
1166 and, if necessary, updates the values of L\bLI\bIN\bNE\bES\bS and C\bCO\bOL\bL-\b-
1167 U\bUM\bMN\bNS\bS.
1168 c\bcm\bmd\bdh\bhi\bis\bst\bt If set, b\bba\bas\bsh\bh attempts to save all lines of a multiple-
1169 line command in the same history entry. This allows
1170 easy re-editing of multi-line commands.
1171 c\bco\bom\bmp\bpa\bat\bt3\b31\b1
1172 If set, b\bba\bas\bsh\bh changes its behavior to that of version 3.1
1173 with respect to quoted arguments to the conditional com-
1174 mand's =~ operator.
1175 d\bdi\bir\brs\bsp\bpe\bel\bll\bl
1176 If set, b\bba\bas\bsh\bh attempts spelling correction on directory
1177 names during word completion if the directory name ini-
1178 tially supplied does not exist.
1179 d\bdo\bot\btg\bgl\blo\bob\bb If set, b\bba\bas\bsh\bh includes filenames beginning with a `.' in
1180 the results of pathname expansion.
1181 e\bex\bxe\bec\bcf\bfa\bai\bil\bl
1182 If set, a non-interactive shell will not exit if it can-
1183 not execute the file specified as an argument to the
1184 e\bex\bxe\bec\bc builtin command. An interactive shell does not
1185 exit if e\bex\bxe\bec\bc fails.
1186 e\bex\bxp\bpa\ban\bnd\bd_\b_a\bal\bli\bia\bas\bse\bes\bs
1187 If set, aliases are expanded as described above under
1188 A\bAL\bLI\bIA\bAS\bSE\bES\bS. This option is enabled by default for interac-
1189 tive shells.
1190 e\bex\bxt\btd\bde\beb\bbu\bug\bg
1191 If set, behavior intended for use by debuggers is
1192 enabled:
1193 1\b1.\b. The -\b-F\bF option to the d\bde\bec\bcl\bla\bar\bre\be builtin displays the
1194 source file name and line number corresponding to
1195 each function name supplied as an argument.
1196 2\b2.\b. If the command run by the D\bDE\bEB\bBU\bUG\bG trap returns a
1197 non-zero value, the next command is skipped and
1198 not executed.
1199 3\b3.\b. If the command run by the D\bDE\bEB\bBU\bUG\bG trap returns a
1200 value of 2, and the shell is executing in a sub-
1201 routine (a shell function or a shell script exe-
1202 cuted by the .\b. or s\bso\bou\bur\brc\bce\be builtins), a call to
1203 r\bre\bet\btu\bur\brn\bn is simulated.
1204 4\b4.\b. B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGC\bC and B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV are updated as described
1205 in their descriptions above.
1206 5\b5.\b. Function tracing is enabled: command substitu-
1207 tion, shell functions, and subshells invoked with
1208 (\b( _\bc_\bo_\bm_\bm_\ba_\bn_\bd )\b) inherit the D\bDE\bEB\bBU\bUG\bG and R\bRE\bET\bTU\bUR\bRN\bN traps.
1209 6\b6.\b. Error tracing is enabled: command substitution,
1210 shell functions, and subshells invoked with (\b(
1211 _\bc_\bo_\bm_\bm_\ba_\bn_\bd )\b) inherit the E\bER\bRR\bRO\bOR\bR trap.
1212 e\bex\bxt\btg\bgl\blo\bob\bb If set, the extended pattern matching features described
1213 above under P\bPa\bat\bth\bhn\bna\bam\bme\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn are enabled.
1214 e\bex\bxt\btq\bqu\buo\bot\bte\be
1215 If set, $\b$'_\bs_\bt_\br_\bi_\bn_\bg' and $\b$"_\bs_\bt_\br_\bi_\bn_\bg" quoting is performed
1216 within $\b${\b{_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br}\b} expansions enclosed in double
1217 quotes. This option is enabled by default.
1218 f\bfa\bai\bil\blg\bgl\blo\bob\bb
1219 If set, patterns which fail to match filenames during
1220 pathname expansion result in an expansion error.
1221 f\bfo\bor\brc\bce\be_\b_f\bfi\big\bgn\bno\bor\bre\be
1222 If set, the suffixes specified by the F\bFI\bIG\bGN\bNO\bOR\bRE\bE shell
1223 variable cause words to be ignored when performing word
1224 completion even if the ignored words are the only possi-
1225 ble completions. See S\bSH\bHE\bEL\bLL\bL V\bVA\bAR\bRI\bIA\bAB\bBL\bLE\bES\bS above for a
1226 description of F\bFI\bIG\bGN\bNO\bOR\bRE\bE. This option is enabled by
1227 default.
1228 g\bgl\blo\bob\bbs\bst\bta\bar\br
1229 If set, the pattern *\b**\b* used in a filename expansion con-
1230 text will match a files and zero or more directories and
1231 subdirectories. If the pattern is followed by a /\b/, only
1232 directories and subdirectories match.
1233 g\bgn\bnu\bu_\b_e\ber\brr\brf\bfm\bmt\bt
1234 If set, shell error messages are written in the standard
1235 GNU error message format.
1236 h\bhi\bis\bst\bta\bap\bpp\bpe\ben\bnd\bd
1237 If set, the history list is appended to the file named
1238 by the value of the H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE variable when the shell
1239 exits, rather than overwriting the file.
1240 h\bhi\bis\bst\btr\bre\bee\bed\bdi\bit\bt
1241 If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, a user is given the
1242 opportunity to re-edit a failed history substitution.
1243 h\bhi\bis\bst\btv\bve\ber\bri\bif\bfy\by
1244 If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, the results of his-
1245 tory substitution are not immediately passed to the
1246 shell parser. Instead, the resulting line is loaded
1247 into the r\bre\bea\bad\bdl\bli\bin\bne\be editing buffer, allowing further modi-
1248 fication.
1249 h\bho\bos\bst\btc\bco\bom\bmp\bpl\ble\bet\bte\be
1250 If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, b\bba\bas\bsh\bh will attempt to
1251 perform hostname completion when a word containing a @\b@
1252 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
1253 above). This is enabled by default.
1254 h\bhu\bup\bpo\bon\bne\bex\bxi\bit\bt
1255 If set, b\bba\bas\bsh\bh will send S\bSI\bIG\bGH\bHU\bUP\bP to all jobs when an inter-
1256 active login shell exits.
1257 i\bin\bnt\bte\ber\bra\bac\bct\bti\biv\bve\be_\b_c\bco\bom\bmm\bme\ben\bnt\bts\bs
1258 If set, allow a word beginning with #\b# to cause that word
1259 and all remaining characters on that line to be ignored
1260 in an interactive shell (see C\bCO\bOM\bMM\bME\bEN\bNT\bTS\bS above). This
1261 option is enabled by default.
1262 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
1263 commands are saved to the history with embedded newlines
1264 rather than using semicolon separators where possible.
1265 l\blo\bog\bgi\bin\bn_\b_s\bsh\bhe\bel\bll\bl
1266 The shell sets this option if it is started as a login
1267 shell (see I\bIN\bNV\bVO\bOC\bCA\bAT\bTI\bIO\bON\bN above). The value may not be
1268 changed.
1269 m\bma\bai\bil\blw\bwa\bar\brn\bn
1270 If set, and a file that b\bba\bas\bsh\bh is checking for mail has
1271 been accessed since the last time it was checked, the
1272 message ``The mail in _\bm_\ba_\bi_\bl_\bf_\bi_\bl_\be has been read'' is dis-
1273 played.
1274 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
1275 If set, and r\bre\bea\bad\bdl\bli\bin\bne\be is being used, b\bba\bas\bsh\bh will not
1276 attempt to search the P\bPA\bAT\bTH\bH for possible completions when
1277 completion is attempted on an empty line.
1278 n\bno\boc\bca\bas\bse\beg\bgl\blo\bob\bb
1279 If set, b\bba\bas\bsh\bh matches filenames in a case-insensitive
1280 fashion when performing pathname expansion (see P\bPa\bat\bth\bhn\bna\bam\bme\be
1281 E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn above).
1282 n\bno\boc\bca\bas\bse\bem\bma\bat\btc\bch\bh
1283 If set, b\bba\bas\bsh\bh matches patterns in a case-insensitive
1284 fashion when performing matching while executing c\bca\bas\bse\be or
1285 [\b[[\b[ conditional commands.
1286 n\bnu\bul\bll\blg\bgl\blo\bob\bb
1287 If set, b\bba\bas\bsh\bh allows patterns which match no files (see
1288 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,
1289 rather than themselves.
1290 p\bpr\bro\bog\bgc\bco\bom\bmp\bp
1291 If set, the programmable completion facilities (see P\bPr\bro\bo-\b-
1292 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
1293 enabled by default.
1294 p\bpr\bro\bom\bmp\bpt\btv\bva\bar\brs\bs
1295 If set, prompt strings undergo parameter expansion, com-
1296 mand substitution, arithmetic expansion, and quote
1297 removal after being expanded as described in P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG
1298 above. This option is enabled by default.
1299 r\bre\bes\bst\btr\bri\bic\bct\bte\bed\bd_\b_s\bsh\bhe\bel\bll\bl
1300 The shell sets this option if it is started in
1301 restricted mode (see R\bRE\bES\bST\bTR\bRI\bIC\bCT\bTE\bED\bD S\bSH\bHE\bEL\bLL\bL below). The value
1302 may not be changed. This is not reset when the startup
1303 files are executed, allowing the startup files to dis-
1304 cover whether or not a shell is restricted.
1305 s\bsh\bhi\bif\bft\bt_\b_v\bve\ber\brb\bbo\bos\bse\be
1306 If set, the s\bsh\bhi\bif\bft\bt builtin prints an error message when
1307 the shift count exceeds the number of positional parame-
1308 ters.
1309 s\bso\bou\bur\brc\bce\bep\bpa\bat\bth\bh
1310 If set, the s\bso\bou\bur\brc\bce\be (.\b.) builtin uses the value of P\bPA\bAT\bTH\bH to
1311 find the directory containing the file supplied as an
1312 argument. This option is enabled by default.
1313 x\bxp\bpg\bg_\b_e\bec\bch\bho\bo
1314 If set, the e\bec\bch\bho\bo builtin expands backslash-escape
1315 sequences by default.
1316 s\bsu\bus\bsp\bpe\ben\bnd\bd [-\b-f\bf]
1317 Suspend the execution of this shell until it receives a S\bSI\bIG\bGC\bCO\bON\bNT\bT
1318 signal. A login shell cannot be suspended; the -\b-f\bf option can be
1319 used to override this and force the suspension. The return sta-
1320 tus is 0 unless the shell is a login shell and -\b-f\bf is not sup-
1321 plied, or if job control is not enabled.
1322 t\bte\bes\bst\bt _\be_\bx_\bp_\br
1323 [\b[ _\be_\bx_\bp_\br ]\b]
1324 Return a status of 0 or 1 depending on the evaluation of the
1325 conditional expression _\be_\bx_\bp_\br. Each operator and operand must be
1326 a separate argument. Expressions are composed of the primaries
1327 described above under C\bCO\bON\bND\bDI\bIT\bTI\bIO\bON\bNA\bAL\bL E\bEX\bXP\bPR\bRE\bES\bSS\bSI\bIO\bON\bNS\bS. t\bte\bes\bst\bt does not
1328 accept any options, nor does it accept and ignore an argument of
1329 -\b--\b- as signifying the end of options.
1330
1331 Expressions may be combined using the following operators,
1332 listed in decreasing order of precedence. The evaluation
1333 depends on the number of arguments; see below.
1334 !\b! _\be_\bx_\bp_\br True if _\be_\bx_\bp_\br is false.
1335 (\b( _\be_\bx_\bp_\br )\b)
1336 Returns the value of _\be_\bx_\bp_\br. This may be used to override
1337 the normal precedence of operators.
1338 _\be_\bx_\bp_\br_\b1 -a\ba _\be_\bx_\bp_\br_\b2
1339 True if both _\be_\bx_\bp_\br_\b1 and _\be_\bx_\bp_\br_\b2 are true.
1340 _\be_\bx_\bp_\br_\b1 -o\bo _\be_\bx_\bp_\br_\b2
1341 True if either _\be_\bx_\bp_\br_\b1 or _\be_\bx_\bp_\br_\b2 is true.
1342
1343 t\bte\bes\bst\bt and [\b[ evaluate conditional expressions using a set of rules
1344 based on the number of arguments.
1345
1346 0 arguments
1347 The expression is false.
1348 1 argument
1349 The expression is true if and only if the argument is not
1350 null.
1351 2 arguments
1352 If the first argument is !\b!, the expression is true if and
1353 only if the second argument is null. If the first argu-
1354 ment is one of the unary conditional operators listed
1355 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
1356 true if the unary test is true. If the first argument is
1357 not a valid unary conditional operator, the expression is
1358 false.
1359 3 arguments
1360 If the second argument is one of the binary conditional
1361 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
1362 result of the expression is the result of the binary test
1363 using the first and third arguments as operands. The -\b-a\ba
1364 and -\b-o\bo operators are considered binary operators when
1365 there are three arguments. If the first argument is !\b!,
1366 the value is the negation of the two-argument test using
1367 the second and third arguments. If the first argument is
1368 exactly (\b( and the third argument is exactly )\b), the result
1369 is the one-argument test of the second argument. Other-
1370 wise, the expression is false.
1371 4 arguments
1372 If the first argument is !\b!, the result is the negation of
1373 the three-argument expression composed of the remaining
1374 arguments. Otherwise, the expression is parsed and eval-
1375 uated according to precedence using the rules listed
1376 above.
1377 5 or more arguments
1378 The expression is parsed and evaluated according to
1379 precedence using the rules listed above.
1380
1381 t\bti\bim\bme\bes\bs Print the accumulated user and system times for the shell and
1382 for processes run from the shell. The return status is 0.
1383
1384 t\btr\bra\bap\bp [-\b-l\blp\bp] [[_\ba_\br_\bg] _\bs_\bi_\bg_\bs_\bp_\be_\bc ...]
1385 The command _\ba_\br_\bg is to be read and executed when the shell
1386 receives signal(s) _\bs_\bi_\bg_\bs_\bp_\be_\bc. If _\ba_\br_\bg is absent (and there is a
1387 single _\bs_\bi_\bg_\bs_\bp_\be_\bc) or -\b-, each specified signal is reset to its
1388 original disposition (the value it had upon entrance to the
1389 shell). If _\ba_\br_\bg is the null string the signal specified by each
1390 _\bs_\bi_\bg_\bs_\bp_\be_\bc is ignored by the shell and by the commands it invokes.
1391 If _\ba_\br_\bg is not present and -\b-p\bp has been supplied, then the trap
1392 commands associated with each _\bs_\bi_\bg_\bs_\bp_\be_\bc are displayed. If no
1393 arguments are supplied or if only -\b-p\bp is given, t\btr\bra\bap\bp prints the
1394 list of commands associated with each signal. The -\b-l\bl option
1395 causes the shell to print a list of signal names and their cor-
1396 responding numbers. Each _\bs_\bi_\bg_\bs_\bp_\be_\bc is either a signal name
1397 defined in <_\bs_\bi_\bg_\bn_\ba_\bl_\b._\bh>, or a signal number. Signal names are
1398 case insensitive and the SIG prefix is optional. If a _\bs_\bi_\bg_\bs_\bp_\be_\bc
1399 is E\bEX\bXI\bIT\bT (0) the command _\ba_\br_\bg is executed on exit from the shell.
1400 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
1401 _\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
1402 arithmetic _\bf_\bo_\br command, and before the first command executes in
1403 a shell function (see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR above). Refer to the
1404 description of the e\bex\bxt\btd\bde\beb\bbu\bug\bg option to the s\bsh\bho\bop\bpt\bt builtin for
1405 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,
1406 the command _\ba_\br_\bg is executed whenever a simple command has a
1407 non-zero exit status, subject to the following conditions. The
1408 E\bER\bRR\bR trap is not executed if the failed command is part of the
1409 command list immediately following a w\bwh\bhi\bil\ble\be or u\bun\bnt\bti\bil\bl keyword,
1410 part of the test in an _\bi_\bf statement, part of a command executed
1411 in a &\b&&\b& or |\b||\b| list, or if the command's return value is being
1412 inverted via !\b!. These are the same conditions obeyed by the
1413 e\ber\brr\bre\bex\bxi\bit\bt option. If a _\bs_\bi_\bg_\bs_\bp_\be_\bc is R\bRE\bET\bTU\bUR\bRN\bN, the command _\ba_\br_\bg is exe-
1414 cuted each time a shell function or a script executed with the .\b.
1415 or s\bso\bou\bur\brc\bce\be builtins finishes executing. Signals ignored upon
1416 entry to the shell cannot be trapped or reset. Trapped signals
1417 that are not being ignored are reset to their original values in
1418 a child process when it is created. The return status is false
1419 if any _\bs_\bi_\bg_\bs_\bp_\be_\bc is invalid; otherwise t\btr\bra\bap\bp returns true.
1420
1421 t\bty\byp\bpe\be [-\b-a\baf\bft\btp\bpP\bP] _\bn_\ba_\bm_\be [_\bn_\ba_\bm_\be ...]
1422 With no options, indicate how each _\bn_\ba_\bm_\be would be interpreted if
1423 used as a command name. If the -\b-t\bt option is used, t\bty\byp\bpe\be prints a
1424 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
1425 _\bf_\bi_\bl_\be if _\bn_\ba_\bm_\be is an alias, shell reserved word, function,
1426 builtin, or disk file, respectively. If the _\bn_\ba_\bm_\be is not found,
1427 then nothing is printed, and an exit status of false is
1428 returned. If the -\b-p\bp option is used, t\bty\byp\bpe\be either returns the
1429 name of the disk file that would be executed if _\bn_\ba_\bm_\be were speci-
1430 fied as a command name, or nothing if ``type -t name'' would not
1431 return _\bf_\bi_\bl_\be. The -\b-P\bP option forces a P\bPA\bAT\bTH\bH search for each _\bn_\ba_\bm_\be,
1432 even if ``type -t name'' would not return _\bf_\bi_\bl_\be. If a command is
1433 hashed, -\b-p\bp and -\b-P\bP print the hashed value, not necessarily the
1434 file that appears first in P\bPA\bAT\bTH\bH. If the -\b-a\ba option is used, t\bty\byp\bpe\be
1435 prints all of the places that contain an executable named _\bn_\ba_\bm_\be.
1436 This includes aliases and functions, if and only if the -\b-p\bp
1437 option is not also used. The table of hashed commands is not
1438 consulted when using -\b-a\ba. The -\b-f\bf option suppresses shell func-
1439 tion lookup, as with the c\bco\bom\bmm\bma\ban\bnd\bd builtin. t\bty\byp\bpe\be returns true if
1440 all of the arguments are found, false if any are not found.
1441
1442 u\bul\bli\bim\bmi\bit\bt [-\b-H\bHS\bST\bTa\bab\bbc\bcd\bde\bef\bfi\bil\blm\bmn\bnp\bpq\bqr\brs\bst\btu\buv\bvx\bx [_\bl_\bi_\bm_\bi_\bt]]
1443 Provides control over the resources available to the shell and
1444 to processes started by it, on systems that allow such control.
1445 The -\b-H\bH and -\b-S\bS options specify that the hard or soft limit is set
1446 for the given resource. A hard limit cannot be increased by a
1447 non-root user once it is set; a soft limit may be increased up
1448 to the value of the hard limit. If neither -\b-H\bH nor -\b-S\bS is speci-
1449 fied, both the soft and hard limits are set. The value of _\bl_\bi_\bm_\bi_\bt
1450 can be a number in the unit specified for the resource or one of
1451 the special values h\bha\bar\brd\bd, s\bso\bof\bft\bt, or u\bun\bnl\bli\bim\bmi\bit\bte\bed\bd, which stand for the
1452 current hard limit, the current soft limit, and no limit,
1453 respectively. If _\bl_\bi_\bm_\bi_\bt is omitted, the current value of the
1454 soft limit of the resource is printed, unless the -\b-H\bH option is
1455 given. When more than one resource is specified, the limit name
1456 and unit are printed before the value. Other options are inter-
1457 preted as follows:
1458 -\b-a\ba All current limits are reported
1459 -\b-b\bb The maximum socket buffer size
1460 -\b-c\bc The maximum size of core files created
1461 -\b-d\bd The maximum size of a process's data segment
1462 -\b-e\be The maximum scheduling priority ("nice")
1463 -\b-f\bf The maximum size of files written by the shell and its
1464 children
1465 -\b-i\bi The maximum number of pending signals
1466 -\b-l\bl The maximum size that may be locked into memory
1467 -\b-m\bm The maximum resident set size
1468 -\b-n\bn The maximum number of open file descriptors (most systems
1469 do not allow this value to be set)
1470 -\b-p\bp The pipe size in 512-byte blocks (this may not be set)
1471 -\b-q\bq The maximum number of bytes in POSIX message queues
1472 -\b-r\br The maximum real-time scheduling priority
1473 -\b-s\bs The maximum stack size
1474 -\b-t\bt The maximum amount of cpu time in seconds
1475 -\b-u\bu The maximum number of processes available to a single
1476 user
1477 -\b-v\bv The maximum amount of virtual memory available to the
1478 shell
1479 -\b-x\bx The maximum number of file locks
1480 -\b-T\bT The maximum number of threads
1481
1482 If _\bl_\bi_\bm_\bi_\bt is given, it is the new value of the specified resource
1483 (the -\b-a\ba option is display only). If no option is given, then -\b-f\bf
1484 is assumed. Values are in 1024-byte increments, except for -\b-t\bt,
1485 which is in seconds, -\b-p\bp, which is in units of 512-byte blocks,
1486 and -\b-T\bT, -\b-b\bb, -\b-n\bn, and -\b-u\bu, which are unscaled values. The return
1487 status is 0 unless an invalid option or argument is supplied, or
1488 an error occurs while setting a new limit.
1489
1490 u\bum\bma\bas\bsk\bk [-\b-p\bp] [-\b-S\bS] [_\bm_\bo_\bd_\be]
1491 The user file-creation mask is set to _\bm_\bo_\bd_\be. If _\bm_\bo_\bd_\be begins with
1492 a digit, it is interpreted as an octal number; otherwise it is
1493 interpreted as a symbolic mode mask similar to that accepted by
1494 _\bc_\bh_\bm_\bo_\bd(1). If _\bm_\bo_\bd_\be is omitted, the current value of the mask is
1495 printed. The -\b-S\bS option causes the mask to be printed in sym-
1496 bolic form; the default output is an octal number. If the -\b-p\bp
1497 option is supplied, and _\bm_\bo_\bd_\be is omitted, the output is in a form
1498 that may be reused as input. The return status is 0 if the mode
1499 was successfully changed or if no _\bm_\bo_\bd_\be argument was supplied,
1500 and false otherwise.
1501
1502 u\bun\bna\bal\bli\bia\bas\bs [-a\ba] [_\bn_\ba_\bm_\be ...]
1503 Remove each _\bn_\ba_\bm_\be from the list of defined aliases. If -\b-a\ba is
1504 supplied, all alias definitions are removed. The return value
1505 is true unless a supplied _\bn_\ba_\bm_\be is not a defined alias.
1506
1507 u\bun\bns\bse\bet\bt [-f\bfv\bv] [_\bn_\ba_\bm_\be ...]
1508 For each _\bn_\ba_\bm_\be, remove the corresponding variable or function.
1509 If no options are supplied, or the -\b-v\bv option is given, each _\bn_\ba_\bm_\be
1510 refers to a shell variable. Read-only variables may not be
1511 unset. If -\b-f\bf is specified, each _\bn_\ba_\bm_\be refers to a shell func-
1512 tion, and the function definition is removed. Each unset vari-
1513 able or function is removed from the environment passed to sub-
1514 sequent commands. If any of R\bRA\bAN\bND\bDO\bOM\bM, S\bSE\bEC\bCO\bON\bND\bDS\bS, L\bLI\bIN\bNE\bEN\bNO\bO, H\bHI\bIS\bST\bTC\bCM\bMD\bD,
1515 F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE, G\bGR\bRO\bOU\bUP\bPS\bS, or D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK are unset, they lose their special
1516 properties, even if they are subsequently reset. The exit sta-
1517 tus is true unless a _\bn_\ba_\bm_\be is readonly.
1518
1519 w\bwa\bai\bit\bt [_\bn _\b._\b._\b.]
1520 Wait for each specified process and return its termination sta-
1521 tus. Each _\bn may be a process ID or a job specification; if a
1522 job spec is given, all processes in that job's pipeline are
1523 waited for. If _\bn is not given, all currently active child pro-
1524 cesses are waited for, and the return status is zero. If _\bn
1525 specifies a non-existent process or job, the return status is
1526 127. Otherwise, the return status is the exit status of the
1527 last process or job waited for.
1528
1529 S\bSE\bEE\bE A\bAL\bLS\bSO\bO
1530 bash(1), sh(1)
1531
1532
1533
1534 GNU Bash-4.0 2004 Apr 20 BASH_BUILTINS(1)