This chapter describes how to use the gnu History Library interactively, from a user's standpoint. It should be considered a user's guide. For information on using the gnu History Library in other programs, see the gnu Readline Library Manual.
When the -o history option to the set builtin
is enabled (see The Set Builtin),
the shell provides access to the command history,
the list of commands previously typed.
The value of the HISTSIZE shell variable is used as the
number of commands to save in a history list.
The text of the last $HISTSIZE
commands (default 500) is saved.
The shell stores each command in the history list prior to
parameter and variable expansion
but after history expansion is performed, subject to the
values of the shell variables
HISTIGNORE and HISTCONTROL.
When the shell starts up, the history is initialized from the
file named by the HISTFILE variable (default ~/.bash_history).
The file named by the value of HISTFILE is truncated, if
necessary, to contain no more than the number of lines specified by
the value of the HISTFILESIZE variable.
When an interactive shell exits, the last
$HISTSIZE lines are copied from the history list to the file
named by $HISTFILE.
If the histappend shell option is set (see Bash Builtins),
the lines are appended to the history file,
otherwise the history file is overwritten.
If HISTFILE
is unset, or if the history file is unwritable, the history is
not saved. After saving the history, the history file is truncated
to contain no more than $HISTFILESIZE
lines. If HISTFILESIZE is not set, no truncation is performed.
If the HISTTIMEFORMAT is set, the time stamp information associated with each history entry is written to the history file.
The builtin command fc may be used to list or edit and re-execute
a portion of the history list.
The history builtin may be used to display or modify the history
list and manipulate the history file.
When using command-line editing, search commands
are available in each editing mode that provide access to the
history list (see Commands For History).
The shell allows control over which commands are saved on the history
list. The HISTCONTROL and HISTIGNORE
variables may be set to cause the shell to save only a subset of the
commands entered.
The cmdhist
shell option, if enabled, causes the shell to attempt to save each
line of a multi-line command in the same history entry, adding
semicolons where necessary to preserve syntactic correctness.
The lithist
shell option causes the shell to save the command with embedded newlines
instead of semicolons.
The shopt builtin is used to set these options.
See Bash Builtins, for a description of shopt.
Fix Command. In the first form, a range of commands from first to
last is selected from the history list. Both first and
last may be specified as a string (to locate the most recent
command beginning with that string) or as a number (an index into the
history list, where a negative number is used as an offset from the
current command number). If last is not specified it is set to
first. If first is not specified it is set to the previous
command for editing and −16 for listing. If the -l flag is
given, the commands are listed on standard output. The -n flag
suppresses the command numbers when listing. The -r flag
reverses the order of the listing. Otherwise, the editor given by
ename is invoked on a file containing those commands. If
ename is not given, the value of the following variable expansion
is used: In the second form, command is re-executed after each instance
of pat in the selected command is replaced by rep.
A useful alias to use with the With no options, display the history list with line numbers.
Lines prefixed with a ‘*’ have been modified.
An argument of n lists only the last n lines.
If the shell variable HISTTIMEFORMAT is set and not null,
it is used as a format string for strftime to display
the time stamp associated with each displayed history entry.
No intervening blank is printed between the formatted time stamp
and the history line.
Options, if supplied, have the following meanings:
When any of the -w, -r, -a, or -n options is
used, if filename
is given, then it is used as the history file. If not, then
the value of the HISTFILE variable is used.
The History library provides a history expansion feature that is similar
to the history expansion provided by History expansions introduce words from the history list into
the input stream, making it easy to repeat commands, insert the
arguments to a previous command into the current input line, or
fix errors in previous commands quickly.
History expansion takes place in two parts. The first is to determine
which line from the history list should be used during substitution.
The second is to select portions of that line for inclusion into the
current one. The line selected from the history is called the
event, and the portions of that line that are acted upon are
called words. Various modifiers are available to manipulate
the selected words. The line is broken into words in the same fashion
that Bash does, so that several words
surrounded by quotes are considered one word.
History expansions are introduced by the appearance of the
history expansion character, which is ‘!’ by default.
Only ‘\’ and ‘'’ may be used to escape the history expansion
character.
Several shell options settable with the The shell allows control of the various characters used by the
history expansion mechanism with the
An event designator is a reference to a command line entry in the
history list.
Word designators are used to select desired words from the event.
A ‘:’ separates the event specification from the word designator. It
may be omitted if the word designator begins with a ‘^’, ‘$’,
‘*’, ‘-’, or ‘%’. Words are numbered from the beginning
of the line, with the first word being denoted by 0 (zero). Words are
inserted into the current line separated by single spaces.
For example,
Here are the word designators:
If a word designator is supplied without an event specification, the
previous command is used as the event.
After the optional word designator, you can add a sequence of one or more
of the following modifiers, each preceded by a ‘:’.
This chapter provides basic instructions for installing Bash on
the various supported platforms. The distribution supports the
gnu operating systems, nearly every version of Unix, and several
non-Unix systems such as BeOS and Interix.
Other independent ports exist for
ms-dos, os/2, and Windows platforms.
These are installation instructions for Bash.
The simplest way to compile Bash is:
Running The To find out more about the options and arguments that the
at the Bash prompt in your Bash source directory.
If you need to do unusual things to compile Bash, please
try to figure out how The file configure.in is used to create You can remove the program binaries and object files from the
source code directory by typing ‘make clean’. To also remove the
files that Some systems require unusual options for compilation or linking
that the On systems that have the The configuration process uses GCC to build Bash if it
is available.
You can compile Bash for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of If you have to use a Alternatively, if your system supports symbolic links, you can use the
support/mkclone script to create a build tree which has
symbolic links back to each file in the source directory. Here's an
example that creates a build directory in the current directory from a
source directory /usr/gnu/src/bash-2.0:
The By default, ‘make install’ will install into
/usr/local/bin, /usr/local/man, etc. You can
specify an installation prefix other than /usr/local by
giving You can specify separate installation prefixes for
architecture-specific files and architecture-independent files.
If you give There may be some features See the file support/config.sub for the possible
values of each field.
If you want to set default values for The Bash Here is a complete list of the --enable- and
--with- options that the Bash There are several --enable- options that alter how Bash is
compiled and linked, rather than changing run-time features.
The ‘minimal-config’ option can be used to disable all of
the following options, but it is processed first, so individual
options may be enabled using ‘enable-feature’.
All of the following options except for ‘disabled-builtins’ and
‘xpg-echo-default’ are
enabled by default, unless the operating system does not provide the
necessary support.
The file config-top.h contains C Preprocessor
‘#define’ statements for options which are not settable from
Please report all bugs you find in Bash.
But first, you should
make sure that it really is a bug, and that it appears in the latest
version of Bash.
The latest version of Bash is always available for FTP from
ftp://ftp.gnu.org/pub/bash/.
Once you have determined that a bug actually exists, use the
All bug reports should include:
Please send all reports concerning this manual to
chet@po.CWRU.Edu.
Bash implements essentially the same grammar, parameter and
variable expansion, redirection, and quoting as the Bourne Shell.
Bash uses the posix standard as the specification of
how these features are to be implemented. There are some
differences between the traditional Bourne shell and Bash; this
section quickly details the differences of significance. A
number of these differences are explained in greater depth in
previous sections.
This section uses the version of The The More features unique to Bash may be found in Bash Features.
Since Bash is a completely new implementation, it does not suffer from
many of the limitations of the SVR4.2 shell. For instance:
The purpose of this License is to make a manual, textbook, or other
functional and useful document free in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
This License is a kind of “copyleft”, which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The “Document”, below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as “you”. You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
A “Modified Version” of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A “Secondary Section” is a named appendix or a front-matter section
of the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall
subject (or to related matters) and contains nothing that could fall
directly within that overall subject. (Thus, if the Document is in
part a textbook of mathematics, a Secondary Section may not explain
any mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The “Invariant Sections” are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
The “Cover Texts” are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
A “Transparent” copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not “Transparent” is called “Opaque”.
Examples of suitable formats for Transparent copies include plain
ascii without markup, Texinfo input format, LaTeX input
format, SGML or XML using a publicly available
DTD, and standard-conforming simple HTML,
PostScript or PDF designed for human modification. Examples
of transparent image formats include PNG, XCF and
JPG. Opaque formats include proprietary formats that can be
read and edited only by proprietary word processors, SGML or
XML for which the DTD and/or processing tools are
not generally available, and the machine-generated HTML,
PostScript or PDF produced by some word processors for
output purposes only.
The “Title Page” means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, “Title Page” means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
A section “Entitled XYZ” means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as “Acknowledgements”,
“Dedications”, “Endorsements”, or “History”.) To “Preserve the Title”
of such a section when you modify the Document means that it remains a
section “Entitled XYZ” according to this definition.
The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section Entitled “Endorsements”, provided it contains
nothing but endorsements of your Modified Version by various
parties—for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled “History”
in the various original documents, forming one section Entitled
“History”; likewise combine any sections Entitled “Acknowledgements”,
and any sections Entitled “Dedications”. You must delete all
sections Entitled “Endorsements.”
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an “aggregate” if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
When the Document is included an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document's Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
If a section in the Document is Entitled “Acknowledgements”,
“Dedications”, or “History”, the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
You may not copy, modify, sublicense, or distribute the Document except
as expressly provided for under this License. Any other attempt to
copy, modify, sublicense or distribute the Document is void, and will
automatically terminate your rights under this License. However,
parties who have received copies, or rights, from you under this
License will not have their licenses terminated so long as such
parties remain in full compliance.
The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License “or any later version” applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation.
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the “with...Texts.” line with this:
If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.
fc
fc [-e ename] [-nlr] [first] [last]
fc -s [pat=rep] [command]
${FCEDIT:-${EDITOR:-vi}}. This says to use the
value of the FCEDIT variable if set, or the value of the
EDITOR variable if that is set, or vi if neither is set.
When editing is complete, the edited commands are echoed and executed.
fc command is r='fc -s', so
that typing ‘r cc’ runs the last command beginning with cc
and typing ‘r’ re-executes the last command (see Aliases).
history history [n]
history -c
history -d offset
history [-anrw] [filename]
history -ps arg
-c-d offset-a-n-r-w-p-s9.3 History Expansion
csh. This section
describes the syntax used to manipulate the history information.
shopt
builtin (see Bash Builtins) may be used to tailor
the behavior of history expansion. If the
histverify shell option is enabled, and Readline
is being used, history substitutions are not immediately passed to
the shell parser.
Instead, the expanded line is reloaded into the Readline
editing buffer for further modification.
If Readline is being used, and the histreedit
shell option is enabled, a failed history expansion will be
reloaded into the Readline editing buffer for correction.
The -p option to the history builtin command
may be used to see what a history expansion will do before using it.
The -s option to the history builtin may be used to
add commands to the end of the history list without actually executing
them, so that they are available for subsequent recall.
This is most useful in conjunction with Readline.
histchars variable.
9.3.1 Event Designators
!extglob shell option is enabled using the shopt builtin).
!n!-n!!!string!?string[?]^string1^string2^!!:s/string1/string2/.
!#9.3.2 Word Designators
!!!!:$!$.
!fi:2fi.
0 (zero)0th word. For many applications, this is the command word.
^$%-y*0th. This is a synonym for ‘1-$’.
It is not an error to use ‘*’ if there is just one word in the event;
the empty string is returned in that case.
*-9.3.3 Modifiers
htrepqxs/old/new/&gags/old/new/,
or with ‘&’.
G10 Installing Bash
10.1 Basic Installation
cd to the directory containing the source code and type
‘./configure’ to configure Bash for your system. If you're
using csh on an old version of System V, you might need to
type ‘sh ./configure’ instead to prevent csh from trying
to execute configure itself.
configure takes some time.
While running, it prints messages telling which features it is
checking for.
bashbug bug
reporting script.
bash and bashbug.
This will also install the manual pages and Info file.
configure shell script attempts to guess correct
values for various system-dependent variables used during
compilation. It uses those values to create a Makefile in
each directory of the package (the top directory, the
builtins, doc, and support directories,
each directory under lib, and several others). It also creates a
config.h file containing system-dependent definitions.
Finally, it creates a shell script named config.status that you
can run in the future to recreate the current configuration, a
file config.cache that saves the results of its tests to
speed up reconfiguring, and a file config.log containing
compiler output (useful mainly for debugging configure).
If at some point
config.cache contains results you don't want to keep, you
may remove or edit it.
configure script understands, type
bash-2.04$ ./configure --help
configure could check whether or not
to do them, and mail diffs or instructions to
bash-maintainers@gnu.org so they can be
considered for the next release.
configure
by a program called Autoconf. You only need
configure.in if you want to change it or regenerate
configure using a newer version of Autoconf. If
you do this, make sure you are using Autoconf version 2.50 or
newer.
configure created (so you can compile Bash for
a different kind of computer), type ‘make distclean’.
10.2 Compilers and Options
configure script does not know about. You can
give configure initial values for variables by setting
them in the environment. Using a Bourne-compatible shell, you
can do that on the command line like this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
env program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
10.3 Compiling For Multiple Architectures
make that
supports the VPATH variable, such as GNU make.
cd to the
directory where you want the object files and executables to go and run
the configure script from the source directory. You may need to
supply the --srcdir=PATH argument to tell configure where the
source files are. configure automatically checks for the
source code in the directory that configure is in and in `..'.
make that does not supports the VPATH
variable, you can compile Bash for one architecture at a
time in the source code directory. After you have installed
Bash for one architecture, use ‘make distclean’ before
reconfiguring for another architecture.
bash /usr/gnu/src/bash-2.0/support/mkclone -s /usr/gnu/src/bash-2.0 .
mkclone script requires Bash, so you must have already built
Bash for at least one architecture before you can create build
directories for other architectures.
Next: Specifying the System Type,
Previous: Compiling For Multiple Architectures,
Up: Installing Bash
10.4 Installation Names
configure the option --prefix=PATH,
or by specifying a value for the DESTDIR ‘make’
variable when running ‘make install’.
configure the option
--exec-prefix=PATH, ‘make install’ will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
10.5 Specifying the System Type
configure can not figure out
automatically, but need to determine by the type of host Bash
will run on. Usually configure can figure that
out, but if it prints a message saying it can not guess the host
type, give it the --host=TYPE option. ‘TYPE’ can
either be a short name for the system type, such as ‘sun4’,
or a canonical name with three fields: ‘CPU-COMPANY-SYSTEM’
(e.g., ‘i386-unknown-freebsd4.2’).
10.6 Sharing Defaults
configure scripts to
share, you can create a site shell script called
config.site that gives default values for variables like
CC, cache_file, and prefix. configure
looks for PREFIX/share/config.site if it exists, then
PREFIX/etc/config.site if it exists. Or, you can set the
CONFIG_SITE environment variable to the location of the site
script. A warning: the Bash configure looks for a site script,
but not all configure scripts do.
10.7 Operation Controls
configure recognizes the following options to control how it
operates.
--cache-file=fileconfigure.
--helpconfigure, and exit.
--quiet--silent-q--srcdir=dirconfigure can determine that directory automatically.
--versionconfigure
script, and exit.
configure also accepts some other, not widely used, boilerplate
options. ‘configure --help’ prints the complete list.
10.8 Optional Features
configure has a number of --enable-feature
options, where feature indicates an optional part of Bash.
There are also several --with-package options,
where package is something like ‘bash-malloc’ or ‘purify’.
To turn off the default use of a package, use
--without-package. To configure Bash without a feature
that is enabled by default, use --disable-feature.
configure recognizes.
--with-afs--with-bash-mallocmalloc in the directory lib/malloc. This is not the same
malloc that appears in gnu libc, but an older version
originally derived from the 4.2 bsd malloc. This malloc
is very fast, but wastes some space on each allocation.
This option is enabled by default.
The NOTES file contains a list of systems for
which this should be turned off, and configure disables this
option automatically for a number of systems.
--with-curses--with-gnu-malloc--with-bash-malloc.
--with-installed-readline[=PREFIX]yes or not
supplied, configure uses the values of the make variables
includedir and libdir, which are subdirectories of prefix
by default, to find the installed version of Readline if it is not in
the standard system include and library directories.
If PREFIX is no, Bash links with the version in
lib/readline.
If PREFIX is set to any other value, configure treats it as
a directory pathname and looks for
the installed version of Readline in subdirectories of that directory
(include files in PREFIX/include and the library in
PREFIX/lib).
--with-purify--enable-minimal-config
--enable-largefile--enable-profilinggprof each time it is executed.
--enable-static-linkgcc is being used.
This could be used to build a version to use as root's shell.
--enable-aliasalias and unalias
builtins (see Aliases).
--enable-arith-for-commandfor command
that behaves like the C language for statement
(see Looping Constructs).
--enable-array-variables--enable-bang-historycsh-like history substitution
(see History Interaction).
--enable-brace-expansioncsh-like brace expansion
( b{a,b}c ==> bac bbc ).
See Brace Expansion, for a complete description.
--enable-command-timingtime as a reserved word and for
displaying timing statistics for the pipeline following time
(see Pipelines).
This allows pipelines as well as shell builtins and functions to be timed.
--enable-cond-command[[ conditional command.
(see Conditional Constructs).
--enable-cond-regexp[[ conditional command.
(see Conditional Constructs).
--enable-debugger--enable-directory-stackcsh-like directory stack and the
pushd, popd, and dirs builtins
(see The Directory Stack).
--enable-disabled-builtinsxxx has been disabled using ‘enable -n xxx’.
See Bash Builtins, for details of the builtin and
enable builtin commands.
--enable-dparen-arithmetic((...)) command
(see Conditional Constructs).
--enable-extended-glob--enable-help-builtinhelp builtin, which displays help on shell builtins and
variables (see Bash Builtins).
--enable-historyfc and history
builtin commands (see Bash History Facilities).
--enable-job-control--enable-multibyte--enable-net-redirections/dev/tcp/host/port and
/dev/udp/host/port
when used in redirections (see Redirections).
--enable-process-substitution--enable-progcomp--enable-prompt-string-decoding--enable-readline--enable-restrictedrbash, enters a restricted mode. See
The Restricted Shell, for a description of restricted mode.
--enable-selectselect builtin, which allows the generation of simple
menus (see Conditional Constructs).
--enable-separate-helpfileshelp builtin
instead of storing the text internally.
--enable-single-help-stringshelp builtin as a single string for
each help topic. This aids in translating the text to different languages.
You may need to disable this if your compiler cannot handle very long string
literals.
--enable-strict-posix-default--enable-usg-echo-default--enable-xpg-echo-default.
--enable-xpg-echo-defaultecho builtin expand backslash-escaped characters by default,
without requiring the -e option.
This sets the default value of the xpg_echo shell option to on,
which makes the Bash echo behave more like the version specified in
the Single Unix Specification, version 3.
See Bash Builtins, for a description of the escape sequences that
echo recognizes.
configure.
Some of these are not meant to be changed; beware of the consequences if
you do.
Read the comments associated with each definition for more
information about its effect.
Appendix A Reporting Bugs
bashbug command to submit a bug report.
If you have a fix, you are encouraged to mail that as well!
Suggestions and `philosophical' bug reports may be mailed
to bug-bash@gnu.org or posted to the Usenet
newsgroup gnu.bash.bug.
bashbug inserts the first three items automatically into
the template it provides for filing a bug report.
Appendix B Major Differences From The Bourne Shell
sh included in SVR4.2 (the
last version of the historical Bourne shell) as the baseline reference.
sh behavior (see Bash POSIX Mode).
bind builtin.
complete and compgen, to manipulate it.
history and fc builtins to manipulate it.
The Bash history list maintains timestamp information and uses the
value of the HISTTIMEFORMAT variable to display it.
csh-like history expansion
(see History Interaction).
$'...' quoting syntax, which expands ANSI-C
backslash-escaped characters in the text between the single quotes,
is supported (see ANSI-C Quoting).
$"..." quoting syntax to do
locale-specific translation of the characters between the double
quotes. The -D, --dump-strings, and --dump-po-strings
invocation options list the translatable strings found in a script
(see Locale Translation).
! keyword to negate the return value of
a pipeline (see Pipelines).
Very useful when an if statement needs to act only if a test fails.
The Bash ‘-o pipefail’ option to set will cause a pipeline to
return a failure status if any command fails.
time reserved word and command timing (see Pipelines).
The display of the timing statistics may be controlled with the
TIMEFORMAT variable.
for (( expr1 ; expr2 ; expr3 ))
arithmetic for command, similar to the C language (see Looping Constructs).
select compound command, which allows the
generation of simple menus (see Conditional Constructs).
[[ compound command, which makes conditional
testing part of the shell grammar (see Conditional Constructs), including
optional regular expression matching.
case and
[[ constructs.
alias and unalias
builtins (see Aliases).
(( compound command
(see Conditional Constructs),
and arithmetic expansion (see Shell Arithmetic).
export
command.
${#xx}, which returns the length of ${xx},
is supported (see Shell Parameter Expansion).
${var:offset[:length]},
which expands to the substring of var's value of length
length, beginning at offset, is present
(see Shell Parameter Expansion).
${var/[/]pattern[/replacement]},
which matches pattern and replaces it with replacement in
the value of var, is available (see Shell Parameter Expansion).
${!prefix}* expansion, which expands to
the names of all shell variables whose names begin with prefix,
is available (see Shell Parameter Expansion).
${!word}
(see Shell Parameter Expansion).
$9 using
${num}.
$() form of command substitution
is implemented (see Command Substitution),
and preferred to the Bourne shell's `` (which
is also implemented for backwards compatibility).
extglob
shell option is enabled (see Pattern Matching).
sh does not separate the two name spaces.
local builtin, and thus useful recursive functions may be written
(see Bash Builtins).
sh, all variable assignments
preceding commands are global unless the command is executed from the
file system.
noclobber option is available to avoid overwriting existing
files with output redirection (see The Set Builtin).
The ‘>|’ redirection operator may be used to override noclobber.
cd and pwd builtins (see Bourne Shell Builtins)
each take -L and -P options to switch between logical and
physical modes.
builtin and command builtins (see Bash Builtins).
command builtin allows selective disabling of functions
when command lookup is performed (see Bash Builtins).
enable
builtin (see Bash Builtins).
exec builtin takes additional options that allow users
to control the contents of the environment passed to the executed
command, and what the zeroth argument to the command is to be
(see Bourne Shell Builtins).
export -f (see Shell Functions).
export, readonly, and declare builtins can
take a -f option to act on shell functions, a -p option to
display variables with various attributes set in a format that can be
used as shell input, a -n option to remove various variable
attributes, and ‘name=value’ arguments to set variable attributes
and values simultaneously.
hash builtin allows a name to be associated with
an arbitrary filename, even when that filename cannot be found by
searching the $PATH, using ‘hash -p’
(see Bourne Shell Builtins).
help builtin for quick reference to shell
facilities (see Bash Builtins).
printf builtin is available to display formatted output
(see Bash Builtins).
read builtin (see Bash Builtins)
will read a line ending in ‘\’ with
the -r option, and will use the REPLY variable as a
default if no non-option arguments are supplied.
The Bash read builtin
also accepts a prompt string with the -p option and will use
Readline to obtain the line when given the -e option.
The read builtin also has additional options to control input:
the -s option will turn off echoing of input characters as
they are read, the -t option will allow read to time out
if input does not arrive within a specified number of seconds, the
-n option will allow reading only a specified number of
characters rather than a full line, and the -d option will read
until a particular character rather than newline.
return builtin may be used to abort execution of scripts
executed with the . or source builtins
(see Bourne Shell Builtins).
shopt builtin, for finer control of shell
optional capabilities (see Bash Builtins), and allows these options
to be set and unset at shell invocation (see Invoking Bash).
set
builtin (see The Set Builtin).
xtrace) option displays commands other than
simple commands when performing an execution trace
(see The Set Builtin).
test builtin (see Bourne Shell Builtins)
is slightly different, as it implements the posix algorithm,
which specifies the behavior based on the number of arguments.
caller builtin, which displays the context of
any active subroutine call (a shell function or a script executed with
the . or source builtins). This supports the bash
debugger.
trap builtin (see Bourne Shell Builtins) allows a
DEBUG pseudo-signal specification, similar to EXIT.
Commands specified with a DEBUG trap are executed before every
simple command, for command, case command,
select command, every arithmetic for command, and before
the first command executes in a shell function.
The DEBUG trap is not inherited by shell functions unless the
function has been given the trace attribute or the
functrace option has been enabled using the shopt builtin.
The extdebug shell option has additional effects on the
DEBUG trap.
trap builtin (see Bourne Shell Builtins) allows an
ERR pseudo-signal specification, similar to EXIT and DEBUG.
Commands specified with an ERR trap are executed after a simple
command fails, with a few exceptions.
The ERR trap is not inherited by shell functions unless the
-o errtrace option to the set builtin is enabled.
trap builtin (see Bourne Shell Builtins) allows a
RETURN pseudo-signal specification, similar to
EXIT and DEBUG.
Commands specified with an RETURN trap are executed before
execution resumes after a shell function or a shell script executed with
. or source returns.
The RETURN trap is not inherited by shell functions unless the
function has been given the trace attribute or the
functrace option has been enabled using the shopt builtin.
type builtin is more extensive and gives more information
about the names it finds (see Bash Builtins).
umask builtin permits a -p option to cause
the output to be displayed in the form of a umask command
that may be reused as input (see Bourne Shell Builtins).
csh-like directory stack, and provides the
pushd, popd, and dirs builtins to manipulate it
(see The Directory Stack).
Bash also makes the directory stack visible as the value of the
DIRSTACK shell variable.
disown builtin can remove a job from the internal shell
job table (see Job Control Builtins) or suppress the sending
of SIGHUP to a job when the shell exits as the result of a
SIGHUP.
mldmode and priv) not present in Bash.
stop or newgrp builtins.
sh uses a TIMEOUT variable like Bash uses
TMOUT.
B.1 Implementation Differences From The SVR4.2 Shell
if or while
statement.
EOF under certain circumstances.
This can be the cause of some hard-to-find errors.
SIGSEGV. If the shell is started from a process with
SIGSEGV blocked (e.g., by using the system() C library
function call), it misbehaves badly.
SIGSEGV,
SIGALRM, or SIGCHLD.
-x -v);
the SVR4.2 shell allows only one option argument (-xv). In
fact, some versions of the shell dump core if the second argument begins
with a ‘-’.
jsh
(it turns on job control).
Appendix C Copying This Manual
C.1 GNU Free Documentation License
Copyright © 2000,2001,2002 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
C.1.1 ADDENDUM: How to use this License for your documents
Copyright (C) year your name.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled ``GNU
Free Documentation License''.
with the Invariant Sections being list their titles, with
the Front-Cover Texts being list, and with the Back-Cover Texts
being list.
Index of Shell Builtin Commands
.: Bourne Shell Builtins:: Bourne Shell Builtins[: Bourne Shell Builtinsalias: Bash Builtinsbg: Job Control Builtinsbind: Bash Builtinsbreak: Bourne Shell Builtinsbuiltin: Bash Builtinscaller: Bash Builtinscd: Bourne Shell Builtinscommand: Bash Builtinscompgen: Programmable Completion Builtinscomplete: Programmable Completion Builtinscontinue: Bourne Shell Builtinsdeclare: Bash Builtinsdirs: Directory Stack Builtinsdisown: Job Control Builtinsecho: Bash Builtinsenable: Bash Builtinseval: Bourne Shell Builtinsexec: Bourne Shell Builtinsexit: Bourne Shell Builtinsexport: Bourne Shell Builtinsfc: Bash History Builtinsfg: Job Control Builtinsgetopts: Bourne Shell Builtinshash: Bourne Shell Builtinshelp: Bash Builtinshistory: Bash History Builtinsjobs: Job Control Builtinskill: Job Control Builtinslet: Bash Builtinslocal: Bash Builtinslogout: Bash Builtinspopd: Directory Stack Builtinsprintf: Bash Builtinspushd: Directory Stack Builtinspwd: Bourne Shell Builtinsread: Bash Builtinsreadonly: Bourne Shell Builtinsreturn: Bourne Shell Builtinsset: The Set Builtinshift: Bourne Shell Builtinsshopt: Bash Builtinssource: Bash Builtinssuspend: Job Control Builtinstest: Bourne Shell Builtinstimes: Bourne Shell Builtinstrap: Bourne Shell Builtinstype: Bash Builtinstypeset: Bash Builtinsulimit: Bash Builtinsumask: Bourne Shell Builtinsunalias: Bash Builtinsunset: Bourne Shell Builtinswait: Job Control BuiltinsIndex of Shell Reserved Words
!: Pipelines[[: Conditional Constructs]]: Conditional Constructscase: Conditional Constructsdo: Looping Constructsdone: Looping Constructselif: Conditional Constructselse: Conditional Constructsesac: Conditional Constructsfi: Conditional Constructsfor: Looping Constructsfunction: Shell Functionsif: Conditional Constructsin: Conditional Constructsselect: Conditional Constructsthen: Conditional Constructstime: Pipelinesuntil: Looping Constructswhile: Looping Constructs{: Command Grouping}: Command GroupingParameter and Variable Index
!: Special Parameters#: Special Parameters$: Special Parameters*: Special Parameters-: Special Parameters0: Special Parameters?: Special Parameters@: Special Parameters_: Special Parametersauto_resume: Job Control VariablesBASH: Bash VariablesBASH_ARGC: Bash VariablesBASH_ARGV: Bash VariablesBASH_COMMAND: Bash VariablesBASH_ENV: Bash VariablesBASH_EXECUTION_STRING: Bash VariablesBASH_LINENO: Bash VariablesBASH_REMATCH: Bash VariablesBASH_SOURCE: Bash VariablesBASH_SUBSHELL: Bash VariablesBASH_VERSINFO: Bash VariablesBASH_VERSION: Bash Variablesbell-style: Readline Init File Syntaxbind-tty-special-chars: Readline Init File SyntaxCDPATH: Bourne Shell VariablesCOLUMNS: Bash Variablescomment-begin: Readline Init File SyntaxCOMP_CWORD: Bash VariablesCOMP_LINE: Bash VariablesCOMP_POINT: Bash VariablesCOMP_WORDBREAKS: Bash VariablesCOMP_WORDS: Bash Variablescompletion-query-items: Readline Init File SyntaxCOMPREPLY: Bash Variablesconvert-meta: Readline Init File SyntaxDIRSTACK: Bash Variablesdisable-completion: Readline Init File Syntaxediting-mode: Readline Init File SyntaxEMACS: Bash Variablesenable-keypad: Readline Init File SyntaxEUID: Bash Variablesexpand-tilde: Readline Init File SyntaxFCEDIT: Bash VariablesFIGNORE: Bash VariablesFUNCNAME: Bash VariablesGLOBIGNORE: Bash VariablesGROUPS: Bash Variableshistchars: Bash VariablesHISTCMD: Bash VariablesHISTCONTROL: Bash VariablesHISTFILE: Bash VariablesHISTFILESIZE: Bash VariablesHISTIGNORE: Bash Variableshistory-preserve-point: Readline Init File SyntaxHISTSIZE: Bash VariablesHISTTIMEFORMAT: Bash VariablesHOME: Bourne Shell Variableshorizontal-scroll-mode: Readline Init File SyntaxHOSTFILE: Bash VariablesHOSTNAME: Bash VariablesHOSTTYPE: Bash VariablesIFS: Bourne Shell VariablesIGNOREEOF: Bash Variablesinput-meta: Readline Init File SyntaxINPUTRC: Bash Variablesisearch-terminators: Readline Init File Syntaxkeymap: Readline Init File SyntaxLANG: Bash VariablesLC_ALL: Bash VariablesLC_COLLATE: Bash VariablesLC_CTYPE: Bash VariablesLC_MESSAGES: Bash VariablesLC_MESSAGES: Locale TranslationLC_NUMERIC: Bash VariablesLINENO: Bash VariablesLINES: Bash VariablesMACHTYPE: Bash VariablesMAIL: Bourne Shell VariablesMAILCHECK: Bash VariablesMAILPATH: Bourne Shell Variablesmark-modified-lines: Readline Init File Syntaxmark-symlinked-directories: Readline Init File Syntaxmatch-hidden-files: Readline Init File Syntaxmeta-flag: Readline Init File SyntaxOLDPWD: Bash VariablesOPTARG: Bourne Shell VariablesOPTERR: Bash VariablesOPTIND: Bourne Shell VariablesOSTYPE: Bash Variablesoutput-meta: Readline Init File Syntaxpage-completions: Readline Init File SyntaxPATH: Bourne Shell VariablesPIPESTATUS: Bash VariablesPOSIXLY_CORRECT: Bash VariablesPPID: Bash VariablesPROMPT_COMMAND: Bash VariablesPS1: Bourne Shell VariablesPS2: Bourne Shell VariablesPS3: Bash VariablesPS4: Bash VariablesPWD: Bash VariablesRANDOM: Bash VariablesREPLY: Bash VariablesSECONDS: Bash VariablesSHELL: Bash VariablesSHELLOPTS: Bash VariablesSHLVL: Bash Variablesshow-all-if-ambiguous: Readline Init File Syntaxshow-all-if-unmodified: Readline Init File SyntaxTEXTDOMAIN: Locale TranslationTEXTDOMAINDIR: Locale TranslationTIMEFORMAT: Bash VariablesTMOUT: Bash VariablesTMPDIR: Bash VariablesUID: Bash Variablesvisible-stats: Readline Init File SyntaxFunction Index
abort (C-g): Miscellaneous Commandsaccept-line (Newline or Return): Commands For Historybackward-char (C-b): Commands For Movingbackward-delete-char (Rubout): Commands For Textbackward-kill-line (C-x Rubout): Commands For Killingbackward-kill-word (M-<DEL>): Commands For Killingbackward-word (M-b): Commands For Movingbeginning-of-history (M-<): Commands For Historybeginning-of-line (C-a): Commands For Movingcall-last-kbd-macro (C-x e): Keyboard Macroscapitalize-word (M-c): Commands For Textcharacter-search (C-]): Miscellaneous Commandscharacter-search-backward (M-C-]): Miscellaneous Commandsclear-screen (C-l): Commands For Movingcomplete (<TAB>): Commands For Completioncopy-backward-word (): Commands For Killingcopy-forward-word (): Commands For Killingcopy-region-as-kill (): Commands For Killingdelete-char (C-d): Commands For Textdelete-char-or-list (): Commands For Completiondelete-horizontal-space (): Commands For Killingdigit-argument (M-0, M-1, ... M--): Numeric Argumentsdo-uppercase-version (M-a, M-b, M-x, ...): Miscellaneous Commandsdowncase-word (M-l): Commands For Textdump-functions (): Miscellaneous Commandsdump-macros (): Miscellaneous Commandsdump-variables (): Miscellaneous Commandsend-kbd-macro (C-x )): Keyboard Macrosend-of-history (M->): Commands For Historyend-of-line (C-e): Commands For Movingexchange-point-and-mark (C-x C-x): Miscellaneous Commandsforward-backward-delete-char (): Commands For Textforward-char (C-f): Commands For Movingforward-search-history (C-s): Commands For Historyforward-word (M-f): Commands For Movinghistory-search-backward (): Commands For Historyhistory-search-forward (): Commands For Historyinsert-comment (M-#): Miscellaneous Commandsinsert-completions (M-*): Commands For Completionkill-line (C-k): Commands For Killingkill-region (): Commands For Killingkill-whole-line (): Commands For Killingkill-word (M-d): Commands For Killingmenu-complete (): Commands For Completionnext-history (C-n): Commands For Historynon-incremental-forward-search-history (M-n): Commands For Historynon-incremental-reverse-search-history (M-p): Commands For Historyoverwrite-mode (): Commands For Textpossible-completions (M-?): Commands For Completionprefix-meta (<ESC>): Miscellaneous Commandsprevious-history (C-p): Commands For Historyquoted-insert (C-q or C-v): Commands For Textre-read-init-file (C-x C-r): Miscellaneous Commandsredraw-current-line (): Commands For Movingreverse-search-history (C-r): Commands For Historyrevert-line (M-r): Miscellaneous Commandsself-insert (a, b, A, 1, !, ...): Commands For Textset-mark (C-@): Miscellaneous Commandsstart-kbd-macro (C-x (): Keyboard Macrostranspose-chars (C-t): Commands For Texttranspose-words (M-t): Commands For Textundo (C-_ or C-x C-u): Miscellaneous Commandsuniversal-argument (): Numeric Argumentsunix-filename-rubout (): Commands For Killingunix-line-discard (C-u): Commands For Killingunix-word-rubout (C-w): Commands For Killingupcase-word (M-u): Commands For Textyank (C-y): Commands For Killingyank-last-arg (M-. or M-_): Commands For Historyyank-nth-arg (M-C-y): Commands For Historyyank-pop (M-y): Commands For KillingConcept Index