1BASH_BUILTINS(1) General Commands Manual BASH_BUILTINS(1)
2
3
4
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 bash(1)
13
15 Unless otherwise noted, each builtin command documented in this section
16 as accepting options preceded by - accepts -- to signify the end of the
17 options. The :, true, false, and test builtins do not accept options
18 and do not treat -- specially. The exit, logout, return, break, con‐
19 tinue, let, and shift builtins accept and process arguments beginning
20 with - without requiring --. Other builtins that accept arguments but
21 are not specified as accepting options interpret arguments beginning
22 with - as invalid options and require -- to prevent this interpreta‐
23 tion.
24 : [arguments]
25 No effect; the command does nothing beyond expanding arguments
26 and performing any specified redirections. The return status is
27 zero.
28
29 . filename [arguments]
30 source filename [arguments]
31 Read and execute commands from filename in the current shell
32 environment and return the exit status of the last command exe‐
33 cuted from filename. If filename does not contain a slash,
34 filenames in PATH are used to find the directory containing
35 filename. The file searched for in PATH need not be executable.
36 When bash is not in posix mode, the current directory is
37 searched if no file is found in PATH. If the sourcepath option
38 to the shopt builtin command is turned off, the PATH is not
39 searched. If any arguments are supplied, they become the posi‐
40 tional parameters when filename is executed. Otherwise the
41 positional parameters are unchanged. If the -T option is
42 enabled, source inherits any trap on DEBUG; if it is not, any
43 DEBUG trap string is saved and restored around the call to
44 source, and source unsets the DEBUG trap while it executes. If
45 -T is not set, and the sourced file changes the DEBUG trap, the
46 new value is retained when source 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 filename is not found or
49 cannot be read.
50
51 alias [-p] [name[=value] ...]
52 Alias with no arguments or with the -p option prints the list of
53 aliases in the form alias name=value on standard output. When
54 arguments are supplied, an alias is defined for each name whose
55 value is given. A trailing space in value causes the next word
56 to be checked for alias substitution when the alias is expanded.
57 For each name in the argument list for which no value is sup‐
58 plied, the name and value of the alias is printed. Alias
59 returns true unless a name is given for which no alias has been
60 defined.
61
62 bg [jobspec ...]
63 Resume each suspended job jobspec in the background, as if it
64 had been started with &. If jobspec is not present, the shell's
65 notion of the current job is used. bg jobspec returns 0 unless
66 run when job control is disabled or, when run with job control
67 enabled, any specified jobspec was not found or was started
68 without job control.
69
70 bind [-m keymap] [-lpsvPSVX]
71 bind [-m keymap] [-q function] [-u function] [-r keyseq]
72 bind [-m keymap] -f filename
73 bind [-m keymap] -x keyseq:shell-command
74 bind [-m keymap] keyseq:function-name
75 bind [-m keymap] keyseq:readline-command
76 Display current readline key and function bindings, bind a key
77 sequence to a readline function or macro, or set a readline
78 variable. Each non-option argument is a command as it would
79 appear in .inputrc, 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 -m keymap
83 Use keymap as the keymap to be affected by the subsequent
84 bindings. Acceptable keymap names are emacs, emacs-stan‐
85 dard, emacs-meta, emacs-ctlx, vi, vi-move, vi-command,
86 and vi-insert. vi is equivalent to vi-command (vi-move
87 is also a synonym); emacs is equivalent to emacs-stan‐
88 dard.
89 -l List the names of all readline functions.
90 -p Display readline function names and bindings in such a
91 way that they can be re-read.
92 -P List current readline function names and bindings.
93 -s Display readline key sequences bound to macros and the
94 strings they output in such a way that they can be re-
95 read.
96 -S Display readline key sequences bound to macros and the
97 strings they output.
98 -v Display readline variable names and values in such a way
99 that they can be re-read.
100 -V List current readline variable names and values.
101 -f filename
102 Read key bindings from filename.
103 -q function
104 Query about which keys invoke the named function.
105 -u function
106 Unbind all keys bound to the named function.
107 -r keyseq
108 Remove any current binding for keyseq.
109 -x keyseq:shell-command
110 Cause shell-command to be executed whenever keyseq is
111 entered. When shell-command is executed, the shell sets
112 the READLINE_LINE variable to the contents of the read‐
113 line line buffer and the READLINE_POINT variable to the
114 current location of the insertion point. If the executed
115 command changes the value of READLINE_LINE or READ‐
116 LINE_POINT, those new values will be reflected in the
117 editing state.
118 -X 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 break [n]
126 Exit from within a for, while, until, or select loop. If n is
127 specified, break n levels. n must be ≥ 1. If n is greater than
128 the number of enclosing loops, all enclosing loops are exited.
129 The return value is 0 unless n is not greater than or equal to
130 1.
131
132 builtin shell-builtin [arguments]
133 Execute the specified shell builtin, passing it arguments, 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 cd builtin is
137 commonly redefined this way. The return status is false if
138 shell-builtin is not a shell builtin command.
139
140 caller [expr]
141 Returns the context of any active subroutine call (a shell func‐
142 tion or a script executed with the . or source builtins). With‐
143 out expr, caller displays the line number and source filename of
144 the current subroutine call. If a non-negative integer is sup‐
145 plied as expr, caller 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 expr does not correspond to a valid position in
151 the call stack.
152
153 cd [-L|[-P [-e]] [-@]] [dir]
154 Change the current directory to dir. if dir is not supplied,
155 the value of the HOME shell variable is the default. Any addi‐
156 tional arguments following dir are ignored. The variable CDPATH
157 defines the search path for the directory containing dir: each
158 directory name in CDPATH is searched for dir. Alternative
159 directory names in CDPATH are separated by a colon (:). A null
160 directory name in CDPATH is the same as the current directory,
161 i.e., ``.''. If dir begins with a slash (/), then CDPATH is not
162 used. The -P option causes cd to use the physical directory
163 structure by resolving symbolic links while traversing dir and
164 before processing instances of .. in dir (see also the -P option
165 to the set builtin command); the -L option forces symbolic links
166 to be followed by resolving the link after processing instances
167 of .. in dir. If .. appears in dir, it is processed by removing
168 the immediately previous pathname component from dir, back to a
169 slash or the beginning of dir. If the -e option is supplied
170 with -P, and the current working directory cannot be success‐
171 fully determined after a successful directory change, cd will
172 return an unsuccessful status. On systems that support it, the
173 -@ option presents the extended attributes associated with a
174 file as a directory. An argument of - is converted to $OLDPWD
175 before the directory change is attempted. If a non-empty direc‐
176 tory name from CDPATH is used, or if - 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 command [-pVv] command [arg ...]
183 Run command with args suppressing the normal shell function
184 lookup. Only builtin commands or commands found in the PATH are
185 executed. If the -p option is given, the search for command is
186 performed using a default value for PATH that is guaranteed to
187 find all of the standard utilities. If either the -V or -v
188 option is supplied, a description of command is printed. The -v
189 option causes a single word indicating the command or filename
190 used to invoke command to be displayed; the -V option produces a
191 more verbose description. If the -V or -v option is supplied,
192 the exit status is 0 if command was found, and 1 if not. If
193 neither option is supplied and an error occurred or command can‐
194 not be found, the exit status is 127. Otherwise, the exit sta‐
195 tus of the command builtin is the exit status of command.
196
197 compgen [option] [word]
198 Generate possible completion matches for word according to the
199 options, which may be any option accepted by the complete
200 builtin with the exception of -p and -r, and write the matches
201 to the standard output. When using the -F or -C 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 word is specified,
208 only those completions matching word will be displayed.
209
210 The return value is true unless an invalid option is supplied,
211 or no matches were generated.
212
213 complete [-abcdefgjksuv] [-o comp-option] [-DE] [-A action] [-G glob‐
214 pat] [-W wordlist] [-F function] [-C command]
215 [-X filterpat] [-P prefix] [-S suffix] name [name ...]
216 complete -pr [-DE] [name ...]
217 Specify how arguments to each name should be completed. If the
218 -p 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 -r option removes a completion spec‐
221 ification for each name, or, if no names are supplied, all com‐
222 pletion specifications. The -D option indicates that the
223 remaining options and actions should apply to the ``default''
224 command completion; that is, completion attempted on a command
225 for which no completion has previously been defined. The -E
226 option indicates that the remaining options and actions should
227 apply to ``empty'' command completion; that is, completion
228 attempted on a blank line.
229
230 The process of applying these completion specifications when
231 word completion is attempted is described above under Program‐
232 mable Completion.
233
234 Other options, if specified, have the following meanings. The
235 arguments to the -G, -W, and -X options (and, if necessary, the
236 -P and -S options) should be quoted to protect them from expan‐
237 sion before the complete builtin is invoked.
238 -o comp-option
239 The comp-option controls several aspects of the comp‐
240 spec's behavior beyond the simple generation of comple‐
241 tions. comp-option may be one of:
242 bashdefault
243 Perform the rest of the default bash completions
244 if the compspec generates no matches.
245 default Use readline's default filename completion if
246 the compspec generates no matches.
247 dirnames
248 Perform directory name completion if the comp‐
249 spec generates no matches.
250 filenames
251 Tell readline that the compspec generates file‐
252 names, so it can perform any filename-specific
253 processing (like adding a slash to directory
254 names, quoting special characters, or suppress‐
255 ing trailing spaces). Intended to be used with
256 shell functions.
257 noquote Tell readline not to quote the completed words
258 if they are filenames (quoting filenames is the
259 default).
260 nosort Tell readline not to sort the list of possible
261 completions alphabetically.
262 nospace Tell readline not to append a space (the
263 default) to words completed at the end of the
264 line.
265 plusdirs
266 After any matches defined by the compspec are
267 generated, directory name completion is
268 attempted and any matches are added to the
269 results of the other actions.
270 -A action
271 The action may be one of the following to generate a
272 list of possible completions:
273 alias Alias names. May also be specified as -a.
274 arrayvar
275 Array variable names.
276 binding Readline key binding names.
277 builtin Names of shell builtin commands. May also be
278 specified as -b.
279 command Command names. May also be specified as -c.
280 directory
281 Directory names. May also be specified as -d.
282 disabled
283 Names of disabled shell builtins.
284 enabled Names of enabled shell builtins.
285 export Names of exported shell variables. May also be
286 specified as -e.
287 file File names. May also be specified as -f.
288 function
289 Names of shell functions.
290 group Group names. May also be specified as -g.
291 helptopic
292 Help topics as accepted by the help builtin.
293 hostname
294 Hostnames, as taken from the file specified by
295 the HOSTFILE shell variable.
296 job Job names, if job control is active. May also
297 be specified as -j.
298 keyword Shell reserved words. May also be specified as
299 -k.
300 running Names of running jobs, if job control is active.
301 service Service names. May also be specified as -s.
302 setopt Valid arguments for the -o option to the set
303 builtin.
304 shopt Shell option names as accepted by the shopt
305 builtin.
306 signal Signal names.
307 stopped Names of stopped jobs, if job control is active.
308 user User names. May also be specified as -u.
309 variable
310 Names of all shell variables. May also be spec‐
311 ified as -v.
312 -C command
313 command is executed in a subshell environment, and its
314 output is used as the possible completions.
315 -F function
316 The shell function function is executed in the current
317 shell environment. When the function is executed, the
318 first argument ($1) is the name of the command whose
319 arguments are being completed, the second argument ($2)
320 is the word being completed, and the third argument ($3)
321 is the word preceding the word being completed on the
322 current command line. When it finishes, the possible
323 completions are retrieved from the value of the COMPRE‐
324 PLY array variable.
325 -G globpat
326 The pathname expansion pattern globpat is expanded to
327 generate the possible completions.
328 -P prefix
329 prefix is added at the beginning of each possible com‐
330 pletion after all other options have been applied.
331 -S suffix
332 suffix is appended to each possible completion after all
333 other options have been applied.
334 -W wordlist
335 The wordlist is split using the characters in the IFS
336 special variable as delimiters, and each resultant word
337 is expanded. The possible completions are the members
338 of the resultant list which match the word being com‐
339 pleted.
340 -X filterpat
341 filterpat is a pattern as used for pathname expansion.
342 It is applied to the list of possible completions gener‐
343 ated by the preceding options and arguments, and each
344 completion matching filterpat is removed from the list.
345 A leading ! in filterpat negates the pattern; in this
346 case, any completion not matching filterpat is removed.
347
348 The return value is true unless an invalid option is supplied,
349 an option other than -p or -r is supplied without a name argu‐
350 ment, an attempt is made to remove a completion specification
351 for a name for which no specification exists, or an error occurs
352 adding a completion specification.
353
354 compopt [-o option] [-DE] [+o option] [name]
355 Modify completion options for each name according to the
356 options, or for the currently-executing completion if no names
357 are supplied. If no options are given, display the completion
358 options for each name or the current completion. The possible
359 values of option are those valid for the complete builtin
360 described above. The -D option indicates that the remaining
361 options should apply to the ``default'' command completion; that
362 is, completion attempted on a command for which no completion
363 has previously been defined. The -E option indicates that the
364 remaining options should apply to ``empty'' command completion;
365 that is, completion attempted on a blank line.
366
367 The return value is true unless an invalid option is supplied,
368 an attempt is made to modify the options for a name for which no
369 completion specification exists, or an output error occurs.
370
371 continue [n]
372 Resume the next iteration of the enclosing for, while, until, or
373 select loop. If n is specified, resume at the nth enclosing
374 loop. n must be ≥ 1. If n is greater than the number of
375 enclosing loops, the last enclosing loop (the ``top-level''
376 loop) is resumed. The return value is 0 unless n is not greater
377 than or equal to 1.
378
379 declare [-aAfFgilnrtux] [-p] [name[=value] ...]
380 typeset [-aAfFgilnrtux] [-p] [name[=value] ...]
381 Declare variables and/or give them attributes. If no names are
382 given then display the values of variables. The -p option will
383 display the attributes and values of each name. When -p is used
384 with name arguments, additional options, other than -f and -F,
385 are ignored. When -p is supplied without name arguments, it
386 will display the attributes and values of all variables having
387 the attributes specified by the additional options. If no other
388 options are supplied with -p, declare will display the
389 attributes and values of all shell variables. The -f option
390 will restrict the display to shell functions. The -F option
391 inhibits the display of function definitions; only the function
392 name and attributes are printed. If the extdebug shell option
393 is enabled using shopt, the source file name and line number
394 where each name is defined are displayed as well. The -F option
395 implies -f. The -g option forces variables to be created or
396 modified at the global scope, even when declare is executed in a
397 shell function. It is ignored in all other cases. The follow‐
398 ing options can be used to restrict output to variables with the
399 specified attribute or to give variables attributes:
400 -a Each name is an indexed array variable (see Arrays
401 above).
402 -A Each name is an associative array variable (see Arrays
403 above).
404 -f Use function names only.
405 -i The variable is treated as an integer; arithmetic evalua‐
406 tion (see ARITHMETIC EVALUATION above) is performed when
407 the variable is assigned a value.
408 -l When the variable is assigned a value, all upper-case
409 characters are converted to lower-case. The upper-case
410 attribute is disabled.
411 -n Give each name the nameref attribute, making it a name
412 reference to another variable. That other variable is
413 defined by the value of name. All references, assign‐
414 ments, and attribute modifications to name, except those
415 using or changing the -n attribute itself, are performed
416 on the variable referenced by name's value. The nameref
417 attribute cannot be applied to array variables.
418 -r Make names readonly. These names cannot then be assigned
419 values by subsequent assignment statements or unset.
420 -t Give each name the trace attribute. Traced functions
421 inherit the DEBUG and RETURN traps from the calling
422 shell. The trace attribute has no special meaning for
423 variables.
424 -u When the variable is assigned a value, all lower-case
425 characters are converted to upper-case. The lower-case
426 attribute is disabled.
427 -x Mark names for export to subsequent commands via the
428 environment.
429
430 Using `+' instead of `-' turns off the attribute instead, with
431 the exceptions that +a may not be used to destroy an array vari‐
432 able and +r will not remove the readonly attribute. When used
433 in a function, declare and typeset make each name local, as with
434 the local command, unless the -g option is supplied. If a vari‐
435 able name is followed by =value, the value of the variable is
436 set to value. When using -a or -A and the compound assignment
437 syntax to create array variables, additional attributes do not
438 take effect until subsequent assignments. The return value is 0
439 unless an invalid option is encountered, an attempt is made to
440 define a function using ``-f foo=bar'', an attempt is made to
441 assign a value to a readonly variable, an attempt is made to
442 assign a value to an array variable without using the compound
443 assignment syntax (see Arrays above), one of the names is not a
444 valid shell variable name, an attempt is made to turn off read‐
445 only status for a readonly variable, an attempt is made to turn
446 off array status for an array variable, or an attempt is made to
447 display a non-existent function with -f.
448
449 dirs [-clpv] [+n] [-n]
450 Without options, displays the list of currently remembered
451 directories. The default display is on a single line with
452 directory names separated by spaces. Directories are added to
453 the list with the pushd command; the popd command removes
454 entries from the list. The current directory is always the
455 first directory in the stack.
456 -c Clears the directory stack by deleting all of the
457 entries.
458 -l Produces a listing using full pathnames; the default
459 listing format uses a tilde to denote the home directory.
460 -p Print the directory stack with one entry per line.
461 -v Print the directory stack with one entry per line, pre‐
462 fixing each entry with its index in the stack.
463 +n Displays the nth entry counting from the left of the list
464 shown by dirs when invoked without options, starting with
465 zero.
466 -n Displays the nth entry counting from the right of the
467 list shown by dirs when invoked without options, starting
468 with zero.
469
470 The return value is 0 unless an invalid option is supplied or n
471 indexes beyond the end of the directory stack.
472
473 disown [-ar] [-h] [jobspec ... | pid ... ]
474 Without options, remove each jobspec from the table of active
475 jobs. If jobspec is not present, and neither the -a nor the -r
476 option is supplied, the current job is used. If the -h option
477 is given, each jobspec is not removed from the table, but is
478 marked so that SIGHUP is not sent to the job if the shell
479 receives a SIGHUP. If no jobspec is supplied, the -a option
480 means to remove or mark all jobs; the -r option without a job‐
481 spec argument restricts operation to running jobs. The return
482 value is 0 unless a jobspec does not specify a valid job.
483
484 echo [-neE] [arg ...]
485 Output the args, separated by spaces, followed by a newline.
486 The return status is 0 unless a write error occurs. If -n is
487 specified, the trailing newline is suppressed. If the -e option
488 is given, interpretation of the following backslash-escaped
489 characters is enabled. The -E option disables the interpreta‐
490 tion of these escape characters, even on systems where they are
491 interpreted by default. The xpg_echo shell option may be used
492 to dynamically determine whether or not echo expands these
493 escape characters by default. echo does not interpret -- to
494 mean the end of options. echo interprets the following escape
495 sequences:
496 \a alert (bell)
497 \b backspace
498 \c suppress further output
499 \e
500 \E an escape character
501 \f form feed
502 \n new line
503 \r carriage return
504 \t horizontal tab
505 \v vertical tab
506 \\ backslash
507 \0nnn the eight-bit character whose value is the octal value
508 nnn (zero to three octal digits)
509 \xHH the eight-bit character whose value is the hexadecimal
510 value HH (one or two hex digits)
511 \uHHHH the Unicode (ISO/IEC 10646) character whose value is the
512 hexadecimal value HHHH (one to four hex digits)
513 \UHHHHHHHH
514 the Unicode (ISO/IEC 10646) character whose value is the
515 hexadecimal value HHHHHHHH (one to eight hex digits)
516
517 enable [-a] [-dnps] [-f filename] [name ...]
518 Enable and disable builtin shell commands. Disabling a builtin
519 allows a disk command which has the same name as a shell builtin
520 to be executed without specifying a full pathname, even though
521 the shell normally searches for builtins before disk commands.
522 If -n is used, each name is disabled; otherwise, names are
523 enabled. For example, to use the test binary found via the PATH
524 instead of the shell builtin version, run ``enable -n test''.
525 The -f option means to load the new builtin command name from
526 shared object filename, on systems that support dynamic loading.
527 The -d option will delete a builtin previously loaded with -f.
528 If no name arguments are given, or if the -p option is supplied,
529 a list of shell builtins is printed. With no other option argu‐
530 ments, the list consists of all enabled shell builtins. If -n
531 is supplied, only disabled builtins are printed. If -a is sup‐
532 plied, the list printed includes all builtins, with an indica‐
533 tion of whether or not each is enabled. If -s is supplied, the
534 output is restricted to the POSIX special builtins. The return
535 value is 0 unless a name is not a shell builtin or there is an
536 error loading a new builtin from a shared object.
537
538 eval [arg ...]
539 The args are read and concatenated together into a single com‐
540 mand. This command is then read and executed by the shell, and
541 its exit status is returned as the value of eval. If there are
542 no args, or only null arguments, eval returns 0.
543
544 exec [-cl] [-a name] [command [arguments]]
545 If command is specified, it replaces the shell. No new process
546 is created. The arguments become the arguments to command. If
547 the -l option is supplied, the shell places a dash at the begin‐
548 ning of the zeroth argument passed to command. This is what
549 login(1) does. The -c option causes command to be executed with
550 an empty environment. If -a is supplied, the shell passes name
551 as the zeroth argument to the executed command. If command can‐
552 not be executed for some reason, a non-interactive shell exits,
553 unless the execfail shell option is enabled. In that case, it
554 returns failure. An interactive shell returns failure if the
555 file cannot be executed. If command is not specified, any redi‐
556 rections take effect in the current shell, and the return status
557 is 0. If there is a redirection error, the return status is 1.
558
559 exit [n]
560 Cause the shell to exit with a status of n. If n is omitted,
561 the exit status is that of the last command executed. A trap on
562 EXIT is executed before the shell terminates.
563
564 export [-fn] [name[=word]] ...
565 export -p
566 The supplied names are marked for automatic export to the envi‐
567 ronment of subsequently executed commands. If the -f option is
568 given, the names refer to functions. If no names are given, or
569 if the -p option is supplied, a list of names of all exported
570 variables is printed. The -n option causes the export property
571 to be removed from each name. If a variable name is followed by
572 =word, the value of the variable is set to word. export returns
573 an exit status of 0 unless an invalid option is encountered, one
574 of the names is not a valid shell variable name, or -f is sup‐
575 plied with a name that is not a function.
576
577 fc [-e ename] [-lnr] [first] [last]
578 fc -s [pat=rep] [cmd]
579 The first form selects a range of commands from first to last
580 from the history list and displays or edits and re-executes
581 them. First and last may be specified as a string (to locate
582 the last command beginning with that string) or as a number (an
583 index into the history list, where a negative number is used as
584 an offset from the current command number). If last is not
585 specified it is set to the current command for listing (so that
586 ``fc -l -10'' prints the last 10 commands) and to first other‐
587 wise. If first is not specified it is set to the previous com‐
588 mand for editing and -16 for listing.
589
590 The -n option suppresses the command numbers when listing. The
591 -r option reverses the order of the commands. If the -l option
592 is given, the commands are listed on standard output. Other‐
593 wise, the editor given by ename is invoked on a file containing
594 those commands. If ename is not given, the value of the FCEDIT
595 variable is used, and the value of EDITOR if FCEDIT is not set.
596 If neither variable is set, vi is used. When editing is com‐
597 plete, the edited commands are echoed and executed.
598
599 In the second form, command is re-executed after each instance
600 of pat is replaced by rep. Command is intepreted the same as
601 first above. A useful alias to use with this is ``r="fc -s"'',
602 so that typing ``r cc'' runs the last command beginning with
603 ``cc'' and typing ``r'' re-executes the last command.
604
605 If the first form is used, the return value is 0 unless an
606 invalid option is encountered or first or last specify history
607 lines out of range. If the -e option is supplied, the return
608 value is the value of the last command executed or failure if an
609 error occurs with the temporary file of commands. If the second
610 form is used, the return status is that of the command re-exe‐
611 cuted, unless cmd does not specify a valid history line, in
612 which case fc returns failure.
613
614 fg [jobspec]
615 Resume jobspec in the foreground, and make it the current job.
616 If jobspec is not present, the shell's notion of the current job
617 is used. The return value is that of the command placed into
618 the foreground, or failure if run when job control is disabled
619 or, when run with job control enabled, if jobspec does not spec‐
620 ify a valid job or jobspec specifies a job that was started
621 without job control.
622
623 getopts optstring name [args]
624 getopts is used by shell procedures to parse positional parame‐
625 ters. optstring contains the option characters to be recog‐
626 nized; if a character is followed by a colon, the option is
627 expected to have an argument, which should be separated from it
628 by white space. The colon and question mark characters may not
629 be used as option characters. Each time it is invoked, getopts
630 places the next option in the shell variable name, initializing
631 name if it does not exist, and the index of the next argument to
632 be processed into the variable OPTIND. OPTIND is initialized to
633 1 each time the shell or a shell script is invoked. When an
634 option requires an argument, getopts places that argument into
635 the variable OPTARG. The shell does not reset OPTIND automati‐
636 cally; it must be manually reset between multiple calls to
637 getopts within the same shell invocation if a new set of parame‐
638 ters is to be used.
639
640 When the end of options is encountered, getopts exits with a
641 return value greater than zero. OPTIND is set to the index of
642 the first non-option argument, and name is set to ?.
643
644 getopts normally parses the positional parameters, but if more
645 arguments are given in args, getopts parses those instead.
646
647 getopts can report errors in two ways. If the first character
648 of optstring is a colon, silent error reporting is used. In
649 normal operation, diagnostic messages are printed when invalid
650 options or missing option arguments are encountered. If the
651 variable OPTERR is set to 0, no error messages will be dis‐
652 played, even if the first character of optstring is not a colon.
653
654 If an invalid option is seen, getopts places ? into name and, if
655 not silent, prints an error message and unsets OPTARG. If
656 getopts is silent, the option character found is placed in
657 OPTARG and no diagnostic message is printed.
658
659 If a required argument is not found, and getopts is not silent,
660 a question mark (?) is placed in name, OPTARG is unset, and a
661 diagnostic message is printed. If getopts is silent, then a
662 colon (:) is placed in name and OPTARG is set to the option
663 character found.
664
665 getopts returns true if an option, specified or unspecified, is
666 found. It returns false if the end of options is encountered or
667 an error occurs.
668
669 hash [-lr] [-p filename] [-dt] [name]
670 Each time hash is invoked, the full pathname of the command name
671 is determined by searching the directories in $PATH and remem‐
672 bered. Any previously-remembered pathname is discarded. If the
673 -p option is supplied, no path search is performed, and filename
674 is used as the full filename of the command. The -r option
675 causes the shell to forget all remembered locations. The -d
676 option causes the shell to forget the remembered location of
677 each name. If the -t option is supplied, the full pathname to
678 which each name corresponds is printed. If multiple name argu‐
679 ments are supplied with -t, the name is printed before the
680 hashed full pathname. The -l option causes output to be dis‐
681 played in a format that may be reused as input. If no arguments
682 are given, or if only -l is supplied, information about remem‐
683 bered commands is printed. The return status is true unless a
684 name is not found or an invalid option is supplied.
685
686 help [-dms] [pattern]
687 Display helpful information about builtin commands. If pattern
688 is specified, help gives detailed help on all commands matching
689 pattern; otherwise help for all the builtins and shell control
690 structures is printed.
691 -d Display a short description of each pattern
692 -m Display the description of each pattern in a manpage-like
693 format
694 -s Display only a short usage synopsis for each pattern
695
696 The return status is 0 unless no command matches pattern.
697
698 history [n]
699 history -c
700 history -d offset
701 history -anrw [filename]
702 history -p arg [arg ...]
703 history -s arg [arg ...]
704 With no options, display the command history list with line num‐
705 bers. Lines listed with a * have been modified. An argument of
706 n lists only the last n lines. If the shell variable HISTTIME‐
707 FORMAT is set and not null, it is used as a format string for
708 strftime(3) to display the time stamp associated with each dis‐
709 played history entry. No intervening blank is printed between
710 the formatted time stamp and the history line. If filename is
711 supplied, it is used as the name of the history file; if not,
712 the value of HISTFILE is used. Options, if supplied, have the
713 following meanings:
714 -c Clear the history list by deleting all the entries.
715 -d offset
716 Delete the history entry at position offset.
717 -a Append the ``new'' history lines to the history file.
718 These are history lines entered since the beginning of
719 the current bash session, but not already appended to the
720 history file.
721 -n Read the history lines not already read from the history
722 file into the current history list. These are lines
723 appended to the history file since the beginning of the
724 current bash session.
725 -r Read the contents of the history file and append them to
726 the current history list.
727 -w Write the current history list to the history file, over‐
728 writing the history file's contents.
729 -p Perform history substitution on the following args and
730 display the result on the standard output. Does not
731 store the results in the history list. Each arg must be
732 quoted to disable normal history expansion.
733 -s Store the args in the history list as a single entry.
734 The last command in the history list is removed before
735 the args are added.
736
737 If the HISTTIMEFORMAT variable is set, the time stamp informa‐
738 tion associated with each history entry is written to the his‐
739 tory file, marked with the history comment character. When the
740 history file is read, lines beginning with the history comment
741 character followed immediately by a digit are interpreted as
742 timestamps for the following history entry. The return value is
743 0 unless an invalid option is encountered, an error occurs while
744 reading or writing the history file, an invalid offset is sup‐
745 plied as an argument to -d, or the history expansion supplied as
746 an argument to -p fails.
747
748 jobs [-lnprs] [ jobspec ... ]
749 jobs -x command [ args ... ]
750 The first form lists the active jobs. The options have the fol‐
751 lowing meanings:
752 -l List process IDs in addition to the normal information.
753 -n Display information only about jobs that have changed
754 status since the user was last notified of their status.
755 -p List only the process ID of the job's process group
756 leader.
757 -r Display only running jobs.
758 -s Display only stopped jobs.
759
760 If jobspec is given, output is restricted to information about
761 that job. The return status is 0 unless an invalid option is
762 encountered or an invalid jobspec is supplied.
763
764 If the -x option is supplied, jobs replaces any jobspec found in
765 command or args with the corresponding process group ID, and
766 executes command passing it args, returning its exit status.
767
768 kill [-s sigspec | -n signum | -sigspec] [pid | jobspec] ...
769 kill -l|-L [sigspec | exit_status]
770 Send the signal named by sigspec or signum to the processes
771 named by pid or jobspec. sigspec is either a case-insensitive
772 signal name such as SIGKILL (with or without the SIG prefix) or
773 a signal number; signum is a signal number. If sigspec is not
774 present, then SIGTERM is assumed. An argument of -l lists the
775 signal names. If any arguments are supplied when -l is given,
776 the names of the signals corresponding to the arguments are
777 listed, and the return status is 0. The exit_status argument to
778 -l is a number specifying either a signal number or the exit
779 status of a process terminated by a signal. The -L option is
780 equivalent to -l. kill returns true if at least one signal was
781 successfully sent, or false if an error occurs or an invalid
782 option is encountered.
783
784 let arg [arg ...]
785 Each arg is an arithmetic expression to be evaluated (see ARITH‐
786 METIC EVALUATION above). If the last arg evaluates to 0, let
787 returns 1; 0 is returned otherwise.
788
789 local [option] [name[=value] ... | - ]
790 For each argument, a local variable named name is created, and
791 assigned value. The option can be any of the options accepted
792 by declare. When local is used within a function, it causes the
793 variable name to have a visible scope restricted to that func‐
794 tion and its children. If name is -, the set of shell options
795 is made local to the function in which local is invoked: shell
796 options changed using the set builtin inside the function are
797 restored to their original values when the function returns.
798 With no operands, local writes a list of local variables to the
799 standard output. It is an error to use local when not within a
800 function. The return status is 0 unless local is used outside a
801 function, an invalid name is supplied, or name is a readonly
802 variable.
803
804 logout Exit a login shell.
805
806 mapfile [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C
807 callback] [-c quantum] [array]
808 readarray [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C
809 callback] [-c quantum] [array]
810 Read lines from the standard input into the indexed array vari‐
811 able array, or from file descriptor fd if the -u option is sup‐
812 plied. The variable MAPFILE is the default array. Options, if
813 supplied, have the following meanings:
814 -d The first character of delim is used to terminate each
815 input line, rather than newline.
816 -n Copy at most count lines. If count is 0, all lines are
817 copied.
818 -O Begin assigning to array at index origin. The default
819 index is 0.
820 -s Discard the first count lines read.
821 -t Remove a trailing delim (default newline) from each line
822 read.
823 -u Read lines from file descriptor fd instead of the stan‐
824 dard input.
825 -C Evaluate callback each time quantum lines are read. The
826 -c option specifies quantum.
827 -c Specify the number of lines read between each call to
828 callback.
829
830 If -C is specified without -c, the default quantum is 5000.
831 When callback is evaluated, it is supplied the index of the next
832 array element to be assigned and the line to be assigned to that
833 element as additional arguments. callback is evaluated after
834 the line is read but before the array element is assigned.
835
836 If not supplied with an explicit origin, mapfile will clear
837 array before assigning to it.
838
839 mapfile returns successfully unless an invalid option or option
840 argument is supplied, array is invalid or unassignable, or if
841 array is not an indexed array.
842
843 popd [-n] [+n] [-n]
844 Removes entries from the directory stack. With no arguments,
845 removes the top directory from the stack, and performs a cd to
846 the new top directory. Arguments, if supplied, have the follow‐
847 ing meanings:
848 -n Suppresses the normal change of directory when removing
849 directories from the stack, so that only the stack is
850 manipulated.
851 +n Removes the nth entry counting from the left of the list
852 shown by dirs, starting with zero. For example: ``popd
853 +0'' removes the first directory, ``popd +1'' the second.
854 -n Removes the nth entry counting from the right of the list
855 shown by dirs, starting with zero. For example: ``popd
856 -0'' removes the last directory, ``popd -1'' the next to
857 last.
858
859 If the popd command is successful, a dirs is performed as well,
860 and the return status is 0. popd returns false if an invalid
861 option is encountered, the directory stack is empty, a non-exis‐
862 tent directory stack entry is specified, or the directory change
863 fails.
864
865 printf [-v var] format [arguments]
866 Write the formatted arguments to the standard output under the
867 control of the format. The -v option causes the output to be
868 assigned to the variable var rather than being printed to the
869 standard output.
870
871 The format is a character string which contains three types of
872 objects: plain characters, which are simply copied to standard
873 output, character escape sequences, which are converted and
874 copied to the standard output, and format specifications, each
875 of which causes printing of the next successive argument. In
876 addition to the standard printf(1) format specifications, printf
877 interprets the following extensions:
878 %b causes printf to expand backslash escape sequences in the
879 corresponding argument in the same way as echo -e.
880 %q causes printf to output the corresponding argument in a
881 format that can be reused as shell input.
882 %(datefmt)T
883 causes printf to output the date-time string resulting
884 from using datefmt as a format string for strftime(3).
885 The corresponding argument is an integer representing the
886 number of seconds since the epoch. Two special argument
887 values may be used: -1 represents the current time, and
888 -2 represents the time the shell was invoked. If no
889 argument is specified, conversion behaves as if -1 had
890 been given. This is an exception to the usual printf
891 behavior.
892
893 Arguments to non-string format specifiers are treated as C con‐
894 stants, except that a leading plus or minus sign is allowed, and
895 if the leading character is a single or double quote, the value
896 is the ASCII value of the following character.
897
898 The format is reused as necessary to consume all of the argu‐
899 ments. If the format requires more arguments than are supplied,
900 the extra format specifications behave as if a zero value or
901 null string, as appropriate, had been supplied. The return
902 value is zero on success, non-zero on failure.
903
904 pushd [-n] [+n] [-n]
905 pushd [-n] [dir]
906 Adds a directory to the top of the directory stack, or rotates
907 the stack, making the new top of the stack the current working
908 directory. With no arguments, pushd exchanges the top two
909 directories and returns 0, unless the directory stack is empty.
910 Arguments, if supplied, have the following meanings:
911 -n Suppresses the normal change of directory when rotating
912 or adding directories to the stack, so that only the
913 stack is manipulated.
914 +n Rotates the stack so that the nth directory (counting
915 from the left of the list shown by dirs, starting with
916 zero) is at the top.
917 -n Rotates the stack so that the nth directory (counting
918 from the right of the list shown by dirs, starting with
919 zero) is at the top.
920 dir Adds dir to the directory stack at the top, making it the
921 new current working directory as if it had been supplied
922 as the argument to the cd builtin.
923
924 If the pushd command is successful, a dirs is performed as well.
925 If the first form is used, pushd returns 0 unless the cd to dir
926 fails. With the second form, pushd returns 0 unless the direc‐
927 tory stack is empty, a non-existent directory stack element is
928 specified, or the directory change to the specified new current
929 directory fails.
930
931 pwd [-LP]
932 Print the absolute pathname of the current working directory.
933 The pathname printed contains no symbolic links if the -P option
934 is supplied or the -o physical option to the set builtin command
935 is enabled. If the -L option is used, the pathname printed may
936 contain symbolic links. The return status is 0 unless an error
937 occurs while reading the name of the current directory or an
938 invalid option is supplied.
939
940 read [-ers] [-a aname] [-d delim] [-i text] [-n nchars] [-N nchars] [-p
941 prompt] [-t timeout] [-u fd] [name ...]
942 One line is read from the standard input, or from the file
943 descriptor fd supplied as an argument to the -u option, split
944 into words as described above under Word Splitting, and the
945 first word is assigned to the first name, the second word to the
946 second name, and so on. If there are more words than names, the
947 remaining words and their intervening delimiters are assigned to
948 the last name. If there are fewer words read from the input
949 stream than names, the remaining names are assigned empty val‐
950 ues. The characters in IFS are used to split the line into
951 words using the same rules the shell uses for expansion
952 (described above under Word Splitting). The backslash character
953 (\) may be used to remove any special meaning for the next char‐
954 acter read and for line continuation. Options, if supplied,
955 have the following meanings:
956 -a aname
957 The words are assigned to sequential indices of the array
958 variable aname, starting at 0. aname is unset before any
959 new values are assigned. Other name arguments are
960 ignored.
961 -d delim
962 The first character of delim is used to terminate the
963 input line, rather than newline.
964 -e If the standard input is coming from a terminal, readline
965 (see READLINE above) is used to obtain the line. Read‐
966 line uses the current (or default, if line editing was
967 not previously active) editing settings.
968 -i text
969 If readline is being used to read the line, text is
970 placed into the editing buffer before editing begins.
971 -n nchars
972 read returns after reading nchars characters rather than
973 waiting for a complete line of input, but honors a delim‐
974 iter if fewer than nchars characters are read before the
975 delimiter.
976 -N nchars
977 read returns after reading exactly nchars characters
978 rather than waiting for a complete line of input, unless
979 EOF is encountered or read times out. Delimiter charac‐
980 ters encountered in the input are not treated specially
981 and do not cause read to return until nchars characters
982 are read. The result is not split on the characters in
983 IFS; the intent is that the variable is assigned exactly
984 the characters read (with the exception of backslash; see
985 the -r option below).
986 -p prompt
987 Display prompt on standard error, without a trailing new‐
988 line, before attempting to read any input. The prompt is
989 displayed only if input is coming from a terminal.
990 -r Backslash does not act as an escape character. The back‐
991 slash is considered to be part of the line. In particu‐
992 lar, a backslash-newline pair may not be used as a line
993 continuation.
994 -s Silent mode. If input is coming from a terminal, charac‐
995 ters are not echoed.
996 -t timeout
997 Cause read to time out and return failure if a complete
998 line of input (or a specified number of characters) is
999 not read within timeout seconds. timeout may be a deci‐
1000 mal number with a fractional portion following the deci‐
1001 mal point. This option is only effective if read is
1002 reading input from a terminal, pipe, or other special
1003 file; it has no effect when reading from regular files.
1004 If read times out, read saves any partial input read into
1005 the specified variable name. If timeout is 0, read
1006 returns immediately, without trying to read any data.
1007 The exit status is 0 if input is available on the speci‐
1008 fied file descriptor, non-zero otherwise. The exit sta‐
1009 tus is greater than 128 if the timeout is exceeded.
1010 -u fd Read input from file descriptor fd.
1011
1012 If no names are supplied, the line read is assigned to the vari‐
1013 able REPLY. The exit status is zero, unless end-of-file is
1014 encountered, read times out (in which case the status is greater
1015 than 128), a variable assignment error (such as assigning to a
1016 readonly variable) occurs, or an invalid file descriptor is sup‐
1017 plied as the argument to -u.
1018
1019 readonly [-aAf] [-p] [name[=word] ...]
1020 The given names are marked readonly; the values of these names
1021 may not be changed by subsequent assignment. If the -f option
1022 is supplied, the functions corresponding to the names are so
1023 marked. The -a option restricts the variables to indexed
1024 arrays; the -A option restricts the variables to associative
1025 arrays. If both options are supplied, -A takes precedence. If
1026 no name arguments are given, or if the -p option is supplied, a
1027 list of all readonly names is printed. The other options may be
1028 used to restrict the output to a subset of the set of readonly
1029 names. The -p option causes output to be displayed in a format
1030 that may be reused as input. If a variable name is followed by
1031 =word, the value of the variable is set to word. The return
1032 status is 0 unless an invalid option is encountered, one of the
1033 names is not a valid shell variable name, or -f is supplied with
1034 a name that is not a function.
1035
1036 return [n]
1037 Causes a function to stop executing and return the value speci‐
1038 fied by n to its caller. If n is omitted, the return status is
1039 that of the last command executed in the function body. If
1040 return is executed by a trap handler, the last command used to
1041 determine the status is the last command executed before the
1042 trap handler. if return is executed during a DEBUG trap, the
1043 last command used to determine the status is the last command
1044 executed by the trap handler before return was invoked. If
1045 return is used outside a function, but during execution of a
1046 script by the . (source) command, it causes the shell to stop
1047 executing that script and return either n or the exit status of
1048 the last command executed within the script as the exit status
1049 of the script. If n is supplied, the return value is its least
1050 significant 8 bits. The return status is non-zero if return is
1051 supplied a non-numeric argument, or is used outside a function
1052 and not during execution of a script by . or source. Any com‐
1053 mand associated with the RETURN trap is executed before execu‐
1054 tion resumes after the function or script.
1055
1056 set [--abefhkmnptuvxBCEHPT] [-o option-name] [arg ...]
1057 set [+abefhkmnptuvxBCEHPT] [+o option-name] [arg ...]
1058 Without options, the name and value of each shell variable are
1059 displayed in a format that can be reused as input for setting or
1060 resetting the currently-set variables. Read-only variables can‐
1061 not be reset. In posix mode, only shell variables are listed.
1062 The output is sorted according to the current locale. When
1063 options are specified, they set or unset shell attributes. Any
1064 arguments remaining after option processing are treated as val‐
1065 ues for the positional parameters and are assigned, in order, to
1066 $1, $2, ... $n. Options, if specified, have the following
1067 meanings:
1068 -a Each variable or function that is created or modified is
1069 given the export attribute and marked for export to the
1070 environment of subsequent commands.
1071 -b Report the status of terminated background jobs immedi‐
1072 ately, rather than before the next primary prompt. This
1073 is effective only when job control is enabled.
1074 -e Exit immediately if a pipeline (which may consist of a
1075 single simple command), a list, or a compound command
1076 (see SHELL GRAMMAR above), exits with a non-zero status.
1077 The shell does not exit if the command that fails is
1078 part of the command list immediately following a while
1079 or until keyword, part of the test following the if or
1080 elif reserved words, part of any command executed in a
1081 && or || list except the command following the final &&
1082 or ||, any command in a pipeline but the last, or if the
1083 command's return value is being inverted with !. If a
1084 compound command other than a subshell returns a non-
1085 zero status because a command failed while -e was being
1086 ignored, the shell does not exit. A trap on ERR, if
1087 set, is executed before the shell exits. This option
1088 applies to the shell environment and each subshell envi‐
1089 ronment separately (see COMMAND EXECUTION ENVIRONMENT
1090 above), and may cause subshells to exit before executing
1091 all the commands in the subshell.
1092
1093 If a compound command or shell function executes in a
1094 context where -e is being ignored, none of the commands
1095 executed within the compound command or function body
1096 will be affected by the -e setting, even if -e is set
1097 and a command returns a failure status. If a compound
1098 command or shell function sets -e while executing in a
1099 context where -e is ignored, that setting will not have
1100 any effect until the compound command or the command
1101 containing the function call completes.
1102 -f Disable pathname expansion.
1103 -h Remember the location of commands as they are looked up
1104 for execution. This is enabled by default.
1105 -k All arguments in the form of assignment statements are
1106 placed in the environment for a command, not just those
1107 that precede the command name.
1108 -m Monitor mode. Job control is enabled. This option is
1109 on by default for interactive shells on systems that
1110 support it (see JOB CONTROL above). All processes run
1111 in a separate process group. When a background job com‐
1112 pletes, the shell prints a line containing its exit sta‐
1113 tus.
1114 -n Read commands but do not execute them. This may be used
1115 to check a shell script for syntax errors. This is
1116 ignored by interactive shells.
1117 -o option-name
1118 The option-name can be one of the following:
1119 allexport
1120 Same as -a.
1121 braceexpand
1122 Same as -B.
1123 emacs Use an emacs-style command line editing inter‐
1124 face. This is enabled by default when the shell
1125 is interactive, unless the shell is started with
1126 the --noediting option. This also affects the
1127 editing interface used for read -e.
1128 errexit Same as -e.
1129 errtrace
1130 Same as -E.
1131 functrace
1132 Same as -T.
1133 hashall Same as -h.
1134 histexpand
1135 Same as -H.
1136 history Enable command history, as described above under
1137 HISTORY. This option is on by default in inter‐
1138 active shells.
1139 ignoreeof
1140 The effect is as if the shell command
1141 ``IGNOREEOF=10'' had been executed (see Shell
1142 Variables above).
1143 keyword Same as -k.
1144 monitor Same as -m.
1145 noclobber
1146 Same as -C.
1147 noexec Same as -n.
1148 noglob Same as -f.
1149 nolog Currently ignored.
1150 notify Same as -b.
1151 nounset Same as -u.
1152 onecmd Same as -t.
1153 physical
1154 Same as -P.
1155 pipefail
1156 If set, the return value of a pipeline is the
1157 value of the last (rightmost) command to exit
1158 with a non-zero status, or zero if all commands
1159 in the pipeline exit successfully. This option
1160 is disabled by default.
1161 posix Change the behavior of bash where the default
1162 operation differs from the POSIX standard to
1163 match the standard (posix mode). See SEE ALSO
1164 below for a reference to a document that details
1165 how posix mode affects bash's behavior.
1166 privileged
1167 Same as -p.
1168 verbose Same as -v.
1169 vi Use a vi-style command line editing interface.
1170 This also affects the editing interface used for
1171 read -e.
1172 xtrace Same as -x.
1173 If -o is supplied with no option-name, the values of the
1174 current options are printed. If +o is supplied with no
1175 option-name, a series of set commands to recreate the
1176 current option settings is displayed on the standard
1177 output.
1178 -p Turn on privileged mode. In this mode, the $ENV and
1179 $BASH_ENV files are not processed, shell functions are
1180 not inherited from the environment, and the SHELLOPTS,
1181 BASHOPTS, CDPATH, and GLOBIGNORE variables, if they
1182 appear in the environment, are ignored. If the shell is
1183 started with the effective user (group) id not equal to
1184 the real user (group) id, and the -p option is not sup‐
1185 plied, these actions are taken and the effective user id
1186 is set to the real user id. If the -p option is sup‐
1187 plied at startup, the effective user id is not reset.
1188 Turning this option off causes the effective user and
1189 group ids to be set to the real user and group ids.
1190 -t Exit after reading and executing one command.
1191 -u Treat unset variables and parameters other than the spe‐
1192 cial parameters "@" and "*" as an error when performing
1193 parameter expansion. If expansion is attempted on an
1194 unset variable or parameter, the shell prints an error
1195 message, and, if not interactive, exits with a non-zero
1196 status.
1197 -v Print shell input lines as they are read.
1198 -x After expanding each simple command, for command, case
1199 command, select command, or arithmetic for command, dis‐
1200 play the expanded value of PS4, followed by the command
1201 and its expanded arguments or associated word list.
1202 -B The shell performs brace expansion (see Brace Expansion
1203 above). This is on by default.
1204 -C If set, bash does not overwrite an existing file with
1205 the >, >&, and <> redirection operators. This may be
1206 overridden when creating output files by using the redi‐
1207 rection operator >| instead of >.
1208 -E If set, any trap on ERR is inherited by shell functions,
1209 command substitutions, and commands executed in a sub‐
1210 shell environment. The ERR trap is normally not inher‐
1211 ited in such cases.
1212 -H Enable ! style history substitution. This option is on
1213 by default when the shell is interactive.
1214 -P If set, the shell does not resolve symbolic links when
1215 executing commands such as cd that change the current
1216 working directory. It uses the physical directory
1217 structure instead. By default, bash follows the logical
1218 chain of directories when performing commands which
1219 change the current directory.
1220 -T If set, any traps on DEBUG and RETURN are inherited by
1221 shell functions, command substitutions, and commands
1222 executed in a subshell environment. The DEBUG and
1223 RETURN traps are normally not inherited in such cases.
1224 -- If no arguments follow this option, then the positional
1225 parameters are unset. Otherwise, the positional parame‐
1226 ters are set to the args, even if some of them begin
1227 with a -.
1228 - Signal the end of options, cause all remaining args to
1229 be assigned to the positional parameters. The -x and -v
1230 options are turned off. If there are no args, the posi‐
1231 tional parameters remain unchanged.
1232
1233 The options are off by default unless otherwise noted. Using +
1234 rather than - causes these options to be turned off. The
1235 options can also be specified as arguments to an invocation of
1236 the shell. The current set of options may be found in $-. The
1237 return status is always true unless an invalid option is encoun‐
1238 tered.
1239
1240 shift [n]
1241 The positional parameters from n+1 ... are renamed to $1 ....
1242 Parameters represented by the numbers $# down to $#-n+1 are
1243 unset. n must be a non-negative number less than or equal to
1244 $#. If n is 0, no parameters are changed. If n is not given,
1245 it is assumed to be 1. If n is greater than $#, the positional
1246 parameters are not changed. The return status is greater than
1247 zero if n is greater than $# or less than zero; otherwise 0.
1248
1249 shopt [-pqsu] [-o] [optname ...]
1250 Toggle the values of settings controlling optional shell behav‐
1251 ior. The settings can be either those listed below, or, if the
1252 -o option is used, those available with the -o option to the set
1253 builtin command. With no options, or with the -p option, a list
1254 of all settable options is displayed, with an indication of
1255 whether or not each is set. The -p option causes output to be
1256 displayed in a form that may be reused as input. Other options
1257 have the following meanings:
1258 -s Enable (set) each optname.
1259 -u Disable (unset) each optname.
1260 -q Suppresses normal output (quiet mode); the return status
1261 indicates whether the optname is set or unset. If multi‐
1262 ple optname arguments are given with -q, the return sta‐
1263 tus is zero if all optnames are enabled; non-zero other‐
1264 wise.
1265 -o Restricts the values of optname to be those defined for
1266 the -o option to the set builtin.
1267
1268 If either -s or -u is used with no optname arguments, shopt
1269 shows only those options which are set or unset, respectively.
1270 Unless otherwise noted, the shopt options are disabled (unset)
1271 by default.
1272
1273 The return status when listing options is zero if all optnames
1274 are enabled, non-zero otherwise. When setting or unsetting
1275 options, the return status is zero unless an optname is not a
1276 valid shell option.
1277
1278 The list of shopt options is:
1279
1280 autocd If set, a command name that is the name of a directory
1281 is executed as if it were the argument to the cd com‐
1282 mand. This option is only used by interactive shells.
1283 cdable_vars
1284 If set, an argument to the cd builtin command that is
1285 not a directory is assumed to be the name of a variable
1286 whose value is the directory to change to.
1287 cdspell If set, minor errors in the spelling of a directory com‐
1288 ponent in a cd command will be corrected. The errors
1289 checked for are transposed characters, a missing charac‐
1290 ter, and one character too many. If a correction is
1291 found, the corrected filename is printed, and the com‐
1292 mand proceeds. This option is only used by interactive
1293 shells.
1294 checkhash
1295 If set, bash checks that a command found in the hash ta‐
1296 ble exists before trying to execute it. If a hashed
1297 command no longer exists, a normal path search is per‐
1298 formed.
1299 checkjobs
1300 If set, bash lists the status of any stopped and running
1301 jobs before exiting an interactive shell. If any jobs
1302 are running, this causes the exit to be deferred until a
1303 second exit is attempted without an intervening command
1304 (see JOB CONTROL above). The shell always postpones
1305 exiting if any jobs are stopped.
1306 checkwinsize
1307 If set, bash checks the window size after each command
1308 and, if necessary, updates the values of LINES and COL‐
1309 UMNS.
1310 cmdhist If set, bash attempts to save all lines of a multiple-
1311 line command in the same history entry. This allows
1312 easy re-editing of multi-line commands.
1313 compat31
1314 If set, bash changes its behavior to that of version 3.1
1315 with respect to quoted arguments to the [[ conditional
1316 command's =~ operator and locale-specific string compar‐
1317 ison when using the [[ conditional command's < and >
1318 operators. Bash versions prior to bash-4.1 use ASCII
1319 collation and strcmp(3); bash-4.1 and later use the cur‐
1320 rent locale's collation sequence and strcoll(3).
1321 compat32
1322 If set, bash changes its behavior to that of version 3.2
1323 with respect to locale-specific string comparison when
1324 using the [[ conditional command's < and > operators
1325 (see previous item) and the effect of interrupting a
1326 command list. Bash versions 3.2 and earlier continue
1327 with the next command in the list after one terminates
1328 due to an interrupt.
1329 compat40
1330 If set, bash changes its behavior to that of version 4.0
1331 with respect to locale-specific string comparison when
1332 using the [[ conditional command's < and > operators
1333 (see description of compat31) and the effect of inter‐
1334 rupting a command list. Bash versions 4.0 and later
1335 interrupt the list as if the shell received the inter‐
1336 rupt; previous versions continue with the next command
1337 in the list.
1338 compat41
1339 If set, bash, when in posix mode, treats a single quote
1340 in a double-quoted parameter expansion as a special
1341 character. The single quotes must match (an even num‐
1342 ber) and the characters between the single quotes are
1343 considered quoted. This is the behavior of posix mode
1344 through version 4.1. The default bash behavior remains
1345 as in previous versions.
1346 compat42
1347 If set, bash does not process the replacement string in
1348 the pattern substitution word expansion using quote
1349 removal.
1350 compat43
1351 If set, bash does not print a warning message if an
1352 attempt is made to use a quoted compound array assign‐
1353 ment as an argument to declare, makes word expansion
1354 errors non-fatal errors that cause the current command
1355 to fail (the default behavior is to make them fatal
1356 errors that cause the shell to exit), and does not reset
1357 the loop state when a shell function is executed (this
1358 allows break or continue in a shell function to affect
1359 loops in the caller's context).
1360 complete_fullquote
1361 If set, bash quotes all shell metacharacters in file‐
1362 names and directory names when performing completion.
1363 If not set, bash removes metacharacters such as the dol‐
1364 lar sign from the set of characters that will be quoted
1365 in completed filenames when these metacharacters appear
1366 in shell variable references in words to be completed.
1367 This means that dollar signs in variable names that
1368 expand to directories will not be quoted; however, any
1369 dollar signs appearing in filenames will not be quoted,
1370 either. This is active only when bash is using back‐
1371 slashes to quote completed filenames. This variable is
1372 set by default, which is the default bash behavior in
1373 versions through 4.2.
1374 direxpand
1375 If set, bash replaces directory names with the results
1376 of word expansion when performing filename completion.
1377 This changes the contents of the readline editing buf‐
1378 fer. If not set, bash attempts to preserve what the
1379 user typed.
1380 dirspell
1381 If set, bash attempts spelling correction on directory
1382 names during word completion if the directory name ini‐
1383 tially supplied does not exist.
1384 dotglob If set, bash includes filenames beginning with a `.' in
1385 the results of pathname expansion.
1386 execfail
1387 If set, a non-interactive shell will not exit if it can‐
1388 not execute the file specified as an argument to the
1389 exec builtin command. An interactive shell does not
1390 exit if exec fails.
1391 expand_aliases
1392 If set, aliases are expanded as described above under
1393 ALIASES. This option is enabled by default for interac‐
1394 tive shells.
1395 extdebug
1396 If set at shell invocation, arrange to execute the
1397 debugger profile before the shell starts, identical to
1398 the --debugger option. If set after invocation, behav‐
1399 ior intended for use by debuggers is enabled:
1400 1. The -F option to the declare builtin displays the
1401 source file name and line number corresponding to
1402 each function name supplied as an argument.
1403 2. If the command run by the DEBUG trap returns a
1404 non-zero value, the next command is skipped and
1405 not executed.
1406 3. If the command run by the DEBUG trap returns a
1407 value of 2, and the shell is executing in a sub‐
1408 routine (a shell function or a shell script exe‐
1409 cuted by the . or source builtins), the shell
1410 simulates a call to return.
1411 4. BASH_ARGC and BASH_ARGV are updated as described
1412 in their descriptions above.
1413 5. Function tracing is enabled: command substitu‐
1414 tion, shell functions, and subshells invoked with
1415 ( command ) inherit the DEBUG and RETURN traps.
1416 6. Error tracing is enabled: command substitution,
1417 shell functions, and subshells invoked with (
1418 command ) inherit the ERR trap.
1419 extglob If set, the extended pattern matching features described
1420 above under Pathname Expansion are enabled.
1421 extquote
1422 If set, $'string' and $"string" quoting is performed
1423 within ${parameter} expansions enclosed in double
1424 quotes. This option is enabled by default.
1425 failglob
1426 If set, patterns which fail to match filenames during
1427 pathname expansion result in an expansion error.
1428 force_fignore
1429 If set, the suffixes specified by the FIGNORE shell
1430 variable cause words to be ignored when performing word
1431 completion even if the ignored words are the only possi‐
1432 ble completions. See SHELL VARIABLES above for a
1433 description of FIGNORE. This option is enabled by
1434 default.
1435 globasciiranges
1436 If set, range expressions used in pattern matching
1437 bracket expressions (see Pattern Matching above) behave
1438 as if in the traditional C locale when performing com‐
1439 parisons. That is, the current locale's collating
1440 sequence is not taken into account, so b will not col‐
1441 late between A and B, and upper-case and lower-case
1442 ASCII characters will collate together.
1443 globstar
1444 If set, the pattern ** used in a pathname expansion con‐
1445 text will match all files and zero or more directories
1446 and subdirectories. If the pattern is followed by a /,
1447 only directories and subdirectories match.
1448 gnu_errfmt
1449 If set, shell error messages are written in the standard
1450 GNU error message format.
1451 histappend
1452 If set, the history list is appended to the file named
1453 by the value of the HISTFILE variable when the shell
1454 exits, rather than overwriting the file.
1455 histreedit
1456 If set, and readline is being used, a user is given the
1457 opportunity to re-edit a failed history substitution.
1458 histverify
1459 If set, and readline is being used, the results of his‐
1460 tory substitution are not immediately passed to the
1461 shell parser. Instead, the resulting line is loaded
1462 into the readline editing buffer, allowing further modi‐
1463 fication.
1464 hostcomplete
1465 If set, and readline is being used, bash will attempt to
1466 perform hostname completion when a word containing a @
1467 is being completed (see Completing under READLINE
1468 above). This is enabled by default.
1469 huponexit
1470 If set, bash will send SIGHUP to all jobs when an inter‐
1471 active login shell exits.
1472 inherit_errexit
1473 If set, command substitution inherits the value of the
1474 errexit option, instead of unsetting it in the subshell
1475 environment. This option is enabled when posix mode is
1476 enabled.
1477 interactive_comments
1478 If set, allow a word beginning with # to cause that word
1479 and all remaining characters on that line to be ignored
1480 in an interactive shell (see COMMENTS above). This
1481 option is enabled by default.
1482 lastpipe
1483 If set, and job control is not active, the shell runs
1484 the last command of a pipeline not executed in the back‐
1485 ground in the current shell environment.
1486 lithist If set, and the cmdhist option is enabled, multi-line
1487 commands are saved to the history with embedded newlines
1488 rather than using semicolon separators where possible.
1489 login_shell
1490 The shell sets this option if it is started as a login
1491 shell (see INVOCATION above). The value may not be
1492 changed.
1493 mailwarn
1494 If set, and a file that bash is checking for mail has
1495 been accessed since the last time it was checked, the
1496 message ``The mail in mailfile has been read'' is dis‐
1497 played.
1498 no_empty_cmd_completion
1499 If set, and readline is being used, bash will not
1500 attempt to search the PATH for possible completions when
1501 completion is attempted on an empty line.
1502 nocaseglob
1503 If set, bash matches filenames in a case-insensitive
1504 fashion when performing pathname expansion (see Pathname
1505 Expansion above).
1506 nocasematch
1507 If set, bash matches patterns in a case-insensitive
1508 fashion when performing matching while executing case or
1509 [[ conditional commands, when performing pattern substi‐
1510 tution word expansions, or when filtering possible com‐
1511 pletions as part of programmable completion.
1512 nullglob
1513 If set, bash allows patterns which match no files (see
1514 Pathname Expansion above) to expand to a null string,
1515 rather than themselves.
1516 progcomp
1517 If set, the programmable completion facilities (see Pro‐
1518 grammable Completion above) are enabled. This option is
1519 enabled by default.
1520 promptvars
1521 If set, prompt strings undergo parameter expansion, com‐
1522 mand substitution, arithmetic expansion, and quote
1523 removal after being expanded as described in PROMPTING
1524 above. This option is enabled by default.
1525 restricted_shell
1526 The shell sets this option if it is started in
1527 restricted mode (see RESTRICTED SHELL below). The value
1528 may not be changed. This is not reset when the startup
1529 files are executed, allowing the startup files to dis‐
1530 cover whether or not a shell is restricted.
1531 shift_verbose
1532 If set, the shift builtin prints an error message when
1533 the shift count exceeds the number of positional parame‐
1534 ters.
1535 sourcepath
1536 If set, the source (.) builtin uses the value of PATH to
1537 find the directory containing the file supplied as an
1538 argument. This option is enabled by default.
1539 xpg_echo
1540 If set, the echo builtin expands backslash-escape
1541 sequences by default.
1542
1543 suspend [-f]
1544 Suspend the execution of this shell until it receives a SIGCONT
1545 signal. A login shell cannot be suspended; the -f option can be
1546 used to override this and force the suspension. The return sta‐
1547 tus is 0 unless the shell is a login shell and -f is not sup‐
1548 plied, or if job control is not enabled.
1549
1550 test expr
1551 [ expr ]
1552 Return a status of 0 (true) or 1 (false) depending on the evalu‐
1553 ation of the conditional expression expr. Each operator and op‐
1554 erand must be a separate argument. Expressions are composed of
1555 the primaries described above under CONDITIONAL EXPRESSIONS.
1556 test does not accept any options, nor does it accept and ignore
1557 an argument of -- as signifying the end of options.
1558
1559 Expressions may be combined using the following operators,
1560 listed in decreasing order of precedence. The evaluation
1561 depends on the number of arguments; see below. Operator prece‐
1562 dence is used when there are five or more arguments.
1563 ! expr True if expr is false.
1564 ( expr )
1565 Returns the value of expr. This may be used to override
1566 the normal precedence of operators.
1567 expr1 -a expr2
1568 True if both expr1 and expr2 are true.
1569 expr1 -o expr2
1570 True if either expr1 or expr2 is true.
1571
1572 test and [ evaluate conditional expressions using a set of rules
1573 based on the number of arguments.
1574
1575 0 arguments
1576 The expression is false.
1577 1 argument
1578 The expression is true if and only if the argument is not
1579 null.
1580 2 arguments
1581 If the first argument is !, the expression is true if and
1582 only if the second argument is null. If the first argu‐
1583 ment is one of the unary conditional operators listed
1584 above under CONDITIONAL EXPRESSIONS, the expression is
1585 true if the unary test is true. If the first argument is
1586 not a valid unary conditional operator, the expression is
1587 false.
1588 3 arguments
1589 The following conditions are applied in the order listed.
1590 If the second argument is one of the binary conditional
1591 operators listed above under CONDITIONAL EXPRESSIONS, the
1592 result of the expression is the result of the binary test
1593 using the first and third arguments as operands. The -a
1594 and -o operators are considered binary operators when
1595 there are three arguments. If the first argument is !,
1596 the value is the negation of the two-argument test using
1597 the second and third arguments. If the first argument is
1598 exactly ( and the third argument is exactly ), the result
1599 is the one-argument test of the second argument. Other‐
1600 wise, the expression is false.
1601 4 arguments
1602 If the first argument is !, the result is the negation of
1603 the three-argument expression composed of the remaining
1604 arguments. Otherwise, the expression is parsed and eval‐
1605 uated according to precedence using the rules listed
1606 above.
1607 5 or more arguments
1608 The expression is parsed and evaluated according to
1609 precedence using the rules listed above.
1610
1611 When used with test or [, the < and > operators sort lexico‐
1612 graphically using ASCII ordering.
1613
1614 times Print the accumulated user and system times for the shell and
1615 for processes run from the shell. The return status is 0.
1616
1617 trap [-lp] [[arg] sigspec ...]
1618 The command arg is to be read and executed when the shell
1619 receives signal(s) sigspec. If arg is absent (and there is a
1620 single sigspec) or -, each specified signal is reset to its
1621 original disposition (the value it had upon entrance to the
1622 shell). If arg is the null string the signal specified by each
1623 sigspec is ignored by the shell and by the commands it invokes.
1624 If arg is not present and -p has been supplied, then the trap
1625 commands associated with each sigspec are displayed. If no
1626 arguments are supplied or if only -p is given, trap prints the
1627 list of commands associated with each signal. The -l option
1628 causes the shell to print a list of signal names and their cor‐
1629 responding numbers. Each sigspec is either a signal name
1630 defined in <signal.h>, or a signal number. Signal names are
1631 case insensitive and the SIG prefix is optional.
1632
1633 If a sigspec is EXIT (0) the command arg is executed on exit
1634 from the shell. If a sigspec is DEBUG, the command arg is exe‐
1635 cuted before every simple command, for command, case command,
1636 select command, every arithmetic for command, and before the
1637 first command executes in a shell function (see SHELL GRAMMAR
1638 above). Refer to the description of the extdebug option to the
1639 shopt builtin for details of its effect on the DEBUG trap. If a
1640 sigspec is RETURN, the command arg is executed each time a shell
1641 function or a script executed with the . or source builtins fin‐
1642 ishes executing.
1643
1644 If a sigspec is ERR, the command arg is executed whenever a
1645 pipeline (which may consist of a single simple command), a list,
1646 or a compound command returns a non-zero exit status, subject to
1647 the following conditions. The ERR trap is not executed if the
1648 failed command is part of the command list immediately following
1649 a while or until keyword, part of the test in an if statement,
1650 part of a command executed in a && or || list except the command
1651 following the final && or ||, any command in a pipeline but the
1652 last, or if the command's return value is being inverted using
1653 !. These are the same conditions obeyed by the errexit (-e)
1654 option.
1655
1656 Signals ignored upon entry to the shell cannot be trapped, reset
1657 or listed. Trapped signals that are not being ignored are reset
1658 to their original values in a subshell or subshell environment
1659 when one is created. The return status is false if any sigspec
1660 is invalid; otherwise trap returns true.
1661
1662 type [-aftpP] name [name ...]
1663 With no options, indicate how each name would be interpreted if
1664 used as a command name. If the -t option is used, type prints a
1665 string which is one of alias, keyword, function, builtin, or
1666 file if name is an alias, shell reserved word, function,
1667 builtin, or disk file, respectively. If the name is not found,
1668 then nothing is printed, and an exit status of false is
1669 returned. If the -p option is used, type either returns the
1670 name of the disk file that would be executed if name were speci‐
1671 fied as a command name, or nothing if ``type -t name'' would not
1672 return file. The -P option forces a PATH search for each name,
1673 even if ``type -t name'' would not return file. If a command is
1674 hashed, -p and -P print the hashed value, which is not necessar‐
1675 ily the file that appears first in PATH. If the -a option is
1676 used, type prints all of the places that contain an executable
1677 named name. This includes aliases and functions, if and only if
1678 the -p option is not also used. The table of hashed commands is
1679 not consulted when using -a. The -f option suppresses shell
1680 function lookup, as with the command builtin. type returns true
1681 if all of the arguments are found, false if any are not found.
1682
1683 ulimit [-HSabcdefiklmnpqrstuvxPT [limit]]
1684 Provides control over the resources available to the shell and
1685 to processes started by it, on systems that allow such control.
1686 The -H and -S options specify that the hard or soft limit is set
1687 for the given resource. A hard limit cannot be increased by a
1688 non-root user once it is set; a soft limit may be increased up
1689 to the value of the hard limit. If neither -H nor -S is speci‐
1690 fied, both the soft and hard limits are set. The value of limit
1691 can be a number in the unit specified for the resource or one of
1692 the special values hard, soft, or unlimited, which stand for the
1693 current hard limit, the current soft limit, and no limit,
1694 respectively. If limit is omitted, the current value of the
1695 soft limit of the resource is printed, unless the -H option is
1696 given. When more than one resource is specified, the limit name
1697 and unit are printed before the value. Other options are inter‐
1698 preted as follows:
1699 -a All current limits are reported
1700 -b The maximum socket buffer size
1701 -c The maximum size of core files created
1702 -d The maximum size of a process's data segment
1703 -e The maximum scheduling priority ("nice")
1704 -f The maximum size of files written by the shell and its
1705 children
1706 -i The maximum number of pending signals
1707 -k The maximum number of kqueues that may be allocated
1708 -l The maximum size that may be locked into memory
1709 -m The maximum resident set size (many systems do not honor
1710 this limit)
1711 -n The maximum number of open file descriptors (most systems
1712 do not allow this value to be set)
1713 -p The pipe size in 512-byte blocks (this may not be set)
1714 -q The maximum number of bytes in POSIX message queues
1715 -r The maximum real-time scheduling priority
1716 -s The maximum stack size
1717 -t The maximum amount of cpu time in seconds
1718 -u The maximum number of processes available to a single
1719 user
1720 -v The maximum amount of virtual memory available to the
1721 shell and, on some systems, to its children
1722 -x The maximum number of file locks
1723 -P The maximum number of pseudoterminals
1724 -T The maximum number of threads
1725
1726 If limit is given, and the -a option is not used, limit is the
1727 new value of the specified resource. If no option is given,
1728 then -f is assumed. Values are in 1024-byte increments, except
1729 for -t, which is in seconds; -p, which is in units of 512-byte
1730 blocks; -P, -T, -b, -k, -n, and -u, which are unscaled values;
1731 and, when in Posix mode, -c and -f, which are in 512-byte incre‐
1732 ments. The return status is 0 unless an invalid option or argu‐
1733 ment is supplied, or an error occurs while setting a new limit.
1734 In POSIX Mode 512-byte blocks are used for the `-c' and `-f'
1735 options.
1736
1737 umask [-p] [-S] [mode]
1738 The user file-creation mask is set to mode. If mode begins with
1739 a digit, it is interpreted as an octal number; otherwise it is
1740 interpreted as a symbolic mode mask similar to that accepted by
1741 chmod(1). If mode is omitted, the current value of the mask is
1742 printed. The -S option causes the mask to be printed in sym‐
1743 bolic form; the default output is an octal number. If the -p
1744 option is supplied, and mode is omitted, the output is in a form
1745 that may be reused as input. The return status is 0 if the mode
1746 was successfully changed or if no mode argument was supplied,
1747 and false otherwise.
1748
1749 unalias [-a] [name ...]
1750 Remove each name from the list of defined aliases. If -a is
1751 supplied, all alias definitions are removed. The return value
1752 is true unless a supplied name is not a defined alias.
1753
1754 unset [-fv] [-n] [name ...]
1755 For each name, remove the corresponding variable or function.
1756 If the -v option is given, each name refers to a shell variable,
1757 and that variable is removed. Read-only variables may not be
1758 unset. If -f is specified, each name refers to a shell func‐
1759 tion, and the function definition is removed. If the -n option
1760 is supplied, and name is a variable with the nameref attribute,
1761 name will be unset rather than the variable it references. -n
1762 has no effect if the -f option is supplied. If no options are
1763 supplied, each name refers to a variable; if there is no vari‐
1764 able by that name, any function with that name is unset. Each
1765 unset variable or function is removed from the environment
1766 passed to subsequent commands. If any of COMP_WORDBREAKS, RAN‐
1767 DOM, SECONDS, LINENO, HISTCMD, FUNCNAME, GROUPS, or DIRSTACK are
1768 unset, they lose their special properties, even if they are sub‐
1769 sequently reset. The exit status is true unless a name is read‐
1770 only.
1771
1772 wait [-n] [n ...]
1773 Wait for each specified child process and return its termination
1774 status. Each n may be a process ID or a job specification; if a
1775 job spec is given, all processes in that job's pipeline are
1776 waited for. If n is not given, all currently active child pro‐
1777 cesses are waited for, and the return status is zero. If the -n
1778 option is supplied, wait waits for any job to terminate and
1779 returns its exit status. If n specifies a non-existent process
1780 or job, the return status is 127. Otherwise, the return status
1781 is the exit status of the last process or job waited for.
1782
1784 bash(1), sh(1)
1785
1786
1787
1788GNU Bash-4.2 2004 Apr 20 BASH_BUILTINS(1)