]> git.ipfire.org Git - thirdparty/bash.git/blame - doc/INTRO
fix for SIGINT in sourced script
[thirdparty/bash.git] / doc / INTRO
CommitLineData
ccc6cda3
JA
1 BASH - The Bourne-Again Shell
2
3Bash is the shell, or command language interpreter, that will appear
4in the GNU operating system. Bash is an sh-compatible shell that
5incorporates useful features from the Korn shell (ksh) and C shell
6(csh). It is intended to conform to the IEEE POSIX P1003.2/ISO 9945.2
7Shell and Tools standard. It offers functional improvements over sh
8for both programming and interactive use. In addition, most sh scripts
9can be run by Bash without modification.
10
11Bash is quite portable. It uses a configuration system that discovers
12characteristics of the compilation platform at build time, and may
13therefore be built on nearly every version of UNIX. Ports to
14UNIX-like systems such as QNX and Minix and to non-UNIX systems such
15as OS/2, Windows 95, and Windows NT are available.
16
17Bash includes the following features:
18
19Editing and Completion
20
21Bash offers a command-line editing facility which permits users to
22edit command lines using familiar emacs or vi-style editing commands.
23Editing allows corrections to be made without having to erase back
24to the point of error or start the command line anew. The editing
25facilities include a feature that allows users to complete command and
26file names.
27
28The Bash line editing library is fully customizable. Users may define
29their own key bindings -- the action taken when a key is pressed. A
30number of variables to fine-tune editing behavior are also available.
31
32History and Command Re-entry
33
34The Bash history feature remembers commands entered to the shell and
35allows them to be recalled and re-executed. The history list may be
36of unlimited size. Bash allows users to search for previous commands
37and reuse portions of those commands when composing new ones. The
38history list may be saved across shell sessions.
39
40Bash allows users to control which commands are saved on the history
41list.
42
43Job Control
44
45On systems that support it, Bash provides an interface to the
46operating system's job control facilities, which allow processes
47to be suspended and restarted, and moved between the foreground
48and background. Bash allows users to selectively `forget' about
49background jobs.
50
51Shell Functions and Aliases
52
53These mechanisms are available to bind a user-selected identifier to a
54list of commands that will be executed when the identifier is used as
55a command name. Functions allow local variables and recursion, and
56have access to the environment of the calling shell. Aliases may be
57used to create a mnemonic for a command name, expand a single word to
58a complex command, or ensure that a command is called with a basic set
59of options.
60
61Arrays
62
63Bash-2.0 supports indexed arrays of unlimited size. The subscript for
64an array is an arithmetic expression. Arrays may be assigned to with
65a new compound assignment syntax, and several builtins have options to
66operate on array variables. Bash includes a number of built-in array
67variables.
68
69Arithmetic
70
71Bash allows users to perform integer arithmetic in any base from two
72to sixty-four. Nearly all of the C language arithmetic operators are
73available with the same syntax and precedence as in C. Arithmetic
74expansion allows an arithmetic expression to be evaluated and the
75result substituted into the command line. Shell variables can be used
76as operands, and the value of an expression may be assigned to a
77variable.
78
79An arithmetic expression may be used as a command; the exit status of
80the command is the value of the expression.
81
82ANSI-C Quoting
83
84There is a new quoting syntax that allows backslash-escaped characters
85in strings to be expanded according to the ANSI C standard.
86
87Tilde Expansion
88
89Users' home directories may be expanded using this feature. Words
90beginning with a tilde may also be expanded to the current or previous
91working directory.
92
93Brace Expansion
94
95Brace expansion is a convenient way to generate a list of strings that
96share a common prefix or suffix.
97
98Substring Capabilities
99
100Bash allows new strings to be created by removing leading or trailing
101substrings from existing variable values, or by specifying a starting
102offset and length. Portions of variable values may be matched against
103shell patterns and the matching portion removed or a new value
104substituted.
105
106Indirect Variable Expansion
107
108Bash makes it easy to find the value of a shell variable whose name is
109the value of another variable.
110
111Expanded I/O Capabilities
112
113Bash provides several input and output features not available in sh,
114including the ability to:
115
116 o specify a file or file descriptor for both input and output
117 o read from or write to asynchronous processes using named pipes
118 o read lines ending in backslash
119 o display a prompt on the terminal before a read
120 o format menus and interpret responses to them
121 o echo lines exactly as input without escape processing
122
123Control of Builtin Commands
124
125Bash implements several builtin commands to give users more control
126over which commands are executed. The enable builtin allows other
127builtin commands to be selectively enabled or disabled. The command
128and builtin builtins change the order in which the shell searches for
129commands.
130
131On systems that provide dynamic loading, new builtins may be loaded
132into a running shell from a shared object file. These new builtins
133have access to all of the shell facilities.
134
135Help
136
b72432fd 137Bash includes a built-in help facility.
ccc6cda3
JA
138
139Shell Optional Behavior
140
141There is a great deal of customizable shell behavior. The shopt
142builtin command provides a unified interface that allows users to
143alter shell defaults.
144
145Prompt Customization
146
147Bash allows the primary and secondary prompts to be customized by
148interpreting a number of backslash-escaped special characters.
149Parameter and variable expansion is also performed on the values of
150the primary and secondary prompt strings before they are displayed.
151
152Security
153
154Bash provides a restricted shell environment. It is also possible to
155control the execution of setuid/setgid scripts.
156
157Directory Stack
158
159Bash provides a `directory stack', to which directories may be added
160and removed. The current directory may be changed to any directory in
161the stack. It is easy to toggle between two directories in the stack.
162The directory stack may be saved and restored across different shell
163invocations.
164
165POSIX Mode
166
167Bash is nearly completely conformant to POSIX.2. POSIX mode changes
168those few areas where the Bash default behavior differs from the
169standard to match the standard. In POSIX mode, Bash is POSIX.2
170compliant.
171
172Internationalization
173
174Bash provides a new quoting syntax that allows strings to be
175translated according to the current locale. The locale in which the
176shell itself runs may also be changed, so that the shell messages
177themselves may be language-specific.
178
179The command-line editing facilities allow the input of eight-bit
180characters, so most of the ISO-8859 family of character sets are
181supported.
182
183Command Timing
184
185Bash allows external commands, shell builtin commands and shell functions
186to be timed. The format used to display the timing information may be
187changed by the user.