aboutsummaryrefslogtreecommitdiffstats
path: root/doc/bash.1
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>2001-11-13 17:56:06 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:54 +0000
commitf73dda092b33638d2d5e9c35375f687a607b5403 (patch)
treef21584e70a444d6a1ecba0fb5e2cf79e8cce91db /doc/bash.1
parent28ef6c316f1aff914bb95ac09787a3c83c1815fd (diff)
downloadandroid_external_bash-f73dda092b33638d2d5e9c35375f687a607b5403.tar.gz
android_external_bash-f73dda092b33638d2d5e9c35375f687a607b5403.tar.bz2
android_external_bash-f73dda092b33638d2d5e9c35375f687a607b5403.zip
Imported from ../bash-2.05a.tar.gz.
Diffstat (limited to 'doc/bash.1')
-rw-r--r--doc/bash.11023
1 files changed, 572 insertions, 451 deletions
diff --git a/doc/bash.1 b/doc/bash.1
index 8809816..b3e9372 100644
--- a/doc/bash.1
+++ b/doc/bash.1
@@ -6,12 +6,12 @@
.\" Case Western Reserve University
.\" chet@ins.CWRU.Edu
.\"
-.\" Last Change: Mon Mar 5 10:19:14 EST 2001
+.\" Last Change: Tue Nov 13 12:55:51 EST 2001
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
-.TH BASH 1 "2001 Mar 5" "GNU Bash-2.05"
+.TH BASH 1 "2001 November 13" "GNU Bash-2.05a"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -113,6 +113,19 @@ are subject to language translation when the current locale
is not \fBC\fP or \fBPOSIX\fP.
This implies the \fB\-n\fP option; no commands will be executed.
.TP
+.B [\-+]O [\fIshopt_option\fP]
+\fIshopt_option\fP is one of the shell options accepted by the
+\fBshopt\fP builtin (see
+.SM
+.B SHELL BUILTIN COMMANDS
+below).
+If \fIshopt_option\fP is present, \fB\-O\fP sets the value of that option;
+\fB+O\fP unsets it.
+If \fIshopt_option\fP is not supplied, the names and values of the shell
+options accepted by \fBshopt\fP are printed on the standard output.
+If the invocation option is \fB+O\fP, the output is displayed in a format
+that may be reused as input.
+.TP
.B \-\-
A
.B \-\-
@@ -226,6 +239,11 @@ reads and executes commands from this file, then exits.
\fBBash\fP's exit status is the exit status of the last command
executed in the script.
If no commands are executed, the exit status is 0.
+An attempt is first made to open the file in the current directory, and,
+if no file is found, then the shell searches the directories in
+.SM
+.B PATH
+for the script.
.SH INVOCATION
A \fIlogin shell\fP is one whose first character of argument zero is a
.BR \- ,
@@ -390,8 +408,10 @@ or allow them to be specified.
.PP
If the shell is started with the effective user (group) id not equal to the
real user (group) id, and the \fB\-p\fP option is not supplied, no startup
-files are read, shell functions are not inherited from the environment,
-the \fBSHELLOPTS\fP variable, if it appears in the environment, is ignored,
+files are read, shell functions are not inherited from the environment, the
+.SM
+.B SHELLOPTS
+variable, if it appears in the environment, is ignored,
and the effective user id is set to the real user id.
If the \fB\-p\fP option is supplied at invocation, the startup behavior is
the same, but the effective user id is not reset.
@@ -460,8 +480,8 @@ command:
A \fIsimple command\fP is a sequence of optional variable assignments
followed by \fBblank\fP-separated words and redirections, and
terminated by a \fIcontrol operator\fP. The first word
-specifies the command to be executed. The remaining words are
-passed as arguments to the invoked command.
+specifies the command to be executed, and is passed as argument zero.
+The remaining words are passed as arguments to the invoked command.
.PP
The return value of a \fIsimple command\fP is its exit status, or
128+\fIn\^\fP if the command is terminated by signal
@@ -479,7 +499,7 @@ The format for a pipeline is:
.PP
The standard output of
.I command
-is connected to the standard input of
+is connected via a pipe to the standard input of
.IR command2 .
This connection is performed before any redirections specified by the
command (see
@@ -595,6 +615,10 @@ after the command completes. The return status is the exit status of
This is known as a \fIgroup command\fP.
The return status is the exit status of
\fIlist\fP.
+Note that unlike the metacharacters \fB(\fP and \fB\)\fP, \fB{\fP and
+\fB}\fP are \fIreserved words\fP and must occur where a reserved
+word is permitted to be recognized. Since they do not cause a word
+break, they must be separated from \fIlist\fP by whitespace.
.TP
((\fIexpression\fP))
The \fIexpression\fP is evaluated according to the rules described
@@ -657,7 +681,6 @@ or
.I expression2
is true.
.PD
-.RE
.LP
The \fB&&\fP and
.if t \fB\(bv\(bv\fP
@@ -665,6 +688,7 @@ The \fB&&\fP and
operators do not execute \fIexpression2\fP if the value of
\fIexpression1\fP is sufficient to determine the return value of
the entire conditional expression.
+.RE
.TP
\fBfor\fP \fIname\fP [ \fBin\fP \fIword\fP ] ; \fBdo\fP \fIlist\fP ; \fBdone\fP
The list of words following \fBin\fP is expanded, generating a list
@@ -716,8 +740,6 @@ The
.I list
is executed after each selection until a
.B break
-or
-.B return
command is executed.
The exit status of
.B select
@@ -901,12 +923,12 @@ backslash
single quote
.TP
.B \e\fInnn\fP
-the character whose ASCII code is the octal value \fInnn\fP
+the eight-bit character whose value is the octal value \fInnn\fP
(one to three digits)
.TP
-.B \ex\fInnn\fP
-the character whose ASCII code is the hexadecimal value \fInnn\fP
-(one to three digits)
+.B \ex\fIHH\fP
+the eight-bit character whose value is the hexadecimal value \fIHH\fP
+(one or two hex digits)
.PD
.RE
.LP
@@ -931,6 +953,14 @@ For the shell's purposes, a
.I variable
is a parameter denoted by a
.IR name .
+A variable has a \fIvalue\fP and zero or more \fIattributes\fP.
+Attributes are assigned using the
+.B declare
+builtin command (see
+.B declare
+below in
+.SM
+.BR "SHELL BUILTIN COMMANDS" ).
.PP
A parameter is set if it has been assigned a value. The null string is
a valid value. Once a variable is set, it may be unset only by using
@@ -960,12 +990,7 @@ removal (see
.B EXPANSION
below). If the variable has its
.B integer
-attribute set (see
-.B declare
-below in
-.SM
-.BR "SHELL BUILTIN COMMANDS" )
-then
+attribute set, then
.I value
is subject to arithmetic expansion even if the $((...)) expansion is
not used (see
@@ -975,6 +1000,14 @@ Word splitting is not performed, with the exception
of \fB"$@"\fP as explained below under
.BR "Special Parameters" .
Pathname expansion is not performed.
+Assignment statements may also appear as arguments to the
+.BR declare ,
+.BR typeset ,
+.BR export ,
+.BR readonly ,
+and
+.B local
+builtin commands.
.SS Positional Parameters
.PP
A
@@ -1092,53 +1125,10 @@ The following variables are set by the shell:
.PP
.PD 0
.TP
-.B PPID
-The process ID of the shell's parent. This variable is readonly.
-.TP
-.B PWD
-The current working directory as set by the
-.B cd
-command.
-.TP
-.B OLDPWD
-The previous working directory as set by the
-.B cd
-command.
-.TP
-.B REPLY
-Set to the line of input read by the
-.B read
-builtin command when no arguments are supplied.
-.TP
-.B UID
-Expands to the user ID of the current user, initialized at shell startup.
-This variable is readonly.
-.TP
-.B EUID
-Expands to the effective user ID of the current user, initialized at
-shell startup. This variable is readonly.
-.TP
-.B GROUPS
-An array variable containing the list of groups of which the current
-user is a member.
-Assignments to
-.SM
-.B GROUPS
-have no effect and return an error status.
-If
-.SM
-.B GROUPS
-is unset, it loses its special properties, even if it is
-subsequently reset.
-.TP
.B BASH
Expands to the full file name used to invoke this instance of
.BR bash .
.TP
-.B BASH_VERSION
-Expands to a string describing the version of this instance of
-.BR bash .
-.TP
.B BASH_VERSINFO
A readonly array variable whose members hold version information for
this instance of
@@ -1168,48 +1158,88 @@ The value of \fBMACHTYPE\fP.
.PD
.RE
.TP
-.B SHLVL
-Incremented by one each time an instance of
-.B bash
-is started.
+.B BASH_VERSION
+Expands to a string describing the version of this instance of
+.BR bash .
.TP
-.B RANDOM
-Each time this parameter is referenced, a random integer between
-0 and 32767 is
-generated. The sequence of random numbers may be initialized by assigning
-a value to
-.SM
-.BR RANDOM .
+.B COMP_CWORD
+An index into \fB${COMP_WORDS}\fP of the word containing the current
+cursor position.
+This variable is available only in shell functions invoked by the
+programmable completion facilities (see \fBProgrammable Completion\fP
+below).
+.TP
+.B COMP_LINE
+The current command line.
+This variable is available only in shell functions and external
+commands invoked by the
+programmable completion facilities (see \fBProgrammable Completion\fP
+below).
+.TP
+.B COMP_POINT
+The index of the current cursor position relative to the beginning of
+the current command.
+If the current cursor position is at the end of the current command,
+the value of this variable is equal to \fB${#COMP_LINE}\fP.
+This variable is available only in shell functions and external
+commands invoked by the
+programmable completion facilities (see \fBProgrammable Completion\fP
+below).
+.TP
+.B COMP_WORDS
+An array variable (see \fBArrays\fP below) consisting of the individual
+words in the current command line.
+This variable is available only in shell functions invoked by the
+programmable completion facilities (see \fBProgrammable Completion\fP
+below).
+.TP
+.B DIRSTACK
+An array variable (see
+.B Arrays
+below) containing the current contents of the directory stack.
+Directories appear in the stack in the order they are displayed by the
+.B dirs
+builtin.
+Assigning to members of this array variable may be used to modify
+directories already in the stack, but the
+.B pushd
+and
+.B popd
+builtins must be used to add and remove directories.
+Assignment to this variable will not change the current directory.
If
.SM
-.B RANDOM
+.B DIRSTACK
is unset, it loses its special properties, even if it is
subsequently reset.
.TP
-.B SECONDS
-Each time this parameter is
-referenced, the number of seconds since shell invocation is returned. If a
-value is assigned to
+.B EUID
+Expands to the effective user ID of the current user, initialized at
+shell startup. This variable is readonly.
+.TP
+.B FUNCNAME
+The name of any currently-executing shell function.
+This variable exists only when a shell function is executing.
+Assignments to
.SM
-.BR SECONDS ,
-the value returned upon subsequent
-references is
-the number of seconds since the assignment plus the value assigned.
+.B FUNCNAME
+have no effect and return an error status.
If
.SM
-.B SECONDS
+.B FUNCNAME
is unset, it loses its special properties, even if it is
subsequently reset.
.TP
-.B LINENO
-Each time this parameter is referenced, the shell substitutes
-a decimal number representing the current sequential line number
-(starting with 1) within a script or function. When not in a
-script or function, the value substituted is not guaranteed to
-be meaningful.
+.B GROUPS
+An array variable containing the list of groups of which the current
+user is a member.
+Assignments to
+.SM
+.B GROUPS
+have no effect and return an error status.
If
.SM
-.B LINENO
+.B GROUPS
is unset, it loses its special properties, even if it is
subsequently reset.
.TP
@@ -1222,45 +1252,39 @@ If
is unset, it loses its special properties, even if it is
subsequently reset.
.TP
-.B FUNCNAME
-The name of any currently-executing shell function.
-This variable exists only when a shell function is executing.
-Assignments to
-.SM
-.B FUNCNAME
-have no effect and return an error status.
-If
-.SM
-.B FUNCNAME
-is unset, it loses its special properties, even if it is
-subsequently reset.
+.B HOSTNAME
+Automatically set to the name of the current host.
.TP
-.B DIRSTACK
-An array variable (see
-.B Arrays
-below) containing the current contents of the directory stack.
-Directories appear in the stack in the order they are displayed by the
-.B dirs
-builtin.
-Assigning to members of this array variable may be used to modify
-directories already in the stack, but the
-.B pushd
-and
-.B popd
-builtins must be used to add and remove directories.
-Assignment to this variable will not change the current directory.
+.B HOSTTYPE
+Automatically set to a string that uniquely
+describes the type of machine on which
+.B bash
+is executing.
+The default is system-dependent.
+.TP
+.B LINENO
+Each time this parameter is referenced, the shell substitutes
+a decimal number representing the current sequential line number
+(starting with 1) within a script or function. When not in a
+script or function, the value substituted is not guaranteed to
+be meaningful.
If
.SM
-.B DIRSTACK
+.B LINENO
is unset, it loses its special properties, even if it is
subsequently reset.
.TP
-.B PIPESTATUS
-An array variable (see
-.B Arrays
-below) containing a list of exit status values from the processes
-in the most-recently-executed foreground pipeline (which may
-contain only a single command).
+.B MACHTYPE
+Automatically set to a string that fully describes the system
+type on which
+.B bash
+is executing, in the standard GNU \fIcpu-company-system\fP format.
+The default is system-dependent.
+.TP
+.B OLDPWD
+The previous working directory as set by the
+.B cd
+command.
.TP
.B OPTARG
The value of the last option argument processed by the
@@ -1278,16 +1302,6 @@ builtin command (see
.B SHELL BUILTIN COMMANDS
below).
.TP
-.B HOSTNAME
-Automatically set to the name of the current host.
-.TP
-.B HOSTTYPE
-Automatically set to a string that uniquely
-describes the type of machine on which
-.B bash
-is executing.
-The default is system-dependent.
-.TP
.B OSTYPE
Automatically set to a string that
describes the operating system on which
@@ -1295,12 +1309,53 @@ describes the operating system on which
is executing.
The default is system-dependent.
.TP
-.B MACHTYPE
-Automatically set to a string that fully describes the system
-type on which
-.B bash
-is executing, in the standard GNU \fIcpu-company-system\fP format.
-The default is system-dependent.
+.B PIPESTATUS
+An array variable (see
+.B Arrays
+below) containing a list of exit status values from the processes
+in the most-recently-executed foreground pipeline (which may
+contain only a single command).
+.TP
+.B PPID
+The process ID of the shell's parent. This variable is readonly.
+.TP
+.B PWD
+The current working directory as set by the
+.B cd
+command.
+.TP
+.B RANDOM
+Each time this parameter is referenced, a random integer between
+0 and 32767 is
+generated. The sequence of random numbers may be initialized by assigning
+a value to
+.SM
+.BR RANDOM .
+If
+.SM
+.B RANDOM
+is unset, it loses its special properties, even if it is
+subsequently reset.
+.TP
+.B REPLY
+Set to the line of input read by the
+.B read
+builtin command when no arguments are supplied.
+.TP
+.B SECONDS
+Each time this parameter is
+referenced, the number of seconds since shell invocation is returned. If a
+value is assigned to
+.SM
+.BR SECONDS ,
+the value returned upon subsequent
+references is
+the number of seconds since the assignment plus the value assigned.
+If
+.SM
+.B SECONDS
+is unset, it loses its special properties, even if it is
+subsequently reset.
.TP
.B SHELLOPTS
A colon-separated list of enabled shell options. Each word in
@@ -1323,36 +1378,14 @@ starts up, each shell option in the list will be enabled before
reading any startup files.
This variable is read-only.
.TP
-.B COMP_WORDS
-An array variable (see \fBArrays\fP below) consisting of the individual
-words in the current command line.
-This variable is available only in shell functions invoked by the
-programmable completion facilities (see \fBProgrammable Completion\fP
-below).
-.TP
-.B COMP_CWORD
-An index into \fB${COMP_WORDS}\fP of the word containing the current
-cursor position.
-This variable is available only in shell functions invoked by the
-programmable completion facilities (see \fBProgrammable Completion\fP
-below).
-.TP
-.B COMP_LINE
-The current command line.
-This variable is available only in shell functions and external
-commands invoked by the
-programmable completion facilities (see \fBProgrammable Completion\fP
-below).
+.B SHLVL
+Incremented by one each time an instance of
+.B bash
+is started.
.TP
-.B COMP_POINT
-The index of the current cursor position relative to the beginning of
-the current command.
-If the current cursor position is at the end of the current command,
-the value of this variable is equal to \fB${#COMP_LINE}\fP.
-This variable is available only in shell functions and external
-commands invoked by the
-programmable completion facilities (see \fBProgrammable Completion\fP
-below).
+.B UID
+Expands to the user ID of the current user, initialized at shell startup.
+This variable is readonly.
.PD
.PP
The following variables are used by the shell. In some cases,
@@ -1362,33 +1395,19 @@ below.
.PP
.PD 0
.TP
-.B IFS
-The
-.I Internal Field Separator
-that is used
-for word splitting after expansion and to
-split lines into words with the
-.B read
-builtin command. The default value is
-``<space><tab><newline>''.
-.TP
-.B PATH
-The search path for commands. It
-is a colon-separated list of directories in which
-the shell looks for commands (see
+.B BASH_ENV
+If this parameter is set when \fBbash\fP is executing a shell script,
+its value is interpreted as a filename containing commands to
+initialize the shell, as in
+.IR ~/.bashrc .
+The value of
.SM
-.B COMMAND EXECUTION
-below). The default path is system-dependent,
-and is set by the administrator who installs
-.BR bash .
-A common value is
-.if t \f(CW/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:.\fP.
-.if n ``/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:.''.
-.TP
-.B HOME
-The home directory of the current user; the default argument for the
-\fBcd\fP builtin command.
-The value of this variable is also used when performing tilde expansion.
+.B BASH_ENV
+is subjected to parameter expansion, command substitution, and arithmetic
+expansion before being interpreted as a file name.
+.SM
+.B PATH
+is not used to search for the resultant file name.
.TP
.B CDPATH
The search path for the
@@ -1400,19 +1419,193 @@ for destination directories specified by the
command.
A sample value is ``.:~:/usr''.
.TP
-.B BASH_ENV
-If this parameter is set when \fBbash\fP is executing a shell script,
-its value is interpreted as a filename containing commands to
-initialize the shell, as in
-.IR ~/.bashrc .
-The value of
+.B COLUMNS
+Used by the \fBselect\fP builtin command to determine the terminal width
+when printing selection lists. Automatically set upon receipt of a SIGWINCH.
+.TP
+.B COMPREPLY
+An array variable from which \fBbash\fP reads the possible completions
+generated by a shell function invoked by the programmable completion
+facility (see \fBProgrammable Completion\fP below).
+.TP
+.B FCEDIT
+The default editor for the
+.B fc
+builtin command.
+.TP
+.B FIGNORE
+A colon-separated list of suffixes to ignore when performing
+filename completion (see
.SM
-.B BASH_ENV
-is subjected to parameter expansion, command substitution, and arithmetic
-expansion before being interpreted as a file name.
+.B READLINE
+below).
+A filename whose suffix matches one of the entries in
.SM
-.B PATH
-is not used to search for the resultant file name.
+.B FIGNORE
+is excluded from the list of matched filenames.
+A sample value is ``.o:~''.
+.TP
+.B GLOBIGNORE
+A colon-separated list of patterns defining the set of filenames to
+be ignored by pathname expansion.
+If a filename matched by a pathname expansion pattern also matches one
+of the patterns in
+.SM
+.BR GLOBIGNORE ,
+it is removed from the list of matches.
+.TP
+.B HISTCONTROL
+If set to a value of
+.IR ignorespace ,
+lines which begin with a
+.B space
+character are not entered on the history list.
+If set to a value of
+.IR ignoredups ,
+lines matching the last history line are not entered.
+A value of
+.I ignoreboth
+combines the two options.
+If unset, or if set to any other value than those above,
+all lines read
+by the parser are saved on the history list, subject to the value
+of
+.BR HISTIGNORE .
+This variable's function is superseded by
+.BR HISTIGNORE .
+The second and subsequent lines of a multi-line compound command are
+not tested, and are added to the history regardless of the value of
+.BR HISTCONTROL .
+.TP
+.B HISTFILE
+The name of the file in which command history is saved (see
+.SM
+.B HISTORY
+below). The default value is \fI~/.bash_history\fP. If unset, the
+command history is not saved when an interactive shell exits.
+.TP
+.B HISTFILESIZE
+The maximum number of lines contained in the history file. When this
+variable is assigned a value, the history file is truncated, if
+necessary, to contain no more than that number of lines. The default
+value is 500. The history file is also truncated to this size after
+writing it when an interactive shell exits.
+.TP
+.B HISTIGNORE
+A colon-separated list of patterns used to decide which command lines
+should be saved on the history list. Each pattern is anchored at the
+beginning of the line and must match the complete line (no implicit
+`\fB*\fP' is appended). Each pattern is tested against the line
+after the checks specified by
+.B HISTCONTROL
+are applied.
+In addition to the normal shell pattern matching characters, `\fB&\fP'
+matches the previous history line. `\fB&\fP' may be escaped using a
+backslash; the backslash is removed before attempting a match.
+The second and subsequent lines of a multi-line compound command are
+not tested, and are added to the history regardless of the value of
+.BR HISTIGNORE .
+.TP
+.B HISTSIZE
+The number of commands to remember in the command history (see
+.SM
+.B HISTORY
+below). The default value is 500.
+.TP
+.B HOME
+The home directory of the current user; the default argument for the
+\fBcd\fP builtin command.
+The value of this variable is also used when performing tilde expansion.
+.TP
+.B HOSTFILE
+Contains the name of a file in the same format as
+.FN /etc/hosts
+that should be read when the shell needs to complete a
+hostname.
+The list of possible hostname completions may be changed while the
+shell is running;
+the next time hostname completion is attempted after the
+value is changed,
+.B bash
+adds the contents of the new file to the existing list.
+If
+.SM
+.B HOSTFILE
+is set, but has no value, \fBbash\fP attempts to read
+.FN /etc/hosts
+to obtain the list of possible hostname completions.
+When
+.SM
+.B HOSTFILE
+is unset, the hostname list is cleared.
+.TP
+.B IFS
+The
+.I Internal Field Separator
+that is used
+for word splitting after expansion and to
+split lines into words with the
+.B read
+builtin command. The default value is
+``<space><tab><newline>''.
+.TP
+.B IGNOREEOF
+Controls the
+action of an interactive shell on receipt of an
+.SM
+.B EOF
+character as the sole input. If set, the value is the number of
+consecutive
+.SM
+.B EOF
+characters which must be
+typed as the first characters on an input line before
+.B bash
+exits. If the variable exists but does not have a numeric value, or
+has no value, the default value is 10. If it does not exist,
+.SM
+.B EOF
+signifies the end of input to the shell.
+.TP
+.B INPUTRC
+The filename for the
+.B readline
+startup file, overriding the default of
+.FN ~/.inputrc
+(see
+.SM
+.B READLINE
+below).
+.TP
+.B LANG
+Used to determine the locale category for any category not specifically
+selected with a variable starting with \fBLC_\fP.
+.TP
+.B LC_ALL
+This variable overrides the value of \fBLANG\fP and any other
+\fBLC_\fP variable specifying a locale category.
+.TP
+.B LC_COLLATE
+This variable determines the collation order used when sorting the
+results of pathname expansion, and determines the behavior of range
+expressions, equivalence classes, and collating sequences within
+pathname expansion and pattern matching.
+.TP
+.B LC_CTYPE
+This variable determines the interpretation of characters and the
+behavior of character classes within pathname expansion and pattern
+matching.
+.TP
+.B LC_MESSAGES
+This variable determines the locale used to translate double-quoted
+strings preceded by a \fB$\fP.
+.TP
+.B LC_NUMERIC
+This variable determines the locale category used for number formatting.
+.TP
+.B LINES
+Used by the \fBselect\fP builtin command to determine the column length
+for printing selection lists. Automatically set upon receipt of a SIGWINCH.
.TP
.B MAIL
If this parameter is set to a file name and the
@@ -1447,6 +1640,47 @@ supplies a default value for this variable, but the location of the user
mail files that it uses is system dependent (e.g., /var/mail/\fB$USER\fP).
.RE
.TP
+.B OPTERR
+If set to the value 1,
+.B bash
+displays error messages generated by the
+.B getopts
+builtin command (see
+.SM
+.B SHELL BUILTIN COMMANDS
+below).
+.SM
+.B OPTERR
+is initialized to 1 each time the shell is invoked or a shell
+script is executed.
+.TP
+.B PATH
+The search path for commands. It
+is a colon-separated list of directories in which
+the shell looks for commands (see
+.SM
+.B COMMAND EXECUTION
+below). The default path is system-dependent,
+and is set by the administrator who installs
+.BR bash .
+A common value is
+.if t \f(CW/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:.\fP.
+.if n ``/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:.''.
+.TP
+.B POSIXLY_CORRECT
+If this variable is in the environment when \fBbash\fP starts, the shell
+enters \fIposix mode\fP before reading the startup files, as if the
+.B \-\-posix
+invocation option had been supplied. If it is set while the shell is
+running, \fBbash\fP enables \fIposix mode\fP, as if the command
+.if t \f(CWset -o posix\fP
+.if n \fIset -o posix\fP
+had been executed.
+.TP
+.B PROMPT_COMMAND
+If set, the value is executed as a command prior to issuing each primary
+prompt.
+.TP
.B PS1
The value of this parameter is expanded (see
.SM
@@ -1526,96 +1760,6 @@ value \fB$'\enreal\et%3lR\enuser\et%3lU\ensys\t%3lS'\fP.
If the value is null, no timing information is displayed.
A trailing newline is added when the format string is displayed.
.TP
-.B HISTSIZE
-The number of commands to remember in the command history (see
-.SM
-.B HISTORY
-below). The default value is 500.
-.TP
-.B HISTFILE
-The name of the file in which command history is saved (see
-.SM
-.B HISTORY
-below). The default value is \fI~/.bash_history\fP. If unset, the
-command history is not saved when an interactive shell exits.
-.TP
-.B HISTFILESIZE
-The maximum number of lines contained in the history file. When this
-variable is assigned a value, the history file is truncated, if
-necessary, to contain no more than that number of lines. The default
-value is 500. The history file is also truncated to this size after
-writing it when an interactive shell exits.
-.TP
-.B OPTERR
-If set to the value 1,
-.B bash
-displays error messages generated by the
-.B getopts
-builtin command (see
-.SM
-.B SHELL BUILTIN COMMANDS
-below).
-.SM
-.B OPTERR
-is initialized to 1 each time the shell is invoked or a shell
-script is executed.
-.TP
-.B LANG
-Used to determine the locale category for any category not specifically
-selected with a variable starting with \fBLC_\fP.
-.TP
-.B LC_ALL
-This variable overrides the value of \fBLANG\fP and any other
-\fBLC_\fP variable specifying a locale category.
-.TP
-.B LC_COLLATE
-This variable determines the collation order used when sorting the
-results of pathname expansion, and determines the behavior of range
-expressions, equivalence classes, and collating sequences within
-pathname expansion and pattern matching.
-.TP
-.B LC_CTYPE
-This variable determines the interpretation of characters and the
-behavior of character classes within pathname expansion and pattern
-matching.
-.TP
-.B LC_MESSAGES
-This variable determines the locale used to translate double-quoted
-strings preceded by a \fB$\fP.
-.TP
-.B LC_NUMERIC
-This variable determines the locale category used for number formatting.
-.TP
-.B LINES
-Used by the \fBselect\fP builtin command to determine the column length
-for printing selection lists. Automatically set upon receipt of a SIGWINCH.
-.TP
-.B COLUMNS
-Used by the \fBselect\fP builtin command to determine the terminal width
-when printing selection lists. Automatically set upon receipt of a SIGWINCH.
-.TP
-.B PROMPT_COMMAND
-If set, the value is executed as a command prior to issuing each primary
-prompt.
-.TP
-.B IGNOREEOF
-Controls the
-action of an interactive shell on receipt of an
-.SM
-.B EOF
-character as the sole input. If set, the value is the number of
-consecutive
-.SM
-.B EOF
-characters which must be
-typed as the first characters on an input line before
-.B bash
-exits. If the variable exists but does not have a numeric value, or
-has no value, the default value is 10. If it does not exist,
-.SM
-.B EOF
-signifies the end of input to the shell.
-.TP
.B TMOUT
If set to a value greater than zero, the value is interpreted as the
number of seconds to wait for input after issuing the primary prompt.
@@ -1623,121 +1767,6 @@ number of seconds to wait for input after issuing the primary prompt.
terminates after waiting for that number of seconds if input does
not arrive.
.TP
-.B FCEDIT
-The default editor for the
-.B fc
-builtin command.
-.TP
-.B FIGNORE
-A colon-separated list of suffixes to ignore when performing
-filename completion (see
-.SM
-.B READLINE
-below).
-A filename whose suffix matches one of the entries in
-.SM
-.B FIGNORE
-is excluded from the list of matched filenames.
-A sample value is ``.o:~''.
-.TP
-.B GLOBIGNORE
-A colon-separated list of patterns defining the set of filenames to
-be ignored by pathname expansion.
-If a filename matched by a pathname expansion pattern also matches one
-of the patterns in
-.SM
-.BR GLOBIGNORE ,
-it is removed from the list of matches.
-.TP
-.B INPUTRC
-The filename for the
-.B readline
-startup file, overriding the default of
-.FN ~/.inputrc
-(see
-.SM
-.B READLINE
-below).
-.TP
-.B HISTCONTROL
-If set to a value of
-.IR ignorespace ,
-lines which begin with a
-.B space
-character are not entered on the history list.
-If set to a value of
-.IR ignoredups ,
-lines matching the last history line are not entered.
-A value of
-.I ignoreboth
-combines the two options.
-If unset, or if set to any other value than those above,
-all lines read
-by the parser are saved on the history list, subject to the value
-of
-.BR HISTIGNORE .
-This variable's function is superseded by
-.BR HISTIGNORE .
-The second and subsequent lines of a multi-line compound command are
-not tested, and are added to the history regardless of the value of
-.BR HISTCONTROL .
-.TP
-.B HISTIGNORE
-A colon-separated list of patterns used to decide which command lines
-should be saved on the history list. Each pattern is anchored at the
-beginning of the line and must match the complete line (no implicit
-`\fB*\fP' is appended). Each pattern is tested against the line
-after the checks specified by
-.B HISTCONTROL
-are applied.
-In addition to the normal shell pattern matching characters, `\fB&\fP'
-matches the previous history line. `\fB&\fP' may be escaped using a
-backslash; the backslash is removed before attempting a match.
-The second and subsequent lines of a multi-line compound command are
-not tested, and are added to the history regardless of the value of
-.BR HISTIGNORE .
-.TP
-.B histchars
-The two or three characters which control history expansion
-and tokenization (see
-.SM
-.B HISTORY EXPANSION
-below). The first character is the \fIhistory expansion\fP character,
-the character which signals the start of a history
-expansion, normally `\fB!\fP'.
-The second character is the \fIquick substitution\fP
-character, which is used as shorthand for re-running the previous
-command entered, substituting one string for another in the command.
-The default is `\fB^\fP'.
-The optional third character is the character
-which indicates that the remainder of the line is a comment when found
-as the first character of a word, normally `\fB#\fP'. The history
-comment character causes history substitution to be skipped for the
-remaining words on the line. It does not necessarily cause the shell
-parser to treat the rest of the line as a comment.
-.TP
-.B HOSTFILE
-Contains the name of a file in the same format as
-.FN /etc/hosts
-that should be read when the shell needs to complete a
-hostname.
-The list of possible hostname completions may be changed while the
-shell is running;
-the next time hostname completion is attempted after the
-value is changed,
-.B bash
-adds the contents of the new file to the existing list.
-If
-.SM
-.B HOSTFILE
-is set, but has no value, \fBbash\fP attempts to read
-.FN /etc/hosts
-to obtain the list of possible hostname completions.
-When
-.SM
-.B HOSTFILE
-is unset, the hostname list is cleared.
-.TP
.B auto_resume
This variable controls how the shell interacts with the user and
job control. If this variable is set, single word simple
@@ -1767,10 +1796,24 @@ analogous to the
.B %
job identifier.
.TP
-.B COMPREPLY
-An array variable from which \fBbash\fP reads the possible completions
-generated by a shell function invoked by the programmable completion
-facility (see \fBProgrammable Completion\fP below).
+.B histchars
+The two or three characters which control history expansion
+and tokenization (see
+.SM
+.B HISTORY EXPANSION
+below). The first character is the \fIhistory expansion\fP character,
+the character which signals the start of a history
+expansion, normally `\fB!\fP'.
+The second character is the \fIquick substitution\fP
+character, which is used as shorthand for re-running the previous
+command entered, substituting one string for another in the command.
+The default is `\fB^\fP'.
+The optional third character is the character
+which indicates that the remainder of the line is a comment when found
+as the first character of a word, normally `\fB#\fP'. The history
+comment character causes history substitution to be skipped for the
+remaining words on the line. It does not necessarily cause the shell
+parser to treat the rest of the line as a comment.
.PD
.SS Arrays
.B Bash
@@ -2686,13 +2729,13 @@ File descriptor 2 is duplicated.
.TP
.B /dev/tcp/\fIhost\fP/\fIport\fP
If \fIhost\fP is a valid hostname or Internet address, and \fIport\fP
-is an integer port number, \fBbash\fP attempts to open a TCP connection
-to the corresponding socket.
+is an integer port number or service name, \fBbash\fP attempts to open
+a TCP connection to the corresponding socket.
.TP
.B /dev/udp/\fIhost\fP/\fIport\fP
If \fIhost\fP is a valid hostname or Internet address, and \fIport\fP
-is an integer port number, \fBbash\fP attempts to open a UDP connection
-to the corresponding socket.
+is an integer port number or service name, \fBbash\fP attempts to open
+a UDP connection to the corresponding socket.
.PD
.RE
.PP
@@ -2811,7 +2854,7 @@ The format of here-documents is as follows:
.PP
.nf
\fB<<\fP[\fB\-\fP]\fIword\fP
- \fIhere\-document\fP
+ \fIhere-document\fP
\fIdelimiter\fP
.fi
.RE
@@ -3139,7 +3182,7 @@ is a decimal number between 2 and 64 representing the arithmetic
base, and \fIn\fP is a number in that base.
If \fIbase#\fP is omitted, then base 10 is used.
The digits greater than 9 are represented by the lowercase letters,
-the uppercase letters, _, and @, in that order.
+the uppercase letters, @, and _, in that order.
If \fIbase\fP is less than or equal to 36, lowercase and uppercase
letters may be used interchangably to represent numbers between 10
and 35.
@@ -3454,6 +3497,11 @@ that the shell inherited from its parent at invocation. Builtin
commands that are invoked as part of a pipeline are also executed in a
subshell environment. Changes made to the subshell environment
cannot affect the shell's execution environment.
+.PP
+If a command is followed by a \fB&\fP and job control is not active, the
+default standard input for the command is the empty file \fI/dev/null\fP.
+Otherwise, the invoked command inherits the file descriptors of the calling
+shell as modified by redirections.
.SH ENVIRONMENT
When a program is invoked it is given an array of strings
called the
@@ -3579,7 +3627,7 @@ and
The shell exits by default upon receipt of a
.SM
.BR SIGHUP .
-Before exiting, it resends the
+Before exiting, an interactive shell resends the
.SM
.B SIGHUP
to all jobs, running or stopped.
@@ -3768,6 +3816,10 @@ builtin command
is enabled,
.B bash
reports such changes immediately.
+Any trap on
+.SM
+.B SIGCHLD
+is executed for each child that exits.
.PP
If an attempt to exit
.B bash
@@ -3834,6 +3886,9 @@ the current time in 12-hour HH:MM:SS format
.B \e@
the current time in 12-hour am/pm format
.TP
+.B \eA
+the current time in 24-hour HH:MM format
+.TP
.B \eu
the username of the current user
.TP
@@ -3841,7 +3896,7 @@ the username of the current user
the version of \fBbash\fP (e.g., 2.00)
.TP
.B \eV
-the release of \fBbash\fP, version + patchlevel (e.g., 2.00.0)
+the release of \fBbash\fP, version + patchelvel (e.g., 2.00.0)
.TP
.B \ew
the current working directory
@@ -4123,12 +4178,12 @@ horizontal tab
vertical tab
.TP
.B \e\fInnn\fP
-the character whose ASCII code is the octal value \fInnn\fP
+the eight-bit character whose value is the octal value \fInnn\fP
(one to three digits)
.TP
-.B \ex\fInnn\fP
-the character whose ASCII code is the hexadecimal value \fInnn\fP
-(one to three digits)
+.B \ex\fIHH\fP
+the eight-bit character whose value is the hexadecimal value \fIHH\fP
+(one or two hex digits)
.RE
.PD
.PP
@@ -4230,6 +4285,11 @@ arrow keys.
If set to \fBon\fP, tilde expansion is performed when readline
attempts word completion.
.TP
+.B history-preserve-point
+If set to \fBon\fP, the history code attempts to place point at the
+same location on each history line retrived with \fBprevious-history\fP
+or \fBnext-history\fP.
+.TP
.B horizontal\-scroll\-mode (Off)
When set to \fBOn\fP, makes readline use a single line for display,
scrolling the input horizontally on a single screen line when it
@@ -4268,6 +4328,12 @@ appended.
If set to \fBOn\fP, history lines that have been modified are displayed
with a preceding asterisk (\fB*\fP).
.TP
+.B match\-hidden\-files (On)
+This variable, when set to \fBOn\fP, causes readline to match files whose
+names begin with a `.' (hidden files) when performing filename
+completion, unless the leading `.' is
+supplied by the user in the filename to be completed.
+.TP
.B output\-meta (Off)
If set to \fBOn\fP, readline will display characters with the
eighth bit set directly rather than as a meta-prefixed escape
@@ -4393,6 +4459,10 @@ the search and execute that command.
For instance, a \fInewline\fP will terminate the search and accept
the line, thereby executing the command from the history list.
.PP
+Readline remembers the last incremental search string. If two
+Control-Rs are typed without any intervening characters defining a
+new search string, any remembered search string is used.
+.PP
Non-incremental searches read the entire search string before starting
to search for matching history lines. The search string may be
typed by the user or be part of the contents of the current line.
@@ -4566,7 +4636,7 @@ save the deleted text on the kill ring.
.B forward\-backward\-delete\-char
Delete the character under the cursor, unless the cursor is at the
end of the line, in which case the character behind the cursor is
-deleted. By default, this is not bound to a key.
+deleted.
.TP
.B quoted\-insert (C\-q, C\-v)
Add the next character typed to the line verbatim. This is
@@ -4588,6 +4658,8 @@ Negative arguments have no effect.
.B transpose\-words (M\-t)
Drag the word before point past the word after point,
moving point over that word as well.
+If point is at the end of the line, this transposes
+the last two words on the line.
.TP
.B upcase\-word (M\-u)
Uppercase the current (or following) word. With a negative argument,
@@ -4707,7 +4779,7 @@ with a single match from the list of possible completions.
Repeated execution of \fBmenu\-complete\fP steps through the list
of possible completions, inserting each match in turn.
At the end of the list of completions, the bell is rung
-(subject to the setting of \Bbell\-style\fP)
+(subject to the setting of \fBbell\-style\fP)
and the original text is restored.
An argument of \fIn\fP moves \fIn\fP positions forward in the list
of matches; a negative argument may be used to move backward
@@ -5672,7 +5744,7 @@ The return value is true unless an invalid option is supplied, or no
matches were generated.
.TP
.PD 0
-\fBcomplete\fP [\fB\-abcdefjkvu\fP] [\fB\-o\fP \fIcomp-option\fP] [\fB\-A\fP \fIaction\fP] [\fB\-G\fP \fIglobpat\fP] [\fB\-W\fP \fIwordlist\fP] [\fB\-P\fP \fIprefix\fP] [\fB\-S\fP \fIsuffix\fP]
+\fBcomplete\fP [\fB\-abcdefgjkvu\fP] [\fB\-o\fP \fIcomp-option\fP] [\fB\-A\fP \fIaction\fP] [\fB\-G\fP \fIglobpat\fP] [\fB\-W\fP \fIwordlist\fP] [\fB\-P\fP \fIprefix\fP] [\fB\-S\fP \fIsuffix\fP]
.br
[\fB\-X\fP \fIfilterpat\fP] [\fB\-F\fP \fIfunction\fP] [\fB\-C\fP \fIcommand\fP] \fIname\fP [\fIname ...\fP]
.TP
@@ -5754,6 +5826,9 @@ File names. May also be specified as \fB\-f\fP.
.B function
Names of shell functions.
.TP 8
+.B group
+Group names. May also be specified as \fB\-g\fP.
+.TP 8
.B helptopic
Help topics as accepted by the \fBhelp\fP builtin.
.TP 8
@@ -6058,12 +6133,12 @@ vertical tab
backslash
.TP
.B \e\fInnn\fP
-the character whose ASCII code is the octal value \fInnn\fP
+the eight-bit character whose value is the octal value \fInnn\fP
(one to three digits)
.TP
-.B \ex\fInnn\fP
-the character whose ASCII code is the hexadecimal value \fInnn\fP
-(one to three digits)
+.B \ex\fIHH\fP
+the eight-bit character whose value is the hexadecimal value \fIHH\fP
+(one or two hex digits)
.PD
.RE
.TP
@@ -6392,6 +6467,7 @@ If a required argument is not found, and
is not silent,
a question mark (\^\fB?\fP\^) is placed in
.IR name ,
+.SM
.B OPTARG
is unset, and a diagnostic message is printed.
If
@@ -6408,7 +6484,7 @@ returns true if an option, specified or unspecified, is found.
It returns false if the end of options is encountered or an
error occurs.
.TP
-\fBhash\fP [\fB\-r\fP] [\fB\-p\fP \fIfilename\fP] [\fIname\fP]
+\fBhash\fP [\fB\-r\fP] [\fB\-p\fP \fIfilename\fP] [\fB\-t\fP] [\fIname\fP]
For each
.IR name ,
the full file name of the command is determined by searching
@@ -6423,8 +6499,13 @@ is used as the full file name of the command.
The
.B \-r
option causes the shell to forget all
-remembered locations. If no arguments are given, information
-about remembered commands is printed.
+remembered locations.
+If the
+.B \-t
+option is supplied, the full pathname to which each \fIname\fP corresponds
+is printed. If multiple \fIname\fP arguments are supplied with \fB\-t\fP,
+the \fIname\fP is printed before the hashed full pathname.
+If no arguments are given, information about remembered commands is printed.
The return status is true unless a
.I name
is not found or an invalid option is supplied.
@@ -6713,9 +6794,9 @@ plain characters, which are simply copied to standard output, character
escape sequences, which are converted and copied to the standard output, and
format specifications, each of which causes printing of the next successive
\fIargument\fP.
-In addition to the standard \fIprintf\fP(1) formats, %b causes
+In addition to the standard \fIprintf\fP(1) formats, \fB%b\fP causes
\fBprintf\fP to expand backslash escape sequences in the corresponding
-\fIargument\fP, and %q causes \fBprintf\fP to output the corresponding
+\fIargument\fP, and \fB%q\fP causes \fBprintf\fP to output the corresponding
\fIargument\fP in a format that can be reused as shell input.
.sp 1
The \fIformat\fP is reused as necessary to consume all of the \fIarguments\fP.
@@ -6842,7 +6923,7 @@ above) is used to obtain the line.
waiting for a complete line of input.
.TP
.B \-p \fIprompt\fP
-Display \fIprompt\fP, without a
+Display \fIprompt\fP on standard error, without a
trailing newline, before attempting to read any input. The prompt
is displayed only if input is coming from a terminal.
.TP
@@ -6964,6 +7045,7 @@ or
list, or if the command's return value is
being inverted via
.BR ! .
+A trap on \fBERR\fP, if set, is executed before the shell exits.
.TP 8
.B \-f
Disable pathname expansion.
@@ -7057,6 +7139,8 @@ Same as
.B noglob
Same as
.BR \-f .
+.B nolog
+Currently ignored.
.TP 8
.B notify
Same as
@@ -7400,6 +7484,13 @@ If set, and the
option is enabled, multi-line commands are saved to the history with
embedded newlines rather than using semicolon separators where possible.
.TP 8
+.B login_shell
+The shell sets this option if it is started as a login shell (see
+.SM
+.B "INVOCATION"
+above).
+The value may not be changed.
+.TP 8
.B mailwarn
If set, and a file that \fBbash\fP is checking for mail has been
accessed since the last time it was checked, the message ``The mail in
@@ -7620,7 +7711,8 @@ is
.B EXIT
(0) the command
.I arg
-is executed on exit from the shell. If a
+is executed on exit from the shell.
+If a
.I sigspec
is
.SM
@@ -7631,6 +7723,31 @@ is executed after every \fIsimple command\fP (see
.SM
.B SHELL GRAMMAR
above).
+If a
+.I sigspec
+is
+.SM
+.BR ERR ,
+the command
+.I arg
+is executed whenever a simple command has a non\-zero exit status.
+The
+.SM
+.BR ERR
+trap is not executed if the failed command is part of an
+.I until
+or
+.I while
+loop,
+part of an
+.I if
+statement, part of a
+.B &&
+or
+.B \(bv\(bv
+list, or if the command's return value is
+being inverted via
+.BR ! .
The
.B \-l
option causes the shell to print a list of signal names and
@@ -7707,17 +7824,22 @@ none are found.
.TP
\fBulimit\fP [\fB\-SHacdflmnpstuv\fP [\fIlimit\fP]]
Provides control over the resources available to the shell and to
-processes started by it, on systems that allow such control. The
-value of
-.I limit
-can be a number in the unit specified for the resource, or the
-value
-.BR unlimited .
+processes started by it, on systems that allow such control.
The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is
set for the given resource. A hard limit cannot be increased once it
is set; a soft limit may be increased up to the value of the hard limit.
If neither \fB\-H\fP nor \fB\-S\fP is specified, both the soft and hard
limits are set.
+The value of
+.I limit
+can be a number in the unit specified for the resource
+or one of the special values
+.BR hard ,
+.BR soft ,
+or
+.BR unlimited ,
+which stand for the current hard limit, the current soft limit, and
+no limit, respectively.
If
.I limit
is omitted, the current value of the soft limit of the resource is
@@ -7781,10 +7903,9 @@ and
.B \-n
and
.BR \-u ,
-which are unscaled values. The return status is 0
-unless an invalid option is encountered, a non-numeric argument
-other than \fBunlimited\fP is supplied as \fIlimit\fP, or an
-error occurs while setting a new limit.
+which are unscaled values.
+The return status is 0 unless an invalid option or argument is supplied,
+or an error occurs while setting a new limit.
.RE
.TP
\fBumask\fP [\fB\-p\fP] [\fB\-S\fP] [\fImode\fP]