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