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