Files
bash/doc/bash.html
T

16415 lines
546 KiB
HTML

<!-- Creator : groff version 1.23.0 -->
<!-- CreationDate: Sat Sep 6 15:33:53 2025 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>BASH</title>
</head>
<body>
<h1 align="center">BASH</h1>
<a href="#NAME">NAME</a><br>
<a href="#SYNOPSIS">SYNOPSIS</a><br>
<a href="#COPYRIGHT">COPYRIGHT</a><br>
<a href="#DESCRIPTION">DESCRIPTION</a><br>
<a href="#OPTIONS">OPTIONS</a><br>
<a href="#ARGUMENTS">ARGUMENTS</a><br>
<a href="#INVOCATION">INVOCATION</a><br>
<a href="#DEFINITIONS">DEFINITIONS</a><br>
<a href="#RESERVED WORDS">RESERVED WORDS</a><br>
<a href="#SHELL GRAMMAR">SHELL GRAMMAR</a><br>
<a href="#Simple Commands">Simple Commands</a><br>
<a href="#Pipelines">Pipelines</a><br>
<a href="#Lists">Lists</a><br>
<a href="#Compound Commands">Compound Commands</a><br>
<a href="#Coprocesses">Coprocesses</a><br>
<a href="#Shell Function Definitions">Shell Function Definitions</a><br>
<a href="#COMMENTS">COMMENTS</a><br>
<a href="#QUOTING">QUOTING</a><br>
<a href="#Translating Strings">Translating Strings</a><br>
<a href="#PARAMETERS">PARAMETERS</a><br>
<a href="#Positional Parameters">Positional Parameters</a><br>
<a href="#Special Parameters">Special Parameters</a><br>
<a href="#Shell Variables">Shell Variables</a><br>
<a href="#Arrays">Arrays</a><br>
<a href="#EXPANSION">EXPANSION</a><br>
<a href="#Brace Expansion">Brace Expansion</a><br>
<a href="#Tilde Expansion">Tilde Expansion</a><br>
<a href="#Parameter Expansion">Parameter Expansion</a><br>
<a href="#Command Substitution">Command Substitution</a><br>
<a href="#Arithmetic Expansion">Arithmetic Expansion</a><br>
<a href="#Process Substitution">Process Substitution</a><br>
<a href="#Word Splitting">Word Splitting</a><br>
<a href="#Pathname Expansion">Pathname Expansion</a><br>
<a href="#Quote Removal">Quote Removal</a><br>
<a href="#REDIRECTION">REDIRECTION</a><br>
<a href="#Redirecting Input">Redirecting Input</a><br>
<a href="#Redirecting Output">Redirecting Output</a><br>
<a href="#Appending Redirected Output">Appending Redirected Output</a><br>
<a href="#Redirecting Standard Output and Standard Error">Redirecting Standard Output and Standard Error</a><br>
<a href="#Appending Standard Output and Standard Error">Appending Standard Output and Standard Error</a><br>
<a href="#Here Documents">Here Documents</a><br>
<a href="#Here Strings">Here Strings</a><br>
<a href="#Duplicating File Descriptors">Duplicating File Descriptors</a><br>
<a href="#Moving File Descriptors">Moving File Descriptors</a><br>
<a href="#Opening File Descriptors for Reading and Writing">Opening File Descriptors for Reading and Writing</a><br>
<a href="#ALIASES">ALIASES</a><br>
<a href="#FUNCTIONS">FUNCTIONS</a><br>
<a href="#ARITHMETIC EVALUATION">ARITHMETIC EVALUATION</a><br>
<a href="#CONDITIONAL EXPRESSIONS">CONDITIONAL EXPRESSIONS</a><br>
<a href="#SIMPLE COMMAND EXPANSION">SIMPLE COMMAND EXPANSION</a><br>
<a href="#COMMAND EXECUTION">COMMAND EXECUTION</a><br>
<a href="#COMMAND EXECUTION ENVIRONMENT">COMMAND EXECUTION ENVIRONMENT</a><br>
<a href="#ENVIRONMENT">ENVIRONMENT</a><br>
<a href="#EXIT STATUS">EXIT STATUS</a><br>
<a href="#SIGNALS">SIGNALS</a><br>
<a href="#JOB CONTROL">JOB CONTROL</a><br>
<a href="#PROMPTING">PROMPTING</a><br>
<a href="#READLINE">READLINE</a><br>
<a href="#Readline Notation">Readline Notation</a><br>
<a href="#Readline Initialization">Readline Initialization</a><br>
<a href="#Readline Key Bindings">Readline Key Bindings</a><br>
<a href="#Readline Variables">Readline Variables</a><br>
<a href="#Readline Conditional Constructs">Readline Conditional Constructs</a><br>
<a href="#Searching">Searching</a><br>
<a href="#Readline Command Names">Readline Command Names</a><br>
<a href="#Commands for Moving">Commands for Moving</a><br>
<a href="#Commands for Manipulating the History">Commands for Manipulating the History</a><br>
<a href="#Commands for Changing Text">Commands for Changing Text</a><br>
<a href="#Killing and Yanking">Killing and Yanking</a><br>
<a href="#Numeric Arguments">Numeric Arguments</a><br>
<a href="#Completing">Completing</a><br>
<a href="#Keyboard Macros">Keyboard Macros</a><br>
<a href="#Miscellaneous">Miscellaneous</a><br>
<a href="#Programmable Completion">Programmable Completion</a><br>
<a href="#HISTORY">HISTORY</a><br>
<a href="#HISTORY EXPANSION">HISTORY EXPANSION</a><br>
<a href="#Event Designators">Event Designators</a><br>
<a href="#Word Designators">Word Designators</a><br>
<a href="#Modifiers">Modifiers</a><br>
<a href="#SHELL BUILTIN COMMANDS">SHELL BUILTIN COMMANDS</a><br>
<a href="#SHELL COMPATIBILITY MODE">SHELL COMPATIBILITY MODE</a><br>
<a href="#RESTRICTED SHELL">RESTRICTED SHELL</a><br>
<a href="#SEE ALSO">SEE ALSO</a><br>
<a href="#FILES">FILES</a><br>
<a href="#AUTHORS">AUTHORS</a><br>
<a href="#BUG REPORTS">BUG REPORTS</a><br>
<a href="#BUGS">BUGS</a><br>
<hr>
<h2>NAME
<a name="NAME"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">bash &minus; GNU
Bourne-Again SHell</p>
<h2>SYNOPSIS
<a name="SYNOPSIS"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em"><b>bash</b>
[options] [command_string | file]</p>
<h2>COPYRIGHT
<a name="COPYRIGHT"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">Bash is
Copyright (C) 1989-2025 by the Free Software Foundation,
Inc.</p>
<h2>DESCRIPTION
<a name="DESCRIPTION"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em"><b>Bash</b> is a
command language interpreter that executes commands read
from the standard input, from a string, or from a file. It
is a reimplementation and extension of the Bourne shell, the
historical Unix command language interpreter. <b>Bash</b>
also incorporates useful features from the <i>Korn</i> and
<i>C</i> shells (<b>ksh</b> and <b>csh</b>).</p>
<p style="margin-left:9%; margin-top: 1em"><small>POSIX</small>
is the name for a family of computing standards based on
Unix. <b>Bash</b> is intended to be a conformant
implementation of the Shell and Utilities portion of the
IEEE <small>POSIX</small> specification (IEEE Standard
1003.1). <b>Bash</b> <small>POSIX</small> mode (hereafter
referred to as <i>posix mode</i>) changes the shell&rsquo;s
behavior where its default operation differs from the
standard to strictly conform to the standard. See
<b><small>SEE ALSO</small></b> below for a reference to a
document that details how posix mode affects
<b>bash</b>&rsquo;s behavior. <b>Bash</b> can be configured
to be <small>POSIX</small> -conformant by default.</p>
<h2>OPTIONS
<a name="OPTIONS"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">All of the
single-character shell options documented in the description
of the <b>set</b> builtin command, including
<b>&minus;o</b>, can be used as options when the shell is
invoked. In addition, <b>bash</b> interprets the following
options when it is invoked:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="3%">
<p><b>&minus;c</b></p></td>
<td width="10%"></td>
<td width="78%">
<p>If the <b>&minus;c</b> option is present, then commands
are read from the first non-option argument
<i>command_string</i>. If there are arguments after the
<i>command_string</i>, the first argument is assigned to
<b>$0</b> and any remaining arguments are assigned to the
positional parameters. The assignment to <b>$0</b> sets the
name of the shell, which is used in warning and error
messages.</p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="3%">
<p><b>&minus;i</b></p></td>
<td width="10%"></td>
<td width="78%">
<p>If the <b>&minus;i</b> option is present, the shell is
<i>interactive</i>.</p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="3%">
<p><b>&minus;l</b></p></td>
<td width="10%"></td>
<td width="78%">
<p>Make <b>bash</b> act as if it had been invoked as a
login shell (see <b><small>INVOCATION</small></b>
below).</p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="3%">
<p><b>&minus;r</b></p></td>
<td width="10%"></td>
<td width="78%">
<p>If the <b>&minus;r</b> option is present, the shell
becomes <i>restricted</i> (see <b><small>RESTRICTED
SHELL</small></b> below).</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="3%">
<p><b>&minus;s</b></p></td>
<td width="10%"></td>
<td width="78%">
<p>If the <b>&minus;s</b> option is present, or if no
arguments remain after option processing, the shell reads
commands from the standard input. This option allows the
positional parameters to be set when invoking an interactive
shell or when reading input through a pipe.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="3%">
<p><b>&minus;D</b></p></td>
<td width="10%"></td>
<td width="78%">
<p>Print a list of all double-quoted strings preceded by
<b>$</b> on the standard output. These are the strings that
are subject to language translation when the current locale
is not <b>C</b> or <b>POSIX</b>. This implies the
<b>&minus;n</b> option; no commands will be executed.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>[&minus;+]O
[</b><i>shopt_option</i><b>]</b></p>
<p style="margin-left:22%;"><i>shopt_option</i> is one of
the shell options accepted by the <b>shopt</b> builtin (see
<b><small>SHELL BUILTIN COMMANDS</small></b> below). If
<i>shopt_option</i> is present, <b>&minus;O</b> sets the
value of that option; <b>+O</b> unsets it. If
<i>shopt_option</i> is not supplied, <b>bash</b> prints the
names and values of the shell options accepted by
<b>shopt</b> on the standard output. If the invocation
option is <b>+O</b>, the output is displayed in a format
that may be reused as input.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="3%">
<p><b>&minus;&minus;</b></p></td>
<td width="10%"></td>
<td width="78%">
<p>A <b>&minus;&minus;</b> signals the end of options and
disables further option processing. Any arguments after the
<b>&minus;&minus;</b> are treated as a shell script filename
(see below) and arguments passed to that script. An argument
of <b>&minus;</b> is equivalent to
<b>&minus;&minus;</b>.</p> </td></tr>
</table>
<p style="margin-left:9%; margin-top: 1em"><b>Bash</b> also
interprets a number of multi-character options. These
options must appear on the command line before the
single-character options to be recognized. <b><br>
&minus;&minus;debugger</b></p>
<p style="margin-left:18%;">Arrange for the debugger
profile to be executed before the shell starts. Turns on
extended debugging mode (see the description of the
<b>extdebug</b> option to the <b>shopt</b> builtin
below).</p>
<p style="margin-left:9%;"><b>&minus;&minus;dump&minus;po&minus;strings</b></p>
<p style="margin-left:18%;">Equivalent to <b>&minus;D</b>,
but the output is in the GNU <i>gettext</i> &ldquo;po&rdquo;
(portable object) file format.</p>
<p style="margin-left:9%;"><b>&minus;&minus;dump&minus;strings</b></p>
<p style="margin-left:18%;">Equivalent to
<b>&minus;D</b>.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>&minus;&minus;help</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>Display a usage message on standard output and exit
successfully.</p> </td></tr>
</table>
<p style="margin-left:9%;"><b>&minus;&minus;init&minus;file</b>
<i>file</i> <b><br>
&minus;&minus;rcfile</b> <i>file</i></p>
<p style="margin-left:18%;">Execute commands from
<i>file</i> instead of the standard personal initialization
file <A HREF="file:~/.bashrc"><i>~/.bashrc</i></A> if the shell is interactive (see
<b><small>INVOCATION</small></b> below).</p>
<p style="margin-left:9%;"><b>&minus;&minus;login</b></p>
<p style="margin-left:18%;">Equivalent to
<b>&minus;l</b>.</p>
<p style="margin-left:9%;"><b>&minus;&minus;noediting</b></p>
<p style="margin-left:18%;">Do not use the GNU
<b>readline</b> library to read command lines when the shell
is interactive.</p>
<p style="margin-left:9%;"><b>&minus;&minus;noprofile</b></p>
<p style="margin-left:18%;">Do not read either the
system-wide startup file <A HREF="file:/etc/profile"><i>/etc/profile</i></A> or any of the
personal initialization files <A HREF="file:~/.bash_profile"><i>~/.bash_profile</i></A>,
<A HREF="file:~/.bash_login"><i>~/.bash_login</i></A>, or <A HREF="file:~/.profile"><i>~/.profile</i></A>. By default,
<b>bash</b> reads these files when it is invoked as a login
shell (see <b><small>INVOCATION</small></b> below).</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>&minus;&minus;norc</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>Do not read and execute the personal initialization file
<A HREF="file:~/.bashrc"><i>~/.bashrc</i></A> if the shell is interactive. This option is
on by default if the shell is invoked as <b>sh</b>.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>&minus;&minus;posix</b></p>
<p style="margin-left:18%;">Enable posix mode; change the
behavior of <b>bash</b> where the default operation differs
from the <small>POSIX</small> standard to match the
standard.</p>
<p style="margin-left:9%;"><b>&minus;&minus;restricted</b></p>
<p style="margin-left:18%;">The shell becomes restricted
(see <b><small>RESTRICTED SHELL</small></b> below).</p>
<p style="margin-left:9%;"><b>&minus;&minus;verbose</b></p>
<p style="margin-left:18%;">Equivalent to
<b>&minus;v</b>.</p>
<p style="margin-left:9%;"><b>&minus;&minus;version</b></p>
<p style="margin-left:18%;">Show version information for
this instance of <b>bash</b> on the standard output and exit
successfully.</p>
<h2>ARGUMENTS
<a name="ARGUMENTS"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">If arguments
remain after option processing, and neither the
<b>&minus;c</b> nor the <b>&minus;s</b> option has been
supplied, the first argument is treated as the name of a
file containing shell commands (a <i>shell script</i>). When
<b>bash</b> is invoked in this fashion, <b>$0</b> is set to
the name of the file, and the positional parameters are set
to the remaining arguments. <b>Bash</b> reads and executes
commands from this file, then exits. <b>Bash</b>&rsquo;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. <b>Bash</b> first attempts to open the file in the
current directory, and, if no file is found, searches the
directories in <b><small>PATH</small></b> for the
script.</p>
<h2>INVOCATION
<a name="INVOCATION"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">A <i>login
shell</i> is one whose first character of argument zero is a
<b>&minus;</b>, or one started with the
<b>&minus;&minus;login</b> option.</p>
<p style="margin-left:9%; margin-top: 1em">An
<i>interactive shell</i> is one started without non-option
arguments (unless <b>&minus;s</b> is specified) and without
the <b>&minus;c</b> option, and whose standard input and
standard error are both connected to terminals (as
determined by <i>isatty</i>(3)), or one started with the
<b>&minus;i</b> option. <b>Bash</b> sets
<b><small>PS1</small></b> and <b>$&minus;</b> includes
<b>i</b> if the shell is interactive, so a shell script or a
startup file can test this state.</p>
<p style="margin-left:9%; margin-top: 1em">The following
paragraphs describe how <b>bash</b> executes its startup
files. If any of the files exist but cannot be read,
<b>bash</b> reports an error. Tildes are expanded in
filenames as described below under <b>Tilde Expansion</b> in
the <b><small>EXPANSION</small></b> section.</p>
<p style="margin-left:9%; margin-top: 1em">When <b>bash</b>
is invoked as an interactive login shell, or as a
non-interactive shell with the <b>&minus;&minus;login</b>
option, it first reads and executes commands from the file
<A HREF="file:/etc/profile"><i>/etc/profile</i></A>, if that file exists. After reading that
file, it looks for <A HREF="file:~/.bash_profile"><i>~/.bash_profile</i></A>,
<A HREF="file:~/.bash_login"><i>~/.bash_login</i></A>, and <A HREF="file:~/.profile"><i>~/.profile</i></A>, in that order,
and reads and executes commands from the first one that
exists and is readable. The <b>&minus;&minus;noprofile</b>
option may be used when the shell is started to inhibit this
behavior.</p>
<p style="margin-left:9%; margin-top: 1em">When an
interactive login shell exits, or a non-interactive login
shell executes the <b>exit</b> builtin command, <b>bash</b>
reads and executes commands from the file
<A HREF="file:~/.bash_logout"><i>~/.bash_logout</i></A>, if it exists.</p>
<p style="margin-left:9%; margin-top: 1em">When an
interactive shell that is not a login shell is started,
<b>bash</b> reads and executes commands from
<A HREF="file:~/.bashrc"><i>~/.bashrc</i></A>, if that file exists. The
<b>&minus;&minus;norc</b> option inhibits this behavior. The
<b>&minus;&minus;rcfile</b> <i>file</i> option causes
<b>bash</b> to use <i>file</i> instead of
<A HREF="file:~/.bashrc"><i>~/.bashrc</i></A>.</p>
<p style="margin-left:9%; margin-top: 1em">When <b>bash</b>
is started non-interactively, to run a shell script, for
example, it looks for the variable
<b><small>BASH_ENV</small></b> in the environment, expands
its value if it appears there, and uses the expanded value
as the name of a file to read and execute. <b>Bash</b>
behaves as if the following command were executed:</p>
<p style="margin-left:18%; margin-top: 1em">if [ &minus;n
&quot;$BASH_ENV&quot; ]; then . &quot;$BASH_ENV&quot;;
fi</p>
<p style="margin-left:9%; margin-top: 1em">but does not use
the value of the <b><small>PATH</small></b> variable to
search for the filename.</p>
<p style="margin-left:9%; margin-top: 1em">If <b>bash</b>
is invoked with the name <b>sh</b>, it tries to mimic the
startup behavior of historical versions of <b>sh</b> as
closely as possible, while conforming to the
<small>POSIX</small> standard as well. When invoked as an
interactive login shell, or a non-interactive shell with the
<b>&minus;&minus;login</b> option, it first attempts to read
and execute commands from <A HREF="file:/etc/profile"><i>/etc/profile</i></A> and
<A HREF="file:~/.profile"><i>~/.profile</i></A>, in that order. The
<b>&minus;&minus;noprofile</b> option inhibits this
behavior. When invoked as an interactive shell with the name
<b>sh</b>, <b>bash</b> looks for the variable
<b><small>ENV</small></b><small>,</small> expands its value
if it is defined, and uses the expanded value as the name of
a file to read and execute. Since a shell invoked as
<b>sh</b> does not attempt to read and execute commands from
any other startup files, the <b>&minus;&minus;rcfile</b>
option has no effect. A non-interactive shell invoked with
the name <b>sh</b> does not attempt to read any other
startup files.</p>
<p style="margin-left:9%; margin-top: 1em">When invoked as
<b>sh</b>, <b>bash</b> enters posix mode after reading the
startup files.</p>
<p style="margin-left:9%; margin-top: 1em">When <b>bash</b>
is started in posix mode, as with the
<b>&minus;&minus;posix</b> command line option, it follows
the <small>POSIX</small> standard for startup files. In this
mode, interactive shells expand the
<b><small>ENV</small></b> variable and read and execute
commands from the file whose name is the expanded value. No
other startup files are read.</p>
<p style="margin-left:9%; margin-top: 1em"><b>Bash</b>
attempts to determine when it is being run with its standard
input connected to a network connection, as when executed by
the historical and rarely-seen remote shell daemon, usually
<i>rshd</i>, or the secure shell daemon <i>sshd</i>. If
<b>bash</b> determines it is being run non-interactively in
this fashion, it reads and executes commands from
<A HREF="file:~/.bashrc"><i>~/.bashrc</i></A>, if that file exists and is readable.
<b>Bash</b> does not read this file if invoked as <b>sh</b>.
The <b>&minus;&minus;norc</b> option inhibits this behavior,
and the <b>&minus;&minus;rcfile</b> option makes <b>bash</b>
use a different file instead of <A HREF="file:~/.bashrc"><i>~/.bashrc</i></A>, but
neither <i>rshd</i> nor <i>sshd</i> generally invoke the
shell with those options or allow them to be specified.</p>
<p style="margin-left:9%; margin-top: 1em">If the shell is
started with the effective user (group) id not equal to the
real user (group) id, and the <b>&minus;p</b> option is not
supplied, no startup files are read, shell functions are not
inherited from the environment, the
<b><small>SHELLOPTS</small></b><small>, <b>BASHOPTS</b>,
<b>CDPATH</b>,</small> and <b><small>GLOBIGNORE</small></b>
variables, if they appear in the environment, are ignored,
and the effective user id is set to the real user id. If the
<b>&minus;p</b> option is supplied at invocation, the
startup behavior is the same, but the effective user id is
not reset.</p>
<h2>DEFINITIONS
<a name="DEFINITIONS"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">The following
definitions are used throughout the rest of this
document.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>blank</b></p></td>
<td width="3%"></td>
<td width="19%">
<p>A space or tab.</p></td>
<td width="63%">
</td></tr>
</table>
<p style="margin-left:9%;"><b>whitespace</b></p>
<p style="margin-left:18%;">A character belonging to the
<b>space</b> character class in the current locale, or for
which <i>isspace</i>(3) returns true.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="5%">
<p><b>word</b></p></td>
<td width="4%"></td>
<td width="82%">
<p>A sequence of characters considered as a single unit by
the shell. Also known as a <b>token</b>.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="5%">
<p><b>name</b></p></td>
<td width="4%"></td>
<td width="82%">
<p>A <i>word</i> consisting only of alphanumeric characters
and underscores, and beginning with an alphabetic character
or an underscore. Also referred to as an
<b>identifier</b>.</p> </td></tr>
</table>
<p style="margin-left:9%;"><b>metacharacter</b></p>
<p style="margin-left:18%;">A character that, when
unquoted, separates words. One of the following: <b><br>
| &amp; ; ( ) &lt; &gt; space tab newline</b></p>
<p style="margin-left:9%;"><b>control operator</b></p>
<p style="margin-left:18%;">A <i>token</i> that performs a
control function. It is one of the following symbols:
<b><br>
|| &amp; &amp;&amp; ; ;; ;&amp; ;;&amp; ( ) | |&amp;
&lt;newline&gt;</b></p>
<h2>RESERVED WORDS
<a name="RESERVED WORDS"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em"><b><i>Reserved
words</i></b> are words that have a special meaning to the
shell. The following words are recognized as reserved when
unquoted and either</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>the first word of a command (see <b><small>SHELL
GRAMMAR</small></b> below);</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>the first word following a reserved word other than
<b>case</b>, <b>for</b>, <b>select</b>, or <b>in</b>;</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>the third word of a <b>case</b> command (only <b>in</b>
is valid);</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>the third word of a <b>for</b> or <b>select</b> command
(only <b>in</b> and <b>do</b> are valid);</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>following a control operator.</p></td></tr>
</table>
<p style="margin-left:9%; margin-top: 1em">The shell will
also recognize reserved words where the syntax of a command
specifically requires the reserved word as the only correct
token.</p>
<p style="margin-left:9%; margin-top: 1em">The following
are reserved words:</p>
<p style="margin-left:9%; margin-top: 1em"><b>! case coproc
do done elif else esac fi for function if in select then
until while { } time [[ ]]</b></p>
<h2>SHELL GRAMMAR
<a name="SHELL GRAMMAR"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">This section
describes the syntax of the various forms of shell
commands.</p>
<h3>Simple Commands
<a name="Simple Commands"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">A <i>simple
command</i> is a sequence of optional variable assignments
followed by <b>blank</b>-separated words and redirections,
and terminated by a <i>control operator</i>. The first word
specifies the command to be executed, and is passed as
argument zero. The remaining words are passed as arguments
to the invoked command.</p>
<p style="margin-left:9%; margin-top: 1em">The return value
of a <i>simple command</i> is its exit status, or
128+<i>n</i> if the command is terminated by signal
<i>n</i>.</p>
<h3>Pipelines
<a name="Pipelines"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">A
<i>pipeline</i> is a sequence of one or more commands
separated by one of the control operators <b>|</b> or
<b>|&amp;</b>. The format for a pipeline is:</p>
<p style="margin-left:18%; margin-top: 1em">[<b>time</b>
[<b>&minus;p</b>]] [ ! ] <i>command1</i> [
[<b>|</b>&#9130;<b>|&amp;</b>] <i>command2</i> ... ]</p>
<p style="margin-left:9%; margin-top: 1em">The standard
output of <i>command1</i> is connected via a pipe to the
standard input of <i>command2</i>. This connection is
performed before any redirections specified by the
<i>command1</i>(see <b><small>REDIRECTION</small></b>
below). If <b>|&amp;</b> is the pipeline operator,
<i>command1</i>&rsquo;s standard error, in addition to its
standard output, is connected to <i>command2</i>&rsquo;s
standard input through the pipe; it is shorthand for
<b>2&gt;&amp;1 |</b>. This implicit redirection of the
standard error to the standard output is performed after any
redirections specified by <i>command1</i>.</p>
<p style="margin-left:9%; margin-top: 1em">The return
status of a pipeline is the exit status of the last command,
unless the <b>pipefail</b> option is enabled. If
<b>pipefail</b> is enabled, the pipeline&rsquo;s return
status is the value of the last (rightmost) command to exit
with a non-zero status, or zero if all commands exit
successfully. If the reserved word <b>!</b> precedes a
pipeline, the exit status of that pipeline is the logical
negation of the exit status as described above. If a
pipeline is executed synchronously, the shell waits for all
commands in the pipeline to terminate before returning a
value.</p>
<p style="margin-left:9%; margin-top: 1em">If the
<b>time</b> reserved word precedes a pipeline, the shell
reports the elapsed as well as user and system time consumed
by its execution when the pipeline terminates. The
<b>&minus;p</b> option changes the output format to that
specified by <small>POSIX</small> . When the shell is in
posix mode, it does not recognize <b>time</b> as a reserved
word if the next token begins with a &ldquo;&minus;&rdquo;.
The value of the <b><small>TIMEFORMAT</small></b> variable
is a format string that specifies how the timing information
should be displayed; see the description of
<b><small>TIMEFORMAT</small></b> below under <b>Shell
Variables</b>.</p>
<p style="margin-left:9%; margin-top: 1em">When the shell
is in posix mode, <b>time</b> may appear by itself as the
only word in a simple command. In this case, the shell
displays the total user and system time consumed by the
shell and its children. The <b><small>TIMEFORMAT</small></b>
variable specifies the format of the time information.</p>
<p style="margin-left:9%; margin-top: 1em">Each command in
a multi-command pipeline, where pipes are created, is
executed in a <i>subshell</i>, which is a separate process.
See <b><small>COMMAND EXECUTION ENVIRONMENT</small></b> for
a description of subshells and a subshell environment. If
the <b>lastpipe</b> option is enabled using the <b>shopt</b>
builtin (see the description of <b>shopt</b> below), and job
control is not active, the last element of a pipeline may be
run by the shell process.</p>
<h3>Lists
<a name="Lists"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">A <i>list</i> is
a sequence of one or more AND or OR lists separated by one
of the operators <b>;</b>, <b>&amp;</b>, or
<b>&lt;newline&gt;</b>, and optionally terminated by one of
those three characters.</p>
<p style="margin-left:9%; margin-top: 1em">AND and OR lists
are sequences of one or more pipelines separated by the
<b>&amp;&amp;</b> and <b>||</b> control operators,
respectively. AND and OR lists are executed with left
associativity.</p>
<p style="margin-left:9%; margin-top: 1em">An AND list has
the form</p>
<p style="margin-left:18%; margin-top: 1em"><i>command1</i>
<b>&amp;&amp;</b> <i>command2</i></p>
<p style="margin-left:9%; margin-top: 1em"><i>command2</i>
is executed if, and only if, <i>command1</i> returns an exit
status of zero (success).</p>
<p style="margin-left:9%; margin-top: 1em">An OR list has
the form</p>
<p style="margin-left:18%; margin-top: 1em"><i>command1</i>
<b>||</b> <i>command2</i></p>
<p style="margin-left:9%; margin-top: 1em"><i>command2</i>
is executed if, and only if, <i>command1</i> returns a
non-zero exit status. The return status of AND and OR lists
is the exit status of the last command executed in the
list.</p>
<p style="margin-left:9%; margin-top: 1em">Of these list
operators, <b>&amp;&amp;</b> and <b>||</b> have equal
precedence, followed by <b>;</b> and <b>&amp;</b>, which
have equal precedence.</p>
<p style="margin-left:9%; margin-top: 1em">A sequence of
one or more newlines may appear in a <i>list</i> instead of
a semicolon to delimit commands.</p>
<p style="margin-left:9%; margin-top: 1em">If a command is
terminated by the control operator <b>&amp;</b>, the shell
executes the command in the <i>background</i> in a subshell.
The shell does not wait for the command to finish, and the
return status is 0. These are referred to as
<i>asynchronous</i> commands. Commands separated or
terminated by <b>;</b> (or an equivalent
<b>&lt;newline&gt;</b>) are executed sequentially; the shell
waits for each command to terminate in turn.</p>
<p style="margin-left:9%; margin-top: 1em">The return
status of a list is the exit status of the last command
executed.</p>
<h3>Compound Commands
<a name="Compound Commands"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">A <i>compound
command</i> is one of the following. In most cases a
<i>list</i> in a command&rsquo;s description may be
separated from the rest of the command by one or more
newlines, and may be followed by a newline in place of a
semicolon.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p style="margin-top: 1em">(<i>list</i>)</p></td>
<td width="1%"></td>
<td width="82%">
<p style="margin-top: 1em"><i>list</i> is executed in a
subshell (see <b><small>COMMAND EXECUTION
ENVIRONMENT</small></b> below for a description of a
subshell environment). Variable assignments and builtin
commands that affect the shell&rsquo;s environment do not
remain in effect after the command completes. The return
status is the exit status of <i>list</i>.</p></td></tr>
</table>
<p style="margin-left:9%;">{ <i>list</i>; }</p>
<p style="margin-left:18%;"><i>list</i> is executed in the
current shell environment. <i>list</i> must be terminated
with a newline or semicolon. This is known as a <i>group
command</i>. The return status is the exit status of
<i>list</i>.</p>
<p style="margin-left:18%; margin-top: 1em">Note that
unlike the metacharacters <b>(</b> and <b>)</b>, <b>{</b>
and <b>}</b> are <i>reserved words</i> 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
<i>list</i> by whitespace or another shell
metacharacter.</p>
<p style="margin-left:9%;">((<i>expression</i>))</p>
<p style="margin-left:18%;">The arithmetic
<i>expression</i> is evaluated according to the rules
described below under <b><small>ARITHMETIC
EVALUATION</small></b><small>.</small> If the value of the
expression is non-zero, the return status is 0; otherwise
the return status is 1. The <i>expression</i> undergoes the
same expansions as if it were within double quotes, but
unescaped double quote characters in <i>expression</i> are
not treated specially and are removed. Since this can
potentially result in empty strings, this command treats
those as expressions that evaluate to 0.</p>
<p style="margin-left:9%;"><b>[[</b> <i>expression</i>
<b>]]</b></p>
<p style="margin-left:18%;">Evaluate the conditional
expression <i>expression</i> and return a status of zero
(true) or non-zero (false). Expressions are composed of the
primaries described below under <b><small>CONDITIONAL
EXPRESSIONS</small></b><small>.</small> The words between
the <b>[[</b> and <b>]]</b> do not undergo word splitting
and pathname expansion. The shell performs tilde expansion,
parameter and variable expansion, arithmetic expansion,
command substitution, process substitution, and quote
removal on those words. Conditional operators such as
<b>&minus;f</b> must be unquoted to be recognized as
primaries.</p>
<p style="margin-left:18%; margin-top: 1em">When used with
<b>[[</b>, the <b>&lt;</b> and <b>&gt;</b> operators sort
lexicographically using the current locale.</p>
<p style="margin-left:18%; margin-top: 1em">When the
<b>==</b> and <b>!=</b> operators are used, the string to
the right of the operator is considered a pattern and
matched according to the rules described below under
<b>Pattern Matching</b>, as if the <b>extglob</b> shell
option were enabled. The <b>=</b> operator is equivalent to
<b>==</b>. If the <b>nocasematch</b> shell option is
enabled, the match is performed without regard to the case
of alphabetic characters. The return value is 0 if the
string matches (<b>==</b>) or does not match (<b>!=</b>) the
pattern, and 1 otherwise. If any part of the pattern is
quoted, the quoted portion is matched as a string: every
character in the quoted portion matches itself, instead of
having any special pattern matching meaning.</p>
<p style="margin-left:18%; margin-top: 1em">An additional
binary operator, <b>=~</b>, is available, with the same
precedence as <b>==</b> and <b>!=</b>. When it is used, the
string to the right of the operator is considered a
<small>POSIX</small> extended regular expression and matched
accordingly (using the <small>POSIX</small> <i>regcomp</i>
and <i>regexec</i> interfaces usually described in
<i>regex</i>(3)). The return value is 0 if the string
matches the pattern, and 1 otherwise. If the regular
expression is syntactically incorrect, the conditional
expression&rsquo;s return value is 2. If the
<b>nocasematch</b> shell option is enabled, the match is
performed without regard to the case of alphabetic
characters.</p>
<p style="margin-left:18%; margin-top: 1em">If any part of
the pattern is quoted, the quoted portion is matched
literally, as above. If the pattern is stored in a shell
variable, quoting the variable expansion forces the entire
pattern to be matched literally. Treat bracket expressions
in regular expressions carefully, since normal quoting and
pattern characters lose their meanings between brackets.</p>
<p style="margin-left:18%; margin-top: 1em">The match
succeeds if the pattern matches any part of the string.
Anchor the pattern using the <b>^</b> and <b>$</b> regular
expression operators to force it to match the entire
string.</p>
<p style="margin-left:18%; margin-top: 1em">The array
variable <b><small>BASH_REMATCH</small></b> records which
parts of the string matched the pattern. The element of
<b><small>BASH_REMATCH</small></b> with index 0 contains the
portion of the string matching the entire regular
expression. Substrings matched by parenthesized
subexpressions within the regular expression are saved in
the remaining <b><small>BASH_REMATCH</small></b> indices.
The element of <b><small>BASH_REMATCH</small></b> with index
<i>n</i> is the portion of the string matching the
<i>n</i>th parenthesized subexpression. <b>Bash</b> sets
<b><small>BASH_REMATCH</small></b> in the global scope;
declaring it as a local variable will lead to unexpected
results.</p>
<p style="margin-left:18%; margin-top: 1em">Expressions may
be combined using the following operators, listed in
decreasing order of precedence: <b><br>
(</b> <i>expression</i> <b>)</b></p>
<p style="margin-left:27%;">Returns the value of
<i>expression</i>. This may be used to override the normal
precedence of operators.</p>
<p style="margin-left:18%;"><b>!</b> <i>expression</i></p>
<p style="margin-left:27%;">True if <i>expression</i> is
false.</p>
<p style="margin-left:18%;"><i>expression1</i>
<b>&amp;&amp;</b> <i>expression2</i></p>
<p style="margin-left:27%;">True if both <i>expression1</i>
and <i>expression2</i> are true.</p>
<p style="margin-left:18%;"><i>expression1</i> <b>||</b>
<i>expression2</i></p>
<p style="margin-left:27%;">True if either
<i>expression1</i> or <i>expression2</i> is true.</p>
<p style="margin-left:18%; margin-top: 1em">The
<b>&amp;&amp;</b> and <b>||</b> operators do not evaluate
<i>expression2</i> if the value of <i>expression1</i> is
sufficient to determine the return value of the entire
conditional expression.</p>
<p style="margin-left:9%;"><b>for</b> <i>name</i> [ [
<b>in</b> <i>word ...</i> ] ; ] <b>do</b> <i>list</i> ;
<b>done</b></p>
<p style="margin-left:18%;">First, expand the list of words
following <b>in</b>, generating a list of items. Then, the
variable <i>name</i> is set to each element of this list in
turn, and <i>list</i> is executed each time. If the
<b>in</b> <i>word</i> is omitted, the <b>for</b> command
executes <i>list</i> once for each positional parameter that
is set (see <b><small>PARAMETERS</small></b> below). The
return status is the exit status of the last command that
executes. If the expansion of the items following <b>in</b>
results in an empty list, no commands are executed, and the
return status is 0.</p>
<p style="margin-left:9%;"><b>for</b> (( <i>expr1</i> ;
<i>expr2</i> ; <i>expr3</i> )) [;] <b>do</b> <i>list</i> ;
<b>done</b></p>
<p style="margin-left:18%;">First, evaluate the arithmetic
expression <i>expr1</i> according to the rules described
below under <b><small>ARITHMETIC
EVALUATION</small></b><small>.</small> Then, repeatedly
evaluate the arithmetic expression <i>expr2</i> until it
evaluates to zero. Each time <i>expr2</i> evaluates to a
non-zero value, execute <i>list</i> and evaluate the
arithmetic expression <i>expr3</i>. If any expression is
omitted, it behaves as if it evaluates to 1. The return
value is the exit status of the last command in <i>list</i>
that is executed, or non-zero if any of the expressions is
invalid.</p>
<p style="margin-left:18%; margin-top: 1em">Use the
<b>break</b> and <b>continue</b> builtins (see
<b><small>SHELL BUILTIN COMMANDS</small></b> below) to
control loop execution.</p>
<p style="margin-left:9%;"><b>select</b> <i>name</i> [ [
<b>in</b> <i>word ...</i> ] ; ] <b>do</b> <i>list</i> ;
<b>done</b></p>
<p style="margin-left:18%;">First, expand the list of words
following <b>in</b>, generating a list of items, and print
the set of expanded words the standard error, each preceded
by a number. If the <b>in</b> <i>word</i> is omitted, print
the positional parameters (see
<b><small>PARAMETERS</small></b> below). <b>select</b> then
displays the <b><small>PS3</small></b> prompt and reads a
line from the standard input. If the line consists of a
number corresponding to one of the displayed words, then
<b>select</b> sets the value of <i>name</i> to that word. If
the line is empty, <b>select</b> displays the words and
prompt again. If EOF is read, <b>select</b> completes and
returns 1. Any other value sets <i>name</i> to null. The
line read is saved in the variable
<b><small>REPLY</small></b><small>.</small> The <i>list</i>
is executed after each selection until a <b>break</b>
command is executed. The exit status of <b>select</b> is the
exit status of the last command executed in <i>list</i>, or
zero if no commands were executed.</p>
<p style="margin-left:9%;"><b>case</b> <i>word</i>
<b>in</b> [ [(] <i>pattern</i> [ <b>|</b> <i>pattern</i> ]
... ) <i>list</i> ;; ] ... <b>esac</b></p>
<p style="margin-left:18%;">A <b>case</b> command first
expands <i>word</i>, and tries to match it against each
<i>pattern</i> in turn, proceeding from first to last, using
the matching rules described under <b>Pattern Matching</b>
below. The <i>word</i> is expanded using tilde expansion,
parameter and variable expansion, arithmetic expansion,
command substitution, process substitution and quote
removal. Each <i>pattern</i> examined is expanded using
tilde expansion, parameter and variable expansion,
arithmetic expansion, command substitution, process
substitution, and quote removal. If the <b>nocasematch</b>
shell option is enabled, the match is performed without
regard to the case of alphabetic characters.</p>
<p style="margin-left:18%; margin-top: 1em">A <i>pattern
list</i> is a set of one or more patterns separated by
<b>|</b>, and terminated by the <b>)</b> operator. A case
<i>clause</i> is a pattern list and an associated
<i>list</i>, terminated by <b>;;</b>, <b>;&amp;</b>, or
<b>;;&amp;</b>. The terminator is optional for the last
clause preceding <b>esac</b>. There may be an arbitrary
number of case clauses. The first pattern that matches
determines the <i>list</i> that is executed.</p>
<p style="margin-left:18%; margin-top: 1em">When a match is
found, <b>case</b> executes the corresponding <i>list</i>.
If the <b>;;</b> operator terminates the case clause, the
<b>case</b> command completes after the first match. Using
the <b>;&amp;</b> terminator continues execution with the
<i>list</i> associated with the next clause, if any. Using
the <b>;;&amp;</b> terminator causes the shell to test the
pattern list in the next clause, if any, and execute any
associated <i>list</i> if the match succeeds, continuing the
case statement execution as if the pattern list had not
matched.</p>
<p style="margin-left:18%; margin-top: 1em">The exit status
is zero if no pattern matches. Otherwise, it is the exit
status of the last command executed in the last <i>list</i>
executed.</p>
<p style="margin-left:9%;"><b>if</b> <i>list</i>;
<b>then</b> <i>list</i>; [ <b>elif</b> <i>list</i>;
<b>then</b> <i>list</i>; ] ... [ <b>else</b> <i>list</i>; ]
<b>fi</b></p>
<p style="margin-left:18%;">The <b>if</b> <i>list</i> is
executed. If its exit status is zero, the <b>then</b>
<i>list</i> is executed. Otherwise, each <b>elif</b>
<i>list</i> is executed in turn, and if its exit status is
zero, the corresponding <b>then</b> <i>list</i> is executed
and the command completes. Otherwise, the <b>else</b>
<i>list</i> is executed, if present. The exit status is the
exit status of the last command executed, or zero if no
condition tested true.</p>
<p style="margin-left:9%;"><b>while</b> <i>list-1</i>;
<b>do</b> <i>list-2</i>; <b>done <br>
until</b> <i>list-1</i>; <b>do</b> <i>list-2</i>;
<b>done</b></p>
<p style="margin-left:18%;">The <b>while</b> command
continuously executes the list <i>list-2</i> as long as the
last command in the list <i>list-1</i> returns an exit
status of zero. The <b>until</b> command is identical to the
<b>while</b> command, except that the test is negated:
<i>list-2</i> is executed as long as the last command in
<i>list-1</i> returns a non-zero exit status. The exit
status of the <b>while</b> and <b>until</b> commands is the
exit status of the last command executed in <i>list-2</i>,
or zero if none was executed.</p>
<h3>Coprocesses
<a name="Coprocesses"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">A
<i>coprocess</i> is a shell command preceded by the
<b>coproc</b> reserved word. A coprocess is executed
asynchronously in a subshell, as if the command had been
terminated with the <b>&amp;</b> control operator, with a
two-way pipe established between the executing shell and the
coprocess.</p>
<p style="margin-left:9%; margin-top: 1em">The syntax for a
coprocess is:</p>
<p style="margin-left:18%; margin-top: 1em"><b>coproc</b>
[<i>NAME</i>] <i>command</i> [<i>redirections</i>]</p>
<p style="margin-left:9%; margin-top: 1em">This creates a
coprocess named <i>NAME</i>. <i>command</i> may be either a
simple command or a compound command (see above).
<i>NAME</i> is a shell variable name. If <i>NAME</i> is not
supplied, the default name is <b>COPROC</b>.</p>
<p style="margin-left:9%; margin-top: 1em">The recommended
form to use for a coprocess is</p>
<p style="margin-left:18%; margin-top: 1em"><b>coproc</b>
<i>NAME</i> { <i>command</i> [<i>redirections</i>]; }</p>
<p style="margin-left:9%; margin-top: 1em">This form is
preferred because simple commands result in the coprocess
always being named <b>COPROC</b>, and it is simpler to use
and more complete than the other compound commands.</p>
<p style="margin-left:9%; margin-top: 1em">If
<i>command</i> is a compound command, <i>NAME</i> is
optional. The word following <b>coproc</b> determines
whether that word is interpreted as a variable name: it is
interpreted as <i>NAME</i> if it is not a reserved word that
introduces a compound command. If <i>command</i> is a simple
command, <i>NAME</i> is not allowed; this is to avoid
confusion between <i>NAME</i> and the first word of the
simple command.</p>
<p style="margin-left:9%; margin-top: 1em">When the
coprocess is executed, the shell creates an array variable
(see <b>Arrays</b> below) named <i>NAME</i> in the context
of the executing shell. The standard output of
<i>command</i> is connected via a pipe to a file descriptor
in the executing shell, and that file descriptor is assigned
to <i>NAME</i>[0]. The standard input of <i>command</i> is
connected via a pipe to a file descriptor in the executing
shell, and that file descriptor is assigned to
<i>NAME</i>[1]. This pipe is established before any
redirections specified by the command (see
<b><small>REDIRECTION</small></b> below). The file
descriptors can be utilized as arguments to shell commands
and redirections using standard word expansions. Other than
those created to execute command and process substitutions,
the file descriptors are not available in subshells.</p>
<p style="margin-left:9%; margin-top: 1em">The process ID
of the shell spawned to execute the coprocess is available
as the value of the variable <i>NAME</i>_PID. The
<b>wait</b> builtin may be used to wait for the coprocess to
terminate.</p>
<p style="margin-left:9%; margin-top: 1em">Since the
coprocess is created as an asynchronous command, the
<b>coproc</b> command always returns success. The return
status of a coprocess is the exit status of
<i>command</i>.</p>
<h3>Shell Function Definitions
<a name="Shell Function Definitions"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">A shell function
is an object that is called like a simple command and
executes a compound command with a new set of positional
parameters. Shell functions are declared as follows: <i><br>
fname</i> () <i>compound&minus;command</i>
[<i>redirection</i>] <b><br>
function</b> <i>fname</i> [()] <i>compound&minus;command</i>
[<i>redirection</i>]</p>
<p style="margin-left:18%;">This defines a function named
<i>fname</i>. The reserved word <b>function</b> is optional.
If the <b>function</b> reserved word is supplied, the
parentheses are optional. The <i>body</i> of the function is
the compound command <i>compound&minus;command</i> (see
<b>Compound Commands</b> above). That command is usually a
<i>list</i> of commands between { and }, but may be any
command listed under <b>Compound Commands</b> above. If the
<b>function</b> reserved word is used, but the parentheses
are not supplied, the braces are recommended.
<i>compound&minus;command</i> is executed whenever
<i>fname</i> is specified as the name of a simple command.
When in posix mode, <i>fname</i> must be a valid shell
<i>name</i> and may not be the name of one of the
<small>POSIX</small> <i>special builtins</i>. In default
mode, a function name can be any unquoted shell word that
does not contain <b>$</b>.</p>
<p style="margin-left:9%; margin-top: 1em">Any redirections
(see <b><small>REDIRECTION</small></b> below) specified when
a function is defined are performed when the function is
executed.</p>
<p style="margin-left:9%; margin-top: 1em">The exit status
of a function definition is zero unless a syntax error
occurs or a readonly function with the same name already
exists. When executed, the exit status of a function is the
exit status of the last command executed in the body. (See
<b><small>FUNCTIONS</small></b> below.)</p>
<h2>COMMENTS
<a name="COMMENTS"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">In a
non-interactive shell, or an interactive shell in which the
<b>interactive_comments</b> option to the <b>shopt</b>
builtin is enabled (see <b><small>SHELL BUILTIN
COMMANDS</small></b> below), a word beginning with <b>#</b>
introduces a comment. A word begins at the beginning of a
line, after unquoted whitespace, or after an operator. The
comment causes that word and all remaining characters on
that line to be ignored. An interactive shell without the
<b>interactive_comments</b> option enabled does not allow
comments. The <b>interactive_comments</b> option is enabled
by default in interactive shells.</p>
<h2>QUOTING
<a name="QUOTING"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em"><i>Quoting</i>
is used to remove the special meaning of certain characters
or words to the shell. Quoting can be used to disable
special treatment for special characters, to prevent
reserved words from being recognized as such, and to prevent
parameter expansion.</p>
<p style="margin-left:9%; margin-top: 1em">Each of the
<i>metacharacters</i> listed above under
<b><small>DEFINITIONS</small></b> has special meaning to the
shell and must be quoted if it is to represent itself.</p>
<p style="margin-left:9%; margin-top: 1em">When the command
history expansion facilities are being used (see
<b><small>HISTORY EXPANSION</small></b> below), the
<i>history expansion</i> character, usually <b>!</b>, must
be quoted to prevent history expansion.</p>
<p style="margin-left:9%; margin-top: 1em">There are four
quoting mechanisms: the <i>escape character</i>, single
quotes, double quotes, and dollar-single quotes.</p>
<p style="margin-left:9%; margin-top: 1em">A non-quoted
backslash (<b>\</b>) is the <i>escape character</i>. It
preserves the literal value of the next character that
follows, removing any special meaning it has, with the
exception of &lt;newline&gt;. If a <b>\</b>&lt;newline&gt;
pair appears, and the backslash is not itself quoted, the
<b>\</b>&lt;newline&gt; is treated as a line continuation
(that is, it is removed from the input stream and
effectively ignored).</p>
<p style="margin-left:9%; margin-top: 1em">Enclosing
characters in single quotes preserves the literal value of
each character within the quotes. A single quote may not
occur between single quotes, even when preceded by a
backslash.</p>
<p style="margin-left:9%; margin-top: 1em">Enclosing
characters in double quotes preserves the literal value of
all characters within the quotes, with the exception of
<b>$</b>, <b>`</b>, <b>\</b>, and, when history expansion is
enabled, <b>!</b>. When the shell is in posix mode, the
<b>!</b> has no special meaning within double quotes, even
when history expansion is enabled. The characters <b>$</b>
and <b>`</b> retain their special meaning within double
quotes. The backslash retains its special meaning only when
followed by one of the following characters: <b>$</b>,
<b>`</b>, <b>&quot;</b>, <b>\</b>, or
<b>&lt;newline&gt;</b>. Backslashes preceding characters
without a special meaning are left unmodified.</p>
<p style="margin-left:9%; margin-top: 1em">A double quote
may be quoted within double quotes by preceding it with a
backslash. If enabled, history expansion will be performed
unless an <b>!</b> appearing in double quotes is escaped
using a backslash. The backslash preceding the <b>!</b> is
not removed.</p>
<p style="margin-left:9%; margin-top: 1em">The special
parameters <b>*</b> and <b>@</b> have special meaning when
in double quotes (see <b><small>PARAMETERS</small></b>
below).</p>
<p style="margin-left:9%; margin-top: 1em">Character
sequences of the form <b>$</b>'<i>string</i>' are treated as
a special variant of single quotes. The sequence expands to
<i>string</i>, with backslash-escaped characters in
<i>string</i> replaced as specified by the ANSI C standard.
Backslash escape sequences, if present, are decoded as
follows:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\a</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>alert (bell)</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\b</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>backspace</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\e</b></p></td>
<td width="1%"></td>
<td width="73%">
</td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\E</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>an escape character</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\f</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>form feed</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\n</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>new line</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\r</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>carriage return</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\t</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>horizontal tab</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\v</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>vertical tab</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\\</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>backslash</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\'</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>single quote</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\&quot;</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>double quote</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\?</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>question mark</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\</b><i>nnn</i></p></td>
<td width="1%"></td>
<td width="73%">
<p>The eight-bit character whose value is the octal value
<i>nnn</i> (one to three octal digits).</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\x</b><i>HH</i></p></td>
<td width="1%"></td>
<td width="73%">
<p>The eight-bit character whose value is the hexadecimal
value <i>HH</i> (one or two hex digits).</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\u</b><i>HHHH</i></p></td>
<td width="1%"></td>
<td width="73%">
<p>The Unicode (ISO/IEC 10646) character whose value is the
hexadecimal value <i>HHHH</i> (one to four hex digits).</p></td></tr>
</table>
<p style="margin-left:18%;"><b>\U</b><i>HHHHHHHH</i></p>
<p style="margin-left:27%;">The Unicode (ISO/IEC 10646)
character whose value is the hexadecimal value
<i>HHHHHHHH</i> (one to eight hex digits).</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="4%">
<p><b>\c</b><i>x</i></p></td>
<td width="5%"></td>
<td width="28%">
<p>A control-<i>x</i> character.</p></td>
<td width="45%">
</td></tr>
</table>
<p style="margin-left:9%; margin-top: 1em">The expanded
result is single-quoted, as if the dollar sign had not been
present.</p>
<h3>Translating Strings
<a name="Translating Strings"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">A double-quoted
string preceded by a dollar sign
(<b>$</b>&quot;<i>string</i>&quot;) causes the string to be
translated according to the current locale. The
<i>gettext</i> infrastructure performs the lookup and
translation, using the <b>LC_MESSAGES</b>,
<b>TEXTDOMAINDIR</b>, and <b>TEXTDOMAIN</b> shell variables.
If the current locale is <b>C</b> or <b>POSIX</b>, if there
are no translations available, or if the string is not
translated, the dollar sign is ignored, and the string is
treated as double-quoted as described above. This is a form
of double quoting, so the string remains double-quoted by
default, whether or not it is translated and replaced. If
the <b>noexpand_translation</b> option is enabled using the
<b>shopt</b> builtin, translated strings are single-quoted
instead of double-quoted. See the description of
<b>shopt</b> below under <b><small>SHELL BUILTIN
COMMANDS</small></b><small>.</small></p>
<h2>PARAMETERS
<a name="PARAMETERS"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">A
<i>parameter</i> is an entity that stores values. It can be
a <i>name</i>, a number, or one of the special characters
listed below under <b>Special Parameters</b>. A
<i>variable</i> is a parameter denoted by a <i>name</i>. A
variable has a <i>value</i> and zero or more
<i>attributes</i>. Attributes are assigned using the
<b>declare</b> builtin command (see <b>declare</b> below in
<b><small>SHELL BUILTIN
COMMANDS</small></b><small>).</small> The <b>export</b> and
<b>readonly</b> builtins assign specific attributes.</p>
<p style="margin-left:9%; margin-top: 1em">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 the <b>unset</b> builtin command (see <b><small>SHELL
BUILTIN COMMANDS</small></b> below).</p>
<p style="margin-left:9%; margin-top: 1em">A
<i>variable</i> is assigned to using a statement of the
form</p>
<p style="margin-left:18%; margin-top: 1em"><i>name</i>=[<i>value</i>]</p>
<p style="margin-left:9%; margin-top: 1em">If <i>value</i>
is not given, the variable is assigned the null string. All
<i>values</i> undergo tilde expansion, parameter and
variable expansion, command substitution, arithmetic
expansion, and quote removal (see
<b><small>EXPANSION</small></b> below). If the variable has
its <b>integer</b> attribute set, then <i>value</i> is
evaluated as an arithmetic expression even if the
<b>$((</b>...<b>))</b> expansion is not used (see
<b>Arithmetic Expansion</b> below). Word splitting and
pathname expansion are not performed. Assignment statements
may also appear as arguments to the <b>alias</b>,
<b>declare</b>, <b>typeset</b>, <b>export</b>,
<b>readonly</b>, and <b>local</b> builtin commands
(<i>declaration</i> commands). When in posix mode, these
builtins may appear in a command after one or more instances
of the <b>command</b> builtin and retain these assignment
statement properties.</p>
<p style="margin-left:9%; margin-top: 1em">In the context
where an assignment statement is assigning a value to a
shell variable or array index, the &ldquo;+=&rdquo; operator
appends to or adds to the variable&rsquo;s previous value.
This includes arguments to <i>declaration</i> commands such
as <b>declare</b> that accept assignment statements. When
&ldquo;+=&rdquo; is applied to a variable for which the
<b>integer</b> attribute has been set, the variable&rsquo;s
current value and <i>value</i> are each evaluated as
arithmetic expressions, and the sum of the results is
assigned as the variable&rsquo;s value. The current value is
usually an integer constant, but may be an expression. When
&ldquo;+=&rdquo; is applied to an array variable using
compound assignment (see <b>Arrays</b> below), the
variable&rsquo;s value is not unset (as it is when using
&ldquo;=&rdquo;), and new values are appended to the array
beginning at one greater than the array&rsquo;s maximum
index (for indexed arrays) or added as additional
key&minus;value pairs in an associative array. When applied
to a string-valued variable, <i>value</i> is expanded and
appended to the variable&rsquo;s value.</p>
<p style="margin-left:9%; margin-top: 1em">A variable can
be assigned the <i>nameref</i> attribute using the
<b>&minus;n</b> option to the <b>declare</b> or <b>local</b>
builtin commands (see the descriptions of <b>declare</b> and
<b>local</b> below) to create a <i>nameref</i>, or a
reference to another variable. This allows variables to be
manipulated indirectly. Whenever the nameref variable is
referenced, assigned to, unset, or has its attributes
modified (other than using or changing the <i>nameref</i>
attribute itself), the operation is actually performed on
the variable specified by the nameref variable&rsquo;s
value. A nameref is commonly used within shell functions to
refer to a variable whose name is passed as an argument to
the function. For instance, if a variable name is passed to
a shell function as its first argument, running</p>
<p style="margin-left:18%; margin-top: 1em">declare
&minus;n ref=$1</p>
<p style="margin-left:9%; margin-top: 1em">inside the
function creates a local nameref variable <b>ref</b> whose
value is the variable name passed as the first argument.
References and assignments to <b>ref</b>, and changes to its
attributes, are treated as references, assignments, and
attribute modifications to the variable whose name was
passed as <b>$1</b>. If the control variable in a <b>for</b>
loop has the nameref attribute, the list of words can be a
list of shell variables, and a name reference is established
for each word in the list, in turn, when the loop is
executed. Array variables cannot be given the <b>nameref</b>
attribute. However, nameref variables can reference array
variables and subscripted array variables. Namerefs can be
unset using the <b>&minus;n</b> option to the <b>unset</b>
builtin. Otherwise, if <b>unset</b> is executed with the
name of a nameref variable as an argument, the variable
referenced by the nameref variable is unset.</p>
<p style="margin-left:9%; margin-top: 1em">When the shell
starts, it reads its environment and creates a shell
variable from each environment variable that has a valid
name, as described below (see
<b><small>ENVIRONMENT</small></b><small>).</small></p>
<h3>Positional Parameters
<a name="Positional Parameters"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">A <i>positional
parameter</i> is a parameter denoted by one or more digits,
other than the single digit 0. Positional parameters are
assigned from the shell&rsquo;s arguments when it is
invoked, and may be reassigned using the <b>set</b> builtin
command. Positional parameters may not be assigned to with
assignment statements. The positional parameters are
temporarily replaced when a shell function is executed (see
<b><small>FUNCTIONS</small></b> below).</p>
<p style="margin-left:9%; margin-top: 1em">When a
positional parameter consisting of more than a single digit
is expanded, it must be enclosed in braces (see
<b><small>EXPANSION</small></b> below). Without braces, a
digit following $ can only refer to one of the first nine
positional parameters (<b>$1&minus;$9</b>) or the special
parameter <b>$0</b> (see the next section).</p>
<h3>Special Parameters
<a name="Special Parameters"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">The shell treats
several parameters specially. These parameters may only be
referenced; assignment to them is not allowed. Special
parameters are denoted by one of the following
characters.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p style="margin-top: 1em"><b>*</b></p></td>
<td width="8%"></td>
<td width="82%">
<p style="margin-top: 1em">(<b>$*</b>) Expands to the
positional parameters, starting from one. When the expansion
is not within double quotes, each positional parameter
expands to a separate word. In contexts where word
expansions are performed, those words are subject to further
word splitting and pathname expansion. When the expansion
occurs within double quotes, it expands to a single word
with the value of each parameter separated by the first
character of the <b><small>IFS</small></b> variable. That
is, <b>&quot;$*&quot;</b> is equivalent to
<b>&quot;$1</b><i>c</i><b>$2</b><i>c</i><b>...&quot;</b>,
where <i>c</i> is the first character of the value of the
<b><small>IFS</small></b> variable. If
<b><small>IFS</small></b> is unset, the parameters are
separated by spaces. If <b><small>IFS</small></b> is null,
the parameters are joined without intervening
separators.</p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p><b>@</b></p></td>
<td width="8%"></td>
<td width="82%">
<p>(<b>$@</b>) Expands to the positional parameters,
starting from one. In contexts where word splitting is
performed, this expands each positional parameter to a
separate word; if not within double quotes, these words are
subject to word splitting. In contexts where word splitting
is not performed, such as the value portion of an assignment
statement, this expands to a single word with each
positional parameter separated by a space. When the
expansion occurs within double quotes, and word splitting is
performed, each parameter expands to a separate word. That
is, <b>&quot;$@&quot;</b> is equivalent to
<b>&quot;$1&quot;&nbsp;&quot;$2&quot;&nbsp;...</b> If the
double-quoted expansion occurs within a word, the expansion
of the first parameter is joined with the expansion of the
beginning part of the original word, and the expansion of
the last parameter is joined with the expansion of the last
part of the original word. When there are no positional
parameters, <b>&quot;$@&quot;</b> and <b>$@</b> expand to
nothing (i.e., they are removed).</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p><b>#</b></p></td>
<td width="8%"></td>
<td width="82%">
<p>(<b>$#</b>) Expands to the number of positional
parameters in decimal.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p><b>?</b></p></td>
<td width="8%"></td>
<td width="82%">
<p>(<b>$?</b>) Expands to the exit status of the most
recently executed command.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p><b>&minus;</b></p></td>
<td width="8%"></td>
<td width="82%">
<p>(<b>$&minus;</b>) Expands to the current option flags as
specified upon invocation, by the <b>set</b> builtin
command, or those set by the shell itself (such as the
<b>&minus;i</b> option).</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p><b>$</b></p></td>
<td width="8%"></td>
<td width="82%">
<p>(<b>$$</b>) Expands to the process ID of the shell. In a
subshell, it expands to the process ID of the parent shell,
not the subshell.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p><b>!</b></p></td>
<td width="8%"></td>
<td width="82%">
<p>(<b>$!</b>)Expands to the process ID of the job most
recently placed into the background, whether executed as an
asynchronous command or using the <b>bg</b> builtin (see
<b><small>JOB CONTROL</small></b> below).</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p><b>0</b></p></td>
<td width="8%"></td>
<td width="82%">
<p>(<b>$0</b>) Expands to the name of the shell or shell
script. This is set at shell initialization. If <b>bash</b>
is invoked with a file of commands, <b>$0</b> is set to the
name of that file. If <b>bash</b> is started with the
<b>&minus;c</b> option, then <b>$0</b> is set to the first
argument after the string to be executed, if one is present.
Otherwise, it is set to the filename used to invoke
<b>bash</b>, as given by argument zero.</p></td></tr>
</table>
<h3>Shell Variables
<a name="Shell Variables"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">The shell sets
following variables:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="5%">
<p style="margin-top: 1em"><b>_</b></p></td>
<td width="4%"></td>
<td width="82%">
<p style="margin-top: 1em">(<b>$_</b>, an underscore) This
has a number of meanings depending on context. At shell
startup, <b>_</b> is set to the pathname used to invoke the
shell or shell script being executed as passed in the
environment or argument list. Subsequently, it expands to
the last argument to the previous simple command executed in
the foreground, after expansion. It is also set to the full
pathname used to invoke each command executed and placed in
the environment exported to that command. When checking
mail, <b>$_</b> expands to the name of the mail file
currently being checked.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="5%">
<p><b>BASH</b></p></td>
<td width="4%"></td>
<td width="82%">
<p>Expands to the full filename used to invoke this
instance of <b>bash</b>.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>BASHOPTS</b></p>
<p style="margin-left:18%;">A colon-separated list of
enabled shell options. Each word in the list is a valid
argument for the <b>&minus;s</b> option to the <b>shopt</b>
builtin command (see <b><small>SHELL BUILTIN
COMMANDS</small></b> below). The options appearing in
<b><small>BASHOPTS</small></b> are those reported as
<i>on</i> by <b>shopt</b>. If this variable is in the
environment when <b>bash</b> starts up, the shell enables
each option in the list before reading any startup files. If
this variable is exported, child shells will enable each
option in the list. This variable is read-only.</p>
<p style="margin-left:9%;"><b>BASHPID</b></p>
<p style="margin-left:18%;">Expands to the process ID of
the current <b>bash</b> process. This differs from <b>$$</b>
under certain circumstances, such as subshells that do not
require <b>bash</b> to be re-initialized. Assignments to
<b><small>BASHPID</small></b> have no effect. If
<b><small>BASHPID</small></b> is unset, it loses its special
properties, even if it is subsequently reset.</p>
<p style="margin-left:9%;"><b>BASH_ALIASES</b></p>
<p style="margin-left:18%;">An associative array variable
whose members correspond to the internal list of aliases as
maintained by the <b>alias</b> builtin. Elements added to
this array appear in the alias list; however, unsetting
array elements currently does not remove aliases from the
alias list. If <b><small>BASH_ALIASES</small></b> is unset,
it loses its special properties, even if it is subsequently
reset.</p>
<p style="margin-left:9%;"><b>BASH_ARGC</b></p>
<p style="margin-left:18%;">An array variable whose values
are the number of parameters in each frame of the current
<b>bash</b> execution call stack. The number of parameters
to the current subroutine (shell function or script executed
with <b>.</b> or <b>source</b>) is at the top of the stack.
When a subroutine is executed, the number of parameters
passed is pushed onto
<b><small>BASH_ARGC</small></b><small>.</small> The shell
sets <b><small>BASH_ARGC</small></b> only when in extended
debugging mode (see the description of the <b>extdebug</b>
option to the <b>shopt</b> builtin below). Setting
<b>extdebug</b> after the shell has started to execute a
script, or referencing this variable when <b>extdebug</b> is
not set, may result in inconsistent values. Assignments to
<b><small>BASH_ARGC</small></b> have no effect, and it may
not be unset.</p>
<p style="margin-left:9%;"><b>BASH_ARGV</b></p>
<p style="margin-left:18%;">An array variable containing
all of the parameters in the current <b>bash</b> execution
call stack. The final parameter of the last subroutine call
is at the top of the stack; the first parameter of the
initial call is at the bottom. When a subroutine is
executed, the shell pushes the supplied parameters onto
<b><small>BASH_ARGV</small></b><small>.</small> The shell
sets <b><small>BASH_ARGV</small></b> only when in extended
debugging mode (see the description of the <b>extdebug</b>
option to the <b>shopt</b> builtin below). Setting
<b>extdebug</b> after the shell has started to execute a
script, or referencing this variable when <b>extdebug</b> is
not set, may result in inconsistent values. Assignments to
<b><small>BASH_ARGV</small></b> have no effect, and it may
not be unset.</p>
<p style="margin-left:9%;"><b>BASH_ARGV0</b></p>
<p style="margin-left:18%;">When referenced, this variable
expands to the name of the shell or shell script (identical
to <b>$0</b>; see the description of special parameter 0
above). Assigning a value to
<b><small>BASH_ARGV0</small></b> sets <b>$0</b> to the same
value. If <b><small>BASH_ARGV0</small></b> is unset, it
loses its special properties, even if it is subsequently
reset.</p>
<p style="margin-left:9%;"><b>BASH_CMDS</b></p>
<p style="margin-left:18%;">An associative array variable
whose members correspond to the internal hash table of
commands as maintained by the <b>hash</b> builtin. Adding
elements to this array makes them appear in the hash table;
however, unsetting array elements currently does not remove
command names from the hash table. If
<b><small>BASH_CMDS</small></b> is unset, it loses its
special properties, even if it is subsequently reset.</p>
<p style="margin-left:9%;"><b>BASH_COMMAND</b></p>
<p style="margin-left:18%;">Expands to the command
currently being executed or about to be executed, unless the
shell is executing a command as the result of a trap, in
which case it is the command executing at the time of the
trap. If <b><small>BASH_COMMAND</small></b> is unset, it
loses its special properties, even if it is subsequently
reset.</p>
<p style="margin-left:9%;"><b>BASH_EXECUTION_STRING</b></p>
<p style="margin-left:18%;">The command argument to the
<b>&minus;c</b> invocation option.</p>
<p style="margin-left:9%;"><b>BASH_LINENO</b></p>
<p style="margin-left:18%;">An array variable whose members
are the line numbers in source files where each
corresponding member of <b><small>FUNCNAME</small></b> was
invoked. <b>${BASH_LINENO[</b><i>$i</i><b>]}</b> is the line
number in the source file
(<b>${BASH_SOURCE[</b><i>$i+1</i><b>]}</b>) where
<b>${FUNCNAME[</b><i>$i</i><b>]}</b> was called (or
<b>${BASH_LINENO[</b><i>$i&minus;1</i><b>]}</b> if
referenced within another shell function). Use
<b><small>LINENO</small></b> to obtain the current line
number. Assignments to <b><small>BASH_LINENO</small></b>
have no effect, and it may not be unset.</p>
<p style="margin-left:9%;"><b>BASH_LOADABLES_PATH</b></p>
<p style="margin-left:18%;">A colon-separated list of
directories in which the <b>enable</b> command looks for
dynamically loadable builtins.</p>
<p style="margin-left:9%;"><b>BASH_MONOSECONDS</b></p>
<p style="margin-left:18%;">Each time this variable is
referenced, it expands to the value returned by the
system&rsquo;s monotonic clock, if one is available. If
there is no monotonic clock, this is equivalent to
<b>EPOCHSECONDS</b>. If
<b><small>BASH_MONOSECONDS</small></b> is unset, it loses
its special properties, even if it is subsequently
reset.</p>
<p style="margin-left:9%;"><b>BASH_REMATCH</b></p>
<p style="margin-left:18%;">An array variable whose members
are assigned by the <b>=~</b> binary operator to the
<b>[[</b> conditional command. The element with index 0 is
the portion of the string matching the entire regular
expression. The element with index <i>n</i> is the portion
of the string matching the <i>n</i>th parenthesized
subexpression.</p>
<p style="margin-left:9%;"><b>BASH_SOURCE</b></p>
<p style="margin-left:18%;">An array variable whose members
are the source filenames where the corresponding shell
function names in the <b><small>FUNCNAME</small></b> array
variable are defined. The shell function
<b>${FUNCNAME[</b><i>$i</i><b>]}</b> is defined in the file
<b>${BASH_SOURCE[</b><i>$i</i><b>]}</b> and called from
<b>${BASH_SOURCE[</b><i>$i+1</i><b>]}</b>. Assignments to
<b><small>BASH_SOURCE</small></b> have no effect, and it may
not be unset.</p>
<p style="margin-left:9%;"><b>BASH_SUBSHELL</b></p>
<p style="margin-left:18%;">Incremented by one within each
subshell or subshell environment when the shell begins
executing in that environment. The initial value is 0. If
<b><small>BASH_SUBSHELL</small></b> is unset, it loses its
special properties, even if it is subsequently reset.</p>
<p style="margin-left:9%;"><b>BASH_TRAPSIG</b></p>
<p style="margin-left:18%;">Set to the signal number
corresponding to the trap action being executed during its
execution. See the description of <b>trap</b> under
<b><small>SHELL BUILTIN COMMANDS</small></b> below for
information about signal numbers and trap execution.</p>
<p style="margin-left:9%;"><b>BASH_VERSINFO</b></p>
<p style="margin-left:18%;">A readonly array variable whose
members hold version information for this instance of
<b>bash</b>. The values assigned to the array members are as
follows:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="20%">
<p><b>BASH_VERSINFO[</b>0<b>]</b></p></td>
<td width="11%"></td>
<td width="50%">
<p>The major version number (the <i>release</i>).</p></td>
<td width="1%">
</td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="20%">
<p><b>BASH_VERSINFO[</b>1<b>]</b></p></td>
<td width="11%"></td>
<td width="50%">
<p>The minor version number (the <i>version</i>).</p></td>
<td width="1%">
</td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="20%">
<p><b>BASH_VERSINFO[</b>2<b>]</b></p></td>
<td width="11%"></td>
<td width="50%">
<p>The patch level.</p></td>
<td width="1%">
</td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="20%">
<p><b>BASH_VERSINFO[</b>3<b>]</b></p></td>
<td width="11%"></td>
<td width="50%">
<p>The build version.</p></td>
<td width="1%">
</td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="20%">
<p><b>BASH_VERSINFO[</b>4<b>]</b></p></td>
<td width="11%"></td>
<td width="50%">
<p>The release status (e.g., <i>beta</i>).</p></td>
<td width="1%">
</td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="20%">
<p><b>BASH_VERSINFO[</b>5<b>]</b></p></td>
<td width="11%"></td>
<td width="50%">
<p>The value of
<b><small>MACHTYPE</small></b><small>.</small></p> </td>
<td width="1%">
</td></tr>
</table>
<p style="margin-left:9%;"><b>BASH_VERSION</b></p>
<p style="margin-left:18%;">Expands to a string describing
the version of this instance of <b>bash</b> (e.g.,
5.2.37(3)-release).</p>
<p style="margin-left:9%;"><b>COMP_CWORD</b></p>
<p style="margin-left:18%;">An index into
<b>${COMP_WORDS}</b> of the word containing the current
cursor position. This variable is available only in shell
functions invoked by the programmable completion facilities
(see <b>Programmable Completion</b> below).</p>
<p style="margin-left:9%;"><b>COMP_KEY</b></p>
<p style="margin-left:18%;">The key (or final key of a key
sequence) used to invoke the current completion function.
This variable is available only in shell functions and
external commands invoked by the programmable completion
facilities (see <b>Programmable Completion</b> below).</p>
<p style="margin-left:9%;"><b>COMP_LINE</b></p>
<p style="margin-left:18%;">The current command line. This
variable is available only in shell functions and external
commands invoked by the programmable completion facilities
(see <b>Programmable Completion</b> below).</p>
<p style="margin-left:9%;"><b>COMP_POINT</b></p>
<p style="margin-left:18%;">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
<b>${#COMP_LINE}</b>. This variable is available only in
shell functions and external commands invoked by the
programmable completion facilities (see <b>Programmable
Completion</b> below).</p>
<p style="margin-left:9%;"><b>COMP_TYPE</b></p>
<p style="margin-left:18%;">Set to an integer value
corresponding to the type of attempted completion that
caused a completion function to be called: <i>TAB</i>, for
normal completion, <i>?</i>, for listing completions after
successive tabs, <i>!</i>, for listing alternatives on
partial word completion, <i>@</i>, to list completions if
the word is not unmodified, or <i>%</i>, for menu
completion. This variable is available only in shell
functions and external commands invoked by the programmable
completion facilities (see <b>Programmable Completion</b>
below).</p>
<p style="margin-left:9%;"><b>COMP_WORDBREAKS</b></p>
<p style="margin-left:18%;">The set of characters that the
<b>readline</b> library treats as word separators when
performing word completion. If
<b><small>COMP_WORDBREAKS</small></b> is unset, it loses its
special properties, even if it is subsequently reset.</p>
<p style="margin-left:9%;"><b>COMP_WORDS</b></p>
<p style="margin-left:18%;">An array variable (see
<b>Arrays</b> below) consisting of the individual words in
the current command line. The line is split into words as
<b>readline</b> would split it, using
<b><small>COMP_WORDBREAKS</small></b> as described above.
This variable is available only in shell functions invoked
by the programmable completion facilities (see
<b>Programmable Completion</b> below).</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>COPROC</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>An array variable (see <b>Arrays</b> below) created to
hold the file descriptors for output from and input to an
unnamed coprocess (see <b>Coprocesses</b> above).</p></td></tr>
</table>
<p style="margin-left:9%;"><b>DIRSTACK</b></p>
<p style="margin-left:18%;">An array variable (see
<b>Arrays</b> below) containing the current contents of the
directory stack. Directories appear in the stack in the
order they are displayed by the <b>dirs</b> builtin.
Assigning to members of this array variable may be used to
modify directories already in the stack, but the
<b>pushd</b> and <b>popd</b> builtins must be used to add
and remove directories. Assigning to this variable does not
change the current directory. If
<b><small>DIRSTACK</small></b> is unset, it loses its
special properties, even if it is subsequently reset.</p>
<p style="margin-left:9%;"><b>EPOCHREALTIME</b></p>
<p style="margin-left:18%;">Each time this parameter is
referenced, it expands to the number of seconds since the
Unix Epoch (see <i>time</i>(3)) as a floating-point value
with micro-second granularity. Assignments to
<b><small>EPOCHREALTIME</small></b> are ignored. If
<b><small>EPOCHREALTIME</small></b> is unset, it loses its
special properties, even if it is subsequently reset.</p>
<p style="margin-left:9%;"><b>EPOCHSECONDS</b></p>
<p style="margin-left:18%;">Each time this parameter is
referenced, it expands to the number of seconds since the
Unix Epoch (see <i>time</i>(3)). Assignments to
<b><small>EPOCHSECONDS</small></b> are ignored. If
<b><small>EPOCHSECONDS</small></b> is unset, it loses its
special properties, even if it is subsequently reset.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="5%">
<p><b>EUID</b></p></td>
<td width="4%"></td>
<td width="82%">
<p>Expands to the effective user ID of the current user,
initialized at shell startup. This variable is readonly.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>FUNCNAME</b></p>
<p style="margin-left:18%;">An array variable containing
the names of all shell functions currently in the execution
call stack. The element with index 0 is the name of any
currently-executing shell function. The bottom-most element
(the one with the highest index) is &ldquo;main&rdquo;. This
variable exists only when a shell function is executing.
Assignments to <b><small>FUNCNAME</small></b> have no
effect. If <b><small>FUNCNAME</small></b> is unset, it loses
its special properties, even if it is subsequently
reset.</p>
<p style="margin-left:18%; margin-top: 1em">This variable
can be used with <b><small>BASH_LINENO</small></b> and
<b><small>BASH_SOURCE</small></b><small>.</small> Each
element of <b><small>FUNCNAME</small></b> has corresponding
elements in <b><small>BASH_LINENO</small></b> and
<b><small>BASH_SOURCE</small></b> to describe the call
stack. For instance, <b>${FUNCNAME[</b><i>$i</i><b>]}</b>
was called from the file
<b>${BASH_SOURCE[</b><i>$i+1</i><b>]}</b> at line number
<b>${BASH_LINENO[</b><i>$i</i><b>]}</b>. The <b>caller</b>
builtin displays the current call stack using this
information.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>GROUPS</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>An array variable containing the list of groups of which
the current user is a member. Assignments to
<b><small>GROUPS</small></b> have no effect. If
<b><small>GROUPS</small></b> is unset, it loses its special
properties, even if it is subsequently reset.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>HISTCMD</b></p>
<p style="margin-left:18%;">The history number, or index in
the history list, of the current command. Assignments to
<b><small>HISTCMD</small></b> have no effect. If
<b><small>HISTCMD</small></b> is unset, it loses its special
properties, even if it is subsequently reset.</p>
<p style="margin-left:9%;"><b>HOSTNAME</b></p>
<p style="margin-left:18%;">Automatically set to the name
of the current host.</p>
<p style="margin-left:9%;"><b>HOSTTYPE</b></p>
<p style="margin-left:18%;">Automatically set to a string
that uniquely describes the type of machine on which
<b>bash</b> is executing. The default is
system-dependent.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>LINENO</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>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
<b><small>LINENO</small></b> is unset, it loses its special
properties, even if it is subsequently reset.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>MACHTYPE</b></p>
<p style="margin-left:18%;">Automatically set to a string
that fully describes the system type on which <b>bash</b> is
executing, in the standard GNU <i>cpu-company-system</i>
format. The default is system-dependent.</p>
<p style="margin-left:9%;"><b>MAPFILE</b></p>
<p style="margin-left:18%;">An array variable (see
<b>Arrays</b> below) created to hold the text read by the
<b>mapfile</b> builtin when no variable name is
supplied.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>OLDPWD</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>The previous working directory as set by the <b>cd</b>
command.</p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>OPTARG</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>The value of the last option argument processed by the
<b>getopts</b> builtin command (see <b><small>SHELL BUILTIN
COMMANDS</small></b> below).</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>OPTIND</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>The index of the next argument to be processed by the
<b>getopts</b> builtin command (see <b><small>SHELL BUILTIN
COMMANDS</small></b> below).</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>OSTYPE</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>Automatically set to a string that describes the
operating system on which <b>bash</b> is executing. The
default is system-dependent.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>PIPESTATUS</b></p>
<p style="margin-left:18%;">An array variable (see
<b>Arrays</b> below) containing a list of exit status values
from the commands in the most-recently-executed foreground
pipeline, which may consist of only a simple command (see
<b><small>SHELL GRAMMAR</small></b> above). <b>Bash</b> sets
<b><small>PIPESTATUS</small></b> after executing
multi-element pipelines, timed and negated pipelines, simple
commands, subshells created with the ( operator, the
<b>[[</b> and <b>((</b> compound commands, and after error
conditions that result in the shell aborting command
execution.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>PPID</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>The process ID of the shell&rsquo;s parent. This
variable is readonly.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>PWD</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>The current working directory as set by the <b>cd</b>
command.</p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>RANDOM</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>Each time this parameter is referenced, it expands to a
random integer between 0 and 32767. Assigning a value to
<b><small>RANDOM</small></b> initializes (seeds) the
sequence of random numbers. Seeding the random number
generator with the same constant value produces the same
sequence of values. If <b><small>RANDOM</small></b> is
unset, it loses its special properties, even if it is
subsequently reset.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>READLINE_ARGUMENT</b></p>
<p style="margin-left:18%;">Any numeric argument given to a
<b>readline</b> command that was defined using &ldquo;bind
&minus;x&rdquo; (see <b><small>SHELL BUILTIN
COMMANDS</small></b> below) when it was invoked.</p>
<p style="margin-left:9%;"><b>READLINE_LINE</b></p>
<p style="margin-left:18%;">The contents of the
<b>readline</b> line buffer, for use with &ldquo;bind
&minus;x&rdquo; (see <b><small>SHELL BUILTIN
COMMANDS</small></b> below).</p>
<p style="margin-left:9%;"><b>READLINE_MARK</b></p>
<p style="margin-left:18%;">The position of the mark (saved
insertion point) in the <b>readline</b> line buffer, for use
with &ldquo;bind &minus;x&rdquo; (see <b><small>SHELL
BUILTIN COMMANDS</small></b> below). The characters between
the insertion point and the mark are often called the
<i>region</i>.</p>
<p style="margin-left:9%;"><b>READLINE_POINT</b></p>
<p style="margin-left:18%;">The position of the insertion
point in the <b>readline</b> line buffer, for use with
&ldquo;bind &minus;x&rdquo; (see <b><small>SHELL BUILTIN
COMMANDS</small></b> below).</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>REPLY</b></p></td>
<td width="3%"></td>
<td width="82%">
<p>Set to the line of input read by the <b>read</b> builtin
command when no arguments are supplied.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>SECONDS</b></p>
<p style="margin-left:18%;">Each time this parameter is
referenced, it expands to the number of seconds since shell
invocation. If a value is assigned to
<b><small>SECONDS</small></b><small>,</small> the value
returned upon subsequent references is the number of seconds
since the assignment plus the value assigned. The number of
seconds at shell invocation and the current time are always
determined by querying the system clock at one-second
resolution. If <b><small>SECONDS</small></b> is unset, it
loses its special properties, even if it is subsequently
reset.</p>
<p style="margin-left:9%;"><b>SHELLOPTS</b></p>
<p style="margin-left:18%;">A colon-separated list of
enabled shell options. Each word in the list is a valid
argument for the <b>&minus;o</b> option to the <b>set</b>
builtin command (see <b><small>SHELL BUILTIN
COMMANDS</small></b> below). The options appearing in
<b><small>SHELLOPTS</small></b> are those reported as
<i>on</i> by <b>set &minus;o</b>. If this variable is in the
environment when <b>bash</b> starts up, the shell enables
each option in the list before reading any startup files. If
this variable is exported, child shells will enable each
option in the list. This variable is read-only.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>SHLVL</b></p></td>
<td width="3%"></td>
<td width="77%">
<p>Incremented by one each time an instance of <b>bash</b>
is started.</p></td>
<td width="5%">
</td></tr>
</table>
<p style="margin-left:9%;"><b>SRANDOM</b></p>
<p style="margin-left:18%;">Each time it is referenced,
this variable expands to a 32-bit pseudo-random number. The
random number generator is not linear on systems that
support <i>/dev/urandom</i> or <i>arc4random</i>(3), so each
returned number has no relationship to the numbers preceding
it. The random number generator cannot be seeded, so
assignments to this variable have no effect. If
<b><small>SRANDOM</small></b> is unset, it loses its special
properties, even if it is subsequently reset.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="4%">
<p><b>UID</b></p></td>
<td width="5%"></td>
<td width="82%">
<p>Expands to the user ID of the current user, initialized
at shell startup. This variable is readonly.</p></td></tr>
</table>
<p style="margin-left:9%; margin-top: 1em">The shell uses
the following variables. In some cases, <b>bash</b> assigns
a default value to a variable; these cases are noted below.
<b><br>
BASH_COMPAT</b></p>
<p style="margin-left:18%;">The value is used to set the
shell&rsquo;s compatibility level. See <b><small>SHELL
COMPATIBILITY MODE</small></b> below for a description of
the various compatibility levels and their effects. The
value may be a decimal number (e.g., 4.2) or an integer
(e.g., 42) corresponding to the desired compatibility level.
If <b><small>BASH_COMPAT</small></b> is unset or set to the
empty string, the compatibility level is set to the default
for the current version. If
<b><small>BASH_COMPAT</small></b> is set to a value that is
not one of the valid compatibility levels, the shell prints
an error message and sets the compatibility level to the
default for the current version. A subset of the valid
values correspond to the compatibility levels described
below under <b><small>SHELL COMPATIBILITY
MODE</small></b><small>.</small> For example, 4.2 and 42 are
valid values that correspond to the <b>compat42 shopt</b>
option and set the compatibility level to 42. The current
version is also a valid value.</p>
<p style="margin-left:9%;"><b>BASH_ENV</b></p>
<p style="margin-left:18%;">If this parameter is set when
<b>bash</b> is executing a shell script, its expanded value
is interpreted as a filename containing commands to
initialize the shell before it reads and executes commands
from the script. The value of <b><small>BASH_ENV</small></b>
is subjected to parameter expansion, command substitution,
and arithmetic expansion before being interpreted as a
filename. <b><small>PATH</small></b> is not used to search
for the resultant filename.</p>
<p style="margin-left:9%;"><b>BASH_XTRACEFD</b></p>
<p style="margin-left:18%;">If set to an integer
corresponding to a valid file descriptor, <b>bash</b> writes
the trace output generated when &ldquo;set &minus;x&rdquo;
is enabled to that file descriptor, instead of the standard
error. The file descriptor is closed when
<b><small>BASH_XTRACEFD</small></b> is unset or assigned a
new value. Unsetting <b><small>BASH_XTRACEFD</small></b> or
assigning it the empty string causes the trace output to be
sent to the standard error. Note that setting
<b><small>BASH_XTRACEFD</small></b> to 2 (the standard error
file descriptor) and then unsetting it will result in the
standard error being closed.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>CDPATH</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>The search path for the <b>cd</b> command. This is a
colon-separated list of directories where the shell looks
for directories specified as arguments to the <b>cd</b>
command. A sample value is &ldquo;.:~:/usr&rdquo;.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>CHILD_MAX</b></p>
<p style="margin-left:18%;">Set the number of exited child
status values for the shell to remember. <b>Bash</b> will
not allow this value to be decreased below a
<small>POSIX</small> -mandated minimum, and there is a
maximum value (currently 8192) that this may not exceed. The
minimum value is system-dependent.</p>
<p style="margin-left:9%;"><b>COLUMNS</b></p>
<p style="margin-left:18%;">Used by the <b>select</b>
compound command to determine the terminal width when
printing selection lists. Automatically set if the
<b>checkwinsize</b> option is enabled or in an interactive
shell upon receipt of a
<b><small>SIGWINCH</small></b><small>.</small></p>
<p style="margin-left:9%;"><b>COMPREPLY</b></p>
<p style="margin-left:18%;">An array variable from which
<b>bash</b> reads the possible completions generated by a
shell function invoked by the programmable completion
facility (see <b>Programmable Completion</b> below). Each
array element contains one possible completion.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>EMACS</b></p></td>
<td width="3%"></td>
<td width="82%">
<p>If <b>bash</b> finds this variable in the environment
when the shell starts with value &ldquo;t&rdquo;, it assumes
that the shell is running in an Emacs shell buffer and
disables line editing.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>ENV</b></p></td>
<td width="3%"></td>
<td width="82%">
<p>Expanded and executed similarly to
<b><small>BASH_ENV</small></b> (see
<b><small>INVOCATION</small></b> above) when an interactive
shell is invoked in posix mode.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>EXECIGNORE</b></p>
<p style="margin-left:18%;">A colon-separated list of shell
patterns (see <b>Pattern Matching</b>) defining the set of
filenames to be ignored by command search using
<b><small>PATH</small></b><small>.</small> Files whose full
pathnames match one of these patterns are not considered
executable files for the purposes of completion and command
execution via <b><small>PATH</small></b> lookup. This does
not affect the behavior of the <b>[</b>, <b>test</b>, and
<b>[[</b> commands. Full pathnames in the command hash table
are not subject to
<b><small>EXECIGNORE</small></b><small>.</small> Use this
variable to ignore shared library files that have the
executable bit set, but are not executable files. The
pattern matching honors the setting of the <b>extglob</b>
shell option.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>FCEDIT</b></p></td>
<td width="1%"></td>
<td width="59%">
<p>The default editor for the <b>fc</b> builtin
command.</p> </td>
<td width="23%">
</td></tr>
</table>
<p style="margin-left:9%;"><b>FIGNORE</b></p>
<p style="margin-left:18%;">A colon-separated list of
suffixes to ignore when performing filename completion (see
<b><small>READLINE</small></b> below). A filename whose
suffix matches one of the entries in
<b><small>FIGNORE</small></b> is excluded from the list of
matched filenames. A sample value is &ldquo;.o:~&rdquo;.</p>
<p style="margin-left:9%;"><b>FUNCNEST</b></p>
<p style="margin-left:18%;">If set to a numeric value
greater than 0, defines a maximum function nesting level.
Function invocations that exceed this nesting level cause
the current command to abort.</p>
<p style="margin-left:9%;"><b>GLOBIGNORE</b></p>
<p style="margin-left:18%;">A colon-separated list of
patterns defining the set of file names to be ignored by
pathname expansion. If a file name matched by a pathname
expansion pattern also matches one of the patterns in
<b><small>GLOBIGNORE</small></b><small>,</small> it is
removed from the list of matches. The pattern matching
honors the setting of the <b>extglob</b> shell option.</p>
<p style="margin-left:9%;"><b>GLOBSORT</b></p>
<p style="margin-left:18%;">Controls how the results of
pathname expansion are sorted. The value of this variable
specifies the sort criteria and sort order for the results
of pathname expansion. If this variable is unset or set to
the null string, pathname expansion uses the historical
behavior of sorting by name, in ascending lexicographic
order as determined by the <b><small>LC_COLLATE</small></b>
shell variable.</p>
<p style="margin-left:18%; margin-top: 1em">If set, a valid
value begins with an optional <i>+</i>, which is ignored, or
<i>&minus;</i>, which reverses the sort order from ascending
to descending, followed by a sort specifier. The valid sort
specifiers are <i>name</i>, <i>numeric</i>, <i>size</i>,
<i>mtime</i>, <i>atime</i>, <i>ctime</i>, and <i>blocks</i>,
which sort the files on name, names in numeric rather than
lexicographic order, file size, modification time, access
time, inode change time, and number of blocks, respectively.
If any of the non-name keys compare as equal (e.g., if two
files are the same size), sorting uses the name as a
secondary sort key.</p>
<p style="margin-left:18%; margin-top: 1em">For example, a
value of <i>&minus;mtime</i> sorts the results in descending
order by modification time (newest first).</p>
<p style="margin-left:18%; margin-top: 1em">The
<i>numeric</i> specifier treats names consisting solely of
digits as numbers and sorts them using their numeric value
(so &ldquo;2&rdquo; sorts before &ldquo;10&rdquo;, for
example). When using <i>numeric</i>, names containing
non-digits sort after all the all-digit names and are sorted
by name using the traditional behavior.</p>
<p style="margin-left:18%; margin-top: 1em">A sort
specifier of <i>nosort</i> disables sorting completely;
<b>bash</b> returns the results in the order they are read
from the file system, ignoring any leading
<i>&minus;</i>.</p>
<p style="margin-left:18%; margin-top: 1em">If the sort
specifier is missing, it defaults to <i>name</i>, so a value
of <i>+</i> is equivalent to the null string, and a value of
<i>-</i> sorts by name in descending order. Any invalid
value restores the historical sorting behavior.</p>
<p style="margin-left:9%;"><b>HISTCONTROL</b></p>
<p style="margin-left:18%;">A colon-separated list of
values controlling how commands are saved on the history
list. If the list of values includes <i>ignorespace</i>,
lines which begin with a <b>space</b> character are not
saved in the history list. A value of <i>ignoredups</i>
causes lines matching the previous history entry not to be
saved. A value of <i>ignoreboth</i> is shorthand for
<i>ignorespace</i> and <i>ignoredups</i>. A value of
<i>erasedups</i> causes all previous lines matching the
current line to be removed from the history list before that
line is saved. Any value not in the above list is ignored.
If <b><small>HISTCONTROL</small></b> is unset, or does not
include a valid value, <b>bash</b> saves all lines read by
the shell parser on the history list, subject to the value
of <b><small>HISTIGNORE</small></b><small>.</small> If the
first line of a multi-line compound command was saved, the
second and subsequent lines are not tested, and are added to
the history regardless of the value of
<b><small>HISTCONTROL</small></b><small>.</small> If the
first line was not saved, the second and subsequent lines of
the command are not saved either.</p>
<p style="margin-left:9%;"><b>HISTFILE</b></p>
<p style="margin-left:18%;">The name of the file in which
command history is saved (see <b><small>HISTORY</small></b>
below). <b>Bash</b> assigns a default value of
<A HREF="file:~/.bash_history"><i>~/.bash_history</i></A>. If <b><small>HISTFILE</small></b> is
unset or null, the shell does not save the command history
when it exits.</p>
<p style="margin-left:9%;"><b>HISTFILESIZE</b></p>
<p style="margin-left:18%;">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 the number of history
entries that total no more than that number of lines by
removing the oldest entries. If the history list contains
multi-line entries, the history file may contain more lines
than this maximum to avoid leaving partial history entries.
The history file is also truncated to this size after
writing it when a shell exits or by the <b>history</b>
builtin. If the value is 0, the history file is truncated to
zero size. Non-numeric values and numeric values less than
zero inhibit truncation. The shell sets the default value to
the value of <b><small>HISTSIZE</small></b> after reading
any startup files.</p>
<p style="margin-left:9%;"><b>HISTIGNORE</b></p>
<p style="margin-left:18%;">A colon-separated list of
patterns used to decide which command lines should be saved
on the history list. If a command line matches one of the
patterns in the value of
<b><small>HISTIGNORE</small></b><small>,</small> it is not
saved on the history list. Each pattern is anchored at the
beginning of the line and must match the complete line
(<b>bash</b> does not implicitly append a
&ldquo;<b>*</b>&rdquo;). Each pattern is tested against the
line after the checks specified by
<b><small>HISTCONTROL</small></b> are applied. In addition
to the normal shell pattern matching characters,
&ldquo;<b>&amp;</b>&rdquo; matches the previous history
line. A backslash escapes the &ldquo;<b>&amp;</b>&rdquo;;
the backslash is removed before attempting a match. If the
first line of a multi-line compound command was saved, the
second and subsequent lines are not tested, and are added to
the history regardless of the value of
<b><small>HISTIGNORE</small></b><small>.</small> If the
first line was not saved, the second and subsequent lines of
the command are not saved either. The pattern matching
honors the setting of the <b>extglob</b> shell option.
<b><small><br>
HISTIGNORE</small></b> subsumes some of the function of
<b><small>HISTCONTROL</small></b><small>.</small> A pattern
of &ldquo;&amp;&rdquo; is identical to
&ldquo;ignoredups&rdquo;, and a pattern of &ldquo;[
]*&rdquo; is identical to &ldquo;ignorespace&rdquo;.
Combining these two patterns, separating them with a colon,
provides the functionality of &ldquo;ignoreboth&rdquo;.</p>
<p style="margin-left:9%;"><b>HISTSIZE</b></p>
<p style="margin-left:18%;">The number of commands to
remember in the command history (see
<b><small>HISTORY</small></b> below). If the value is 0,
commands are not saved in the history list. Numeric values
less than zero result in every command being saved on the
history list (there is no limit). The shell sets the default
value to 500 after reading any startup files.</p>
<p style="margin-left:9%;"><b>HISTTIMEFORMAT</b></p>
<p style="margin-left:18%;">If this variable is set and not
null, its value is used as a format string for
<i>strftime</i>(3) to print the time stamp associated with
each history entry displayed by the <b>history</b> builtin.
If this variable is set, the shell writes time stamps to the
history file so they may be preserved across shell sessions.
This uses the history comment character to distinguish
timestamps from other history lines.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="5%">
<p><b>HOME</b></p></td>
<td width="4%"></td>
<td width="82%">
<p>The home directory of the current user; the default
argument for the <b>cd</b> builtin command. The value of
this variable is also used when performing tilde
expansion.</p> </td></tr>
</table>
<p style="margin-left:9%;"><b>HOSTFILE</b></p>
<p style="margin-left:18%;">Contains the name of a file in
the same format as <i>/etc/hosts</i> 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</b> adds the contents of
the new file to the existing list. If
<b><small>HOSTFILE</small></b> is set, but has no value, or
does not name a readable file, <b>bash</b> attempts to read
<i>/etc/hosts</i> to obtain the list of possible hostname
completions. When <b><small>HOSTFILE</small></b> is unset,
<b>bash</b> clears the hostname list.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="4%">
<p><b>IFS</b></p></td>
<td width="5%"></td>
<td width="82%">
<p>The <i>Internal Field Separator</i> that is used for
word splitting after expansion and to split lines into words
with the <b>read</b> builtin command. Word splitting is
described below under
<b><small>EXPANSION</small></b><small>.</small> The default
value is
&ldquo;&lt;space&gt;&lt;tab&gt;&lt;newline&gt;&rdquo;.</p> </td></tr>
</table>
<p style="margin-left:9%;"><b>IGNOREEOF</b></p>
<p style="margin-left:18%;">Controls the action of an
interactive shell on receipt of an <b><small>EOF</small></b>
character as the sole input. If set, the value is the number
of consecutive <b><small>EOF</small></b> characters which
must be typed as the first characters on an input line
before <b>bash</b> exits. If the variable is set but does
not have a numeric value, or the value is null, the default
value is 10. If it is unset, <b><small>EOF</small></b>
signifies the end of input to the shell.</p>
<p style="margin-left:9%;"><b>INPUTRC</b></p>
<p style="margin-left:18%;">The filename for the
<b>readline</b> startup file, overriding the default of
<A HREF="file:~/.inputrc"><i>~/.inputrc</i></A> (see <b><small>READLINE</small></b>
below).</p>
<p style="margin-left:9%;"><b>INSIDE_EMACS</b></p>
<p style="margin-left:18%;">If this variable appears in the
environment when the shell starts, <b>bash</b> assumes that
it is running inside an Emacs shell buffer and may disable
line editing, depending on the value of
<b><small>TERM</small></b><small>.</small></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>LANG</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>Used to determine the locale category for any category
not specifically selected with a variable starting with
<b>LC_</b>.</p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>LC_ALL</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>This variable overrides the value of
<b><small>LANG</small></b> and any other <b>LC_</b> variable
specifying a locale category.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>LC_COLLATE</b></p>
<p style="margin-left:18%;">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.</p>
<p style="margin-left:9%;"><b>LC_CTYPE</b></p>
<p style="margin-left:18%;">This variable determines the
interpretation of characters and the behavior of character
classes within pathname expansion and pattern matching.</p>
<p style="margin-left:9%;"><b>LC_MESSAGES</b></p>
<p style="margin-left:18%;">This variable determines the
locale used to translate double-quoted strings preceded by a
<b>$</b>.</p>
<p style="margin-left:9%;"><b>LC_NUMERIC</b></p>
<p style="margin-left:18%;">This variable determines the
locale category used for number formatting.</p>
<p style="margin-left:9%;"><b>LC_TIME</b></p>
<p style="margin-left:18%;">This variable determines the
locale category used for data and time formatting.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>LINES</b></p></td>
<td width="3%"></td>
<td width="82%">
<p>Used by the <b>select</b> compound command to determine
the column length for printing selection lists.
Automatically set if the <b>checkwinsize</b> option is
enabled or in an interactive shell upon receipt of a
<b><small>SIGWINCH</small></b><small>.</small></p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>MAIL</b></p></td>
<td width="3%"></td>
<td width="82%">
<p>If the value is set to a file or directory name and the
<b><small>MAILPATH</small></b> variable is not set,
<b>bash</b> informs the user of the arrival of mail in the
specified file or Maildir-format directory.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>MAILCHECK</b></p>
<p style="margin-left:18%;">Specifies how often (in
seconds) <b>bash</b> checks for mail. The default is 60
seconds. When it is time to check for mail, the shell does
so before displaying the primary prompt. If this variable is
unset, or set to a value that is not a number greater than
or equal to zero, the shell disables mail checking.</p>
<p style="margin-left:9%;"><b>MAILPATH</b></p>
<p style="margin-left:18%;">A colon-separated list of
filenames to be checked for mail. The message to be printed
when mail arrives in a particular file may be specified by
separating the filename from the message with a
&ldquo;?&rdquo;. When used in the text of the message,
<b>$_</b> expands to the name of the current mailfile. For
example: <b><br>
MAILPATH</b>='/var/mail/bfox?&quot;You have
mail&quot;:~/shell&minus;mail?&quot;$_ has mail!&quot;'
<b><br>
Bash</b> can be configured to supply a default value for
this variable (there is no value by default), but the
location of the user mail files that it uses is system
dependent (e.g., /var/mail/<b>$USER</b>).</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>OPTERR</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>If set to the value 1, <b>bash</b> displays error
messages generated by the <b>getopts</b> builtin command
(see <b><small>SHELL BUILTIN COMMANDS</small></b> below).
<b><small>OPTERR</small></b> is initialized to 1 each time
the shell is invoked or a shell script is executed.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>PATH</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>The search path for commands. It is a colon-separated
list of directories in which the shell looks for commands
(see <b><small>COMMAND EXECUTION</small></b> below). A
zero-length (null) directory name in the value of
<b><small>PATH</small></b> indicates the current directory.
A null directory name may appear as two adjacent colons, or
as an initial or trailing colon. The default path is
system-dependent, and is set by the administrator who
installs <b>bash</b>. A common value is</p></td></tr>
</table>
<p style="margin-left:24%;">/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin</p>
<p style="margin-left:9%;"><b>POSIXLY_CORRECT</b></p>
<p style="margin-left:18%;">If this variable is in the
environment when <b>bash</b> starts, the shell enters posix
mode before reading the startup files, as if the
<b>&minus;&minus;posix</b> invocation option had been
supplied. If it is set while the shell is running,
<b>bash</b> enables posix mode, as if the command &ldquo;set
&minus;o posix&rdquo; had been executed. When the shell
enters posix mode, it sets this variable if it was not
already set.</p>
<p style="margin-left:9%;"><b>PROMPT_COMMAND</b></p>
<p style="margin-left:18%;">If this variable is set, and is
an array, the value of each set element is executed as a
command prior to issuing each primary prompt. If this is set
but not an array variable, its value is used as a command to
execute instead.</p>
<p style="margin-left:9%;"><b>PROMPT_DIRTRIM</b></p>
<p style="margin-left:18%;">If set to a number greater than
zero, the value is used as the number of trailing directory
components to retain when expanding the <b>\w</b> and
<b>\W</b> prompt string escapes (see
<b><small>PROMPTING</small></b> below). Characters removed
are replaced with an ellipsis.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>PS0</b></p></td>
<td width="3%"></td>
<td width="82%">
<p>The value of this parameter is expanded (see
<b><small>PROMPTING</small></b> below) and displayed by
interactive shells after reading a command and before the
command is executed.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>PS1</b></p></td>
<td width="3%"></td>
<td width="82%">
<p>The value of this parameter is expanded (see
<b><small>PROMPTING</small></b> below) and used as the
primary prompt string. The default value is
&ldquo;\s&minus;\v\$&nbsp;&rdquo;.</p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>PS2</b></p></td>
<td width="3%"></td>
<td width="82%">
<p>The value of this parameter is expanded as with
<b><small>PS1</small></b> and used as the secondary prompt
string. The default is &ldquo;&gt;&nbsp;&rdquo;.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>PS3</b></p></td>
<td width="3%"></td>
<td width="82%">
<p>The value of this parameter is used as the prompt for
the <b>select</b> command (see <b><small>SHELL
GRAMMAR</small></b> above).</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>PS4</b></p></td>
<td width="3%"></td>
<td width="82%">
<p>The value of this parameter is expanded as with
<b><small>PS1</small></b> and the value is printed before
each command <b>bash</b> displays during an execution trace.
The first character of the expanded value of
<b><small>PS4</small></b> is replicated multiple times, as
necessary, to indicate multiple levels of indirection. The
default is &ldquo;+&nbsp;&rdquo;.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>SHELL</b></p></td>
<td width="3%"></td>
<td width="82%">
<p>This variable expands to the full pathname to the shell.
If it is not set when the shell starts, <b>bash</b> assigns
to it the full pathname of the current user&rsquo;s login
shell.</p> </td></tr>
</table>
<p style="margin-left:9%;"><b>TIMEFORMAT</b></p>
<p style="margin-left:18%;">The value of this parameter is
used as a format string specifying how the timing
information for pipelines prefixed with the <b>time</b>
reserved word should be displayed. The <b>%</b> character
introduces an escape sequence that is expanded to a time
value or other information. The escape sequences and their
meanings are as follows; the brackets denote optional
portions.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="10%">
<p><b>%%</b></p></td>
<td width="3%"></td>
<td width="60%">
<p>A literal <b>%</b>.</p></td>
<td width="9%">
</td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="10%">
<p><b>%[</b><i>p</i><b>][l]R</b></p></td>
<td width="3%"></td>
<td width="60%">
<p>The elapsed time in seconds.</p></td>
<td width="9%">
</td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="10%">
<p><b>%[</b><i>p</i><b>][l]U</b></p></td>
<td width="3%"></td>
<td width="60%">
<p>The number of CPU seconds spent in user mode.</p></td>
<td width="9%">
</td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="10%">
<p><b>%[</b><i>p</i><b>][l]S</b></p></td>
<td width="3%"></td>
<td width="60%">
<p>The number of CPU seconds spent in system mode.</p></td>
<td width="9%">
</td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="10%">
<p><b>%P</b></p></td>
<td width="3%"></td>
<td width="60%">
<p>The CPU percentage, computed as (%U + %S) / %R.</p></td>
<td width="9%">
</td></tr>
</table>
<p style="margin-left:18%; margin-top: 1em">The optional
<i>p</i> is a digit specifying the <i>precision</i>, the
number of fractional digits after a decimal point. A value
of 0 causes no decimal point or fraction to be output.
<b>time</b> prints at most six digits after the decimal
point; values of <i>p</i> greater than 6 are changed to 6.
If <i>p</i> is not specified, <b>time</b> prints three
digits after the decimal point.</p>
<p style="margin-left:18%; margin-top: 1em">The optional
<b>l</b> specifies a longer format, including minutes, of
the form <i>MM</i>m<i>SS</i>.<i>FF</i>s. The value of
<i>p</i> determines whether or not the fraction is
included.</p>
<p style="margin-left:18%; margin-top: 1em">If this
variable is not set, <b>bash</b> acts as if it had the value
<b>$'\nreal\t%3lR\nuser\t%3lU\nsys\t%3lS'</b>. If the value
is null, <b>bash</b> does not display any timing
information. A trailing newline is added when the format
string is displayed.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p style="margin-top: 1em"><b>TMOUT</b></p></td>
<td width="1%"></td>
<td width="82%">
<p style="margin-top: 1em">If set to a value greater than
zero, the <b>read</b> builtin uses the value as its default
timeout. The <b>select</b> command terminates if input does
not arrive after <b><small>TMOUT</small></b> seconds when
input is coming from a terminal. In an interactive shell,
the value is interpreted as the number of seconds to wait
for a line of input after issuing the primary prompt.
<b>Bash</b> terminates after waiting for that number of
seconds if a complete line of input does not arrive.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>TMPDIR</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>If set, <b>bash</b> uses its value as the name of a
directory in which <b>bash</b> creates temporary files for
the shell&rsquo;s use.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>auto_resume</b></p>
<p style="margin-left:18%;">This variable controls how the
shell interacts with the user and job control. If this
variable is set, simple commands consisting of only a single
word, without redirections, are treated as candidates for
resumption of an existing stopped job. There is no ambiguity
allowed; if there is more than one job beginning with or
containing the word, this selects the most recently accessed
job. The <i>name</i> of a stopped job, in this context, is
the command line used to start it, as displayed by
<b>jobs</b>. If set to the value <i>exact</i>, the word must
match the name of a stopped job exactly; if set to
<i>substring</i>, the word needs to match a substring of the
name of a stopped job. The <i>substring</i> value provides
functionality analogous to the <b>%?</b> job identifier (see
<b><small>JOB CONTROL</small></b> below). If set to any
other value (e.g., <i>prefix</i>), the word must be a prefix
of a stopped job&rsquo;s name; this provides functionality
analogous to the <b>%</b><i>string</i> job identifier.</p>
<p style="margin-left:9%;"><b>histchars</b></p>
<p style="margin-left:18%;">The two or three characters
which control history expansion, quick substitution, and
tokenization (see <b><small>HISTORY EXPANSION</small></b>
below). The first character is the <i>history expansion</i>
character, the character which begins a history expansion,
normally &ldquo;<b>!</b>&rdquo;. The second character is the
<i>quick substitution</i> character, normally
&ldquo;<b>^</b>&rdquo;. When it appears as the first
character on the line, history substitution repeats the
previous command, replacing one string with another. The
optional third character is the <i>history comment</i>
character, normally &ldquo;<b>#</b>&rdquo;, which indicates
that the remainder of the line is a comment when it appears
as the first character of a word. The history comment
character disables history substitution 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.</p>
<h3>Arrays
<a name="Arrays"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em"><b>Bash</b>
provides one-dimensional indexed and associative array
variables. Any variable may be used as an indexed array; the
<b>declare</b> builtin explicitly declares an array. There
is no maximum limit on the size of an array, nor any
requirement that members be indexed or assigned
contiguously. Indexed arrays are referenced using arithmetic
expressions that must expand to an integer (see
<b><small>ARITHMETIC EVALUATION</small></b> below) and are
zero-based; associative arrays are referenced using
arbitrary strings. Unless otherwise noted, indexed array
indices must be non-negative integers.</p>
<p style="margin-left:9%; margin-top: 1em">The shell
performs parameter and variable expansion, arithmetic
expansion, command substitution, and quote removal on
indexed array subscripts. Since this can potentially result
in empty strings, subscript indexing treats those as
expressions that evaluate to 0.</p>
<p style="margin-left:9%; margin-top: 1em">The shell
performs tilde expansion, parameter and variable expansion,
arithmetic expansion, command substitution, and quote
removal on associative array subscripts. Empty strings
cannot be used as associative array keys.</p>
<p style="margin-left:9%; margin-top: 1em"><b>Bash</b>
automatically creates an indexed array if any variable is
assigned to using the syntax</p>
<p style="margin-left:18%;"><i>name</i>[<i>subscript</i>]=<i>value</i>
.</p>
<p style="margin-left:9%;">The <i>subscript</i> is treated
as an arithmetic expression that must evaluate to a number
greater than or equal to zero. To explicitly declare an
indexed array, use</p>
<p style="margin-left:18%;"><b>declare
&minus;a&nbsp;</b><i>name</i></p>
<p style="margin-left:9%;">(see <b><small>SHELL BUILTIN
COMMANDS</small></b> below).</p>
<p style="margin-left:18%;"><b>declare &minus;a</b>
<i>name</i>[<i>subscript</i>]</p>
<p style="margin-left:9%;">is also accepted; the
<i>subscript</i> is ignored.</p>
<p style="margin-left:9%; margin-top: 1em">Associative
arrays are created using</p>
<p style="margin-left:18%;"><b>declare
&minus;A&nbsp;</b><i>name</i></p>
<p style="margin-left:9%;">.</p>
<p style="margin-left:9%; margin-top: 1em">Attributes may
be specified for an array variable using the <b>declare</b>
and <b>readonly</b> builtins. Each attribute applies to all
members of an array.</p>
<p style="margin-left:9%; margin-top: 1em">Arrays are
assigned using compound assignments of the form
<i>name</i>=<b>(</b>value<i>1</i> ... value<i>n</i><b>)</b>,
where each <i>value</i> may be of the form
[<i>subscript</i>]=<i>string</i>. Indexed array assignments
do not require anything but <i>string</i>. Each <i>value</i>
in the list is expanded using the shell expansions described
below under <b><small>EXPANSION</small></b><small>,</small>
but <i>value</i>s that are valid variable assignments
including the brackets and subscript do not undergo brace
expansion and word splitting, as with individual variable
assignments.</p>
<p style="margin-left:9%; margin-top: 1em">When assigning
to indexed arrays, if the optional brackets and subscript
are supplied, that index is assigned to; otherwise the index
of the element assigned is the last index assigned to by the
statement plus one. Indexing starts at zero.</p>
<p style="margin-left:9%; margin-top: 1em">When assigning
to an associative array, the words in a compound assignment
may be either assignment statements, for which the subscript
is required, or a list of words that is interpreted as a
sequence of alternating keys and values:
<i>name</i>=<b>(</b> <i>key1 value1 key2 value2</i>
...<b>)</b>. These are treated identically to
<i>name</i>=<b>(</b> [<i>key1</i>]=<i>value1</i>
[<i>key2</i>]=<i>value2</i> ...<b>)</b>. The first word in
the list determines how the remaining words are interpreted;
all assignments in a list must be of the same type. When
using key/value pairs, the keys may not be missing or empty;
a final missing value is treated like the empty string.</p>
<p style="margin-left:9%; margin-top: 1em">This syntax is
also accepted by the <b>declare</b> builtin. Individual
array elements may be assigned to using the
<i>name</i>[<i>subscript</i>]=<i>value</i> syntax introduced
above.</p>
<p style="margin-left:9%; margin-top: 1em">When assigning
to an indexed array, if <i>name</i> is subscripted by a
negative number, that number is interpreted as relative to
one greater than the maximum index of <i>name</i>, so
negative indices count back from the end of the array, and
an index of &minus;1 references the last element.</p>
<p style="margin-left:9%; margin-top: 1em">The
&ldquo;+=&rdquo; operator appends to an array variable when
assigning using the compound assignment syntax; see
<b><small>PARAMETERS</small></b> above.</p>
<p style="margin-left:9%; margin-top: 1em">An array element
is referenced using ${<i>name</i>[<i>subscript</i>]}. The
braces are required to avoid conflicts with pathname
expansion. If <i>subscript</i> is <b>@</b> or <b>*</b>, the
word expands to all members of <i>name</i>, unless noted in
the description of a builtin or word expansion. These
subscripts differ only when the word appears within double
quotes. If the word is double-quoted, ${<i>name</i>[*]}
expands to a single word with the value of each array member
separated by the first character of the
<b><small>IFS</small></b> special variable, and
${<i>name</i>[@]} expands each element of <i>name</i> to a
separate word. When there are no array members,
${<i>name</i>[@]} expands to nothing. If the double-quoted
expansion occurs within a word, the expansion of the first
parameter is joined with the beginning part of the expansion
of the original word, and the expansion of the last
parameter is joined with the last part of the expansion of
the original word. This is analogous to the expansion of the
special parameters <b>*</b> and <b>@</b> (see <b>Special
Parameters</b> above).</p>
<p style="margin-left:9%; margin-top: 1em">${#<i>name</i>[<i>subscript</i>]}
expands to the length of ${<i>name</i>[<i>subscript</i>]}.
If <i>subscript</i> is <b>*</b> or <b>@</b>, the expansion
is the number of elements in the array.</p>
<p style="margin-left:9%; margin-top: 1em">If the
<i>subscript</i> used to reference an element of an indexed
array evaluates to a number less than zero, it is
interpreted as relative to one greater than the maximum
index of the array, so negative indices count back from the
end of the array, and an index of &minus;1 references the
last element.</p>
<p style="margin-left:9%; margin-top: 1em">Referencing an
array variable without a subscript is equivalent to
referencing the array with a subscript of 0. Any reference
to a variable using a valid subscript is valid; <b>bash</b>
creates an array if necessary.</p>
<p style="margin-left:9%; margin-top: 1em">An array
variable is considered set if a subscript has been assigned
a value. The null string is a valid value.</p>
<p style="margin-left:9%; margin-top: 1em">It is possible
to obtain the keys (indices) of an array as well as the
values. ${<b>!</b><i>name</i>[<i>@</i>]} and
${<b>!</b><i>name</i>[<i>*</i>]} expand to the indices
assigned in array variable <i>name</i>. The treatment when
in double quotes is similar to the expansion of the special
parameters <i>@</i> and <i>*</i> within double quotes.</p>
<p style="margin-left:9%; margin-top: 1em">The <b>unset</b>
builtin is used to destroy arrays. <b>unset</b>
<i>name</i>[<i>subscript</i>] unsets the array element at
index <i>subscript</i>, for both indexed and associative
arrays. Negative subscripts to indexed arrays are
interpreted as described above. Unsetting the last element
of an array variable does not unset the variable.
<b>unset</b> <i>name</i>, where <i>name</i> is an array,
removes the entire array. <b>unset</b>
<i>name</i>[<i>subscript</i>] behaves differently depending
on whether <i>name</i> is an indexed or associative array
when <i>subscript</i> is <b>*</b> or <b>@</b>. If
<i>name</i> is an associative array, this unsets the element
with subscript <b>*</b> or <b>@</b>. If <i>name</i> is an
indexed array, unset removes all of the elements but does
not remove the array itself.</p>
<p style="margin-left:9%; margin-top: 1em">When using a
variable name with a subscript as an argument to a command,
such as with <b>unset</b>, without using the word expansion
syntax described above, (e.g., unset a[4]), the argument is
subject to pathname expansion. Quote the argument if
pathname expansion is not desired (e.g., unset 'a[4]').</p>
<p style="margin-left:9%; margin-top: 1em">The
<b>declare</b>, <b>local</b>, and <b>readonly</b> builtins
each accept a <b>&minus;a</b> option to specify an indexed
array and a <b>&minus;A</b> option to specify an associative
array. If both options are supplied, <b>&minus;A</b> takes
precedence. The <b>read</b> builtin accepts a
<b>&minus;a</b> option to assign a list of words read from
the standard input to an array. The <b>set</b> and
<b>declare</b> builtins display array values in a way that
allows them to be reused as assignments. Other builtins
accept array name arguments as well (e.g., <b>mapfile</b>);
see the descriptions of individual builtins below for
details. The shell provides a number of builtin array
variables.</p>
<h2>EXPANSION
<a name="EXPANSION"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">Expansion is
performed on the command line after it has been split into
words. The shell performs these expansions: <i>brace
expansion</i>, <i>tilde expansion</i>, <i>parameter and
variable expansion</i>, <i>command substitution</i>,
<i>arithmetic expansion</i>, <i>word splitting</i>,
<i>pathname expansion</i>, and <i>quote removal</i>.</p>
<p style="margin-left:9%; margin-top: 1em">The order of
expansions is: brace expansion; tilde expansion, parameter
and variable expansion, arithmetic expansion, and command
substitution (done in a left-to-right fashion); word
splitting; pathname expansion; and quote removal.</p>
<p style="margin-left:9%; margin-top: 1em">On systems that
can support it, there is an additional expansion available:
<i>process substitution</i>. This is performed at the same
time as tilde, parameter, variable, and arithmetic expansion
and command substitution.</p>
<p style="margin-left:9%; margin-top: 1em"><i>Quote
removal</i> is always performed last. It removes quote
characters present in the original word, not ones resulting
from one of the other expansions, unless they have been
quoted themselves.</p>
<p style="margin-left:9%; margin-top: 1em">Only brace
expansion, word splitting, and pathname expansion can
increase the number of words of the expansion; other
expansions expand a single word to a single word. The only
exceptions to this are the expansions of
<b>&quot;$@&quot;</b> and
<b>&quot;${</b><i>name</i><b>[@]}&quot;</b>, and, in most
cases, <b>$*</b> and <b>${</b><i>name</i><b>[*]}</b> as
explained above (see
<b><small>PARAMETERS</small></b><small>).</small></p>
<h3>Brace Expansion
<a name="Brace Expansion"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em"><i>Brace
expansion</i> is a mechanism to generate arbitrary strings
sharing a common prefix and suffix, either of which can be
empty. This mechanism is similar to <i>pathname
expansion</i>, but the filenames generated need not exist.
Patterns to be brace expanded are formed from an optional
<i>preamble</i>, followed by either a series of
comma-separated strings or a sequence expression between a
pair of braces, followed by an optional <i>postscript</i>.
The preamble is prefixed to each string contained within the
braces, and the postscript is then appended to each
resulting string, expanding left to right.</p>
<p style="margin-left:9%; margin-top: 1em">Brace expansions
may be nested. The results of each expanded string are not
sorted; brace expansion preserves left to right order. For
example, a<b>{</b>d,c,b<b>}</b>e expands into &ldquo;ade ace
abe&rdquo;.</p>
<p style="margin-left:9%; margin-top: 1em">A sequence
expression takes the form
<i>x</i><b>..</b><i>y</i><b>[..</b><i>incr</i><b>]</b>,
where <i>x</i> and <i>y</i> are either integers or single
letters, and <i>incr</i>, an optional increment, is an
integer. When integers are supplied, the expression expands
to each number between <i>x</i> and <i>y</i>, inclusive. If
either <i>x</i> or <i>y</i> begins with a zero, each
generated term will contain the same number of digits,
zero-padding where necessary. When letters are supplied, the
expression expands to each character lexicographically
between <i>x</i> and <i>y</i>, inclusive, using the C
locale. Note that both <i>x</i> and <i>y</i> must be of the
same type (integer or letter). When the increment is
supplied, it is used as the difference between each term.
The default increment is 1 or &minus;1 as appropriate.</p>
<p style="margin-left:9%; margin-top: 1em">Brace expansion
is performed before any other expansions, and any characters
special to other expansions are preserved in the result. It
is strictly textual. <b>Bash</b> does not apply any
syntactic interpretation to the context of the expansion or
the text between the braces.</p>
<p style="margin-left:9%; margin-top: 1em">A
correctly-formed brace expansion must contain unquoted
opening and closing braces, and at least one unquoted comma
or a valid sequence expression. Any incorrectly formed brace
expansion is left unchanged.</p>
<p style="margin-left:9%; margin-top: 1em">A
&ldquo;{&rdquo; or Q , may be quoted with a backslash to
prevent its being considered part of a brace expression. To
avoid conflicts with parameter expansion, the string
&ldquo;${&rdquo; is not considered eligible for brace
expansion, and inhibits brace expansion until the closing
&ldquo;}&rdquo;.</p>
<p style="margin-left:9%; margin-top: 1em">This construct
is typically used as shorthand when the common prefix of the
strings to be generated is longer than in the above
example:</p>
<p style="margin-left:18%; margin-top: 1em">mkdir
/usr/local/src/bash/{old,new,dist,bugs}</p>
<p style="margin-left:9%;">or</p>
<p style="margin-left:18%;">chown root
/usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}</p>
<p style="margin-left:9%; margin-top: 1em">Brace expansion
introduces a slight incompatibility with historical versions
of <b>sh</b>. <b>sh</b> does not treat opening or closing
braces specially when they appear as part of a word, and
preserves them in the output. <b>Bash</b> removes braces
from words as a consequence of brace expansion. For example,
a word entered to <b>sh</b> as &ldquo;file{1,2}&rdquo;
appears identically in the output. <b>Bash</b> outputs that
word as &ldquo;file1 file2&rdquo; after brace expansion.
Start <b>bash</b> with the <b>+B</b> option or disable brace
expansion with the <b>+B</b> option to the <b>set</b>
command (see <b><small>SHELL BUILTIN COMMANDS</small></b>
below) for strict <b>sh</b> compatibility.</p>
<h3>Tilde Expansion
<a name="Tilde Expansion"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">If a word begins
with an unquoted tilde character (&ldquo;<b>~</b>&rdquo;),
all of the characters preceding the first unquoted slash (or
all characters, if there is no unquoted slash) are
considered a <i>tilde-prefix</i>. If none of the characters
in the tilde-prefix are quoted, the characters in the
tilde-prefix following the tilde are treated as a possible
<i>login name</i>. If this login name is the null string,
the tilde is replaced with the value of the shell parameter
<b><small>HOME</small></b><small>.</small> If
<b><small>HOME</small></b> is unset, the tilde expands to
the home directory of the user executing the shell instead.
Otherwise, the tilde-prefix is replaced with the home
directory associated with the specified login name.</p>
<p style="margin-left:9%; margin-top: 1em">If the
tilde-prefix is a &ldquo;~+&rdquo;, the value of the shell
variable <b><small>PWD</small></b> replaces the
tilde-prefix. If the tilde-prefix is a
&ldquo;~&minus;&rdquo;, the shell substitutes the value of
the shell variable
<b><small>OLDPWD</small></b><small>,</small> if it is set.
If the characters following the tilde in the tilde-prefix
consist of a number <i>N</i>, optionally prefixed by a
&ldquo;+&rdquo; or a &ldquo;&minus;&rdquo;, the tilde-prefix
is replaced with the corresponding element from the
directory stack, as it would be displayed by the <b>dirs</b>
builtin invoked with the characters following the tilde in
the tilde-prefix as an argument. If the characters following
the tilde in the tilde-prefix consist of a number without a
leading &ldquo;+&rdquo; or &ldquo;&minus;&rdquo;, tilde
expansion assumes &ldquo;+&rdquo;.</p>
<p style="margin-left:9%; margin-top: 1em">The results of
tilde expansion are treated as if they were quoted, so the
replacement is not subject to word splitting and pathname
expansion.</p>
<p style="margin-left:9%; margin-top: 1em">If the login
name is invalid, or the tilde expansion fails, the
tilde-prefix is unchanged.</p>
<p style="margin-left:9%; margin-top: 1em"><b>Bash</b>
checks each variable assignment for unquoted tilde-prefixes
immediately following a <b>:</b> or the first <b>=</b>, and
performs tilde expansion in these cases. Consequently, one
may use filenames with tildes in assignments to
<b><small>PATH</small></b><small>, <b>MAILPATH</b>,</small>
and <b><small>CDPATH</small></b><small>,</small> and the
shell assigns the expanded value.</p>
<p style="margin-left:9%; margin-top: 1em"><b>Bash</b> also
performs tilde expansion on words satisfying the conditions
of variable assignments (as described above under
<b><small>PARAMETERS</small></b><small>)</small> when they
appear as arguments to simple commands. <b>Bash</b> does not
do this, except for the <i>declaration</i> commands listed
above, when in posix mode.</p>
<h3>Parameter Expansion
<a name="Parameter Expansion"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">The
&ldquo;<b>$</b>&rdquo; character introduces parameter
expansion, command substitution, or arithmetic expansion.
The parameter name or symbol to be expanded may be enclosed
in braces, which are optional but serve to protect the
variable to be expanded from characters immediately
following it which could be interpreted as part of the
name.</p>
<p style="margin-left:9%; margin-top: 1em">When braces are
used, the matching ending brace is the first
&ldquo;<b>}</b>&rdquo; not escaped by a backslash or within
a quoted string, and not within an embedded arithmetic
expansion, command substitution, or parameter expansion.</p>
<p style="margin-left:9%; margin-top: 1em">The basic form
of parameter expansion is</p>
<p style="margin-left:9%; margin-top: 1em">${<i>parameter</i>}</p>
<p style="margin-left:9%; margin-top: 1em">which
substitutes the value of <i>parameter</i>. The braces are
required when <i>parameter</i> is a positional parameter
with more than one digit, or when <i>parameter</i> is
followed by a character which is not to be interpreted as
part of its name. The <i>parameter</i> is a shell parameter
as described above <b>PARAMETERS</b>) or an array reference
(<b>Arrays</b>).</p>
<p style="margin-left:9%; margin-top: 1em">If the first
character of <i>parameter</i> is an exclamation point
(<b>!</b>), and <i>parameter</i> is not a <i>nameref</i>, it
introduces a level of indirection. <b>Bash</b> uses the
value formed by expanding the rest of <i>parameter</i> as
the new <i>parameter</i>; this new parameter is then
expanded and that value is used in the rest of the
expansion, rather than the expansion of the original
<i>parameter</i>. This is known as <i>indirect
expansion</i>. The value is subject to tilde expansion,
parameter expansion, command substitution, and arithmetic
expansion. If <i>parameter</i> is a nameref, this expands to
the name of the parameter referenced by <i>parameter</i>
instead of performing the complete indirect expansion, for
compatibility. The exceptions to this are the expansions of
${<b>!</b><i>prefix</i><b>*</b>} and
${<b>!</b><i>name</i>[<i>@</i>]} described below. The
exclamation point must immediately follow the left brace in
order to introduce indirection.</p>
<p style="margin-left:9%; margin-top: 1em">In each of the
cases below, <i>word</i> is subject to tilde expansion,
parameter expansion, command substitution, and arithmetic
expansion.</p>
<p style="margin-left:9%; margin-top: 1em">When not
performing substring expansion, using the forms documented
below (e.g., <b>:-</b>), <b>bash</b> tests for a parameter
that is unset or null. Omitting the colon tests only for a
parameter that is unset. <br>
${<i>parameter</i><b>:&minus;</b><i>word</i>}</p>
<p style="margin-left:18%;"><b>Use Default Values</b>. If
<i>parameter</i> is unset or null, the expansion of
<i>word</i> is substituted. Otherwise, the value of
<i>parameter</i> is substituted.</p>
<p style="margin-left:9%;">${<i>parameter</i><b>:=</b><i>word</i>}</p>
<p style="margin-left:18%;"><b>Assign Default Values</b>.
If <i>parameter</i> is unset or null, the expansion of
<i>word</i> is assigned to <i>parameter</i>, and the
expansion is the final value of <i>parameter</i>. Positional
parameters and special parameters may not be assigned in
this way.</p>
<p style="margin-left:9%;">${<i>parameter</i><b>:?</b><i>word</i>}</p>
<p style="margin-left:18%;"><b>Display Error if Null or
Unset</b>. If <i>parameter</i> is null or unset, the shell
writes the expansion of <i>word</i> (or a message to that
effect if <i>word</i> is not present) to the standard error
and, if it is not interactive, exits with a non-zero status.
An interactive shell does not exit, but does not execute the
command associated with the expansion. Otherwise, the value
of <i>parameter</i> is substituted.</p>
<p style="margin-left:9%;">${<i>parameter</i><b>:+</b><i>word</i>}</p>
<p style="margin-left:18%;"><b>Use Alternate Value</b>. If
<i>parameter</i> is null or unset, nothing is substituted,
otherwise the expansion of <i>word</i> is substituted. The
value of <i>parameter</i> is not used.</p>
<p style="margin-left:9%;">${<i>parameter</i><b>:</b><i>offset</i>}
<br>
${<i>parameter</i><b>:</b><i>offset</i><b>:</b><i>length</i>}</p>
<p style="margin-left:18%;"><b>Substring Expansion</b>.
Expands to up to <i>length</i> characters of the value of
<i>parameter</i> starting at the character specified by
<i>offset</i>. If <i>parameter</i> is <b>@</b> or <b>*</b>,
an indexed array subscripted by <b>@</b> or <b>*</b>, or an
associative array name, the results differ as described
below. If <b>:</b><i>length</i> is omitted (the first form
above), this expands to the substring of the value of
<i>parameter</i> starting at the character specified by
<i>offset</i> and extending to the end of the value. If
<i>offset</i> is omitted, it is treated as 0. If
<i>length</i> is omitted, but the colon after <i>offset</i>
is present, it is treated as 0. <i>length</i> and
<i>offset</i> are arithmetic expressions (see
<b><small>ARITHMETIC EVALUATION</small></b> below).</p>
<p style="margin-left:18%; margin-top: 1em">If
<i>offset</i> evaluates to a number less than zero, the
value is used as an offset in characters from the end of the
value of <i>parameter</i>. If <i>length</i> evaluates to a
number less than zero, it is interpreted as an offset in
characters from the end of the value of <i>parameter</i>
rather than a number of characters, and the expansion is the
characters between <i>offset</i> and that result. Note that
a negative offset must be separated from the colon by at
least one space to avoid being confused with the <b>:-</b>
expansion.</p>
<p style="margin-left:18%; margin-top: 1em">If
<i>parameter</i> is <b>@</b> or <b>*</b>, the result is
<i>length</i> positional parameters beginning at
<i>offset</i>. A negative <i>offset</i> is taken relative to
one greater than the greatest positional parameter, so an
offset of &minus;1 evaluates to the last positional
parameter (or 0 if there are no positional parameters). It
is an expansion error if <i>length</i> evaluates to a number
less than zero.</p>
<p style="margin-left:18%; margin-top: 1em">If
<i>parameter</i> is an indexed array name subscripted by @
or *, the result is the <i>length</i> members of the array
beginning with ${<i>parameter</i>[<i>offset</i>]}. A
negative <i>offset</i> is taken relative to one greater than
the maximum index of the specified array. It is an expansion
error if <i>length</i> evaluates to a number less than
zero.</p>
<p style="margin-left:18%; margin-top: 1em">Substring
expansion applied to an associative array produces undefined
results.</p>
<p style="margin-left:18%; margin-top: 1em">Substring
indexing is zero-based unless the positional parameters are
used, in which case the indexing starts at 1 by default. If
<i>offset</i> is 0, and the positional parameters are used,
<b>$0</b> is prefixed to the list.</p>
<p style="margin-left:9%;">${<b>!</b><i>prefix</i><b>*</b>}
<br>
${<b>!</b><i>prefix</i><b>@</b>}</p>
<p style="margin-left:18%;"><b>Names matching prefix</b>.
Expands to the names of variables whose names begin with
<i>prefix</i>, separated by the first character of the
<b><small>IFS</small></b> special variable. When <i>@</i> is
used and the expansion appears within double quotes, each
variable name expands to a separate word.</p>
<p style="margin-left:9%;">${<b>!</b><i>name</i>[<i>@</i>]}
<br>
${<b>!</b><i>name</i>[<i>*</i>]}</p>
<p style="margin-left:18%;"><b>List of array keys</b>. If
<i>name</i> is an array variable, expands to the list of
array indices (keys) assigned in <i>name</i>. If <i>name</i>
is not an array, expands to 0 if <i>name</i> is set and null
otherwise. When <i>@</i> is used and the expansion appears
within double quotes, each key expands to a separate
word.</p>
<p style="margin-left:9%;">${<b>#</b><i>parameter</i>}</p>
<p style="margin-left:18%;"><b>Parameter length</b>.
Substitutes the length in characters of the expanded value
of <i>parameter</i>. If <i>parameter</i> is <b>*</b> or
<b>@</b>, the value substituted is the number of positional
parameters. If <i>parameter</i> is an array name subscripted
by <b>*</b> or <b>@</b>, the value substituted is the number
of elements in the array. If <i>parameter</i> is an indexed
array name subscripted by a negative number, that number is
interpreted as relative to one greater than the maximum
index of <i>parameter</i>, so negative indices count back
from the end of the array, and an index of &minus;1
references the last element.</p>
<p style="margin-left:9%;">${<i>parameter</i><b>#</b><i>word</i>}
<br>
${<i>parameter</i><b>##</b><i>word</i>}</p>
<p style="margin-left:18%;"><b>Remove matching prefix
pattern</b>. The <i>word</i> is expanded to produce a
pattern just as in pathname expansion, and matched against
the expanded value of <i>parameter</i> using the rules
described under <b>Pattern Matching</b> below. If the
pattern matches the beginning of the value of
<i>parameter</i>, then the result of the expansion is the
expanded value of <i>parameter</i> with the shortest
matching pattern (the &ldquo;#&rdquo; case) or the longest
matching pattern (the &ldquo;##&rdquo; case) deleted. If
<i>parameter</i> is <b>@</b> or <b>*</b>, the pattern
removal operation is applied to each positional parameter in
turn, and the expansion is the resultant list. If
<i>parameter</i> is an array variable subscripted with
<b>@</b> or <b>*</b>, the pattern removal operation is
applied to each member of the array in turn, and the
expansion is the resultant list.</p>
<p style="margin-left:9%;">${<i>parameter</i><b>%</b><i>word</i>}
<br>
${<i>parameter</i><b>%%</b><i>word</i>}</p>
<p style="margin-left:18%;"><b>Remove matching suffix
pattern</b>. The <i>word</i> is expanded to produce a
pattern just as in pathname expansion, and matched against
the expanded value of <i>parameter</i> using the rules
described under <b>Pattern Matching</b> below. If the
pattern matches a trailing portion of the expanded value of
<i>parameter</i>, then the result of the expansion is the
expanded value of <i>parameter</i> with the shortest
matching pattern (the &ldquo;%&rdquo; case) or the longest
matching pattern (the &ldquo;%%&rdquo; case) deleted. If
<i>parameter</i> is <b>@</b> or <b>*</b>, the pattern
removal operation is applied to each positional parameter in
turn, and the expansion is the resultant list. If
<i>parameter</i> is an array variable subscripted with
<b>@</b> or <b>*</b>, the pattern removal operation is
applied to each member of the array in turn, and the
expansion is the resultant list.</p>
<p style="margin-left:9%;">${<i>parameter</i><b>/</b><i>pattern</i><b>/</b><i>string</i>}
<br>
${<i>parameter</i><b>//</b><i>pattern</i><b>/</b><i>string</i>}
<br>
${<i>parameter</i><b>/#</b><i>pattern</i><b>/</b><i>string</i>}
<br>
${<i>parameter</i><b>/%</b><i>pattern</i><b>/</b><i>string</i>}</p>
<p style="margin-left:18%;"><b>Pattern substitution</b>.
The <i>pattern</i> is expanded to produce a pattern and
matched against the expanded value of <i>parameter</i> as
described under <b>Pattern Matching</b> below. The longest
match of <i>pattern</i> in the expanded value is replaced
with <i>string</i>. <i>string</i> undergoes tilde expansion,
parameter and variable expansion, arithmetic expansion,
command and process substitution, and quote removal.</p>
<p style="margin-left:18%; margin-top: 1em">In the first
form above, only the first match is replaced. If there are
two slashes separating <i>parameter</i> and <i>pattern</i>
(the second form above), all matches of <i>pattern</i> are
replaced with <i>string</i>. If <i>pattern</i> is preceded
by <b>#</b> (the third form above), it must match at the
beginning of the expanded value of <i>parameter</i>. If
<i>pattern</i> is preceded by <b>%</b> (the fourth form
above), it must match at the end of the expanded value of
<i>parameter</i>.</p>
<p style="margin-left:18%; margin-top: 1em">If the
expansion of <i>string</i> is null, matches of
<i>pattern</i> are deleted and the <b>/</b> following
<i>pattern</i> may be omitted.</p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>patsub_replacement</b> shell option is enabled using
<b>shopt</b>, any unquoted instances of <b>&amp;</b> in
<i>string</i> are replaced with the matching portion of
<i>pattern</i>.</p>
<p style="margin-left:18%; margin-top: 1em">Quoting any
part of <i>string</i> inhibits replacement in the expansion
of the quoted portion, including replacement strings stored
in shell variables. Backslash escapes <b>&amp;</b> in
<i>string</i>; the backslash is removed in order to permit a
literal <b>&amp;</b> in the replacement string. Backslash
can also be used to escape a backslash; <b>\\</b> results in
a literal backslash in the replacement. Users should take
care if <i>string</i> is double-quoted to avoid unwanted
interactions between the backslash and double-quoting, since
backslash has special meaning within double quotes. Pattern
substitution performs the check for unquoted <b>&amp;</b>
after expanding <i>string</i>; shell programmers should
quote any occurrences of <b>&amp;</b> they want to be taken
literally in the replacement and ensure any instances of
<b>&amp;</b> they want to be replaced are unquoted.</p>
<p style="margin-left:18%; margin-top: 1em">Like the
pattern removal operators, double quotes surrounding the
replacement string quote the expanded characters, while
double quotes enclosing the entire parameter substitution do
not, since the expansion is performed in a context that
doesn&rsquo;t take any enclosing double quotes into
account.</p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>nocasematch</b> shell option is enabled, the match is
performed without regard to the case of alphabetic
characters.</p>
<p style="margin-left:18%; margin-top: 1em">If
<i>parameter</i> is <b>@</b> or <b>*</b>, the substitution
operation is applied to each positional parameter in turn,
and the expansion is the resultant list. If <i>parameter</i>
is an array variable subscripted with <b>@</b> or <b>*</b>,
the substitution operation is applied to each member of the
array in turn, and the expansion is the resultant list.</p>
<p style="margin-left:9%;">${<i>parameter</i><b>^</b><i>pattern</i>}
<br>
${<i>parameter</i><b>^^</b><i>pattern</i>} <br>
${<i>parameter</i><b>,</b><i>pattern</i>} <br>
${<i>parameter</i><b>,,</b><i>pattern</i>}</p>
<p style="margin-left:18%;"><b>Case modification</b>. This
expansion modifies the case of alphabetic characters in
<i>parameter</i>. First, the <i>pattern</i> is expanded to
produce a pattern as described below under <b><small>Pattern
Matching</small></b><small>.</small> <b>Bash</b> then
examines characters in the expanded value of
<i>parameter</i> against <i>pattern</i> as described below.
If a character matches the pattern, its case is converted.
The pattern should not attempt to match more than one
character.</p>
<p style="margin-left:18%; margin-top: 1em">Using
&ldquo;^&rdquo; converts lowercase letters matching
<i>pattern</i> to uppercase; &ldquo;,&rdquo; converts
matching uppercase letters to lowercase. The <b>^</b> and
<b>,</b> variants examine the first character in the
expanded value and convert its case if it matches
<i>pattern</i>; the <b>^^</b> and <b>,,</b> variants examine
all characters in the expanded value and convert each one
that matches <i>pattern</i>. If <i>pattern</i> is omitted,
it is treated like a <b>?</b>, which matches every
character.</p>
<p style="margin-left:18%; margin-top: 1em">If
<i>parameter</i> is <b>@</b> or <b>*</b>, the case
modification operation is applied to each positional
parameter in turn, and the expansion is the resultant list.
If <i>parameter</i> is an array variable subscripted with
<b>@</b> or <b>*</b>, the case modification operation is
applied to each member of the array in turn, and the
expansion is the resultant list.</p>
<p style="margin-left:9%;">${<i>parameter</i><b>@</b><i>operator</i>}</p>
<p style="margin-left:18%;"><b>Parameter
transformation</b>. The expansion is either a transformation
of the value of <i>parameter</i> or information about
<i>parameter</i> itself, depending on the value of
<i>operator</i>. Each <i>operator</i> is a single
letter:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p><b>U</b></p></td>
<td width="8%"></td>
<td width="73%">
<p>The expansion is a string that is the value of
<i>parameter</i> with lowercase alphabetic characters
converted to uppercase.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p><b>u</b></p></td>
<td width="8%"></td>
<td width="73%">
<p>The expansion is a string that is the value of
<i>parameter</i> with the first character converted to
uppercase, if it is alphabetic.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p><b>L</b></p></td>
<td width="8%"></td>
<td width="73%">
<p>The expansion is a string that is the value of
<i>parameter</i> with uppercase alphabetic characters
converted to lowercase.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p><b>Q</b></p></td>
<td width="8%"></td>
<td width="73%">
<p>The expansion is a string that is the value of
<i>parameter</i> quoted in a format that can be reused as
input.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p><b>E</b></p></td>
<td width="8%"></td>
<td width="73%">
<p>The expansion is a string that is the value of
<i>parameter</i> with backslash escape sequences expanded as
with the <b>$'</b>...<b>'</b> quoting mechanism.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p><b>P</b></p></td>
<td width="8%"></td>
<td width="73%">
<p>The expansion is a string that is the result of
expanding the value of <i>parameter</i> as if it were a
prompt string (see <b>PROMPTING</b> below).</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p><b>A</b></p></td>
<td width="8%"></td>
<td width="73%">
<p>The expansion is a string in the form of an assignment
statement or <b>declare</b> command that, if evaluated,
recreates <i>parameter</i> with its attributes and
value.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p><b>K</b></p></td>
<td width="8%"></td>
<td width="73%">
<p>Produces a possibly-quoted version of the value of
<i>parameter</i>, except that it prints the values of
indexed and associative arrays as a sequence of quoted
key-value pairs (see <b>Arrays</b> above). The keys and
values are quoted in a format that can be reused as
input.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p><b>a</b></p></td>
<td width="8%"></td>
<td width="73%">
<p>The expansion is a string consisting of flag values
representing <i>parameter</i>&rsquo;s attributes.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p><b>k</b></p></td>
<td width="8%"></td>
<td width="73%">
<p>Like the K transformation, but expands the keys and
values of indexed and associative arrays to separate words
after word splitting.</p></td></tr>
</table>
<p style="margin-left:18%; margin-top: 1em">If
<i>parameter</i> is <b>@</b> or <b>*</b>, the operation is
applied to each positional parameter in turn, and the
expansion is the resultant list. If <i>parameter</i> is an
array variable subscripted with <b>@</b> or <b>*</b>, the
operation is applied to each member of the array in turn,
and the expansion is the resultant list.</p>
<p style="margin-left:18%; margin-top: 1em">The result of
the expansion is subject to word splitting and pathname
expansion as described below.</p>
<h3>Command Substitution
<a name="Command Substitution"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em"><i>Command
substitution</i> allows the output of a command to replace
the command itself. There are two standard forms:</p>
<p style="margin-left:18%; margin-top: 1em"><b>$(</b><i>command</i><b>)</b></p>
<p style="margin-left:9%;">or (deprecated)</p>
<p style="margin-left:18%;"><b>`</b><i>command</i><b>`</b>.</p>
<p style="margin-left:9%; margin-top: 1em"><b>Bash</b>
performs the expansion by executing <i>command</i> in a
subshell environment and replacing the command substitution
with the standard output of the command, with any trailing
newlines deleted. Embedded newlines are not deleted, but
they may be removed during word splitting. The command
substitution <b>$(cat</b> <i>file</i><b>)</b> can be
replaced by the equivalent but faster <b>$(&lt;</b>
<i>file</i><b>)</b>.</p>
<p style="margin-left:9%; margin-top: 1em">With the
old-style backquote form of substitution, backslash retains
its literal meaning except when followed by <b>$</b>,
<b>`</b>, or <b>\</b>. The first backquote not preceded by a
backslash terminates the command substitution. When using
the $(<i>command</i>) form, all characters between the
parentheses make up the command; none are treated
specially.</p>
<p style="margin-left:9%; margin-top: 1em">There is an
alternate form of command substitution:</p>
<p style="margin-left:18%; margin-top: 1em"><b>${</b><i>c
command</i><b>;}</b></p>
<p style="margin-left:9%; margin-top: 1em">which executes
<i>command</i> in the current execution environment and
captures its output, again with trailing newlines
removed.</p>
<p style="margin-left:9%; margin-top: 1em">The character
<i>c</i> following the open brace must be a space, tab,
newline, or <b>|</b>, and the close brace must be in a
position where a reserved word may appear (i.e., preceded by
a command terminator such as semicolon). <b>Bash</b> allows
the close brace to be joined to the remaining characters in
the word without being followed by a shell metacharacter as
a reserved word would usually require.</p>
<p style="margin-left:9%; margin-top: 1em">Any side effects
of <i>command</i> take effect immediately in the current
execution environment and persist in the current environment
after the command completes (e.g., the <b>exit</b> builtin
exits the shell).</p>
<p style="margin-left:9%; margin-top: 1em">This type of
command substitution superficially resembles executing an
unnamed shell function: local variables are created as when
a shell function is executing, and the <b>return</b> builtin
forces <i>command</i> to complete; however, the rest of the
execution environment, including the positional parameters,
is shared with the caller.</p>
<p style="margin-left:9%; margin-top: 1em">If the first
character following the open brace is a <b>|</b>, the
construct expands to the value of the <b>REPLY</b> shell
variable after <i>command</i> executes, without removing any
trailing newlines, and the standard output of <i>command</i>
remains the same as in the calling shell. <b>Bash</b>
creates <b>REPLY</b> as an initially-unset local variable
when <i>command</i> executes, and restores <b>REPLY</b> to
the value it had before the command substitution after
<i>command</i> completes, as with any local variable.</p>
<p style="margin-left:9%; margin-top: 1em">Command
substitutions may be nested. To nest when using the
backquoted form, escape the inner backquotes with
backslashes.</p>
<p style="margin-left:9%; margin-top: 1em">If the
substitution appears within double quotes, <b>bash</b> does
not perform word splitting and pathname expansion on the
results.</p>
<h3>Arithmetic Expansion
<a name="Arithmetic Expansion"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">Arithmetic
expansion evaluates an arithmetic expression and substitutes
the result. The format for arithmetic expansion is:</p>
<p style="margin-left:18%; margin-top: 1em"><b>$((</b><i>expression</i><b>))</b></p>
<p style="margin-left:9%; margin-top: 1em">The
<i>expression</i> undergoes the same expansions as if it
were within double quotes, but unescaped double quote
characters in <i>expression</i> are not treated specially
and are removed. All tokens in the expression undergo
parameter and variable expansion, command substitution, and
quote removal. The result is treated as the arithmetic
expression to be evaluated. Since the way Bash handles
double quotes can potentially result in empty strings,
arithmetic expansion treats those as expressions that
evaluate to 0. Arithmetic expansions may be nested.</p>
<p style="margin-left:9%; margin-top: 1em">The evaluation
is performed according to the rules listed below under
<b><small>ARITHMETIC EVALUATION</small></b><small>.</small>
If <i>expression</i> is invalid, <b>bash</b> prints a
message to standard error indicating failure, does not
perform the substitution, and does not execute the command
associated with the expansion.</p>
<h3>Process Substitution
<a name="Process Substitution"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em"><i>Process
substitution</i> allows a process&rsquo;s input or output to
be referred to using a filename. It takes the form of
<b>&lt;(</b><i>list</i><b>)</b> or
<b>&gt;(</b><i>list</i><b>)</b>. The process <i>list</i> is
run asynchronously, and its input or output appears as a
filename. This filename is passed as an argument to the
current command as the result of the expansion.</p>
<p style="margin-left:9%; margin-top: 1em">If the
<b>&gt;(</b><i>list</i><b>)</b> form is used, writing to the
file provides input for <i>list</i>. If the
<b>&lt;(</b><i>list</i><b>)</b> form is used, reading the
file obtains the output of <i>list</i>. No space may appear
between the <b>&lt;</b> or <b>&gt;</b> and the left
parenthesis, otherwise the construct would be interpreted as
a redirection.</p>
<p style="margin-left:9%; margin-top: 1em">Process
substitution is supported on systems that support named
pipes (<i>FIFOs</i>) or the <i>/dev/fd</i> method of naming
open files.</p>
<p style="margin-left:9%; margin-top: 1em">When available,
process substitution is performed simultaneously with
parameter and variable expansion, command substitution, and
arithmetic expansion.</p>
<h3>Word Splitting
<a name="Word Splitting"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">The shell scans
the results of parameter expansion, command substitution,
and arithmetic expansion that did not occur within double
quotes for <i>word splitting</i>. Words that were not
expanded are not split.</p>
<p style="margin-left:9%; margin-top: 1em">The shell treats
each character of <b><small>IFS</small></b> as a delimiter,
and splits the results of the other expansions into words
using these characters as field terminators.</p>
<p style="margin-left:9%; margin-top: 1em">An <i>IFS
whitespace</i> character is whitespace as defined above (see
<b>Definitions</b>) that appears in the value of
<b><small>IFS</small></b><small>.</small> Space, tab, and
newline are always considered IFS whitespace, even if they
don&rsquo;t appear in the locale&rsquo;s <b>space</b>
category.</p>
<p style="margin-left:9%; margin-top: 1em">If
<b><small>IFS</small></b> is unset, field splitting acts as
if its value were
<b>&lt;space&gt;&lt;tab&gt;&lt;newline&gt;</b>, and treats
these characters as IFS whitespace. If the value of
<b><small>IFS</small></b> is null, no word splitting occurs,
but implicit null arguments (see below) are still
removed.</p>
<p style="margin-left:9%; margin-top: 1em">Word splitting
begins by removing sequences of IFS whitespace characters
from the beginning and end of the results of the previous
expansions, then splits the remaining words.</p>
<p style="margin-left:9%; margin-top: 1em">If the value of
<b><small>IFS</small></b> consists solely of IFS whitespace,
any sequence of IFS whitespace characters delimits a field,
so a field consists of characters that are not unquoted IFS
whitespace, and null fields result only from quoting.</p>
<p style="margin-left:9%; margin-top: 1em">If
<b><small>IFS</small></b> contains a non-whitespace
character, then any character in the value of
<b><small>IFS</small></b> that is not IFS whitespace, along
with any adjacent IFS whitespace characters, delimits a
field. This means that adjacent non-IFS-whitespace
delimiters produce a null field. A sequence of IFS
whitespace characters also delimits a field.</p>
<p style="margin-left:9%; margin-top: 1em">Explicit null
arguments (<b>&quot;&quot;</b> or <b>''</b>) are retained
and passed to commands as empty strings. Unquoted implicit
null arguments, resulting from the expansion of parameters
that have no values, are removed. Expanding a parameter with
no value within double quotes produces a null field, which
is retained and passed to a command as an empty string.</p>
<p style="margin-left:9%; margin-top: 1em">When a quoted
null argument appears as part of a word whose expansion is
non-null, word splitting removes the null argument portion,
leaving the non-null expansion. That is, the word
&ldquo;&minus;d''&rdquo; becomes &ldquo;&minus;d&rdquo;
after word splitting and null argument removal.</p>
<h3>Pathname Expansion
<a name="Pathname Expansion"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">After word
splitting, unless the <b>&minus;f</b> option has been set,
<b>bash</b> scans each word for the characters <b>*</b>,
<b>?</b>, and <b>[</b>. If one of these characters appears,
and is not quoted, then the word is regarded as a
<i>pattern</i>, and replaced with a sorted list of filenames
matching the pattern (see <b><small>Pattern
Matching</small></b> below) subject to the value of the
<b>GLOBSORT</b> shell variable.</p>
<p style="margin-left:9%; margin-top: 1em">If no matching
filenames are found, and the shell option <b>nullglob</b> is
not enabled, the word is left unchanged. If the
<b>nullglob</b> option is set, and no matches are found, the
word is removed. If the <b>failglob</b> shell option is set,
and no matches are found, <b>bash</b> prints an error
message and does not execute the command. If the shell
option <b>nocaseglob</b> is enabled, the match is performed
without regard to the case of alphabetic characters.</p>
<p style="margin-left:9%; margin-top: 1em">When a pattern
is used for pathname expansion, the character
&ldquo;.&rdquo; at the start of a name or immediately
following a slash must be matched explicitly, unless the
shell option <b>dotglob</b> is set. In order to match the
filenames <i>.</i> and <i>..</i>, the pattern must begin
with &ldquo;.&rdquo; (for example, &ldquo;.?&rdquo;), even
if <b>dotglob</b> is set. If the <b>globskipdots</b> shell
option is enabled, the filenames <i>.</i> and <i>..</i>
never match, even if the pattern begins with a
&ldquo;.&rdquo;. When not matching pathnames, the
&ldquo;.&rdquo; character is not treated specially.</p>
<p style="margin-left:9%; margin-top: 1em">When matching a
pathname, the slash character must always be matched
explicitly by a slash in the pattern, but in other matching
contexts it can be matched by a special pattern character as
described below under <b><small>Pattern
Matching</small></b><small>.</small></p>
<p style="margin-left:9%; margin-top: 1em">See the
description of <b>shopt</b> below under <b><small>SHELL
BUILTIN COMMANDS</small></b> for a description of the
<b>nocaseglob</b>, <b>nullglob</b>, <b>globskipdots</b>,
<b>failglob</b>, and <b>dotglob</b> shell options.</p>
<p style="margin-left:9%; margin-top: 1em">The
<b><small>GLOBIGNORE</small></b> shell variable may be used
to restrict the set of file names matching a <i>pattern</i>.
If <b><small>GLOBIGNORE</small></b> is set, each matching
file name that also matches one of the patterns in
<b><small>GLOBIGNORE</small></b> is removed from the list of
matches. If the <b>nocaseglob</b> option is set, the
matching against the patterns in
<b><small>GLOBIGNORE</small></b> is performed without regard
to case. The filenames <i>.</i> and <i>..</i> are always
ignored when <b><small>GLOBIGNORE</small></b> is set and not
null. However, setting <b><small>GLOBIGNORE</small></b> to a
non-null value has the effect of enabling the <b>dotglob</b>
shell option, so all other filenames beginning with a
&ldquo;.&rdquo; match. To get the old behavior of ignoring
filenames beginning with a &ldquo;.&rdquo;, make
&ldquo;.*&rdquo; one of the patterns in
<b><small>GLOBIGNORE</small></b> . The <b>dotglob</b> option
is disabled when <b><small>GLOBIGNORE</small></b> is unset.
The <b>GLOBIGNORE</b> pattern matching honors the setting of
the <b>extglob</b> shell option.</p>
<p style="margin-left:9%; margin-top: 1em">The value of the
<b><small>GLOBSORT</small></b> shell variable controls how
the results of pathname expansion are sorted, as described
above under <b>Shell Variables</b>.</p>
<p style="margin-left:9%; margin-top: 1em"><b>Pattern
Matching</b></p>
<p style="margin-left:9%; margin-top: 1em">Any character
that appears in a pattern, other than the special pattern
characters described below, matches itself. The NUL
character may not occur in a pattern. A backslash escapes
the following character; the escaping backslash is discarded
when matching. The special pattern characters must be quoted
if they are to be matched literally.</p>
<p style="margin-left:9%; margin-top: 1em">The special
pattern characters have the following meanings:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="6%">
<p style="margin-top: 1em"><b>*</b></p></td>
<td width="3%"></td>
<td width="73%">
<p style="margin-top: 1em">Matches any string, including
the null string. When the <b>globstar</b> shell option is
enabled, and <b>*</b> is used in a pathname expansion
context, two adjacent <b>*</b>s used as a single pattern
match all files and zero or more directories and
subdirectories. If followed by a <b>/</b>, two adjacent
<b>*</b>s match only directories and subdirectories.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="6%">
<p><b>?</b></p></td>
<td width="3%"></td>
<td width="73%">
<p>Matches any single character.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="6%">
<p><b>[</b>...<b>]</b></p></td>
<td width="3%"></td>
<td width="73%">
<p>Matches any one of the characters enclosed between the
brackets. This is known as a <i>bracket expression</i> and
matches a single character. A pair of characters separated
by a hyphen denotes a <i>range expression</i>; any character
that falls between those two characters, inclusive, using
the current locale&rsquo;s collating sequence and character
set, matches. If the first character following the <b>[</b>
is a <b>!</b> or a <b>^</b> then any character not within
the range matches. To match a <b>&minus;</b>, include it as
the first or last character in the set. To match a <b>]</b>,
include it as the first character in the set.</p></td></tr>
</table>
<p style="margin-left:27%; margin-top: 1em">The sorting
order of characters in range expressions, and the characters
included in the range, are determined by the current locale
and the values of the <b><small>LC_COLLATE</small></b> or
<b><small>LC_ALL</small></b> shell variables, if set. To
obtain the traditional interpretation of range expressions,
where <b>[a&minus;d]</b> is equivalent to <b>[abcd]</b>, set
the value of the <b>LC_COLLATE</b> or <b>LC_ALL</b> shell
variables to <b>C</b>, or enable the <b>globasciiranges</b>
shell option.</p>
<p style="margin-left:27%; margin-top: 1em">Within a
bracket expression, <i>character classes</i> can be
specified using the syntax <b>[:</b><i>class</i><b>:]</b>,
where <i>class</i> is one of the following classes defined
in the <small>POSIX</small> standard:</p>
<p style="margin-left:27%; margin-top: 1em"><b>alnum alpha
ascii blank cntrl digit graph lower print punct space upper
word xdigit</b></p>
<p style="margin-left:27%; margin-top: 1em">A character
class matches any character belonging to that class. The
<b>word</b> character class matches letters, digits, and the
character _.</p>
<p style="margin-left:27%; margin-top: 1em">Within a
bracket expression, an <i>equivalence class</i> can be
specified using the syntax <b>[=</b><i>c</i><b>=]</b>, which
matches all characters with the same collation weight (as
defined by the current locale) as the character
<i>c</i>.</p>
<p style="margin-left:27%; margin-top: 1em">Within a
bracket expression, the syntax
<b>[.</b><i>symbol</i><b>.]</b> matches the collating symbol
<i>symbol</i>.</p>
<p style="margin-left:9%; margin-top: 1em">If the
<b>extglob</b> shell option is enabled using the
<b>shopt</b> builtin, the shell recognizes several extended
pattern matching operators. In the following description, a
<i>pattern-list</i> is a list of one or more patterns
separated by a <b>|</b>. Composite patterns may be formed
using one or more of the following sub-patterns:</p>
<p style="margin-left:18%;"><b>?(</b><i>pattern-list</i><b>)</b></p>
<p style="margin-left:27%;">Matches zero or one occurrence
of the given patterns.</p>
<p style="margin-left:18%;"><b>*(</b><i>pattern-list</i><b>)</b></p>
<p style="margin-left:27%;">Matches zero or more
occurrences of the given patterns.</p>
<p style="margin-left:18%;"><b>+(</b><i>pattern-list</i><b>)</b></p>
<p style="margin-left:27%;">Matches one or more occurrences
of the given patterns.</p>
<p style="margin-left:18%;"><b>@(</b><i>pattern-list</i><b>)</b></p>
<p style="margin-left:27%;">Matches one of the given
patterns.</p>
<p style="margin-left:18%;"><b>!(</b><i>pattern-list</i><b>)</b></p>
<p style="margin-left:27%;">Matches anything except one of
the given patterns.</p>
<p style="margin-left:9%; margin-top: 1em">The
<b>extglob</b> option changes the behavior of the parser,
since the parentheses are normally treated as operators with
syntactic meaning. To ensure that extended matching patterns
are parsed correctly, make sure that <b>extglob</b> is
enabled before parsing constructs containing the patterns,
including shell functions and command substitutions.</p>
<p style="margin-left:9%; margin-top: 1em">When matching
filenames, the <b>dotglob</b> shell option determines the
set of filenames that are tested: when <b>dotglob</b> is
enabled, the set of filenames includes all files beginning
with &ldquo;.&rdquo;, but <i>.</i> and <i>..</i> must be
matched by a pattern or sub-pattern that begins with a dot;
when it is disabled, the set does not include any filenames
beginning with &ldquo;.&rdquo; unless the pattern or
sub-pattern begins with a &ldquo;.&rdquo;. If the
<b>globskipdots</b> shell option is enabled, the filenames
<i>.</i> and <i>..</i> never appear in the set. As above,
&ldquo;.&rdquo; only has a special meaning when matching
filenames.</p>
<p style="margin-left:9%; margin-top: 1em">Complicated
extended pattern matching against long strings is slow,
especially when the patterns contain alternations and the
strings contain multiple matches. Using separate matches
against shorter strings, or using arrays of strings instead
of a single long string, may be faster.</p>
<h3>Quote Removal
<a name="Quote Removal"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">After the
preceding expansions, all unquoted occurrences of the
characters <b>\</b>, <b>'</b>, and <b>&quot;</b> that did
not result from one of the above expansions are removed.</p>
<h2>REDIRECTION
<a name="REDIRECTION"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">Before a command
is executed, its input and output may be <i>redirected</i>
using a special notation interpreted by the shell.
<i>Redirection</i> allows commands&rsquo; file handles to be
duplicated, opened, closed, made to refer to different
files, and can change the files the command reads from and
writes to. When used with the <b>exec</b> builtin,
redirections modify file handles in the current shell
execution environment. The following redirection operators
may precede or appear anywhere within a <i>simple
command</i> or may follow a <i>command</i>. Redirections are
processed in the order they appear, from left to right.</p>
<p style="margin-left:9%; margin-top: 1em">Each redirection
that may be preceded by a file descriptor number may instead
be preceded by a word of the form {<i>varname</i>}. In this
case, for each redirection operator except
<b>&gt;&amp;&minus;</b> and <b>&lt;&amp;&minus;</b>, the
shell allocates a file descriptor greater than or equal to
10 and assigns it to <i>varname</i>. If {<i>varname</i>}
precedes <b>&gt;&amp;&minus;</b> or <b>&lt;&amp;&minus;</b>,
the value of <i>varname</i> defines the file descriptor to
close. If {<i>varname</i>} is supplied, the redirection
persists beyond the scope of the command, which allows the
shell programmer to manage the file descriptor&rsquo;s
lifetime manually without using the <b>exec</b> builtin. The
<b>varredir_close</b> shell option manages this
behavior.</p>
<p style="margin-left:9%; margin-top: 1em">In the following
descriptions, if the file descriptor number is omitted, and
the first character of the redirection operator is
&ldquo;&lt;&rdquo;, the redirection refers to the standard
input (file descriptor 0). If the first character of the
redirection operator is &ldquo;&gt;&rdquo;, the redirection
refers to the standard output (file descriptor 1).</p>
<p style="margin-left:9%; margin-top: 1em">The <i>word</i>
following the redirection operator in the following
descriptions, unless otherwise noted, is subjected to brace
expansion, tilde expansion, parameter and variable
expansion, command substitution, arithmetic expansion, quote
removal, pathname expansion, and word splitting. If it
expands to more than one word, <b>bash</b> reports an
error.</p>
<p style="margin-left:9%; margin-top: 1em">The order of
redirections is significant. For example, the command</p>
<p style="margin-left:18%; margin-top: 1em">ls <b>&gt;</b>
dirlist 2<b>&gt;&amp;</b>1</p>
<p style="margin-left:9%; margin-top: 1em">directs both
standard output and standard error to the file
<i>dirlist</i>, while the command</p>
<p style="margin-left:18%; margin-top: 1em">ls
2<b>&gt;&amp;</b>1 <b>&gt;</b> dirlist</p>
<p style="margin-left:9%; margin-top: 1em">directs only the
standard output to file <i>dirlist</i>, because the standard
error was directed to the standard output before the
standard output was redirected to <i>dirlist</i>.</p>
<p style="margin-left:9%; margin-top: 1em"><b>Bash</b>
handles several filenames specially when they are used in
redirections, as described in the following table. If the
operating system on which <b>bash</b> is running provides
these special files, <b>bash</b> uses them; otherwise it
emulates them internally with the behavior described
below.</p>
<p style="margin-left:18%;"><b>/dev/fd/</b><i>fd</i></p>
<p style="margin-left:27%;">If <i>fd</i> is a valid
integer, duplicate file descriptor <i>fd</i>.</p>
<p style="margin-left:18%;"><b>/dev/stdin</b></p>
<p style="margin-left:27%;">File descriptor 0 is
duplicated.</p>
<p style="margin-left:18%;"><b>/dev/stdout</b></p>
<p style="margin-left:27%;">File descriptor 1 is
duplicated.</p>
<p style="margin-left:18%;"><b>/dev/stderr</b></p>
<p style="margin-left:27%;">File descriptor 2 is
duplicated.</p>
<p style="margin-left:18%;"><b>/dev/tcp/</b><i>host</i><b>/</b><i>port</i></p>
<p style="margin-left:27%;">If <i>host</i> is a valid
hostname or Internet address, and <i>port</i> is an integer
port number or service name, <b>bash</b> attempts to open
the corresponding TCP socket.</p>
<p style="margin-left:18%;"><b>/dev/udp/</b><i>host</i><b>/</b><i>port</i></p>
<p style="margin-left:27%;">If <i>host</i> is a valid
hostname or Internet address, and <i>port</i> is an integer
port number or service name, <b>bash</b> attempts to open
the corresponding UDP socket.</p>
<p style="margin-left:9%; margin-top: 1em">A failure to
open or create a file causes the redirection to fail.</p>
<p style="margin-left:9%; margin-top: 1em">Redirections
using file descriptors greater than 9 should be used with
care, as they may conflict with file descriptors the shell
uses internally.</p>
<h3>Redirecting Input
<a name="Redirecting Input"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">Redirecting
input opens the file whose name results from the expansion
of <i>word</i> for reading on file descriptor <i>n</i>, or
the standard input (file descriptor 0) if <i>n</i> is not
specified.</p>
<p style="margin-left:9%; margin-top: 1em">The general
format for redirecting input is:</p>
<p style="margin-left:18%; margin-top: 1em">[<i>n</i>]<b>&lt;</b><i>word</i></p>
<h3>Redirecting Output
<a name="Redirecting Output"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">Redirecting
output opens the file whose name results from the expansion
of <i>word</i> for writing on file descriptor <i>n</i>, or
the standard output (file descriptor 1) if <i>n</i> is not
specified. If the file does not exist it is created; if it
does exist it is truncated to zero size.</p>
<p style="margin-left:9%; margin-top: 1em">The general
format for redirecting output is:</p>
<p style="margin-left:18%; margin-top: 1em">[<i>n</i>]<b>&gt;</b><i>word</i></p>
<p style="margin-left:9%; margin-top: 1em">If the
redirection operator is <b>&gt;</b>, and the
<b>noclobber</b> option to the <b>set</b> builtin command
has been enabled, the redirection fails if the file whose
name results from the expansion of <i>word</i> exists and is
a regular file. If the redirection operator is <b>&gt;|</b>,
or the redirection operator is <b>&gt;</b> and the
<b>noclobber</b> option to the <b>set</b> builtin is not
enabled, <b>bash</b> attempts the redirection even if the
file named by <i>word</i> exists.</p>
<h3>Appending Redirected Output
<a name="Appending Redirected Output"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">Redirecting
output in this fashion opens the file whose name results
from the expansion of <i>word</i> for appending on file
descriptor <i>n</i>, or the standard output (file descriptor
1) if <i>n</i> is not specified. If the file does not exist
it is created.</p>
<p style="margin-left:9%; margin-top: 1em">The general
format for appending output is:</p>
<p style="margin-left:18%; margin-top: 1em">[<i>n</i>]<b>&gt;&gt;</b><i>word</i></p>
<h3>Redirecting Standard Output and Standard Error
<a name="Redirecting Standard Output and Standard Error"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">This construct
redirects both the standard output (file descriptor 1) and
the standard error output (file descriptor 2) to the file
whose name is the expansion of <i>word</i>.</p>
<p style="margin-left:9%; margin-top: 1em">There are two
formats for redirecting standard output and standard
error:</p>
<p style="margin-left:18%; margin-top: 1em"><b>&amp;&gt;</b><i>word</i></p>
<p style="margin-left:9%;">and</p>
<p style="margin-left:18%;"><b>&gt;&amp;</b><i>word</i></p>
<p style="margin-left:9%; margin-top: 1em">Of the two
forms, the first is preferred. This is semantically
equivalent to</p>
<p style="margin-left:18%; margin-top: 1em"><b>&gt;</b><i>word</i>
2<b>&gt;&amp;</b>1</p>
<p style="margin-left:9%; margin-top: 1em">When using the
second form, <i>word</i> may not expand to a number or
<b>&minus;</b>. If it does, other redirection operators
apply (see <b>Duplicating File Descriptors</b> below) for
compatibility reasons.</p>
<h3>Appending Standard Output and Standard Error
<a name="Appending Standard Output and Standard Error"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">This construct
appends both the standard output (file descriptor 1) and the
standard error output (file descriptor 2) to the file whose
name is the expansion of <i>word</i>.</p>
<p style="margin-left:9%; margin-top: 1em">The format for
appending standard output and standard error is:</p>
<p style="margin-left:18%; margin-top: 1em"><b>&amp;&gt;&gt;</b><i>word</i></p>
<p style="margin-left:9%; margin-top: 1em">This is
semantically equivalent to</p>
<p style="margin-left:18%; margin-top: 1em"><b>&gt;&gt;</b><i>word</i>
2<b>&gt;&amp;</b>1</p>
<p style="margin-left:9%; margin-top: 1em">(see
<b>Duplicating File Descriptors</b> below).</p>
<h3>Here Documents
<a name="Here Documents"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">This type of
redirection instructs the shell to read input from the
current source until it reads a line containing only
<i>delimiter</i> (with no trailing blanks). All of the lines
read up to that point then become the standard input (or
file descriptor <i>n</i> if <i>n</i> is specified) for a
command.</p>
<p style="margin-left:9%; margin-top: 1em">The format of
here-documents is:</p>
<p style="margin-left:18%; margin-top: 1em">[<i>n</i>]<b>&lt;&lt;</b>[<b>&minus;</b>]<i>word
<br>
here-document <br>
delimiter</i></p>
<p style="margin-left:9%; margin-top: 1em">The shell does
not perform parameter and variable expansion, command
substitution, arithmetic expansion, or pathname expansion on
<i>word</i>.</p>
<p style="margin-left:9%; margin-top: 1em">If any part of
<i>word</i> is quoted, the <i>delimiter</i> is the result of
quote removal on <i>word</i>, and the lines in the
here-document are not expanded. If <i>word</i> is unquoted,
the <i>delimiter</i> is <i>word</i> itself, and the
here-document text is treated similarly to a double-quoted
string: all lines of the here-document are subjected to
parameter expansion, command substitution, and arithmetic
expansion, the character sequence <b>\&lt;newline&gt;</b> is
treated literally, and <b>\</b> must be used to quote the
characters <b>\</b>, <b>$</b>, and <b>`</b>; however, double
quote characters have no special meaning.</p>
<p style="margin-left:9%; margin-top: 1em">If the
redirection operator is <b>&lt;&lt;&minus;</b>, then the
shell strips all leading tab characters from input lines and
the line containing <i>delimiter</i>. This allows
here-documents within shell scripts to be indented in a
natural fashion.</p>
<p style="margin-left:9%; margin-top: 1em">If the delimiter
is not quoted, the shell treats the <b>\&lt;newline&gt;</b>
sequence as a line continuation: the two lines are joined
and the backslash-newline is removed. This happens while
reading the here-document, before the check for the ending
delimiter, so joined lines can form the end delimiter.</p>
<h3>Here Strings
<a name="Here Strings"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">A variant of
here documents, the format is:</p>
<p style="margin-left:18%; margin-top: 1em">[<i>n</i>]<b>&lt;&lt;&lt;</b><i>word</i></p>
<p style="margin-left:9%; margin-top: 1em">The <i>word</i>
undergoes tilde expansion, parameter and variable expansion,
command substitution, arithmetic expansion, and quote
removal. Pathname expansion and word splitting are not
performed. The result is supplied as a single string, with a
newline appended, to the command on its standard input (or
file descriptor <i>n</i> if <i>n</i> is specified).</p>
<h3>Duplicating File Descriptors
<a name="Duplicating File Descriptors"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">The redirection
operator</p>
<p style="margin-left:18%; margin-top: 1em">[<i>n</i>]<b>&lt;&amp;</b><i>word</i></p>
<p style="margin-left:9%; margin-top: 1em">is used to
duplicate input file descriptors. If <i>word</i> expands to
one or more digits, file descriptor <i>n</i> is made to be a
copy of that file descriptor. It is a redirection error if
the digits in <i>word</i> do not specify a file descriptor
open for input. If <i>word</i> evaluates to <b>&minus;</b>,
file descriptor <i>n</i> is closed. If <i>n</i> is not
specified, this uses the standard input (file descriptor
0).</p>
<p style="margin-left:9%; margin-top: 1em">The operator</p>
<p style="margin-left:18%; margin-top: 1em">[<i>n</i>]<b>&gt;&amp;</b><i>word</i></p>
<p style="margin-left:9%; margin-top: 1em">is used
similarly to duplicate output file descriptors. If <i>n</i>
is not specified, this uses the standard output (file
descriptor 1). It is a redirection error if the digits in
<i>word</i> do not specify a file descriptor open for
output. If <i>word</i> evaluates to <b>&minus;</b>, file
descriptor <i>n</i> is closed. As a special case, if
<i>n</i> is omitted, and <i>word</i> does not expand to one
or more digits or <b>&minus;</b>, this redirects the
standard output and standard error as described
previously.</p>
<h3>Moving File Descriptors
<a name="Moving File Descriptors"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">The redirection
operator</p>
<p style="margin-left:18%; margin-top: 1em">[<i>n</i>]<b>&lt;&amp;</b><i>digit</i><b>&minus;</b></p>
<p style="margin-left:9%; margin-top: 1em">moves the file
descriptor <i>digit</i> to file descriptor <i>n</i>, or the
standard input (file descriptor 0) if <i>n</i> is not
specified. <i>digit</i> is closed after being duplicated to
<i>n</i>.</p>
<p style="margin-left:9%; margin-top: 1em">Similarly, the
redirection operator</p>
<p style="margin-left:18%; margin-top: 1em">[<i>n</i>]<b>&gt;&amp;</b><i>digit</i><b>&minus;</b></p>
<p style="margin-left:9%; margin-top: 1em">moves the file
descriptor <i>digit</i> to file descriptor <i>n</i>, or the
standard output (file descriptor 1) if <i>n</i> is not
specified.</p>
<h3>Opening File Descriptors for Reading and Writing
<a name="Opening File Descriptors for Reading and Writing"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">The redirection
operator</p>
<p style="margin-left:18%; margin-top: 1em">[<i>n</i>]<b>&lt;&gt;</b><i>word</i></p>
<p style="margin-left:9%; margin-top: 1em">opens the file
whose name is the expansion of <i>word</i> for both reading
and writing on file descriptor <i>n</i>, or on file
descriptor 0 if <i>n</i> is not specified. If the file does
not exist, it is created.</p>
<h2>ALIASES
<a name="ALIASES"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em"><i>Aliases</i>
allow a string to be substituted for a word that is in a
position in the input where it can be the first word of a
simple command. Aliases have names and corresponding values
that are set and unset using the <b>alias</b> and
<b>unalias</b> builtin commands (see <b><small>SHELL BUILTIN
COMMANDS</small></b> below).</p>
<p style="margin-left:9%; margin-top: 1em">If the shell
reads an unquoted word in the right position, it checks the
word to see if it matches an alias name. If it matches, the
shell replaces the word with the alias value, and reads that
value as if it had been read instead of the word. The shell
doesn&rsquo;t look at any characters following the word
before attempting alias substitution.</p>
<p style="margin-left:9%; margin-top: 1em">The characters
<b>/</b>, <b>$</b>, <b>`</b>, and <b>=</b> and any of the
shell <i>metacharacters</i> or quoting characters listed
above may not appear in an alias name. The replacement text
may contain any valid shell input, including shell
metacharacters. The first word of the replacement text is
tested for aliases, but a word that is identical to an alias
being expanded is not expanded a second time. This means
that one may alias <b>ls</b> to <b>ls &minus;F</b>, for
instance, and <b>bash</b> does not try to recursively expand
the replacement text.</p>
<p style="margin-left:9%; margin-top: 1em">If the last
character of the alias value is a <i>blank</i>, the shell
checks the next command word following the alias for alias
expansion.</p>
<p style="margin-left:9%; margin-top: 1em">Aliases are
created and listed with the <b>alias</b> command, and
removed with the <b>unalias</b> command.</p>
<p style="margin-left:9%; margin-top: 1em">There is no
mechanism for using arguments in the replacement text. If
arguments are needed, use a shell function (see
<b><small>FUNCTIONS</small></b> below) instead.</p>
<p style="margin-left:9%; margin-top: 1em">Aliases are not
expanded when the shell is not interactive, unless the
<b>expand_aliases</b> shell option is set using <b>shopt</b>
(see the description of <b>shopt</b> under <b><small>SHELL
BUILTIN COMMANDS</small></b> below).</p>
<p style="margin-left:9%; margin-top: 1em">The rules
concerning the definition and use of aliases are somewhat
confusing. <b>Bash</b> always reads at least one complete
line of input, and all lines that make up a compound
command, before executing any of the commands on that line
or the compound command. Aliases are expanded when a command
is read, not when it is executed. Therefore, an alias
definition appearing on the same line as another command
does not take effect until the shell reads the next line of
input, and an alias definition in a compound command does
not take effect until the shell parses and executes the
entire compound command. The commands following the alias
definition on that line, or in the rest of a compound
command, are not affected by the new alias. This behavior is
also an issue when functions are executed. Aliases are
expanded when a function definition is read, not when the
function is executed, because a function definition is
itself a command. As a consequence, aliases defined in a
function are not available until after that function is
executed. To be safe, always put alias definitions on a
separate line, and do not use <b>alias</b> in compound
commands.</p>
<p style="margin-left:9%; margin-top: 1em">For almost every
purpose, shell functions are preferable to aliases.</p>
<h2>FUNCTIONS
<a name="FUNCTIONS"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">A shell
function, defined as described above under <b><small>SHELL
GRAMMAR</small></b><small>,</small> stores a series of
commands for later execution. When the name of a shell
function is used as a simple command name, the shell
executes the list of commands associated with that function
name. Functions are executed in the context of the calling
shell; there is no new process created to interpret them
(contrast this with the execution of a shell script).</p>
<p style="margin-left:9%; margin-top: 1em">When a function
is executed, the arguments to the function become the
positional parameters during its execution. The special
parameter <b>#</b> is updated to reflect the new positional
parameters. Special parameter <b>0</b> is unchanged. The
first element of the <b><small>FUNCNAME</small></b> variable
is set to the name of the function while the function is
executing.</p>
<p style="margin-left:9%; margin-top: 1em">All other
aspects of the shell execution environment are identical
between a function and its caller with these exceptions: the
<b><small>DEBUG</small></b> and <b>RETURN</b> traps (see the
description of the <b>trap</b> builtin under <b><small>SHELL
BUILTIN COMMANDS</small></b> below) are not inherited unless
the function has been given the <b>trace</b> attribute (see
the description of the <b><small>declare</small></b> builtin
below) or the <b>&minus;o functrace</b> shell option has
been enabled with the <b>set</b> builtin (in which case all
functions inherit the <b>DEBUG</b> and <b>RETURN</b> traps),
and the <b><small>ERR</small></b> trap is not inherited
unless the <b>&minus;o errtrace</b> shell option has been
enabled.</p>
<p style="margin-left:9%; margin-top: 1em">Variables local
to the function are declared with the <b>local</b> builtin
command (<i>local variables</i>). Ordinarily, variables and
their values are shared between the function and its caller.
If a variable is declared <b>local</b>, the variable&rsquo;s
visible scope is restricted to that function and its
children (including the functions it calls).</p>
<p style="margin-left:9%; margin-top: 1em">In the following
description, the <i>current scope</i> is a currently-
executing function. Previous scopes consist of that
function&rsquo;s caller and so on, back to the
&ldquo;global&rdquo; scope, where the shell is not executing
any shell function. A local variable at the current scope is
a variable declared using the <b>local</b> or <b>declare</b>
builtins in the function that is currently executing.</p>
<p style="margin-left:9%; margin-top: 1em">Local variables
&ldquo;shadow&rdquo; variables with the same name declared
at previous scopes. For instance, a local variable declared
in a function hides variables with the same name declared at
previous scopes, including global variables: references and
assignments refer to the local variable, leaving the
variables at previous scopes unmodified. When the function
returns, the global variable is once again visible.</p>
<p style="margin-left:9%; margin-top: 1em">The shell uses
<i>dynamic scoping</i> to control a variable&rsquo;s
visibility within functions. With dynamic scoping, visible
variables and their values are a result of the sequence of
function calls that caused execution to reach the current
function. The value of a variable that a function sees
depends on its value within its caller, if any, whether that
caller is the global scope or another shell function. This
is also the value that a local variable declaration shadows,
and the value that is restored when the function
returns.</p>
<p style="margin-left:9%; margin-top: 1em">For example, if
a variable <i>var</i> is declared as local in function
<i>func1</i>, and <i>func1</i> calls another function
<i>func2</i>, references to <i>var</i> made from within
<i>func2</i> resolve to the local variable <i>var</i> from
<i>func1</i>, shadowing any global variable named
<i>var</i>.</p>
<p style="margin-left:9%; margin-top: 1em">The <b>unset</b>
builtin also acts using the same dynamic scope: if a
variable is local to the current scope, <b>unset</b> unsets
it; otherwise the unset will refer to the variable found in
any calling scope as described above. If a variable at the
current local scope is unset, it remains so (appearing as
unset) until it is reset in that scope or until the function
returns. Once the function returns, any instance of the
variable at a previous scope becomes visible. If the unset
acts on a variable at a previous scope, any instance of a
variable with that name that had been shadowed becomes
visible (see below how the <b>localvar_unset</b> shell
option changes this behavior).</p>
<p style="margin-left:9%; margin-top: 1em">The
<b><small>FUNCNEST</small></b> variable, if set to a numeric
value greater than 0, defines a maximum function nesting
level. Function invocations that exceed the limit cause the
entire command to abort.</p>
<p style="margin-left:9%; margin-top: 1em">If the builtin
command <b>return</b> is executed in a function, the
function completes and execution resumes with the next
command after the function call. If <b>return</b> is
supplied a numeric argument, that is the function&rsquo;s
return status; otherwise the function&rsquo;s return status
is the exit status of the last command executed before the
<b>return</b>. Any command associated with the <b>RETURN</b>
trap is executed before execution resumes. When a function
completes, the values of the positional parameters and the
special parameter <b>#</b> are restored to the values they
had prior to the function&rsquo;s execution.</p>
<p style="margin-left:9%; margin-top: 1em">The
<b>&minus;f</b> option to the <b>declare</b> or
<b>typeset</b> builtin commands lists function names and
definitions. The <b>&minus;F</b> option to <b>declare</b> or
<b>typeset</b> lists the function names only (and optionally
the source file and line number, if the <b>extdebug</b>
shell option is enabled). Functions may be exported so that
child shell processes (those created when executing a
separate shell invocation) automatically have them defined
with the <b>&minus;f</b> option to the <b>export</b>
builtin. The <b>&minus;f</b> option to the <b>unset</b>
builtin deletes a function definition.</p>
<p style="margin-left:9%; margin-top: 1em">Functions may be
recursive. The <b>FUNCNEST</b> variable may be used to limit
the depth of the function call stack and restrict the number
of function invocations. By default, <b>bash</b> imposes no
limit on the number of recursive calls.</p>
<h2>ARITHMETIC EVALUATION
<a name="ARITHMETIC EVALUATION"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">The shell allows
arithmetic expressions to be evaluated, under certain
circumstances (see the <b>let</b> and <b>declare</b> builtin
commands, the <b>((</b> compound command, the arithmetic
<b>for</b> command, the <b>[[</b> conditional command, and
<b>Arithmetic Expansion</b>).</p>
<p style="margin-left:9%; margin-top: 1em">Evaluation is
done in the largest fixed-width integers available, with no
check for overflow, though division by 0 is trapped and
flagged as an error. The operators and their precedence,
associativity, and values are the same as in the C language.
The following list of operators is grouped into levels of
equal-precedence operators. The levels are listed in order
of decreasing precedence. <i><br>
id</i><b>++</b> <i>id</i><b>&minus;&minus;</b></p>
<p style="margin-left:18%;">variable post-increment and
post-decrement</p>
<p style="margin-left:9%;"><b>++</b><i>id</i>
<b>&minus;&minus;</b><i>id</i></p>
<p style="margin-left:18%;">variable pre-increment and
pre-decrement</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>&minus; +</b></p></td>
<td width="3%"></td>
<td width="45%">
<p>unary minus and plus</p></td>
<td width="37%">
</td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>! ~</b></p></td>
<td width="3%"></td>
<td width="45%">
<p>logical and bitwise negation</p></td>
<td width="37%">
</td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>**</b></p></td>
<td width="3%"></td>
<td width="45%">
<p>exponentiation</p></td>
<td width="37%">
</td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>* / %</b></p></td>
<td width="3%"></td>
<td width="45%">
<p>multiplication, division, remainder</p></td>
<td width="37%">
</td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>+ &minus;</b></p></td>
<td width="3%"></td>
<td width="45%">
<p>addition, subtraction</p></td>
<td width="37%">
</td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>&lt;&lt; &gt;&gt;</b></p></td>
<td width="3%"></td>
<td width="45%">
<p>left and right bitwise shifts</p></td>
<td width="37%">
</td></tr>
</table>
<p style="margin-left:9%;"><b>&lt;= &gt;= &lt; &gt;</b></p>
<p style="margin-left:18%;">comparison</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>== !=</b></p></td>
<td width="3%"></td>
<td width="29%">
<p>equality and inequality</p></td>
<td width="53%">
</td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>&amp;</b></p></td>
<td width="3%"></td>
<td width="29%">
<p>bitwise AND</p></td>
<td width="53%">
</td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>^</b></p></td>
<td width="3%"></td>
<td width="29%">
<p>bitwise exclusive OR</p></td>
<td width="53%">
</td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>|</b></p></td>
<td width="3%"></td>
<td width="29%">
<p>bitwise OR</p></td>
<td width="53%">
</td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>&amp;&amp;</b></p></td>
<td width="3%"></td>
<td width="29%">
<p>logical AND</p></td>
<td width="53%">
</td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>||</b></p></td>
<td width="3%"></td>
<td width="29%">
<p>logical OR</p></td>
<td width="53%">
</td></tr>
</table>
<p style="margin-left:9%;"><i>expr</i><b>?</b><i>expr</i><b>:</b><i>expr</i></p>
<p style="margin-left:18%;">conditional operator</p>
<p style="margin-left:9%;"><b>= *= /= %= += &minus;=
&lt;&lt;= &gt;&gt;= &amp;= ^= |=</b></p>
<p style="margin-left:18%;">assignment</p>
<p style="margin-left:9%;"><i>expr1</i> <b>,</b>
<i>expr2</i></p>
<p style="margin-left:18%;">comma</p>
<p style="margin-left:9%; margin-top: 1em">Shell variables
are allowed as operands; parameter expansion is performed
before the expression is evaluated. Within an expression,
shell variables may also be referenced by name without using
the parameter expansion syntax. This means you can use
&quot;x&quot;, where <i>x</i> is a shell variable name, in
an arithmetic expression, and the shell will evaluate its
value as an expression and use the result. A shell variable
that is null or unset evaluates to 0 when referenced by name
in an expression.</p>
<p style="margin-left:9%; margin-top: 1em">The value of a
variable is evaluated as an arithmetic expression when it is
referenced, or when a variable which has been given the
<i>integer</i> attribute using <b>declare &minus;i</b> is
assigned a value. A null value evaluates to 0. A shell
variable need not have its <i>integer</i> attribute enabled
to be used in an expression.</p>
<p style="margin-left:9%; margin-top: 1em">Integer
constants follow the C language definition, without suffixes
or character constants. Constants with a leading 0 are
interpreted as octal numbers. A leading 0x or 0X denotes
hexadecimal. Otherwise, numbers take the form
[<i>base#</i>]n, where the optional <i>base</i> is a decimal
number between 2 and 64 representing the arithmetic base,
and <i>n</i> is a number in that base. If <i>base#</i> is
omitted, then base 10 is used. When specifying <i>n</i>, if
a non-digit is required, the digits greater than 9 are
represented by the lowercase letters, the uppercase letters,
@, and _, in that order. If <i>base</i> is less than or
equal to 36, lowercase and uppercase letters may be used
interchangeably to represent numbers between 10 and 35.</p>
<p style="margin-left:9%; margin-top: 1em">Operators are
evaluated in precedence order. Sub-expressions in
parentheses are evaluated first and may override the
precedence rules above.</p>
<h2>CONDITIONAL EXPRESSIONS
<a name="CONDITIONAL EXPRESSIONS"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">Conditional
expressions are used by the <b>[[</b> compound command and
the <b>test</b> and <b>[</b> builtin commands to test file
attributes and perform string and arithmetic comparisons.
The <b>test</b> and <b>[</b> commands determine their
behavior based on the number of arguments; see the
descriptions of those commands for any other
command-specific actions.</p>
<p style="margin-left:9%; margin-top: 1em">Expressions are
formed from the unary or binary primaries listed below.
Unary expressions are often used to examine the status of a
file or shell variable. Binary operators are used for
string, numeric, and file attribute comparisons.</p>
<p style="margin-left:9%; margin-top: 1em"><b>Bash</b>
handles several filenames specially when they are used in
expressions. If the operating system on which <b>bash</b> is
running provides these special files, bash will use them;
otherwise it will emulate them internally with this
behavior: If any <i>file</i> argument to one of the
primaries is of the form <i>/dev/fd/n</i>, then <b>bash</b>
checks file descriptor <i>n</i>. If the <i>file</i> argument
to one of the primaries is one of <i>/dev/stdin</i>,
<i>/dev/stdout</i>, or <i>/dev/stderr</i>, <b>bash</b>
checks file descriptor 0, 1, or 2, respectively.</p>
<p style="margin-left:9%; margin-top: 1em">Unless otherwise
specified, primaries that operate on files follow symbolic
links and operate on the target of the link, rather than the
link itself.</p>
<p style="margin-left:9%; margin-top: 1em">When used with
<b>[[</b>, or when the shell is in posix mode, the
<b>&lt;</b> and <b>&gt;</b> operators sort lexicographically
using the current locale. When the shell is not in posix
mode, the <b>test</b> command sorts using ASCII ordering.
<b><br>
&minus;a</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists.</p>
<p style="margin-left:9%;"><b>&minus;b</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists and
is a block special file.</p>
<p style="margin-left:9%;"><b>&minus;c</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists and
is a character special file.</p>
<p style="margin-left:9%;"><b>&minus;d</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists and
is a directory.</p>
<p style="margin-left:9%;"><b>&minus;e</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists.</p>
<p style="margin-left:9%;"><b>&minus;f</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists and
is a regular file.</p>
<p style="margin-left:9%;"><b>&minus;g</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists and
is set-group-id.</p>
<p style="margin-left:9%;"><b>&minus;h</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists and
is a symbolic link.</p>
<p style="margin-left:9%;"><b>&minus;k</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists and
its &ldquo;sticky&rdquo; bit is set.</p>
<p style="margin-left:9%;"><b>&minus;p</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists and
is a named pipe (FIFO).</p>
<p style="margin-left:9%;"><b>&minus;r</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists and
is readable.</p>
<p style="margin-left:9%;"><b>&minus;s</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists and
has a size greater than zero.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>&minus;t</b> <i>fd</i></p></td>
<td width="3%"></td>
<td width="77%">
<p>True if file descriptor <i>fd</i> is open and refers to
a terminal.</p></td>
<td width="5%">
</td></tr>
</table>
<p style="margin-left:9%;"><b>&minus;u</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists and
its set-user-id bit is set.</p>
<p style="margin-left:9%;"><b>&minus;w</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists and
is writable.</p>
<p style="margin-left:9%;"><b>&minus;x</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists and
is executable.</p>
<p style="margin-left:9%;"><b>&minus;G</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists and
is owned by the effective group id.</p>
<p style="margin-left:9%;"><b>&minus;L</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists and
is a symbolic link.</p>
<p style="margin-left:9%;"><b>&minus;N</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists and
has been modified since it was last accessed.</p>
<p style="margin-left:9%;"><b>&minus;O</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists and
is owned by the effective user id.</p>
<p style="margin-left:9%;"><b>&minus;S</b> <i>file</i></p>
<p style="margin-left:18%;">True if <i>file</i> exists and
is a socket.</p>
<p style="margin-left:9%;"><b>&minus;o</b>
<i>optname</i></p>
<p style="margin-left:18%;">True if the shell option
<i>optname</i> is enabled. See the list of options under the
description of the <b>&minus;o</b> option to the <b>set</b>
builtin below.</p>
<p style="margin-left:9%;"><b>&minus;v</b>
<i>varname</i></p>
<p style="margin-left:18%;">True if the shell variable
<i>varname</i> is set (has been assigned a value). If
<i>varname</i> is an indexed array variable name subscripted
by <i>@</i> or <i>*</i>, this returns true if the array has
any set elements. If <i>varname</i> is an associative array
variable name subscripted by <i>@</i> or <i>*</i>, this
returns true if an element with that key is set.</p>
<p style="margin-left:9%;"><b>&minus;R</b>
<i>varname</i></p>
<p style="margin-left:18%;">True if the shell variable
<i>varname</i> is set and is a name reference.</p>
<p style="margin-left:9%;"><b>&minus;z</b>
<i>string</i></p>
<p style="margin-left:18%;">True if the length of
<i>string</i> is zero.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><i>string</i></p></td>
<td width="83%">
</td></tr>
</table>
<p style="margin-left:9%; margin-top: 1em"><b>&minus;n</b>
<i>string</i></p>
<p style="margin-left:18%;">True if the length of
<i>string</i> is non-zero.</p>
<p style="margin-left:9%;"><i>string1</i> <b>==</b>
<i>string2 <br>
string1</i> <b>=</b> <i>string2</i></p>
<p style="margin-left:18%;">True if the strings are equal.
<b>=</b> should be used with the <b>test</b> command for
<small>POSIX</small> conformance. When used with the
<b>[[</b> command, this performs pattern matching as
described above (<b>Compound Commands</b>).</p>
<p style="margin-left:9%;"><i>string1</i> <b>!=</b>
<i>string2</i></p>
<p style="margin-left:18%;">True if the strings are not
equal.</p>
<p style="margin-left:9%;"><i>string1</i> <b>&lt;</b>
<i>string2</i></p>
<p style="margin-left:18%;">True if <i>string1</i> sorts
before <i>string2</i> lexicographically.</p>
<p style="margin-left:9%;"><i>string1</i> <b>&gt;</b>
<i>string2</i></p>
<p style="margin-left:18%;">True if <i>string1</i> sorts
after <i>string2</i> lexicographically.</p>
<p style="margin-left:9%;"><i>file1</i> <b>&minus;ef</b>
<i>file2</i></p>
<p style="margin-left:18%;">True if <i>file1</i> and
<i>file2</i> refer to the same device and inode numbers.</p>
<p style="margin-left:9%;"><i>file1</i> &minus;<b>nt</b>
<i>file2</i></p>
<p style="margin-left:18%;">True if <i>file1</i> is newer
(according to modification date) than <i>file2</i>, or if
<i>file1</i> exists and <i>file2</i> does not.</p>
<p style="margin-left:9%;"><i>file1</i> &minus;<b>ot</b>
<i>file2</i></p>
<p style="margin-left:18%;">True if <i>file1</i> is older
than <i>file2</i>, or if <i>file2</i> exists and
<i>file1</i> does not.</p>
<p style="margin-left:9%;"><i>arg1</i> <b>OP</b>
<i>arg2</i></p>
<p style="margin-left:18%;"><b><small>OP</small></b> is one
of <b>&minus;eq</b>, <b>&minus;ne</b>, <b>&minus;lt</b>,
<b>&minus;le</b>, <b>&minus;gt</b>, or <b>&minus;ge</b>.
These arithmetic binary operators return true if <i>arg1</i>
is equal to, not equal to, less than, less than or equal to,
greater than, or greater than or equal to <i>arg2</i>,
respectively. <i>arg1</i> and <i>arg2</i> may be positive or
negative integers. When used with the <b>[[</b> command,
<i>arg1</i> and <i>arg2</i> are evaluated as arithmetic
expressions (see <b><small>ARITHMETIC EVALUATION</small></b>
above). Since the expansions the <b>[[</b> command performs
on <i>arg1</i> and <i>arg2</i> can potentially result in
empty strings, arithmetic expression evaluation treats those
as expressions that evaluate to 0.</p>
<h2>SIMPLE COMMAND EXPANSION
<a name="SIMPLE COMMAND EXPANSION"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">When the shell
executes a simple command, it performs the following
expansions, assignments, and redirections, from left to
right, in the following order.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="3%">
<p>1.</p></td>
<td width="6%"></td>
<td width="82%">
<p>The words that the parser has marked as variable
assignments (those preceding the command name) and
redirections are saved for later processing.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="3%">
<p>2.</p></td>
<td width="6%"></td>
<td width="82%">
<p>The words that are not variable assignments or
redirections are expanded. If any words remain after
expansion, the first word is taken to be the name of the
command and the remaining words are the arguments.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="3%">
<p>3.</p></td>
<td width="6%"></td>
<td width="82%">
<p>Redirections are performed as described above under
<b><small>REDIRECTION</small></b><small>.</small></p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="3%">
<p>4.</p></td>
<td width="6%"></td>
<td width="82%">
<p>The text after the <b>=</b> in each variable assignment
undergoes tilde expansion, parameter expansion, command
substitution, arithmetic expansion, and quote removal before
being assigned to the variable.</p></td></tr>
</table>
<p style="margin-left:9%; margin-top: 1em">If no command
name results, the variable assignments affect the current
shell environment. In the case of such a command (one that
consists only of assignment statements and redirections),
assignment statements are performed before redirections.
Otherwise, the variables are added to the environment of the
executed command and do not affect the current shell
environment. If any of the assignments attempts to assign a
value to a readonly variable, an error occurs, and the
command exits with a non-zero status.</p>
<p style="margin-left:9%; margin-top: 1em">If no command
name results, redirections are performed, but do not affect
the current shell environment. A redirection error causes
the command to exit with a non-zero status.</p>
<p style="margin-left:9%; margin-top: 1em">If there is a
command name left after expansion, execution proceeds as
described below. Otherwise, the command exits. If one of the
expansions contained a command substitution, the exit status
of the command is the exit status of the last command
substitution performed. If there were no command
substitutions, the command exits with a zero status.</p>
<h2>COMMAND EXECUTION
<a name="COMMAND EXECUTION"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">After a command
has been split into words, if it results in a simple command
and an optional list of arguments, the shell performs the
following actions.</p>
<p style="margin-left:9%; margin-top: 1em">If the command
name contains no slashes, the shell attempts to locate it.
If there exists a shell function by that name, that function
is invoked as described above in
<b><small>FUNCTIONS</small></b><small>.</small> If the name
does not match a function, the shell searches for it in the
list of shell builtins. If a match is found, that builtin is
invoked.</p>
<p style="margin-left:9%; margin-top: 1em">If the name is
neither a shell function nor a builtin, and contains no
slashes, <b>bash</b> searches each element of the
<b><small>PATH</small></b> for a directory containing an
executable file by that name. <b>Bash</b> uses a hash table
to remember the full pathnames of executable files (see
<b>hash</b> under <b><small>SHELL BUILTIN
COMMANDS</small></b> below). Bash performs a full search of
the directories in <b><small>PATH</small></b> only if the
command is not found in the hash table. If the search is
unsuccessful, the shell searches for a defined shell
function named <b>command_not_found_handle</b>. If that
function exists, it is invoked in a separate execution
environment with the original command and the original
command&rsquo;s arguments as its arguments, and the
function&rsquo;s exit status becomes the exit status of that
subshell. If that function is not defined, the shell prints
an error message and returns an exit status of 127.</p>
<p style="margin-left:9%; margin-top: 1em">If the search is
successful, or if the command name contains one or more
slashes, the shell executes the named program in a separate
execution environment. Argument 0 is set to the name given,
and the remaining arguments to the command are set to the
arguments given, if any.</p>
<p style="margin-left:9%; margin-top: 1em">If this
execution fails because the file is not in executable
format, and the file is not a directory, it is assumed to be
a <i>shell script</i>, a file containing shell commands, and
the shell creates a new instance of itself to execute it.
Bash tries to determine whether the file is a text file or a
binary, and will not execute files it determines to be
binaries. This subshell reinitializes itself, so that the
effect is as if a new shell had been invoked to handle the
script, with the exception that the locations of commands
remembered by the parent (see <b>hash</b> below under
<b><small>SHELL BUILTIN COMMANDS</small></b> are retained by
the child.</p>
<p style="margin-left:9%; margin-top: 1em">If the program
is a file beginning with <b>#!</b>, the remainder of the
first line specifies an interpreter for the program. The
shell executes the specified interpreter on operating
systems that do not handle this executable format
themselves. The arguments to the interpreter consist of a
single optional argument following the interpreter name on
the first line of the program, followed by the name of the
program, followed by the command arguments, if any.</p>
<h2>COMMAND EXECUTION ENVIRONMENT
<a name="COMMAND EXECUTION ENVIRONMENT"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">The shell has an
<i>execution environment</i>, which consists of the
following:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p style="margin-top: 1em">&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p style="margin-top: 1em">Open files inherited by the
shell at invocation, as modified by redirections supplied to
the <b>exec</b> builtin.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>The current working directory as set by <b>cd</b>,
<b>pushd</b>, or <b>popd</b>, or inherited by the shell at
invocation.</p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>The file creation mode mask as set by <b>umask</b> or
inherited from the shell&rsquo;s parent.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Current traps set by <b>trap</b>.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Shell parameters that are set by variable assignment or
with <b>set</b> or inherited from the shell&rsquo;s parent
in the environment.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Shell functions defined during execution or inherited
from the shell&rsquo;s parent in the environment.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Options enabled at invocation (either by default or with
command-line arguments) or by <b>set</b>.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Options enabled by <b>shopt</b>.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Shell aliases defined with <b>alias</b>.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Various process IDs, including those of background jobs,
the value of <b>$$</b>, and the value of
<b><small>PPID</small></b><small>.</small></p> </td></tr>
</table>
<p style="margin-left:9%; margin-top: 1em">When a simple
command other than a builtin or shell function is to be
executed, it is invoked in a separate execution environment
that consists of the following. Unless otherwise noted, the
values are inherited from the shell.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p style="margin-top: 1em">&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p style="margin-top: 1em">The shell&rsquo;s open files,
plus any modifications and additions specified by
redirections to the command.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>The current working directory.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>The file creation mode mask.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Shell variables and functions marked for export, along
with variables exported for the command, passed in the
environment.</p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Traps caught by the shell are reset to the values
inherited from the shell&rsquo;s parent, and traps ignored
by the shell are ignored.</p></td></tr>
</table>
<p style="margin-left:9%; margin-top: 1em">A command
invoked in this separate environment cannot affect the
shell&rsquo;s execution environment.</p>
<p style="margin-left:9%; margin-top: 1em">A
<i>subshell</i> is a copy of the shell process.</p>
<p style="margin-left:9%; margin-top: 1em">Command
substitution, commands grouped with parentheses, and
asynchronous commands are invoked in a subshell environment
that is a duplicate of the shell environment, except that
traps caught by the shell are reset to the values that the
shell inherited from its parent at invocation. Builtin
commands that are invoked as part of a pipeline, except
possibly in the last element depending on the value of the
<b>lastpipe</b> shell option, are also executed in a
subshell environment. Changes made to the subshell
environment cannot affect the shell&rsquo;s execution
environment.</p>
<p style="margin-left:9%; margin-top: 1em">When the shell
is in posix mode, subshells spawned to execute command
substitutions inherit the value of the <b>&minus;e</b>
option from their parent shell. When not in posix mode,
<b>bash</b> clears the <b>&minus;e</b> option in such
subshells. See the description of the <b>inherit_errexit</b>
shell option below for how to control this behavior when not
in posix mode.</p>
<p style="margin-left:9%; margin-top: 1em">If a command is
followed by a <b>&amp;</b> and job control is not active,
the default standard input for the command is the empty file
<i>/dev/null</i>. Otherwise, the invoked command inherits
the file descriptors of the calling shell as modified by
redirections.</p>
<h2>ENVIRONMENT
<a name="ENVIRONMENT"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">When a program
is invoked it is given an array of strings called the
<i>environment</i>. This is a list of
<i>name</i>&minus;<i>value</i> pairs, of the form
<i>name</i>=<i>value</i>.</p>
<p style="margin-left:9%; margin-top: 1em">The shell
provides several ways to manipulate the environment. On
invocation, the shell scans its own environment and creates
a parameter for each name found, automatically marking it
for <i>export</i> to child processes. Executed commands
inherit the environment. The <b>export</b>, <b>declare
&minus;x</b>, and <b>unset</b> commands modify the
environment by adding and deleting parameters and functions.
If the value of a parameter in the environment is modified,
the new value automatically becomes part of the environment,
replacing the old. The environment inherited by any executed
command consists of the shell&rsquo;s initial environment,
whose values may be modified in the shell, less any pairs
removed by the <b>unset</b> or <b>export &minus;n</b>
commands, plus any additions via the <b>export</b> and
<b>declare &minus;x</b> commands.</p>
<p style="margin-left:9%; margin-top: 1em">If any parameter
assignments, as described above in
<b><small>PARAMETERS</small></b><small>,</small> appear
before a <i>simple command</i>, the variable assignments are
part of that command&rsquo;s environment for as long as it
executes. These assignment statements affect only the
environment seen by that command. If these assignments
precede a call to a shell function, the variables are local
to the function and exported to that function&rsquo;s
children.</p>
<p style="margin-left:9%; margin-top: 1em">If the
<b>&minus;k</b> option is set (see the <b>set</b> builtin
command below), then <i>all</i> parameter assignments are
placed in the environment for a command, not just those that
precede the command name.</p>
<p style="margin-left:9%; margin-top: 1em">When <b>bash</b>
invokes an external command, the variable <b>_</b> is set to
the full pathname of the command and passed to that command
in its environment.</p>
<h2>EXIT STATUS
<a name="EXIT STATUS"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">The exit status
of an executed command is the value returned by the
<i>waitpid</i> system call or equivalent function. Exit
statuses fall between 0 and 255, though, as explained below,
the shell may use values above 125 specially. Exit statuses
from shell builtins and compound commands are also limited
to this range. Under certain circumstances, the shell will
use special values to indicate specific failure modes.</p>
<p style="margin-left:9%; margin-top: 1em">For the
shell&rsquo;s purposes, a command which exits with a zero
exit status has succeeded. So while an exit status of zero
indicates success, a non-zero exit status indicates
failure.</p>
<p style="margin-left:9%; margin-top: 1em">When a command
terminates on a fatal signal <i>N</i>, <b>bash</b> uses the
value of 128+<i>N</i> as the exit status.</p>
<p style="margin-left:9%; margin-top: 1em">If a command is
not found, the child process created to execute it returns a
status of 127. If a command is found but is not executable,
the return status is 126.</p>
<p style="margin-left:9%; margin-top: 1em">If a command
fails because of an error during expansion or redirection,
the exit status is greater than zero.</p>
<p style="margin-left:9%; margin-top: 1em">Shell builtin
commands return a status of 0 (<i>true</i>) if successful,
and non-zero (<i>false</i>) if an error occurs while they
execute. All builtins return an exit status of 2 to indicate
incorrect usage, generally invalid options or missing
arguments.</p>
<p style="margin-left:9%; margin-top: 1em">The exit status
of the last command is available in the special parameter
$?.</p>
<p style="margin-left:9%; margin-top: 1em"><b>Bash</b>
itself returns the exit status of the last command executed,
unless a syntax error occurs, in which case it exits with a
non-zero value. See also the <b>exit</b> builtin command
below.</p>
<h2>SIGNALS
<a name="SIGNALS"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">When <b>bash</b>
is interactive, in the absence of any traps, it ignores
<b><small>SIGTERM</small></b> (so that <b>kill 0</b> does
not kill an interactive shell), and catches and handles
<b><small>SIGINT</small></b> (so that the <b>wait</b>
builtin is interruptible). When <b>bash</b> receives
<b><small>SIGINT</small></b><small>,</small> it breaks out
of any executing loops. In all cases, <b>bash</b> ignores
<b><small>SIGQUIT</small></b><small>.</small> If job control
is in effect, <b>bash</b> ignores
<b><small>SIGTTIN</small></b><small>,
<b>SIGTTOU</b>,</small> and
<b><small>SIGTSTP</small></b><small>.</small></p>
<p style="margin-left:9%; margin-top: 1em">The <b>trap</b>
builtin modifies the shell&rsquo;s signal handling, as
described below.</p>
<p style="margin-left:9%; margin-top: 1em">Non-builtin
commands <b>bash</b> executes have signal handlers set to
the values inherited by the shell from its parent, unless
<b>trap</b> sets them to be ignored, in which case the child
process will ignore them as well. When job control is not in
effect, asynchronous commands ignore
<b><small>SIGINT</small></b> and
<b><small>SIGQUIT</small></b> in addition to these inherited
handlers. Commands run as a result of command substitution
ignore the keyboard-generated job control signals
<b><small>SIGTTIN</small></b><small>,
<b>SIGTTOU</b>,</small> and
<b><small>SIGTSTP</small></b><small>.</small></p>
<p style="margin-left:9%; margin-top: 1em">The shell exits
by default upon receipt of a
<b><small>SIGHUP</small></b><small>.</small> Before exiting,
an interactive shell resends the
<b><small>SIGHUP</small></b> to all jobs, running or
stopped. The shell sends <b><small>SIGCONT</small></b> to
stopped jobs to ensure that they receive the
<b><small>SIGHUP</small></b> (see <b><small>JOB
CONTROL</small></b> below for more information about running
and stopped jobs). To prevent the shell from sending the
signal to a particular job, remove it from the jobs table
with the <b>disown</b> builtin (see <b><small>SHELL BUILTIN
COMMANDS</small></b> below) or mark it not to receive
<b><small>SIGHUP</small></b> using <b>disown
&minus;h</b>.</p>
<p style="margin-left:9%; margin-top: 1em">If the
<b>huponexit</b> shell option has been set using
<b>shopt</b>, <b>bash</b> sends a
<b><small>SIGHUP</small></b> to all jobs when an interactive
login shell exits.</p>
<p style="margin-left:9%; margin-top: 1em">If <b>bash</b>
is waiting for a command to complete and receives a signal
for which a trap has been set, it will not execute the trap
until the command completes. If <b>bash</b> is waiting for
an asynchronous command via the <b>wait</b> builtin, and it
receives a signal for which a trap has been set, the
<b>wait</b> builtin will return immediately with an exit
status greater than 128, immediately after which the shell
executes the trap.</p>
<p style="margin-left:9%; margin-top: 1em">When job control
is not enabled, and <b>bash</b> is waiting for a foreground
command to complete, the shell receives keyboard-generated
signals such as <b><small>SIGINT</small></b> (usually
generated by <b>^C</b>) that users commonly intend to send
to that command. This happens because the shell and the
command are in the same process group as the terminal, and
<b>^C</b> sends <b><small>SIGINT</small></b> to all
processes in that process group. Since <b>bash</b> does not
enable job control by default when the shell is not
interactive, this scenario is most common in non-interactive
shells.</p>
<p style="margin-left:9%; margin-top: 1em">When job control
is enabled, and <b>bash</b> is waiting for a foreground
command to complete, the shell does not receive
keyboard-generated signals, because it is not in the same
process group as the terminal. This scenario is most common
in interactive shells, where <b>bash</b> attempts to enable
job control by default. See <b><small>JOB
CONTROL</small></b> below for more information about process
groups.</p>
<p style="margin-left:9%; margin-top: 1em">When job control
is not enabled, and <b>bash</b> receives
<b><small>SIGINT</small></b> while waiting for a foreground
command, it waits until that foreground command terminates
and then decides what to do about the
<b><small>SIGINT</small></b><small>:</small></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="3%">
<p style="margin-top: 1em">1.</p></td>
<td width="6%"></td>
<td width="82%">
<p style="margin-top: 1em">If the command terminates due to
the <b><small>SIGINT</small></b><small>,</small> <b>bash</b>
concludes that the user meant to send the
<b><small>SIGINT</small></b> to the shell as well, and acts
on the <b><small>SIGINT</small></b> (e.g., by running a
<b><small>SIGINT</small></b> trap, exiting a non-interactive
shell, or returning to the top level to read a new
command).</p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="3%">
<p>2.</p></td>
<td width="6%"></td>
<td width="82%">
<p>If the command does not terminate due to
<b><small>SIGINT</small></b><small>,</small> the program
handled the <b><small>SIGINT</small></b> itself and did not
treat it as a fatal signal. In that case, <b>bash</b> does
not treat <b><small>SIGINT</small></b> as a fatal signal,
either, instead assuming that the
<b><small>SIGINT</small></b> was used as part of the
program&rsquo;s normal operation (e.g., emacs uses it to
abort editing commands) or deliberately discarded. However,
<b>bash</b> will run any trap set on
<b><small>SIGINT</small></b><small>,</small> as it does with
any other trapped signal it receives while it is waiting for
the foreground command to complete, for compatibility.</p></td></tr>
</table>
<p style="margin-left:9%; margin-top: 1em">When job control
is enabled, <b>bash</b> does not receive keyboard-generated
signals such as <b><small>SIGINT</small></b> while it is
waiting for a foreground command. An interactive shell does
not pay attention to the
<b><small>SIGINT</small></b><small>,</small> even if the
foreground command terminates as a result, other than noting
its exit status. If the shell is not interactive, and the
foreground command terminates due to the
<b><small>SIGINT</small></b><small>,</small> <b>bash</b>
pretends it received the <b><small>SIGINT</small></b> itself
(scenario 1 above), for compatibility.</p>
<h2>JOB CONTROL
<a name="JOB CONTROL"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em"><i>Job
control</i> refers to the ability to selectively stop
(<i>suspend</i>) the execution of processes and continue
(<i>resume</i>) their execution at a later point. A user
typically employs this facility via an interactive interface
supplied jointly by the operating system kernel&rsquo;s
terminal driver and <b>bash</b>.</p>
<p style="margin-left:9%; margin-top: 1em">The shell
associates a <i>job</i> with each pipeline. It keeps a table
of currently executing jobs, which the <b>jobs</b> command
will display. Each job has a <i>job number</i>, which
<b>jobs</b> displays between brackets. Job numbers start at
1. When <b>bash</b> starts a job asynchronously (in the
<i>background</i>), it prints a line that looks like:</p>
<p style="margin-left:18%; margin-top: 1em">[1] 25647</p>
<p style="margin-left:9%; margin-top: 1em">indicating that
this job is job number 1 and that the process ID of the last
process in the pipeline associated with this job is 25647.
All of the processes in a single pipeline are members of the
same job. <b>Bash</b> uses the <i>job</i> abstraction as the
basis for job control.</p>
<p style="margin-left:9%; margin-top: 1em">To facilitate
the implementation of the user interface to job control,
each process has a <i>process group ID</i>, and the
operating system maintains the notion of a <i>current
terminal process group ID</i>. This terminal process group
ID is associated with the <i>controlling terminal</i>.</p>
<p style="margin-left:9%; margin-top: 1em">Processes that
have the same process group ID are said to be part of the
same <i>process group</i>. Members of the <i>foreground</i>
process group (processes whose process group ID is equal to
the current terminal process group ID) receive
keyboard-generated signals such as
<b><small>SIGINT</small></b><small>.</small> Processes in
the foreground process group are said to be
<i>foreground</i> processes. <i>Background</i> processes are
those whose process group ID differs from the controlling
terminal&rsquo;s; such processes are immune to
keyboard-generated signals. Only foreground processes are
allowed to read from or, if the user so specifies with
&ldquo;stty tostop&rdquo;, write to the controlling
terminal. The system sends a <b><small>SIGTTIN
(SIGTTOU)</small></b> signal to background processes which
attempt to read from (write to when &ldquo;tostop&rdquo; is
in effect) the terminal, which, unless caught, suspends the
process.</p>
<p style="margin-left:9%; margin-top: 1em">If the operating
system on which <b>bash</b> is running supports job control,
<b>bash</b> contains facilities to use it. Typing the
<i>suspend</i> character (typically <b>^Z</b>, Control-Z)
while a process is running stops that process and returns
control to <b>bash</b>. Typing the <i>delayed suspend</i>
character (typically <b>^Y</b>, Control-Y) causes the
process stop when it attempts to read input from the
terminal, and returns control to <b>bash</b>. The user then
manipulates the state of this job, using the <b>bg</b>
command to continue it in the background, the <b>fg</b>
command to continue it in the foreground, or the <b>kill</b>
command to kill it. The suspend character takes effect
immediately, and has the additional side effect of
discarding any pending output and typeahead. To force a
background process to stop, or stop a process that&rsquo;s
not associated with the current terminal session, send it
the <b><small>SIGSTOP</small></b> signal using
<b>kill</b>.</p>
<p style="margin-left:9%; margin-top: 1em">There are a
number of ways to refer to a job in the shell. The <b>%</b>
character introduces a job specification (jobspec).</p>
<p style="margin-left:9%; margin-top: 1em">Job number
<i>n</i> may be referred to as <b>%n</b>. A job may also be
referred to using a prefix of the name used to start it, or
using a substring that appears in its command line. For
example, <b>%ce</b> refers to a job whose command name
begins with <b>ce</b>. Using <b>%?ce</b>, on the other hand,
refers to any job containing the string <b>ce</b> in its
command line. If the prefix or substring matches more than
one job, <b>bash</b> reports an error.</p>
<p style="margin-left:9%; margin-top: 1em">The symbols
<b>%%</b> and <b>%+</b> refer to the shell&rsquo;s notion of
the <i>current job</i>. A single % (with no accompanying job
specification) also refers to the current job.
<b>%&minus;</b> refers to the <i>previous job</i>. When a
job starts in the background, a job stops while in the
foreground, or a job is resumed in the background, it
becomes the current job. The job that was the current job
becomes the previous job. When the current job terminates,
the previous job becomes the current job. If there is only a
single job, <b>%+</b> and <b>%&minus;</b> can both be used
to refer to that job. In output pertaining to jobs (e.g.,
the output of the <b>jobs</b> command), the current job is
always marked with a <b>+</b>, and the previous job with a
<b>&minus;</b>.</p>
<p style="margin-left:9%; margin-top: 1em">Simply naming a
job can be used to bring it into the foreground: <b>%1</b>
is a synonym for &ldquo;fg %1&rdquo;, bringing job 1 from
the background into the foreground. Similarly, &ldquo;%1
&amp;&rdquo; resumes job 1 in the background, equivalent to
&ldquo;bg %1&rdquo;.</p>
<p style="margin-left:9%; margin-top: 1em">The shell learns
immediately whenever a job changes state. Normally,
<b>bash</b> waits until it is about to print a prompt before
notifying the user about changes in a job&rsquo;s status so
as to not interrupt any other output, though it will notify
of changes in a job&rsquo;s status after a foreground
command in a list completes, before executing the next
command in the list. If the <b>&minus;b</b> option to the
<b>set</b> builtin command is enabled, <b>bash</b> reports
status changes immediately. <b>Bash</b> executes any trap on
<b><small>SIGCHLD</small></b> for each child that
terminates.</p>
<p style="margin-left:9%; margin-top: 1em">When a job
terminates and <b>bash</b> notifies the user about it,
<b>bash</b> removes the job from the table. It will not
appear in <b>jobs</b> output, but <b>wait</b> will report
its exit status, as long as it&rsquo;s supplied the process
ID associated with the job as an argument. When the table is
empty, job numbers start over at 1.</p>
<p style="margin-left:9%; margin-top: 1em">If a user
attempts to exit <b>bash</b> while jobs are stopped (or, if
the <b>checkjobs</b> shell option has been enabled using the
<b>shopt</b> builtin, running), the shell prints a warning
message, and, if the <b>checkjobs</b> option is enabled,
lists the jobs and their statuses. The <b>jobs</b> command
may then be used to inspect their status. If the user
immediately attempts to exit again, without an intervening
command, <b>bash</b> does not print another warning, and
terminates any stopped jobs.</p>
<p style="margin-left:9%; margin-top: 1em">When the shell
is waiting for a job or process using the <b>wait</b>
builtin, and job control is enabled, <b>wait</b> will return
when the job changes state. The <b>&minus;f</b> option
causes <b>wait</b> to wait until the job or process
terminates before returning.</p>
<h2>PROMPTING
<a name="PROMPTING"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">When executing
interactively, <b>bash</b> displays the primary prompt
<b><small>PS1</small></b> when it is ready to read a
command, and the secondary prompt <b><small>PS2</small></b>
when it needs more input to complete a command.</p>
<p style="margin-left:9%; margin-top: 1em"><b>Bash</b>
examines the value of the array variable
<b>PROMPT_COMMAND</b> just before printing each primary
prompt. If any elements in <b>PROMPT_COMMAND</b> are set and
non-null, Bash executes each value, in numeric order, just
as if it had been typed on the command line. <b>Bash</b>
displays <b><small>PS0</small></b> after it reads a command
but before executing it.</p>
<p style="margin-left:9%; margin-top: 1em"><b>Bash</b>
displays <b><small>PS4</small></b> as described above before
tracing each command when the <b>&minus;x</b> option is
enabled.</p>
<p style="margin-left:9%; margin-top: 1em"><b>Bash</b>
allows the prompt strings <b>PS0</b>, <b>PS1</b>,
<b>PS2</b>, and <b>PS4</b>, to be customized by inserting a
number of backslash-escaped special characters that are
decoded as follows:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p style="margin-top: 1em"><b>\a</b></p></td>
<td width="6%"></td>
<td width="73%">
<p style="margin-top: 1em">An ASCII bell character
(07).</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>\d</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The date in &ldquo;Weekday Month Date&rdquo; format
(e.g., &ldquo;Tue May 26&rdquo;).</p></td></tr>
</table>
<p style="margin-left:18%;"><b>\D{</b><i>format</i><b>}</b></p>
<p style="margin-left:27%;">The <i>format</i> is passed to
<i>strftime</i>(3) and the result is inserted into the
prompt string; an empty <i>format</i> results in a
locale-specific time representation. The braces are
required.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\e</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>An ASCII escape character (033).</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\h</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>The hostname up to the first &ldquo;.&rdquo;.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\H</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>The hostname.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\j</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>The number of jobs currently managed by the shell.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\l</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>The basename of the shell&rsquo;s terminal device name
(e.g., &ldquo;ttys0&rdquo;).</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\n</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>A newline.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\r</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>A carriage return.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\s</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>The name of the shell: the basename of <b>$0</b> (the
portion following the final slash).</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\t</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>The current time in 24-hour HH:MM:SS format.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\T</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>The current time in 12-hour HH:MM:SS format.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\@</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>The current time in 12-hour am/pm format.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\A</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>The current time in 24-hour HH:MM format.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\u</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>The username of the current user.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\v</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>The <b>bash</b> version (e.g., 2.00).</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\V</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>The <b>bash</b> release, version + patch level (e.g.,
2.00.0)</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\w</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>The value of the <b>PWD</b> shell variable
(<b>$PWD</b>), with <b><small>$HOME</small></b> abbreviated
with a tilde (uses the value of the
<b><small>PROMPT_DIRTRIM</small></b> variable).</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\W</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>The basename of <b>$PWD</b>, with
<b><small>$HOME</small></b> abbreviated with a tilde.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\!</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>The history number of this command.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\#</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>The command number of this command.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\$</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>If the effective UID is 0, a <b>#</b>, otherwise a
<b>$</b>.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\</b><i>nnn</i></p></td>
<td width="4%"></td>
<td width="73%">
<p>The character corresponding to the octal number
<i>nnn</i>.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\\</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>A backslash.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\[</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>Begin a sequence of non-printing characters, which could
be used to embed a terminal control sequence into the
prompt.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\]</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>End a sequence of non-printing characters.</p></td></tr>
</table>
<p style="margin-left:9%; margin-top: 1em">The command
number and the history number are usually different: the
history number of a command is its position in the history
list, which may include commands restored from the history
file (see <b><small>HISTORY</small></b> below), while the
command number is the position in the sequence of commands
executed during the current shell session. After the string
is decoded, it is expanded via parameter expansion, command
substitution, arithmetic expansion, and quote removal,
subject to the value of the <b>promptvars</b> shell option
(see the description of the <b>shopt</b> command under
<b><small>SHELL BUILTIN COMMANDS</small></b> below). This
can have unwanted side effects if escaped portions of the
string appear within command substitution or contain
characters special to word expansion.</p>
<h2>READLINE
<a name="READLINE"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">This is the
library that handles reading input when using an interactive
shell, unless the <b>&minus;&minus;noediting</b> option is
supplied at shell invocation. Line editing is also used when
using the <b>&minus;e</b> option to the <b>read</b> builtin.
By default, the line editing commands are similar to those
of emacs; a vi-style line editing interface is also
available. Line editing can be enabled at any time using the
<b>&minus;o emacs</b> or <b>&minus;o vi</b> options to the
<b>set</b> builtin (see <b><small>SHELL BUILTIN
COMMANDS</small></b> below). To turn off line editing after
the shell is running, use the <b>+o emacs</b> or <b>+o
vi</b> options to the <b>set</b> builtin.</p>
<h3>Readline Notation
<a name="Readline Notation"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">This section
uses Emacs-style editing concepts and uses its notation for
keystrokes. Control keys are denoted by C&minus;<i>key</i>,
e.g., C&minus;n means Control&minus;N. Similarly,
<i>meta</i> keys are denoted by M&minus;<i>key</i>, so
M&minus;x means Meta&minus;X. The Meta key is often labeled
&ldquo;Alt&rdquo; or &ldquo;Option&rdquo;.</p>
<p style="margin-left:9%; margin-top: 1em">On keyboards
without a <i>Meta</i> key, M&minus;<i>x</i> means ESC
<i>x</i>, i.e., press and release the Escape key, then press
and release the <i>x</i> key, in sequence. This makes ESC
the <i>meta prefix</i>. The combination
M&minus;C&minus;<i>x</i> means ESC Control&minus;<i>x</i>:
press and release the Escape key, then press and hold the
Control key while pressing the <i>x</i> key, then release
both.</p>
<p style="margin-left:9%; margin-top: 1em">On some
keyboards, the Meta key modifier produces characters with
the eighth bit (0200) set. You can use the
<b>enable&minus;meta&minus;key</b> variable to control
whether or not it does this, if the keyboard allows it. On
many others, the terminal or terminal emulator converts the
metafied key to a key sequence beginning with ESC as
described in the preceding paragraph.</p>
<p style="margin-left:9%; margin-top: 1em">If your
<i>Meta</i> key produces a key sequence with the ESC meta
prefix, you can make M-<i>key</i> key bindings you specify
(see <b>Readline Key Bindings</b> below) do the same thing
by setting the <b>force&minus;meta&minus;prefix</b>
variable.</p>
<p style="margin-left:9%; margin-top: 1em"><b>Readline</b>
commands may be given numeric <i>arguments</i>, which
normally act as a repeat count. Sometimes, however, it is
the sign of the argument that is significant. Passing a
negative argument to a command that acts in the forward
direction (e.g., <b>kill&minus;line</b>) makes that command
act in a backward direction. Commands whose behavior with
arguments deviates from this are noted below.</p>
<p style="margin-left:9%; margin-top: 1em">The <i>point</i>
is the current cursor position, and <i>mark</i> refers to a
saved cursor position. The text between the point and mark
is referred to as the <i>region</i>. <b>Readline</b> has the
concept of an <i>active region</i>: when the region is
active, <b>readline</b> redisplay highlights the region
using the value of the <b>active-region-start-color</b>
variable. The <b>enable&minus;active&minus;region</b>
variable turns this on and off. Several commands set the
region to active; those are noted below.</p>
<p style="margin-left:9%; margin-top: 1em">When a command
is described as <i>killing</i> text, the text deleted is
saved for possible future retrieval (<i>yanking</i>). The
killed text is saved in a <i>kill ring</i>. Consecutive
kills accumulate the deleted text into one unit, which can
be yanked all at once. Commands which do not kill text
separate the chunks of text on the kill ring.</p>
<h3>Readline Initialization
<a name="Readline Initialization"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em"><b>Readline</b>
is customized by putting commands in an initialization file
(the <i>inputrc</i> file). The name of this file is taken
from the value of the <b><small>INPUTRC</small></b> shell
variable. If that variable is unset, the default is
<A HREF="file:~/.inputrc"><i>~/.inputrc</i></A>. If that file does not exist or cannot be
read, <b>readline</b> looks for <A HREF="file:/etc/inputrc"><i>/etc/inputrc</i></A>. When a
program that uses the <b>readline</b> library starts up,
<b>readline</b> reads the initialization file and sets the
key bindings and variables found there, before reading any
user input.</p>
<p style="margin-left:9%; margin-top: 1em">There are only a
few basic constructs allowed in the inputrc file. Blank
lines are ignored. Lines beginning with a <b>#</b> are
comments. Lines beginning with a <b>$</b> indicate
conditional constructs. Other lines denote key bindings and
variable settings.</p>
<p style="margin-left:9%; margin-top: 1em">The default
key-bindings in this section may be changed using key
binding commands in the <i>inputrc</i> file. Programs that
use the <b>readline</b> library, including <b>bash</b>, may
add their own commands and bindings.</p>
<p style="margin-left:9%; margin-top: 1em">For example,
placing</p>
<p style="margin-left:18%; margin-top: 1em">M&minus;Control&minus;u:
universal&minus;argument</p>
<p style="margin-left:9%;">or</p>
<p style="margin-left:18%;">C&minus;Meta&minus;u:
universal&minus;argument</p>
<p style="margin-left:9%; margin-top: 1em">into the
<i>inputrc</i> would make M&minus;C&minus;u execute the
<b>readline</b> command <i>universal&minus;argument</i>.</p>
<p style="margin-left:9%; margin-top: 1em">Key bindings may
contain the following symbolic character names: <i>DEL</i>,
<i>ESC</i>, <i>ESCAPE</i>, <i>LFD</i>, <i>NEWLINE</i>,
<i>RET</i>, <i>RETURN</i>, <i>RUBOUT</i> (a destructive
backspace), <i>SPACE</i>, <i>SPC</i>, and <i>TAB</i>.</p>
<p style="margin-left:9%; margin-top: 1em">In addition to
command names, <b>readline</b> allows keys to be bound to a
string that is inserted when the key is pressed (a
<i>macro</i>). The difference between a macro and a command
is that a macro is enclosed in single or double quotes.</p>
<h3>Readline Key Bindings
<a name="Readline Key Bindings"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">The syntax for
controlling key bindings in the <i>inputrc</i> file is
simple. All that is required is the name of the command or
the text of a macro and a key sequence to which it should be
bound. The key sequence may be specified in one of two ways:
as a symbolic key name, possibly with <i>Meta&minus;</i> or
<i>Control&minus;</i> prefixes, or as a key sequence
composed of one or more characters enclosed in double
quotes. The key sequence and name are separated by a colon.
There can be no whitespace between the name and the
colon.</p>
<p style="margin-left:9%; margin-top: 1em">When using the
form <b>keyname</b>:<i>function&minus;name</i> or
<i>macro</i>, <i>keyname</i> is the name of a key spelled
out in English. For example:</p>
<p style="margin-left:18%; margin-top: 1em">Control-u:
universal&minus;argument <br>
Meta-Rubout: backward&minus;kill&minus;word <br>
Control-o: &quot;&gt; output&quot;</p>
<p style="margin-left:9%; margin-top: 1em">In the above
example, <i>C&minus;u</i> is bound to the function
<b>universal&minus;argument</b>, <i>M&minus;DEL</i> is bound
to the function <b>backward&minus;kill&minus;word</b>, and
<i>C&minus;o</i> is bound to run the macro expressed on the
right hand side (that is, to insert the text &ldquo;&gt;
output&rdquo; into the line).</p>
<p style="margin-left:9%; margin-top: 1em">In the second
form, <b>&quot;keyseq&quot;</b>:<i>function&minus;name</i>
or <i>macro</i>, <b>keyseq</b> differs from <b>keyname</b>
above in that strings denoting an entire key sequence may be
specified by placing the sequence within double quotes. Some
GNU Emacs style key escapes can be used, as in the following
example, but none of the symbolic character names are
recognized.</p>
<p style="margin-left:18%; margin-top: 1em">&quot;\C&minus;u&quot;:
universal&minus;argument <br>
&quot;\C&minus;x\C&minus;r&quot;:
re&minus;read&minus;init&minus;file <br>
&quot;\e[11~&quot;: &quot;Function Key 1&quot;</p>
<p style="margin-left:9%; margin-top: 1em">In this example,
<i>C&minus;u</i> is again bound to the function
<b>universal&minus;argument</b>. <i>C&minus;x C&minus;r</i>
is bound to the function
<b>re&minus;read&minus;init&minus;file</b>, and <i>ESC [ 1 1
~</i> is bound to insert the text &ldquo;Function Key
1&rdquo;.</p>
<p style="margin-left:9%; margin-top: 1em">The full set of
GNU Emacs style escape sequences available when specifying
key sequences is</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="4%">
<p style="margin-top: 1em"><b>\C&minus;</b></p></td>
<td width="5%"></td>
<td width="73%">
<p style="margin-top: 1em">A control prefix.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="4%">
<p><b>\M&minus;</b></p></td>
<td width="5%"></td>
<td width="73%">
<p>Adding the meta prefix or converting the following
character to a meta character, as described below under
<b>force-meta-prefix</b>.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="4%">
<p><b>\e</b></p></td>
<td width="5%"></td>
<td width="73%">
<p>An escape character.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="4%">
<p><b>\\</b></p></td>
<td width="5%"></td>
<td width="73%">
<p>Backslash.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="4%">
<p><b>\&quot;</b></p></td>
<td width="5%"></td>
<td width="73%">
<p>Literal &quot;, a double quote.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="4%">
<p><b>\'</b></p></td>
<td width="5%"></td>
<td width="73%">
<p>Literal ', a single quote.</p></td></tr>
</table>
<p style="margin-left:9%; margin-top: 1em">In addition to
the GNU Emacs style escape sequences, a second set of
backslash escapes is available:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p style="margin-top: 1em"><b>\a</b></p></td>
<td width="4%"></td>
<td width="73%">
<p style="margin-top: 1em">alert (bell)</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\b</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>backspace</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\d</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>delete</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\f</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>form feed</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\n</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>newline</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\r</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>carriage return</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\t</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>horizontal tab</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\v</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>vertical tab</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\</b><i>nnn</i></p></td>
<td width="4%"></td>
<td width="73%">
<p>The eight-bit character whose value is the octal value
<i>nnn</i> (one to three digits).</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>\x</b><i>HH</i></p></td>
<td width="4%"></td>
<td width="73%">
<p>The eight-bit character whose value is the hexadecimal
value <i>HH</i> (one or two hex digits).</p></td></tr>
</table>
<p style="margin-left:9%; margin-top: 1em">When entering
the text of a macro, single or double quotes must be used to
indicate a macro definition. Unquoted text is assumed to be
a function name. The backslash escapes described above are
expanded in the macro body. Backslash quotes any other
character in the macro text, including &quot; and '.</p>
<p style="margin-left:9%; margin-top: 1em"><b>Bash</b> will
display or modify the current <b>readline</b> key bindings
with the <b>bind</b> builtin command. The <b>&minus;o
emacs</b> or <b>&minus;o vi</b> options to the <b>set</b>
builtin (see <b><small>SHELL BUILTIN COMMANDS</small></b>
below) change the editing mode during interactive use.</p>
<h3>Readline Variables
<a name="Readline Variables"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em"><b>Readline</b>
has variables that can be used to further customize its
behavior. A variable may be set in the <i>inputrc</i> file
with a statement of the form</p>
<p style="margin-left:18%; margin-top: 1em"><b>set</b>
<i>variable&minus;name value</i></p>
<p style="margin-left:9%;">or using the <b>bind</b> builtin
command (see <b><small>SHELL BUILTIN COMMANDS</small></b>
below).</p>
<p style="margin-left:9%; margin-top: 1em">Except where
noted, <b>readline</b> variables can take the values
<b>On</b> or <b>Off</b> (without regard to case).
Unrecognized variable names are ignored. When
<b>readline</b> reads a variable value, empty or null
values, &ldquo;on&rdquo; (case-insensitive), and
&ldquo;1&rdquo; are equivalent to <b>On</b>. All other
values are equivalent to <b>Off</b>.</p>
<p style="margin-left:9%; margin-top: 1em">The <b>bind
&minus;V</b> command lists the current <b>readline</b>
variable names and values (see <b><small>SHELL BUILTIN
COMMANDS</small></b> below).</p>
<p style="margin-left:9%; margin-top: 1em">The variables
and their default values are: <b><br>
active&minus;region&minus;start&minus;color</b></p>
<p style="margin-left:18%;">A string variable that controls
the text color and background when displaying the text in
the active region (see the description of
<b>enable&minus;active&minus;region</b> below). This string
must not take up any physical character positions on the
display, so it should consist only of terminal escape
sequences. It is output to the terminal before displaying
the text in the active region. This variable is reset to the
default value whenever the terminal type changes. The
default value is the string that puts the terminal in
standout mode, as obtained from the terminal&rsquo;s
terminfo description. A sample value might be
&ldquo;\e[01;33m&rdquo;.</p>
<p style="margin-left:9%;"><b>active&minus;region&minus;end&minus;color</b></p>
<p style="margin-left:18%;">A string variable that
&ldquo;undoes&rdquo; the effects of
<b>active&minus;region&minus;start&minus;color</b> and
restores &ldquo;normal&rdquo; terminal display appearance
after displaying text in the active region. This string must
not take up any physical character positions on the display,
so it should consist only of terminal escape sequences. It
is output to the terminal after displaying the text in the
active region. This variable is reset to the default value
whenever the terminal type changes. The default value is the
string that restores the terminal from standout mode, as
obtained from the terminal&rsquo;s terminfo description. A
sample value might be &ldquo;\e[0m&rdquo;.</p>
<p style="margin-left:9%;"><b>bell&minus;style
(audible)</b></p>
<p style="margin-left:18%;">Controls what happens when
<b>readline</b> wants to ring the terminal bell. If set to
<b>none</b>, <b>readline</b> never rings the bell. If set to
<b>visible</b>, <b>readline</b> uses a visible bell if one
is available. If set to <b>audible</b>, <b>readline</b>
attempts to ring the terminal&rsquo;s bell.</p>
<p style="margin-left:9%;"><b>bind&minus;tty&minus;special&minus;chars
(On)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>,
<b>readline</b> attempts to bind the control characters that
are treated specially by the kernel&rsquo;s terminal driver
to their <b>readline</b> equivalents. These override the
default <b>readline</b> bindings described here. Type
&ldquo;stty &minus;a&rdquo; at a <b>bash</b> prompt to see
your current terminal settings, including the special
control characters (usually <b>cchars</b>). This binding
takes place on each call to <b>readline</b>, so changes made
by &ldquo;stty&rdquo; can take effect.</p>
<p style="margin-left:9%;"><b>blink&minus;matching&minus;paren
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>,
<b>readline</b> attempts to briefly move the cursor to an
opening parenthesis when a closing parenthesis is
inserted.</p>
<p style="margin-left:9%;"><b>colored&minus;completion&minus;prefix
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>, when
listing completions, <b>readline</b> displays the common
prefix of the set of possible completions using a different
color. The color definitions are taken from the value of the
<b>LS_COLORS</b> environment variable. If there is a color
definition in <b>$LS_COLORS</b> for the custom suffix
&ldquo;.readline-colored-completion-prefix&rdquo;,
<b>readline</b> uses this color for the common prefix
instead of its default.</p>
<p style="margin-left:9%;"><b>colored&minus;stats
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>,
<b>readline</b> displays possible completions using
different colors to indicate their file type. The color
definitions are taken from the value of the <b>LS_COLORS</b>
environment variable.</p>
<p style="margin-left:9%;"><b>comment&minus;begin&nbsp;(</b>&ldquo;<b>#</b>&rdquo;<b>)</b></p>
<p style="margin-left:18%;">The string that the <b>readline
insert&minus;comment</b> command inserts. This command is
bound to <b>M&minus;#</b> in emacs mode and to <b>#</b> in
vi command mode.</p>
<p style="margin-left:9%;"><b>completion&minus;display&minus;width
(&minus;1)</b></p>
<p style="margin-left:18%;">The number of screen columns
used to display possible matches when performing completion.
The value is ignored if it is less than 0 or greater than
the terminal screen width. A value of 0 causes matches to be
displayed one per line. The default value is &minus;1.</p>
<p style="margin-left:9%;"><b>completion&minus;ignore&minus;case
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>,
<b>readline</b> performs filename matching and completion in
a case&minus;insensitive fashion.</p>
<p style="margin-left:9%;"><b>completion&minus;map&minus;case
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>, and
<b>completion&minus;ignore&minus;case</b> is enabled,
<b>readline</b> treats hyphens (<i>&minus;</i>) and
underscores (<i>_</i>) as equivalent when performing
case&minus;insensitive filename matching and completion.</p>
<p style="margin-left:9%;"><b>completion&minus;prefix&minus;display&minus;length
(0)</b></p>
<p style="margin-left:18%;">The maximum length in
characters of the common prefix of a list of possible
completions that is displayed without modification. When set
to a value greater than zero, <b>readline</b> replaces
common prefixes longer than this value with an ellipsis when
displaying possible completions. If a completion begins with
a period, and <b>eadline</b> is completing filenames, it
uses three underscores instead of an ellipsis.</p>
<p style="margin-left:9%;"><b>completion&minus;query&minus;items
(100)</b></p>
<p style="margin-left:18%;">This determines when the user
is queried about viewing the number of possible completions
generated by the <b>possible&minus;completions</b> command.
It may be set to any integer value greater than or equal to
zero. If the number of possible completions is greater than
or equal to the value of this variable, <b>readline</b> asks
whether or not the user wishes to view them; otherwise
<b>readline</b> simply lists them on the terminal. A zero
value means <b>readline</b> should never ask; negative
values are treated as zero.</p>
<p style="margin-left:9%;"><b>convert&minus;meta
(On)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>,
<b>readline</b> converts characters it reads that have the
eighth bit set to an ASCII key sequence by clearing the
eighth bit and prefixing it with an escape character
(converting the character to have the meta prefix). The
default is <i>On</i>, but <b>readline</b> sets it to
<i>Off</i> if the locale contains characters whose encodings
may include bytes with the eighth bit set. This variable is
dependent on the <b>LC_CTYPE</b> locale category, and may
change if the locale changes. This variable also affects key
bindings; see the description of
<b>force&minus;meta&minus;prefix</b> below.</p>
<p style="margin-left:9%;"><b>disable&minus;completion
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>,
<b>readline</b> inhibits word completion. Completion
characters are inserted into the line as if they had been
mapped to <b>self-insert</b>.</p>
<p style="margin-left:9%;"><b>echo&minus;control&minus;characters
(On)</b></p>
<p style="margin-left:18%;">When set to <b>On</b>, on
operating systems that indicate they support it,
<b>readline</b> echoes a character corresponding to a signal
generated from the keyboard.</p>
<p style="margin-left:9%;"><b>editing&minus;mode
(emacs)</b></p>
<p style="margin-left:18%;">Controls whether
<b>readline</b> uses a set of key bindings similar to
<i>Emacs</i> or <i>vi</i>. <b>editing&minus;mode</b> can be
set to either <b>emacs</b> or <b>vi</b>.</p>
<p style="margin-left:9%;"><b>emacs&minus;mode&minus;string
(@)</b></p>
<p style="margin-left:18%;">If the
<i>show&minus;mode&minus;in&minus;prompt</i> variable is
enabled, this string is displayed immediately before the
last line of the primary prompt when emacs editing mode is
active. The value is expanded like a key binding, so the
standard set of meta- and control- prefixes and backslash
escape sequences is available. The \1 and \2 escapes begin
and end sequences of non-printing characters, which can be
used to embed a terminal control sequence into the mode
string.</p>
<p style="margin-left:9%;"><b>enable&minus;active&minus;region
(On)</b></p>
<p style="margin-left:18%;">When this variable is set to
<i>On</i>, <b>readline</b> allows certain commands to
designate the region as <i>active</i>. When the region is
active, <b>readline</b> highlights the text in the region
using the value of the
<b>active&minus;region&minus;start&minus;color</b> variable,
which defaults to the string that enables the
terminal&rsquo;s standout mode. The active region shows the
text inserted by bracketed-paste and any matching text found
by incremental and non-incremental history searches.</p>
<p style="margin-left:9%;"><b>enable&minus;bracketed&minus;paste
(On)</b></p>
<p style="margin-left:18%;">When set to <b>On</b>,
<b>readline</b> configures the terminal to insert each paste
into the editing buffer as a single string of characters,
instead of treating each character as if it had been read
from the keyboard. This is called <i>bracketed&minus;paste
mode</i>; it prevents <b>readline</b> from executing any
editing commands bound to key sequences appearing in the
pasted text.</p>
<p style="margin-left:9%;"><b>enable&minus;keypad
(Off)</b></p>
<p style="margin-left:18%;">When set to <b>On</b>,
<b>readline</b> tries to enable the application keypad when
it is called. Some systems need this to enable the arrow
keys.</p>
<p style="margin-left:9%;"><b>enable&minus;meta&minus;key
(On)</b></p>
<p style="margin-left:18%;">When set to <b>On</b>,
<b>readline</b> tries to enable any meta modifier key the
terminal claims to support. On many terminals, the Meta key
is used to send eight-bit characters; this variable checks
for the terminal capability that indicates the terminal can
enable and disable a mode that sets the eighth bit of a
character (0200) if the Meta key is held down when the
character is typed (a meta character).</p>
<p style="margin-left:9%;"><b>expand&minus;tilde
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>,
<b>readline</b> performs tilde expansion when it attempts
word completion.</p>
<p style="margin-left:9%;"><b>force&minus;meta&minus;prefix
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>,
<b>readline</b> modifies its behavior when binding key
sequences containing \M- or Meta- (see <b>Key Bindings</b>
above) by converting a key sequence of the form
\M&minus;<i>C</i> or Meta&minus;<i>C</i> to the
two-character sequence <b>ESC</b> <i>C</i> (adding the meta
prefix). If <b>force&minus;meta&minus;prefix</b> is set to
<b>Off</b> (the default), <b>readline</b> uses the value of
the <b>convert&minus;meta</b> variable to determine whether
to perform this conversion: if <b>convert&minus;meta</b> is
<b>On</b>, <b>readline</b> performs the conversion described
above; if it is <b>Off</b>, <b>readline</b> converts
<i>C</i> to a meta character by setting the eighth bit
(0200).</p>
<p style="margin-left:9%;"><b>history&minus;preserve&minus;point
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>, the
history code attempts to place point at the same location on
each history line retrieved with <b>previous-history</b> or
<b>next-history</b>.</p>
<p style="margin-left:9%;"><b>history&minus;size
(unset)</b></p>
<p style="margin-left:18%;">Set the maximum number of
history entries saved in the history list. If set to zero,
any existing history entries are deleted and no new entries
are saved. If set to a value less than zero, the number of
history entries is not limited. By default, <b>bash</b> sets
the maximum number of history entries to the value of the
<b>HISTSIZE</b> shell variable. Setting
<i>history&minus;size</i> to a non-numeric value will set
the maximum number of history entries to 500.</p>
<p style="margin-left:9%;"><b>horizontal&minus;scroll&minus;mode
(Off)</b></p>
<p style="margin-left:18%;">Setting this variable to
<b>On</b> makes <b>readline</b> use a single line for
display, scrolling the input horizontally on a single screen
line when it becomes longer than the screen width rather
than wrapping to a new line. This setting is automatically
enabled for terminals of height 1.</p>
<p style="margin-left:9%;"><b>input&minus;meta
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>,
<b>readline</b> enables eight-bit input (that is, it does
not clear the eighth bit in the characters it reads),
regardless of what the terminal claims it can support. The
default is <i>Off</i>, but <b>readline</b> sets it to
<i>On</i> if the locale contains characters whose encodings
may include bytes with the eighth bit set. This variable is
dependent on the <b>LC_CTYPE</b> locale category, and its
value may change if the locale changes. The name
<b>meta&minus;flag</b> is a synonym for
<b>input&minus;meta</b>.</p>
<p style="margin-left:9%;"><b>isearch&minus;terminators&nbsp;(</b>&ldquo;<b>C&minus;[C&minus;j</b>&rdquo;<b>)</b></p>
<p style="margin-left:18%;">The string of characters that
should terminate an incremental search without subsequently
executing the character as a command. If this variable has
not been given a value, the characters <i>ESC</i> and
<b>C&minus;j</b> terminate an incremental search.</p>
<p style="margin-left:9%;"><b>keymap (emacs)</b></p>
<p style="margin-left:18%;">Set the current <b>readline</b>
keymap. The set of valid keymap names is <i>emacs,
emacs&minus;standard, emacs&minus;meta, emacs&minus;ctlx,
vi, vi&minus;command</i>, and <i>vi&minus;insert</i>.
<i>vi</i> is equivalent to <i>vi&minus;command</i>;
<i>emacs</i> is equivalent to <i>emacs&minus;standard</i>.
The default value is <i>emacs</i>; the value of
<b>editing&minus;mode</b> also affects the default
keymap.</p>
<p style="margin-left:9%;"><b>keyseq&minus;timeout
(500)</b></p>
<p style="margin-left:18%;">Specifies the duration
<b>readline</b> will wait for a character when reading an
ambiguous key sequence (one that can form a complete key
sequence using the input read so far, or can take additional
input to complete a longer key sequence). If <b>readline</b>
does not receive any input within the timeout, it uses the
shorter but complete key sequence. The value is specified in
milliseconds, so a value of 1000 means that <b>readline</b>
will wait one second for additional input. If this variable
is set to a value less than or equal to zero, or to a
non-numeric value, <b>readline</b> waits until another key
is pressed to decide which key sequence to complete.</p>
<p style="margin-left:9%;"><b>mark&minus;directories
(On)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>, completed
directory names have a slash appended.</p>
<p style="margin-left:9%;"><b>mark&minus;modified&minus;lines
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>,
<b>readline</b> displays history lines that have been
modified with a preceding asterisk (<b>*</b>).</p>
<p style="margin-left:9%;"><b>mark&minus;symlinked&minus;directories
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>, completed
names which are symbolic links to directories have a slash
appended, subject to the value of
<b>mark&minus;directories</b>.</p>
<p style="margin-left:9%;"><b>match&minus;hidden&minus;files
(On)</b></p>
<p style="margin-left:18%;">This variable, when set to
<b>On</b>, forces <b>readline</b> to match files whose names
begin with a &ldquo;.&rdquo; (hidden files) when performing
filename completion. If set to <b>Off</b>, the user must
include the leading &ldquo;.&rdquo; in the filename to be
completed.</p>
<p style="margin-left:9%;"><b>menu&minus;complete&minus;display&minus;prefix
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>, menu
completion displays the common prefix of the list of
possible completions (which may be empty) before cycling
through the list.</p>
<p style="margin-left:9%;"><b>output&minus;meta
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>,
<b>readline</b> displays characters with the eighth bit set
directly rather than as a meta-prefixed escape sequence. The
default is <i>Off</i>, but <b>readline</b> sets it to
<i>On</i> if the locale contains characters whose encodings
may include bytes with the eighth bit set. This variable is
dependent on the <b>LC_CTYPE</b> locale category, and its
value may change if the locale changes.</p>
<p style="margin-left:9%;"><b>page&minus;completions
(On)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>,
<b>readline</b> uses an internal pager resembling
<i>more</i>(1) to display a screenful of possible
completions at a time.</p>
<p style="margin-left:9%;"><b>prefer&minus;visible&minus;bell</b></p>
<p style="margin-left:18%;">See
<b>bell&minus;style</b>.</p>
<p style="margin-left:9%;"><b>print&minus;completions&minus;horizontally
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>,
<b>readline</b> displays completions with matches sorted
horizontally in alphabetical order, rather than down the
screen.</p>
<p style="margin-left:9%;"><b>revert&minus;all&minus;at&minus;newline
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>,
<b>readline</b> will undo all changes to history lines
before returning when executing <b>accept&minus;line</b>. By
default, history lines may be modified and retain individual
undo lists across calls to <b>readline</b>.</p>
<p style="margin-left:9%;"><b>search&minus;ignore&minus;case
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>,
<b>readline</b> performs incremental and non-incremental
history list searches in a case&minus;insensitive
fashion.</p>
<p style="margin-left:9%;"><b>show&minus;all&minus;if&minus;ambiguous
(Off)</b></p>
<p style="margin-left:18%;">This alters the default
behavior of the completion functions. If set to <b>On</b>,
words which have more than one possible completion cause the
matches to be listed immediately instead of ringing the
bell.</p>
<p style="margin-left:9%;"><b>show&minus;all&minus;if&minus;unmodified
(Off)</b></p>
<p style="margin-left:18%;">This alters the default
behavior of the completion functions in a fashion similar to
<b>show&minus;all&minus;if&minus;ambiguous</b>. If set to
<b>On</b>, words which have more than one possible
completion without any possible partial completion (the
possible completions don&rsquo;t share a common prefix)
cause the matches to be listed immediately instead of
ringing the bell.</p>
<p style="margin-left:9%;"><b>show&minus;mode&minus;in&minus;prompt
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>, add a
string to the beginning of the prompt indicating the editing
mode: emacs, vi command, or vi insertion. The mode strings
are user-settable (e.g.,
<i>emacs&minus;mode&minus;string</i>).</p>
<p style="margin-left:9%;"><b>skip&minus;completed&minus;text
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>, this
alters the default completion behavior when inserting a
single match into the line. It&rsquo;s only active when
performing completion in the middle of a word. If enabled,
<b>readline</b> does not insert characters from the
completion that match characters after point in the word
being completed, so portions of the word following the
cursor are not duplicated.</p>
<p style="margin-left:9%;"><b>vi&minus;cmd&minus;mode&minus;string
((cmd))</b></p>
<p style="margin-left:18%;">If the
<i>show&minus;mode&minus;in&minus;prompt</i> variable is
enabled, this string is displayed immediately before the
last line of the primary prompt when vi editing mode is
active and in command mode. The value is expanded like a key
binding, so the standard set of meta- and control- prefixes
and backslash escape sequences is available. The \1 and \2
escapes begin and end sequences of non-printing characters,
which can be used to embed a terminal control sequence into
the mode string.</p>
<p style="margin-left:9%;"><b>vi&minus;ins&minus;mode&minus;string
((ins))</b></p>
<p style="margin-left:18%;">If the
<i>show&minus;mode&minus;in&minus;prompt</i> variable is
enabled, this string is displayed immediately before the
last line of the primary prompt when vi editing mode is
active and in insertion mode. The value is expanded like a
key binding, so the standard set of meta- and control-
prefixes and backslash escape sequences is available. The \1
and \2 escapes begin and end sequences of non-printing
characters, which can be used to embed a terminal control
sequence into the mode string.</p>
<p style="margin-left:9%;"><b>visible&minus;stats
(Off)</b></p>
<p style="margin-left:18%;">If set to <b>On</b>, a
character denoting a file&rsquo;s type as reported by
<i>stat</i>(2) is appended to the filename when listing
possible completions.</p>
<h3>Readline Conditional Constructs
<a name="Readline Conditional Constructs"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em"><b>Readline</b>
implements a facility similar in spirit to the conditional
compilation features of the C preprocessor which allows key
bindings and variable settings to be performed as the result
of tests. There are four parser directives available.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="4%">
<p><b>$if</b></p></td>
<td width="5%"></td>
<td width="82%">
<p>The <b>$if</b> construct allows bindings to be made
based on the editing mode, the terminal being used, or the
application using <b>readline</b>. The text of the test,
after any comparison operator, extends to the end of the
line; unless otherwise noted, no characters are required to
isolate it.</p></td></tr>
</table>
<p style="margin-left:18%;"><b>mode</b></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%"></td>
<td width="4%"></td>
<td width="73%">
<p style="margin-top: 1em">The <b>mode=</b> form of the
<b>$if</b> directive is used to test whether <b>readline</b>
is in emacs or vi mode. This may be used in conjunction with
the <b>set keymap</b> command, for instance, to set bindings
in the <i>emacs&minus;standard</i> and
<i>emacs&minus;ctlx</i> keymaps only if <b>readline</b> is
starting out in emacs mode.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="5%">
<p><b>term</b></p></td>
<td width="4%"></td>
<td width="73%">
<p>The <b>term=</b> form may be used to include
terminal-specific key bindings, perhaps to bind the key
sequences output by the terminal&rsquo;s function keys. The
word on the right side of the <b>=</b> is tested against
both the full name of the terminal and the portion of the
terminal name before the first <b>&minus;</b>. This allows
<i>xterm</i> to match both <i>xterm</i> and
<i>xterm&minus;256color</i>, for instance.</p></td></tr>
</table>
<p style="margin-left:18%;"><b>version</b></p>
<p style="margin-left:27%;">The <b>version</b> test may be
used to perform comparisons against specific <b>readline</b>
versions. The <b>version</b> expands to the current
<b>readline</b> version. The set of comparison operators
includes <b>=</b>, (and <b>==</b>), <b>!=</b>, <b>&lt;=</b>,
<b>&gt;=</b>, <b>&lt;</b>, and <b>&gt;</b>. The version
number supplied on the right side of the operator consists
of a major version number, an optional decimal point, and an
optional minor version (e.g., <b>7.1</b>). If the minor
version is omitted, it defaults to <b>0</b>. The operator
may be separated from the string <b>version</b> and from the
version number argument by whitespace.</p>
<p style="margin-left:18%;"><i>application</i></p>
<p style="margin-left:27%;">The <i>application</i>
construct is used to include application-specific settings.
Each program using the <b>readline</b> library sets the
<i>application name</i>, and an initialization file can test
for a particular value. This could be used to bind key
sequences to functions useful for a specific program. For
instance, the following command adds a key sequence that
quotes the current or previous word in <b>bash</b>:</p>
<p style="margin-left:27%; margin-top: 1em"><b>$if</b> Bash
<br>
# Quote the current or previous word <br>
&quot;\C-xq&quot;: &quot;\eb\&quot;\ef\&quot;&quot; <b><br>
$endif</b></p>
<p style="margin-left:18%;"><i>variable</i></p>
<p style="margin-left:27%;">The <i>variable</i> construct
provides simple equality tests for <b>readline</b> variables
and values. The permitted comparison operators are <i>=</i>,
<i>==</i>, and <i>!=</i>. The variable name must be
separated from the comparison operator by whitespace; the
operator may be separated from the value on the right hand
side by whitespace. String and boolean variables may be
tested. Boolean variables must be tested against the values
<i>on</i> and <i>off</i>.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>$else</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>Commands in this branch of the <b>$if</b> directive are
executed if the test fails.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>$endif</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>This command, as seen in the previous example,
terminates an <b>$if</b> command.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>$include</b></p>
<p style="margin-left:18%;">This directive takes a single
filename as an argument and reads commands and key bindings
from that file. For example, the following directive would
read <A HREF="file:/etc/inputrc"><i>/etc/inputrc</i></A>:</p>
<p style="margin-left:18%; margin-top: 1em"><b>$include</b>
<A HREF="file:/etc/inputrc"><i>/etc/inputrc</i></A></p>
<h3>Searching
<a name="Searching"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em"><i><b>Readline</b></i>
provides commands for searching through the command history
(see <b><small>HISTORY</small></b> below) for lines
containing a specified string. There are two search modes:
<i>incremental</i> and <i>non-incremental</i>.</p>
<p style="margin-left:9%; margin-top: 1em">Incremental
searches begin before the user has finished typing the
search string. As each character of the search string is
typed, <b>readline</b> displays the next entry from the
history matching the string typed so far. An incremental
search requires only as many characters as needed to find
the desired history entry. When using emacs editing mode,
type <b>C&minus;r</b> to search backward in the history for
a particular string. Typing <b>C&minus;s</b> searches
forward through the history. The characters present in the
value of the <b>isearch-terminators</b> variable are used to
terminate an incremental search. If that variable has not
been assigned a value, <i>ESC</i> and <b>C&minus;j</b>
terminate an incremental search. <b>C&minus;g</b> aborts an
incremental search and restores the original line. When the
search is terminated, the history entry containing the
search string becomes the current line.</p>
<p style="margin-left:9%; margin-top: 1em">To find other
matching entries in the history list, type <b>C&minus;r</b>
or <b>C&minus;s</b> as appropriate. This searches backward
or forward in the history for the next entry matching the
search string typed so far. Any other key sequence bound to
a <b>readline</b> command terminates the search and executes
that command. For instance, a newline terminates the search
and accepts the line, thereby executing the command from the
history list. A movement command will terminate the search,
make the last line found the current line, and begin
editing.</p>
<p style="margin-left:9%; margin-top: 1em"><b>Readline</b>
remembers the last incremental search string. If two
<b>C&minus;r</b>s are typed without any intervening
characters defining a new search string, <b>readline</b>
uses any remembered search string.</p>
<p style="margin-left:9%; margin-top: 1em">Non-incremental
searches read the entire search string before starting to
search for matching history entries. The search string may
be typed by the user or be part of the contents of the
current line.</p>
<h3>Readline Command Names
<a name="Readline Command Names"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">The following is
a list of the names of the commands and the default key
sequences to which they are bound. Command names without an
accompanying key sequence are unbound by default.</p>
<p style="margin-left:9%; margin-top: 1em">In the following
descriptions, <i>point</i> refers to the current cursor
position, and <i>mark</i> refers to a cursor position saved
by the <b>set&minus;mark</b> command. The text between the
point and mark is referred to as the <i>region</i>.
<b>Readline</b> has the concept of an <i>active region</i>:
when the region is active, <b>readline</b> redisplay
highlights the region using the value of the
<b>active&minus;region&minus;start&minus;color</b> variable.
The <b>enable&minus;active&minus;region readline</b>
variable turns this on and off. Several commands set the
region to active; those are noted below.</p>
<h3>Commands for Moving
<a name="Commands for Moving"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em"><b>beginning&minus;of&minus;line
(C&minus;a)</b></p>
<p style="margin-left:18%;">Move to the start of the
current line. This may also be bound to the Home key on some
keyboards.</p>
<p style="margin-left:9%;"><b>end&minus;of&minus;line
(C&minus;e)</b></p>
<p style="margin-left:18%;">Move to the end of the line.
This may also be bound to the End key on some keyboards.</p>
<p style="margin-left:9%;"><b>forward&minus;char
(C&minus;f)</b></p>
<p style="margin-left:18%;">Move forward a character. This
may also be bound to the right arrow key on some
keyboards.</p>
<p style="margin-left:9%;"><b>backward&minus;char
(C&minus;b)</b></p>
<p style="margin-left:18%;">Move back a character. This may
also be bound to the left arrow key on some keyboards.</p>
<p style="margin-left:9%;"><b>forward&minus;word
(M&minus;f)</b></p>
<p style="margin-left:18%;">Move forward to the end of the
next word. Words are composed of alphanumeric characters
(letters and digits).</p>
<p style="margin-left:9%;"><b>backward&minus;word
(M&minus;b)</b></p>
<p style="margin-left:18%;">Move back to the start of the
current or previous word. Words are composed of alphanumeric
characters (letters and digits).</p>
<p style="margin-left:9%;"><b>shell&minus;forward&minus;word
(M&minus;C&minus;f)</b></p>
<p style="margin-left:18%;">Move forward to the end of the
next word. Words are delimited by non-quoted shell
metacharacters.</p>
<p style="margin-left:9%;"><b>shell&minus;backward&minus;word
(M&minus;C&minus;b)</b></p>
<p style="margin-left:18%;">Move back to the start of the
current or previous word. Words are delimited by non-quoted
shell metacharacters.</p>
<p style="margin-left:9%;"><b>previous&minus;screen&minus;line</b></p>
<p style="margin-left:18%;">Attempt to move point to the
same physical screen column on the previous physical screen
line. This will not have the desired effect if the current
<b>readline</b> line does not take up more than one physical
line or if point is not greater than the length of the
prompt plus the screen width.</p>
<p style="margin-left:9%;"><b>next&minus;screen&minus;line</b></p>
<p style="margin-left:18%;">Attempt to move point to the
same physical screen column on the next physical screen
line. This will not have the desired effect if the current
<b>readline</b> line does not take up more than one physical
line or if the length of the current <b>readline</b> line is
not greater than the length of the prompt plus the screen
width.</p>
<p style="margin-left:9%;"><b>clear&minus;display
(M&minus;C&minus;l)</b></p>
<p style="margin-left:18%;">Clear the screen and, if
possible, the terminal&rsquo;s scrollback buffer, then
redraw the current line, leaving the current line at the top
of the screen.</p>
<p style="margin-left:9%;"><b>clear&minus;screen
(C&minus;l)</b></p>
<p style="margin-left:18%;">Clear the screen, then redraw
the current line, leaving the current line at the top of the
screen. With a numeric argument, refresh the current line
without clearing the screen.</p>
<p style="margin-left:9%;"><b>redraw&minus;current&minus;line</b></p>
<p style="margin-left:18%;">Refresh the current line.</p>
<h3>Commands for Manipulating the History
<a name="Commands for Manipulating the History"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em"><b>accept&minus;line
(Newline, Return)</b></p>
<p style="margin-left:18%;">Accept the line regardless of
where the cursor is. If this line is non-empty, add it to
the history list according to the state of the
<b><small>HISTCONTROL</small></b> and <b>HISTIGNORE</b>
variables. If the line is a modified history line, restore
the history line to its original state.</p>
<p style="margin-left:9%;"><b>previous&minus;history
(C&minus;p)</b></p>
<p style="margin-left:18%;">Fetch the previous command from
the history list, moving back in the list. This may also be
bound to the up arrow key on some keyboards.</p>
<p style="margin-left:9%;"><b>next&minus;history
(C&minus;n)</b></p>
<p style="margin-left:18%;">Fetch the next command from the
history list, moving forward in the list. This may also be
bound to the down arrow key on some keyboards.</p>
<p style="margin-left:9%;"><b>beginning&minus;of&minus;history
(M&minus;&lt;)</b></p>
<p style="margin-left:18%;">Move to the first line in the
history.</p>
<p style="margin-left:9%;"><b>end&minus;of&minus;history
(M&minus;&gt;)</b></p>
<p style="margin-left:18%;">Move to the end of the input
history, i.e., the line currently being entered.</p>
<p style="margin-left:9%;"><b>operate&minus;and&minus;get&minus;next
(C&minus;o)</b></p>
<p style="margin-left:18%;">Accept the current line for
execution as if a newline had been entered, and fetch the
next line relative to the current line from the history for
editing. A numeric argument, if supplied, specifies the
history entry to use instead of the current line.</p>
<p style="margin-left:9%;"><b>fetch&minus;history</b></p>
<p style="margin-left:18%;">With a numeric argument, fetch
that entry from the history list and make it the current
line. Without an argument, move back to the first entry in
the history list.</p>
<p style="margin-left:9%;"><b>reverse&minus;search&minus;history
(C&minus;r)</b></p>
<p style="margin-left:18%;">Search backward starting at the
current line and moving &ldquo;up&rdquo; through the history
as necessary. This is an incremental search. This command
sets the region to the matched text and activates the
region.</p>
<p style="margin-left:9%;"><b>forward&minus;search&minus;history
(C&minus;s)</b></p>
<p style="margin-left:18%;">Search forward starting at the
current line and moving &ldquo;down&rdquo; through the
history as necessary. This is an incremental search. This
command sets the region to the matched text and activates
the region.</p>
<p style="margin-left:9%;"><b>non&minus;incremental&minus;reverse&minus;search&minus;history
(M&minus;p)</b></p>
<p style="margin-left:18%;">Search backward through the
history starting at the current line using a non-incremental
search for a string supplied by the user. The search string
may match anywhere in a history line.</p>
<p style="margin-left:9%;"><b>non&minus;incremental&minus;forward&minus;search&minus;history
(M&minus;n)</b></p>
<p style="margin-left:18%;">Search forward through the
history using a non-incremental search for a string supplied
by the user. The search string may match anywhere in a
history line.</p>
<p style="margin-left:9%;"><b>history&minus;search&minus;backward</b></p>
<p style="margin-left:18%;">Search backward through the
history for the string of characters between the start of
the current line and the point. The search string must match
at the beginning of a history line. This is a
non-incremental search. This may be bound to the Page Up key
on some keyboards.</p>
<p style="margin-left:9%;"><b>history&minus;search&minus;forward</b></p>
<p style="margin-left:18%;">Search forward through the
history for the string of characters between the start of
the current line and the point. The search string must match
at the beginning of a history line. This is a
non-incremental search. This may be bound to the Page Down
key on some keyboards.</p>
<p style="margin-left:9%;"><b>history&minus;substring&minus;search&minus;backward</b></p>
<p style="margin-left:18%;">Search backward through the
history for the string of characters between the start of
the current line and the point. The search string may match
anywhere in a history line. This is a non-incremental
search.</p>
<p style="margin-left:9%;"><b>history&minus;substring&minus;search&minus;forward</b></p>
<p style="margin-left:18%;">Search forward through the
history for the string of characters between the start of
the current line and the point. The search string may match
anywhere in a history line. This is a non-incremental
search.</p>
<p style="margin-left:9%;"><b>yank&minus;nth&minus;arg
(M&minus;C&minus;y)</b></p>
<p style="margin-left:18%;">Insert the first argument to
the previous command (usually the second word on the
previous line) at point. With an argument <i>n</i>, insert
the <i>n</i>th word from the previous command (the words in
the previous command begin with word 0). A negative argument
inserts the <i>n</i>th word from the end of the previous
command. Once the argument <i>n</i> is computed, this uses
the history expansion facilities to extract the <i>n</i>th
word, as if the &ldquo;!<i>n</i>&rdquo; history expansion
had been specified.</p>
<p style="margin-left:9%;"><b>yank&minus;last&minus;arg
(M&minus;., M&minus;_)</b></p>
<p style="margin-left:18%;">Insert the last argument to the
previous command (the last word of the previous history
entry). With a numeric argument, behave exactly like
<b>yank&minus;nth&minus;arg</b>. Successive calls to
<b>yank&minus;last&minus;arg</b> move back through the
history list, inserting the last word (or the word specified
by the argument to the first call) of each line in turn. Any
numeric argument supplied to these successive calls
determines the direction to move through the history. A
negative argument switches the direction through the history
(back or forward). This uses the history expansion
facilities to extract the last word, as if the
&ldquo;!$&rdquo; history expansion had been specified.</p>
<p style="margin-left:9%;"><b>shell&minus;expand&minus;line
(M&minus;C&minus;e)</b></p>
<p style="margin-left:18%;">Expand the line by performing
shell word expansions. This performs alias and history
expansion, <b>$</b>'<i>string</i>' and
<b>$</b>&quot;<i>string</i>&quot; quoting, tilde expansion,
parameter and variable expansion, arithmetic expansion,
command and process substitution, word splitting, and quote
removal. An explicit argument suppresses command and process
substitution. See <b><small>HISTORY EXPANSION</small></b>
below for a description of history expansion.</p>
<p style="margin-left:9%;"><b>history&minus;expand&minus;line
(M&minus;^)</b></p>
<p style="margin-left:18%;">Perform history expansion on
the current line. See <b><small>HISTORY
EXPANSION</small></b> below for a description of history
expansion.</p>
<p style="margin-left:9%;"><b>magic&minus;space</b></p>
<p style="margin-left:18%;">Perform history expansion on
the current line and insert a space. See <b><small>HISTORY
EXPANSION</small></b> below for a description of history
expansion.</p>
<p style="margin-left:9%;"><b>alias&minus;expand&minus;line</b></p>
<p style="margin-left:18%;">Perform alias expansion on the
current line. See <b><small>ALIASES</small></b> above for a
description of alias expansion.</p>
<p style="margin-left:9%;"><b>history&minus;and&minus;alias&minus;expand&minus;line</b></p>
<p style="margin-left:18%;">Perform history and alias
expansion on the current line.</p>
<p style="margin-left:9%;"><b>insert&minus;last&minus;argument
(M&minus;., M&minus;_)</b></p>
<p style="margin-left:18%;">A synonym for
<b>yank&minus;last&minus;arg</b>.</p>
<p style="margin-left:9%;"><b>edit&minus;and&minus;execute&minus;command
(C&minus;x C&minus;e)</b></p>
<p style="margin-left:18%;">Invoke an editor on the current
command line, and execute the result as shell commands.
<b>Bash</b> attempts to invoke
<b><small>$VISUAL</small></b><small>,
<b>$EDITOR</b>,</small> and <i>emacs</i> as the editor, in
that order.</p>
<h3>Commands for Changing Text
<a name="Commands for Changing Text"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em"><i>end&minus;of&minus;file</i>
<b>(usually C&minus;d)</b></p>
<p style="margin-left:18%;">The character indicating
end-of-file as set, for example, by <i>stty</i>(1). If this
character is read when there are no characters on the line,
and point is at the beginning of the line, <b>readline</b>
interprets it as the end of input and returns
<b><small>EOF</small></b><small>.</small></p>
<p style="margin-left:9%;"><b>delete&minus;char
(C&minus;d)</b></p>
<p style="margin-left:18%;">Delete the character at point.
If this function is bound to the same character as the tty
<b>EOF</b> character, as <b>C&minus;d</b> commonly is, see
above for the effects. This may also be bound to the Delete
key on some keyboards.</p>
<p style="margin-left:9%;"><b>backward&minus;delete&minus;char
(Rubout)</b></p>
<p style="margin-left:18%;">Delete the character behind the
cursor. When given a numeric argument, save the deleted text
on the kill ring.</p>
<p style="margin-left:9%;"><b>forward&minus;backward&minus;delete&minus;char</b></p>
<p style="margin-left:18%;">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.</p>
<p style="margin-left:9%;"><b>quoted&minus;insert
(C&minus;q, C&minus;v)</b></p>
<p style="margin-left:18%;">Add the next character typed to
the line verbatim. This is how to insert characters like
<b>C&minus;q</b>, for example.</p>
<p style="margin-left:9%;"><b>tab&minus;insert (C&minus;v
TAB)</b></p>
<p style="margin-left:18%;">Insert a tab character.</p>
<p style="margin-left:9%;"><b>self&minus;insert (a, b, A,
1, !,</b> ...<b>)</b></p>
<p style="margin-left:18%;">Insert the character typed.</p>
<p style="margin-left:9%;"><b>bracketed&minus;paste&minus;begin</b></p>
<p style="margin-left:18%;">This function is intended to be
bound to the &ldquo;bracketed paste&rdquo; escape sequence
sent by some terminals, and such a binding is assigned by
default. It allows <b>readline</b> to insert the pasted text
as a single unit without treating each character as if it
had been read from the keyboard. The pasted characters are
inserted as if each one was bound to
<b>self&minus;insert</b> instead of executing any editing
commands. <br>
Bracketed paste sets the region to the inserted text and
activates the region.</p>
<p style="margin-left:9%;"><b>transpose&minus;chars
(C&minus;t)</b></p>
<p style="margin-left:18%;">Drag the character before point
forward over the character at point, moving point forward as
well. If point is at the end of the line, then this
transposes the two characters before point. Negative
arguments have no effect.</p>
<p style="margin-left:9%;"><b>transpose&minus;words
(M&minus;t)</b></p>
<p style="margin-left:18%;">Drag the word before point past
the word after point, moving point past that word as well.
If point is at the end of the line, this transposes the last
two words on the line.</p>
<p style="margin-left:9%;"><b>shell&minus;transpose&minus;words
(M-C-t)</b></p>
<p style="margin-left:18%;">Drag the word before point past
the word after point, moving point past that word as well.
If the insertion point is at the end of the line, this
transposes the last two words on the line. Word boundaries
are the same as <b>shell&minus;forward&minus;word</b> and
<b>shell&minus;backward&minus;word</b>.</p>
<p style="margin-left:9%;"><b>upcase&minus;word
(M&minus;u)</b></p>
<p style="margin-left:18%;">Uppercase the current (or
following) word. With a negative argument, uppercase the
previous word, but do not move point.</p>
<p style="margin-left:9%;"><b>downcase&minus;word
(M&minus;l)</b></p>
<p style="margin-left:18%;">Lowercase the current (or
following) word. With a negative argument, lowercase the
previous word, but do not move point.</p>
<p style="margin-left:9%;"><b>capitalize&minus;word
(M&minus;c)</b></p>
<p style="margin-left:18%;">Capitalize the current (or
following) word. With a negative argument, capitalize the
previous word, but do not move point.</p>
<p style="margin-left:9%;"><b>overwrite&minus;mode</b></p>
<p style="margin-left:18%;">Toggle overwrite mode. With an
explicit positive numeric argument, switches to overwrite
mode. With an explicit non-positive numeric argument,
switches to insert mode. This command affects only
<b>emacs</b> mode; <b>vi</b> mode does overwrite
differently. Each call to <i>readline()</i> starts in insert
mode. <br>
In overwrite mode, characters bound to
<b>self&minus;insert</b> replace the text at point rather
than pushing the text to the right. Characters bound to
<b>backward&minus;delete&minus;char</b> replace the
character before point with a space. By default, this
command is unbound, but may be bound to the Insert key on
some keyboards.</p>
<h3>Killing and Yanking
<a name="Killing and Yanking"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em"><b>kill&minus;line
(C&minus;k)</b></p>
<p style="margin-left:18%;">Kill the text from point to the
end of the current line. With a negative numeric argument,
kill backward from the cursor to the beginning of the
line.</p>
<p style="margin-left:9%;"><b>backward&minus;kill&minus;line
(C&minus;x Rubout)</b></p>
<p style="margin-left:18%;">Kill backward to the beginning
of the current line. With a negative numeric argument, kill
forward from the cursor to the end of the line.</p>
<p style="margin-left:9%;"><b>unix&minus;line&minus;discard
(C&minus;u)</b></p>
<p style="margin-left:18%;">Kill backward from point to the
beginning of the line, saving the killed text on the
kill-ring.</p>
<p style="margin-left:9%;"><b>kill&minus;whole&minus;line</b></p>
<p style="margin-left:18%;">Kill all characters on the
current line, no matter where point is.</p>
<p style="margin-left:9%;"><b>kill&minus;word
(M&minus;d)</b></p>
<p style="margin-left:18%;">Kill from point to the end of
the current word, or if between words, to the end of the
next word. Word boundaries are the same as those used by
<b>forward&minus;word</b>.</p>
<p style="margin-left:9%;"><b>backward&minus;kill&minus;word
(M&minus;Rubout)</b></p>
<p style="margin-left:18%;">Kill the word behind point.
Word boundaries are the same as those used by
<b>backward&minus;word</b>.</p>
<p style="margin-left:9%;"><b>shell&minus;kill&minus;word
(M&minus;C&minus;d)</b></p>
<p style="margin-left:18%;">Kill from point to the end of
the current word, or if between words, to the end of the
next word. Word boundaries are the same as those used by
<b>shell&minus;forward&minus;word</b>.</p>
<p style="margin-left:9%;"><b>shell&minus;backward&minus;kill&minus;word</b></p>
<p style="margin-left:18%;">Kill the word behind point.
Word boundaries are the same as those used by
<b>shell&minus;backward&minus;word</b>.</p>
<p style="margin-left:9%;"><b>unix&minus;word&minus;rubout
(C&minus;w)</b></p>
<p style="margin-left:18%;">Kill the word behind point,
using white space as a word boundary, saving the killed text
on the kill-ring.</p>
<p style="margin-left:9%;"><b>unix&minus;filename&minus;rubout</b></p>
<p style="margin-left:18%;">Kill the word behind point,
using white space and the slash character as the word
boundaries, saving the killed text on the kill-ring.</p>
<p style="margin-left:9%;"><b>delete&minus;horizontal&minus;space
(M&minus;\)</b></p>
<p style="margin-left:18%;">Delete all spaces and tabs
around point.</p>
<p style="margin-left:9%;"><b>kill&minus;region</b></p>
<p style="margin-left:18%;">Kill the text in the current
region.</p>
<p style="margin-left:9%;"><b>copy&minus;region&minus;as&minus;kill</b></p>
<p style="margin-left:18%;">Copy the text in the region to
the kill buffer, so it can be yanked immediately.</p>
<p style="margin-left:9%;"><b>copy&minus;backward&minus;word</b></p>
<p style="margin-left:18%;">Copy the word before point to
the kill buffer. The word boundaries are the same as
<b>backward&minus;word</b>.</p>
<p style="margin-left:9%;"><b>copy&minus;forward&minus;word</b></p>
<p style="margin-left:18%;">Copy the word following point
to the kill buffer. The word boundaries are the same as
<b>forward&minus;word</b>.</p>
<p style="margin-left:9%;"><b>yank (C&minus;y)</b></p>
<p style="margin-left:18%;">Yank the top of the kill ring
into the buffer at point.</p>
<p style="margin-left:9%;"><b>yank&minus;pop
(M&minus;y)</b></p>
<p style="margin-left:18%;">Rotate the kill ring, and yank
the new top. Only works following <b>yank</b> or
<b>yank&minus;pop</b>.</p>
<h3>Numeric Arguments
<a name="Numeric Arguments"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em"><b>digit&minus;argument
(M&minus;0, M&minus;1,</b> ...<b>, M&minus;&minus;)</b></p>
<p style="margin-left:18%;">Add this digit to the argument
already accumulating, or start a new argument.
M&minus;&minus; starts a negative argument.</p>
<p style="margin-left:9%;"><b>universal&minus;argument</b></p>
<p style="margin-left:18%;">This is another way to specify
an argument. If this command is followed by one or more
digits, optionally with a leading minus sign, those digits
define the argument. If the command is followed by digits,
executing <b>universal&minus;argument</b> again ends the
numeric argument, but is otherwise ignored. As a special
case, if this command is immediately followed by a character
that is neither a digit nor minus sign, the argument count
for the next command is multiplied by four. The argument
count is initially one, so executing this function the first
time makes the argument count four, a second time makes the
argument count sixteen, and so on.</p>
<h3>Completing
<a name="Completing"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em"><b>complete
(TAB)</b></p>
<p style="margin-left:18%;">Attempt to perform completion
on the text before point. <b>Bash</b> attempts completion by
first checking for any programmable completions for the
command word (see <b>Programmable Completion</b> below),
otherwise treating the text as a variable (if the text
begins with <b>$</b>), username (if the text begins with
<b>~</b>), hostname (if the text begins with <b>@</b>), or
command (including aliases, functions, and builtins) in
turn. If none of these produces a match, it falls back to
filename completion.</p>
<p style="margin-left:9%;"><b>possible&minus;completions
(M&minus;?)</b></p>
<p style="margin-left:18%;">List the possible completions
of the text before point. When displaying completions,
<b>readline</b> sets the number of columns used for display
to the value of <b>completion-display-width</b>, the value
of the shell variable
<b><small>COLUMNS</small></b><small>,</small> or the screen
width, in that order.</p>
<p style="margin-left:9%;"><b>insert&minus;completions
(M&minus;*)</b></p>
<p style="margin-left:18%;">Insert all completions of the
text before point that would have been generated by
<b>possible&minus;completions</b>, separated by a space.</p>
<p style="margin-left:9%;"><b>menu&minus;complete</b></p>
<p style="margin-left:18%;">Similar to <b>complete</b>, but
replaces the word to be completed with a single match from
the list of possible completions. Repeatedly executing
<b>menu&minus;complete</b> steps through the list of
possible completions, inserting each match in turn. At the
end of the list of completions, <b>menu&minus;complete</b>
rings the bell (subject to the setting of
<b>bell&minus;style</b>) and restores the original text. An
argument of <i>n</i> moves <i>n</i> positions forward in the
list of matches; a negative argument moves backward through
the list. This command is intended to be bound to
<b>TAB</b>, but is unbound by default.</p>
<p style="margin-left:9%;"><b>menu&minus;complete&minus;backward</b></p>
<p style="margin-left:18%;">Identical to
<b>menu&minus;complete</b>, but moves backward through the
list of possible completions, as if
<b>menu&minus;complete</b> had been given a negative
argument. This command is unbound by default.</p>
<p style="margin-left:9%;"><b>export&minus;completions</b></p>
<p style="margin-left:18%;">Perform completion on the word
before point as described above and write the list of
possible completions to <b>readline</b>&rsquo;s output
stream using the following format, writing information on
separate lines:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>the number of matches <i>N</i>;</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>the word being completed;</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p><i>S</i>:<i>E</i>, where <i>S</i> and <i>E</i> are the
start and end offsets of the word in the <b>readline</b>
line buffer; then</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>each match, one per line</p></td></tr>
</table>
<p style="margin-left:18%; margin-top: 1em">If there are no
matches, the first line will be &ldquo;0&rdquo;, and this
command does not print any output after the
<i>S</i>:<i>E</i>. If there is only a single match, this
prints a single line containing it. If there is more than
one match, this prints the common prefix of the matches,
which may be empty, on the first line after the
<i>S</i>:<i>E</i>, then the matches on subsequent lines. In
this case, <i>N</i> will include the first line with the
common prefix.</p>
<p style="margin-left:18%; margin-top: 1em">The user or
application should be able to accommodate the possibility of
a blank line. The intent is that the user or application
reads <i>N</i> lines after the line containing
<i>S</i>:<i>E</i> to obtain the match list. This command is
unbound by default.</p>
<p style="margin-left:9%;"><b>delete&minus;char&minus;or&minus;list</b></p>
<p style="margin-left:18%;">Deletes the character under the
cursor if not at the beginning or end of the line (like
<b>delete&minus;char</b>). At the end of the line, it
behaves identically to <b>possible&minus;completions</b>.
This command is unbound by default.</p>
<p style="margin-left:9%;"><b>complete&minus;filename
(M&minus;/)</b></p>
<p style="margin-left:18%;">Attempt filename completion on
the text before point.</p>
<p style="margin-left:9%;"><b>possible&minus;filename&minus;completions
(C&minus;x /)</b></p>
<p style="margin-left:18%;">List the possible completions
of the text before point, treating it as a filename.</p>
<p style="margin-left:9%;"><b>complete&minus;username
(M&minus;~)</b></p>
<p style="margin-left:18%;">Attempt completion on the text
before point, treating it as a username.</p>
<p style="margin-left:9%;"><b>possible&minus;username&minus;completions
(C&minus;x ~)</b></p>
<p style="margin-left:18%;">List the possible completions
of the text before point, treating it as a username.</p>
<p style="margin-left:9%;"><b>complete&minus;variable
(M&minus;$)</b></p>
<p style="margin-left:18%;">Attempt completion on the text
before point, treating it as a shell variable.</p>
<p style="margin-left:9%;"><b>possible&minus;variable&minus;completions
(C&minus;x $)</b></p>
<p style="margin-left:18%;">List the possible completions
of the text before point, treating it as a shell
variable.</p>
<p style="margin-left:9%;"><b>complete&minus;hostname
(M&minus;@)</b></p>
<p style="margin-left:18%;">Attempt completion on the text
before point, treating it as a hostname.</p>
<p style="margin-left:9%;"><b>possible&minus;hostname&minus;completions
(C&minus;x @)</b></p>
<p style="margin-left:18%;">List the possible completions
of the text before point, treating it as a hostname.</p>
<p style="margin-left:9%;"><b>complete&minus;command
(M&minus;!)</b></p>
<p style="margin-left:18%;">Attempt completion on the text
before point, treating it as a command name. Command
completion attempts to match the text against aliases,
reserved words, shell functions, shell builtins, and finally
executable filenames, in that order.</p>
<p style="margin-left:9%;"><b>possible&minus;command&minus;completions
(C&minus;x !)</b></p>
<p style="margin-left:18%;">List the possible completions
of the text before point, treating it as a command name.</p>
<p style="margin-left:9%;"><b>dynamic&minus;complete&minus;history
(M&minus;TAB)</b></p>
<p style="margin-left:18%;">Attempt completion on the text
before point, comparing the text against history list
entries for possible completion matches.</p>
<p style="margin-left:9%;"><b>dabbrev&minus;expand</b></p>
<p style="margin-left:18%;">Attempt menu completion on the
text before point, comparing the text against lines from the
history list for possible completion matches.</p>
<p style="margin-left:9%;"><b>complete&minus;into&minus;braces
(M&minus;{)</b></p>
<p style="margin-left:18%;">Perform filename completion and
insert the list of possible completions enclosed within
braces so the list is available to the shell (see <b>Brace
Expansion</b> above).</p>
<h3>Keyboard Macros
<a name="Keyboard Macros"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em"><b>start&minus;kbd&minus;macro
(C&minus;x ()</b></p>
<p style="margin-left:18%;">Begin saving the characters
typed into the current keyboard macro.</p>
<p style="margin-left:9%;"><b>end&minus;kbd&minus;macro
(C&minus;x ))</b></p>
<p style="margin-left:18%;">Stop saving the characters
typed into the current keyboard macro and store the
definition.</p>
<p style="margin-left:9%;"><b>call&minus;last&minus;kbd&minus;macro
(C&minus;x e)</b></p>
<p style="margin-left:18%;">Re-execute the last keyboard
macro defined, by making the characters in the macro appear
as if typed at the keyboard.</p>
<p style="margin-left:9%;"><b>print&minus;last&minus;kbd&minus;macro
()</b></p>
<p style="margin-left:18%;">Print the last keyboard macro
defined in a format suitable for the <i>inputrc</i>
file.</p>
<h3>Miscellaneous
<a name="Miscellaneous"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em"><b>re&minus;read&minus;init&minus;file
(C&minus;x C&minus;r)</b></p>
<p style="margin-left:18%;">Read in the contents of the
<i>inputrc</i> file, and incorporate any bindings or
variable assignments found there.</p>
<p style="margin-left:9%;"><b>abort (C&minus;g)</b></p>
<p style="margin-left:18%;">Abort the current editing
command and ring the terminal&rsquo;s bell (subject to the
setting of <b>bell&minus;style</b>).</p>
<p style="margin-left:9%;"><b>do&minus;lowercase&minus;version
(M&minus;A, M&minus;B, M&minus;</b><i>x</i><b>,</b>
...<b>)</b></p>
<p style="margin-left:18%;">If the metafied character
<i>x</i> is uppercase, run the command that is bound to the
corresponding metafied lowercase character. The behavior is
undefined if <i>x</i> is already lowercase.</p>
<p style="margin-left:9%;"><b>prefix&minus;meta
(ESC)</b></p>
<p style="margin-left:18%;">Metafy the next character
typed. <b><small>ESC</small> f</b> is equivalent to
<b>Meta&minus;f</b>.</p>
<p style="margin-left:9%;"><b>undo (C&minus;_, C&minus;x
C&minus;u)</b></p>
<p style="margin-left:18%;">Incremental undo, separately
remembered for each line.</p>
<p style="margin-left:9%;"><b>revert&minus;line
(M&minus;r)</b></p>
<p style="margin-left:18%;">Undo all changes made to this
line. This is like executing the <b>undo</b> command enough
times to return the line to its initial state.</p>
<p style="margin-left:9%;"><b>tilde&minus;expand
(M&minus;&amp;)</b></p>
<p style="margin-left:18%;">Perform tilde expansion on the
current word.</p>
<p style="margin-left:9%;"><b>set&minus;mark (C&minus;@,
M&minus;&lt;space&gt;)</b></p>
<p style="margin-left:18%;">Set the mark to the point. If a
numeric argument is supplied, set the mark to that
position.</p>
<p style="margin-left:9%;"><b>exchange&minus;point&minus;and&minus;mark
(C&minus;x C&minus;x)</b></p>
<p style="margin-left:18%;">Swap the point with the mark.
Set the current cursor position to the saved position, then
set the mark to the old cursor position.</p>
<p style="margin-left:9%;"><b>character&minus;search
(C&minus;])</b></p>
<p style="margin-left:18%;">Read a character and move point
to the next occurrence of that character. A negative
argument searches for previous occurrences.</p>
<p style="margin-left:9%;"><b>character&minus;search&minus;backward
(M&minus;C&minus;])</b></p>
<p style="margin-left:18%;">Read a character and move point
to the previous occurrence of that character. A negative
argument searches for subsequent occurrences.</p>
<p style="margin-left:9%;"><b>skip&minus;csi&minus;sequence</b></p>
<p style="margin-left:18%;">Read enough characters to
consume a multi-key sequence such as those defined for keys
like Home and End. CSI sequences begin with a Control
Sequence Indicator (CSI), usually <i>ESC [</i>. If this
sequence is bound to &ldquo;\e[&rdquo;, keys producing CSI
sequences have no effect unless explicitly bound to a
<b>readline</b> command, instead of inserting stray
characters into the editing buffer. This is unbound by
default, but usually bound to <i>ESC [</i>.</p>
<p style="margin-left:9%;"><b>insert&minus;comment
(M&minus;#)</b></p>
<p style="margin-left:18%;">Without a numeric argument,
insert the value of the <b>readline comment&minus;begin</b>
variable at the beginning of the current line. If a numeric
argument is supplied, this command acts as a toggle: if the
characters at the beginning of the line do not match the
value of <b>comment&minus;begin</b>, insert the value;
otherwise delete the characters in <b>comment-begin</b> from
the beginning of the line. In either case, the line is
accepted as if a newline had been typed. The default value
of <b>comment&minus;begin</b> causes this command to make
the current line a shell comment. If a numeric argument
causes the comment character to be removed, the line will be
executed by the shell.</p>
<p style="margin-left:9%;"><b>spell&minus;correct&minus;word
(C&minus;x s)</b></p>
<p style="margin-left:18%;">Perform spelling correction on
the current word, treating it as a directory or filename, in
the same way as the <b>cdspell</b> shell option. Word
boundaries are the same as those used by
<b>shell&minus;forward&minus;word</b>.</p>
<p style="margin-left:9%;"><b>glob&minus;complete&minus;word
(M&minus;g)</b></p>
<p style="margin-left:18%;">Treat the word before point as
a pattern for pathname expansion, with an asterisk
implicitly appended, then use the pattern to generate a list
of matching file names for possible completions.</p>
<p style="margin-left:9%;"><b>glob&minus;expand&minus;word
(C&minus;x *)</b></p>
<p style="margin-left:18%;">Treat the word before point as
a pattern for pathname expansion, and insert the list of
matching file names, replacing the word. If a numeric
argument is supplied, append a <b>*</b> before pathname
expansion.</p>
<p style="margin-left:9%;"><b>glob&minus;list&minus;expansions
(C&minus;x g)</b></p>
<p style="margin-left:18%;">Display the list of expansions
that would have been generated by
<b>glob&minus;expand&minus;word</b> and redisplay the line.
If a numeric argument is supplied, append a <b>*</b> before
pathname expansion.</p>
<p style="margin-left:9%;"><b>dump&minus;functions</b></p>
<p style="margin-left:18%;">Print all of the functions and
their key bindings to the <b>readline</b> output stream. If
a numeric argument is supplied, the output is formatted in
such a way that it can be made part of an <i>inputrc</i>
file.</p>
<p style="margin-left:9%;"><b>dump&minus;variables</b></p>
<p style="margin-left:18%;">Print all of the settable
<b>readline</b> variables and their values to the
<b>readline</b> output stream. If a numeric argument is
supplied, the output is formatted in such a way that it can
be made part of an <i>inputrc</i> file.</p>
<p style="margin-left:9%;"><b>dump&minus;macros</b></p>
<p style="margin-left:18%;">Print all of the
<b>readline</b> key sequences bound to macros and the
strings they output to the <b>readline</b> output stream. If
a numeric argument is supplied, the output is formatted in
such a way that it can be made part of an <i>inputrc</i>
file.</p>
<p style="margin-left:9%;"><b>execute&minus;named&minus;command
(M-x)</b></p>
<p style="margin-left:18%;">Read a bindable <b>readline</b>
command name from the input and execute the function to
which it&rsquo;s bound, as if the key sequence to which it
was bound appeared in the input. If this function is
supplied with a numeric argument, it passes that argument to
the function it executes.</p>
<p style="margin-left:9%;"><b>display&minus;shell&minus;version
(C&minus;x C&minus;v)</b></p>
<p style="margin-left:18%;">Display version information
about the current instance of <b>bash</b>.</p>
<h3>Programmable Completion
<a name="Programmable Completion"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">When a user
attempts word completion for a command or an argument to a
command for which a completion specification (a
<i>compspec</i>) has been defined using the <b>complete</b>
builtin (see <b><small>SHELL BUILTIN COMMANDS</small></b>
below), <b>readline</b> invokes the programmable completion
facilities.</p>
<p style="margin-left:9%; margin-top: 1em">First,
<b>bash</b> identifies the command name. If a compspec has
been defined for that command, the compspec is used to
generate the list of possible completions for the word. If
the command word is the empty string (completion attempted
at the beginning of an empty line), <b>bash</b> uses any
compspec defined with the <b>&minus;E</b> option to
<b>complete</b>. The <b>&minus;I</b> option to
<b>complete</b> indicates that the command word is the first
non-assignment word on the line, or after a command
delimiter such as <b>;</b> or <b>|</b>. This usually
indicates command name completion.</p>
<p style="margin-left:9%; margin-top: 1em">If the command
word is a full pathname, <b>bash</b> searches for a compspec
for the full pathname first. If there is no compspec for the
full pathname, <b>bash</b> attempts to find a compspec for
the portion following the final slash. If those searches do
not result in a compspec, or if there is no compspec for the
command word, <b>bash</b> uses any compspec defined with the
<b>&minus;D</b> option to <b>complete</b> as the default. If
there is no default compspec, <b>bash</b> performs alias
expansion on the command word as a final resort, and
attempts to find a compspec for the command word resulting
from any successful expansion.</p>
<p style="margin-left:9%; margin-top: 1em">If a compspec is
not found, <b>bash</b> performs its default completion as
described above under <b>Completing</b>. Otherwise, once a
compspec has been found, <b>bash</b> uses it to generate the
list of matching words.</p>
<p style="margin-left:9%; margin-top: 1em">First,
<b>bash</b> performs the <i>actions</i> specified by the
compspec. This only returns matches which are prefixes of
the word being completed. When the <b>&minus;f</b> or
<b>&minus;d</b> option is used for filename or directory
name completion, <b>bash</b> uses the shell variable
<b><small>FIGNORE</small></b> to filter the matches.</p>
<p style="margin-left:9%; margin-top: 1em">Next,
programmable completion generates matches specified by a
pathname expansion pattern supplied as an argument to the
<b>&minus;G</b> option. The words generated by the pattern
need not match the word being completed. <b>Bash</b> uses
the <b><small>FIGNORE</small></b> variable to filter the
matches, but does not use the
<b><small>GLOBIGNORE</small></b> shell variable.</p>
<p style="margin-left:9%; margin-top: 1em">Next, completion
considers the string specified as the argument to the
<b>&minus;W</b> option. The string is first split using the
characters in the <b><small>IFS</small></b> special variable
as delimiters. This honors shell quoting within the string,
in order to provide a mechanism for the words to contain
shell metacharacters or characters in the value of
<b><small>IFS</small></b><small>.</small> Each word is then
expanded using brace expansion, tilde expansion, parameter
and variable expansion, command substitution, and arithmetic
expansion, as described above under
<b><small>EXPANSION</small></b><small>.</small> The results
are split using the rules described above under <b>Word
Splitting</b>. The results of the expansion are
prefix-matched against the word being completed, and the
matching words become possible completions.</p>
<p style="margin-left:9%; margin-top: 1em">After these
matches have been generated, <b>bash</b> executes any shell
function or command specified with the <b>&minus;F</b> and
<b>&minus;C</b> options. When the command or function is
invoked, <b>bash</b> assigns values to the
<b><small>COMP_LINE</small></b><small>, <b>COMP_POINT</b>,
<b>COMP_KEY</b>,</small> and <b><small>COMP_TYPE</small></b>
variables as described above under <b>Shell Variables</b>.
If a shell function is being invoked, <b>bash</b> also sets
the <b><small>COMP_WORDS</small></b> and
<b><small>COMP_CWORD</small></b> variables. When the
function or command is invoked, the first argument
(<b>$1</b>) is the name of the command whose arguments are
being completed, the second argument (<b>$2</b>) is the word
being completed, and the third argument (<b>$3</b>) is the
word preceding the word being completed on the current
command line. There is no filtering of the generated
completions against the word being completed; the function
or command has complete freedom in generating the matches
and they do not need to match a prefix of the word.</p>
<p style="margin-left:9%; margin-top: 1em">Any function
specified with <b>&minus;F</b> is invoked first. The
function may use any of the shell facilities, including the
<b>compgen</b> and <b>compopt</b> builtins described below,
to generate the matches. It must put the possible
completions in the <b><small>COMPREPLY</small></b> array
variable, one per array element.</p>
<p style="margin-left:9%; margin-top: 1em">Next, any
command specified with the <b>&minus;C</b> option is invoked
in an environment equivalent to command substitution. It
should print a list of completions, one per line, to the
standard output. Backslash will escape a newline, if
necessary. These are added to the set of possible
completions.</p>
<p style="margin-left:9%; margin-top: 1em">External
commands that are invoked to generate completions (
&ldquo;external completers&rdquo;) receive the word
preceding the completion word as an argument, as described
above. This provides context that is sometimes useful, but
may include information that is considered sensitive or part
of a word expansion that will not appear in the command line
after expansion. That word may be visible in process
listings or in audit logs. This may be a concern to users
and completion specification authors if there is sensitive
information on the command line before expansion, since
completion takes place before words are expanded. If this is
an issue, completion authors should use functions as
wrappers around external commands and pass context
information to the external command in a different way.
External completers can infer context from the
<b><small>COMP_LINE</small></b> and
<b><small>COMP_POINT</small></b> environment variables, but
they need to ensure they break words in the same way
<b>readline</b> does, using the
<b><small>COMP_WORDBREAKS</small></b> variable.</p>
<p style="margin-left:9%; margin-top: 1em">After generating
all of the possible completions, <b>bash</b> applies any
filter specified with the <b>&minus;X</b> option to the
completions in the list. The filter is a pattern as used for
pathname expansion; a <b>&amp;</b> in the pattern is
replaced with the text of the word being completed. A
literal <b>&amp;</b> may be escaped with a backslash; the
backslash is removed before attempting a match. Any
completion that matches the pattern is removed from the
list. A leading <b>!</b> negates the pattern; in this case
<b>bash</b> removes any completion that does not match the
pattern. If the <b>nocasematch</b> shell option is enabled,
<b>bash</b> performs the match without regard to the case of
alphabetic characters.</p>
<p style="margin-left:9%; margin-top: 1em">Finally,
programmable completion adds any prefix and suffix specified
with the <b>&minus;P</b> and <b>&minus;S</b> options,
respectively, to each completion, and returns the result to
<b>readline</b> as the list of possible completions.</p>
<p style="margin-left:9%; margin-top: 1em">If the
previously-applied actions do not generate any matches, and
the <b>&minus;o dirnames</b> option was supplied to
<b>complete</b> when the compspec was defined, <b>bash</b>
attempts directory name completion.</p>
<p style="margin-left:9%; margin-top: 1em">If the
<b>&minus;o plusdirs</b> option was supplied to
<b>complete</b> when the compspec was defined, <b>bash</b>
attempts directory name completion and adds any matches to
the set of possible completions.</p>
<p style="margin-left:9%; margin-top: 1em">By default, if a
compspec is found, whatever it generates is returned to the
completion code as the full set of possible completions. The
default <b>bash</b> completions and the <b>readline</b>
default of filename completion are disabled. If the
<b>&minus;o bashdefault</b> option was supplied to
<b>complete</b> when the compspec was defined, and the
compspec generates no matches, <b>bash</b> attempts its
default completions. If the compspec and, if attempted, the
default <b>bash</b> completions generate no matches, and the
<b>&minus;o default</b> option was supplied to
<b>complete</b> when the compspec was defined, programmable
completion performs <b>readline</b>&rsquo;s default
completion.</p>
<p style="margin-left:9%; margin-top: 1em">The options
supplied to <b>complete</b> and <b>compopt</b> can control
how <b>readline</b> treats the completions. For instance,
the <i>&minus;o fullquote</i> option tells <b>readline</b>
to quote the matches as if they were filenames. See the
description of <b>complete</b> below for details.</p>
<p style="margin-left:9%; margin-top: 1em">When a compspec
indicates that it wants directory name completion, the
programmable completion functions force <b>readline</b> to
append a slash to completed names which are symbolic links
to directories, subject to the value of the
<b>mark&minus;directories readline</b> variable, regardless
of the setting of the <b>mark-symlinked&minus;directories
readline</b> variable.</p>
<p style="margin-left:9%; margin-top: 1em">There is some
support for dynamically modifying completions. This is most
useful when used in combination with a default completion
specified with <b>complete &minus;D</b>. It&rsquo;s possible
for shell functions executed as completion functions to
indicate that completion should be retried by returning an
exit status of 124. If a shell function returns 124, and
changes the compspec associated with the command on which
completion is being attempted (supplied as the first
argument when the function is executed), programmable
completion restarts from the beginning, with an attempt to
find a new compspec for that command. This can be used to
build a set of completions dynamically as completion is
attempted, rather than loading them all at once.</p>
<p style="margin-left:9%; margin-top: 1em">For instance,
assuming that there is a library of compspecs, each kept in
a file corresponding to the name of the command, the
following default completion function would load completions
dynamically:</p>
<p style="margin-left:18%;">_completion_loader() <br>
{ <br>
. &quot;/etc/bash_completion.d/$1.sh&quot; \ <br>
&gt;/dev/null 2&gt;&amp;1 &amp;&amp; return 124 <br>
} <br>
complete &minus;D &minus;F _completion_loader \ <br>
&minus;o bashdefault &minus;o default</p>
<h2>HISTORY
<a name="HISTORY"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">When the
<b>&minus;o history</b> option to the <b>set</b> builtin is
enabled, the shell provides access to the <i>command
history</i>, the list of commands previously typed. The
value of the <b><small>HISTSIZE</small></b> variable is used
as the number of commands to save in a history list: the
shell saves the text of the last
<b><small>HISTSIZE</small></b> commands (default 500). The
shell stores each command in the history list prior to
parameter and variable expansion (see
<b><small>EXPANSION</small></b> above) but after history
expansion is performed, subject to the values of the shell
variables <b><small>HISTIGNORE</small></b> and
<b><small>HISTCONTROL</small></b><small>.</small></p>
<p style="margin-left:9%; margin-top: 1em">On startup,
<b>bash</b> initializes the history list by reading history
entries from the file named by the
<b><small>HISTFILE</small></b> variable (default
<A HREF="file:~/.bash_history"><i>~/.bash_history</i></A>). That file is referred to as the
<i>history file</i>. The history file is truncated, if
necessary, to contain no more than the number of history
entries specified by the value of the
<b><small>HISTFILESIZE</small></b> variable. If
<b><small>HISTFILESIZE</small></b> is unset, or set to null,
a non-numeric value, or a numeric value less than zero, the
history file is not truncated.</p>
<p style="margin-left:9%; margin-top: 1em">When the history
file is read, lines beginning with the history comment
character followed immediately by a digit are interpreted as
timestamps for the following history line. These timestamps
are optionally displayed depending on the value of the
<b><small>HISTTIMEFORMAT</small></b> variable. When present,
history timestamps delimit history entries, making
multi-line entries possible.</p>
<p style="margin-left:9%; margin-top: 1em">When a shell
with history enabled exits, <b>bash</b> copies the last
<b><small>$HISTSIZE</small></b> entries from the history
list to <b><small>$HISTFILE</small></b><small>.</small> If
the <b>histappend</b> shell option is enabled (see the
description of <b>shopt</b> under <b><small>SHELL BUILTIN
COMMANDS</small></b> below), <b>bash</b> appends the entries
to the history file, otherwise it overwrites the history
file. If <b><small>HISTFILE</small></b> is unset or null, or
if the history file is unwritable, the history is not saved.
After saving the history, <b>bash</b> truncates the history
file to contain no more than
<b><small>HISTFILESIZE</small></b> lines as described
above.</p>
<p style="margin-left:9%; margin-top: 1em">If the
<b><small>HISTTIMEFORMAT</small></b> variable is set, the
shell writes the timestamp information associated with each
history entry to the history file, marked with the history
comment character, so timestamps are preserved across shell
sessions. This uses the history comment character to
distinguish timestamps from other history lines. As above,
when using
<b><small>HISTTIMEFORMAT</small></b><small>,</small> the
timestamps delimit multi-line history entries.</p>
<p style="margin-left:9%; margin-top: 1em">The <b>fc</b>
builtin command (see <b><small>SHELL BUILTIN
COMMANDS</small></b> below) will list or edit and re-execute
a portion of the history list. The <b>history</b> builtin
can 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.</p>
<p style="margin-left:9%; margin-top: 1em">The shell allows
control over which commands are saved on the history list.
The <b><small>HISTCONTROL</small></b> and
<b><small>HISTIGNORE</small></b> variables are used to save
only a subset of the commands entered. If the <b>cmdhist</b>
shell option is enabled, the shell attempts to save each
line of a multi-line command in the same history entry,
adding semicolons where necessary to preserve syntactic
correctness. The <b>lithist</b> shell option modifies
<b>cmdhist</b> by saving the command with embedded newlines
instead of semicolons. See the description of the
<b>shopt</b> builtin below under <b><small>SHELL BUILTIN
COMMANDS</small></b> for information on setting and
unsetting shell options.</p>
<h2>HISTORY EXPANSION
<a name="HISTORY EXPANSION"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">The shell
supports a history expansion feature that is similar to the
history expansion in <b>csh</b>. This section describes what
syntax features are available.</p>
<p style="margin-left:9%; margin-top: 1em">History
expansion is enabled by default for interactive shells, and
can be disabled using the <b>+H</b> option to the <b>set</b>
builtin command (see <b><small>SHELL BUILTIN
COMMANDS</small></b> below). Non-interactive shells do not
perform history expansion by default, but it can be enabled
with &ldquo;set -H&rdquo;.</p>
<p style="margin-left:9%; margin-top: 1em">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.</p>
<p style="margin-left:9%; margin-top: 1em">History
expansion is performed immediately after a complete line is
read, before the shell breaks it into words, and is
performed on each line individually. The shell attempts to
inform the history expansion functions about quoting still
in effect from previous lines.</p>
<p style="margin-left:9%; margin-top: 1em">It takes place
in two parts. The first is to determine which history list
entry to use during substitution. The second is to select
portions of that entry to include into the current one.</p>
<p style="margin-left:9%; margin-top: 1em">The entry
selected from the history is the <i>event</i>, and the
portions of that entry that are acted upon are <i>words</i>.
Various <i>modifiers</i> are available to manipulate the
selected words. The entry is split into words in the same
fashion as when reading input, so that several
<i>metacharacter</i>-separated words surrounded by quotes
are considered one word. The <i>event designator</i> selects
the event, the optional <i>word designator</i> selects words
from the event, and various optional <i>modifiers</i> are
available to manipulate the selected words.</p>
<p style="margin-left:9%; margin-top: 1em">History
expansions are introduced by the appearance of the history
expansion character, which is <b>!</b> by default. History
expansions may appear anywhere in the input, but do not
nest.</p>
<p style="margin-left:9%; margin-top: 1em">Only backslash
(<b>\</b>) and single quotes can quote the history expansion
character, but the history expansion character is also
treated as quoted if it immediately precedes the closing
double quote in a double-quoted string.</p>
<p style="margin-left:9%; margin-top: 1em">Several
characters inhibit history expansion if found immediately
following the history expansion character, even if it is
unquoted: space, tab, newline, carriage return, <b>=</b>,
and the other shell metacharacters defined above.</p>
<p style="margin-left:9%; margin-top: 1em">There is a
special abbreviation for substitution, active when the
<i>quick substitution</i> character (described above under
<b>histchars</b>) is the first character on the line. It
selects the previous history list entry, using an event
designator equivalent to <b>!!</b>, and substitutes one
string for another in that entry. It is described below
under <b>Event Designators</b>. This is the only history
expansion that does not begin with the history expansion
character.</p>
<p style="margin-left:9%; margin-top: 1em">Several shell
options settable with the <b>shopt</b> builtin will modify
history expansion behavior (see the description of the
<b>shopt</b> builtin below).and If the <b>histverify</b>
shell option is enabled, and <b>readline</b> is being used,
history substitutions are not immediately passed to the
shell parser. Instead, the expanded line is reloaded into
the <b>readline</b> editing buffer for further modification.
If <b>readline</b> is being used, and the <b>histreedit</b>
shell option is enabled, a failed history substitution is
reloaded into the <b>readline</b> editing buffer for
correction.</p>
<p style="margin-left:9%; margin-top: 1em">The
<b>&minus;p</b> option to the <b>history</b> builtin command
shows what a history expansion will do before using it. The
<b>&minus;s</b> option to the <b>history</b> builtin will
add commands to the end of the history list without actually
executing them, so that they are available for subsequent
recall.</p>
<p style="margin-left:9%; margin-top: 1em">The shell allows
control of the various characters used by the history
expansion mechanism (see the description of <b>histchars</b>
above under <b>Shell Variables</b>). The shell uses the
history comment character to mark history timestamps when
writing the history file.</p>
<h3>Event Designators
<a name="Event Designators"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">An event
designator is a reference to an entry in the history list.
The event designator consists of the portion of the word
beginning with the history expansion character and ending
with the word designator if present, or the end of the word.
Unless the reference is absolute, events are relative to the
current position in the history list.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="4%">
<p><b>!</b></p></td>
<td width="5%"></td>
<td width="82%">
<p>Start a history substitution, except when followed by a
<b>blank</b>, newline, carriage return, =, or, when the
<b>extglob</b> shell option is enabled using the
<b>shopt</b> builtin, (.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="4%">
<p><b>!</b><i>n</i></p></td>
<td width="5%"></td>
<td width="82%">
<p>Refer to history list entry <i>n</i>.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="4%">
<p><b>!&minus;</b><i>n</i></p></td>
<td width="5%"></td>
<td width="82%">
<p>Refer to the current entry minus <i>n</i>.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="4%">
<p><b>!!</b></p></td>
<td width="5%"></td>
<td width="82%">
<p>Refer to the previous entry. This is a synonym for
&ldquo;!&minus;1&rdquo;.</p> </td></tr>
</table>
<p style="margin-left:9%;"><b>!</b><i>string</i></p>
<p style="margin-left:18%;">Refer to the most recent
command preceding the current position in the history list
starting with <i>string</i>.</p>
<p style="margin-left:9%;"><b>!?</b><i>string</i><b>[?]</b></p>
<p style="margin-left:18%;">Refer to the most recent
command preceding the current position in the history list
containing <i>string</i>. The trailing <b>?</b> may be
omitted if <i>string</i> is followed immediately by a
newline. If <i>string</i> is missing, this uses the string
from the most recent search; it is an error if there is no
previous search string.</p>
<p style="margin-left:9%;"><b><big>^</big></b>
<i>string1</i> <b><big>^</big></b> <i>string2</i>
<b><big>^</big></b></p>
<p style="margin-left:18%;">Quick substitution. Repeat the
previous command, replacing <i>string1</i> with
<i>string2</i>. Equivalent to &ldquo;!!:s <big>^</big>
<i>string1</i> <big>^</big> <i>string2</i> <big>^</big>
&rdquo; (see <b>Modifiers</b> below).</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="3%">
<p><b>!#</b></p></td>
<td width="6%"></td>
<td width="47%">
<p>The entire command line typed so far.</p></td>
<td width="35%">
</td></tr>
</table>
<h3>Word Designators
<a name="Word Designators"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">Word designators
are used to select desired words from the event. They are
optional; if the word designator isn&rsquo;t supplied, the
history expansion uses the entire event. A <b>:</b>
separates the event specification from the word designator.
It may be omitted if the word designator begins with a
<b>^</b>, <b>$</b>, <b>*</b>, <b>&minus;</b>, or <b>%</b>.
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. <b><br>
0 (zero)</b></p>
<p style="margin-left:18%;">The zeroth word. For the shell,
this is the command word.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="4%">
<p><i>n</i></p></td>
<td width="5%"></td>
<td width="82%">
<p>The <i>n</i>th word.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="4%">
<p><b>^</b></p></td>
<td width="5%"></td>
<td width="82%">
<p>The first argument: word 1.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="4%">
<p><b>$</b></p></td>
<td width="5%"></td>
<td width="82%">
<p>The last word. This is usually the last argument, but
will expand to the zeroth word if there is only one word in
the line.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="4%">
<p><b>%</b></p></td>
<td width="5%"></td>
<td width="82%">
<p>The first word matched by the most recent
&ldquo;?<i>string</i>?&rdquo; search, if the search string
begins with a character that is part of a word. By default,
searches begin at the end of each line and proceed to the
beginning, so the first word matched is the one closest to
the end of the line.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="4%">
<p><i>x</i><b>&minus;</b><i>y</i></p></td>
<td width="5%"></td>
<td width="82%">
<p>A range of words; &ldquo;&minus;<i>y</i>&rdquo;
abbreviates &ldquo;0&minus;<i>y</i>&rdquo;.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="4%">
<p><b>*</b></p></td>
<td width="5%"></td>
<td width="82%">
<p>All of the words but the zeroth. This is a synonym for
&ldquo;<i>1&minus;$</i>&rdquo;. It is not an error to use
<b>*</b> if there is just one word in the event; it expands
to the empty string in that case.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="4%">
<p><b>x*</b></p></td>
<td width="5%"></td>
<td width="82%">
<p>Abbreviates <i>x&minus;$</i>.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="4%">
<p><b>x&minus;</b></p></td>
<td width="5%"></td>
<td width="82%">
<p>Abbreviates <i>x&minus;$</i> like <b>x*</b>, but omits
the last word. If <b>x</b> is missing, it defaults to 0.</p></td></tr>
</table>
<p style="margin-left:9%; margin-top: 1em">If a word
designator is supplied without an event specification, the
previous command is used as the event, equivalent to
<b>!!</b>.</p>
<h3>Modifiers
<a name="Modifiers"></a>
</h3>
<p style="margin-left:9%; margin-top: 1em">After the
optional word designator, the expansion may include a
sequence of one or more of the following modifiers, each
preceded by a &ldquo;:&rdquo;. These modify, or edit, the
word or words selected from the history event.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p style="margin-top: 1em"><b>h</b></p></td>
<td width="8%"></td>
<td width="82%">
<p style="margin-top: 1em">Remove a trailing pathname
component, leaving only the head.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p><b>t</b></p></td>
<td width="8%"></td>
<td width="82%">
<p>Remove all leading pathname components, leaving the
tail.</p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p><b>r</b></p></td>
<td width="8%"></td>
<td width="82%">
<p>Remove a trailing suffix of the form <i>.xxx</i>,
leaving the basename.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p><b>e</b></p></td>
<td width="8%"></td>
<td width="82%">
<p>Remove all but the trailing suffix.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p><b>p</b></p></td>
<td width="8%"></td>
<td width="82%">
<p>Print the new command but do not execute it.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p><b>q</b></p></td>
<td width="8%"></td>
<td width="82%">
<p>Quote the substituted words, escaping further
substitutions.</p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p><b>x</b></p></td>
<td width="8%"></td>
<td width="82%">
<p>Quote the substituted words as with <b>q</b>, but break
into words at <b>blanks</b> and newlines. The <b>q</b> and
<b>x</b> modifiers are mutually exclusive; expansion uses
the last one supplied.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>s/</b><i>old</i><b>/</b><i>new</i><b>/</b></p>
<p style="margin-left:18%;">Substitute <i>new</i> for the
first occurrence of <i>old</i> in the event line. Any
character may be used as the delimiter in place of /. The
final delimiter is optional if it is the last character of
the event line. A single backslash quotes the delimiter in
<i>old</i> and <i>new</i>. If &amp; appears in <i>new</i>,
it is replaced with <i>old</i>. A single backslash quotes
the &amp;. If <i>old</i> is null, it is set to the last
<i>old</i> substituted, or, if no previous history
substitutions took place, the last <i>string</i> in a
<b>!?</b><i>string</i><b>[?]</b> search. If <i>new</i> is
null, each matching <i>old</i> is deleted.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p><b>&amp;</b></p></td>
<td width="8%"></td>
<td width="82%">
<p>Repeat the previous substitution.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p><b>g</b></p></td>
<td width="8%"></td>
<td width="82%">
<p>Cause changes to be applied over the entire event line.
This is used in conjunction with &ldquo;<b>:s</b>&rdquo;
(e.g.,
&ldquo;<b>:gs/</b><i>old</i><b>/</b><i>new</i><b>/</b>&rdquo;)
or &ldquo;<b>:&amp;</b>&rdquo;. If used with
&ldquo;<b>:s</b>&rdquo;, any delimiter can be used in place
of /, and the final delimiter is optional if it is the last
character of the event line. An <b>a</b> may be used as a
synonym for <b>g</b>.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p><b>G</b></p></td>
<td width="8%"></td>
<td width="82%">
<p>Apply the following &ldquo;<b>s</b>&rdquo; or
&ldquo;<b>&amp;</b>&rdquo; modifier once to each word in the
event line.</p></td></tr>
</table>
<h2>SHELL BUILTIN COMMANDS
<a name="SHELL BUILTIN COMMANDS"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">Unless otherwise
noted, each builtin command documented in this section as
accepting options preceded by <b>&minus;</b> accepts
<b>&minus;&minus;</b> to signify the end of the options. The
<b>:</b>, <b>true</b>, <b>false</b>, and
<b>test</b>/<b>[</b> builtins do not accept options and do
not treat <b>&minus;&minus;</b> specially. The <b>exit</b>,
<b>logout</b>, <b>return</b>, <b>break</b>, <b>continue</b>,
<b>let</b>, and <b>shift</b> builtins accept and process
arguments beginning with <b>&minus;</b> without requiring
<b>&minus;&minus;</b>. Other builtins that accept arguments
but are not specified as accepting options interpret
arguments beginning with <b>&minus;</b> as invalid options
and require <b>&minus;&minus;</b> to prevent this
interpretation. <b><br>
:</b> [<i>arguments</i>]</p>
<p style="margin-left:18%;">No effect; the command does
nothing beyond expanding <i>arguments</i> and performing any
specified redirections. The return status is zero.</p>
<p style="margin-left:9%;"><b>.</b> [<b>&minus;p</b>
<i>path</i>] <i>filename</i> [<i>arguments</i>] <b><br>
source</b> [<b>&minus;p</b> <i>path</i>] <i>filename</i>
[<i>arguments</i>]</p>
<p style="margin-left:18%;">The <b>.</b> command
(<b>source</b>) reads and execute commands from
<i>filename</i> in the current shell environment and returns
the exit status of the last command executed from
<i>filename</i>.</p>
<p style="margin-left:18%; margin-top: 1em">If
<i>filename</i> does not contain a slash, <b>.</b> searches
for it. If the <b>&minus;p</b> option is supplied, <b>.</b>
treats <i>path</i> as a colon-separated list of directories
in which to find <i>filename</i>; otherwise, <b>.</b> uses
the entries in <b><small>PATH</small></b> to find the
directory containing <i>filename</i>. <i>filename</i> does
not need to be executable. When <b>bash</b> is not in posix
mode, it searches the current directory if <i>filename</i>
is not found in <b><small>PATH</small></b><small>,</small>
but does not search the current directory if <b>&minus;p</b>
is supplied. If the <b>sourcepath</b> option to the
<b>shopt</b> builtin command is turned off, <b>.</b> does
not search <b><small>PATH</small></b><small>.</small></p>
<p style="margin-left:18%; margin-top: 1em">If any
<i>arguments</i> are supplied, they become the positional
parameters when <i>filename</i> is executed. Otherwise the
positional parameters are unchanged.</p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>&minus;T</b> option is enabled, <b>.</b> inherits any
trap on <b>DEBUG</b>; if it is not, any <b>DEBUG</b> trap
string is saved and restored around the call to <b>.</b>,
and <b>.</b> unsets the <b>DEBUG</b> trap while it executes.
If <b>&minus;T</b> is not set, and the sourced file changes
the <b>DEBUG</b> trap, the new value persists after <b>.</b>
completes. The return status is the status of the last
command executed from <i>filename</i> (0 if no commands are
executed), and non-zero if <i>filename</i> is not found or
cannot be read.</p>
<p style="margin-left:9%;"><b>alias</b> [<b>&minus;p</b>]
[<i>name</i>[=<i>value</i>] ...]</p>
<p style="margin-left:18%;">With no arguments or with the
<b>&minus;p</b> option, <b>alias</b> prints the list of
aliases in the form <b>alias</b> <i>name</i>=<i>value</i> on
standard output. When arguments are supplied, define an
alias for each <i>name</i> whose <i>value</i> is given. A
trailing space in <i>value</i> causes the next word to be
checked for alias substitution when the alias is expanded
during command parsing. For each <i>name</i> in the argument
list for which no <i>value</i> is supplied, print the name
and value of the alias <i>name</i>. <b>alias</b> returns
true unless a <i>name</i> is given (without a corresponding
=<i>value</i>) for which no alias has been defined.</p>
<p style="margin-left:9%;"><b>bg</b> [<i>jobspec</i>
...]</p>
<p style="margin-left:18%;">Resume each suspended job
<i>jobspec</i> in the background, as if it had been started
with <b>&amp;</b>. If <i>jobspec</i> is not present, the
shell uses its notion of the <i>current job</i>. <b>bg</b>
<i>jobspec</i> returns 0 unless run when job control is
disabled or, when run with job control enabled, any
specified <i>jobspec</i> was not found or was started
without job control.</p>
<p style="margin-left:9%;"><b>bind</b> [<b>&minus;m</b>
<i>keymap</i>] [<b>&minus;lsvSVX</b>] <b><br>
bind</b> [<b>&minus;m</b> <i>keymap</i>] [<b>&minus;q</b>
<i>function</i>] [<b>&minus;u</b> <i>function</i>]
[<b>&minus;r</b> <i>keyseq</i>] <b><br>
bind</b> [<b>&minus;m</b> <i>keymap</i>] <b>&minus;f</b>
<i>filename</i> <b><br>
bind</b> [<b>&minus;m</b> <i>keymap</i>] <b>&minus;x</b>
<i>keyseq</i>[:] <i>shell&minus;command</i> <b><br>
bind</b> [<b>&minus;m</b> <i>keymap</i>]
<i>keyseq</i>:<i>function&minus;name</i> <b><br>
bind</b> [<b>&minus;m</b> <i>keymap</i>]
<b>&minus;p</b>|<b>&minus;P</b>
[<i>readline&minus;command</i>] <b><br>
bind</b> [<b>&minus;m</b> <i>keymap</i>]
<i>keyseq</i>:<i>readline&minus;command</i> <b><br>
bind</b> <i>readline-command-line</i></p>
<p style="margin-left:18%;">Display current <b>readline</b>
key and function bindings, bind a key sequence to a
<b>readline</b> function or macro or to a shell command, or
set a <b>readline</b> variable. Each non-option argument is
a key binding or command as it would appear in a
<b>readline</b> initialization file such as <i>.inputrc</i>,
but each binding or command must be passed as a separate
argument; e.g., '&quot;\C&minus;x\C&minus;r&quot;:
re&minus;read&minus;init&minus;file'. In the following
descriptions, output available to be re-read is formatted as
commands that would appear in a <b>readline</b>
initialization file or that would be supplied as individual
arguments to a <b>bind</b> command. Options, if supplied,
have the following meanings: <b><br>
&minus;m</b> <i>keymap</i></p>
<p style="margin-left:27%;">Use <i>keymap</i> as the keymap
to be affected by the subsequent bindings. Acceptable
<i>keymap</i> names are <i>emacs, emacs&minus;standard,
emacs&minus;meta, emacs&minus;ctlx, vi, vi&minus;move,
vi&minus;command</i>, and <i>vi&minus;insert</i>. <i>vi</i>
is equivalent to <i>vi&minus;command</i>
(<i>vi&minus;move</i> is also a synonym); <i>emacs</i> is
equivalent to <i>emacs&minus;standard</i>.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;l</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>List the names of all <b>readline</b> functions.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;p</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Display <b>readline</b> function names and bindings in
such a way that they can be used as an argument to a
subsequent <b>bind</b> command or in a <b>readline</b>
initialization file. If arguments remain after option
processing, <b>bind</b> treats them as <b>readline</b>
command names and restricts output to those names.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;P</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>List current <b>readline</b> function names and
bindings. If arguments remain after option processing,
<b>bind</b> treats them as <b>readline</b> command names and
restricts output to those names.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;s</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Display <b>readline</b> key sequences bound to macros
and the strings they output in such a way that they can be
used as an argument to a subsequent <b>bind</b> command or
in a <b>readline</b> initialization file.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;S</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Display <b>readline</b> key sequences bound to macros
and the strings they output.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;v</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Display <b>readline</b> variable names and values in
such a way that they can be used as an argument to a
subsequent <b>bind</b> command or in a <b>readline</b>
initialization file.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;V</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>List current <b>readline</b> variable names and
values.</p> </td></tr>
</table>
<p style="margin-left:18%;"><b>&minus;f</b>
<i>filename</i></p>
<p style="margin-left:27%;">Read key bindings from
<i>filename</i>.</p>
<p style="margin-left:18%;"><b>&minus;q</b>
<i>function</i></p>
<p style="margin-left:27%;">Display key sequences that
invoke the named <b>readline</b> <i>function</i>.</p>
<p style="margin-left:18%;"><b>&minus;u</b>
<i>function</i></p>
<p style="margin-left:27%;">Unbind all key sequences bound
to the named <b>readline</b> <i>function</i>.</p>
<p style="margin-left:18%;"><b>&minus;r</b>
<i>keyseq</i></p>
<p style="margin-left:27%;">Remove any current binding for
<i>keyseq</i>.</p>
<p style="margin-left:18%;"><b>&minus;x</b>
<i>keyseq</i><b>[: ]</b><i>shell&minus;command</i></p>
<p style="margin-left:27%;">Cause
<i>shell&minus;command</i> to be executed whenever
<i>keyseq</i> is entered. The separator between
<i>keyseq</i> and <i>shell&minus;command</i> is either
whitespace or a colon optionally followed by whitespace. If
the separator is whitespace, <i>shell&minus;command</i> must
be enclosed in double quotes and <b>readline</b> expands any
of its special backslash-escapes in
<i>shell&minus;command</i> before saving it. If the
separator is a colon, any enclosing double quotes are
optional, and <b>readline</b> does not expand the command
string before saving it. Since the entire key binding
expression must be a single argument, it should be enclosed
in single quotes. When <i>shell&minus;command</i> is
executed, the shell sets the
<b><small>READLINE_LINE</small></b> variable to the contents
of the <b>readline</b> line buffer and the
<b><small>READLINE_POINT</small></b> and
<b><small>READLINE_MARK</small></b> variables to the current
location of the insertion point and the saved insertion
point (the mark), respectively. The shell assigns any
numeric argument the user supplied to the
<b><small>READLINE_ARGUMENT</small></b> variable. If there
was no argument, that variable is not set. If the executed
command changes the value of any of
<b><small>READLINE_LINE</small></b><small>,
<b>READLINE_POINT</b>,</small> or
<b><small>READLINE_MARK</small></b><small>,</small> those
new values will be reflected in the editing state.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;X</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>List all key sequences bound to shell commands and the
associated commands in a format that can be reused as an
argument to a subsequent <b>bind</b> command.</p></td></tr>
</table>
<p style="margin-left:18%; margin-top: 1em">The return
value is 0 unless an unrecognized option is supplied or an
error occurred.</p>
<p style="margin-left:9%;"><b>break</b> [<i>n</i>]</p>
<p style="margin-left:18%;">Exit from within a <b>for</b>,
<b>while</b>, <b>until</b>, or <b>select</b> loop. If
<i>n</i> is specified, <b>break</b> exits <i>n</i> enclosing
loops. <i>n</i> must be &ge; 1. If <i>n</i> is greater than
the number of enclosing loops, all enclosing loops are
exited. The return value is 0 unless <i>n</i> is not greater
than or equal to 1.</p>
<p style="margin-left:9%;"><b>builtin</b>
<i>shell&minus;builtin</i> [<i>arguments</i>]</p>
<p style="margin-left:18%;">Execute the specified shell
builtin <i>shell&minus;builtin</i>, passing it
<i>arguments</i>, and return its exit status. This is useful
when defining a function whose name is the same as a shell
builtin, retaining the functionality of the builtin within
the function. The <b>cd</b> builtin is commonly redefined
this way. The return status is false if
<i>shell&minus;builtin</i> is not a shell builtin
command.</p>
<p style="margin-left:9%;"><b>caller</b> [<i>expr</i>]</p>
<p style="margin-left:18%;">Returns the context of any
active subroutine call (a shell function or a script
executed with the <b>.</b> or <b>source</b> builtins).</p>
<p style="margin-left:18%; margin-top: 1em">Without
<i>expr</i>, <b>caller</b> displays the line number and
source filename of the current subroutine call. If a
non-negative integer is supplied as <i>expr</i>,
<b>caller</b> displays the line number, subroutine name, and
source file corresponding to that position in the current
execution call stack. This extra information may be used,
for example, to print a stack trace. The current frame is
frame 0.</p>
<p style="margin-left:18%; margin-top: 1em">The return
value is 0 unless the shell is not executing a subroutine
call or <i>expr</i> does not correspond to a valid position
in the call stack.</p>
<p style="margin-left:9%;"><b>cd</b> [<b>&minus;L</b>]
[<b>&minus;@</b>] [<i>dir</i>] <b><br>
cd &minus;P</b> [<b>&minus;e</b>] [<b>&minus;@</b>]
[<i>dir</i>]</p>
<p style="margin-left:18%;">Change the current directory to
<i>dir</i>. if <i>dir</i> is not supplied, the value of the
<b><small>HOME</small></b> shell variable is used as
<i>dir</i>. If <i>dir</i> is the empty string, <b>cd</b>
treats it as an error. The variable
<b><small>CDPATH</small></b> exists, and <i>dir</i> does not
begin with a slash (/), <b>cd</b> uses it as a search path:
the shell searches each directory name in
<b><small>CDPATH</small></b> for <i>dir</i>. Alternative
directory names in <b><small>CDPATH</small></b> are
separated by a colon (:). A null directory name in
<b><small>CDPATH</small></b> is the same as the current
directory, i.e., &ldquo;.&rdquo;.</p>
<p style="margin-left:18%; margin-top: 1em">The
<b>&minus;P</b> option causes <b>cd</b> to use the physical
directory structure by resolving symbolic links while
traversing <i>dir</i> and before processing instances of
<i>..</i> in <i>dir</i> (see also the <b>&minus;P</b> option
to the <b>set</b> builtin command).</p>
<p style="margin-left:18%; margin-top: 1em">The
<b>&minus;L</b> option forces <b>cd</b> to follow symbolic
links by resolving the link after processing instances of
<i>..</i> in <i>dir</i>. If <i>..</i> appears in <i>dir</i>,
<b>cd</b> processes it by removing the immediately previous
pathname component from <i>dir</i>, back to a slash or the
beginning of <i>dir</i>, and verifying that the portion of
<i>dir</i> it has processed to that point is still a valid
directory name after removing the pathname component. If it
is not a valid directory name, <b>cd</b> returns a non-zero
status. If neither <b>&minus;L</b> nor <b>&minus;P</b> is
supplied, <b>cd</b> behaves as if <b>&minus;L</b> had been
supplied.</p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>&minus;e</b> option is supplied with <b>&minus;P</b>, and
<b>cd</b> cannot successfully determine the current working
directory after a successful directory change, it returns a
non-zero status.</p>
<p style="margin-left:18%; margin-top: 1em">On systems that
support it, the <b>&minus;@</b> option presents the extended
attributes associated with a file as a directory.</p>
<p style="margin-left:18%; margin-top: 1em">An argument of
<b>&minus;</b> is converted to <b><small>$OLDPWD</small></b>
before attempting the directory change.</p>
<p style="margin-left:18%; margin-top: 1em">If <b>cd</b>
uses a non-empty directory name from
<b><small>CDPATH</small></b><small>,</small> or if
<b>&minus;</b> is the first argument, and the directory
change is successful, <b>cd</b> writes the absolute pathname
of the new working directory to the standard output.</p>
<p style="margin-left:18%; margin-top: 1em">If the
directory change is successful, <b>cd</b> sets the value of
the <b>PWD</b> environment variable to the new directory
name, and sets the <b>OLDPWD</b> environment variable to the
value of the current working directory before the
change.</p>
<p style="margin-left:18%; margin-top: 1em">The return
value is true if the directory was successfully changed;
false otherwise.</p>
<p style="margin-left:9%;"><b>command</b>
[<b>&minus;pVv</b>] <i>command</i> [<i>arg</i> ...]</p>
<p style="margin-left:18%;">The <b>command</b> builtin runs
<i>command</i> with <i>args</i> suppressing the normal shell
function lookup for <i>command</i>. Only builtin commands or
commands found in the <b><small>PATH</small></b> named
<i>command</i> are executed. If the <b>&minus;p</b> option
is supplied, the search for <i>command</i> is performed
using a default value for <b><small>PATH</small></b> that is
guaranteed to find all of the standard utilities.</p>
<p style="margin-left:18%; margin-top: 1em">If either the
<b>&minus;V</b> or <b>&minus;v</b> option is supplied,
<b>command</b> prints a description of <i>command</i>. The
<b>&minus;v</b> option displays a single word indicating the
command or filename used to invoke <i>command</i>; the
<b>&minus;V</b> option produces a more verbose
description.</p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>&minus;V</b> or <b>&minus;v</b> option is supplied, the
exit status is zero if <i>command</i> was found, and
non-zero if not. If neither option is supplied and an error
occurred or <i>command</i> cannot be found, the exit status
is 127. Otherwise, the exit status of the <b>command</b>
builtin is the exit status of <i>command</i>.</p>
<p style="margin-left:9%;"><b>compgen</b> [<b>&minus;V</b>
<i>varname</i>] [<i>option</i>] [<i>word</i>]</p>
<p style="margin-left:18%;">Generate possible completion
matches for <i>word</i> according to the <i>option</i>s,
which may be any option accepted by the <b>complete</b>
builtin with the exceptions of <b>&minus;p</b>,
<b>&minus;r</b>, <b>&minus;D</b>, <b>&minus;E</b>, and
<b>&minus;I</b>, and write the matches to the standard
output.</p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>&minus;V</b> option is supplied, <b>compgen</b> stores
the generated completions into the indexed array variable
<i>varname</i> instead of writing them to the standard
output.</p>
<p style="margin-left:18%; margin-top: 1em">When using the
<b>&minus;F</b> or <b>&minus;C</b> options, the various
shell variables set by the programmable completion
facilities, while available, will not have useful
values.</p>
<p style="margin-left:18%; margin-top: 1em">The matches
will be generated in the same way as if the programmable
completion code had generated them directly from a
completion specification with the same flags. If <i>word</i>
is specified, only those completions matching <i>word</i>
will be displayed or stored.</p>
<p style="margin-left:18%; margin-top: 1em">The return
value is true unless an invalid option is supplied, or no
matches were generated.</p>
<p style="margin-left:9%;"><b>complete</b>
[<b>&minus;abcdefgjksuv</b>] [<b>&minus;o</b>
<i>comp-option</i>] [<b>&minus;DEI</b>] [<b>&minus;A</b>
<i>action</i>]</p>
<p style="margin-left:18%;">[<b>&minus;G</b>
<i>globpat</i>] [<b>&minus;W</b> <i>wordlist</i>]
[<b>&minus;F</b> <i>function</i>] [<b>&minus;C</b>
<i>command</i>] <br>
[<b>&minus;X</b> <i>filterpat</i>] [<b>&minus;P</b>
<i>prefix</i>] [<b>&minus;S</b> <i>suffix</i>] <i>name</i>
[<i>name</i> ...]</p>
<p style="margin-left:9%;"><b>complete &minus;pr</b>
[<b>&minus;DEI</b>] [<i>name</i> ...]</p>
<p style="margin-left:18%;">Specify how arguments to each
<i>name</i> should be completed.</p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>&minus;p</b> option is supplied, or if no options or
<i>name</i>s are supplied, print existing completion
specifications in a way that allows them to be reused as
input. The <b>&minus;r</b> option removes a completion
specification for each <i>name</i>, or, if no <i>name</i>s
are supplied, all completion specifications.</p>
<p style="margin-left:18%; margin-top: 1em">The
<b>&minus;D</b> option indicates that other supplied options
and actions should apply to the &ldquo;default&rdquo;
command completion; that is, completion attempted on a
command for which no completion has previously been defined.
The <b>&minus;E</b> option indicates that other supplied
options and actions should apply to &ldquo;empty&rdquo;
command completion; that is, completion attempted on a blank
line. The <b>&minus;I</b> option indicates that other
supplied options and actions should apply to completion on
the initial non-assignment word on the line, or after a
command delimiter such as <b>;</b> or <b>|</b>, which is
usually command name completion. If multiple options are
supplied, the <b>&minus;D</b> option takes precedence over
<b>&minus;E</b>, and both take precedence over
<b>&minus;I</b>. If any of <b>&minus;D</b>, <b>&minus;E</b>,
or <b>&minus;I</b> are supplied, any other <i>name</i>
arguments are ignored; these completions only apply to the
case specified by the option.</p>
<p style="margin-left:18%; margin-top: 1em">The process of
applying these completion specifications when attempting
word completion is described above under <b>Programmable
Completion</b>.</p>
<p style="margin-left:18%; margin-top: 1em">Other options,
if specified, have the following meanings. The arguments to
the <b>&minus;G</b>, <b>&minus;W</b>, and <b>&minus;X</b>
options (and, if necessary, the <b>&minus;P</b> and
<b>&minus;S</b> options) should be quoted to protect them
from expansion before the <b>complete</b> builtin is
invoked. <b><br>
&minus;o</b> <i>comp-option</i></p>
<p style="margin-left:28%;">The <i>comp-option</i> controls
several aspects of the compspec&rsquo;s behavior beyond the
simple generation of completions. <i>comp-option</i> may be
one of: <b><br>
bashdefault</b></p>
<p style="margin-left:38%;">Perform the rest of the default
<b>bash</b> completions if the compspec generates no
matches.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>default</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Use <b>readline</b>&rsquo;s default filename completion
if the compspec generates no matches.</p></td></tr>
</table>
<p style="margin-left:28%;"><b>dirnames</b></p>
<p style="margin-left:38%;">Perform directory name
completion if the compspec generates no matches.</p>
<p style="margin-left:28%;"><b>filenames</b></p>
<p style="margin-left:38%;">Tell <b>readline</b> that the
compspec generates filenames, so it can perform any
filename&minus;specific processing (such as adding a slash
to directory names, quoting special characters, or
suppressing trailing spaces). This is intended to be used
with shell functions.</p>
<p style="margin-left:28%;"><b>fullquote</b></p>
<p style="margin-left:38%;">Tell <b>readline</b> to quote
all the completed words even if they are not filenames.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>noquote</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Tell <b>readline</b> not to quote the completed words if
they are filenames (quoting filenames is the default).</p></td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>nosort</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Tell <b>readline</b> not to sort the list of possible
completions alphabetically.</p></td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>nospace</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Tell <b>readline</b> not to append a space (the default)
to words completed at the end of the line.</p></td></tr>
</table>
<p style="margin-left:28%;"><b>plusdirs</b></p>
<p style="margin-left:38%;">After generating any matches
defined by the compspec, attempt directory name completion
and add any matches to the results of the other actions.</p>
<p style="margin-left:18%;"><b>&minus;A</b>
<i>action</i></p>
<p style="margin-left:28%;">The <i>action</i> may be one of
the following to generate a list of possible
completions:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="28%"></td>
<td width="7%">
<p><b>alias</b></p></td>
<td width="3%"></td>
<td width="54%">
<p>Alias names. May also be specified as
<b>&minus;a</b>.</p> </td>
<td width="8%">
</td></tr>
</table>
<p style="margin-left:28%;"><b>arrayvar</b></p>
<p style="margin-left:38%;">Array variable names.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>binding</b></p></td>
<td width="1%"></td>
<td width="62%">
<p><b>Readline</b> key binding names.</p></td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>builtin</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Names of shell builtin commands. May also be specified
as <b>&minus;b</b>.</p></td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>command</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Command names. May also be specified as
<b>&minus;c</b>.</p> </td></tr>
</table>
<p style="margin-left:28%;"><b>directory</b></p>
<p style="margin-left:38%;">Directory names. May also be
specified as <b>&minus;d</b>.</p>
<p style="margin-left:28%;"><b>disabled</b></p>
<p style="margin-left:38%;">Names of disabled shell
builtins.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>enabled</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Names of enabled shell builtins.</p></td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>export</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Names of exported shell variables. May also be specified
as <b>&minus;e</b>.</p></td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>file</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>File and directory names, similar to
<b>readline</b>&rsquo;s filename completion. May also be
specified as <b>&minus;f</b>.</p></td></tr>
</table>
<p style="margin-left:28%;"><b>function</b></p>
<p style="margin-left:38%;">Names of shell functions.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="28%"></td>
<td width="7%">
<p><b>group</b></p></td>
<td width="3%"></td>
<td width="54%">
<p>Group names. May also be specified as
<b>&minus;g</b>.</p> </td>
<td width="8%">
</td></tr>
</table>
<p style="margin-left:28%;"><b>helptopic</b></p>
<p style="margin-left:38%;">Help topics as accepted by the
<b>help</b> builtin.</p>
<p style="margin-left:28%;"><b>hostname</b></p>
<p style="margin-left:38%;">Hostnames, as taken from the
file specified by the <b><small>HOSTFILE</small></b> shell
variable.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>job</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Job names, if job control is active. May also be
specified as <b>&minus;j</b>.</p></td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>keyword</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Shell reserved words. May also be specified as
<b>&minus;k</b>.</p> </td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>running</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Names of running jobs, if job control is active.</p></td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>service</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Service names. May also be specified as
<b>&minus;s</b>.</p> </td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>setopt</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Valid arguments for the <b>&minus;o</b> option to the
<b>set</b> builtin.</p></td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>shopt</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Shell option names as accepted by the <b>shopt</b>
builtin.</p> </td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>signal</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Signal names.</p></td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>stopped</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Names of stopped jobs, if job control is active.</p></td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>user</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>User names. May also be specified as
<b>&minus;u</b>.</p> </td></tr>
</table>
<p style="margin-left:28%;"><b>variable</b></p>
<p style="margin-left:38%;">Names of all shell variables.
May also be specified as <b>&minus;v</b>.</p>
<p style="margin-left:18%;"><b>&minus;C</b>
<i>command</i></p>
<p style="margin-left:28%;"><i>command</i> is executed in a
subshell environment, and its output is used as the possible
completions. Arguments are passed as with the
<b>&minus;F</b> option.</p>
<p style="margin-left:18%;"><b>&minus;F</b>
<i>function</i></p>
<p style="margin-left:28%;">The shell function
<i>function</i> is executed in the current shell
environment. When the function is executed, the first
argument (<b>$1</b>) is the name of the command whose
arguments are being completed, the second argument
(<b>$2</b>) is the word being completed, and the third
argument (<b>$3</b>) is the word preceding the word being
completed on the current command line. When <i>function</i>
finishes, programmable completion retrieves the possible
completions from the value of the
<b><small>COMPREPLY</small></b> array variable.</p>
<p style="margin-left:18%;"><b>&minus;G</b>
<i>globpat</i></p>
<p style="margin-left:28%;">Expand the pathname expansion
pattern <i>globpat</i> to generate the possible
completions.</p>
<p style="margin-left:18%;"><b>&minus;P</b>
<i>prefix</i></p>
<p style="margin-left:28%;">Add <i>prefix</i> to the
beginning of each possible completion after all other
options have been applied.</p>
<p style="margin-left:18%;"><b>&minus;S</b>
<i>suffix</i></p>
<p style="margin-left:28%;">Append <i>suffix</i> to each
possible completion after all other options have been
applied.</p>
<p style="margin-left:18%;"><b>&minus;W</b>
<i>wordlist</i></p>
<p style="margin-left:28%;">Split the <i>wordlist</i> using
the characters in the <b><small>IFS</small></b> special
variable as delimiters, and expand each resulting word.
Shell quoting is honored within <i>wordlist</i>, in order to
provide a mechanism for the words to contain shell
metacharacters or characters in the value of
<b><small>IFS</small></b><small>.</small> The possible
completions are the members of the resultant list which
match a prefix of the word being completed.</p>
<p style="margin-left:18%;"><b>&minus;X</b>
<i>filterpat</i></p>
<p style="margin-left:28%;"><i>filterpat</i> is a pattern
as used for pathname expansion. It is applied to the list of
possible completions generated by the preceding options and
arguments, and each completion matching <i>filterpat</i> is
removed from the list. A leading <b>!</b> in
<i>filterpat</i> negates the pattern; in this case, any
completion not matching <i>filterpat</i> is removed.</p>
<p style="margin-left:18%; margin-top: 1em">The return
value is true unless an invalid option is supplied, an
option other than <b>&minus;p</b>, <b>&minus;r</b>,
<b>&minus;D</b>, <b>&minus;E</b>, or <b>&minus;I</b> is
supplied without a <i>name</i> argument, an attempt is made
to remove a completion specification for a <i>name</i> for
which no specification exists, or an error occurs adding a
completion specification.</p>
<p style="margin-left:9%;"><b>compopt</b> [<b>&minus;o</b>
<i>option</i>] [<b>&minus;DEI</b>] [<b>+o</b> <i>option</i>]
[<i>name</i>]</p>
<p style="margin-left:18%;">Modify completion options for
each <i>name</i> according to the <i>option</i>s, or for the
currently-executing completion if no <i>name</i>s are
supplied. If no <i>option</i>s are supplied, display the
completion options for each <i>name</i> or the current
completion. The possible values of <i>option</i> are those
valid for the <b>complete</b> builtin described above.</p>
<p style="margin-left:18%; margin-top: 1em">The
<b>&minus;D</b> option indicates that other supplied options
should apply to the &ldquo;default&rdquo; command
completion; the <b>&minus;E</b> option indicates that other
supplied options should apply to &ldquo;empty&rdquo; command
completion; and the <b>&minus;I</b> option indicates that
other supplied options should apply to completion on the
initial word on the line. These are determined in the same
way as the <b>complete</b> builtin.</p>
<p style="margin-left:18%; margin-top: 1em">If multiple
options are supplied, the <b>&minus;D</b> option takes
precedence over <b>&minus;E</b>, and both take precedence
over <b>&minus;I</b>.</p>
<p style="margin-left:18%; margin-top: 1em">The return
value is true unless an invalid option is supplied, an
attempt is made to modify the options for a <i>name</i> for
which no completion specification exists, or an output error
occurs.</p>
<p style="margin-left:9%;"><b>continue</b> [<i>n</i>]</p>
<p style="margin-left:18%;"><b>continue</b> resumes the
next iteration of the enclosing <b>for</b>, <b>while</b>,
<b>until</b>, or <b>select</b> loop. If <i>n</i> is
specified, <b>bash</b> resumes the <i>n</i>th enclosing
loop. <i>n</i> must be &ge; 1. If <i>n</i> is greater than
the number of enclosing loops, the shell resumes the last
enclosing loop (the &ldquo;top-level&rdquo; loop). The
return value is 0 unless <i>n</i> is not greater than or
equal to 1.</p>
<p style="margin-left:9%;"><b>declare</b>
[<b>&minus;aAfFgiIlnrtux</b>] [<b>&minus;p</b>]
[<i>name</i>[=<i>value</i>] ...] <b><br>
typeset</b> [<b>&minus;aAfFgiIlnrtux</b>] [<b>&minus;p</b>]
[<i>name</i>[=<i>value</i>] ...]</p>
<p style="margin-left:18%;">Declare variables and/or give
them attributes. If no <i>name</i>s are given then display
the values of variables or functions. The <b>&minus;p</b>
option will display the attributes and values of each
<i>name</i>. When <b>&minus;p</b> is used with <i>name</i>
arguments, additional options, other than <b>&minus;f</b>
and <b>&minus;F</b>, are ignored.</p>
<p style="margin-left:18%; margin-top: 1em">When
<b>&minus;p</b> is supplied without <i>name</i> arguments,
<b>declare</b> will display the attributes and values of all
variables having the attributes specified by the additional
options. If no other options are supplied with
<b>&minus;p</b>, <b>declare</b> will display the attributes
and values of all shell variables. The <b>&minus;f</b>
option restricts the display to shell functions.</p>
<p style="margin-left:18%; margin-top: 1em">The
<b>&minus;F</b> option inhibits the display of function
definitions; only the function name and attributes are
printed. If the <b>extdebug</b> shell option is enabled
using <b>shopt</b>, the source file name and line number
where each <i>name</i> is defined are displayed as well. The
<b>&minus;F</b> option implies <b>&minus;f</b>.</p>
<p style="margin-left:18%; margin-top: 1em">The
<b>&minus;g</b> option forces variables to be created or
modified at the global scope, even when <b>declare</b> is
executed in a shell function. It is ignored when
<b>declare</b> is not executed in a shell function.</p>
<p style="margin-left:18%; margin-top: 1em">The
<b>&minus;I</b> option causes local variables to inherit the
attributes (except the <i>nameref</i> attribute) and value
of any existing variable with the same <i>name</i> at a
surrounding scope. If there is no existing variable, the
local variable is initially unset.</p>
<p style="margin-left:18%; margin-top: 1em">The following
options can be used to restrict output to variables with the
specified attribute or to give variables attributes:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;a</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Each <i>name</i> is an indexed array variable (see
<b>Arrays</b> above).</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;A</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Each <i>name</i> is an associative array variable (see
<b>Arrays</b> above).</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;f</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Each <i>name</i> refers to a shell function.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;i</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The variable is treated as an integer; arithmetic
evaluation (see <b><small>ARITHMETIC EVALUATION</small></b>
above) is performed when the variable is assigned a
value.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;l</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>When the variable is assigned a value, all upper-case
characters are converted to lower-case. The upper-case
attribute is disabled.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;n</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Give each <i>name</i> the <i>nameref</i> attribute,
making it a name reference to another variable. That other
variable is defined by the value of <i>name</i>. All
references, assignments, and attribute modifications to
<i>name</i>, except those using or changing the
<b>&minus;n</b> attribute itself, are performed on the
variable referenced by <i>name</i>&rsquo;s value. The
nameref attribute cannot be applied to array variables.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;r</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Make <i>name</i>s readonly. These names cannot then be
assigned values by subsequent assignment statements or
unset.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;t</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Give each <i>name</i> the <i>trace</i> attribute. Traced
functions inherit the <b>DEBUG</b> and <b>RETURN</b> traps
from the calling shell. The trace attribute has no special
meaning for variables.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;u</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>When the variable is assigned a value, all lower-case
characters are converted to upper-case. The lower-case
attribute is disabled.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;x</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Mark each <i>name</i> for export to subsequent commands
via the environment.</p></td></tr>
</table>
<p style="margin-left:18%; margin-top: 1em">Using
&ldquo;+&rdquo; instead of &ldquo;&minus;&rdquo; turns off
the specified attribute instead, with the exceptions that
<b>+a</b> and <b>+A</b> may not be used to destroy array
variables and <b>+r</b> will not remove the readonly
attribute.</p>
<p style="margin-left:18%; margin-top: 1em">When used in a
function, <b>declare</b> and <b>typeset</b> make each
<i>name</i> local, as with the <b>local</b> command, unless
the <b>&minus;g</b> option is supplied. If a variable name
is followed by =<i>value</i>, the value of the variable is
set to <i>value</i>. When using <b>&minus;a</b> or
<b>&minus;A</b> and the compound assignment syntax to create
array variables, additional attributes do not take effect
until subsequent assignments.</p>
<p style="margin-left:18%; margin-top: 1em">The return
value is 0 unless an invalid option is encountered, an
attempt is made to define a function using &ldquo;&minus;f
foo=bar&rdquo;, an attempt is made to assign a value to a
readonly variable, an attempt is made to assign a value to
an array variable without using the compound assignment
syntax (see <b>Arrays</b> above), one of the <i>names</i> is
not a valid shell variable name, an attempt is made to turn
off readonly status for a readonly variable, an attempt is
made to turn off array status for an array variable, or an
attempt is made to display a non-existent function with
<b>&minus;f</b>.</p>
<p style="margin-left:9%;"><b>dirs [&minus;clpv]
[+</b><i>n</i><b>] [&minus;</b><i>n</i><b>]</b></p>
<p style="margin-left:18%;">Without options, display the
list of currently remembered directories. The default
display is on a single line with directory names separated
by spaces. Directories are added to the list with the
<b>pushd</b> command; the <b>popd</b> command removes
entries from the list. The current directory is always the
first directory in the stack.</p>
<p style="margin-left:18%; margin-top: 1em">Options, if
supplied, have the following meanings:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;c</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Clears the directory stack by deleting all of the
entries.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;l</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Produces a listing using full pathnames; the default
listing format uses a tilde to denote the home
directory.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;p</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Print the directory stack with one entry per line.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;v</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Print the directory stack with one entry per line,
prefixing each entry with its index in the stack.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>+</b><i>n</i></p></td>
<td width="6%"></td>
<td width="73%">
<p>Displays the <i>n</i>th entry counting from the left of
the list shown by <b>dirs</b> when invoked without options,
starting with zero.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;</b><i>n</i></p></td>
<td width="6%"></td>
<td width="73%">
<p>Displays the <i>n</i>th entry counting from the right of
the list shown by <b>dirs</b> when invoked without options,
starting with zero.</p></td></tr>
</table>
<p style="margin-left:18%; margin-top: 1em">The return
value is 0 unless an invalid option is supplied or <i>n</i>
indexes beyond the end of the directory stack.</p>
<p style="margin-left:9%;"><b>disown</b> [<b>&minus;ar</b>]
[<b>&minus;h</b>] [<i>id</i> ...]</p>
<p style="margin-left:18%;">Without options, remove each
<i>id</i> from the table of active jobs. Each <i>id</i> may
be a job specification <i>jobspec</i> or a process ID
<i>pid</i>; if <i>id</i> is a <i>pid</i>, <b>disown</b> uses
the job containing <i>pid</i> as <i>jobspec</i>.</p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>&minus;h</b> option is supplied, <b>disown</b> does not
remove the jobs corresponding to each <i>id</i> from the
jobs table, but rather marks them so the shell does not send
<b><small>SIGHUP</small></b> to the job if the shell
receives a <b><small>SIGHUP</small></b><small>.</small></p>
<p style="margin-left:18%; margin-top: 1em">If no <i>id</i>
is supplied, the <b>&minus;a</b> option means to remove or
mark all jobs; the <b>&minus;r</b> option without an
<i>id</i> argument removes or marks running jobs. If no
<i>id</i> is supplied, and neither the <b>&minus;a</b> nor
the <b>&minus;r</b> option is supplied, <b>disown</b>
removes or marks the current job.</p>
<p style="margin-left:18%; margin-top: 1em">The return
value is 0 unless an <i>id</i> does not specify a valid
job.</p>
<p style="margin-left:9%;"><b>echo</b> [<b>&minus;neE</b>]
[<i>arg</i> ...]</p>
<p style="margin-left:18%;">Output the <i>arg</i>s,
separated by spaces, followed by a newline. The return
status is 0 unless a write error occurs. If <b>&minus;n</b>
is specified, the trailing newline is not printed.</p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>&minus;e</b> option is given, <b>echo</b> interprets the
following backslash-escaped characters. The <b>&minus;E</b>
option disables interpretation of these escape characters,
even on systems where they are interpreted by default. The
<b>xpg_echo</b> shell option determines whether or not
<b>echo</b> interprets any options and expands these escape
characters. <b>echo</b> does not interpret
<b>&minus;&minus;</b> to mean the end of options.</p>
<p style="margin-left:18%; margin-top: 1em"><b>echo</b>
interprets the following escape sequences:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\a</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>alert (bell)</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\b</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>backspace</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\c</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>suppress further output</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\e</b></p></td>
<td width="1%"></td>
<td width="73%">
</td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\E</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>an escape character</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\f</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>form feed</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\n</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>new line</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\r</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>carriage return</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\t</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>horizontal tab</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\v</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>vertical tab</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\\</b></p></td>
<td width="1%"></td>
<td width="73%">
<p>backslash</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\0</b><i>nnn</i></p></td>
<td width="1%"></td>
<td width="73%">
<p>The eight-bit character whose value is the octal value
<i>nnn</i> (zero to three octal digits).</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\x</b><i>HH</i></p></td>
<td width="1%"></td>
<td width="73%">
<p>The eight-bit character whose value is the hexadecimal
value <i>HH</i> (one or two hex digits).</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>\u</b><i>HHHH</i></p></td>
<td width="1%"></td>
<td width="73%">
<p>The Unicode (ISO/IEC 10646) character whose value is the
hexadecimal value <i>HHHH</i> (one to four hex digits).</p></td></tr>
</table>
<p style="margin-left:18%;"><b>\U</b><i>HHHHHHHH</i></p>
<p style="margin-left:27%;">The Unicode (ISO/IEC 10646)
character whose value is the hexadecimal value
<i>HHHHHHHH</i> (one to eight hex digits).</p>
<p style="margin-left:18%; margin-top: 1em"><b>echo</b>
writes any unrecognized backslash-escaped characters
unchanged.</p>
<p style="margin-left:9%;"><b>enable</b> [<b>&minus;a</b>]
[<b>&minus;dnps</b>] [<b>&minus;f</b> <i>filename</i>]
[<i>name</i> ...]</p>
<p style="margin-left:18%;">Enable and disable builtin
shell commands. Disabling a builtin allows an executable
file which has the same name as a shell builtin to be
executed without specifying a full pathname, even though the
shell normally searches for builtins before files.</p>
<p style="margin-left:18%; margin-top: 1em">If
<b>&minus;n</b> is supplied, each <i>name</i> is disabled;
otherwise, <i>name</i>s are enabled. For example, to use the
<b>test</b> binary found using <b><small>PATH</small></b>
instead of the shell builtin version, run &ldquo;enable
&minus;n test&rdquo;.</p>
<p style="margin-left:18%; margin-top: 1em">If no
<i>name</i> arguments are supplied, or if the
<b>&minus;p</b> option is supplied, print a list of shell
builtins. With no other option arguments, the list consists
of all enabled shell builtins. If <b>&minus;n</b> is
supplied, print only disabled builtins. If <b>&minus;a</b>
is supplied, the list printed includes all builtins, with an
indication of whether or not each is enabled. The
<b>&minus;s</b> option means to restrict the output to the
<small>POSIX</small> <i>special</i> builtins.</p>
<p style="margin-left:18%; margin-top: 1em">The
<b>&minus;f</b> option means to load the new builtin command
<i>name</i> from shared object <i>filename</i>, on systems
that support dynamic loading. If <i>filename</i> does not
contain a slash, <b>Bash</b> will use the value of the
<b>BASH_LOADABLES_PATH</b> variable as a colon-separated
list of directories in which to search for <i>filename</i>.
The default for <b>BASH_LOADABLES_PATH</b> is
system-dependent, and may include &ldquo;.&rdquo; to force a
search of the current directory. The <b>&minus;d</b> option
will delete a builtin previously loaded with
<b>&minus;f</b>. If <i>&minus;s</i> is used with
<i>&minus;f</i>, the new builtin becomes a
<small>POSIX</small> special builtin.</p>
<p style="margin-left:18%; margin-top: 1em">If no options
are supplied and a <i>name</i> is not a shell builtin,
<b>enable</b> will attempt to load <i>name</i> from a shared
object named <i>name</i>, as if the command were
&ldquo;enable &minus;f <i>name name</i>&rdquo;.</p>
<p style="margin-left:18%; margin-top: 1em">The return
value is 0 unless a <i>name</i> is not a shell builtin or
there is an error loading a new builtin from a shared
object.</p>
<p style="margin-left:9%;"><b>eval</b> [<i>arg</i> ...]</p>
<p style="margin-left:18%;">Concatenate the <i>arg</i>s
together into a single command, separating them with spaces.
<b>Bash</b> then reads and execute this command, and returns
its exit status as the return status of <b>eval</b>. If
there are no <i>args</i>, or only null arguments,
<b>eval</b> returns 0.</p>
<p style="margin-left:9%;"><b>exec</b> [<b>&minus;cl</b>]
[<b>&minus;a</b> <i>name</i>] [<i>command</i>
[<i>arguments</i>]]</p>
<p style="margin-left:18%;">If <i>command</i> is specified,
it replaces the shell without creating a new process.
<i>command</i> cannot be a shell builtin or function. The
<i>arguments</i> become the arguments to <i>command</i>. If
the <b>&minus;l</b> option is supplied, the shell places a
dash at the beginning of the zeroth argument passed to
<i>command</i>. This is what <i>login</i>(1) does. The
<b>&minus;c</b> option causes <i>command</i> to be executed
with an empty environment. If <b>&minus;a</b> is supplied,
the shell passes <i>name</i> as the zeroth argument to the
executed command.</p>
<p style="margin-left:18%; margin-top: 1em">If
<i>command</i> cannot be executed for some reason, a
non-interactive shell exits, unless the <b>execfail</b>
shell option is enabled. In that case, it returns a non-zero
status. An interactive shell returns a non-zero status if
the file cannot be executed. A subshell exits
unconditionally if <b>exec</b> fails.</p>
<p style="margin-left:18%; margin-top: 1em">If
<i>command</i> is not specified, any redirections take
effect in the current shell, and the return status is 0. If
there is a redirection error, the return status is 1.</p>
<p style="margin-left:9%;"><b>exit</b> [<i>n</i>]</p>
<p style="margin-left:18%;">Cause the shell to exit with a
status of <i>n</i>. If <i>n</i> is omitted, the exit status
is that of the last command executed. Any trap on
<b><small>EXIT</small></b> is executed before the shell
terminates.</p>
<p style="margin-left:9%;"><b>export</b> [<b>&minus;fn</b>]
[<i>name</i>[=<i>value</i>]] ... <b><br>
export &minus;p [&minus;f]</b></p>
<p style="margin-left:18%;">The supplied <i>names</i> are
marked for automatic export to the environment of
subsequently executed commands. If the <b>&minus;f</b>
option is given, the <i>names</i> refer to functions.</p>
<p style="margin-left:18%; margin-top: 1em">The
<b>&minus;n</b> option unexports, or removes the export
attribute, from each <i>name</i>. If no <i>names</i> are
given, or if only the <b>&minus;p</b> option is supplied,
<b>export</b> displays a list of names of all exported
variables on the standard output. Using <b>&minus;p</b> and
<b>&minus;f</b> together displays exported functions. The
<b>&minus;p</b> option displays output in a form that may be
reused as input.</p>
<p style="margin-left:18%; margin-top: 1em"><b>export</b>
allows the value of a variable to be set when it is exported
or unexported by following the variable name with
=<i>value</i>. This sets the value of the variable to
<i>value</i> while modifying the export attribute.
<b>export</b> returns an exit status of 0 unless an invalid
option is encountered, one of the <i>names</i> is not a
valid shell variable name, or <b>&minus;f</b> is supplied
with a <i>name</i> that is not a function.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>false</b></p></td>
<td width="3%"></td>
<td width="51%">
<p>Does nothing; returns a non-zero status.</p></td>
<td width="31%">
</td></tr>
</table>
<p style="margin-left:9%;"><b>fc</b> [<b>&minus;e</b>
<i>ename</i>] [<b>&minus;lnr</b>] [<i>first</i>]
[<i>last</i>] <b><br>
fc &minus;s</b> [<i>pat</i>=<i>rep</i>] [<i>cmd</i>]</p>
<p style="margin-left:18%;">The first form selects a range
of commands from <i>first</i> to <i>last</i> from the
history list and displays or edits and re-executes them.
<i>First</i> and <i>last</i> may be specified as a string
(to locate the last 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).</p>
<p style="margin-left:18%; margin-top: 1em">When listing, a
<i>first</i> or <i>last</i> of 0 is equivalent to &minus;1
and &minus;0 is equivalent to the current command (usually
the <b>fc</b> command); otherwise 0 is equivalent to
&minus;1 and &minus;0 is invalid. If <i>last</i> is not
specified, it is set to the current command for listing (so
that &ldquo;fc &minus;l &minus;10&rdquo; prints the last 10
commands) and to <i>first</i> otherwise. If <i>first</i> is
not specified, it is set to the previous command for editing
and &minus;16 for listing.</p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>&minus;l</b> option is supplied, the commands are listed
on the standard output. The <b>&minus;n</b> option
suppresses the command numbers when listing. The
<b>&minus;r</b> option reverses the order of the
commands.</p>
<p style="margin-left:18%; margin-top: 1em">Otherwise,
<b>fc</b> invokes the editor named by <i>ename</i> on a file
containing those commands. If <i>ename</i> is not supplied,
<b>fc</b> uses the value of the <b><small>FCEDIT</small></b>
variable, and the value of <b><small>EDITOR</small></b> if
<b><small>FCEDIT</small></b> is not set. If neither variable
is set, <b>fc</b> uses <i>vi.</i> When editing is complete,
<b>fc</b> reads the file containing the edited commands and
echoes and executes them.</p>
<p style="margin-left:18%; margin-top: 1em">In the second
form, <b>fc</b> re-executes <i>command</i> after replacing
each instance of <i>pat</i> with <i>rep</i>. <i>Command</i>
is interpreted the same as <i>first</i> above.</p>
<p style="margin-left:18%; margin-top: 1em">A useful alias
to use with <b>fc</b> is &ldquo;r=&quot;fc
&minus;s&quot;&rdquo;, so that typing &ldquo;r cc&rdquo;
runs the last command beginning with &ldquo;cc&rdquo; and
typing &ldquo;r&rdquo; re-executes the last command.</p>
<p style="margin-left:18%; margin-top: 1em">If the first
form is used, the return value is zero unless an invalid
option is encountered or <i>first</i> or <i>last</i> specify
history lines out of range. When editing and re-executing a
file of commands, the return value is the value of the last
command executed or failure if an error occurs with the
temporary file. If the second form is used, the return
status is that of the re-executed command, unless <i>cmd</i>
does not specify a valid history entry, in which case
<b>fc</b> returns a non-zero status.</p>
<p style="margin-left:9%;"><b>fg</b> [<i>jobspec</i>]</p>
<p style="margin-left:18%;">Resume <i>jobspec</i> in the
foreground, and make it the current job. If <i>jobspec</i>
is not present, <b>fg</b> uses the shell&rsquo;s notion of
the <i>current job</i>. The return value is that of the
command placed into the foreground, or failure if run when
job control is disabled or, when run with job control
enabled, if <i>jobspec</i> does not specify a valid job or
<i>jobspec</i> specifies a job that was started without job
control.</p>
<p style="margin-left:9%;"><b>getopts</b> <i>optstring
name</i> [<i>arg</i> ...]</p>
<p style="margin-left:18%;"><b>getopts</b> is used by shell
scripts and functions to parse positional parameters and
obtain options and their arguments. <i>optstring</i>
contains the option characters to be recognized; if a
character is followed by a colon, the option is expected to
have an argument, which should be separated from it by white
space. The colon and question mark characters may not be
used as option characters.</p>
<p style="margin-left:18%; margin-top: 1em">Each time it is
invoked, <b>getopts</b> places the next option in the shell
variable <i>name</i>, initializing <i>name</i> if it does
not exist, and the index of the next argument to be
processed into the variable
<b><small>OPTIND</small></b><small>. <b>OPTIND</b></small>
is initialized to 1 each time the shell or a shell script is
invoked. When an option requires an argument, <b>getopts</b>
places that argument into the variable
<b><small>OPTARG</small></b><small>.</small></p>
<p style="margin-left:18%; margin-top: 1em">The shell does
not reset <b><small>OPTIND</small></b> automatically; it
must be manually reset between multiple calls to
<b>getopts</b> within the same shell invocation to use a new
set of parameters.</p>
<p style="margin-left:18%; margin-top: 1em">When it reaches
the end of options, <b>getopts</b> exits with a return value
greater than zero. <b><small>OPTIND</small></b> is set to
the index of the first non-option argument, and <i>name</i>
is set to ?.</p>
<p style="margin-left:18%; margin-top: 1em"><b>getopts</b>
normally parses the positional parameters, but if more
arguments are supplied as <i>arg</i> values, <b>getopts</b>
parses those instead.</p>
<p style="margin-left:18%; margin-top: 1em"><b>getopts</b>
can report errors in two ways. If the first character of
<i>optstring</i> is a colon, <b>getopts</b> uses
<i>silent</i> error reporting. In normal operation,
<b>getopts</b> prints diagnostic messages when it encounters
invalid options or missing option arguments. If the variable
<b><small>OPTERR</small></b> is set to 0, <b>getopts</b>
does not display any error messages, even if the first
character of <i>optstring</i> is not a colon.</p>
<p style="margin-left:18%; margin-top: 1em">If
<b>getopts</b> detects an invalid option, it places ? into
<i>name</i> and, if not silent, prints an error message and
unsets <b><small>OPTARG</small></b><small>.</small> If
<b>getopts</b> is silent, it assigns the option character
found to <b><small>OPTARG</small></b> and does not print a
diagnostic message.</p>
<p style="margin-left:18%; margin-top: 1em">If a required
argument is not found, and <b>getopts</b> is not silent, it
sets the value of <i>name</i> to a question mark (<b>?</b>),
unsets <b><small>OPTARG</small></b><small>,</small> and
prints a diagnostic message. If <b>getopts</b> is silent, it
sets the value of <i>name</i> to a colon (<b>:</b>) and sets
<b><small>OPTARG</small></b> to the option character
found.</p>
<p style="margin-left:18%; margin-top: 1em"><b>getopts</b>
returns true if an option, specified or unspecified, is
found. It returns false if the end of options is encountered
or an error occurs.</p>
<p style="margin-left:9%;"><b>hash</b> [<b>&minus;lr</b>]
[<b>&minus;p</b> <i>filename</i>] [<b>&minus;dt</b>]
[<i>name</i>]</p>
<p style="margin-left:18%;">Each time <b>hash</b> is
invoked, it remembers the full pathname of the command
<i>name</i> as determined by searching the directories in
<b>$PATH</b>. Any previously-remembered pathname associated
with <i>name</i> is discarded. If the <b>&minus;p</b> option
is supplied, <b>hash</b> uses <i>filename</i> as the full
pathname of the command.</p>
<p style="margin-left:18%; margin-top: 1em">The
<b>&minus;r</b> option causes the shell to forget all
remembered locations. Assigning to the <b>PATH</b> variable
also clears all hashed filenames. The <b>&minus;d</b> option
causes the shell to forget the remembered location of each
<i>name</i>.</p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>&minus;t</b> option is supplied, <b>hash</b> prints the
full pathname corresponding to each <i>name</i>. If multiple
<i>name</i> arguments are supplied with <b>&minus;t</b>,
<b>hash</b> prints the <i>name</i> before the corresponding
hashed full pathname. The <b>&minus;l</b> option displays
output in a format that may be reused as input.</p>
<p style="margin-left:18%; margin-top: 1em">If no arguments
are given, or if only <b>&minus;l</b> is supplied,
<b>hash</b> prints information about remembered commands.
The <b>&minus;t</b>, <b>&minus;d</b>, and <b>&minus;p</b>
options (the options that act on the <i>name</i> arguments)
are mutually exclusive. Only one will be active. If more
than one is supplied, <b>&minus;t</b> has higher priority
than <b>&minus;p</b>, and both have higher priority than
<b>&minus;d</b>.</p>
<p style="margin-left:18%; margin-top: 1em">The return
status is zero unless a <i>name</i> is not found or an
invalid option is supplied.</p>
<p style="margin-left:9%;"><b>help</b> [<b>&minus;dms</b>]
[<i>pattern</i>]</p>
<p style="margin-left:18%;">Display helpful information
about builtin commands. If <i>pattern</i> is specified,
<b>help</b> gives detailed help on all commands matching
<i>pattern</i> as described below; otherwise it displays a
list of all the builtins and shell compound commands.</p>
<p style="margin-left:18%; margin-top: 1em">Options, if
supplied, have the follow meanings:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;d</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Display a short description of each <i>pattern</i></p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;m</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Display the description of each <i>pattern</i> in a
manpage-like format</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;s</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Display only a short usage synopsis for each
<i>pattern</i></p> </td></tr>
</table>
<p style="margin-left:18%; margin-top: 1em">If
<i>pattern</i> contains pattern matching characters (see
<b><small>Pattern Matching</small></b> above) it&rsquo;s
treated as a shell pattern and <b>help</b> prints the
description of each help topic matching <i>pattern</i>.</p>
<p style="margin-left:18%; margin-top: 1em">If not, and
<i>pattern</i> exactly matches the name of a help topic,
<b>help</b> prints the description associated with that
topic. Otherwise, <b>help</b> performs prefix matching and
prints the descriptions of all matching help topics.</p>
<p style="margin-left:18%; margin-top: 1em">The return
status is 0 unless no command matches <i>pattern</i>.</p>
<p style="margin-left:9%;"><b>history [</b><i>n</i><b>]
<br>
history &minus;c <br>
history &minus;d</b> <i>offset</i> <b><br>
history &minus;d</b> <i>start</i>-<i>end</i> <b><br>
history &minus;anrw</b> [<i>filename</i>] <b><br>
history &minus;p</b> <i>arg</i> [<i>arg</i> ...] <b><br>
history &minus;s</b> <i>arg</i> [<i>arg</i> ...]</p>
<p style="margin-left:18%;">With no options, display the
command history list with numbers. Entries prefixed with a
<b>*</b> have been modified. An argument of <i>n</i> lists
only the last <i>n</i> entries. If the shell variable
<b><small>HISTTIMEFORMAT</small></b> is set and not null, it
is used as a format string for <i>strftime</i>(3) to display
the time stamp associated with each displayed history entry.
If <b>history</b> uses
<b><small>HISTTIMEFORMAT</small></b><small>,</small> it does
not print an intervening space between the formatted time
stamp and the history entry.</p>
<p style="margin-left:18%; margin-top: 1em">If
<i>filename</i> is supplied, <b>history</b> uses it as the
name of the history file; if not, it uses the value of
<b><small>HISTFILE</small></b><small>.</small> If
<i>filename</i> is not supplied and
<b><small>HISTFILE</small></b> is unset or null, the
<b>&minus;a, &minus;n, &minus;r,</b> and <b>&minus;w</b>
options have no effect.</p>
<p style="margin-left:18%; margin-top: 1em">Options, if
supplied, have the following meanings:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;c</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Clear the history list by deleting all the entries. This
can be used with the other options to replace the history
list.</p> </td></tr>
</table>
<p style="margin-left:18%;"><b>&minus;d</b>
<i>offset</i></p>
<p style="margin-left:27%;">Delete the history entry at
position <i>offset</i>. If <i>offset</i> is negative, it is
interpreted as relative to one greater than the last history
position, so negative indices count back from the end of the
history, and an index of &minus;1 refers to the current
<b>history &minus;d</b> command.</p>
<p style="margin-left:18%;"><b>&minus;d</b>
<i>start</i>&minus;<i>end</i></p>
<p style="margin-left:27%;">Delete the range of history
entries between positions <i>start</i> and <i>end</i>,
inclusive. Positive and negative values for <i>start</i> and
<i>end</i> are interpreted as described above.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;a</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Append the &ldquo;new&rdquo; history lines to the
history file. These are history lines entered since the
beginning of the current <b>bash</b> session, but not
already appended to the history file.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;n</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Read the history lines not already read from the history
file and add them to the current history list. These are
lines appended to the history file since the beginning of
the current <b>bash</b> session.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;r</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Read the history file and append its contents to the
current history list.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;w</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Write the current history list to the history file,
overwriting the history file.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;p</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Perform history substitution on the following
<i>args</i> and display the result on the standard output,
without storing the results in the history list. Each
<i>arg</i> must be quoted to disable normal history
expansion.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;s</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Store the <i>args</i> in the history list as a single
entry. The last command in the history list is removed
before adding the <i>args</i>.</p></td></tr>
</table>
<p style="margin-left:18%; margin-top: 1em">If the
<b><small>HISTTIMEFORMAT</small></b> variable is set,
<b>history</b> writes the time stamp information associated
with each history entry to the history file, marked with the
history comment character as described above. When the
history file is read, lines beginning with the history
comment character followed immediately by a digit are
interpreted as timestamps for the following history
entry.</p>
<p style="margin-left:18%; margin-top: 1em">The return
value is 0 unless an invalid option is encountered, an error
occurs while reading or writing the history file, an invalid
<i>offset</i> or range is supplied as an argument to
<b>&minus;d</b>, or the history expansion supplied as an
argument to <b>&minus;p</b> fails.</p>
<p style="margin-left:9%;"><b>jobs</b>
[<b>&minus;lnprs</b>] [ <i>jobspec</i> ... ] <b><br>
jobs &minus;x</b> <i>command</i> [ <i>args</i> ... ]</p>
<p style="margin-left:18%;">The first form lists the active
jobs. The options have the following meanings:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;l</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>List process IDs in addition to the normal
information.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;n</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Display information only about jobs that have changed
status since the user was last notified of their status.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;p</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>List only the process ID of the job&rsquo;s process
group leader.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;r</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Display only running jobs.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;s</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Display only stopped jobs.</p></td></tr>
</table>
<p style="margin-left:18%; margin-top: 1em">If
<i>jobspec</i> is supplied, <b>jobs</b> restricts output to
information about that job. The return status is 0 unless an
invalid option is encountered or an invalid <i>jobspec</i>
is supplied.</p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>&minus;x</b> option is supplied, <b>jobs</b> replaces any
<i>jobspec</i> found in <i>command</i> or <i>args</i> with
the corresponding process group ID, and executes
<i>command</i>, passing it <i>args</i>, returning its exit
status.</p>
<p style="margin-left:9%;"><b>kill</b> [<b>&minus;s</b>
<i>sigspec</i> | <b>&minus;n</b> <i>signum</i> |
<b>&minus;</b><i>sigspec</i>] <i>id</i> [ ... ] <b><br>
kill &minus;l</b>|<b>&minus;L</b> [<i>sigspec</i> |
<i>exit_status</i>]</p>
<p style="margin-left:18%;">Send the signal specified by
<i>sigspec</i> or <i>signum</i> to the processes named by
each <i>id</i>. Each <i>id</i> may be a job specification
<i>jobspec</i> or a process ID <i>pid</i>. <i>sigspec</i> is
either a case-insensitive signal name such as
<b><small>SIGKILL</small></b> (with or without the
<b><small>SIG</small></b> prefix) or a signal number;
<i>signum</i> is a signal number. If <i>sigspec</i> is not
supplied, then <b>kill</b> sends
<b><small>SIGTERM</small></b><small>.</small></p>
<p style="margin-left:18%; margin-top: 1em">The
<b>&minus;l</b> option lists the signal names. If any
arguments are supplied when <b>&minus;l</b> is given,
<b>kill</b> lists the names of the signals corresponding to
the arguments, and the return status is 0. The
<i>exit_status</i> argument to <b>&minus;l</b> is a number
specifying either a signal number or the exit status of a
process terminated by a signal; if it is supplied,
<b>kill</b> prints the name of the signal that caused the
process to terminate. <b>kill</b> assumes that process exit
statuses are greater than 128; anything less than that is a
signal number. The <b>&minus;L</b> option is equivalent to
<b>&minus;l</b>.</p>
<p style="margin-left:18%; margin-top: 1em"><b>kill</b>
returns true if at least one signal was successfully sent,
or false if an error occurs or an invalid option is
encountered.</p>
<p style="margin-left:9%;"><b>let</b> <i>arg</i>
[<i>arg</i> ...]</p>
<p style="margin-left:18%;">Each <i>arg</i> is evaluated as
an arithmetic expression (see <b><small>ARITHMETIC
EVALUATION</small></b> above). If the last <i>arg</i>
evaluates to 0, <b>let</b> returns 1; otherwise <b>let</b>
returns 0.</p>
<p style="margin-left:9%;"><b>local</b> [<i>option</i>]
[<i>name</i>[=<i>value</i>] ... | &minus; ]</p>
<p style="margin-left:18%;">For each argument, create a
local variable named <i>name</i> and assign it <i>value</i>.
The <i>option</i> can be any of the options accepted by
<b>declare</b>. When <b>local</b> is used within a function,
it causes the variable <i>name</i> to have a visible scope
restricted to that function and its children. It is an error
to use <b>local</b> when not within a function.</p>
<p style="margin-left:18%; margin-top: 1em">If <i>name</i>
is &minus;, it makes the set of shell options local to the
function in which <b>local</b> is invoked: any shell options
changed using the <b>set</b> builtin inside the function
after the call to <b>local</b> are restored to their
original values when the function returns. The restore is
performed as if a series of <b>set</b> commands were
executed to restore the values that were in place before the
function.</p>
<p style="margin-left:18%; margin-top: 1em">With no
operands, <b>local</b> writes a list of local variables to
the standard output.</p>
<p style="margin-left:18%; margin-top: 1em">The return
status is 0 unless <b>local</b> is used outside a function,
an invalid <i>name</i> is supplied, or <i>name</i> is a
readonly variable.</p>
<p style="margin-left:9%;"><b>logout
[</b><i>n</i><b>]</b></p>
<p style="margin-left:18%;">Exit a login shell, returning a
status of <i>n</i> to the shell&rsquo;s parent.</p>
<p style="margin-left:9%;"><b>mapfile</b> [<b>&minus;d</b>
<i>delim</i>] [<b>&minus;n</b> <i>count</i>]
[<b>&minus;O</b> <i>origin</i>] [<b>&minus;s</b>
<i>count</i>] [<b>&minus;t</b>] [<b>&minus;u</b> <i>fd</i>]
[<b>&minus;C</b> <i><br>
callback</i>] [<b>&minus;c</b> <i>quantum</i>]
[<i>array</i>] <b><br>
readarray</b> [<b>&minus;d</b> <i>delim</i>]
[<b>&minus;n</b> <i>count</i>] [<b>&minus;O</b>
<i>origin</i>] [<b>&minus;s</b> <i>count</i>]
[<b>&minus;t</b>] [<b>&minus;u</b> <i>fd</i>]
[<b>&minus;C</b> <i><br>
callback</i>] [<b>&minus;c</b> <i>quantum</i>]
[<i>array</i>]</p>
<p style="margin-left:18%;">Read lines from the standard
input, or from file descriptor <i>fd</i> if the
<b>&minus;u</b> option is supplied, into the indexed array
variable <i>array</i>. The variable
<b><small>MAPFILE</small></b> is the default <i>array</i>.
Options, if supplied, have the following meanings:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;d</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Use the first character of <i>delim</i> to terminate
each input line, rather than newline. If <i>delim</i> is the
empty string, <b>mapfile</b> will terminate a line when it
reads a NUL character.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;n</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Copy at most <i>count</i> lines. If <i>count</i> is 0,
copy all lines.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;O</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Begin assigning to <i>array</i> at index <i>origin</i>.
The default index is 0.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;s</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Discard the first <i>count</i> lines read.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;t</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Remove a trailing <i>delim</i> (default newline) from
each line read.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;u</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Read lines from file descriptor <i>fd</i> instead of the
standard input.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;C</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Evaluate <i>callback</i> each time <i>quantum</i> lines
are read. The <b>&minus;c</b> option specifies
<i>quantum</i>.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;c</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Specify the number of lines read between each call to
<i>callback</i>.</p> </td></tr>
</table>
<p style="margin-left:18%; margin-top: 1em">If
<b>&minus;C</b> is specified without <b>&minus;c</b>, the
default quantum is 5000. When <i>callback</i> is evaluated,
it is supplied the index of the next array element to be
assigned and the line to be assigned to that element as
additional arguments. <i>callback</i> is evaluated after the
line is read but before the array element is assigned.</p>
<p style="margin-left:18%; margin-top: 1em">If not supplied
with an explicit origin, <b>mapfile</b> will clear
<i>array</i> before assigning to it.</p>
<p style="margin-left:18%; margin-top: 1em"><b>mapfile</b>
returns zero unless an invalid option or option argument is
supplied, <i>array</i> is invalid or unassignable, or if
<i>array</i> is not an indexed array.</p>
<p style="margin-left:9%;"><b>popd</b> [&minus;<b>n</b>]
[+<i>n</i>] [&minus;<i>n</i>]</p>
<p style="margin-left:18%;">Remove entries from the
directory stack. The elements are numbered from 0 starting
at the first directory listed by <b>dirs</b>, so <b>popd</b>
is equivalent to &ldquo;popd +0.&rdquo; With no arguments,
<b>popd</b> removes the top directory from the stack, and
changes to the new top directory. Arguments, if supplied,
have the following meanings:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;n</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Suppress the normal change of directory when removing
directories from the stack, only manipulate the stack.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>+</b><i>n</i></p></td>
<td width="6%"></td>
<td width="73%">
<p>Remove the <i>n</i>th entry counting from the left of
the list shown by <b>dirs</b>, starting with zero, from the
stack. For example: &ldquo;popd +0&rdquo; removes the first
directory, &ldquo;popd +1&rdquo; the second.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;</b><i>n</i></p></td>
<td width="6%"></td>
<td width="73%">
<p>Remove the <i>n</i>th entry counting from the right of
the list shown by <b>dirs</b>, starting with zero. For
example: &ldquo;popd &minus;0&rdquo; removes the last
directory, &ldquo;popd &minus;1&rdquo; the next to last.</p></td></tr>
</table>
<p style="margin-left:18%; margin-top: 1em">If the top
element of the directory stack is modified, and the
<i>&minus;n</i> option was not supplied, <b>popd</b> uses
the <b>cd</b> builtin to change to the directory at the top
of the stack. If the <b>cd</b> fails, <b>popd</b> returns a
non-zero value.</p>
<p style="margin-left:18%; margin-top: 1em">Otherwise,
<b>popd</b> returns false if an invalid option is supplied,
the directory stack is empty, or <i>n</i> specifies a
non-existent directory stack entry.</p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>popd</b> command is successful, <b>bash</b> runs
<b>dirs</b> to show the final contents of the directory
stack, and the return status is 0.</p>
<p style="margin-left:9%;"><b>printf</b> [<b>&minus;v</b>
<i>var</i>] <i>format</i> [<i>arguments</i>]</p>
<p style="margin-left:18%;">Write the formatted
<i>arguments</i> to the standard output under the control of
the <i>format</i>. The <b>&minus;v</b> option assigns the
output to the variable <i>var</i> rather than printing it to
the standard output.</p>
<p style="margin-left:18%; margin-top: 1em">The
<i>format</i> is a character string which contains three
types of objects: 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 <i>argument</i>. In addition to the standard
<i>printf</i>(3) format characters
<b>cCsSndiouxXeEfFgGaA</b>, <b>printf</b> interprets the
following additional format specifiers:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>%b</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>causes <b>printf</b> to expand backslash escape
sequences in the corresponding <i>argument</i> in the same
way as <b>echo &minus;e</b>.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>%q</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>causes <b>printf</b> to output the corresponding
<i>argument</i> in a format that can be reused as shell
input. <b>%q</b> and <b>%Q</b> use the <b>$''</b> quoting
style if any characters in the argument string require it,
and backslash quoting otherwise. If the format string uses
the <i>printf</i> alternate form, these two formats quote
the argument string using single quotes.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>%Q</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>like <b>%q</b>, but applies any supplied precision to
the <i>argument</i> before quoting it.</p></td></tr>
</table>
<p style="margin-left:18%;"><b>%(</b><i>datefmt</i><b>)T</b></p>
<p style="margin-left:27%;">causes <b>printf</b> to output
the date-time string resulting from using <i>datefmt</i> as
a format string for <i>strftime</i>(3). The corresponding
<i>argument</i> is an integer representing the number of
seconds since the epoch. This format specifier recognizes
two special argument values: &minus;1 represents the current
time, and &minus;2 represents the time the shell was
invoked. If no argument is specified, conversion behaves as
if &minus;1 had been supplied. This is an exception to the
usual <b>printf</b> behavior.</p>
<p style="margin-left:18%; margin-top: 1em">The %b, %q, and
%T format specifiers all use the field width and precision
arguments from the format specification and write that many
bytes from (or use that wide a field for) the expanded
argument, which usually contains more characters than the
original.</p>
<p style="margin-left:18%; margin-top: 1em">The %n format
specifier accepts a corresponding argument that is treated
as a shell variable name.</p>
<p style="margin-left:18%; margin-top: 1em">The %s and %c
format specifiers accept an l (long) modifier, which forces
them to convert the argument string to a wide-character
string and apply any supplied field width and precision in
terms of characters, not bytes. The %S and %C format
specifiers are equivalent to %ls and %lc, respectively.</p>
<p style="margin-left:18%; margin-top: 1em">Arguments to
non-string format specifiers are treated as C constants,
except that a leading plus or minus sign is allowed, and if
the leading character is a single or double quote, the value
is the numeric value of the following character, using the
current locale.</p>
<p style="margin-left:18%; margin-top: 1em">The
<i>format</i> is reused as necessary to consume all of the
<i>arguments</i>. If the <i>format</i> requires more
<i>arguments</i> than are supplied, the extra format
specifications behave as if a zero value or null string, as
appropriate, had been supplied. The return value is zero on
success, non-zero if an invalid option is supplied or a
write or assignment error occurs.</p>
<p style="margin-left:9%;"><b>pushd</b> [<b>&minus;n</b>]
[+<i>n</i>] [&minus;<i>n</i>] <b><br>
pushd</b> [<b>&minus;n</b>] [<i>dir</i>]</p>
<p style="margin-left:18%;">Add a directory to the top of
the directory stack, or rotate the stack, making the new top
of the stack the current working directory. With no
arguments, <b>pushd</b> exchanges the top two elements of
the directory stack. Arguments, if supplied, have the
following meanings:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="4%">
<p><b>&minus;n</b></p></td>
<td width="5%"></td>
<td width="73%">
<p>Suppress the normal change of directory when rotating or
adding directories to the stack, only manipulate the
stack.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="4%">
<p><b>+</b><i>n</i></p></td>
<td width="5%"></td>
<td width="73%">
<p>Rotate the stack so that the <i>n</i>th directory
(counting from the left of the list shown by <b>dirs</b>,
starting with zero) is at the top.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="4%">
<p><b>&minus;</b><i>n</i></p></td>
<td width="5%"></td>
<td width="73%">
<p>Rotates the stack so that the <i>n</i>th directory
(counting from the right of the list shown by <b>dirs</b>,
starting with zero) is at the top.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="4%">
<p><i>dir</i></p></td>
<td width="5%"></td>
<td width="73%">
<p>Adds <i>dir</i> to the directory stack at the top.</p></td></tr>
</table>
<p style="margin-left:18%; margin-top: 1em">After the stack
has been modified, if the <b>&minus;n</b> option was not
supplied, <b>pushd</b> uses the <b>cd</b> builtin to change
to the directory at the top of the stack. If the <b>cd</b>
fails, <b>pushd</b> returns a non-zero value.</p>
<p style="margin-left:18%; margin-top: 1em">Otherwise, if
no arguments are supplied, <b>pushd</b> returns zero unless
the directory stack is empty. When rotating the directory
stack, <b>pushd</b> returns zero unless the directory stack
is empty or <i>n</i> specifies a non-existent directory
stack element.</p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>pushd</b> command is successful, <b>bash</b> runs
<b>dirs</b> to show the final contents of the directory
stack.</p>
<p style="margin-left:9%;"><b>pwd</b>
[<b>&minus;LP</b>]</p>
<p style="margin-left:18%;">Print the absolute pathname of
the current working directory. The pathname printed contains
no symbolic links if the <b>&minus;P</b> option is supplied
or the <b>&minus;o physical</b> option to the <b>set</b>
builtin command is enabled. If the <b>&minus;L</b> option is
used, the pathname printed may contain symbolic links. The
return status is 0 unless an error occurs while reading the
name of the current directory or an invalid option is
supplied.</p>
<p style="margin-left:9%;"><b>read</b> [<b>&minus;Eers</b>]
[<b>&minus;a</b> <i>aname</i>] [<b>&minus;d</b>
<i>delim</i>] [<b>&minus;i</b> <i>text</i>] [<b>&minus;n</b>
<i>nchars</i>] [<b>&minus;N</b> <i>nchars</i>] <br>
[<b>&minus;p</b> <i>prompt</i>] [<b>&minus;t</b>
<i>timeout</i>] [<b>&minus;u</b> <i>fd</i>] [<i>name</i>
...]</p>
<p style="margin-left:18%;">Read one line from the standard
input, or from the file descriptor <i>fd</i> supplied as an
argument to the <b>&minus;u</b> option, split it into words
as described above under <b>Word Splitting</b>, and assign
the first word to the first <i>name</i>, the second word to
the second <i>name</i>, and so on. If there are more words
than names, the remaining words and their intervening
delimiters are assigned to the last <i>name</i>. If there
are fewer words read from the input stream than names, the
remaining names are assigned empty values. The characters in
the value of the <b><small>IFS</small></b> variable are used
to split the line into words using the same rules the shell
uses for expansion (described above under <b>Word
Splitting</b>). The backslash character (<b>\</b>) removes
any special meaning for the next character read and is used
for line continuation.</p>
<p style="margin-left:18%; margin-top: 1em">Options, if
supplied, have the following meanings: <b><br>
&minus;a</b> <i>aname</i></p>
<p style="margin-left:27%;">The words are assigned to
sequential indices of the array variable <i>aname</i>,
starting at 0. <i>aname</i> is unset before any new values
are assigned. Other <i>name</i> arguments are ignored.</p>
<p style="margin-left:18%;"><b>&minus;d</b>
<i>delim</i></p>
<p style="margin-left:27%;">The first character of
<i>delim</i> terminates the input line, rather than newline.
If <i>delim</i> is the empty string, <b>read</b> will
terminate a line when it reads a NUL character.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;e</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>If the standard input is coming from a terminal,
<b>read</b> uses <b>readline</b> (see
<b><small>READLINE</small></b> above) to obtain the line.
<b>Readline</b> uses the current (or default, if line
editing was not previously active) editing settings, but
uses <b>readline</b>&rsquo;s default filename
completion.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;E</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>If the standard input is coming from a terminal,
<b>read</b> uses <b>readline</b> (see
<b><small>READLINE</small></b> above) to obtain the line.
<b>Readline</b> uses the current (or default, if line
editing was not previously active) editing settings, but
uses bash&rsquo;s default completion, including programmable
completion.</p> </td></tr>
</table>
<p style="margin-left:18%;"><b>&minus;i</b> <i>text</i></p>
<p style="margin-left:27%;">If <b>readline</b> is being
used to read the line, <b>read</b> places <i>text</i> into
the editing buffer before editing begins.</p>
<p style="margin-left:18%;"><b>&minus;n</b>
<i>nchars</i></p>
<p style="margin-left:27%;"><b>read</b> returns after
reading <i>nchars</i> characters rather than waiting for a
complete line of input, unless it encounters EOF or
<b>read</b> times out, but honors a delimiter if it reads
fewer than <i>nchars</i> characters before the
delimiter.</p>
<p style="margin-left:18%;"><b>&minus;N</b>
<i>nchars</i></p>
<p style="margin-left:27%;"><b>read</b> returns after
reading exactly <i>nchars</i> characters rather than waiting
for a complete line of input, unless it encounters EOF or
<b>read</b> times out. Any delimiter characters in the input
are not treated specially and do not cause <b>read</b> to
return until it has read <i>nchars</i> characters. The
result is not split on the characters in <b>IFS</b>; the
intent is that the variable is assigned exactly the
characters read (with the exception of backslash; see the
<b>&minus;r</b> option below).</p>
<p style="margin-left:18%;"><b>&minus;p</b>
<i>prompt</i></p>
<p style="margin-left:27%;">Display <i>prompt</i> on
standard error, without a trailing newline, before
attempting to read any input, but only if input is coming
from a terminal.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;r</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Backslash does not act as an escape character. The
backslash is considered to be part of the line. In
particular, a backslash-newline pair may not then be used as
a line continuation.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;s</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Silent mode. If input is coming from a terminal,
characters are not echoed.</p></td></tr>
</table>
<p style="margin-left:18%;"><b>&minus;t</b>
<i>timeout</i></p>
<p style="margin-left:27%;">Cause <b>read</b> to time out
and return failure if it does not read a complete line of
input (or a specified number of characters) within
<i>timeout</i> seconds. <i>timeout</i> may be a decimal
number with a fractional portion following the decimal
point. This option is only effective if <b>read</b> is
reading input from a terminal, pipe, or other special file;
it has no effect when reading from regular files. If
<b>read</b> times out, it saves any partial input read into
the specified variable <i>name</i>, and the exit status is
greater than 128. If <i>timeout</i> is 0, <b>read</b>
returns immediately, without trying to read any data. In
this case, the exit status is 0 if input is available on the
specified file descriptor, or the read will return EOF,
non-zero otherwise.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="6%">
<p><b>&minus;u</b> <i>fd</i></p></td>
<td width="3%"></td>
<td width="73%">
<p>Read input from file descriptor <i>fd</i> instead of the
standard input.</p></td></tr>
</table>
<p style="margin-left:18%; margin-top: 1em">Other than the
case where <i>delim</i> is the empty string, <b>read</b>
ignores any NUL characters in the input.</p>
<p style="margin-left:18%; margin-top: 1em">If no
<i>names</i> are supplied, <b>read</b> assigns the line
read, without the ending delimiter but otherwise unmodified,
to the variable
<b><small>REPLY</small></b><small>.</small></p>
<p style="margin-left:18%; margin-top: 1em">The exit status
is zero, unless end-of-file is encountered, <b>read</b>
times out (in which case the status is greater than 128), a
variable assignment error (such as assigning to a readonly
variable) occurs, or an invalid file descriptor is supplied
as the argument to <b>&minus;u</b>.</p>
<p style="margin-left:9%;"><b>readonly</b>
[<b>&minus;aAf</b>] [<b>&minus;p</b>]
[<i>name</i>[=<i>word</i>] ...]</p>
<p style="margin-left:18%;">The given <i>names</i> are
marked readonly; the values of these <i>names</i> may not be
changed by subsequent assignment or unset. If the
<b>&minus;f</b> option is supplied, each <i>name</i> refers
to a shell function. The <b>&minus;a</b> option restricts
the variables to indexed arrays; the <b>&minus;A</b> option
restricts the variables to associative arrays. If both
options are supplied, <b>&minus;A</b> takes precedence. If
no <i>name</i> arguments are supplied, or if the
<b>&minus;p</b> option is supplied, print a list of all
readonly names. The other options may be used to restrict
the output to a subset of the set of readonly names. The
<b>&minus;p</b> option displays output in a format that may
be reused as input.</p>
<p style="margin-left:18%; margin-top: 1em"><b>readonly</b>
allows the value of a variable to be set at the same time
the readonly attribute is changed by following the variable
name with =<i>value</i>. This sets the value of the variable
is to <i>value</i> while modifying the readonly
attribute.</p>
<p style="margin-left:18%; margin-top: 1em">The return
status is 0 unless an invalid option is encountered, one of
the <i>names</i> is not a valid shell variable name, or
<b>&minus;f</b> is supplied with a <i>name</i> that is not a
function.</p>
<p style="margin-left:9%;"><b>return</b> [<i>n</i>]</p>
<p style="margin-left:18%;">Stop executing a shell function
or sourced file and return the value specified by <i>n</i>
to its caller. If <i>n</i> is omitted, the return status is
that of the last command executed. If <b>return</b> is
executed by a trap handler, the last command used to
determine the status is the last command executed before the
trap handler. If <b>return</b> is executed during a
<b>DEBUG</b> trap, the last command used to determine the
status is the last command executed by the trap handler
before <b>return</b> was invoked.</p>
<p style="margin-left:18%; margin-top: 1em">When
<b>return</b> is used to terminate execution of a script
being executed by the <b>.</b> (<b>source</b>) command, it
causes the shell to stop executing that script and return
either <i>n</i> or the exit status of the last command
executed within the script as the exit status of the script.
If <i>n</i> is supplied, the return value is its least
significant 8 bits.</p>
<p style="margin-left:18%; margin-top: 1em">Any command
associated with the <b>RETURN</b> trap is executed before
execution resumes after the function or script.</p>
<p style="margin-left:18%; margin-top: 1em">The return
status is non-zero if <b>return</b> is supplied a
non-numeric argument, or is used outside a function and not
during execution of a script by <b>.</b> or
<b>source</b>.</p>
<p style="margin-left:9%;"><b>set</b>
[<b>&minus;abefhkmnptuvxBCEHPT</b>] [<b>&minus;o</b>
<i>option&minus;name</i>] [<b>&minus;&minus;</b>]
[<b>&minus;</b>] [<i>arg</i> ...] <b><br>
set</b> [<b>+abefhkmnptuvxBCEHPT</b>] [<b>+o</b>
<i>option&minus;name</i>] [<b>&minus;&minus;</b>]
[<b>&minus;</b>] [<i>arg</i> ...]</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>set &minus;o</b></p></td>
<td width="1%"></td>
<td width="82%">
</td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="8%">
<p><b>set +o</b></p></td>
<td width="1%"></td>
<td width="82%">
<p>Without options, display the name and value of each
shell variable in a format that can be reused as input for
setting or resetting the currently-set variables. Read-only
variables cannot be reset. In posix mode, only shell
variables are listed. The output is sorted according to the
current locale. When options are specified, they set or
unset shell attributes. Any arguments remaining after option
processing are treated as values for the positional
parameters and are assigned, in order, to <b>$1</b>,
<b>$2</b>, ..., <b>$</b><i>n</i>. Options, if specified,
have the following meanings:</p></td></tr>
</table>
<p style="margin-left:18%;"><b>&minus;a</b></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%"></td>
<td width="7%"></td>
<td width="72%">
<p style="margin-top: 1em">Each variable or function that
is created or modified is given the export attribute and
marked for export to the environment of subsequent
commands.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;b</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>Report the status of terminated background jobs
immediately, rather than before the next primary prompt or
after a foreground command terminates. This is effective
only when job control is enabled.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;e</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>Exit immediately if a <i>pipeline</i> (which may consist
of a single <i>simple command</i>), a <i>list</i>, or a
<i>compound command</i> (see <b><small>SHELL
GRAMMAR</small></b> above), exits with a non-zero status.
The shell does not exit if the command that fails is part of
the command list immediately following a <b>while</b> or
<b>until</b> reserved word, part of the test following the
<b>if</b> or <b>elif</b> reserved words, part of any command
executed in a <b>&amp;&amp;</b> or <b>||</b> list except the
command following the final <b>&amp;&amp;</b> or <b>||</b>,
any command in a pipeline but the last (subject to the state
of the <b>pipefail</b> shell option), or if the
command&rsquo;s return value is being inverted with
<b>!</b>. If a compound command other than a subshell
returns a non-zero status because a command failed while
<b>&minus;e</b> was being ignored, the shell does not exit.
A trap on <b>ERR</b>, if set, is executed before the shell
exits. This option applies to the shell environment and each
subshell environment separately (see <b><small>COMMAND
EXECUTION ENVIRONMENT</small></b> above), and may cause
subshells to exit before executing all the commands in the
subshell.</p> </td></tr>
</table>
<p style="margin-left:28%; margin-top: 1em">If a compound
command or shell function executes in a context where
<b>&minus;e</b> is being ignored, none of the commands
executed within the compound command or function body will
be affected by the <b>&minus;e</b> setting, even if
<b>&minus;e</b> is set and a command returns a failure
status. If a compound command or shell function sets
<b>&minus;e</b> while executing in a context where
<b>&minus;e</b> is ignored, that setting will not have any
effect until the compound command or the command containing
the function call completes.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p style="margin-top: 1em"><b>&minus;f</b></p></td>
<td width="7%"></td>
<td width="72%">
<p style="margin-top: 1em">Disable pathname expansion.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;h</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>Remember the location of commands as they are looked up
for execution. This is enabled by default.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;k</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>All arguments in the form of assignment statements are
placed in the environment for a command, not just those that
precede the command name.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;m</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>Monitor mode. Job control is enabled. This option is on
by default for interactive shells on systems that support it
(see <b><small>JOB CONTROL</small></b> above). All processes
run in a separate process group. When a background job
completes, the shell prints a line containing its exit
status.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;n</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>Read commands but do not execute them. This may be used
to check a shell script for syntax errors. This is ignored
by interactive shells.</p></td></tr>
</table>
<p style="margin-left:18%;"><b>&minus;o</b>
<i>option&minus;name</i></p>
<p style="margin-left:28%;">The <i>option&minus;name</i>
can be one of the following: <b><br>
allexport</b></p>
<p style="margin-left:38%;">Same as <b>&minus;a</b>.</p>
<p style="margin-left:28%;"><b>braceexpand</b></p>
<p style="margin-left:38%;">Same as <b>&minus;B</b>.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>emacs</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Use an emacs-style command line editing interface. This
is enabled by default when the shell is interactive, unless
the shell is started with the <b>&minus;&minus;noediting</b>
option. This also affects the editing interface used for
<b>read &minus;e</b>.</p></td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>errexit</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Same as <b>&minus;e</b>.</p></td></tr>
</table>
<p style="margin-left:28%;"><b>errtrace</b></p>
<p style="margin-left:38%;">Same as <b>&minus;E</b>.</p>
<p style="margin-left:28%;"><b>functrace</b></p>
<p style="margin-left:38%;">Same as <b>&minus;T</b>.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>hashall</b></p></td>
<td width="1%"></td>
<td width="15%">
<p>Same as <b>&minus;h</b>.</p></td>
<td width="47%">
</td></tr>
</table>
<p style="margin-left:28%;"><b>histexpand</b></p>
<p style="margin-left:38%;">Same as <b>&minus;H</b>.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>history</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Enable command history, as described above under
<b><small>HISTORY</small></b><small>.</small> This option is
on by default in interactive shells.</p></td></tr>
</table>
<p style="margin-left:28%;"><b>ignoreeof</b></p>
<p style="margin-left:38%;">The effect is as if the shell
command &ldquo;IGNOREEOF=10&rdquo; had been executed (see
<b>Shell Variables</b> above).</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>keyword</b></p></td>
<td width="1%"></td>
<td width="15%">
<p>Same as <b>&minus;k</b>.</p></td>
<td width="47%">
</td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>monitor</b></p></td>
<td width="1%"></td>
<td width="15%">
<p>Same as <b>&minus;m</b>.</p></td>
<td width="47%">
</td></tr>
</table>
<p style="margin-left:28%;"><b>noclobber</b></p>
<p style="margin-left:38%;">Same as <b>&minus;C</b>.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>noexec</b></p></td>
<td width="1%"></td>
<td width="24%">
<p>Same as <b>&minus;n</b>.</p></td>
<td width="38%">
</td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>noglob</b></p></td>
<td width="1%"></td>
<td width="24%">
<p>Same as <b>&minus;f</b>.</p></td>
<td width="38%">
</td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>nolog</b></p></td>
<td width="1%"></td>
<td width="24%">
<p>Currently ignored.</p></td>
<td width="38%">
</td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>notify</b></p></td>
<td width="1%"></td>
<td width="24%">
<p>Same as <b>&minus;b</b>.</p></td>
<td width="38%">
</td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>nounset</b></p></td>
<td width="1%"></td>
<td width="24%">
<p>Same as <b>&minus;u</b>.</p></td>
<td width="38%">
</td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>onecmd</b></p></td>
<td width="1%"></td>
<td width="24%">
<p>Same as <b>&minus;t</b>.</p></td>
<td width="38%">
</td></tr>
</table>
<p style="margin-left:28%;"><b>physical</b></p>
<p style="margin-left:38%;">Same as <b>&minus;P</b>.</p>
<p style="margin-left:28%;"><b>pipefail</b></p>
<p style="margin-left:38%;">If set, the return value of a
pipeline is the value of the last (rightmost) command to
exit with a non-zero status, or zero if all commands in the
pipeline exit successfully. This option is disabled by
default.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="28%"></td>
<td width="7%">
<p><b>posix</b></p></td>
<td width="3%"></td>
<td width="62%">
<p>Enable posix mode; change the behavior of <b>bash</b>
where the default operation differs from the
<small>POSIX</small> standard to match the standard. See
<b><small>SEE ALSO</small></b> below for a reference to a
document that details how posix mode affects bash&rsquo;s
behavior.</p> </td></tr>
</table>
<p style="margin-left:28%;"><b>privileged</b></p>
<p style="margin-left:38%;">Same as <b>&minus;p</b>.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>verbose</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Same as <b>&minus;v</b>.</p></td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>vi</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Use a vi-style command line editing interface. This also
affects the editing interface used for <b>read
&minus;e</b>.</p> </td></tr>
<tr valign="top" align="left">
<td width="28%"></td>
<td width="9%">
<p><b>xtrace</b></p></td>
<td width="1%"></td>
<td width="62%">
<p>Same as <b>&minus;x</b>.</p></td></tr>
</table>
<p style="margin-left:28%;">If <b>&minus;o</b> is supplied
with no <i>option&minus;name</i>, <b>set</b> prints the
current shell option settings. If <b>+o</b> is supplied with
no <i>option&minus;name</i>, <b>set</b> prints a series of
<b>set</b> commands to recreate the current option settings
on the standard output.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p style="margin-top: 1em"><b>&minus;p</b></p></td>
<td width="7%"></td>
<td width="72%">
<p style="margin-top: 1em">Turn on <i>privileged</i> mode.
In this mode, the shell does not read the
<b><small>$ENV</small></b> and
<b><small>$BASH_ENV</small></b> files, shell functions are
not inherited from the environment, and the
<b><small>SHELLOPTS</small></b><small>, <b>BASHOPTS</b>,
<b>CDPATH</b>,</small> and <b><small>GLOBIGNORE</small></b>
variables, if they appear in the environment, are ignored.
If the shell is started with the effective user (group) id
not equal to the real user (group) id, and the
<b>&minus;p</b> option is not supplied, these actions are
taken and the effective user id is set to the real user id.
If the <b>&minus;p</b> option is supplied at startup, the
effective user id is not reset. Turning this option off
causes the effective user and group ids to be set to the
real user and group ids.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;r</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>Enable restricted shell mode. This option cannot be
unset once it has been set.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;t</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>Exit after reading and executing one command.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;u</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>Treat unset variables and parameters other than the
special parameters &ldquo;@&rdquo; and &ldquo;*&rdquo;, or
array variables subscripted with &ldquo;@&rdquo; or
&ldquo;*&rdquo;, as an error when performing parameter
expansion. If expansion is attempted on an unset variable or
parameter, the shell prints an error message, and, if not
interactive, exits with a non-zero status.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;v</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>Print shell input lines as they are read.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;x</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>After expanding each <i>simple command</i>, <b>for</b>
command, <b>case</b> command, <b>select</b> command, or
arithmetic <b>for</b> command, display the expanded value of
<b><small>PS4</small></b><small>,</small> followed by the
command and its expanded arguments or associated word list,
to the standard error.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;B</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>The shell performs brace expansion (see <b>Brace
Expansion</b> above). This is on by default.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;C</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>If set, <b>bash</b> does not overwrite an existing file
with the <b>&gt;</b>, <b>&gt;&amp;</b>, and <b>&lt;&gt;</b>
redirection operators. Using the redirection operator
<b>&gt;|</b> instead of <b>&gt;</b> will override this and
force the creation of an output file.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;E</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>If set, any trap on <b>ERR</b> is inherited by shell
functions, command substitutions, and commands executed in a
subshell environment. The <b>ERR</b> trap is normally not
inherited in such cases.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;H</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>Enable <b>!</b> style history substitution. This option
is on by default when the shell is interactive.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;P</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>If set, the shell does not resolve symbolic links when
executing commands such as <b>cd</b> that change the current
working directory. It uses the physical directory structure
instead. By default, <b>bash</b> follows the logical chain
of directories when performing commands which change the
current directory.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;T</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>If set, any traps on <b>DEBUG</b> and <b>RETURN</b> are
inherited by shell functions, command substitutions, and
commands executed in a subshell environment. The
<b>DEBUG</b> and <b>RETURN</b> traps are normally not
inherited in such cases.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;&minus;</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>If no arguments follow this option, unset the positional
parameters. Otherwise, set the positional parameters to the
<i>arg</i>s, even if some of them begin with a
<b>&minus;</b>.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;</b></p></td>
<td width="7%"></td>
<td width="72%">
<p>Signal the end of options, and assign all remaining
<i>arg</i>s to the positional parameters. The
<b>&minus;x</b> and <b>&minus;v</b> options are turned off.
If there are no <i>arg</i>s, the positional parameters
remain unchanged.</p></td></tr>
</table>
<p style="margin-left:18%; margin-top: 1em">The options are
off by default unless otherwise noted. Using + rather than
&minus; causes these options to be turned off. The options
can also be specified as arguments to an invocation of the
shell. The current set of options may be found in
<b>$&minus;</b>. The return status is always zero unless an
invalid option is encountered.</p>
<p style="margin-left:9%;"><b>shift</b> [<i>n</i>]</p>
<p style="margin-left:18%;">Rename positional parameters
from <i>n</i>+1 ... to <b>$1 ....</b> Parameters represented
by the numbers <b>$#</b> down to <b>$#</b>&minus;<i>n</i>+1
are unset. <i>n</i> must be a non-negative number less than
or equal to <b>$#</b>. If <i>n</i> is 0, no parameters are
changed. If <i>n</i> is not given, it is assumed to be 1. If
<i>n</i> is greater than <b>$#</b>, the positional
parameters are not changed. The return status is greater
than zero if <i>n</i> is greater than <b>$#</b> or less than
zero; otherwise 0.</p>
<p style="margin-left:9%;"><b>shopt</b>
[<b>&minus;pqsu</b>] [<b>&minus;o</b>] [<i>optname</i>
...]</p>
<p style="margin-left:18%;">Toggle the values of settings
controlling optional shell behavior. The settings can be
either those listed below, or, if the <b>&minus;o</b> option
is used, those available with the <b>&minus;o</b> option to
the <b>set</b> builtin command.</p>
<p style="margin-left:18%; margin-top: 1em">With no
options, or with the <b>&minus;p</b> option, display a list
of all settable options, with an indication of whether or
not each is set; if any <i>optnames</i> are supplied, the
output is restricted to those options. The <b>&minus;p</b>
option displays output in a form that may be reused as
input.</p>
<p style="margin-left:18%; margin-top: 1em">Other options
have the following meanings:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;s</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Enable (set) each <i>optname</i>.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;u</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Disable (unset) each <i>optname</i>.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;q</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Suppresses normal output (quiet mode); the return status
indicates whether the <i>optname</i> is set or unset. If
multiple <i>optname</i> arguments are supplied with
<b>&minus;q</b>, the return status is zero if all
<i>optnames</i> are enabled; non-zero otherwise.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;o</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Restricts the values of <i>optname</i> to be those
defined for the <b>&minus;o</b> option to the <b>set</b>
builtin.</p> </td></tr>
</table>
<p style="margin-left:18%; margin-top: 1em">If either
<b>&minus;s</b> or <b>&minus;u</b> is used with no
<i>optname</i> arguments, <b>shopt</b> shows only those
options which are set or unset, respectively. Unless
otherwise noted, the <b>shopt</b> options are disabled
(unset) by default.</p>
<p style="margin-left:18%; margin-top: 1em">The return
status when listing options is zero if all <i>optnames</i>
are enabled, non-zero otherwise. When setting or unsetting
options, the return status is zero unless an <i>optname</i>
is not a valid shell option.</p>
<p style="margin-left:18%; margin-top: 1em">The list of
<b>shopt</b> options is: <b><br>
array_expand_once</b></p>
<p style="margin-left:28%;">If set, the shell suppresses
multiple evaluation of associative and indexed array
subscripts during arithmetic expression evaluation, while
executing builtins that can perform variable assignments,
and while executing builtins that perform array
dereferencing.</p>
<p style="margin-left:18%;"><b>assoc_expand_once</b></p>
<p style="margin-left:28%;">Deprecated; a synonym for
<b>array_expand_once</b>.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>autocd</b></p></td>
<td width="2%"></td>
<td width="72%">
<p>If set, a command name that is the name of a directory
is executed as if it were the argument to the <b>cd</b>
command. This option is only used by interactive shells.</p></td></tr>
</table>
<p style="margin-left:18%;"><b>bash_source_fullpath</b></p>
<p style="margin-left:28%;">If set, filenames added to the
<b>BASH_SOURCE</b> array variable are converted to full
pathnames (see <b>Shell Variables</b> above).</p>
<p style="margin-left:18%;"><b>cdable_vars</b></p>
<p style="margin-left:28%;">If set, an argument to the
<b>cd</b> builtin command that is not a directory is assumed
to be the name of a variable whose value is the directory to
change to.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="9%">
<p><b>cdspell</b></p></td>
<td width="1%"></td>
<td width="72%">
<p>If set, the <b>cd</b> command attempts to correct minor
errors in the spelling of a directory component. Minor
errors include transposed characters, a missing character,
and one extra character. If <b>cd</b> corrects the directory
name, it prints the corrected filename, and the command
proceeds. This option is only used by interactive
shells.</p> </td></tr>
</table>
<p style="margin-left:18%;"><b>checkhash</b></p>
<p style="margin-left:28%;">If set, <b>bash</b> checks that
a command found in the hash table exists before trying to
execute it. If a hashed command no longer exists,
<b>bash</b> performs a normal path search.</p>
<p style="margin-left:18%;"><b>checkjobs</b></p>
<p style="margin-left:28%;">If set, <b>bash</b> lists the
status of any stopped and running jobs before exiting an
interactive shell. If any jobs are running, <b>bash</b>
defers the exit until a second exit is attempted without an
intervening command (see <b><small>JOB CONTROL</small></b>
above). The shell always postpones exiting if any jobs are
stopped.</p>
<p style="margin-left:18%;"><b>checkwinsize</b></p>
<p style="margin-left:28%;">If set, <b>bash</b> checks the
window size after each external (non-builtin) command and,
if necessary, updates the values of
<b><small>LINES</small></b> and
<b><small>COLUMNS</small></b><small>,</small> using the file
descriptor associated with the standard error if it is a
terminal. This option is enabled by default.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="9%">
<p><b>cmdhist</b></p></td>
<td width="1%"></td>
<td width="72%">
<p>If set, <b>bash</b> attempts to save all lines of a
multiple-line command in the same history entry. This allows
easy re-editing of multi-line commands. This option is
enabled by default, but only has an effect if command
history is enabled, as described above under
<b><small>HISTORY</small></b><small>.</small></p> </td></tr>
</table>
<p style="margin-left:18%;"><b>compat31 <br>
compat32 <br>
compat40 <br>
compat41 <br>
compat42 <br>
compat43 <br>
compat44</b></p>
<p style="margin-left:28%;">These control aspects of the
shell&rsquo;s compatibility mode (see <b><small>SHELL
COMPATIBILITY MODE</small></b> below).</p>
<p style="margin-left:18%;"><b>complete_fullquote</b></p>
<p style="margin-left:28%;">If set, <b>bash</b> quotes all
shell metacharacters in filenames and directory names when
performing completion. If not set, <b>bash</b> removes
metacharacters such as the dollar sign from the set of
characters that will be quoted in completed filenames when
these metacharacters appear in shell variable references in
words to be completed. This means that dollar signs in
variable names that expand to directories will not be
quoted; however, any dollar signs appearing in filenames
will not be quoted, either. This is active only when bash is
using backslashes to quote completed filenames. This
variable is set by default, which is the default bash
behavior in versions through 4.2.</p>
<p style="margin-left:18%;"><b>direxpand</b></p>
<p style="margin-left:28%;">If set, <b>bash</b> replaces
directory names with the results of word expansion when
performing filename completion. This changes the contents of
the <b>readline</b> editing buffer. If not set, <b>bash</b>
attempts to preserve what the user typed.</p>
<p style="margin-left:18%;"><b>dirspell</b></p>
<p style="margin-left:28%;">If set, <b>bash</b> attempts
spelling correction on directory names during word
completion if the directory name initially supplied does not
exist.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="9%">
<p><b>dotglob</b></p></td>
<td width="1%"></td>
<td width="72%">
<p>If set, <b>bash</b> includes filenames beginning with a
&ldquo;.&rdquo; in the results of pathname expansion. The
filenames <i>.</i> and <i>..</i> must always be matched
explicitly, even if <b>dotglob</b> is set.</p></td></tr>
</table>
<p style="margin-left:18%;"><b>execfail</b></p>
<p style="margin-left:28%;">If set, a non-interactive shell
will not exit if it cannot execute the file specified as an
argument to the <b>exec</b> builtin. An interactive shell
does not exit if <b>exec</b> fails.</p>
<p style="margin-left:18%;"><b>expand_aliases</b></p>
<p style="margin-left:28%;">If set, aliases are expanded as
described above under
<b><small>ALIASES</small></b><small>.</small> This option is
enabled by default for interactive shells.</p>
<p style="margin-left:18%;"><b>extdebug</b></p>
<p style="margin-left:28%;">If set at shell invocation, or
in a shell startup file, arrange to execute the debugger
profile before the shell starts, identical to the
<b>&minus;&minus;debugger</b> option. If set after
invocation, behavior intended for use by debuggers is
enabled:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="13%">
<p><b>1.</b></p></td>
<td width="6%"></td>
<td width="63%">
<p>The <b>&minus;F</b> option to the <b>declare</b> builtin
displays the source file name and line number corresponding
to each function name supplied as an argument.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="13%">
<p><b>2.</b></p></td>
<td width="6%"></td>
<td width="63%">
<p>If the command run by the <b>DEBUG</b> trap returns a
non-zero value, the next command is skipped and not
executed.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="13%">
<p><b>3.</b></p></td>
<td width="6%"></td>
<td width="63%">
<p>If the command run by the <b>DEBUG</b> trap returns a
value of 2, and the shell is executing in a subroutine (a
shell function or a shell script executed by the <b>.</b> or
<b>source</b> builtins), the shell simulates a call to
<b>return</b>.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="13%">
<p><b>4.</b></p></td>
<td width="6%"></td>
<td width="63%">
<p><b><small>BASH_ARGC</small></b> and
<b><small>BASH_ARGV</small></b> are updated as described in
their descriptions above).</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="13%">
<p><b>5.</b></p></td>
<td width="6%"></td>
<td width="63%">
<p>Function tracing is enabled: command substitution, shell
functions, and subshells invoked with <b>(</b>
<i>command</i> <b>)</b> inherit the <b>DEBUG</b> and
<b>RETURN</b> traps.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="13%">
<p><b>6.</b></p></td>
<td width="6%"></td>
<td width="63%">
<p>Error tracing is enabled: command substitution, shell
functions, and subshells invoked with <b>(</b>
<i>command</i> <b>)</b> inherit the <b>ERR</b> trap.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="13%">
<p><b>extglob</b></p></td>
<td width="6%"></td>
<td width="63%">
</td></tr>
</table>
<p style="margin-left:28%; margin-top: 1em">If set, enable
the extended pattern matching features described above under
<b>Pathname Expansion</b>.</p>
<p style="margin-left:18%;"><b>extquote</b></p>
<p style="margin-left:28%;">If set, <b>$</b>'<i>string</i>'
and <b>$</b>&quot;<i>string</i>&quot; quoting is performed
within <b>${</b><i>parameter</i><b>}</b> expansions enclosed
in double quotes. This option is enabled by default.</p>
<p style="margin-left:18%;"><b>failglob</b></p>
<p style="margin-left:28%;">If set, patterns which fail to
match filenames during pathname expansion result in an
expansion error.</p>
<p style="margin-left:18%;"><b>force_fignore</b></p>
<p style="margin-left:28%;">If set, the suffixes specified
by the <b><small>FIGNORE</small></b> shell variable cause
words to be ignored when performing word completion even if
the ignored words are the only possible completions. See
<b>Shell Variables</b> above for a description of
<b><small>FIGNORE</small></b><small>.</small> This option is
enabled by default.</p>
<p style="margin-left:18%;"><b>globasciiranges</b></p>
<p style="margin-left:28%;">If set, range expressions used
in pattern matching bracket expressions (see
<b><small>Pattern Matching</small></b> above) behave as if
in the traditional C locale when performing comparisons.
That is, pattern matching does not take the current
locale&rsquo;s collating sequence into account, so <b>b</b>
will not collate between <b>A</b> and <b>B</b>, and
upper-case and lower-case ASCII characters will collate
together.</p>
<p style="margin-left:18%;"><b>globskipdots</b></p>
<p style="margin-left:28%;">If set, pathname expansion will
never match the filenames <i>.</i> and <i>..</i>, even if
the pattern begins with a &ldquo;.&rdquo;. This option is
enabled by default.</p>
<p style="margin-left:18%;"><b>globstar</b></p>
<p style="margin-left:28%;">If set, the pattern <b>**</b>
used in a pathname expansion context will match all files
and zero or more directories and subdirectories. If the
pattern is followed by a <b>/</b>, only directories and
subdirectories match.</p>
<p style="margin-left:18%;"><b>gnu_errfmt</b></p>
<p style="margin-left:28%;">If set, shell error messages
are written in the standard GNU error message format.</p>
<p style="margin-left:18%;"><b>histappend</b></p>
<p style="margin-left:28%;">If set, the history list is
appended to the file named by the value of the
<b><small>HISTFILE</small></b> variable when the shell
exits, rather than overwriting the file.</p>
<p style="margin-left:18%;"><b>histreedit</b></p>
<p style="margin-left:28%;">If set, and <b>readline</b> is
being used, the user is given the opportunity to re-edit a
failed history substitution.</p>
<p style="margin-left:18%;"><b>histverify</b></p>
<p style="margin-left:28%;">If set, and <b>readline</b> is
being used, the results of history substitution are not
immediately passed to the shell parser. Instead, the
resulting line is loaded into the <b>readline</b> editing
buffer, allowing further modification.</p>
<p style="margin-left:18%;"><b>hostcomplete</b></p>
<p style="margin-left:28%;">If set, and <b>readline</b> is
being used, <b>bash</b> will attempt to perform hostname
completion when a word containing a <b>@</b> is being
completed (see <b>Completing</b> under
<b><small>READLINE</small></b> above). This is enabled by
default.</p>
<p style="margin-left:18%;"><b>huponexit</b></p>
<p style="margin-left:28%;">If set, <b>bash</b> will send
<b><small>SIGHUP</small></b> to all jobs when an interactive
login shell exits.</p>
<p style="margin-left:18%;"><b>inherit_errexit</b></p>
<p style="margin-left:28%;">If set, command substitution
inherits the value of the <b>errexit</b> option, instead of
unsetting it in the subshell environment. This option is
enabled when posix mode is enabled.</p>
<p style="margin-left:18%;"><b>interactive_comments</b></p>
<p style="margin-left:28%;">In an interactive shell, a word
beginning with <b>#</b> causes that word and all remaining
characters on that line to be ignored, as in a
non-interactive shell (see <b><small>COMMENTS</small></b>
above). This option is enabled by default.</p>
<p style="margin-left:18%;"><b>lastpipe</b></p>
<p style="margin-left:28%;">If set, and job control is not
active, the shell runs the last command of a pipeline not
executed in the background in the current shell
environment.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="9%">
<p><b>lithist</b></p></td>
<td width="1%"></td>
<td width="72%">
<p>If set, and the <b>cmdhist</b> option is enabled,
multi-line commands are saved to the history with embedded
newlines rather than using semicolon separators where
possible.</p> </td></tr>
</table>
<p style="margin-left:18%;"><b>localvar_inherit</b></p>
<p style="margin-left:28%;">If set, local variables inherit
the value and attributes of a variable of the same name that
exists at a previous scope before any new value is assigned.
The nameref attribute is not inherited.</p>
<p style="margin-left:18%;"><b>localvar_unset</b></p>
<p style="margin-left:28%;">If set, calling <b>unset</b> on
local variables in previous function scopes marks them so
subsequent lookups find them unset until that function
returns. This is identical to the behavior of unsetting
local variables at the current function scope.</p>
<p style="margin-left:18%;"><b>login_shell</b></p>
<p style="margin-left:28%;">The shell sets this option if
it is started as a login shell (see
<b><small>INVOCATION</small></b> above). The value may not
be changed.</p>
<p style="margin-left:18%;"><b>mailwarn</b></p>
<p style="margin-left:28%;">If set, and a file that
<b>bash</b> is checking for mail has been accessed since the
last time it was checked, <b>bash</b> displays the message
&ldquo;The mail in <i>mailfile</i> has been read&rdquo;.</p>
<p style="margin-left:18%;"><b>no_empty_cmd_completion</b></p>
<p style="margin-left:28%;">If set, and <b>readline</b> is
being used, <b>bash</b> does not search
<b><small>PATH</small></b> for possible completions when
completion is attempted on an empty line.</p>
<p style="margin-left:18%;"><b>nocaseglob</b></p>
<p style="margin-left:28%;">If set, <b>bash</b> matches
filenames in a case&minus;insensitive fashion when
performing pathname expansion (see <b>Pathname Expansion</b>
above).</p>
<p style="margin-left:18%;"><b>nocasematch</b></p>
<p style="margin-left:28%;">If set, <b>bash</b> matches
patterns in a case&minus;insensitive fashion when performing
matching while executing <b>case</b> or <b>[[</b>
conditional commands, when performing pattern substitution
word expansions, or when filtering possible completions as
part of programmable completion.</p>
<p style="margin-left:18%;"><b>noexpand_translation</b></p>
<p style="margin-left:28%;">If set, <b>bash</b> encloses
the translated results of <b>$&quot;</b>...<b>&quot;</b>
quoting in single quotes instead of double quotes. If the
string is not translated, this has no effect.</p>
<p style="margin-left:18%;"><b>nullglob</b></p>
<p style="margin-left:28%;">If set, pathname expansion
patterns which match no files (see <b>Pathname Expansion</b>
above) expand to nothing and are removed, rather than
expanding to themselves.</p>
<p style="margin-left:18%;"><b>patsub_replacement</b></p>
<p style="margin-left:28%;">If set, <b>bash</b> expands
occurrences of <b>&amp;</b> in the replacement string of
pattern substitution to the text matched by the pattern, as
described under <b>Parameter Expansion</b> above. This
option is enabled by default.</p>
<p style="margin-left:18%;"><b>progcomp</b></p>
<p style="margin-left:28%;">If set, enable the programmable
completion facilities (see <b>Programmable Completion</b>
above). This option is enabled by default.</p>
<p style="margin-left:18%;"><b>progcomp_alias</b></p>
<p style="margin-left:28%;">If set, and programmable
completion is enabled, <b>bash</b> treats a command name
that doesn&rsquo;t have any completions as a possible alias
and attempts alias expansion. If it has an alias,
<b>bash</b> attempts programmable completion using the
command word resulting from the expanded alias.</p>
<p style="margin-left:18%;"><b>promptvars</b></p>
<p style="margin-left:28%;">If set, prompt strings undergo
parameter expansion, command substitution, arithmetic
expansion, and quote removal after being expanded as
described in <b><small>PROMPTING</small></b> above. This
option is enabled by default.</p>
<p style="margin-left:18%;"><b>restricted_shell</b></p>
<p style="margin-left:28%;">The shell sets this option if
it is started in restricted mode (see <b><small>RESTRICTED
SHELL</small></b> below). The value may not be changed. This
is not reset when the startup files are executed, allowing
the startup files to discover whether or not a shell is
restricted.</p>
<p style="margin-left:18%;"><b>shift_verbose</b></p>
<p style="margin-left:28%;">If set, the <b>shift</b>
builtin prints an error message when the shift count exceeds
the number of positional parameters.</p>
<p style="margin-left:18%;"><b>sourcepath</b></p>
<p style="margin-left:28%;">If set, the <b>.</b>
(<b>source</b>) builtin uses the value of
<b><small>PATH</small></b> to find the directory containing
the file supplied as an argument when the <b>&minus;p</b>
option is not supplied. This option is enabled by
default.</p>
<p style="margin-left:18%;"><b>varredir_close</b></p>
<p style="margin-left:28%;">If set, the shell automatically
closes file descriptors assigned using the <i>{varname}</i>
redirection syntax (see <b><small>REDIRECTION</small></b>
above) instead of leaving them open when the command
completes.</p>
<p style="margin-left:18%;"><b>xpg_echo</b></p>
<p style="margin-left:28%;">If set, the <b>echo</b> builtin
expands backslash-escape sequences by default. If the
<b>posix</b> shell option is also enabled, <b>echo</b> does
not interpret any options.</p>
<p style="margin-left:9%;"><b>suspend</b>
[<b>&minus;f</b>]</p>
<p style="margin-left:18%;">Suspend the execution of this
shell until it receives a <b><small>SIGCONT</small></b>
signal. A login shell, or a shell without job control
enabled, cannot be suspended; the <b>&minus;f</b> option
will override this and force the suspension. The return
status is 0 unless the shell is a login shell or job control
is not enabled and <b>&minus;f</b> is not supplied.</p>
<p style="margin-left:9%;"><b>test</b> <i>expr</i> <b><br>
[</b> <i>expr</i> <b>]</b></p>
<p style="margin-left:18%;">Return a status of 0 (true) or
1 (false) depending on the evaluation of the conditional
expression <i>expr</i>. Each operator and operand must be a
separate argument. Expressions are composed of the primaries
described above under <b><small>CONDITIONAL
EXPRESSIONS</small></b><small>.</small> <b>test</b> does not
accept any options, nor does it accept and ignore an
argument of <b>&minus;&minus;</b> as signifying the end of
options.</p>
<p style="margin-left:18%; margin-top: 1em">Expressions may
be combined using the following operators, listed in
decreasing order of precedence. The evaluation depends on
the number of arguments; see below. <b>test</b> uses
operator precedence when there are five or more
arguments.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="8%">
<p><b>!</b> <i>expr</i></p></td>
<td width="1%"></td>
<td width="28%">
<p>True if <i>expr</i> is false.</p></td>
<td width="45%">
</td></tr>
</table>
<p style="margin-left:18%;"><b>(</b> <i>expr</i>
<b>)</b></p>
<p style="margin-left:27%;">Returns the value of
<i>expr</i>. This may be used to override normal operator
precedence.</p>
<p style="margin-left:18%;"><i>expr1</i> &minus;<b>a</b>
<i>expr2</i></p>
<p style="margin-left:27%;">True if both <i>expr1</i> and
<i>expr2</i> are true.</p>
<p style="margin-left:18%;"><i>expr1</i> &minus;<b>o</b>
<i>expr2</i></p>
<p style="margin-left:27%;">True if either <i>expr1</i> or
<i>expr2</i> is true.</p>
<p style="margin-left:18%; margin-top: 1em"><b>test</b> and
<b>[</b> evaluate conditional expressions using a set of
rules based on the number of arguments. <br>
0 arguments</p>
<p style="margin-left:27%;">The expression is false.</p>
<p style="margin-left:18%;">1 argument</p>
<p style="margin-left:27%;">The expression is true if and
only if the argument is not null.</p>
<p style="margin-left:18%;">2 arguments</p>
<p style="margin-left:27%;">If the first argument is
<b>!</b>, the expression is true if and only if the second
argument is null. If the first argument is one of the unary
conditional operators listed above under
<b><small>CONDITIONAL
EXPRESSIONS</small></b><small>,</small> the expression is
true if the unary test is true. If the first argument is not
a valid unary conditional operator, the expression is
false.</p>
<p style="margin-left:18%;">3 arguments</p>
<p style="margin-left:27%;">The following conditions are
applied in the order listed. If the second argument is one
of the binary conditional operators listed above under
<b><small>CONDITIONAL
EXPRESSIONS</small></b><small>,</small> the result of the
expression is the result of the binary test using the first
and third arguments as operands. The <b>&minus;a</b> and
<b>&minus;o</b> operators are considered binary operators
when there are three arguments. If the first argument is
<b>!</b>, the value is the negation of the two-argument test
using the second and third arguments. If the first argument
is exactly <b>(</b> and the third argument is exactly
<b>)</b>, the result is the one-argument test of the second
argument. Otherwise, the expression is false.</p>
<p style="margin-left:18%;">4 arguments</p>
<p style="margin-left:27%;">The following conditions are
applied in the order listed. If the first argument is
<b>!</b>, the result is the negation of the three-argument
expression composed of the remaining arguments. If the first
argument is exactly <b>(</b> and the fourth argument is
exactly <b>)</b>, the result is the two-argument test of the
second and third arguments. Otherwise, the expression is
parsed and evaluated according to precedence using the rules
listed above.</p>
<p style="margin-left:18%;">5 or more arguments</p>
<p style="margin-left:27%;">The expression is parsed and
evaluated according to precedence using the rules listed
above.</p>
<p style="margin-left:18%; margin-top: 1em">When the shell
is in posix mode, or if the expression is part of the
<b>[[</b> command, the <b>&lt;</b> and <b>&gt;</b> operators
sort using the current locale. If the shell is not in posix
mode, the <b>test</b> and <b>[</b> commands sort
lexicographically using ASCII ordering.</p>
<p style="margin-left:18%; margin-top: 1em">The historical
operator-precedence parsing with 4 or more arguments can
lead to ambiguities when it encounters strings that look
like primaries. The <small>POSIX</small> standard has
deprecated the <b>&minus;a</b> and <b>&minus;o</b> primaries
and enclosing expressions within parentheses. Scripts should
no longer use them. It&rsquo;s much more reliable to
restrict test invocations to a single primary, and to
replace uses of <b>&minus;a</b> and <b>&minus;o</b> with the
shell&rsquo;s <b>&amp;&amp;</b> and <b>||</b> list
operators.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="6%">
<p><b>times</b></p></td>
<td width="3%"></td>
<td width="82%">
<p>Print the accumulated user and system times for the
shell and for processes run from the shell. The return
status is 0.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>trap</b> [<b>&minus;lpP</b>]
[[<i>action</i>] <i>sigspec</i> ...]</p>
<p style="margin-left:18%;">The <i>action</i> is a command
that is read and executed when the shell receives any of the
signals <i>sigspec</i>. If <i>action</i> is absent (and
there is a single <i>sigspec</i>) or <b>&minus;</b>, each
specified <i>sigspec</i> is reset to the value it had when
the shell was started. If <i>action</i> is the null string
the signal specified by each <i>sigspec</i> is ignored by
the shell and by the commands it invokes.</p>
<p style="margin-left:18%; margin-top: 1em">If no arguments
are supplied, <b>trap</b> displays the actions associated
with each trapped signal as a set of <b>trap</b> commands
that can be reused as shell input to restore the current
signal dispositions. If <b>&minus;p</b> is given, and
<i>action</i> is not present, then <b>trap</b> displays the
actions associated with each <i>sigspec</i> or, if none are
supplied, for all trapped signals, as a set of <b>trap</b>
commands that can be reused as shell input to restore the
current signal dispositions. The <b>&minus;P</b> option
behaves similarly, but displays only the actions associated
with each <i>sigspec</i> argument. <b>&minus;P</b> requires
at least one <i>sigspec</i> argument. The <b>&minus;P</b> or
<b>&minus;p</b> options may be used in a subshell
environment (e.g., command substitution) and, as long as
they are used before <b>trap</b> is used to change a
signal&rsquo;s handling, will display the state of its
parent&rsquo;s traps.</p>
<p style="margin-left:18%; margin-top: 1em">The
<b>&minus;l</b> option prints a list of signal names and
their corresponding numbers. Each <i>sigspec</i> is either a
signal name defined in &lt;<i>signal.h</i>&gt;, or a signal
number. Signal names are case insensitive and the
<b><small>SIG</small></b> prefix is optional. If
<b>&minus;l</b> is supplied with no <i>sigspec</i>
arguments, it prints a list of valid signal names.</p>
<p style="margin-left:18%; margin-top: 1em">If a
<i>sigspec</i> is <b><small>EXIT</small></b> (0),
<i>action</i> is executed on exit from the shell. If a
<i>sigspec</i> is
<b><small>DEBUG</small></b><small>,</small> <i>action</i> is
executed before every <i>simple command</i>, <i>for</i>
command, <i>case</i> command, <i>select</i> command, ((
arithmetic command, [[ conditional command, arithmetic
<i>for</i> command, and before the first command executes in
a shell function (see <b><small>SHELL GRAMMAR</small></b>
above). Refer to the description of the <b>extdebug</b>
shell option (see <b>shopt</b> above) for details of its
effect on the <b>DEBUG</b> trap. If a <i>sigspec</i> is
<b><small>RETURN</small></b><small>,</small> <i>action</i>
is executed each time a shell function or a script executed
with the <b>.</b> or <b>source</b> builtins finishes
executing.</p>
<p style="margin-left:18%; margin-top: 1em">If a
<i>sigspec</i> is <b><small>ERR</small></b><small>,</small>
<i>action</i> is executed whenever a pipeline (which may
consist of a single simple command), a list, or a compound
command returns a non&minus;zero exit status, subject to the
following conditions. The <b><small>ERR</small></b> trap is
not executed if the failed command is part of the command
list immediately following a <b>while</b> or <b>until</b>
reserved word, part of the test in an <i>if</i> statement,
part of a command executed in a <b>&amp;&amp;</b> or
<b>||</b> list except the command following the final
<b>&amp;&amp;</b> or <b>||</b>, any command in a pipeline
but the last (subject to the state of the <b>pipefail</b>
shell option), or if the command&rsquo;s return value is
being inverted using <b>!</b>. These are the same conditions
obeyed by the <b>errexit</b> (<b>&minus;e</b>) option.</p>
<p style="margin-left:18%; margin-top: 1em">When the shell
is not interactive, signals ignored upon entry to the shell
cannot be trapped or reset. Interactive shells permit
trapping signals ignored on entry. Trapped signals that are
not being ignored are reset to their original values in a
subshell or subshell environment when one is created. The
return status is false if any <i>sigspec</i> is invalid;
otherwise <b>trap</b> returns true.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="5%">
<p><b>true</b></p></td>
<td width="4%"></td>
<td width="42%">
<p>Does nothing, returns a 0 status.</p></td>
<td width="40%">
</td></tr>
</table>
<p style="margin-left:9%;"><b>type</b>
[<b>&minus;aftpP</b>] <i>name</i> [<i>name</i> ...]</p>
<p style="margin-left:18%;">Indicate how each <i>name</i>
would be interpreted if used as a command name.</p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>&minus;t</b> option is used, <b>type</b> prints a string
which is one of <i>alias</i>, <i>keyword</i>,
<i>function</i>, <i>builtin</i>, or <i>file</i> if
<i>name</i> is an alias, shell reserved word, function,
builtin, or executable file, respectively. If the
<i>name</i> is not found, <b>type</b> prints nothing and
returns a non-zero exit status.</p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>&minus;p</b> option is used, <b>type</b> either returns
the pathname of the executable file that would be found by
searching <b>$PATH</b> for <i>name</i> or nothing if
&ldquo;type &minus;t name&rdquo; would not return
<i>file</i>. The <b>&minus;P</b> option forces a
<b><small>PATH</small></b> search for each <i>name</i>, even
if &ldquo;type &minus;t name&rdquo; would not return
<i>file</i>. If <i>name</i> is present in the table of
hashed commands, <b>&minus;p</b> and <b>&minus;P</b> print
the hashed value, which is not necessarily the file that
appears first in
<b><small>PATH</small></b><small>.</small></p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>&minus;a</b> option is used, <b>type</b> prints all of
the places that contain a command named <i>name</i>. This
includes aliases, reserved words, functions, and builtins,
but the path search options (<b>&minus;p</b> and
<b>&minus;P</b>) can be supplied to restrict the output to
executable files. <b>type</b> does not consult the table of
hashed commands when using <b>&minus;a</b> with
<b>&minus;p</b>, and only performs a
<b><small>PATH</small></b> search for <i>name</i>.</p>
<p style="margin-left:18%; margin-top: 1em">The
<b>&minus;f</b> option suppresses shell function lookup, as
with the <b>command</b> builtin. <b>type</b> returns true if
all of the arguments are found, false if any are not
found.</p>
<p style="margin-left:9%;"><b>ulimit</b> [<b>&minus;HS</b>]
<b>&minus;a <br>
ulimit</b> [<b>&minus;HS</b>]
[<b>&minus;bcdefiklmnpqrstuvxPRT</b> [<i>limit</i>]]</p>
<p style="margin-left:18%;">Provides control over the
resources available to the shell and to processes it starts,
on systems that allow such control.</p>
<p style="margin-left:18%; margin-top: 1em">The
<b>&minus;H</b> and <b>&minus;S</b> options specify whether
the hard or soft limit is set for the given resource. A hard
limit cannot be increased by a non-root user once it is set;
a soft limit may be increased up to the value of the hard
limit. If neither <b>&minus;H</b> nor <b>&minus;S</b> is
specified, <b>ulimit</b> sets both the soft and hard
limits.</p>
<p style="margin-left:18%; margin-top: 1em">The value of
<i>limit</i> can be a number in the unit specified for the
resource or one of the special values <b>hard</b>,
<b>soft</b>, or <b>unlimited</b>, which stand for the
current hard limit, the current soft limit, and no limit,
respectively. If <i>limit</i> is omitted, <b>ulimit</b>
prints the current value of the soft limit of the resource,
unless the <b>&minus;H</b> option is given. When more than
one resource is specified, the limit name and unit, if
appropriate, are printed before the value. Other options are
interpreted as follows:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;a</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>Report all current limits; no limits are set.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;b</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum socket buffer size.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;c</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum size of core files created.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;d</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum size of a process&rsquo;s data segment.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;e</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum scheduling priority
(&ldquo;nice&rdquo;).</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;f</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum size of files written by the shell and its
children.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;i</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum number of pending signals.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;k</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum number of kqueues that may be allocated.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;l</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum size that may be locked into memory.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;m</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum resident set size (many systems do not honor
this limit).</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;n</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum number of open file descriptors (most
systems do not allow this value to be set).</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;p</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The pipe size in 512-byte blocks (this may not be
set).</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;q</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum number of bytes in <small>POSIX</small>
message queues.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;r</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum real-time scheduling priority.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;s</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum stack size.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;t</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum amount of cpu time in seconds.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;u</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum number of processes available to a single
user.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;v</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum amount of virtual memory available to the
shell and, on some systems, to its children.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;x</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum number of file locks.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;P</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum number of pseudoterminals.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;R</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum time a real-time process can run before
blocking, in microseconds.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="3%">
<p><b>&minus;T</b></p></td>
<td width="6%"></td>
<td width="73%">
<p>The maximum number of threads.</p></td></tr>
</table>
<p style="margin-left:18%; margin-top: 1em">If <i>limit</i>
is supplied, and the <b>&minus;a</b> option is not used,
<i>limit</i> is the new value of the specified resource. If
no option is supplied, then <b>&minus;f</b> is assumed.</p>
<p style="margin-left:18%; margin-top: 1em">Values are in
1024-byte increments, except for <b>&minus;t</b>, which is
in seconds; <b>&minus;R</b>, which is in microseconds;
<b>&minus;p</b>, which is in units of 512-byte blocks;
<b>&minus;P</b>, <b>&minus;T</b>, <b>&minus;b</b>,
<b>&minus;k</b>, <b>&minus;n</b>, and <b>&minus;u</b>, which
are unscaled values; and, when in posix mode,
<b>&minus;c</b> and <b>&minus;f</b>, which are in 512-byte
increments. The return status is 0 unless an invalid option
or argument is supplied, or an error occurs while setting a
new limit.</p>
<p style="margin-left:9%;"><b>umask</b> [<b>&minus;p</b>]
[<b>&minus;S</b>] [<i>mode</i>]</p>
<p style="margin-left:18%;">Set the user file-creation mask
to <i>mode</i>. If <i>mode</i> begins with a digit, it is
interpreted as an octal number; otherwise it is interpreted
as a symbolic mode mask similar to that accepted by
<i>chmod</i>(1). If <i>mode</i> is omitted, <b>umask</b>
prints the current value of the mask. The <b>&minus;S</b>
option without a <i>mode</i> argument prints the mask in a
symbolic format; the default output is an octal number. If
the <b>&minus;p</b> option is supplied, and <i>mode</i> is
omitted, the output is in a form that may be reused as
input. The return status is zero if the mode was
successfully changed or if no <i>mode</i> argument was
supplied, and non-zero otherwise.</p>
<p style="margin-left:9%;"><b>unalias</b> [&minus;<b>a</b>]
[<i>name</i> ...]</p>
<p style="margin-left:18%;">Remove each <i>name</i> from
the list of defined aliases. If <b>&minus;a</b> is supplied,
remove all alias definitions. The return value is true
unless a supplied <i>name</i> is not a defined alias.</p>
<p style="margin-left:9%;"><b>unset</b> [&minus;<b>fv</b>]
[&minus;<b>n</b>] [<i>name</i> ...]</p>
<p style="margin-left:18%;">For each <i>name</i>, remove
the corresponding variable or function. If the
<b>&minus;v</b> option is given, each <i>name</i> refers to
a shell variable, and that variable is removed. If
<b>&minus;f</b> is specified, each <i>name</i> refers to a
shell function, and the function definition is removed. If
the <b>&minus;n</b> option is supplied, and <i>name</i> is a
variable with the <i>nameref</i> attribute, <i>name</i> will
be unset rather than the variable it references.
<b>&minus;n</b> has no effect if the <b>&minus;f</b> option
is supplied. Read-only variables and functions may not be
unset. When variables or functions are removed, they are
also removed from the environment passed to subsequent
commands. If no options are supplied, each <i>name</i>
refers to a variable; if there is no variable by that name,
a function with that name, if any, is unset. Some shell
variables may not be unset. If any of
<b><small>BASH_ALIASES</small></b><small>,
<b>BASH_ARGV0</b>, <b>BASH_CMDS</b>, <b>BASH_COMMAND</b>,
<b>BASH_SUBSHELL</b>, <b>BASHPID</b>,
<b>COMP_WORDBREAKS</b>, <b>DIRSTACK</b>,
<b>EPOCHREALTIME</b>, <b>EPOCHSECONDS</b>, <b>FUNCNAME</b>,
<b>GROUPS</b>, <b>HISTCMD</b>, <b>LINENO</b>, <b>RANDOM</b>,
<b>SECONDS</b>,</small> or <b><small>SRANDOM</small></b> are
unset, they lose their special properties, even if they are
subsequently reset. The exit status is true unless a
<i>name</i> is readonly or may not be unset.</p>
<p style="margin-left:9%;"><b>wait</b> [<b>&minus;fn</b>]
[<b>&minus;p</b> <i>varname</i>] [<i>id</i> ...]</p>
<p style="margin-left:18%;">Wait for each specified child
process <i>id</i> and return the termination status of the
last <i>id</i>. Each <i>id</i> may be a process ID
<i>pid</i> or a job specification <i>jobspec</i>; if a
jobspec is supplied, <b>wait</b> waits for all processes in
the job.</p>
<p style="margin-left:18%; margin-top: 1em">If no options
or <i>id</i>s are supplied, <b>wait</b> waits for all
running background jobs and the last-executed process
substitution, if its process id is the same as <b>$!</b>,
and the return status is zero.</p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>&minus;n</b> option is supplied, <b>wait</b> waits for
any one of the given <i>id</i>s or, if no <i>id</i>s are
supplied, any job or process substitution, to complete and
returns its exit status. If none of the supplied <i>id</i>s
is a child of the shell, or if no <i>id</i>s are supplied
and the shell has no unwaited-for children, the exit status
is 127.</p>
<p style="margin-left:18%; margin-top: 1em">If the
<b>&minus;p</b> option is supplied, <b>wait</b> assigns the
process or job identifier of the job for which the exit
status is returned to the variable <i>varname</i> named by
the option argument. The variable, which cannot be readonly,
will be unset initially, before any assignment. This is
useful only when used with the <b>&minus;n</b> option.</p>
<p style="margin-left:18%; margin-top: 1em">Supplying the
<b>&minus;f</b> option, when job control is enabled, forces
<b>wait</b> to wait for each <i>id</i> to terminate before
returning its status, instead of returning when it changes
status.</p>
<p style="margin-left:18%; margin-top: 1em">If none of the
<i>id</i>s specify one of the shell&rsquo;s active child
processes, the return status is 127. If <b>wait</b> is
interrupted by a signal, any <i>varname</i> will remain
unset, and the return status will be greater than 128, as
described under <b>SIGNALS</b> above. Otherwise, the return
status is the exit status of the last <i>id</i>.</p>
<h2>SHELL COMPATIBILITY MODE
<a name="SHELL COMPATIBILITY MODE"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">Bash-4.0
introduced the concept of a <i>shell compatibility
level</i>, specified as a set of options to the shopt
builtin (<b>compat31</b>, <b>compat32</b>, <b>compat40</b>,
<b>compat41</b>, and so on). There is only one current
compatibility level &mdash; each option is mutually
exclusive. The compatibility level is intended to allow
users to select behavior from previous versions that is
incompatible with newer versions while they migrate scripts
to use current features and behavior. It&rsquo;s intended to
be a temporary solution.</p>
<p style="margin-left:9%; margin-top: 1em">This section
does not mention behavior that is standard for a particular
version (e.g., setting <b>compat32</b> means that quoting
the right hand side of the regexp matching operator quotes
special regexp characters in the word, which is default
behavior in bash-3.2 and subsequent versions).</p>
<p style="margin-left:9%; margin-top: 1em">If a user
enables, say, <b>compat32</b>, it may affect the behavior of
other compatibility levels up to and including the current
compatibility level. The idea is that each compatibility
level controls behavior that changed in that version of
<b>bash</b>, but that behavior may have been present in
earlier versions. For instance, the change to use
locale-based comparisons with the <b>[[</b> command came in
bash-4.1, and earlier versions used ASCII-based comparisons,
so enabling <b>compat32</b> will enable ASCII-based
comparisons as well. That granularity may not be sufficient
for all uses, and as a result users should employ
compatibility levels carefully. Read the documentation for a
particular feature to find out the current behavior.</p>
<p style="margin-left:9%; margin-top: 1em">Bash-4.3
introduced a new shell variable:
<b><small>BASH_COMPAT</small></b><small>.</small> The value
assigned to this variable (a decimal version number like
4.2, or an integer corresponding to the
<b>compat</b><i>NN</i> option, like 42) determines the
compatibility level.</p>
<p style="margin-left:9%; margin-top: 1em">Starting with
bash-4.4, <b>bash</b> began deprecating older compatibility
levels. Eventually, the options will be removed in favor of
<b><small>BASH_COMPAT</small></b><small>.</small></p>
<p style="margin-left:9%; margin-top: 1em">Bash-5.0 was the
final version for which there was an individual shopt option
for the previous version. <b><small>BASH_COMPAT</small></b>
is the only mechanism to control the compatibility level in
versions newer than bash-5.0.</p>
<p style="margin-left:9%; margin-top: 1em">The following
table describes the behavior changes controlled by each
compatibility level setting. The <b>compat</b><i>NN</i> tag
is used as shorthand for setting the compatibility level to
<i>NN</i> using one of the following mechanisms. For
versions prior to bash-5.0, the compatibility level may be
set using the corresponding <b>compat</b><i>NN</i> shopt
option. For bash-4.3 and later versions, the
<b><small>BASH_COMPAT</small></b> variable is preferred, and
it is required for bash-5.1 and later versions. <b><br>
compat31</b></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>Quoting the rhs of the <b>[[</b> command&rsquo;s regexp
matching operator (=~) has no special effect.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>compat32</b></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>The <b>&lt;</b> and <b>&gt;</b> operators to the
<b>[[</b> command do not consider the current locale when
comparing strings; they use ASCII ordering.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>compat40</b></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>The <b>&lt;</b> and <b>&gt;</b> operators to the
<b>[[</b> command do not consider the current locale when
comparing strings; they use ASCII ordering. <b>Bash</b>
versions prior to bash-4.1 use ASCII collation and
<i>strcmp</i>(3); bash-4.1 and later use the current
locale&rsquo;s collation sequence and <i>strcoll</i>(3).</p></td></tr>
</table>
<p style="margin-left:9%;"><b>compat41</b></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>In posix mode, <b>time</b> may be followed by options
and still be recognized as a reserved word (this is
<small>POSIX</small> interpretation 267).</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>In <i>posix</i> mode, the parser requires that an even
number of single quotes occur in the <i>word</i> portion of
a double-quoted parameter expansion and treats them
specially, so that characters within the single quotes are
considered quoted (this is <small>POSIX</small>
interpretation 221).</p></td></tr>
</table>
<p style="margin-left:9%;"><b>compat42</b></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>The replacement string in double-quoted pattern
substitution does not undergo quote removal, as it does in
versions after bash-4.2.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>In posix mode, single quotes are considered special when
expanding the <i>word</i> portion of a double-quoted
parameter expansion and can be used to quote a closing brace
or other special character (this is part of
<small>POSIX</small> interpretation 221); in later versions,
single quotes are not special within double-quoted word
expansions.</p> </td></tr>
</table>
<p style="margin-left:9%;"><b>compat43</b></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>Word expansion errors are considered non-fatal errors
that cause the current command to fail, even in posix mode
(the default behavior is to make them fatal errors that
cause the shell to exit).</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>When executing a shell function, the loop state
(while/until/etc.) is not reset, so <b>break</b> or
<b>continue</b> in that function will break or continue
loops in the calling context. Bash-4.4 and later reset the
loop state to prevent this.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>compat44</b></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>The shell sets up the values used by
<b><small>BASH_ARGV</small></b> and
<b><small>BASH_ARGC</small></b> so they can expand to the
shell&rsquo;s positional parameters even if extended
debugging mode is not enabled.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>A subshell inherits loops from its parent context, so
<b>break</b> or <b>continue</b> will cause the subshell to
exit. Bash-5.0 and later reset the loop state to prevent the
exit</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>Variable assignments preceding builtins like
<b>export</b> and <b>readonly</b> that set attributes
continue to affect variables with the same name in the
calling environment even if the shell is not in posix
mode.</p> </td></tr>
</table>
<p style="margin-left:9%;"><b>compat50</b></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>Bash-5.1 changed the way <b><small>$RANDOM</small></b>
is generated to introduce slightly more randomness. If the
shell compatibility level is set to 50 or lower, it reverts
to the method from bash-5.0 and previous versions, so
seeding the random number generator by assigning a value to
<b><small>RANDOM</small></b> will produce the same sequence
as in bash-5.0.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>If the command hash table is empty, bash versions prior
to bash-5.1 printed an informational message to that effect,
even when producing output that can be reused as input.
Bash-5.1 suppresses that message when the <b>&minus;l</b>
option is supplied.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>compat51</b></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>The <b>unset</b> builtin treats attempts to unset array
subscripts <b>@</b> and <b>*</b> differently depending on
whether the array is indexed or associative, and differently
than in previous versions.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>Arithmetic commands ( <b>((</b>...<b>))</b> ) and the
expressions in an arithmetic for statement can be expanded
more than once.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>Expressions used as arguments to arithmetic operators in
the <b>[[</b> conditional command can be expanded more than
once.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>The expressions in substring parameter brace expansion
can be expanded more than once.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>The expressions in the <b>$((</b>...<b>))</b> word
expansion can be expanded more than once.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>Arithmetic expressions used as indexed array subscripts
can be expanded more than once.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p><b>test &minus;v</b>, when given an argument of
<b>A[@]</b>, where <b>A</b> is an existing associative
array, will return true if the array has any set elements.
Bash-5.2 will look for and report on a key named
<b>@</b>.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>The ${<i>parameter</i><b>[:]=</b><i>value</i>} word
expansion will return <i>value</i>, before any
variable-specific transformations have been performed (e.g.,
converting to lowercase). Bash-5.2 will return the final
value assigned to the variable.</p></td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>Parsing command substitutions will behave as if extended
globbing (see the description of the <b>shopt</b> builtin
above) is enabled, so that parsing a command substitution
containing an extglob pattern (say, as part of a shell
function) will not fail. This assumes the intent is to
enable extglob before the command is executed and word
expansions are performed. It will fail at word expansion
time if extglob hasn&rsquo;t been enabled by the time the
command is executed.</p></td></tr>
</table>
<p style="margin-left:9%;"><b>compat52</b></p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>The <b>test</b> builtin uses its historical algorithm to
parse parenthesized subexpressions when given five or more
arguments.</p> </td></tr>
<tr valign="top" align="left">
<td width="18%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="73%">
<p>If the <b>&minus;p</b> or <b>&minus;P</b> option is
supplied to the <b>bind</b> builtin, <b>bind</b> treats any
arguments remaining after option processing as bindable
command names, and displays any key sequences bound to those
commands, instead of treating the arguments as key sequences
to bind.</p></td></tr>
</table>
<h2>RESTRICTED SHELL
<a name="RESTRICTED SHELL"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">If <b>bash</b>
is started with the name <b>rbash</b>, or the
<b>&minus;r</b> option is supplied at invocation, the shell
becomes <i>restricted</i>. A restricted shell is used to set
up an environment more controlled than the standard shell.
It behaves identically to <b>bash</b> with the exception
that the following are disallowed or not performed:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p style="margin-top: 1em">&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p style="margin-top: 1em">Changing directories with
<b>cd</b>.</p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Setting or unsetting the values of
<b><small>SHELL</small></b><small>, <b>PATH</b>,
<b>HISTFILE</b>, <b>ENV</b>,</small> or
<b><small>BASH_ENV</small></b><small>.</small></p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Specifying command names containing <b>/</b>.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Specifying a filename containing a <b>/</b> as an
argument to the <b>.</b> builtin command.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Using the <b>&minus;p</b> option to the <b>.</b> builtin
command to specify a search path.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Specifying a filename containing a slash as an argument
to the <b>history</b> builtin command.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Specifying a filename containing a slash as an argument
to the <b>&minus;p</b> option to the <b>hash</b> builtin
command.</p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Importing function definitions from the shell
environment at startup.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Parsing the values of <b><small>BASHOPTS</small></b> and
<b><small>SHELLOPTS</small></b> from the shell environment
at startup.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Redirecting output using the &gt;, &gt;|, &lt;&gt;,
&gt;&amp;, &amp;&gt;, and &gt;&gt; redirection
operators.</p> </td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Using the <b>exec</b> builtin command to replace the
shell with another command.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Adding or deleting builtin commands with the
<b>&minus;f</b> and <b>&minus;d</b> options to the
<b>enable</b> builtin command.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Using the <b>enable</b> builtin command to enable
disabled shell builtins.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Specifying the <b>&minus;p</b> option to the
<b>command</b> builtin command.</p></td></tr>
<tr valign="top" align="left">
<td width="9%"></td>
<td width="1%">
<p>&bull;</p></td>
<td width="8%"></td>
<td width="82%">
<p>Turning off restricted mode with <b>set +r</b> or
<b>shopt &minus;u restricted_shell</b>.</p></td></tr>
</table>
<p style="margin-left:9%; margin-top: 1em">These
restrictions are enforced after any startup files are
read.</p>
<p style="margin-left:9%; margin-top: 1em">When a command
that is found to be a shell script is executed (see
<b><small>COMMAND EXECUTION</small></b> above), <b>rbash</b>
turns off any restrictions in the shell spawned to execute
the script.</p>
<h2>SEE ALSO
<a name="SEE ALSO"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em"><i>Bash
Reference Manual</i>, Brian Fox and Chet Ramey <i><br>
The Gnu Readline Library</i>, Brian Fox and Chet Ramey
<i><br>
The Gnu History Library</i>, Brian Fox and Chet Ramey
<i><br>
Portable Operating System Interface (POSIX) Part 2: Shell
and <br>
Utilities</i>, IEEE &mdash;</p>
<p style="margin-left:18%;">http://pubs.opengroup.org/onlinepubs/9799919799/</p>
<p style="margin-left:9%;">http://tiswww.case.edu/~chet/bash/POSIX
&mdash; a description of posix mode <i><br>
sh</i>(1), <i>ksh</i>(1), <i>csh</i>(1) <i><br>
emacs</i>(1), <i>vi</i>(1) <i><br>
readline</i>(3)</p>
<h2>FILES
<a name="FILES"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em"><A HREF="file:/bin/bash"><i>/bin/bash</i></A></p>
<p style="margin-left:18%;">The <b>bash</b> executable</p>
<p style="margin-left:9%;"><A HREF="file:/etc/profile"><i>/etc/profile</i></A></p>
<p style="margin-left:18%;">The systemwide initialization
file, executed for login shells</p>
<p style="margin-left:9%;"><A HREF="file:~/.bash_profile"><i>~/.bash_profile</i></A></p>
<p style="margin-left:18%;">The personal initialization
file, executed for login shells</p>
<p style="margin-left:9%;"><A HREF="file:~/.bashrc"><i>~/.bashrc</i></A></p>
<p style="margin-left:18%;">The individual
per-interactive-shell startup file</p>
<p style="margin-left:9%;"><A HREF="file:~/.bash_logout"><i>~/.bash_logout</i></A></p>
<p style="margin-left:18%;">The individual login shell
cleanup file, executed when a login shell exits</p>
<p style="margin-left:9%;"><A HREF="file:~/.bash_history"><i>~/.bash_history</i></A></p>
<p style="margin-left:18%;">The default value of
<b>HISTFILE</b>, the file in which bash saves the command
history</p>
<p style="margin-left:9%;"><A HREF="file:~/.inputrc"><i>~/.inputrc</i></A></p>
<p style="margin-left:18%;">Individual <i>readline</i>
initialization file</p>
<h2>AUTHORS
<a name="AUTHORS"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">Brian Fox, Free
Software Foundation <br>
bfox@gnu.org</p>
<p style="margin-left:9%; margin-top: 1em">Chet Ramey, Case
Western Reserve University <br>
chet.ramey@case.edu</p>
<h2>BUG REPORTS
<a name="BUG REPORTS"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">If you find a
bug in <b>bash</b>, you should report it. But first, you
should make sure that it really is a bug, and that it
appears in the latest version of <b>bash</b>. The latest
version is always available from
<i>ftp://ftp.gnu.org/pub/gnu/bash/</i> and
<i>http://git.savannah.gnu.org/cgit/bash.git/snapshot/bash-master.tar.gz</i>.</p>
<p style="margin-left:9%; margin-top: 1em">Once you have
determined that a bug actually exists, use the
<i>bashbug</i> command to submit a bug report. If you have a
fix, you are encouraged to mail that as well! You may send
suggestions and &ldquo;philosophical&rdquo; bug reports to
<i>bug-bash@gnu.org</i> or post them to the Usenet newsgroup
<b>gnu.bash.bug</b>.</p>
<p style="margin-left:9%; margin-top: 1em">ALL bug reports
should include: <br>
The version number of <b>bash</b> <br>
The hardware and operating system <br>
The compiler used to compile <br>
A description of the bug behavior <br>
A short script or &ldquo;recipe&rdquo; which exercises the
bug</p>
<p style="margin-left:9%; margin-top: 1em"><i>bashbug</i>
inserts the first three items automatically into the
template it provides for filing a bug report.</p>
<p style="margin-left:9%; margin-top: 1em">Comments and bug
reports concerning this manual page should be directed to
<i>chet.ramey@case.edu</i>.</p>
<h2>BUGS
<a name="BUGS"></a>
</h2>
<p style="margin-left:9%; margin-top: 1em">It&rsquo;s too
big and too slow.</p>
<p style="margin-left:9%; margin-top: 1em">There are some
subtle differences between <b>bash</b> and traditional
versions of <b>sh</b>, mostly because of the
<small>POSIX</small> specification.</p>
<p style="margin-left:9%; margin-top: 1em">Aliases are
confusing in some uses.</p>
<p style="margin-left:9%; margin-top: 1em">Shell builtin
commands and functions are not stoppable/restartable.</p>
<p style="margin-left:9%; margin-top: 1em">Compound
commands and command lists of the form &ldquo;a ; b ;
c&rdquo; are not handled gracefully when combined with
process suspension. When a process is stopped, the shell
immediately executes the next command in the list or breaks
out of any existing loops. It suffices to enclose the
command in parentheses to force it into a subshell, which
may be stopped as a unit, or to start the command in the
background and immediately bring it into the foreground.</p>
<p style="margin-left:9%; margin-top: 1em">Array variables
may not (yet) be exported.</p>
<hr>
</body>
</html>