aboutsummaryrefslogtreecommitdiffstats
path: root/doc/bash.0
diff options
context:
space:
mode:
Diffstat (limited to 'doc/bash.0')
-rw-r--r--doc/bash.02358
1 files changed, 1240 insertions, 1118 deletions
diff --git a/doc/bash.0 b/doc/bash.0
index 675cd2f..86d8b70 100644
--- a/doc/bash.0
+++ b/doc/bash.0
@@ -9,7 +9,7 @@ SSYYNNOOPPSSIISS
bbaasshh [options] [file]
CCOOPPYYRRIIGGHHTT
- Bash is Copyright (C) 1989-2009 by the Free Software Foundation, Inc.
+ Bash is Copyright (C) 1989-2010 by the Free Software Foundation, Inc.
DDEESSCCRRIIPPTTIIOONN
BBaasshh is an sshh-compatible command language interpreter that executes
@@ -21,82 +21,81 @@ DDEESSCCRRIIPPTTIIOONN
1003.1). BBaasshh can be configured to be POSIX-conformant by default.
OOPPTTIIOONNSS
- In addition to the single-character shell options documented in the
- description of the sseett builtin command, bbaasshh interprets the following
- options when it is invoked:
+ All of the single-character shell options documented in the descrip-
+ tion of the sseett builtin command can be used as options when the shell
+ is invoked. In addition, bbaasshh interprets the following options when it
+ is invoked:
- --cc _s_t_r_i_n_g If the --cc option is present, then commands are read from
- _s_t_r_i_n_g. If there are arguments after the _s_t_r_i_n_g, they are
+ --cc _s_t_r_i_n_g If the --cc option is present, then commands are read from
+ _s_t_r_i_n_g. If there are arguments after the _s_t_r_i_n_g, they are
assigned to the positional parameters, starting with $$00.
--ii If the --ii option is present, the shell is _i_n_t_e_r_a_c_t_i_v_e.
--ll Make bbaasshh act as if it had been invoked as a login shell (see
IINNVVOOCCAATTIIOONN below).
- --rr If the --rr option is present, the shell becomes _r_e_s_t_r_i_c_t_e_d
+ --rr If the --rr option is present, the shell becomes _r_e_s_t_r_i_c_t_e_d
(see RREESSTTRRIICCTTEEDD SSHHEELLLL below).
- --ss If the --ss option is present, or if no arguments remain after
- option processing, then commands are read from the standard
- input. This option allows the positional parameters to be
+ --ss If the --ss option is present, or if no arguments remain after
+ option processing, then commands are read from the standard
+ input. This option allows the positional parameters to be
set when invoking an interactive shell.
- --DD A list of all double-quoted strings preceded by $$ is printed
- on the standard output. These are the strings that are sub-
+ --DD A list of all double-quoted strings preceded by $$ is printed
+ on the standard output. These are the strings that are sub-
ject to language translation when the current locale is not CC
- or PPOOSSIIXX. This implies the --nn option; no commands will be
+ or PPOOSSIIXX. This implies the --nn option; no commands will be
executed.
[[--++]]OO [[_s_h_o_p_t___o_p_t_i_o_n]]
- _s_h_o_p_t___o_p_t_i_o_n is one of the shell options accepted by the
- sshhoopptt builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). If
+ _s_h_o_p_t___o_p_t_i_o_n is one of the shell options accepted by the
+ sshhoopptt builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). If
_s_h_o_p_t___o_p_t_i_o_n is present, --OO sets the value of that option; ++OO
- unsets it. If _s_h_o_p_t___o_p_t_i_o_n is not supplied, the names and
- values of the shell options accepted by sshhoopptt are printed on
- the standard output. If the invocation option is ++OO, the
- output is displayed in a format that may be reused as input.
- ---- A ---- signals the end of options and disables further option
- processing. Any arguments after the ---- are treated as file-
+ unsets it. If _s_h_o_p_t___o_p_t_i_o_n is not supplied, the names and
+ values of the shell options accepted by sshhoopptt are printed on
+ the standard output. If the invocation option is ++OO, the
+ output is displayed in a format that may be reused as input.
+ ---- A ---- signals the end of options and disables further option
+ processing. Any arguments after the ---- are treated as file-
names and arguments. An argument of -- is equivalent to ----.
- BBaasshh also interprets a number of multi-character options. These
- options must appear on the command line before the single-character
+ BBaasshh also interprets a number of multi-character options. These
+ options must appear on the command line before the single-character
options to be recognized.
----ddeebbuuggggeerr
Arrange for the debugger profile to be executed before the shell
- starts. Turns on extended debugging mode (see the description
- of the eexxttddeebbuugg option to the sshhoopptt builtin below) and shell
- function tracing (see the description of the --oo ffuunnccttrraaccee option
- to the sseett builtin below).
+ starts. Turns on extended debugging mode (see the description
+ of the eexxttddeebbuugg option to the sshhoopptt builtin below).
----dduummpp--ppoo--ssttrriinnggss
- Equivalent to --DD, but the output is in the GNU _g_e_t_t_e_x_t ppoo (por-
+ Equivalent to --DD, but the output is in the GNU _g_e_t_t_e_x_t ppoo (por-
table object) file format.
----dduummpp--ssttrriinnggss
Equivalent to --DD.
- ----hheellpp Display a usage message on standard output and exit success-
+ ----hheellpp Display a usage message on standard output and exit success-
fully.
----iinniitt--ffiillee _f_i_l_e
----rrccffiillee _f_i_l_e
Execute commands from _f_i_l_e instead of the standard personal ini-
- tialization file _~_/_._b_a_s_h_r_c if the shell is interactive (see
+ tialization file _~_/_._b_a_s_h_r_c if the shell is interactive (see
IINNVVOOCCAATTIIOONN below).
----llooggiinn
Equivalent to --ll.
----nnooeeddiittiinngg
- Do not use the GNU rreeaaddlliinnee library to read command lines when
+ Do not use the GNU rreeaaddlliinnee library to read command lines when
the shell is interactive.
----nnoopprrooffiillee
- Do not read either the system-wide startup file _/_e_t_c_/_p_r_o_f_i_l_e or
- any of the personal initialization files _~_/_._b_a_s_h___p_r_o_f_i_l_e,
- _~_/_._b_a_s_h___l_o_g_i_n, or _~_/_._p_r_o_f_i_l_e. By default, bbaasshh reads these
- files when it is invoked as a login shell (see IINNVVOOCCAATTIIOONN
+ Do not read either the system-wide startup file _/_e_t_c_/_p_r_o_f_i_l_e or
+ any of the personal initialization files _~_/_._b_a_s_h___p_r_o_f_i_l_e,
+ _~_/_._b_a_s_h___l_o_g_i_n, or _~_/_._p_r_o_f_i_l_e. By default, bbaasshh reads these
+ files when it is invoked as a login shell (see IINNVVOOCCAATTIIOONN
below).
----nnoorrcc Do not read and execute the personal initialization file
- _~_/_._b_a_s_h_r_c if the shell is interactive. This option is on by
+ _~_/_._b_a_s_h_r_c if the shell is interactive. This option is on by
default if the shell is invoked as sshh.
----ppoossiixx
- Change the behavior of bbaasshh where the default operation differs
+ Change the behavior of bbaasshh where the default operation differs
from the POSIX standard to match the standard (_p_o_s_i_x _m_o_d_e).
----rreessttrriicctteedd
@@ -106,113 +105,113 @@ OOPPTTIIOONNSS
Equivalent to --vv.
----vveerrssiioonn
- Show version information for this instance of bbaasshh on the stan-
+ Show version information for this instance of bbaasshh on the stan-
dard output and exit successfully.
AARRGGUUMMEENNTTSS
If arguments remain after option processing, and neither the --cc nor the
- --ss option has been supplied, the first argument is assumed to be the
- name of a file containing shell commands. If bbaasshh is invoked in this
- fashion, $$00 is set to the name of the file, and the positional parame-
- ters are set to the remaining arguments. BBaasshh reads and executes com-
- mands from this file, then exits. BBaasshh's exit status is the exit sta-
- tus of the last command executed in the script. If no commands are
- executed, the exit status is 0. An attempt is first made to open the
+ --ss option has been supplied, the first argument is assumed to be the
+ name of a file containing shell commands. If bbaasshh is invoked in this
+ fashion, $$00 is set to the name of the file, and the positional parame-
+ ters are set to the remaining arguments. BBaasshh reads and executes com-
+ mands from this file, then exits. BBaasshh's exit status is the exit sta-
+ tus of the last command executed in the script. If no commands are
+ executed, the exit status is 0. An attempt is first made to open the
file in the current directory, and, if no file is found, then the shell
searches the directories in PPAATTHH for the script.
IINNVVOOCCAATTIIOONN
- A _l_o_g_i_n _s_h_e_l_l is one whose first character of argument zero is a --, or
+ A _l_o_g_i_n _s_h_e_l_l is one whose first character of argument zero is a --, or
one started with the ----llooggiinn option.
- An _i_n_t_e_r_a_c_t_i_v_e shell is one started without non-option arguments and
+ An _i_n_t_e_r_a_c_t_i_v_e shell is one started without non-option arguments and
without the --cc option whose standard input and error are both connected
- to terminals (as determined by _i_s_a_t_t_y(3)), or one started with the --ii
- option. PPSS11 is set and $$-- includes ii if bbaasshh is interactive, allowing
+ to terminals (as determined by _i_s_a_t_t_y(3)), or one started with the --ii
+ option. PPSS11 is set and $$-- includes ii if bbaasshh is interactive, allowing
a shell script or a startup file to test this state.
- The following paragraphs describe how bbaasshh executes its startup files.
- If any of the files exist but cannot be read, bbaasshh reports an error.
+ The following paragraphs describe how bbaasshh executes its startup files.
+ If any of the files exist but cannot be read, bbaasshh reports an error.
Tildes are expanded in file names as described below under TTiillddee EExxppaann--
ssiioonn in the EEXXPPAANNSSIIOONN section.
- When bbaasshh is invoked as an interactive login shell, or as a non-inter-
- active shell with the ----llooggiinn option, it first reads and executes com-
- mands from the file _/_e_t_c_/_p_r_o_f_i_l_e, if that file exists. After reading
+ When bbaasshh is invoked as an interactive login shell, or as a non-inter-
+ active shell with the ----llooggiinn option, it first reads and executes com-
+ mands from the file _/_e_t_c_/_p_r_o_f_i_l_e, if that file exists. After reading
that file, it looks for _~_/_._b_a_s_h___p_r_o_f_i_l_e, _~_/_._b_a_s_h___l_o_g_i_n, and _~_/_._p_r_o_f_i_l_e,
- in that order, and reads and executes commands from the first one that
- exists and is readable. The ----nnoopprrooffiillee option may be used when the
+ in that order, and reads and executes commands from the first one that
+ exists and is readable. The ----nnoopprrooffiillee option may be used when the
shell is started to inhibit this behavior.
- When a login shell exits, bbaasshh reads and executes commands from the
+ When a login shell exits, bbaasshh reads and executes commands from the
file _~_/_._b_a_s_h___l_o_g_o_u_t, if it exists.
- When an interactive shell that is not a login shell is started, bbaasshh
- reads and executes commands from _~_/_._b_a_s_h_r_c, if that file exists. This
- may be inhibited by using the ----nnoorrcc option. The ----rrccffiillee _f_i_l_e option
- will force bbaasshh to read and execute commands from _f_i_l_e instead of
+ When an interactive shell that is not a login shell is started, bbaasshh
+ reads and executes commands from _~_/_._b_a_s_h_r_c, if that file exists. This
+ may be inhibited by using the ----nnoorrcc option. The ----rrccffiillee _f_i_l_e option
+ will force bbaasshh to read and execute commands from _f_i_l_e instead of
_~_/_._b_a_s_h_r_c.
- When bbaasshh is started non-interactively, to run a shell script, for
+ When bbaasshh is started non-interactively, to run a shell script, for
example, it looks for the variable BBAASSHH__EENNVV 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. BBaasshh behaves as if the following com-
+ its value if it appears there, and uses the expanded value as the name
+ of a file to read and execute. BBaasshh behaves as if the following com-
mand were executed:
if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
- but the value of the PPAATTHH variable is not used to search for the file
+ but the value of the PPAATTHH variable is not used to search for the file
name.
- If bbaasshh is invoked with the name sshh, it tries to mimic the startup
- behavior of historical versions of sshh as closely as possible, while
- conforming to the POSIX standard as well. When invoked as an interac-
- tive login shell, or a non-interactive shell with the ----llooggiinn option,
- it first attempts to read and execute commands from _/_e_t_c_/_p_r_o_f_i_l_e and
- _~_/_._p_r_o_f_i_l_e, in that order. The ----nnoopprrooffiillee option may be used to
- inhibit this behavior. When invoked as an interactive shell with the
- name sshh, bbaasshh looks for the variable EENNVV, expands its value if it is
- defined, and uses the expanded value as the name of a file to read and
+ If bbaasshh is invoked with the name sshh, it tries to mimic the startup
+ behavior of historical versions of sshh as closely as possible, while
+ conforming to the POSIX standard as well. When invoked as an interac-
+ tive login shell, or a non-interactive shell with the ----llooggiinn option,
+ it first attempts to read and execute commands from _/_e_t_c_/_p_r_o_f_i_l_e and
+ _~_/_._p_r_o_f_i_l_e, in that order. The ----nnoopprrooffiillee option may be used to
+ inhibit this behavior. When invoked as an interactive shell with the
+ name sshh, bbaasshh looks for the variable EENNVV, 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 sshh does not attempt to read and exe-
- cute commands from any other startup files, the ----rrccffiillee option has no
- effect. A non-interactive shell invoked with the name sshh does not
- attempt to read any other startup files. When invoked as sshh, bbaasshh
+ cute commands from any other startup files, the ----rrccffiillee option has no
+ effect. A non-interactive shell invoked with the name sshh does not
+ attempt to read any other startup files. When invoked as sshh, bbaasshh
enters _p_o_s_i_x mode after the startup files are read.
- When bbaasshh is started in _p_o_s_i_x mode, as with the ----ppoossiixx command line
+ When bbaasshh is started in _p_o_s_i_x mode, as with the ----ppoossiixx command line
option, it follows the POSIX standard for startup files. In this mode,
- interactive shells expand the EENNVV variable and commands are read and
- executed from the file whose name is the expanded value. No other
+ interactive shells expand the EENNVV variable and commands are read and
+ executed from the file whose name is the expanded value. No other
startup files are read.
BBaasshh attempts to determine when it is being run with its standard input
- connected to a a network connection, as if by the remote shell daemon,
- usually _r_s_h_d, or the secure shell daemon _s_s_h_d. If bbaasshh determines it
- is being run in this fashion, it reads and executes commands from
- _~_/_._b_a_s_h_r_c, if that file exists and is readable. It will not do this if
- invoked as sshh. The ----nnoorrcc option may be used to inhibit this behavior,
- and the ----rrccffiillee option may be used to force another file to be read,
- but _r_s_h_d does not generally invoke the shell with those options or
- allow them to be specified.
+ connected to a network connection, as when executed by the remote shell
+ daemon, usually _r_s_h_d, or the secure shell daemon _s_s_h_d. If bbaasshh deter-
+ mines it is being run in this fashion, it reads and executes commands
+ from _~_/_._b_a_s_h_r_c, if that file exists and is readable. It will not do
+ this if invoked as sshh. The ----nnoorrcc option may be used to inhibit this
+ behavior, and the ----rrccffiillee option may be used to force another file to
+ be read, but _r_s_h_d does not generally invoke the shell with those
+ options or allow them to be specified.
If the shell is started with the effective user (group) id not equal to
the real user (group) id, and the --pp option is not supplied, no startup
files are read, shell functions are not inherited from the environment,
- the SSHHEELLLLOOPPTTSS, BBAASSHHOOPPTTSS, CCDDPPAATTHH, and GGLLOOBBIIGGNNOORREE variables, if they
- appear in the environment, are ignored, and the effective user id is
- set to the real user id. If the --pp option is supplied at invocation,
- the startup behavior is the same, but the effective user id is not
+ the SSHHEELLLLOOPPTTSS, BBAASSHHOOPPTTSS, CCDDPPAATTHH, and GGLLOOBBIIGGNNOORREE variables, if they
+ appear in the environment, are ignored, and the effective user id is
+ set to the real user id. If the --pp option is supplied at invocation,
+ the startup behavior is the same, but the effective user id is not
reset.
DDEEFFIINNIITTIIOONNSS
- The following definitions are used throughout the rest of this docu-
+ The following definitions are used throughout the rest of this docu-
ment.
bbllaannkk A space or tab.
- wwoorrdd A sequence of characters considered as a single unit by the
+ wwoorrdd A sequence of characters considered as a single unit by the
shell. Also known as a ttookkeenn.
- nnaammee A _w_o_r_d consisting only of alphanumeric characters and under-
- scores, and beginning with an alphabetic character or an under-
+ nnaammee A _w_o_r_d consisting only of alphanumeric characters and under-
+ scores, and beginning with an alphabetic character or an under-
score. Also referred to as an iiddeennttiiffiieerr.
mmeettaacchhaarraacctteerr
- A character that, when unquoted, separates words. One of the
+ A character that, when unquoted, separates words. One of the
following:
|| && ;; (( )) << >> ssppaaccee ttaabb
ccoonnttrrooll ooppeerraattoorr
@@ -223,52 +222,59 @@ DDEEFFIINNIITTIIOONNSS
RREESSEERRVVEEDD WWOORRDDSS
_R_e_s_e_r_v_e_d _w_o_r_d_s are words that have a special meaning to the shell. The
following words are recognized as reserved when unquoted and either the
- first word of a simple command (see SSHHEELLLL GGRRAAMMMMAARR below) or the third
+ first word of a simple command (see SSHHEELLLL GGRRAAMMMMAARR below) or the third
word of a ccaassee or ffoorr command:
- !! ccaassee ddoo ddoonnee eelliiff eellssee eessaacc ffii ffoorr ffuunnccttiioonn iiff iinn sseelleecctt tthheenn uunnttiill
+ !! ccaassee ddoo ddoonnee eelliiff eellssee eessaacc ffii ffoorr ffuunnccttiioonn iiff iinn sseelleecctt tthheenn uunnttiill
wwhhiillee {{ }} ttiimmee [[[[ ]]]]
SSHHEELLLL GGRRAAMMMMAARR
SSiimmppllee CCoommmmaannddss
- A _s_i_m_p_l_e _c_o_m_m_a_n_d is a sequence of optional variable assignments fol-
- lowed by bbllaannkk-separated words and redirections, and terminated by a
+ A _s_i_m_p_l_e _c_o_m_m_a_n_d is a sequence of optional variable assignments fol-
+ lowed by bbllaannkk-separated words and redirections, and terminated by a
_c_o_n_t_r_o_l _o_p_e_r_a_t_o_r. The first word specifies the command to be executed,
- and is passed as argument zero. The remaining words are passed as
+ and is passed as argument zero. The remaining words are passed as
arguments to the invoked command.
- The return value of a _s_i_m_p_l_e _c_o_m_m_a_n_d is its exit status, or 128+_n if
+ The return value of a _s_i_m_p_l_e _c_o_m_m_a_n_d is its exit status, or 128+_n if
the command is terminated by signal _n.
PPiippeelliinneess
- A _p_i_p_e_l_i_n_e is a sequence of one or more commands separated by one of
+ A _p_i_p_e_l_i_n_e is a sequence of one or more commands separated by one of
the control operators || or ||&&. The format for a pipeline is:
[ttiimmee [--pp]] [ ! ] _c_o_m_m_a_n_d [ [|||||&&] _c_o_m_m_a_n_d_2 ... ]
- The standard output of _c_o_m_m_a_n_d is connected via a pipe to the standard
- input of _c_o_m_m_a_n_d_2. This connection is performed before any redirec-
+ The standard output of _c_o_m_m_a_n_d is connected via a pipe to the standard
+ input of _c_o_m_m_a_n_d_2. This connection is performed before any redirec-
tions specified by the command (see RREEDDIIRREECCTTIIOONN below). If ||&& is used,
the standard error of _c_o_m_m_a_n_d is connected to _c_o_m_m_a_n_d_2's standard input
- through the pipe; it is shorthand for 22>>&&11 ||. This implicit redirect-
+ through the pipe; it is shorthand for 22>>&&11 ||. This implicit redirect-
ion of the standard error is performed after any redirections specified
by the command.
The return status of a pipeline is the exit status of the last command,
- unless the ppiippeeffaaiill option is enabled. If ppiippeeffaaiill is enabled, the
- pipeline's return status is the value of the last (rightmost) command
- to exit with a non-zero status, or zero if all commands exit success-
+ unless the ppiippeeffaaiill option is enabled. If ppiippeeffaaiill is enabled, the
+ pipeline's return status is the value of the last (rightmost) command
+ to exit with a non-zero status, or zero if all commands exit success-
fully. If the reserved word !! precedes a pipeline, the exit status of
- that pipeline is the logical negation of the exit status as described
- above. The shell waits for all commands in the pipeline to terminate
+ that pipeline is the logical negation of the exit status as described
+ above. The shell waits for all commands in the pipeline to terminate
before returning a value.
- If the ttiimmee reserved word precedes a pipeline, the elapsed as well as
- user and system time consumed by its execution are reported when the
- pipeline terminates. The --pp option changes the output format to that
- specified by POSIX. The TTIIMMEEFFOORRMMAATT variable may be set to a format
- string that specifies how the timing information should be displayed;
- see the description of TTIIMMEEFFOORRMMAATT under SShheellll VVaarriiaabblleess below.
+ If the ttiimmee reserved word precedes a pipeline, the elapsed as well as
+ user and system time consumed by its execution are reported when the
+ pipeline terminates. The --pp option changes the output format to that
+ specified by POSIX. When the shell is in _p_o_s_i_x _m_o_d_e, it does not rec-
+ ognize ttiimmee as a reserved word if the next token begins with a `-'.
+ The TTIIMMEEFFOORRMMAATT variable may be set to a format string that specifies
+ how the timing information should be displayed; see the description of
+ TTIIMMEEFFOORRMMAATT under SShheellll VVaarriiaabblleess below.
+
+ When the shell is in _p_o_s_i_x _m_o_d_e, ttiimmee may be followed by a newline. In
+ this case, the shell displays the total user and system time consumed
+ by the shell and its children. The TTIIMMEEFFOORRMMAATT variable may be used to
+ specify the format of the time information.
Each command in a pipeline is executed as a separate process (i.e., in
a subshell).
@@ -345,7 +351,7 @@ SSHHEELLLL GGRRAAMMMMAARR
tional operators such as --ff must be unquoted to be recognized as
primaries.
- When used with [[[[, The << and >> operators sort lexicographically
+ When used with [[[[, the << and >> operators sort lexicographically
using the current locale.
When the ==== and !!== operators are used, the string to the right
@@ -458,117 +464,119 @@ SSHHEELLLL GGRRAAMMMMAARR
tus of the last command executed, or zero if no condition tested
true.
- wwhhiillee _l_i_s_t; ddoo _l_i_s_t; ddoonnee
- uunnttiill _l_i_s_t; ddoo _l_i_s_t; ddoonnee
- The wwhhiillee command continuously executes the ddoo _l_i_s_t as long as
- the last command in _l_i_s_t returns an exit status of zero. The
- uunnttiill command is identical to the wwhhiillee command, except that the
- test is negated; the ddoo _l_i_s_t is executed as long as the last
- command in _l_i_s_t returns a non-zero exit status. The exit status
- of the wwhhiillee and uunnttiill commands is the exit status of the last
- ddoo _l_i_s_t command executed, or zero if none was executed.
+ wwhhiillee _l_i_s_t_-_1; ddoo _l_i_s_t_-_2; ddoonnee
+ uunnttiill _l_i_s_t_-_1; ddoo _l_i_s_t_-_2; ddoonnee
+ The wwhhiillee command continuously executes the list _l_i_s_t_-_2 as long
+ as the last command in the list _l_i_s_t_-_1 returns an exit status of
+ zero. The uunnttiill command is identical to the wwhhiillee command,
+ except that the test is negated; _l_i_s_t_-_2 is executed as long as
+ the last command in _l_i_s_t_-_1 returns a non-zero exit status. The
+ exit status of the wwhhiillee and uunnttiill commands is the exit status
+ of the last command executed in _l_i_s_t_-_2, or zero if none was exe-
+ cuted.
CCoopprroocceesssseess
A _c_o_p_r_o_c_e_s_s is a shell command preceded by the ccoopprroocc reserved word. A
- coprocess is executed asynchronously in a subshell, as if the command
- had been terminated with the && control operator, with a two-way pipe
+ coprocess is executed asynchronously in a subshell, as if the command
+ had been terminated with the && control operator, with a two-way pipe
established between the executing shell and the coprocess.
The format for a coprocess is:
ccoopprroocc [_N_A_M_E] _c_o_m_m_a_n_d [_r_e_d_i_r_e_c_t_i_o_n_s]
- This creates a coprocess named _N_A_M_E. If _N_A_M_E is not supplied, the
+ This creates a coprocess named _N_A_M_E. If _N_A_M_E is not supplied, the
default name is _C_O_P_R_O_C. _N_A_M_E must not be supplied if _c_o_m_m_a_n_d is a _s_i_m_-
_p_l_e _c_o_m_m_a_n_d (see above); otherwise, it is interpreted as the first word
- of the simple command. When the coproc is executed, the shell creates
- an array variable (see AArrrraayyss below) named _N_A_M_E in the context of the
- executing shell. The standard output of _c_o_m_m_a_n_d is connected via a
- pipe to a file descriptor in the executing shell, and that file
- descriptor is assigned to _N_A_M_E[0]. The standard input of _c_o_m_m_a_n_d is
- connected via a pipe to a file descriptor in the executing shell, and
- that file descriptor is assigned to _N_A_M_E[1]. This pipe is established
- before any redirections specified by the command (see RREEDDIIRREECCTTIIOONN
- below). The file descriptors can be utilized as arguments to shell
- commands and redirections using standard word expansions. The process
- id of the shell spawned to execute the coprocess is available as the
- value of the variable _N_A_M_E_PID. The wwaaiitt builtin command may be used
+ of the simple command. When the coproc is executed, the shell creates
+ an array variable (see AArrrraayyss below) named _N_A_M_E in the context of the
+ executing shell. The standard output of _c_o_m_m_a_n_d is connected via a
+ pipe to a file descriptor in the executing shell, and that file
+ descriptor is assigned to _N_A_M_E[0]. The standard input of _c_o_m_m_a_n_d is
+ connected via a pipe to a file descriptor in the executing shell, and
+ that file descriptor is assigned to _N_A_M_E[1]. This pipe is established
+ before any redirections specified by the command (see RREEDDIIRREECCTTIIOONN
+ below). The file descriptors can be utilized as arguments to shell
+ commands and redirections using standard word expansions. The process
+ ID of the shell spawned to execute the coprocess is available as the
+ value of the variable _N_A_M_E_PID. The wwaaiitt builtin command may be used
to wait for the coprocess to terminate.
The return status of a coprocess is the exit status of _c_o_m_m_a_n_d.
SShheellll FFuunnccttiioonn DDeeffiinniittiioonnss
- 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.
+ 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:
- [ ffuunnccttiioonn ] _n_a_m_e () _c_o_m_p_o_u_n_d_-_c_o_m_m_a_n_d [_r_e_d_i_r_e_c_t_i_o_n]
- This defines a function named _n_a_m_e. The reserved word ffuunnccttiioonn
- is optional. If the ffuunnccttiioonn reserved word is supplied, the
- parentheses are optional. The _b_o_d_y of the function is the com-
- pound command _c_o_m_p_o_u_n_d_-_c_o_m_m_a_n_d (see CCoommppoouunndd CCoommmmaannddss above).
- That command is usually a _l_i_s_t of commands between { and }, but
- may be any command listed under CCoommppoouunndd CCoommmmaannddss above. _c_o_m_-
+ _n_a_m_e () _c_o_m_p_o_u_n_d_-_c_o_m_m_a_n_d [_r_e_d_i_r_e_c_t_i_o_n]
+ ffuunnccttiioonn _n_a_m_e [()] _c_o_m_p_o_u_n_d_-_c_o_m_m_a_n_d [_r_e_d_i_r_e_c_t_i_o_n]
+ This defines a function named _n_a_m_e. The reserved word ffuunnccttiioonn
+ is optional. If the ffuunnccttiioonn reserved word is supplied, the
+ parentheses are optional. The _b_o_d_y of the function is the com-
+ pound command _c_o_m_p_o_u_n_d_-_c_o_m_m_a_n_d (see CCoommppoouunndd CCoommmmaannddss above).
+ That command is usually a _l_i_s_t of commands between { and }, but
+ may be any command listed under CCoommppoouunndd CCoommmmaannddss above. _c_o_m_-
_p_o_u_n_d_-_c_o_m_m_a_n_d is executed whenever _n_a_m_e is specified as the name
- of a simple command. Any redirections (see RREEDDIIRREECCTTIIOONN below)
- specified when a function is defined are performed when the
- function is executed. The exit status of a function definition
+ of a simple command. Any redirections (see RREEDDIIRREECCTTIIOONN below)
+ specified when a function is defined are performed when the
+ function is executed. 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
+ a function is the exit status of the last command executed in
the body. (See FFUUNNCCTTIIOONNSS below.)
CCOOMMMMEENNTTSS
In a non-interactive shell, or an interactive shell in which the iinntteerr--
- aaccttiivvee__ccoommmmeennttss option to the sshhoopptt builtin is enabled (see SSHHEELLLL
- BBUUIILLTTIINN CCOOMMMMAANNDDSS below), a word beginning with ## causes that word and
- all remaining characters on that line to be ignored. An interactive
- shell without the iinntteerraaccttiivvee__ccoommmmeennttss option enabled does not allow
+ aaccttiivvee__ccoommmmeennttss option to the sshhoopptt builtin is enabled (see SSHHEELLLL
+ BBUUIILLTTIINN CCOOMMMMAANNDDSS below), a word beginning with ## causes that word and
+ all remaining characters on that line to be ignored. An interactive
+ shell without the iinntteerraaccttiivvee__ccoommmmeennttss option enabled does not allow
comments. The iinntteerraaccttiivvee__ccoommmmeennttss option is on by default in interac-
tive shells.
QQUUOOTTIINNGG
- _Q_u_o_t_i_n_g is used to remove the special meaning of certain characters or
- words to the shell. Quoting can be used to disable special treatment
+ _Q_u_o_t_i_n_g 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.
- Each of the _m_e_t_a_c_h_a_r_a_c_t_e_r_s listed above under DDEEFFIINNIITTIIOONNSS has special
+ Each of the _m_e_t_a_c_h_a_r_a_c_t_e_r_s listed above under DDEEFFIINNIITTIIOONNSS has special
meaning to the shell and must be quoted if it is to represent itself.
- When the command history expansion facilities are being used (see HHIISS--
+ When the command history expansion facilities are being used (see HHIISS--
TTOORRYY EEXXPPAANNSSIIOONN below), the _h_i_s_t_o_r_y _e_x_p_a_n_s_i_o_n character, usually !!, must
be quoted to prevent history expansion.
- There are three quoting mechanisms: the _e_s_c_a_p_e _c_h_a_r_a_c_t_e_r, single
+ There are three quoting mechanisms: the _e_s_c_a_p_e _c_h_a_r_a_c_t_e_r, single
quotes, and double quotes.
- A non-quoted backslash (\\) is the _e_s_c_a_p_e _c_h_a_r_a_c_t_e_r. It preserves the
+ A non-quoted backslash (\\) is the _e_s_c_a_p_e _c_h_a_r_a_c_t_e_r. It preserves the
literal value of the next character that follows, with the exception of
- <newline>. If a \\<newline> pair appears, and the backslash is not
- itself quoted, the \\<newline> is treated as a line continuation (that
+ <newline>. If a \\<newline> pair appears, and the backslash is not
+ itself quoted, the \\<newline> is treated as a line continuation (that
is, it is removed from the input stream and effectively ignored).
- Enclosing characters in single quotes preserves the literal value of
+ 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.
- Enclosing characters in double quotes preserves the literal value of
- all characters within the quotes, with the exception of $$, ``, \\, and,
- when history expansion is enabled, !!. The characters $$ and `` retain
- their special meaning within double quotes. The backslash retains its
- special meaning only when followed by one of the following characters:
- $$, ``, "", \\, or <<nneewwlliinnee>>. A double quote may be quoted within double
+ Enclosing characters in double quotes preserves the literal value of
+ all characters within the quotes, with the exception of $$, ``, \\, and,
+ when history expansion is enabled, !!. The characters $$ and `` retain
+ their special meaning within double quotes. The backslash retains its
+ special meaning only when followed by one of the following characters:
+ $$, ``, "", \\, or <<nneewwlliinnee>>. A double quote may be quoted within double
quotes by preceding it with a backslash. If enabled, history expansion
- will be performed unless an !! appearing in double quotes is escaped
+ will be performed unless an !! appearing in double quotes is escaped
using a backslash. The backslash preceding the !! is not removed.
- The special parameters ** and @@ have special meaning when in double
+ The special parameters ** and @@ have special meaning when in double
quotes (see PPAARRAAMMEETTEERRSS below).
Words of the form $$'_s_t_r_i_n_g' are treated specially. The word expands to
- _s_t_r_i_n_g, with backslash-escaped characters replaced as specified by the
- ANSI C standard. Backslash escape sequences, if present, are decoded
+ _s_t_r_i_n_g, with backslash-escaped characters replaced as specified by the
+ ANSI C standard. Backslash escape sequences, if present, are decoded
as follows:
\\aa alert (bell)
\\bb backspace
@@ -582,178 +590,182 @@ QQUUOOTTIINNGG
\\\\ backslash
\\'' single quote
\\"" double quote
- \\_n_n_n the eight-bit character whose value is the octal value
+ \\_n_n_n the eight-bit character whose value is the octal value
_n_n_n (one to three digits)
- \\xx_H_H the eight-bit character whose value is the hexadecimal
+ \\xx_H_H the eight-bit character whose value is the hexadecimal
value _H_H (one or two hex digits)
+ \\uu_H_H_H_H the Unicode (ISO/IEC 10646) character whose value is the
+ hexadecimal value _H_H_H_H (one to four hex digits)
+ \\UU_H_H_H_H_H_H_H_H
+ the Unicode (ISO/IEC 10646) character whose value is the
+ hexadecimal value _H_H_H_H_H_H_H_H (one to eight hex digits)
\\cc_x a control-_x character
- The expanded result is single-quoted, as if the dollar sign had not
+ The expanded result is single-quoted, as if the dollar sign had not
been present.
A double-quoted string preceded by a dollar sign ($$"_s_t_r_i_n_g") will cause
- the string to be translated according to the current locale. If the
- current locale is CC or PPOOSSIIXX, the dollar sign is ignored. If the
+ the string to be translated according to the current locale. If the
+ current locale is CC or PPOOSSIIXX, the dollar sign is ignored. If the
string is translated and replaced, the replacement is double-quoted.
PPAARRAAMMEETTEERRSS
- A _p_a_r_a_m_e_t_e_r is an entity that stores values. It can be a _n_a_m_e, a num-
+ A _p_a_r_a_m_e_t_e_r is an entity that stores values. It can be a _n_a_m_e, a num-
ber, or one of the special characters listed below under SSppeecciiaall PPaarraamm--
- eetteerrss. A _v_a_r_i_a_b_l_e is a parameter denoted by a _n_a_m_e. A variable has a
- _v_a_l_u_e and zero or more _a_t_t_r_i_b_u_t_e_s. Attributes are assigned using the
- ddeeccllaarree builtin command (see ddeeccllaarree below in SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS).
+ eetteerrss. A _v_a_r_i_a_b_l_e is a parameter denoted by a _n_a_m_e. A variable has a
+ _v_a_l_u_e and zero or more _a_t_t_r_i_b_u_t_e_s. Attributes are assigned using the
+ ddeeccllaarree builtin command (see ddeeccllaarree below in SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS).
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
+ a valid value. Once a variable is set, it may be unset only by using
the uunnsseett builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below).
A _v_a_r_i_a_b_l_e may be assigned to by a statement of the form
_n_a_m_e=[_v_a_l_u_e]
- If _v_a_l_u_e is not given, the variable is assigned the null string. All
- _v_a_l_u_e_s undergo tilde expansion, parameter and variable expansion, com-
- mand substitution, arithmetic expansion, and quote removal (see EEXXPPAANN--
+ If _v_a_l_u_e is not given, the variable is assigned the null string. All
+ _v_a_l_u_e_s undergo tilde expansion, parameter and variable expansion, com-
+ mand substitution, arithmetic expansion, and quote removal (see EEXXPPAANN--
SSIIOONN below). If the variable has its iinntteeggeerr attribute set, then _v_a_l_u_e
is evaluated as an arithmetic expression even if the $((...)) expansion
- is not used (see AArriitthhmmeettiicc EExxppaannssiioonn below). Word splitting is not
- performed, with the exception of ""$$@@"" as explained below under SSppeecciiaall
- PPaarraammeetteerrss. Pathname expansion is not performed. Assignment state-
- ments may also appear as arguments to the aalliiaass, ddeeccllaarree, ttyyppeesseett,
+ is not used (see AArriitthhmmeettiicc EExxppaannssiioonn below). Word splitting is not
+ performed, with the exception of ""$$@@"" as explained below under SSppeecciiaall
+ PPaarraammeetteerrss. Pathname expansion is not performed. Assignment state-
+ ments may also appear as arguments to the aalliiaass, ddeeccllaarree, ttyyppeesseett,
eexxppoorrtt, rreeaaddoonnllyy, and llooccaall builtin commands.
- In the context where an assignment statement is assigning a value to a
+ In the context where an assignment statement is assigning a value to a
shell variable or array index, the += operator can be used to append to
or add to the variable's previous value. When += is applied to a vari-
- able for which the integer attribute has been set, _v_a_l_u_e is evaluated
- as an arithmetic expression and added to the variable's current value,
+ able for which the _i_n_t_e_g_e_r attribute has been set, _v_a_l_u_e is evaluated
+ as an arithmetic expression and added to the variable's current value,
which is also evaluated. When += is applied to an array variable using
- compound assignment (see AArrrraayyss below), the variable's value is not
+ compound assignment (see AArrrraayyss below), the variable's value is not
unset (as it is when using =), and new values are appended to the array
- beginning at one greater than the array's maximum index (for indexed
+ beginning at one greater than the array's maximum index (for indexed
arrays) or added as additional key-value pairs in an associative array.
- When applied to a string-valued variable, _v_a_l_u_e is expanded and
+ When applied to a string-valued variable, _v_a_l_u_e is expanded and
appended to the variable's value.
PPoossiittiioonnaall PPaarraammeetteerrss
- A _p_o_s_i_t_i_o_n_a_l _p_a_r_a_m_e_t_e_r is a parameter denoted by one or more digits,
+ A _p_o_s_i_t_i_o_n_a_l _p_a_r_a_m_e_t_e_r is a parameter denoted by one or more digits,
other than the single digit 0. Positional parameters are assigned from
- the shell's arguments when it is invoked, and may be reassigned using
- the sseett builtin command. Positional parameters may not be assigned to
- with assignment statements. The positional parameters are temporarily
+ the shell's arguments when it is invoked, and may be reassigned using
+ the sseett 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 FFUUNNCCTTIIOONNSS below).
- When a positional parameter consisting of more than a single digit is
+ When a positional parameter consisting of more than a single digit is
expanded, it must be enclosed in braces (see EEXXPPAANNSSIIOONN below).
SSppeecciiaall PPaarraammeetteerrss
- The shell treats several parameters specially. These parameters may
+ The shell treats several parameters specially. These parameters may
only be referenced; assignment to them is not allowed.
- ** Expands to the positional parameters, starting from one. When
- the expansion occurs within double quotes, it expands to a sin-
+ ** Expands to the positional parameters, starting from one. When
+ the expansion occurs within double quotes, it expands to a sin-
gle word with the value of each parameter separated by the first
character of the IIFFSS special variable. That is, "$$**" is equiva-
lent to "$$11_c$$22_c......", where _c is the first character of the value
- of the IIFFSS variable. If IIFFSS is unset, the parameters are sepa-
- rated by spaces. If IIFFSS is null, the parameters are joined
+ of the IIFFSS variable. If IIFFSS is unset, the parameters are sepa-
+ rated by spaces. If IIFFSS is null, the parameters are joined
without intervening separators.
- @@ Expands to the positional parameters, starting from one. When
+ @@ Expands to the positional parameters, starting from one. When
the expansion occurs within double quotes, each parameter
expands to a separate word. That is, "$$@@" is equivalent to "$$11"
- "$$22" ... If the double-quoted expansion occurs within a word,
- the expansion of the first parameter is joined with the begin-
- ning part of the original word, and the expansion of the last
- parameter is joined with the last part of the original word.
- When there are no positional parameters, "$$@@" and $$@@ expand to
+ "$$22" ... If the double-quoted expansion occurs within a word,
+ the expansion of the first parameter is joined with the begin-
+ ning part of the original word, and the expansion of the last
+ parameter is joined with the last part of the original word.
+ When there are no positional parameters, "$$@@" and $$@@ expand to
nothing (i.e., they are removed).
## Expands to the number of positional parameters in decimal.
- ?? Expands to the exit status of the most recently executed fore-
+ ?? Expands to the exit status of the most recently executed fore-
ground pipeline.
- -- Expands to the current option flags as specified upon invoca-
- tion, by the sseett builtin command, or those set by the shell
+ -- Expands to the current option flags as specified upon invoca-
+ tion, by the sseett builtin command, or those set by the shell
itself (such as the --ii option).
- $$ Expands to the process ID of the shell. In a () subshell, it
- expands to the process ID of the current shell, not the sub-
+ $$ Expands to the process ID of the shell. In a () subshell, it
+ expands to the process ID of the current shell, not the sub-
shell.
- !! Expands to the process ID of the most recently executed back-
+ !! Expands to the process ID of the most recently executed back-
ground (asynchronous) command.
- 00 Expands to the name of the shell or shell script. This is set
+ 00 Expands to the name of the shell or shell script. This is set
at shell initialization. If bbaasshh is invoked with a file of com-
- mands, $$00 is set to the name of that file. If bbaasshh is started
- with the --cc option, then $$00 is set to the first argument after
- the string to be executed, if one is present. Otherwise, it is
- set to the file name used to invoke bbaasshh, as given by argument
+ mands, $$00 is set to the name of that file. If bbaasshh is started
+ with the --cc option, then $$00 is set to the first argument after
+ the string to be executed, if one is present. Otherwise, it is
+ set to the file name used to invoke bbaasshh, as given by argument
zero.
- __ At shell startup, set to the absolute pathname used to invoke
- the shell or shell script being executed as passed in the envi-
- ronment or argument list. Subsequently, expands to the last
- argument to the previous command, after expansion. Also set to
- the full pathname used to invoke each command executed and
+ __ At shell startup, set to the absolute pathname used to invoke
+ the shell or shell script being executed as passed in the envi-
+ ronment or argument list. Subsequently, expands to the last
+ argument to the previous command, after expansion. Also set to
+ the full pathname used to invoke each command executed and
placed in the environment exported to that command. When check-
- ing mail, this parameter holds the name of the mail file cur-
+ ing mail, this parameter holds the name of the mail file cur-
rently being checked.
SShheellll VVaarriiaabblleess
The following variables are set by the shell:
- BBAASSHH Expands to the full file name used to invoke this instance of
+ BBAASSHH Expands to the full file name used to invoke this instance of
bbaasshh.
BBAASSHHOOPPTTSS
- A colon-separated list of enabled shell options. Each word in
- the list is a valid argument for the --ss option to the sshhoopptt
+ A colon-separated list of enabled shell options. Each word in
+ the list is a valid argument for the --ss option to the sshhoopptt
builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). The options
- appearing in BBAASSHHOOPPTTSS are those reported as _o_n by sshhoopptt. If
- this variable is in the environment when bbaasshh starts up, each
- shell option in the list will be enabled before reading any
+ appearing in BBAASSHHOOPPTTSS are those reported as _o_n by sshhoopptt. If
+ this variable is in the environment when bbaasshh starts up, each
+ shell option in the list will be enabled before reading any
startup files. This variable is read-only.
BBAASSHHPPIIDD
- Expands to the process id of the current bbaasshh process. This
- differs from $$$$ under certain circumstances, such as subshells
+ Expands to the process ID of the current bbaasshh process. This
+ differs from $$$$ under certain circumstances, such as subshells
that do not require bbaasshh to be re-initialized.
BBAASSHH__AALLIIAASSEESS
- An associative array variable whose members correspond to the
- internal list of aliases as maintained by the aalliiaass builtin Ele-
- ments added to this array appear in the alias list; unsetting
- array elements cause aliases to be removed from the alias list.
+ An associative array variable whose members correspond to the
+ internal list of aliases as maintained by the aalliiaass builtin.
+ Elements added to this array appear in the alias list; unsetting
+ array elements cause aliases to be removed from the alias list.
BBAASSHH__AARRGGCC
- An array variable whose values are the number of parameters in
+ An array variable whose values are the number of parameters in
each frame of the current bbaasshh execution call stack. The number
- of parameters to the current subroutine (shell function or
- script executed with .. or ssoouurrccee) is at the top of the stack.
- When a subroutine is executed, the number of parameters passed
+ of parameters to the current subroutine (shell function or
+ script executed with .. or ssoouurrccee) is at the top of the stack.
+ When a subroutine is executed, the number of parameters passed
is pushed onto BBAASSHH__AARRGGCC. The shell sets BBAASSHH__AARRGGCC only when in
- extended debugging mode (see the description of the eexxttddeebbuugg
+ extended debugging mode (see the description of the eexxttddeebbuugg
option to the sshhoopptt builtin below)
BBAASSHH__AARRGGVV
- An array variable containing all of the parameters in the cur-
+ An array variable containing all of the parameters in the cur-
rent bbaasshh execution call stack. The final parameter of the last
- subroutine call is at the top of the stack; the first parameter
+ subroutine call is at the top of the stack; the first parameter
of the initial call is at the bottom. When a subroutine is exe-
- cuted, the parameters supplied are pushed onto BBAASSHH__AARRGGVV. The
- shell sets BBAASSHH__AARRGGVV only when in extended debugging mode (see
- the description of the eexxttddeebbuugg option to the sshhoopptt builtin
+ cuted, the parameters supplied are pushed onto BBAASSHH__AARRGGVV. The
+ shell sets BBAASSHH__AARRGGVV only when in extended debugging mode (see
+ the description of the eexxttddeebbuugg option to the sshhoopptt builtin
below)
BBAASSHH__CCMMDDSS
- An associative array variable whose members correspond to the
- internal hash table of commands as maintained by the hhaasshh
+ An associative array variable whose members correspond to the
+ internal hash table of commands as maintained by the hhaasshh
builtin. Elements added to this array appear in the hash table;
- unsetting array elements cause commands to be removed from the
+ unsetting array elements cause commands to be removed from the
hash table.
BBAASSHH__CCOOMMMMAANNDD
- The command currently being executed or about to be executed,
+ 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
+ in which case it is the command executing at the time of the
trap.
BBAASSHH__EEXXEECCUUTTIIOONN__SSTTRRIINNGG
The command argument to the --cc invocation option.
BBAASSHH__LLIINNEENNOO
- An array variable whose members are the line numbers in source
- files corresponding to each member of FFUUNNCCNNAAMMEE.
- $${{BBAASSHH__LLIINNEENNOO[[_$_i]]}} is the line number in the source file where
- $${{FFUUNNCCNNAAMMEE[[_$_i]]}} was called (or $${{BBAASSHH__LLIINNEENNOO[[_$_i_-_1]]}} if refer-
- enced within another shell function). The corresponding source
- file name is $${{BBAASSHH__SSOOUURRCCEE[[_$_i]]}}. Use LLIINNEENNOO to obtain the cur-
- rent line number.
+ An array variable whose members are the line numbers in source
+ files where each corresponding member of FFUUNNCCNNAAMMEE was invoked.
+ $${{BBAASSHH__LLIINNEENNOO[[_$_i]]}} is the line number in the source file
+ ($${{BBAASSHH__SSOOUURRCCEE[[_$_i_+_1]]}}) where $${{FFUUNNCCNNAAMMEE[[_$_i]]}} was called (or
+ $${{BBAASSHH__LLIINNEENNOO[[_$_i_-_1]]}} if referenced within another shell func-
+ tion). Use LLIINNEENNOO to obtain the current line number.
BBAASSHH__RREEMMAATTCCHH
An array variable whose members are assigned by the ==~~ binary
operator to the [[[[ conditional command. The element with index
@@ -762,30 +774,33 @@ PPAARRAAMMEETTEERRSS
string matching the _nth parenthesized subexpression. This vari-
able is read-only.
BBAASSHH__SSOOUURRCCEE
- An array variable whose members are the source filenames corre-
- sponding to the elements in the FFUUNNCCNNAAMMEE array variable.
+ An array variable whose members are the source filenames where
+ the corresponding shell function names in the FFUUNNCCNNAAMMEE array
+ variable are defined. The shell function $${{FFUUNNCCNNAAMMEE[[_$_i]]}} is
+ defined in the file $${{BBAASSHH__SSOOUURRCCEE[[_$_i]]}} and called from
+ $${{BBAASSHH__SSOOUURRCCEE[[_$_i_+_1]]}}.
BBAASSHH__SSUUBBSSHHEELLLL
- Incremented by one each time a subshell or subshell environment
+ Incremented by one each time a subshell or subshell environment
is spawned. The initial value is 0.
BBAASSHH__VVEERRSSIINNFFOO
A readonly array variable whose members hold version information
- for this instance of bbaasshh. The values assigned to the array
+ for this instance of bbaasshh. The values assigned to the array
members are as follows:
- BBAASSHH__VVEERRSSIINNFFOO[[0]] The major version number (the _r_e_l_e_a_s_e).
- BBAASSHH__VVEERRSSIINNFFOO[[1]] The minor version number (the _v_e_r_s_i_o_n).
+ BBAASSHH__VVEERRSSIINNFFOO[[0]] The major version number (the _r_e_l_e_a_s_e).
+ BBAASSHH__VVEERRSSIINNFFOO[[1]] The minor version number (the _v_e_r_s_i_o_n).
BBAASSHH__VVEERRSSIINNFFOO[[2]] The patch level.
BBAASSHH__VVEERRSSIINNFFOO[[3]] The build version.
BBAASSHH__VVEERRSSIINNFFOO[[4]] The release status (e.g., _b_e_t_a_1).
BBAASSHH__VVEERRSSIINNFFOO[[5]] The value of MMAACCHHTTYYPPEE.
BBAASSHH__VVEERRSSIIOONN
- Expands to a string describing the version of this instance of
+ Expands to a string describing the version of this instance of
bbaasshh.
CCOOMMPP__CCWWOORRDD
- An index into $${{CCOOMMPP__WWOORRDDSS}} of the word containing the current
+ An index into $${{CCOOMMPP__WWOORRDDSS}} of the word containing the current
cursor position. This variable is available only in shell func-
- tions invoked by the programmable completion facilities (see
+ tions invoked by the programmable completion facilities (see
PPrrooggrraammmmaabbllee CCoommpplleettiioonn below).
CCOOMMPP__KKEEYY
@@ -793,98 +808,115 @@ PPAARRAAMMEETTEERRSS
rent completion function.
CCOOMMPP__LLIINNEE
- The current command line. This variable is available only in
- shell functions and external commands invoked by the pro-
- grammable completion facilities (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn
+ The current command line. This variable is available only in
+ shell functions and external commands invoked by the pro-
+ grammable completion facilities (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn
below).
CCOOMMPP__PPOOIINNTT
- The index of the current cursor position relative to the begin-
- ning of the current command. If the current cursor position is
+ The index of the current cursor position relative to the begin-
+ ning 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 $${{##CCOOMMPP__LLIINNEE}}. This variable is available only in
- shell functions and external commands invoked by the pro-
- grammable completion facilities (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn
+ equal to $${{##CCOOMMPP__LLIINNEE}}. This variable is available only in
+ shell functions and external commands invoked by the pro-
+ grammable completion facilities (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn
below).
CCOOMMPP__TTYYPPEE
- Set to an integer value corresponding to the type of completion
- attempted that caused a completion function to be called: _T_A_B,
- for normal completion, _?, for listing completions after succes-
- sive tabs, _!, for listing alternatives on partial word comple-
- tion, _@, to list completions if the word is not unmodified, or
- _%, for menu completion. This variable is available only in
- shell functions and external commands invoked by the pro-
- grammable completion facilities (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn
+ Set to an integer value corresponding to the type of completion
+ attempted that caused a completion function to be called: _T_A_B,
+ for normal completion, _?, for listing completions after succes-
+ sive tabs, _!, for listing alternatives on partial word comple-
+ tion, _@, to list completions if the word is not unmodified, or
+ _%, for menu completion. This variable is available only in
+ shell functions and external commands invoked by the pro-
+ grammable completion facilities (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn
below).
CCOOMMPP__WWOORRDDBBRREEAAKKSS
- The set of characters that the rreeaaddlliinnee library treats as word
- separators when performing word completion. If CCOOMMPP__WWOORRDDBBRREEAAKKSS
- is unset, it loses its special properties, even if it is subse-
+ The set of characters that the rreeaaddlliinnee library treats as word
+ separators when performing word completion. If CCOOMMPP__WWOORRDDBBRREEAAKKSS
+ is unset, it loses its special properties, even if it is subse-
quently reset.
CCOOMMPP__WWOORRDDSS
- An array variable (see AArrrraayyss below) consisting of the individ-
- ual words in the current command line. The line is split into
- words as rreeaaddlliinnee would split it, using CCOOMMPP__WWOORRDDBBRREEAAKKSS as
+ An array variable (see AArrrraayyss below) consisting of the individ-
+ ual words in the current command line. The line is split into
+ words as rreeaaddlliinnee would split it, using CCOOMMPP__WWOORRDDBBRREEAAKKSS as
described above. This variable is available only in shell func-
- tions invoked by the programmable completion facilities (see
+ tions invoked by the programmable completion facilities (see
PPrrooggrraammmmaabbllee CCoommpplleettiioonn below).
+ CCOOPPRROOCC An array variable (see AArrrraayyss below) created to hold the file
+ descriptors for output from and input to an unnamed coprocess
+ (see CCoopprroocceesssseess above).
+
DDIIRRSSTTAACCKK
An array variable (see AArrrraayyss below) containing the current con-
- tents of the directory stack. Directories appear in the stack
- in the order they are displayed by the ddiirrss builtin. Assigning
+ tents of the directory stack. Directories appear in the stack
+ in the order they are displayed by the ddiirrss builtin. Assigning
to members of this array variable may be used to modify directo-
- ries already in the stack, but the ppuusshhdd and ppooppdd builtins must
+ ries already in the stack, but the ppuusshhdd and ppooppdd builtins must
be used to add and remove directories. Assignment to this vari-
- able will not change the current directory. If DDIIRRSSTTAACCKK is
- unset, it loses its special properties, even if it is subse-
+ able will not change the current directory. If DDIIRRSSTTAACCKK is
+ unset, it loses its special properties, even if it is subse-
quently reset.
- EEUUIIDD Expands to the effective user ID of the current user, initial-
+ EEUUIIDD Expands to the effective user ID of the current user, initial-
ized at shell startup. This variable is readonly.
FFUUNNCCNNAAMMEE
- An array variable containing the names of all shell functions
+ 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 bot-
- tom-most element is "main". This variable exists only when a
- shell function is executing. Assignments to FFUUNNCCNNAAMMEE have no
- effect and return an error status. If FFUUNNCCNNAAMMEE is unset, it
- loses its special properties, even if it is subsequently reset.
-
- GGRROOUUPPSS An array variable containing the list of groups of which the
- current user is a member. Assignments to GGRROOUUPPSS have no effect
- and return an error status. If GGRROOUUPPSS is unset, it loses its
+ tom-most element (the one with the highest index) is "main".
+ This variable exists only when a shell function is executing.
+ Assignments to FFUUNNCCNNAAMMEE have no effect and return an error sta-
+ tus. If FFUUNNCCNNAAMMEE is unset, it loses its special properties,
+ even if it is subsequently reset.
+
+ This variable can be used with BBAASSHH__LLIINNEENNOO and BBAASSHH__SSOOUURRCCEE.
+ Each element of FFUUNNCCNNAAMMEE has corresponding elements in
+ BBAASSHH__LLIINNEENNOO and BBAASSHH__SSOOUURRCCEE to describe the call stack. For
+ instance, $${{FFUUNNCCNNAAMMEE[[_$_i]]}} was called from the file
+ $${{BBAASSHH__SSOOUURRCCEE[[_$_i_+_1]]}} at line number $${{BBAASSHH__LLIINNEENNOO[[_$_i]]}}. The
+ ccaalllleerr builtin displays the current call stack using this infor-
+ mation.
+
+ GGRROOUUPPSS An array variable containing the list of groups of which the
+ current user is a member. Assignments to GGRROOUUPPSS have no effect
+ and return an error status. If GGRROOUUPPSS is unset, it loses its
special properties, even if it is subsequently reset.
HHIISSTTCCMMDD
The history number, or index in the history list, of the current
- command. If HHIISSTTCCMMDD is unset, it loses its special properties,
+ command. If HHIISSTTCCMMDD is unset, it loses its special properties,
even if it is subsequently reset.
HHOOSSTTNNAAMMEE
Automatically set to the name of the current host.
HHOOSSTTTTYYPPEE
- Automatically set to a string that uniquely describes the type
- of machine on which bbaasshh is executing. The default is system-
+ Automatically set to a string that uniquely describes the type
+ of machine on which bbaasshh is executing. The default is system-
dependent.
- LLIINNEENNOO 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
+ LLIINNEENNOO 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 LLIINNEENNOO is unset, it loses its special proper-
ties, even if it is subsequently reset.
MMAACCHHTTYYPPEE
- Automatically set to a string that fully describes the system
- type on which bbaasshh is executing, in the standard GNU _c_p_u_-_c_o_m_-
+ Automatically set to a string that fully describes the system
+ type on which bbaasshh is executing, in the standard GNU _c_p_u_-_c_o_m_-
_p_a_n_y_-_s_y_s_t_e_m format. The default is system-dependent.
+ MMAAPPFFIILLEE
+ An array variable (see AArrrraayyss below) created to hold the text
+ read by the mmaappffiillee builtin when no variable name is supplied.
+
OOLLDDPPWWDD The previous working directory as set by the ccdd command.
OOPPTTAARRGG The value of the last option argument processed by the ggeettooppttss
@@ -913,6 +945,14 @@ PPAARRAAMMEETTEERRSS
it loses its special properties, even if it is subsequently
reset.
+ RREEAADDLLIINNEE__LLIINNEE
+ The contents of the rreeaaddlliinnee line buffer, for use with "bind -x"
+ (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below).
+
+ RREEAADDLLIINNEE__PPOOIINNTT
+ The position of the insertion point in the rreeaaddlliinnee line buffer,
+ for use with "bind -x" (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below).
+
RREEPPLLYY Set to the line of input read by the rreeaadd builtin command when
no arguments are supplied.
@@ -948,144 +988,151 @@ PPAARRAAMMEETTEERRSS
subjected to parameter expansion, command substitution, and
arithmetic expansion before being interpreted as a file name.
PPAATTHH is not used to search for the resultant file name.
- CCDDPPAATTHH The search path for the ccdd command. This is a colon-separated
- list of directories in which the shell looks for destination
- directories specified by the ccdd command. A sample value is
- ".:~:/usr".
BBAASSHH__XXTTRRAACCEEFFDD
- If set to an integer corresponding to a valid file descriptor,
- bbaasshh will write the trace output generated when _s_e_t _-_x is
- enabled to that file descriptor. The file descriptor is closed
- when BBAASSHH__XXTTRRAACCEEFFDD is unset or assigned a new value. Unsetting
- BBAASSHH__XXTTRRAACCEEFFDD or assigning it the empty string causes the trace
- output to be sent to the standard error. Note that setting
+ If set to an integer corresponding to a valid file descriptor,
+ bbaasshh will write the trace output generated when _s_e_t _-_x is
+ enabled to that file descriptor. The file descriptor is closed
+ when BBAASSHH__XXTTRRAACCEEFFDD is unset or assigned a new value. Unsetting
+ BBAASSHH__XXTTRRAACCEEFFDD or assigning it the empty string causes the trace
+ output to be sent to the standard error. Note that setting
BBAASSHH__XXTTRRAACCEEFFDD to 2 (the standard error file descriptor) and then
unsetting it will result in the standard error being closed.
+ CCDDPPAATTHH The search path for the ccdd command. This is a colon-separated
+ list of directories in which the shell looks for destination
+ directories specified by the ccdd command. A sample value is
+ ".:~:/usr".
CCOOLLUUMMNNSS
- Used by the sseelleecctt builtin command to determine the terminal
+ Used by the sseelleecctt compound command to determine the terminal
width when printing selection lists. Automatically set upon
- receipt of a SIGWINCH.
+ receipt of a SSIIGGWWIINNCCHH.
CCOOMMPPRREEPPLLYY
An array variable from which bbaasshh reads the possible completions
generated by a shell function invoked by the programmable com-
pletion facility (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn below).
EEMMAACCSS If bbaasshh finds this variable in the environment when the shell
starts with value "t", it assumes that the shell is running in
- an emacs shell buffer and disables line editing.
+ an Emacs shell buffer and disables line editing.
+ EENNVV Similar to BBAASSHH__EENNVV; used when the shell is invoked in POSIX
+ mode.
FFCCEEDDIITT The default editor for the ffcc builtin command.
FFIIGGNNOORREE
- A colon-separated list of suffixes to ignore when performing
+ A colon-separated list of suffixes to ignore when performing
filename completion (see RREEAADDLLIINNEE below). A filename whose suf-
- fix matches one of the entries in FFIIGGNNOORREE is excluded from the
+ fix matches one of the entries in FFIIGGNNOORREE is excluded from the
list of matched filenames. A sample value is ".o:~".
+ FFUUNNCCNNEESSTT
+ If set to a numeric value greater than 0, defines a maximum
+ function nesting level. Function invocations that exceed this
+ nesting level will cause the current command to abort.
GGLLOOBBIIGGNNOORREE
A colon-separated list of patterns defining the set of filenames
to be ignored by pathname expansion. If a filename matched by a
- pathname expansion pattern also matches one of the patterns in
+ pathname expansion pattern also matches one of the patterns in
GGLLOOBBIIGGNNOORREE, it is removed from the list of matches.
HHIISSTTCCOONNTTRROOLL
- A colon-separated list of values controlling how commands are
- saved on the history list. If the list of values includes
- _i_g_n_o_r_e_s_p_a_c_e, lines which begin with a ssppaaccee character are not
- saved in the history list. A value of _i_g_n_o_r_e_d_u_p_s causes lines
+ A colon-separated list of values controlling how commands are
+ saved on the history list. If the list of values includes
+ _i_g_n_o_r_e_s_p_a_c_e, lines which begin with a ssppaaccee character are not
+ saved in the history list. A value of _i_g_n_o_r_e_d_u_p_s causes lines
matching the previous history entry to not be saved. A value of
_i_g_n_o_r_e_b_o_t_h is shorthand for _i_g_n_o_r_e_s_p_a_c_e and _i_g_n_o_r_e_d_u_p_s. A value
of _e_r_a_s_e_d_u_p_s 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 HHIISSTTCCOONNTTRROOLL is
- unset, or does not include a valid value, all lines read by the
+ to be removed from the history list before that line is saved.
+ Any value not in the above list is ignored. If HHIISSTTCCOONNTTRROOLL is
+ unset, or does not include a valid value, all lines read by the
shell parser are saved on the history list, subject to the value
- of HHIISSTTIIGGNNOORREE. The second and subsequent lines of a multi-line
- compound command are not tested, and are added to the history
+ of HHIISSTTIIGGNNOORREE. The second and subsequent lines of a multi-line
+ compound command are not tested, and are added to the history
regardless of the value of HHIISSTTCCOONNTTRROOLL.
HHIISSTTFFIILLEE
The name of the file in which command history is saved (see HHIISS--
- TTOORRYY below). The default value is _~_/_._b_a_s_h___h_i_s_t_o_r_y. If unset,
- the command history is not saved when an interactive shell
+ TTOORRYY below). The default value is _~_/_._b_a_s_h___h_i_s_t_o_r_y. If unset,
+ the command history is not saved when an interactive shell
exits.
HHIISSTTFFIILLEESSIIZZEE
The maximum number of lines contained in the history file. When
- this variable is assigned a value, the history file is trun-
- cated, if necessary, by removing the oldest entries, to contain
- no more than that number of lines. The default value is 500.
+ this variable is assigned a value, the history file is trun-
+ cated, if necessary, by removing the oldest entries, to contain
+ no more than that number of lines. The default value is 500.
The history file is also truncated to this size after writing it
when an interactive shell exits.
HHIISSTTIIGGNNOORREE
- A colon-separated list of patterns used to decide which command
- lines should be saved on the history list. Each pattern is
- anchored at the beginning of the line and must match the com-
- plete line (no implicit `**' is appended). Each pattern is
- tested against the line after the checks specified by HHIISSTTCCOONN--
- TTRROOLL are applied. In addition to the normal shell pattern
+ A colon-separated list of patterns used to decide which command
+ lines should be saved on the history list. Each pattern is
+ anchored at the beginning of the line and must match the com-
+ plete line (no implicit `**' is appended). Each pattern is
+ tested against the line after the checks specified by HHIISSTTCCOONN--
+ TTRROOLL are applied. In addition to the normal shell pattern
matching characters, `&&' matches the previous history line. `&&'
- may be escaped using a backslash; the backslash is removed
+ may be escaped using a backslash; the backslash is removed
before attempting a match. The second and subsequent lines of a
multi-line compound command are not tested, and are added to the
history regardless of the value of HHIISSTTIIGGNNOORREE.
HHIISSTTSSIIZZEE
- The number of commands to remember in the command history (see
+ The number of commands to remember in the command history (see
HHIISSTTOORRYY below). The default value is 500.
HHIISSTTTTIIMMEEFFOORRMMAATT
- If this variable is set and not null, its value is used as a
+ If this variable is set and not null, its value is used as a
format string for _s_t_r_f_t_i_m_e(3) to print the time stamp associated
- with each history entry displayed by the hhiissttoorryy builtin. If
- this variable is set, time stamps are written to the history
- file so they may be preserved across shell sessions. This uses
- the history comment character to distinguish timestamps from
+ with each history entry displayed by the hhiissttoorryy builtin. If
+ this variable is set, time stamps are written 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.
HHOOMMEE The home directory of the current user; the default argument for
the ccdd builtin command. The value of this variable is also used
when performing tilde expansion.
HHOOSSTTFFIILLEE
- Contains the name of a file in the same format as _/_e_t_c_/_h_o_s_t_s
+ Contains the name of a file in the same format as _/_e_t_c_/_h_o_s_t_s
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, bbaasshh adds the contents of
- the new file to the existing list. If HHOOSSTTFFIILLEE is set, but has
- no value, or does not name a readable file, bbaasshh attempts to
- read _/_e_t_c_/_h_o_s_t_s to obtain the list of possible hostname comple-
+ 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, bbaasshh adds the contents of
+ the new file to the existing list. If HHOOSSTTFFIILLEE is set, but has
+ no value, or does not name a readable file, bbaasshh attempts to
+ read _/_e_t_c_/_h_o_s_t_s to obtain the list of possible hostname comple-
tions. When HHOOSSTTFFIILLEE is unset, the hostname list is cleared.
- IIFFSS The _I_n_t_e_r_n_a_l _F_i_e_l_d _S_e_p_a_r_a_t_o_r that is used for word splitting
- after expansion and to split lines into words with the rreeaadd
+ IIFFSS The _I_n_t_e_r_n_a_l _F_i_e_l_d _S_e_p_a_r_a_t_o_r that is used for word splitting
+ after expansion and to split lines into words with the rreeaadd
builtin command. The default value is ``<space><tab><new-
line>''.
IIGGNNOORREEEEOOFF
Controls the action of an interactive shell on receipt of an EEOOFF
character as the sole input. If set, the value is the number of
- consecutive EEOOFF characters which must be typed as the first
- characters on an input line before bbaasshh exits. If the variable
- exists but does not have a numeric value, or has no value, the
- default value is 10. If it does not exist, EEOOFF signifies the
+ consecutive EEOOFF characters which must be typed as the first
+ characters on an input line before bbaasshh exits. If the variable
+ exists but does not have a numeric value, or has no value, the
+ default value is 10. If it does not exist, EEOOFF signifies the
end of input to the shell.
IINNPPUUTTRRCC
- The filename for the rreeaaddlliinnee startup file, overriding the
+ The filename for the rreeaaddlliinnee startup file, overriding the
default of _~_/_._i_n_p_u_t_r_c (see RREEAADDLLIINNEE below).
- LLAANNGG Used to determine the locale category for any category not
+ LLAANNGG Used to determine the locale category for any category not
specifically selected with a variable starting with LLCC__.
- LLCC__AALLLL This variable overrides the value of LLAANNGG and any other LLCC__
+ LLCC__AALLLL This variable overrides the value of LLAANNGG and any other LLCC__
variable specifying a locale category.
LLCC__CCOOLLLLAATTEE
- 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
+ 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.
LLCC__CCTTYYPPEE
- This variable determines the interpretation of characters and
- the behavior of character classes within pathname expansion and
+ This variable determines the interpretation of characters and
+ the behavior of character classes within pathname expansion and
pattern matching.
LLCC__MMEESSSSAAGGEESS
- This variable determines the locale used to translate double-
+ This variable determines the locale used to translate double-
quoted strings preceded by a $$.
LLCC__NNUUMMEERRIICC
- This variable determines the locale category used for number
+ This variable determines the locale category used for number
formatting.
- LLIINNEESS Used by the sseelleecctt builtin command to determine the column
- length for printing selection lists. Automatically set upon
+ LLIINNEESS Used by the sseelleecctt compound command to determine the column
+ length for printing selection lists. Automatically set upon
receipt of a SSIIGGWWIINNCCHH.
- MMAAIILL If this parameter is set to a file name and the MMAAIILLPPAATTHH vari-
- able is not set, bbaasshh informs the user of the arrival of mail in
- the specified file.
+ MMAAIILL If this parameter is set to a file or directory name and the
+ MMAAIILLPPAATTHH variable is not set, bbaasshh informs the user of the
+ arrival of mail in the specified file or Maildir-format direc-
+ tory.
MMAAIILLCCHHEECCKK
Specifies how often (in seconds) bbaasshh checks for mail. The
default is 60 seconds. When it is time to check for mail, the
@@ -1181,8 +1228,8 @@ PPAARRAAMMEETTEERRSS
issuing the primary prompt. BBaasshh terminates after waiting for
that number of seconds if input does not arrive.
- TTMMPPDDIIRR If set, BBaasshh uses its value as the name of a directory in which
- BBaasshh creates temporary files for the shell's use.
+ TTMMPPDDIIRR If set, bbaasshh uses its value as the name of a directory in which
+ bbaasshh creates temporary files for the shell's use.
aauuttoo__rreessuummee
This variable controls how the shell interacts with the user and
@@ -1227,10 +1274,12 @@ PPAARRAAMMEETTEERRSS
An indexed array is created automatically if any variable is assigned
to using the syntax _n_a_m_e[_s_u_b_s_c_r_i_p_t]=_v_a_l_u_e. The _s_u_b_s_c_r_i_p_t 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 ddeeccllaarree --aa
- _n_a_m_e (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). ddeeccllaarree --aa _n_a_m_e[[_s_u_b_s_c_r_i_p_t]] is
- also accepted; the _s_u_b_s_c_r_i_p_t is ignored.
+ an arithmetic expression that must evaluate to a number. If _s_u_b_s_c_r_i_p_t
+ evaluates to a number less than zero, it is used as an offset from one
+ greater than the array's maximum index (so a subcript of -1 refers to
+ the last element of the array). To explicitly declare an indexed
+ array, use ddeeccllaarree --aa _n_a_m_e (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). ddeeccllaarree
+ --aa _n_a_m_e[[_s_u_b_s_c_r_i_p_t]] is also accepted; the _s_u_b_s_c_r_i_p_t is ignored.
Associative arrays are created using ddeeccllaarree --AA _n_a_m_e.
@@ -1414,9 +1463,9 @@ EEXXPPAANNSSIIOONN
able; this variable is then expanded and that value is used in the rest
of the substitution, rather than the value of _p_a_r_a_m_e_t_e_r itself. This
is known as _i_n_d_i_r_e_c_t _e_x_p_a_n_s_i_o_n. The exceptions to this are the expan-
- sions of ${!_p_r_e_f_i_x*} and ${!!_n_a_m_e[_@]} described below. The exclamation
- point must immediately follow the left brace in order to introduce
- indirection.
+ sions of ${!!\\ffPPffIIpprreeffiixx**} and ${!!_n_a_m_e[_@]} described below. The excla-
+ mation point must immediately follow the left brace in order to intro-
+ duce indirection.
In each of the cases below, _w_o_r_d is subject to tilde expansion, parame-
ter expansion, command substitution, and arithmetic expansion.
@@ -1445,113 +1494,117 @@ EEXXPPAANNSSIIOONN
substituted, otherwise the expansion of _w_o_r_d is substituted.
${_p_a_r_a_m_e_t_e_r::_o_f_f_s_e_t}
${_p_a_r_a_m_e_t_e_r::_o_f_f_s_e_t::_l_e_n_g_t_h}
- SSuubbssttrriinngg EExxppaannssiioonn.. Expands to up to _l_e_n_g_t_h characters of
+ SSuubbssttrriinngg EExxppaannssiioonn. Expands to up to _l_e_n_g_t_h characters of
_p_a_r_a_m_e_t_e_r starting at the character specified by _o_f_f_s_e_t. If
_l_e_n_g_t_h is omitted, expands to the substring of _p_a_r_a_m_e_t_e_r start-
ing at the character specified by _o_f_f_s_e_t. _l_e_n_g_t_h and _o_f_f_s_e_t are
- arithmetic expressions (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN below).
- _l_e_n_g_t_h must evaluate to a number greater than or equal to zero.
- If _o_f_f_s_e_t evaluates to a number less than zero, the value is
- used as an offset from the end of the value of _p_a_r_a_m_e_t_e_r. If
- _p_a_r_a_m_e_t_e_r is @@, the result is _l_e_n_g_t_h positional parameters
- beginning at _o_f_f_s_e_t. If _p_a_r_a_m_e_t_e_r is an indexed array name sub-
- scripted by @ or *, the result is the _l_e_n_g_t_h members of the
- array beginning with ${_p_a_r_a_m_e_t_e_r[_o_f_f_s_e_t]}. A negative _o_f_f_s_e_t is
- taken relative to one greater than the maximum index of the
- specified array. Substring expansion applied to an associative
- array produces undefined results. Note that a negative offset
- must be separated from the colon by at least one space to avoid
- being confused with the :- expansion. Substring indexing is
- zero-based unless the positional parameters are used, in which
- case the indexing starts at 1 by default. If _o_f_f_s_e_t is 0, and
- the positional parameters are used, $$00 is prefixed to the list.
+ arithmetic expressions (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN below). If
+ _o_f_f_s_e_t evaluates to a number less than zero, the value is used
+ as an offset from the end of the value of _p_a_r_a_m_e_t_e_r. If _l_e_n_g_t_h
+ evaluates to a number less than zero, and _p_a_r_a_m_e_t_e_r is not @@ and
+ not an indexed or associative array, it is interpreted as an
+ offset from the end of the value of _p_a_r_a_m_e_t_e_r rather than a num-
+ ber of characters, and the expansion is the characters between
+ the two offsets. If _p_a_r_a_m_e_t_e_r is @@, the result is _l_e_n_g_t_h posi-
+ tional parameters beginning at _o_f_f_s_e_t. If _p_a_r_a_m_e_t_e_r is an
+ indexed array name subscripted by @ or *, the result is the
+ _l_e_n_g_t_h members of the array beginning with ${_p_a_r_a_m_e_t_e_r[_o_f_f_s_e_t]}.
+ A negative _o_f_f_s_e_t is taken relative to one greater than the max-
+ imum index of the specified array. Substring expansion applied
+ to an associative array produces undefined results. Note that a
+ negative offset must be separated from the colon by at least one
+ space to avoid being confused with the :- expansion. Substring
+ indexing is zero-based unless the positional parameters are
+ used, in which case the indexing starts at 1 by default. If
+ _o_f_f_s_e_t is 0, and the positional parameters are used, $$00 is pre-
+ fixed to the list.
${!!_p_r_e_f_i_x**}
${!!_p_r_e_f_i_x@@}
- NNaammeess mmaattcchhiinngg pprreeffiixx.. Expands to the names of variables whose
+ NNaammeess mmaattcchhiinngg pprreeffiixx. Expands to the names of variables whose
names begin with _p_r_e_f_i_x, separated by the first character of the
- IIFFSS special variable. When _@ is used and the expansion appears
- within double quotes, each variable name expands to a separate
+ IIFFSS special variable. When _@ is used and the expansion appears
+ within double quotes, each variable name expands to a separate
word.
${!!_n_a_m_e[_@]}
${!!_n_a_m_e[_*]}
- LLiisstt ooff aarrrraayy kkeeyyss.. If _n_a_m_e is an array variable, expands to
- the list of array indices (keys) assigned in _n_a_m_e. If _n_a_m_e is
- not an array, expands to 0 if _n_a_m_e is set and null otherwise.
- When _@ is used and the expansion appears within double quotes,
+ LLiisstt ooff aarrrraayy kkeeyyss. If _n_a_m_e is an array variable, expands to
+ the list of array indices (keys) assigned in _n_a_m_e. If _n_a_m_e is
+ not an array, expands to 0 if _n_a_m_e is set and null otherwise.
+ When _@ is used and the expansion appears within double quotes,
each key expands to a separate word.
${##_p_a_r_a_m_e_t_e_r}
- PPaarraammeetteerr lleennggtthh.. The length in characters of the value of
- _p_a_r_a_m_e_t_e_r is substituted. If _p_a_r_a_m_e_t_e_r is ** or @@, the value
- substituted is the number of positional parameters. If _p_a_r_a_m_e_-
- _t_e_r is an array name subscripted by ** or @@, the value substi-
+ PPaarraammeetteerr lleennggtthh. The length in characters of the value of
+ _p_a_r_a_m_e_t_e_r is substituted. If _p_a_r_a_m_e_t_e_r is ** or @@, the value
+ substituted is the number of positional parameters. If _p_a_r_a_m_e_-
+ _t_e_r is an array name subscripted by ** or @@, the value substi-
tuted is the number of elements in the array.
${_p_a_r_a_m_e_t_e_r##_w_o_r_d}
${_p_a_r_a_m_e_t_e_r####_w_o_r_d}
- RReemmoovvee mmaattcchhiinngg pprreeffiixx ppaatttteerrnn.. The _w_o_r_d is expanded to produce
+ RReemmoovvee mmaattcchhiinngg pprreeffiixx ppaatttteerrnn. The _w_o_r_d is expanded to produce
a pattern just as in pathname expansion. If the pattern matches
- the beginning of the value of _p_a_r_a_m_e_t_e_r, then the result of the
- expansion is the expanded value of _p_a_r_a_m_e_t_e_r with the shortest
- matching pattern (the ``##'' case) or the longest matching pat-
- tern (the ``####'' case) deleted. If _p_a_r_a_m_e_t_e_r is @@ or **, the
- pattern removal operation is applied to each positional parame-
+ the beginning of the value of _p_a_r_a_m_e_t_e_r, then the result of the
+ expansion is the expanded value of _p_a_r_a_m_e_t_e_r with the shortest
+ matching pattern (the ``##'' case) or the longest matching pat-
+ tern (the ``####'' case) deleted. If _p_a_r_a_m_e_t_e_r is @@ or **, the
+ pattern removal operation is applied to each positional parame-
ter in turn, and the expansion is the resultant list. If _p_a_r_a_m_-
- _e_t_e_r is an array variable subscripted with @@ or **, the pattern
- removal operation is applied to each member of the array in
+ _e_t_e_r is an array variable subscripted with @@ or **, the pattern
+ removal operation is applied to each member of the array in
turn, and the expansion is the resultant list.
${_p_a_r_a_m_e_t_e_r%%_w_o_r_d}
${_p_a_r_a_m_e_t_e_r%%%%_w_o_r_d}
- RReemmoovvee mmaattcchhiinngg ssuuffffiixx ppaatttteerrnn.. The _w_o_r_d is expanded to produce
+ RReemmoovvee mmaattcchhiinngg ssuuffffiixx ppaatttteerrnn. The _w_o_r_d is expanded to produce
a pattern just as in pathname expansion. If the pattern matches
- a trailing portion of the expanded value of _p_a_r_a_m_e_t_e_r, then the
- result of the expansion is the expanded value of _p_a_r_a_m_e_t_e_r with
- the shortest matching pattern (the ``%%'' case) or the longest
- matching pattern (the ``%%%%'' case) deleted. If _p_a_r_a_m_e_t_e_r is @@
- or **, the pattern removal operation is applied to each posi-
- tional parameter in turn, and the expansion is the resultant
- list. If _p_a_r_a_m_e_t_e_r is an array variable subscripted with @@ or
- **, the pattern removal operation is applied to each member of
+ a trailing portion of the expanded value of _p_a_r_a_m_e_t_e_r, then the
+ result of the expansion is the expanded value of _p_a_r_a_m_e_t_e_r with
+ the shortest matching pattern (the ``%%'' case) or the longest
+ matching pattern (the ``%%%%'' case) deleted. If _p_a_r_a_m_e_t_e_r is @@
+ or **, the pattern removal operation is applied to each posi-
+ tional parameter in turn, and the expansion is the resultant
+ list. If _p_a_r_a_m_e_t_e_r is an array variable subscripted with @@ or
+ **, the pattern removal operation is applied to each member of
the array in turn, and the expansion is the resultant list.
${_p_a_r_a_m_e_t_e_r//_p_a_t_t_e_r_n//_s_t_r_i_n_g}
- PPaatttteerrnn ssuubbssttiittuuttiioonn.. The _p_a_t_t_e_r_n is expanded to produce a pat-
- tern just as in pathname expansion. _P_a_r_a_m_e_t_e_r is expanded and
- the longest match of _p_a_t_t_e_r_n against its value is replaced with
- _s_t_r_i_n_g. If _p_a_t_t_e_r_n begins with //, all matches of _p_a_t_t_e_r_n are
- replaced with _s_t_r_i_n_g. Normally only the first match is
+ PPaatttteerrnn ssuubbssttiittuuttiioonn. The _p_a_t_t_e_r_n is expanded to produce a pat-
+ tern just as in pathname expansion. _P_a_r_a_m_e_t_e_r is expanded and
+ the longest match of _p_a_t_t_e_r_n against its value is replaced with
+ _s_t_r_i_n_g. If _p_a_t_t_e_r_n begins with //, all matches of _p_a_t_t_e_r_n are
+ replaced with _s_t_r_i_n_g. Normally only the first match is
replaced. If _p_a_t_t_e_r_n begins with ##, it must match at the begin-
ning of the expanded value of _p_a_r_a_m_e_t_e_r. If _p_a_t_t_e_r_n begins with
- %%, it must match at the end of the expanded value of _p_a_r_a_m_e_t_e_r.
+ %%, it must match at the end of the expanded value of _p_a_r_a_m_e_t_e_r.
If _s_t_r_i_n_g is null, matches of _p_a_t_t_e_r_n are deleted and the // fol-
lowing _p_a_t_t_e_r_n may be omitted. If _p_a_r_a_m_e_t_e_r is @@ or **, the sub-
- stitution operation is applied to each positional parameter in
- turn, and the expansion is the resultant list. If _p_a_r_a_m_e_t_e_r is
- an array variable subscripted with @@ or **, the substitution
- operation is applied to each member of the array in turn, and
+ stitution operation is applied to each positional parameter in
+ turn, and the expansion is the resultant list. If _p_a_r_a_m_e_t_e_r is
+ an array variable subscripted with @@ or **, the substitution
+ operation is applied to each member of the array in turn, and
the expansion is the resultant list.
${_p_a_r_a_m_e_t_e_r^^_p_a_t_t_e_r_n}
${_p_a_r_a_m_e_t_e_r^^^^_p_a_t_t_e_r_n}
${_p_a_r_a_m_e_t_e_r,,_p_a_t_t_e_r_n}
${_p_a_r_a_m_e_t_e_r,,,,_p_a_t_t_e_r_n}
- CCaassee mmooddiiffiiccaattiioonn.. This expansion modifies the case of alpha-
- betic characters in _p_a_r_a_m_e_t_e_r. The _p_a_t_t_e_r_n is expanded to pro-
- duce a pattern just as in pathname expansion. The ^^ operator
- converts lowercase letters matching _p_a_t_t_e_r_n to uppercase; the ,,
- operator converts matching uppercase letters to lowercase. The
- ^^^^ and ,,,, expansions convert each matched character in the
- expanded value; the ^^ and ,, expansions match and convert only
- the first character in the expanded value.. If _p_a_t_t_e_r_n is omit-
- ted, it is treated like a ??, which matches every character. If
- _p_a_r_a_m_e_t_e_r is @@ or **, the case modification operation is applied
- to each positional parameter in turn, and the expansion is the
- resultant list. If _p_a_r_a_m_e_t_e_r is an array variable subscripted
- with @@ or **, the case modification operation is applied to each
- member of the array in turn, and the expansion is the resultant
+ CCaassee mmooddiiffiiccaattiioonn. This expansion modifies the case of alpha-
+ betic characters in _p_a_r_a_m_e_t_e_r. The _p_a_t_t_e_r_n is expanded to pro-
+ duce a pattern just as in pathname expansion. The ^^ operator
+ converts lowercase letters matching _p_a_t_t_e_r_n to uppercase; the ,,
+ operator converts matching uppercase letters to lowercase. The
+ ^^^^ and ,,,, expansions convert each matched character in the
+ expanded value; the ^^ and ,, expansions match and convert only
+ the first character in the expanded value. If _p_a_t_t_e_r_n is omit-
+ ted, it is treated like a ??, which matches every character. If
+ _p_a_r_a_m_e_t_e_r is @@ or **, the case modification operation is applied
+ to each positional parameter in turn, and the expansion is the
+ resultant list. If _p_a_r_a_m_e_t_e_r is an array variable subscripted
+ with @@ or **, the case modification operation is applied to each
+ member of the array in turn, and the expansion is the resultant
list.
CCoommmmaanndd SSuubbssttiittuuttiioonn
@@ -1564,160 +1617,162 @@ EEXXPPAANNSSIIOONN
``_c_o_m_m_a_n_d``
BBaasshh performs the expansion by executing _c_o_m_m_a_n_d and replacing the com-
- mand substitution with the standard output of the command, with any
+ mand 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 $$((ccaatt
+ may be removed during word splitting. The command substitution $$((ccaatt
_f_i_l_e)) can be replaced by the equivalent but faster $$((<< _f_i_l_e)).
- When the old-style backquote form of substitution is used, backslash
- retains its literal meaning except when followed by $$, ``, or \\. The
+ When the old-style backquote form of substitution is used, backslash
+ retains its literal meaning except when followed by $$, ``, or \\. The
first backquote not preceded by a backslash terminates the command sub-
- stitution. When using the $(_c_o_m_m_a_n_d) form, all characters between the
+ stitution. When using the $(_c_o_m_m_a_n_d) form, all characters between the
parentheses make up the command; none are treated specially.
Command substitutions may be nested. To nest when using the backquoted
form, escape the inner backquotes with backslashes.
- If the substitution appears within double quotes, word splitting and
+ If the substitution appears within double quotes, word splitting and
pathname expansion are not performed on the results.
AArriitthhmmeettiicc EExxppaannssiioonn
- Arithmetic expansion allows the evaluation of an arithmetic expression
- and the substitution of the result. The format for arithmetic expan-
+ Arithmetic expansion allows the evaluation of an arithmetic expression
+ and the substitution of the result. The format for arithmetic expan-
sion is:
$$((((_e_x_p_r_e_s_s_i_o_n))))
- The _e_x_p_r_e_s_s_i_o_n is treated as if it were within double quotes, but a
- double quote inside the parentheses is not treated specially. All
+ The _e_x_p_r_e_s_s_i_o_n is treated as if it were within double quotes, but a
+ double quote inside the parentheses is not treated specially. All
tokens in the expression undergo parameter expansion, string expansion,
- command substitution, and quote removal. Arithmetic expansions may be
+ command substitution, and quote removal. Arithmetic expansions may be
nested.
- The evaluation is performed according to the rules listed below under
+ The evaluation is performed according to the rules listed below under
AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN. If _e_x_p_r_e_s_s_i_o_n is invalid, bbaasshh prints a message
indicating failure and no substitution occurs.
PPrroocceessss SSuubbssttiittuuttiioonn
- _P_r_o_c_e_s_s _s_u_b_s_t_i_t_u_t_i_o_n is supported on systems that support named pipes
- (_F_I_F_O_s) or the //ddeevv//ffdd method of naming open files. It takes the form
- of <<((_l_i_s_t)) or >>((_l_i_s_t)). The process _l_i_s_t is run with its input or out-
+ _P_r_o_c_e_s_s _s_u_b_s_t_i_t_u_t_i_o_n is supported on systems that support named pipes
+ (_F_I_F_O_s) or the //ddeevv//ffdd method of naming open files. It takes the form
+ of <<((_l_i_s_t)) or >>((_l_i_s_t)). The process _l_i_s_t is run with its input or out-
put connected to a _F_I_F_O or some file in //ddeevv//ffdd. The name of this file
- is passed as an argument to the current command as the result of the
- expansion. If the >>((_l_i_s_t)) form is used, writing to the file will pro-
- vide input for _l_i_s_t. If the <<((_l_i_s_t)) form is used, the file passed as
+ is passed as an argument to the current command as the result of the
+ expansion. If the >>((_l_i_s_t)) form is used, writing to the file will pro-
+ vide input for _l_i_s_t. If the <<((_l_i_s_t)) form is used, the file passed as
an argument should be read to obtain the output of _l_i_s_t.
- When available, process substitution is performed simultaneously with
- parameter and variable expansion, command substitution, and arithmetic
+ When available, process substitution is performed simultaneously with
+ parameter and variable expansion, command substitution, and arithmetic
expansion.
WWoorrdd SSpplliittttiinngg
- The shell scans the results of parameter expansion, command substitu-
- tion, and arithmetic expansion that did not occur within double quotes
+ The shell scans the results of parameter expansion, command substitu-
+ tion, and arithmetic expansion that did not occur within double quotes
for _w_o_r_d _s_p_l_i_t_t_i_n_g.
- The shell treats each character of IIFFSS as a delimiter, and splits the
+ The shell treats each character of IIFFSS as a delimiter, and splits the
results of the other expansions into words on these characters. If IIFFSS
- is unset, or its value is exactly <<ssppaaccee>><<ttaabb>><<nneewwlliinnee>>, the default,
- then sequences of <<ssppaaccee>>, <<ttaabb>>, and <<nneewwlliinnee>> at the beginning and
- end of the results of the previous expansions are ignored, and any
- sequence of IIFFSS characters not at the beginning or end serves to
- delimit words. If IIFFSS has a value other than the default, then
+ is unset, or its value is exactly <<ssppaaccee>><<ttaabb>><<nneewwlliinnee>>, the default,
+ then sequences of <<ssppaaccee>>, <<ttaabb>>, and <<nneewwlliinnee>> at the beginning and
+ end of the results of the previous expansions are ignored, and any
+ sequence of IIFFSS characters not at the beginning or end serves to
+ delimit words. If IIFFSS has a value other than the default, then
sequences of the whitespace characters ssppaaccee and ttaabb are ignored at the
- beginning and end of the word, as long as the whitespace character is
- in the value of IIFFSS (an IIFFSS whitespace character). Any character in
- IIFFSS that is not IIFFSS whitespace, along with any adjacent IIFFSS whitespace
- characters, delimits a field. A sequence of IIFFSS whitespace characters
- is also treated as a delimiter. If the value of IIFFSS is null, no word
+ beginning and end of the word, as long as the whitespace character is
+ in the value of IIFFSS (an IIFFSS whitespace character). Any character in
+ IIFFSS that is not IIFFSS whitespace, along with any adjacent IIFFSS whitespace
+ characters, delimits a field. A sequence of IIFFSS whitespace characters
+ is also treated as a delimiter. If the value of IIFFSS is null, no word
splitting occurs.
- Explicit null arguments ("""" or '''') are retained. Unquoted implicit
+ Explicit null arguments ("""" or '''') are retained. Unquoted implicit
null arguments, resulting from the expansion of parameters that have no
- values, are removed. If a parameter with no value is expanded within
+ values, are removed. If a parameter with no value is expanded within
double quotes, a null argument results and is retained.
Note that if no expansion occurs, no splitting is performed.
PPaatthhnnaammee EExxppaannssiioonn
- After word splitting, unless the --ff option has been set, bbaasshh scans
- each word for the characters **, ??, and [[. If one of these characters
- appears, then the word is regarded as a _p_a_t_t_e_r_n, and replaced with an
- alphabetically sorted list of file names matching the pattern. If no
- matching file names are found, and the shell option nnuullllgglloobb is not
- enabled, the word is left unchanged. If the nnuullllgglloobb option is set,
- and no matches are found, the word is removed. If the ffaaiillgglloobb shell
- option is set, and no matches are found, an error message is printed
- and the command is not executed. If the shell option nnooccaasseegglloobb is
- enabled, the match is performed without regard to the case of alpha-
- betic characters. When a pattern is used for pathname expansion, the
- character ````..'''' at the start of a name or immediately following a
- slash must be matched explicitly, unless the shell option ddoottgglloobb is
- set. When matching a pathname, the slash character must always be
- matched explicitly. In other cases, the ````..'''' character is not
- treated specially. See the description of sshhoopptt below under SSHHEELLLL
- BBUUIILLTTIINN CCOOMMMMAANNDDSS for a description of the nnooccaasseegglloobb, nnuullllgglloobb, ffaaiill--
+ After word splitting, unless the --ff option has been set, bbaasshh scans
+ each word for the characters **, ??, and [[. If one of these characters
+ appears, then the word is regarded as a _p_a_t_t_e_r_n, and replaced with an
+ alphabetically sorted list of file names matching the pattern. If no
+ matching file names are found, and the shell option nnuullllgglloobb is not
+ enabled, the word is left unchanged. If the nnuullllgglloobb option is set,
+ and no matches are found, the word is removed. If the ffaaiillgglloobb shell
+ option is set, and no matches are found, an error message is printed
+ and the command is not executed. If the shell option nnooccaasseegglloobb is
+ enabled, the match is performed without regard to the case of alpha-
+ betic characters. When a pattern is used for pathname expansion, the
+ character ````..'''' at the start of a name or immediately following a
+ slash must be matched explicitly, unless the shell option ddoottgglloobb is
+ set. When matching a pathname, the slash character must always be
+ matched explicitly. In other cases, the ````..'''' character is not
+ treated specially. See the description of sshhoopptt below under SSHHEELLLL
+ BBUUIILLTTIINN CCOOMMMMAANNDDSS for a description of the nnooccaasseegglloobb, nnuullllgglloobb, ffaaiill--
gglloobb, and ddoottgglloobb shell options.
- The GGLLOOBBIIGGNNOORREE shell variable may be used to restrict the set of file
- names matching a _p_a_t_t_e_r_n. If GGLLOOBBIIGGNNOORREE is set, each matching file
- name that also matches one of the patterns in GGLLOOBBIIGGNNOORREE is removed
+ The GGLLOOBBIIGGNNOORREE shell variable may be used to restrict the set of file
+ names matching a _p_a_t_t_e_r_n. If GGLLOOBBIIGGNNOORREE is set, each matching file
+ name that also matches one of the patterns in GGLLOOBBIIGGNNOORREE is removed
from the list of matches. The file names ````..'''' and ````....'''' are always
- ignored when GGLLOOBBIIGGNNOORREE is set and not null. However, setting GGLLOOBBIIGG--
- NNOORREE to a non-null value has the effect of enabling the ddoottgglloobb shell
+ ignored when GGLLOOBBIIGGNNOORREE is set and not null. However, setting GGLLOOBBIIGG--
+ NNOORREE to a non-null value has the effect of enabling the ddoottgglloobb shell
option, so all other file names beginning with a ````..'''' will match. To
- get the old behavior of ignoring file names beginning with a ````..'''',
- make ````..**'''' one of the patterns in GGLLOOBBIIGGNNOORREE. The ddoottgglloobb option is
+ get the old behavior of ignoring file names beginning with a ````..'''',
+ make ````..**'''' one of the patterns in GGLLOOBBIIGGNNOORREE. The ddoottgglloobb option is
disabled when GGLLOOBBIIGGNNOORREE is unset.
PPaatttteerrnn MMaattcchhiinngg
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 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.
The special pattern characters have the following meanings:
- ** Matches any string, including the null string. When the gglloobb--
- ssttaarr shell option is enabled, and ** is used in a pathname expan-
- sion context, two adjacent **s used as a single pattern will
- match all files and zero or more directories and subdirectories.
- If followed by a //, two adjacent **s will match only directories
- and subdirectories.
- ?? Matches any single character.
- [[......]] Matches any one of the enclosed characters. A pair of charac-
- ters separated by a hyphen denotes a _r_a_n_g_e _e_x_p_r_e_s_s_i_o_n; any char-
- acter that sorts between those two characters, inclusive, using
- the current locale's collating sequence and character set, is
- matched. If the first character following the [[ is a !! or a ^^
- then any character not enclosed is matched. The sorting order
- of characters in range expressions is determined by the current
- locale and the value of the LLCC__CCOOLLLLAATTEE shell variable, if set.
- A -- may be matched by including it as the first or last charac-
- ter in the set. A ]] may be matched by including it as the first
- character in the set.
-
- Within [[ and ]], _c_h_a_r_a_c_t_e_r _c_l_a_s_s_e_s can be specified using the
- syntax [[::_c_l_a_s_s::]], where _c_l_a_s_s is one of the following classes
- defined in the POSIX standard:
- aallnnuumm aallpphhaa aasscciiii bbllaannkk ccnnttrrll ddiiggiitt ggrraapphh lloowweerr pprriinntt ppuunncctt
- ssppaaccee uuppppeerr wwoorrdd xxddiiggiitt
- A character class matches any character belonging to that class.
- The wwoorrdd character class matches letters, digits, and the char-
- acter _.
-
- Within [[ and ]], an _e_q_u_i_v_a_l_e_n_c_e _c_l_a_s_s can be specified using the
- syntax [[==_c==]], which matches all characters with the same colla-
- tion weight (as defined by the current locale) as the character
- _c.
-
- Within [[ and ]], the syntax [[.._s_y_m_b_o_l..]] matches the collating sym-
- bol _s_y_m_b_o_l.
+ ** Matches any string, including the null string. When the
+ gglloobbssttaarr shell option is enabled, and ** is used in a
+ pathname expansion context, two adjacent **s used as a
+ single pattern will match all files and zero or more
+ directories and subdirectories. If followed by a //, two
+ adjacent **s will match only directories and subdirecto-
+ ries.
+ ?? Matches any single character.
+ [[......]] Matches any one of the enclosed characters. A pair of
+ characters separated by a hyphen denotes a _r_a_n_g_e _e_x_p_r_e_s_-
+ _s_i_o_n; any character that sorts between those two charac-
+ ters, inclusive, using the current locale's collating
+ sequence and character set, is matched. If the first
+ character following the [[ is a !! or a ^^ then any charac-
+ ter not enclosed is matched. The sorting order of char-
+ acters in range expressions is determined by the current
+ locale and the value of the LLCC__CCOOLLLLAATTEE shell variable, if
+ set. A -- may be matched by including it as the first or
+ last character in the set. A ]] may be matched by includ-
+ ing it as the first character in the set.
+
+ Within [[ and ]], _c_h_a_r_a_c_t_e_r _c_l_a_s_s_e_s can be specified using
+ the syntax [[::_c_l_a_s_s::]], where _c_l_a_s_s is one of the following
+ classes defined in the POSIX standard:
+ aallnnuumm aallpphhaa aasscciiii bbllaannkk ccnnttrrll ddiiggiitt ggrraapphh lloowweerr pprriinntt
+ ppuunncctt ssppaaccee uuppppeerr wwoorrdd xxddiiggiitt
+ A character class matches any character belonging to that
+ class. The wwoorrdd character class matches letters, digits,
+ and the character _.
+
+ Within [[ and ]], an _e_q_u_i_v_a_l_e_n_c_e _c_l_a_s_s can be specified
+ using the syntax [[==_c==]], which matches all characters with
+ the same collation weight (as defined by the current
+ locale) as the character _c.
+
+ Within [[ and ]], the syntax [[.._s_y_m_b_o_l..]] matches the collat-
+ ing symbol _s_y_m_b_o_l.
If the eexxttgglloobb shell option is enabled using the sshhoopptt builtin, several
- extended pattern matching operators are recognized. In the following
+ extended pattern matching operators are recognized. In the following
description, a _p_a_t_t_e_r_n_-_l_i_s_t is a list of one or more patterns separated
by a ||. Composite patterns may be formed using one or more of the fol-
lowing sub-patterns:
@@ -1735,55 +1790,55 @@ EEXXPPAANNSSIIOONN
QQuuoottee RReemmoovvaall
After the preceding expansions, all unquoted occurrences of the charac-
- ters \\, '', and "" that did not result from one of the above expansions
+ ters \\, '', and "" that did not result from one of the above expansions
are removed.
RREEDDIIRREECCTTIIOONN
- Before a command is executed, its input and output may be _r_e_d_i_r_e_c_t_e_d
- using a special notation interpreted by the shell. Redirection may
- also be used to open and close files for the current shell execution
+ Before a command is executed, its input and output may be _r_e_d_i_r_e_c_t_e_d
+ using a special notation interpreted by the shell. Redirection may
+ also be used to open and close files for the current shell execution
environment. The following redirection operators may precede or appear
anywhere within a _s_i_m_p_l_e _c_o_m_m_a_n_d or may follow a _c_o_m_m_a_n_d. Redirections
are processed in the order they appear, from left to right.
- Each redirection that may be preceded by a file descriptor number may
+ Each redirection that may be preceded by a file descriptor number may
instead be preceded by a word of the form {_v_a_r_n_a_m_e}. In this case, for
each redirection operator except >&- and <&-, the shell will allocate a
- file descriptor greater than 10 and assign it to _v_a_r_n_a_m_e. If >&- or
- <&- is preceded by {_v_a_r_n_a_m_e}, the value of _v_a_r_n_a_m_e defines the file
+ file descriptor greater than 10 and assign it to _v_a_r_n_a_m_e. If >&- or
+ <&- is preceded by {_v_a_r_n_a_m_e}, the value of _v_a_r_n_a_m_e defines the file
descriptor to close.
- In the following descriptions, if the file descriptor number is omit-
- ted, and the first character of the redirection operator is <<, the re-
- direction refers to the standard input (file descriptor 0). If the
- first character of the redirection operator is >>, the redirection
+ In the following descriptions, if the file descriptor number is omit-
+ ted, and the first character of the redirection operator is <<, the re-
+ direction refers to the standard input (file descriptor 0). If the
+ first character of the redirection operator is >>, the redirection
refers to the standard output (file descriptor 1).
- The word following the redirection operator in the following descrip-
- tions, unless otherwise noted, is subjected to brace expansion, tilde
+ The word following the redirection operator in the following descrip-
+ tions, unless otherwise noted, is subjected to brace expansion, tilde
expansion, parameter expansion, command substitution, arithmetic expan-
- sion, quote removal, pathname expansion, and word splitting. If it
+ sion, quote removal, pathname expansion, and word splitting. If it
expands to more than one word, bbaasshh reports an error.
- Note that the order of redirections is significant. For example, the
+ Note that the order of redirections is significant. For example, the
command
ls >> dirlist 2>>&&1
- directs both standard output and standard error to the file _d_i_r_l_i_s_t,
+ directs both standard output and standard error to the file _d_i_r_l_i_s_t,
while the command
ls 2>>&&1 >> dirlist
- directs only the standard output to file _d_i_r_l_i_s_t, because the standard
- error was duplicated from the standard output before the standard out-
+ directs only the standard output to file _d_i_r_l_i_s_t, because the standard
+ error was duplicated from the standard output before the standard out-
put was redirected to _d_i_r_l_i_s_t.
BBaasshh handles several filenames specially when they are used in redirec-
tions, as described in the following table:
//ddeevv//ffdd//_f_d
- If _f_d is a valid integer, file descriptor _f_d is dupli-
+ If _f_d is a valid integer, file descriptor _f_d is dupli-
cated.
//ddeevv//ssttddiinn
File descriptor 0 is duplicated.
@@ -1793,22 +1848,22 @@ RREEDDIIRREECCTTIIOONN
File descriptor 2 is duplicated.
//ddeevv//ttccpp//_h_o_s_t//_p_o_r_t
If _h_o_s_t is a valid hostname or Internet address, and _p_o_r_t
- is an integer port number or service name, bbaasshh attempts
+ is an integer port number or service name, bbaasshh attempts
to open a TCP connection to the corresponding socket.
//ddeevv//uuddpp//_h_o_s_t//_p_o_r_t
If _h_o_s_t is a valid hostname or Internet address, and _p_o_r_t
- is an integer port number or service name, bbaasshh attempts
+ is an integer port number or service name, bbaasshh attempts
to open a UDP connection to the corresponding socket.
A failure to open or create a file causes the redirection to fail.
- Redirections using file descriptors greater than 9 should be used with
- care, as they may conflict with file descriptors the shell uses inter-
+ Redirections using file descriptors greater than 9 should be used with
+ care, as they may conflict with file descriptors the shell uses inter-
nally.
RReeddiirreeccttiinngg IInnppuutt
Redirection of input causes the file whose name results from the expan-
- sion of _w_o_r_d to be opened for reading on file descriptor _n, or the
+ sion of _w_o_r_d to be opened for reading on file descriptor _n, or the
standard input (file descriptor 0) if _n is not specified.
The general format for redirecting input is:
@@ -1816,27 +1871,27 @@ RREEDDIIRREECCTTIIOONN
[_n]<<_w_o_r_d
RReeddiirreeccttiinngg OOuuttppuutt
- Redirection of output causes the file whose name results from the
+ Redirection of output causes the file whose name results from the
expansion of _w_o_r_d to be opened for writing on file descriptor _n, or the
standard output (file descriptor 1) if _n is not specified. If the file
- does not exist it is created; if it does exist it is truncated to zero
+ does not exist it is created; if it does exist it is truncated to zero
size.
The general format for redirecting output is:
[_n]>>_w_o_r_d
- If the redirection operator is >>, and the nnoocclloobbbbeerr option to the sseett
- builtin has been enabled, the redirection will fail if the file whose
- name results from the expansion of _w_o_r_d exists and is a regular file.
+ If the redirection operator is >>, and the nnoocclloobbbbeerr option to the sseett
+ builtin has been enabled, the redirection will fail if the file whose
+ name results from the expansion of _w_o_r_d exists and is a regular file.
If the redirection operator is >>||, or the redirection operator is >> and
the nnoocclloobbbbeerr option to the sseett builtin command is not enabled, the re-
direction is attempted even if the file named by _w_o_r_d exists.
AAppppeennddiinngg RReeddiirreecctteedd OOuuttppuutt
- Redirection of output in this fashion causes the file whose name
- results from the expansion of _w_o_r_d to be opened for appending on file
- descriptor _n, or the standard output (file descriptor 1) if _n is not
+ Redirection of output in this fashion causes the file whose name
+ results from the expansion of _w_o_r_d to be opened for appending on file
+ descriptor _n, or the standard output (file descriptor 1) if _n is not
specified. If the file does not exist it is created.
The general format for appending output is:
@@ -1845,11 +1900,11 @@ RREEDDIIRREECCTTIIOONN
RReeddiirreeccttiinngg SSttaannddaarrdd OOuuttppuutt aanndd SSttaannddaarrdd EErrrroorr
- This construct allows both the standard output (file descriptor 1) and
- the standard error output (file descriptor 2) to be redirected to the
+ This construct allows both the standard output (file descriptor 1) and
+ the standard error output (file descriptor 2) to be redirected to the
file whose name is the expansion of _w_o_r_d.
- There are two formats for redirecting standard output and standard
+ There are two formats for redirecting standard output and standard
error:
&&>>_w_o_r_d
@@ -1863,8 +1918,8 @@ RREEDDIIRREECCTTIIOONN
AAppppeennddiinngg SSttaannddaarrdd OOuuttppuutt aanndd SSttaannddaarrdd EErrrroorr
- This construct allows both the standard output (file descriptor 1) and
- the standard error output (file descriptor 2) to be appended to the
+ This construct allows both the standard output (file descriptor 1) and
+ the standard error output (file descriptor 2) to be appended to the
file whose name is the expansion of _w_o_r_d.
The format for appending standard output and standard error is:
@@ -1876,9 +1931,9 @@ RREEDDIIRREECCTTIIOONN
>>>>_w_o_r_d 2>>&&1
HHeerree DDooccuummeennttss
- This type of redirection instructs the shell to read input from the
+ This type of redirection instructs the shell to read input from the
current source until a line containing only _d_e_l_i_m_i_t_e_r (with no trailing
- blanks) is seen. All of the lines read up to that point are then used
+ blanks) is seen. All of the lines read up to that point are then used
as the standard input for a command.
The format of here-documents is:
@@ -1887,18 +1942,18 @@ RREEDDIIRREECCTTIIOONN
_h_e_r_e_-_d_o_c_u_m_e_n_t
_d_e_l_i_m_i_t_e_r
- No parameter expansion, command substitution, arithmetic expansion, or
+ No parameter expansion, command substitution, arithmetic expansion, or
pathname expansion is performed on _w_o_r_d. If any characters in _w_o_r_d are
- quoted, the _d_e_l_i_m_i_t_e_r is the result of quote removal on _w_o_r_d, and the
- lines in the here-document are not expanded. If _w_o_r_d is unquoted, all
- lines of the here-document are subjected to parameter expansion, com-
- mand substitution, and arithmetic expansion. In the latter case, the
- character sequence \\<<nneewwlliinnee>> is ignored, and \\ must be used to quote
+ quoted, the _d_e_l_i_m_i_t_e_r is the result of quote removal on _w_o_r_d, and the
+ lines in the here-document are not expanded. If _w_o_r_d is unquoted, all
+ lines of the here-document are subjected to parameter expansion, com-
+ mand substitution, and arithmetic expansion. In the latter case, the
+ character sequence \\<<nneewwlliinnee>> is ignored, and \\ must be used to quote
the characters \\, $$, and ``.
If the redirection operator is <<<<--, then all leading tab characters are
- stripped from input lines and the line containing _d_e_l_i_m_i_t_e_r. This
- allows here-documents within shell scripts to be indented in a natural
+ stripped from input lines and the line containing _d_e_l_i_m_i_t_e_r. This
+ allows here-documents within shell scripts to be indented in a natural
fashion.
HHeerree SSttrriinnggss
@@ -1914,20 +1969,20 @@ RREEDDIIRREECCTTIIOONN
[_n]<<&&_w_o_r_d
is used to duplicate input file descriptors. If _w_o_r_d expands to one or
- more digits, the file descriptor denoted by _n is made to be a copy of
- that file descriptor. If the digits in _w_o_r_d do not specify a file
- descriptor open for input, a redirection error occurs. If _w_o_r_d evalu-
- ates to --, file descriptor _n is closed. If _n is not specified, the
+ more digits, the file descriptor denoted by _n is made to be a copy of
+ that file descriptor. If the digits in _w_o_r_d do not specify a file
+ descriptor open for input, a redirection error occurs. If _w_o_r_d evalu-
+ ates to --, file descriptor _n is closed. If _n is not specified, the
standard input (file descriptor 0) is used.
The operator
[_n]>>&&_w_o_r_d
- is used similarly to duplicate output file descriptors. If _n is not
- specified, the standard output (file descriptor 1) is used. If the
- digits in _w_o_r_d do not specify a file descriptor open for output, a re-
- direction error occurs. As a special case, if _n is omitted, and _w_o_r_d
+ is used similarly to duplicate output file descriptors. If _n is not
+ specified, the standard output (file descriptor 1) is used. If the
+ digits in _w_o_r_d do not specify a file descriptor open for output, a re-
+ direction error occurs. As a special case, if _n is omitted, and _w_o_r_d
does not expand to one or more digits, the standard output and standard
error are redirected as described previously.
@@ -1936,7 +1991,7 @@ RREEDDIIRREECCTTIIOONN
[_n]<<&&_d_i_g_i_t--
- moves the file descriptor _d_i_g_i_t to file descriptor _n, or the standard
+ moves the file descriptor _d_i_g_i_t to file descriptor _n, or the standard
input (file descriptor 0) if _n is not specified. _d_i_g_i_t is closed after
being duplicated to _n.
@@ -1944,7 +1999,7 @@ RREEDDIIRREECCTTIIOONN
[_n]>>&&_d_i_g_i_t--
- moves the file descriptor _d_i_g_i_t to file descriptor _n, or the standard
+ moves the file descriptor _d_i_g_i_t to file descriptor _n, or the standard
output (file descriptor 1) if _n is not specified.
OOppeenniinngg FFiillee DDeessccrriippttoorrss ffoorr RReeaaddiinngg aanndd WWrriittiinngg
@@ -1952,111 +2007,117 @@ RREEDDIIRREECCTTIIOONN
[_n]<<>>_w_o_r_d
- causes the file whose name is the expansion of _w_o_r_d to be opened for
- both reading and writing on file descriptor _n, or on file descriptor 0
+ causes the file whose name is the expansion of _w_o_r_d to be opened for
+ both reading and writing on file descriptor _n, or on file descriptor 0
if _n is not specified. If the file does not exist, it is created.
AALLIIAASSEESS
- _A_l_i_a_s_e_s allow a string to be substituted for a word when it is used as
- the first word of a simple command. The shell maintains a list of
- aliases that may be set and unset with the aalliiaass and uunnaalliiaass builtin
- commands (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). The first word of each
- simple command, if unquoted, is checked to see if it has an alias. If
- so, that word is replaced by the text of the alias. The characters //,
- $$, ``, and == and any of the shell _m_e_t_a_c_h_a_r_a_c_t_e_r_s or quoting characters
+ _A_l_i_a_s_e_s allow a string to be substituted for a word when it is used as
+ the first word of a simple command. The shell maintains a list of
+ aliases that may be set and unset with the aalliiaass and uunnaalliiaass builtin
+ commands (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). The first word of each
+ simple command, if unquoted, is checked to see if it has an alias. If
+ so, that word is replaced by the text of the alias. The characters //,
+ $$, ``, and == and any of the shell _m_e_t_a_c_h_a_r_a_c_t_e_r_s 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 llss to llss --FF, for instance, and
- bbaasshh does not try to recursively expand the replacement text. If the
- last character of the alias value is a _b_l_a_n_k, then the next command
+ 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 llss to llss --FF, for instance, and
+ bbaasshh does not try to recursively expand the replacement text. If the
+ last character of the alias value is a _b_l_a_n_k, then the next command
word following the alias is also checked for alias expansion.
Aliases are created and listed with the aalliiaass command, and removed with
the uunnaalliiaass command.
- There is no mechanism for using arguments in the replacement text. If
- arguments are needed, a shell function should be used (see FFUUNNCCTTIIOONNSS
+ There is no mechanism for using arguments in the replacement text. If
+ arguments are needed, a shell function should be used (see FFUUNNCCTTIIOONNSS
below).
- Aliases are not expanded when the shell is not interactive, unless the
- eexxppaanndd__aalliiaasseess shell option is set using sshhoopptt (see the description of
+ Aliases are not expanded when the shell is not interactive, unless the
+ eexxppaanndd__aalliiaasseess shell option is set using sshhoopptt (see the description of
sshhoopptt under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below).
- The rules concerning the definition and use of aliases are somewhat
- confusing. BBaasshh always reads at least one complete line of input
- before executing any of the commands on that line. 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 next line of input is read. The commands
+ The rules concerning the definition and use of aliases are somewhat
+ confusing. BBaasshh always reads at least one complete line of input
+ before executing any of the commands on that line. 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 next line of input is read. The commands
following the alias definition on that line 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 com-
+ 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 com-
pound 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 aalliiaass in com-
+ available until after that function is executed. To be safe, always
+ put alias definitions on a separate line, and do not use aalliiaass in com-
pound commands.
For almost every purpose, aliases are superseded by shell functions.
FFUUNNCCTTIIOONNSS
- A shell function, defined as described above under SSHHEELLLL GGRRAAMMMMAARR,
- stores a series of commands for later execution. When the name of a
- shell function is used as a simple command name, the list of commands
+ A shell function, defined as described above under SSHHEELLLL GGRRAAMMMMAARR,
+ stores a series of commands for later execution. When the name of a
+ shell function is used as a simple command name, the list of commands
associated with that function name is executed. Functions are executed
- in the context of the current shell; no new process is created to
- interpret them (contrast this with the execution of a shell script).
- When a function is executed, the arguments to the function become the
+ in the context of the current shell; no new process is created to
+ interpret them (contrast this with the execution of a shell script).
+ When a function is executed, the arguments to the function become the
positional parameters during its execution. The special parameter ## is
- updated to reflect the change. Special parameter 0 is unchanged. The
- first element of the FFUUNNCCNNAAMMEE variable is set to the name of the func-
+ updated to reflect the change. Special parameter 00 is unchanged. The
+ first element of the FFUUNNCCNNAAMMEE variable is set to the name of the func-
tion while the function is executing.
- All other aspects of the shell execution environment are identical
+ All other aspects of the shell execution environment are identical
between a function and its caller with these exceptions: the DDEEBBUUGG and
- RREETTUURRNN traps (see the description of the ttrraapp builtin under SSHHEELLLL
- BBUUIILLTTIINN CCOOMMMMAANNDDSS below) are not inherited unless the function has been
- given the ttrraaccee attribute (see the description of the ddeeccllaarree builtin
- below) or the --oo ffuunnccttrraaccee shell option has been enabled with the sseett
- builtin (in which case all functions inherit the DDEEBBUUGG and RREETTUURRNN
- traps), and the EERRRR trap is not inherited unless the --oo eerrrrttrraaccee shell
+ RREETTUURRNN traps (see the description of the ttrraapp builtin under SSHHEELLLL
+ BBUUIILLTTIINN CCOOMMMMAANNDDSS below) are not inherited unless the function has been
+ given the ttrraaccee attribute (see the description of the ddeeccllaarree builtin
+ below) or the --oo ffuunnccttrraaccee shell option has been enabled with the sseett
+ builtin (in which case all functions inherit the DDEEBBUUGG and RREETTUURRNN
+ traps), and the EERRRR trap is not inherited unless the --oo eerrrrttrraaccee shell
option has been enabled.
- Variables local to the function may be declared with the llooccaall builtin
+ Variables local to the function may be declared with the llooccaall builtin
command. Ordinarily, variables and their values are shared between the
function and its caller.
- If the builtin command rreettuurrnn is executed in a function, the function
- completes and execution resumes with the next command after the func-
- tion call. Any command associated with the RREETTUURRNN trap is executed
+ The FFUUNNCCNNEESSTT 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.
+
+ If the builtin command rreettuurrnn is executed in a function, the function
+ completes and execution resumes with the next command after the func-
+ tion call. Any command associated with the RREETTUURRNN trap is executed
before execution resumes. When a function completes, the values of the
- positional parameters and the special parameter ## are restored to the
+ positional parameters and the special parameter ## are restored to the
values they had prior to the function's execution.
- Function names and definitions may be listed with the --ff option to the
+ Function names and definitions may be listed with the --ff option to the
ddeeccllaarree or ttyyppeesseett builtin commands. The --FF option to ddeeccllaarree or ttyyppee--
- sseett will list the function names only (and optionally the source file
- and line number, if the eexxttddeebbuugg shell option is enabled). Functions
- may be exported so that subshells automatically have them defined with
- the --ff option to the eexxppoorrtt builtin. A function definition may be
- deleted using the --ff option to the uunnsseett builtin. Note that shell
+ sseett will list the function names only (and optionally the source file
+ and line number, if the eexxttddeebbuugg shell option is enabled). Functions
+ may be exported so that subshells automatically have them defined with
+ the --ff option to the eexxppoorrtt builtin. A function definition may be
+ deleted using the --ff option to the uunnsseett builtin. Note that shell
functions and variables with the same name may result in multiple iden-
- tically-named entries in the environment passed to the shell's chil-
+ tically-named entries in the environment passed to the shell's chil-
dren. Care should be taken in cases where this may cause a problem.
- Functions may be recursive. No limit is imposed on the number of
+ Functions may be recursive. The FFUUNNCCNNEESSTT variable may be used to limit
+ the depth of the function call stack and restrict the number of func-
+ tion invocations. By default, no limit is imposed on the number of
recursive calls.
AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN
- The shell allows arithmetic expressions to be evaluated, under certain
- circumstances (see the lleett and ddeeccllaarree builtin commands and AArriitthhmmeettiicc
- EExxppaannssiioonn). Evaluation is done in fixed-width integers 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
+ The shell allows arithmetic expressions to be evaluated, under certain
+ circumstances (see the lleett and ddeeccllaarree builtin commands and AArriitthhmmeettiicc
+ EExxppaannssiioonn). Evaluation is done in fixed-width integers 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_d++++ _i_d----
@@ -2084,47 +2145,47 @@ AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN
_e_x_p_r_1 ,, _e_x_p_r_2
comma
- Shell variables are allowed as operands; parameter expansion is per-
+ Shell variables are allowed as operands; parameter expansion is per-
formed before the expression is evaluated. Within an expression, shell
- variables may also be referenced by name without using the parameter
- expansion syntax. A shell variable that is null or unset evaluates to
+ variables may also be referenced by name without using the parameter
+ expansion syntax. A shell variable that is null or unset evaluates to
0 when referenced by name without using the parameter expansion syntax.
- 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_n_t_e_g_e_r
+ 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_n_t_e_g_e_r
attribute using ddeeccllaarree --ii is assigned a value. A null value evaluates
- to 0. A shell variable need not have its integer attribute turned on
+ to 0. A shell variable need not have its _i_n_t_e_g_e_r attribute turned on
to be used in an expression.
Constants with a leading 0 are interpreted as octal numbers. A leading
- 0x or 0X denotes hexadecimal. Otherwise, numbers take the form
- [_b_a_s_e_#]n, where _b_a_s_e is a decimal number between 2 and 64 representing
- the arithmetic base, and _n is a number in that base. If _b_a_s_e_# is omit-
- ted, then base 10 is used. The digits greater than 9 are represented
- by the lowercase letters, the uppercase letters, @, and _, in that
- order. If _b_a_s_e is less than or equal to 36, lowercase and uppercase
- letters may be used interchangeably to represent numbers between 10 and
- 35.
-
- Operators are evaluated in order of precedence. Sub-expressions in
- parentheses are evaluated first and may override the precedence rules
+ 0x or 0X denotes hexadecimal. Otherwise, numbers take the form
+ [_b_a_s_e_#]n, where the optional _b_a_s_e is a decimal number between 2 and 64
+ representing the arithmetic base, and _n is a number in that base. If
+ _b_a_s_e_# is omitted, then base 10 is used. The digits greater than 9 are
+ represented by the lowercase letters, the uppercase letters, @, and _,
+ in that order. If _b_a_s_e is less than or equal to 36, lowercase and
+ uppercase letters may be used interchangeably to represent numbers
+ between 10 and 35.
+
+ Operators are evaluated in order of precedence. Sub-expressions in
+ parentheses are evaluated first and may override the precedence rules
above.
CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS
- Conditional expressions are used by the [[[[ compound command and the
- tteesstt and [[ builtin commands to test file attributes and perform string
- and arithmetic comparisons. Expressions are formed from the following
- unary or binary primaries. If any _f_i_l_e argument to one of the pri-
+ Conditional expressions are used by the [[[[ compound command and the
+ tteesstt and [[ builtin commands to test file attributes and perform string
+ and arithmetic comparisons. Expressions are formed from the following
+ unary or binary primaries. If any _f_i_l_e argument to one of the pri-
maries is of the form _/_d_e_v_/_f_d_/_n, then file descriptor _n is checked. If
- the _f_i_l_e argument to one of the primaries is one of _/_d_e_v_/_s_t_d_i_n,
- _/_d_e_v_/_s_t_d_o_u_t, or _/_d_e_v_/_s_t_d_e_r_r, file descriptor 0, 1, or 2, respectively,
+ the _f_i_l_e argument to one of the primaries is one of _/_d_e_v_/_s_t_d_i_n,
+ _/_d_e_v_/_s_t_d_o_u_t, or _/_d_e_v_/_s_t_d_e_r_r, file descriptor 0, 1, or 2, respectively,
is checked.
Unless otherwise specified, primaries that operate on files follow sym-
bolic links and operate on the target of the link, rather than the link
itself.
- When used with [[[[, The << and >> operators sort lexicographically using
- the current locale.
+ When used with [[[[, the << and >> operators sort lexicographically using
+ the current locale. The tteesstt command sorts using ASCII ordering.
--aa _f_i_l_e
True if _f_i_l_e exists.
@@ -2157,30 +2218,33 @@ CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS
True if _f_i_l_e exists and is writable.
--xx _f_i_l_e
True if _f_i_l_e exists and is executable.
- --OO _f_i_l_e
- True if _f_i_l_e exists and is owned by the effective user id.
--GG _f_i_l_e
True if _f_i_l_e exists and is owned by the effective group id.
--LL _f_i_l_e
True if _f_i_l_e exists and is a symbolic link.
- --SS _f_i_l_e
- True if _f_i_l_e exists and is a socket.
--NN _f_i_l_e
- True if _f_i_l_e exists and has been modified since it was last
+ True if _f_i_l_e exists and has been modified since it was last
read.
+ --OO _f_i_l_e
+ True if _f_i_l_e exists and is owned by the effective user id.
+ --SS _f_i_l_e
+ True if _f_i_l_e exists and is a socket.
+ _f_i_l_e_1 --eeff _f_i_l_e_2
+ True if _f_i_l_e_1 and _f_i_l_e_2 refer to the same device and inode num-
+ bers.
_f_i_l_e_1 -nntt _f_i_l_e_2
True if _f_i_l_e_1 is newer (according to modification date) than
_f_i_l_e_2, or if _f_i_l_e_1 exists and _f_i_l_e_2 does not.
_f_i_l_e_1 -oott _f_i_l_e_2
True if _f_i_l_e_1 is older than _f_i_l_e_2, or if _f_i_l_e_2 exists and _f_i_l_e_1
does not.
- _f_i_l_e_1 --eeff _f_i_l_e_2
- True if _f_i_l_e_1 and _f_i_l_e_2 refer to the same device and inode num-
- bers.
--oo _o_p_t_n_a_m_e
- True if shell option _o_p_t_n_a_m_e is enabled. See the list of
- options under the description of the --oo option to the sseett
+ True if the shell option _o_p_t_n_a_m_e is enabled. See the list of
+ options under the description of the --oo option to the sseett
builtin below.
+ --vv _v_a_r_n_a_m_e
+ True if the shell variable _v_a_r_n_a_m_e is set (has been assigned a
+ value).
--zz _s_t_r_i_n_g
True if the length of _s_t_r_i_n_g is zero.
_s_t_r_i_n_g
@@ -2354,7 +2418,7 @@ CCOOMMMMAANNDD EEXXEECCUUTTIIOONN EENNVVIIRROONNMMEENN
ronment cannot affect the shell's execution environment.
Subshells spawned to execute command substitutions inherit the value of
- the --ee option from the parent shell. When not in posix mode, Bash
+ the --ee option from the parent shell. When not in _p_o_s_i_x mode, bbaasshh
clears the --ee option in such subshells.
If a command is followed by a && and job control is not active, the
@@ -2593,7 +2657,7 @@ RREEAADDLLIINNEE
This is the library that handles reading input when using an interac-
tive shell, unless the ----nnooeeddiittiinngg option is given at shell invocation.
Line editing is also used when using the --ee option to the rreeaadd builtin.
- By default, the line editing commands are similar to those of emacs. A
+ 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 --oo eemmaaccss or --oo vvii options to the sseett
builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). To turn off line editing
@@ -2601,7 +2665,7 @@ RREEAADDLLIINNEE
sseett builtin.
RReeaaddlliinnee NNoottaattiioonn
- In this section, the emacs-style notation is used to denote keystrokes.
+ In this section, the Emacs-style notation is used to denote keystrokes.
Control keys are denoted by C-_k_e_y, e.g., C-n means Control-N. Simi-
larly, _m_e_t_a keys are denoted by M-_k_e_y, so M-x means Meta-X. (On key-
boards without a _m_e_t_a key, M-_x means ESC _x, i.e., press the Escape key
@@ -2771,7 +2835,7 @@ RREEAADDLLIINNEE
mapped to sseellff--iinnsseerrtt.
eeddiittiinngg--mmooddee ((eemmaaccss))
Controls whether readline begins with a set of key bindings sim-
- ilar to _e_m_a_c_s or _v_i. eeddiittiinngg--mmooddee can be set to either eemmaaccss or
+ ilar to _E_m_a_c_s or _v_i. eeddiittiinngg--mmooddee can be set to either eemmaaccss or
vvii.
eecchhoo--ccoonnttrrooll--cchhaarraacctteerrss ((OOnn))
When set to OOnn, on operating systems that indicate they support
@@ -2786,10 +2850,10 @@ RREEAADDLLIINNEE
key the terminal claims to support when it is called. On many
terminals, the meta key is used to send eight-bit characters.
eexxppaanndd--ttiillddee ((OOffff))
- If set to oonn, tilde expansion is performed when readline
+ If set to OOnn, tilde expansion is performed when readline
attempts word completion.
hhiissttoorryy--pprreesseerrvvee--ppooiinntt ((OOffff))
- If set to oonn, the history code attempts to place point at the
+ If set to OOnn, the history code attempts to place point at the
same location on each history line retrieved with pprreevviioouuss--hhiiss--
ttoorryy or nneexxtt--hhiissttoorryy.
hhiissttoorryy--ssiizzee ((00))
@@ -2829,8 +2893,12 @@ RREEAADDLLIINNEE
mmaattcchh--hhiiddddeenn--ffiilleess ((OOnn))
This variable, when set to OOnn, causes readline to match files
whose names begin with a `.' (hidden files) when performing
- filename completion, unless the leading `.' is supplied by the
- user in the filename to be completed.
+ filename completion. If set to OOffff, the leading `.' must be
+ supplied by the user in the filename to be completed.
+ mmeennuu--ccoommpplleettee--ddiissppllaayy--pprreeffiixx ((OOffff))
+ If set to OOnn, menu completion displays the common prefix of the
+ list of possible completions (which may be empty) before cycling
+ through the list.
oouuttppuutt--mmeettaa ((OOffff))
If set to OOnn, readline will display characters with the eighth
bit set directly rather than as a meta-prefixed escape sequence.
@@ -2842,18 +2910,18 @@ RREEAADDLLIINNEE
sorted horizontally in alphabetical order, rather than down the
screen.
rreevveerrtt--aallll--aatt--nneewwlliinnee ((OOffff))
- If set to oonn, readline will undo all changes to history lines
+ If set to OOnn, readline will undo all changes to history lines
before returning when aacccceepptt--lliinnee is executed. By default, his-
tory lines may be modified and retain individual undo lists
across calls to rreeaaddlliinnee.
sshhooww--aallll--iiff--aammbbiigguuoouuss ((OOffff))
This alters the default behavior of the completion functions.
- If set to oonn, words which have more than one possible completion
+ If set to OOnn, words which have more than one possible completion
cause the matches to be listed immediately instead of ringing
the bell.
sshhooww--aallll--iiff--uunnmmooddiiffiieedd ((OOffff))
This alters the default behavior of the completion functions in
- a fashion similar to sshhooww--aallll--iiff--aammbbiigguuoouuss. If set to oonn, words
+ a fashion similar to sshhooww--aallll--iiff--aammbbiigguuoouuss. If set to OOnn, words
which have more than one possible completion without any possi-
ble partial completion (the possible completions don't share a
common prefix) cause the matches to be listed immediately
@@ -2904,7 +2972,7 @@ RREEAADDLLIINNEE
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
- Bash:
+ bbaasshh:
$$iiff Bash
# Quote the current or previous word
@@ -3043,12 +3111,16 @@ RREEAADDLLIINNEE
"!_n" history expansion had been specified.
yyaannkk--llaasstt--aarrgg ((MM--..,, MM--__))
Insert the last argument to the previous command (the last word
- of the previous history entry). With an argument, behave
+ of the previous history entry). With a numeric argument, behave
exactly like yyaannkk--nntthh--aarrgg. Successive calls to yyaannkk--llaasstt--aarrgg
- move back through the history list, inserting the last argument
- of each line in turn. The history expansion facilities are used
- to extract the last argument, as if the "!$" history expansion
- had been specified.
+ 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). The history expansion facilities are used to
+ extract the last argument, as if the "!$" history expansion had
+ been specified.
sshheellll--eexxppaanndd--lliinnee ((MM--CC--ee))
Expand the line as the shell does. This performs alias and his-
tory expansion as well as all of the shell word expansions. See
@@ -3214,9 +3286,9 @@ RREEAADDLLIINNEE
moves _n positions forward in the list of matches; a negative
argument may be used to move backward through the list. This
command is intended to be bound to TTAABB, but is unbound by
- default.cc
- mmeennuu--ccoommpplleettee--kkrrdd
- Identicwwal to mmeennuu--ccoommpplleettee, but moves backward through the list
+ default.
+ mmeennuu--ccoommpplleettee--bbaacckkwwaarrdd
+ Identical to mmeennuu--ccoommpplleettee, but moves backward through the list
of possible completions, as if mmeennuu--ccoommpplleettee had been given a
negative argument. This command is unbound by default.
ddeelleettee--cchhaarr--oorr--lliisstt
@@ -3314,7 +3386,7 @@ RREEAADDLLIINNEE
A character is read and point is moved to the previous occur-
rence of that character. A negative count searches for subse-
quent occurrences.
- sskkiipp--ccssii--sseeqquueennccee (())
+ sskkiipp--ccssii--sseeqquueennccee
Read enough characters to consume a multi-key sequence such as
those defined for keys like Home and End. Such sequences begin
with a Control Sequence Indicator (CSI), usually ESC-[. If this
@@ -3381,7 +3453,7 @@ RREEAADDLLIINNEE
word is a full pathname, a compspec for the full pathname is searched
for first. If no compspec is found for the full pathname, an attempt
is made to find a compspec for the portion following the final slash.
- If those searches to not result in a compspec, any compspec defined
+ If those searches do not result in a compspec, any compspec defined
with the --DD option to ccoommpplleettee is used as the default.
Once a compspec has been found, it is used to generate the list of
@@ -3476,8 +3548,8 @@ RREEAADDLLIINNEE
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 compspec for that command. This allows a set of com-
- pletions to be built dynamically as completion is attempted, rather
+ attempt to find a new compspec for that command. This allows a set of
+ completions to be built dynamically as completion is attempted, rather
than being loaded all at once.
For instance, assuming that there is a library of compspecs, each kept
@@ -3593,24 +3665,26 @@ HHIISSTTOORRYY EEXXPPAANNSSIIOONN
EEvveenntt DDeessiiggnnaattoorrss
An event designator is a reference to a command line entry in the his-
- tory list.
+ tory list. Unless the reference is absolute, events are relative to
+ the current position in the history list.
- !! Start a history substitution, except when followed by a bbllaannkk,
- newline, carriage return, = or ( (when the eexxttgglloobb shell option
+ !! Start a history substitution, except when followed by a bbllaannkk,
+ newline, carriage return, = or ( (when the eexxttgglloobb shell option
is enabled using the sshhoopptt builtin).
!!_n Refer to command line _n.
- !!--_n Refer to the current command line minus _n.
+ !!--_n Refer to the current command minus _n.
!!!! Refer to the previous command. This is a synonym for `!-1'.
!!_s_t_r_i_n_g
- Refer to the most recent command starting with _s_t_r_i_n_g.
+ Refer to the most recent command preceding the current position
+ in the history list starting with _s_t_r_i_n_g.
!!??_s_t_r_i_n_g[[??]]
- Refer to the most recent command containing _s_t_r_i_n_g. The trail-
- ing ?? may be omitted if _s_t_r_i_n_g is followed immediately by a new-
- line.
+ Refer to the most recent command preceding the current postition
+ in the history list containing _s_t_r_i_n_g. The trailing ?? may be
+ omitted if _s_t_r_i_n_g is followed immediately by a newline.
^^_s_t_r_i_n_g_1^^_s_t_r_i_n_g_2^^
- Quick substitution. Repeat the last command, replacing _s_t_r_i_n_g_1
- with _s_t_r_i_n_g_2. Equivalent to ``!!:s/_s_t_r_i_n_g_1/_s_t_r_i_n_g_2/'' (see MMoodd--
- iiffiieerrss below).
+ Quick substitution. Repeat the previous command, replacing
+ _s_t_r_i_n_g_1 with _s_t_r_i_n_g_2. Equivalent to ``!!:s/_s_t_r_i_n_g_1/_s_t_r_i_n_g_2/''
+ (see MMooddiiffiieerrss below).
!!## The entire command line typed so far.
WWoorrdd DDeessiiggnnaattoorrss
@@ -3785,7 +3859,7 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
ccaalllleerr [_e_x_p_r]
Returns the context of any active subroutine call (a shell func-
- tion or a script executed with the .. or ssoouurrccee builtins. With-
+ tion or a script executed with the .. or ssoouurrccee builtins). With-
out _e_x_p_r, ccaalllleerr displays the line number and source filename of
the current subroutine call. If a non-negative integer is sup-
plied as _e_x_p_r, ccaalllleerr displays the line number, subroutine name,
@@ -3796,7 +3870,7 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
routine call or _e_x_p_r does not correspond to a valid position in
the call stack.
- ccdd [--LL||--PP] [_d_i_r]
+ ccdd [--LL|[--PP [--ee]]] [_d_i_r]
Change the current directory to _d_i_r. The variable HHOOMMEE is the
default _d_i_r. The variable CCDDPPAATTHH defines the search path for
the directory containing _d_i_r. Alternative directory names in
@@ -3806,104 +3880,107 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
option says to use the physical directory structure instead of
following symbolic links (see also the --PP option to the sseett
builtin command); the --LL option forces symbolic links to be fol-
- lowed. An argument of -- is equivalent to $$OOLLDDPPWWDD. If a non-
- empty directory name from CCDDPPAATTHH is used, or if -- is the first
- argument, and the directory change is successful, the absolute
- pathname of the new working directory is written to the standard
- output. The return value is true if the directory was success-
+ lowed. If the --ee option is supplied with --PP, and the current
+ working directory cannot be successfully determined after a suc-
+ cessful directory change, ccdd will return an unsuccessful status.
+ An argument of -- is equivalent to $$OOLLDDPPWWDD. If a non-empty
+ directory name from CCDDPPAATTHH is used, or if -- is the first argu-
+ ment, and the directory change is successful, the absolute path-
+ name of the new working directory is written to the standard
+ output. The return value is true if the directory was success-
fully changed; false otherwise.
ccoommmmaanndd [--ppVVvv] _c_o_m_m_a_n_d [_a_r_g ...]
- Run _c_o_m_m_a_n_d with _a_r_g_s suppressing the normal shell function
- lookup. Only builtin commands or commands found in the PPAATTHH are
- executed. If the --pp option is given, the search for _c_o_m_m_a_n_d is
- performed using a default value for PPAATTHH that is guaranteed to
- find all of the standard utilities. If either the --VV or --vv
+ Run _c_o_m_m_a_n_d with _a_r_g_s suppressing the normal shell function
+ lookup. Only builtin commands or commands found in the PPAATTHH are
+ executed. If the --pp option is given, the search for _c_o_m_m_a_n_d is
+ performed using a default value for PPAATTHH that is guaranteed to
+ find all of the standard utilities. If either the --VV or --vv
option is supplied, a description of _c_o_m_m_a_n_d is printed. The --vv
- option causes a single word indicating the command or file name
+ option causes a single word indicating the command or file name
used to invoke _c_o_m_m_a_n_d to be displayed; the --VV option produces a
- more verbose description. If the --VV or --vv option is supplied,
- the exit status is 0 if _c_o_m_m_a_n_d was found, and 1 if not. If
+ more verbose description. If the --VV or --vv option is supplied,
+ the exit status is 0 if _c_o_m_m_a_n_d was found, and 1 if not. If
neither option is supplied and an error occurred or _c_o_m_m_a_n_d can-
- not be found, the exit status is 127. Otherwise, the exit sta-
+ not be found, the exit status is 127. Otherwise, the exit sta-
tus of the ccoommmmaanndd builtin is the exit status of _c_o_m_m_a_n_d.
ccoommppggeenn [_o_p_t_i_o_n] [_w_o_r_d]
- Generate possible completion matches for _w_o_r_d according to the
- _o_p_t_i_o_ns, which may be any option accepted by the ccoommpplleettee
- builtin with the exception of --pp and --rr, and write the matches
- to the standard output. When using the --FF or --CC options, the
- various shell variables set by the programmable completion
+ Generate possible completion matches for _w_o_r_d according to the
+ _o_p_t_i_o_ns, which may be any option accepted by the ccoommpplleettee
+ builtin with the exception of --pp and --rr, and write the matches
+ to the standard output. When using the --FF or --CC options, the
+ various shell variables set by the programmable completion
facilities, while available, will not have useful values.
- The matches will be generated in the same way as if the pro-
- grammable completion code had generated them directly from a
+ The matches will be generated in the same way as if the pro-
+ grammable completion code had generated them directly from a
completion specification with the same flags. If _w_o_r_d is speci-
fied, only those completions matching _w_o_r_d will be displayed.
- The return value is true unless an invalid option is supplied,
+ The return value is true unless an invalid option is supplied,
or no matches were generated.
- ccoommpplleettee [--aabbccddeeffggjjkkssuuvv] [--oo _c_o_m_p_-_o_p_t_i_o_n] [--DDEE] [--AA _a_c_t_i_o_n] [--GG _g_l_o_b_-
+ ccoommpplleettee [--aabbccddeeffggjjkkssuuvv] [--oo _c_o_m_p_-_o_p_t_i_o_n] [--DDEE] [--AA _a_c_t_i_o_n] [--GG _g_l_o_b_-
_p_a_t] [--WW _w_o_r_d_l_i_s_t] [--FF _f_u_n_c_t_i_o_n] [--CC _c_o_m_m_a_n_d]
[--XX _f_i_l_t_e_r_p_a_t] [--PP _p_r_e_f_i_x] [--SS _s_u_f_f_i_x] _n_a_m_e [_n_a_m_e _._._.]
ccoommpplleettee --pprr [--DDEE] [_n_a_m_e ...]
- Specify how arguments to each _n_a_m_e should be completed. If the
- --pp option is supplied, or if no options are supplied, existing
- completion specifications are printed in a way that allows them
+ Specify how arguments to each _n_a_m_e should be completed. If the
+ --pp option is supplied, or if no options are supplied, existing
+ completion specifications are printed in a way that allows them
to be reused as input. The --rr option removes a completion spec-
- ification for each _n_a_m_e, or, if no _n_a_m_es are supplied, all com-
+ ification for each _n_a_m_e, or, if no _n_a_m_es are supplied, all com-
pletion specifications. The --DD option indicates that the
- remaining options and actions should apply to the ``default''
- command completion; that is, completion attempted on a command
- for which no completion has previously been defined. The --EE
- option indicates that the remaining options and actions should
- apply to ``empty'' command completion; that is, completion
+ remaining options and actions should apply to the ``default''
+ command completion; that is, completion attempted on a command
+ for which no completion has previously been defined. The --EE
+ option indicates that the remaining options and actions should
+ apply to ``empty'' command completion; that is, completion
attempted on a blank line.
- The process of applying these completion specifications when
- word completion is attempted is described above under PPrroo--
+ The process of applying these completion specifications when
+ word completion is attempted is described above under PPrroo--
ggrraammmmaabbllee CCoommpplleettiioonn.
- Other options, if specified, have the following meanings. The
- arguments to the --GG, --WW, and --XX options (and, if necessary, the
- --PP and --SS options) should be quoted to protect them from expan-
+ Other options, if specified, have the following meanings. The
+ arguments to the --GG, --WW, and --XX options (and, if necessary, the
+ --PP and --SS options) should be quoted to protect them from expan-
sion before the ccoommpplleettee builtin is invoked.
--oo _c_o_m_p_-_o_p_t_i_o_n
- The _c_o_m_p_-_o_p_t_i_o_n controls several aspects of the comp-
- spec's behavior beyond the simple generation of comple-
+ The _c_o_m_p_-_o_p_t_i_o_n controls several aspects of the comp-
+ spec's behavior beyond the simple generation of comple-
tions. _c_o_m_p_-_o_p_t_i_o_n may be one of:
bbaasshhddeeffaauulltt
Perform the rest of the default bbaasshh completions
if the compspec generates no matches.
- ddeeffaauulltt Use readline's default filename completion if
+ ddeeffaauulltt Use readline's default filename completion if
the compspec generates no matches.
ddiirrnnaammeess
- Perform directory name completion if the comp-
+ Perform directory name completion if the comp-
spec generates no matches.
ffiilleennaammeess
- Tell readline that the compspec generates file-
- names, so it can perform any filename-specific
- processing (like adding a slash to directory
- names, quoting special characters, or suppress-
- ing trailing spaces). Intended to be used with
+ Tell readline that the compspec generates file-
+ names, so it can perform any filename-specific
+ processing (like adding a slash to directory
+ names, quoting special characters, or suppress-
+ ing trailing spaces). Intended to be used with
shell functions.
- nnoossppaaccee Tell readline not to append a space (the
- default) to words completed at the end of the
+ nnoossppaaccee Tell readline not to append a space (the
+ default) to words completed at the end of the
line.
pplluussddiirrss
- After any matches defined by the compspec are
- generated, directory name completion is
- attempted and any matches are added to the
+ After any matches defined by the compspec are
+ generated, directory name completion is
+ attempted and any matches are added to the
results of the other actions.
--AA _a_c_t_i_o_n
- The _a_c_t_i_o_n may be one of the following to generate a
+ The _a_c_t_i_o_n may be one of the following to generate a
list of possible completions:
aalliiaass Alias names. May also be specified as --aa.
aarrrraayyvvaarr
Array variable names.
bbiinnddiinngg RReeaaddlliinnee key binding names.
- bbuuiillttiinn Names of shell builtin commands. May also be
+ bbuuiillttiinn Names of shell builtin commands. May also be
specified as --bb.
ccoommmmaanndd Command names. May also be specified as --cc.
ddiirreeccttoorryy
@@ -3911,7 +3988,7 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
ddiissaabblleedd
Names of disabled shell builtins.
eennaabblleedd Names of enabled shell builtins.
- eexxppoorrtt Names of exported shell variables. May also be
+ eexxppoorrtt Names of exported shell variables. May also be
specified as --ee.
ffiillee File names. May also be specified as --ff.
ffuunnccttiioonn
@@ -3920,17 +3997,17 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
hheellppttooppiicc
Help topics as accepted by the hheellpp builtin.
hhoossttnnaammee
- Hostnames, as taken from the file specified by
+ Hostnames, as taken from the file specified by
the HHOOSSTTFFIILLEE shell variable.
- jjoobb Job names, if job control is active. May also
+ jjoobb Job names, if job control is active. May also
be specified as --jj.
- kkeeyywwoorrdd Shell reserved words. May also be specified as
+ kkeeyywwoorrdd Shell reserved words. May also be specified as
--kk.
rruunnnniinngg Names of running jobs, if job control is active.
sseerrvviiccee Service names. May also be specified as --ss.
- sseettoopptt Valid arguments for the --oo option to the sseett
+ sseettoopptt Valid arguments for the --oo option to the sseett
builtin.
- sshhoopptt Shell option names as accepted by the sshhoopptt
+ sshhoopptt Shell option names as accepted by the sshhoopptt
builtin.
ssiiggnnaall Signal names.
ssttooppppeedd Names of stopped jobs, if job control is active.
@@ -3938,15 +4015,6 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
vvaarriiaabbllee
Names of all shell variables. May also be spec-
ified as --vv.
- --GG _g_l_o_b_p_a_t
- The pathname expansion pattern _g_l_o_b_p_a_t is expanded to
- generate the possible completions.
- --WW _w_o_r_d_l_i_s_t
- The _w_o_r_d_l_i_s_t is split using the characters in the IIFFSS
- special variable as delimiters, and each resultant word
- is expanded. The possible completions are the members
- of the resultant list which match the word being com-
- pleted.
--CC _c_o_m_m_a_n_d
_c_o_m_m_a_n_d is executed in a subshell environment, and its
output is used as the possible completions.
@@ -3955,69 +4023,81 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
shell environment. When it finishes, the possible com-
pletions are retrieved from the value of the CCOOMMPPRREEPPLLYY
array variable.
- --XX _f_i_l_t_e_r_p_a_t
- _f_i_l_t_e_r_p_a_t is a pattern as used for pathname expansion.
- It is applied to the list of possible completions gener-
- ated by the preceding options and arguments, and each
- completion matching _f_i_l_t_e_r_p_a_t is removed from the list.
- A leading !! in _f_i_l_t_e_r_p_a_t negates the pattern; in this
- case, any completion not matching _f_i_l_t_e_r_p_a_t is removed.
+ --GG _g_l_o_b_p_a_t
+ The pathname expansion pattern _g_l_o_b_p_a_t is expanded to
+ generate the possible completions.
--PP _p_r_e_f_i_x
- _p_r_e_f_i_x is added at the beginning of each possible com-
+ _p_r_e_f_i_x is added at the beginning of each possible com-
pletion after all other options have been applied.
--SS _s_u_f_f_i_x
_s_u_f_f_i_x is appended to each possible completion after all
other options have been applied.
-
- The return value is true unless an invalid option is supplied,
- an option other than --pp or --rr is supplied without a _n_a_m_e argu-
- ment, an attempt is made to remove a completion specification
+ --WW _w_o_r_d_l_i_s_t
+ The _w_o_r_d_l_i_s_t is split using the characters in the IIFFSS
+ special variable as delimiters, and each resultant word
+ is expanded. The possible completions are the members
+ of the resultant list which match the word being com-
+ pleted.
+ --XX _f_i_l_t_e_r_p_a_t
+ _f_i_l_t_e_r_p_a_t is a pattern as used for pathname expansion.
+ It is applied to the list of possible completions gener-
+ ated by the preceding options and arguments, and each
+ completion matching _f_i_l_t_e_r_p_a_t is removed from the list.
+ A leading !! in _f_i_l_t_e_r_p_a_t negates the pattern; in this
+ case, any completion not matching _f_i_l_t_e_r_p_a_t is removed.
+
+ The return value is true unless an invalid option is supplied,
+ an option other than --pp or --rr is supplied without a _n_a_m_e argu-
+ ment, an attempt is made to remove a completion specification
for a _n_a_m_e for which no specification exists, or an error occurs
adding a completion specification.
ccoommppoopptt [--oo _o_p_t_i_o_n] [--DDEE] [++oo _o_p_t_i_o_n] [_n_a_m_e]
Modify completion options for each _n_a_m_e according to the
- _o_p_t_i_o_ns, or for the currently-execution completion if no _n_a_m_es
- are supplied. If no _o_p_t_i_o_ns are given, display the completion
- options for each _n_a_m_e or the current completion. The possible
- values of _o_p_t_i_o_n are those valid for the ccoommpplleettee builtin
- described above. The --DD option indicates that the remaining
+ _o_p_t_i_o_ns, or for the currently-executing completion if no _n_a_m_es
+ are supplied. If no _o_p_t_i_o_ns are given, display the completion
+ options for each _n_a_m_e or the current completion. The possible
+ values of _o_p_t_i_o_n are those valid for the ccoommpplleettee builtin
+ described above. The --DD option indicates that the remaining
options should apply to the ``default'' command completion; that
- is, completion attempted on a command for which no completion
- has previously been defined. The --EE option indicates that the
- remaining options should apply to ``empty'' command completion;
+ is, completion attempted on a command for which no completion
+ has previously been defined. The --EE option indicates that the
+ remaining options should apply to ``empty'' command completion;
that is, completion attempted on a blank line.
- The return value is true unless an invalid option is supplied, an
- attempt is made to modify the options for a _n_a_m_e for which no comple-
- tion specification exists, or an output error occurs.
+ The return value is true unless an invalid option is supplied,
+ an attempt is made to modify the options for a _n_a_m_e for which no
+ completion specification exists, or an output error occurs.
ccoonnttiinnuuee [_n]
Resume the next iteration of the enclosing ffoorr, wwhhiillee, uunnttiill, or
- sseelleecctt loop. If _n is specified, resume at the _nth enclosing
- loop. _n must be >= 1. If _n is greater than the number of
- enclosing loops, the last enclosing loop (the ``top-level''
+ sseelleecctt loop. If _n is specified, resume at the _nth enclosing
+ loop. _n must be >= 1. If _n is greater than the number of
+ enclosing loops, the last enclosing loop (the ``top-level''
loop) is resumed. The return value is 0 unless _n is not greater
than or equal to 1.
- ddeeccllaarree [--aaAAffFFiillrrttuuxx] [--pp] [_n_a_m_e[=_v_a_l_u_e] ...]
- ttyyppeesseett [--aaAAffFFiillrrttuuxx] [--pp] [_n_a_m_e[=_v_a_l_u_e] ...]
- Declare variables and/or give them attributes. If no _n_a_m_es are
- given then display the values of variables. The --pp option will
+ ddeeccllaarree [--aaAAffFFggiillrrttuuxx] [--pp] [_n_a_m_e[=_v_a_l_u_e] ...]
+ ttyyppeesseett [--aaAAffFFggiillrrttuuxx] [--pp] [_n_a_m_e[=_v_a_l_u_e] ...]
+ Declare variables and/or give them attributes. If no _n_a_m_es are
+ given then display the values of variables. The --pp option will
display the attributes and values of each _n_a_m_e. When --pp is used
with _n_a_m_e arguments, additional options are ignored. When --pp is
- supplied without _n_a_m_e arguments, it will display the attributes
- and values of all variables having the attributes specified by
- the additional options. If no other options are supplied with
- --pp, ddeeccllaarree will display the attributes and values of all shell
- variables. The --ff option will restrict the display to shell
+ supplied without _n_a_m_e arguments, it will display the attributes
+ and values of all variables having the attributes specified by
+ the additional options. If no other options are supplied with
+ --pp, ddeeccllaarree will display the attributes and values of all shell
+ variables. The --ff option will restrict the display to shell
functions. The --FF option inhibits the display of function defi-
- nitions; only the function name and attributes are printed. If
- the eexxttddeebbuugg shell option is enabled using sshhoopptt, the source
+ nitions; only the function name and attributes are printed. If
+ the eexxttddeebbuugg shell option is enabled using sshhoopptt, the source
file name and line number where the function is defined are dis-
- played as well. The --FF option implies --ff. The following
- options can be used to restrict output to variables with the
- specified attribute or to give variables attributes:
+ played as well. The --FF option implies --ff. The --gg option forces
+ variables to be created or modified at the global scope, even
+ when ddeeccllaarree is executed in a shell function. It is ignored in
+ all other cases. The following options can be used to restrict
+ output to variables with the specified attribute or to give
+ variables attributes:
--aa Each _n_a_m_e is an indexed array variable (see AArrrraayyss
above).
--AA Each _n_a_m_e is an associative array variable (see AArrrraayyss
@@ -4044,20 +4124,20 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
Using `+' instead of `-' turns off the attribute instead, with
the exceptions that ++aa may not be used to destroy an array vari-
able and ++rr will not remove the readonly attribute. When used
- in a function, makes each _n_a_m_e local, as with the llooccaall command.
- If a variable name is followed by =_v_a_l_u_e, the value of the vari-
- able is set to _v_a_l_u_e. The return value is 0 unless an invalid
- option is encountered, an attempt is made to define a function
- using ``-f foo=bar'', 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
- AArrrraayyss above), one of the _n_a_m_e_s is not a valid shell variable
- name, an attempt is made to turn off readonly status for a read-
- only variable, an attempt is made to turn off array status for
- an array variable, or an attempt is made to display a non-exis-
- tent function with --ff.
-
- ddiirrss [[++_n]] [[--_n]] [[--ccppllvv]]
+ in a function, makes each _n_a_m_e local, as with the llooccaall command,
+ unless the --ggPP ooppttiioonn iiss ssuupppplliieedd,, IIff aa vvaarriiaabbllee nnaammee iiss ffooll--
+ lloowweedd bbyy ==_v_a_l_u_e,, tthhee vvaalluuee ooff tthhee vvaarriiaabbllee iiss sseett ttoo _v_a_l_u_e.. TThhee
+ rreettuurrnn vvaalluuee iiss 00 uunnlleessss aann iinnvvaalliidd ooppttiioonn iiss eennccoouunntteerreedd,, aann
+ aatttteemmpptt iiss mmaaddee ttoo ddeeffiinnee aa ffuunnccttiioonn uussiinngg ````--ff ffoooo==bbaarr'''',, aann
+ aatttteemmpptt iiss mmaaddee ttoo aassssiiggnn aa vvaalluuee ttoo aa rreeaaddoonnllyy vvaarriiaabbllee,, aann
+ aatttteemmpptt iiss mmaaddee ttoo aassssiiggnn aa vvaalluuee ttoo aann aarrrraayy vvaarriiaabbllee wwiitthhoouutt
+ uussiinngg tthhee ccoommppoouunndd aassssiiggnnmmeenntt ssyynnttaaxx ((sseeee AArrrraayyss above), one of
+ the _n_a_m_e_s 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 --ff.
+
+ ddiirrss [[++_n]] [[--_n]] [[--ccllppvv]]
Without options, displays the list of currently remembered
directories. The default display is on a single line with
directory names separated by spaces. Directories are added to
@@ -4107,7 +4187,8 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
\\aa alert (bell)
\\bb backspace
\\cc suppress further output
- \\ee an escape character
+ \\ee
+ \\EE an escape character
\\ff form feed
\\nn new line
\\rr carriage return
@@ -4118,6 +4199,11 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
_n_n_n (zero to three octal digits)
\\xx_H_H the eight-bit character whose value is the hexadecimal
value _H_H (one or two hex digits)
+ \\uu_H_H_H_H the Unicode (ISO/IEC 10646) character whose value is the
+ hexadecimal value _H_H_H_H (one to four hex digits)
+ \\UU_H_H_H_H_H_H_H_H
+ the Unicode (ISO/IEC 10646) character whose value is the
+ hexadecimal value _H_H_H_H_H_H_H_H (one to eight hex digits)
eennaabbllee [--aa] [--ddnnppss] [--ff _f_i_l_e_n_a_m_e] [_n_a_m_e ...]
Enable and disable builtin shell commands. Disabling a builtin
@@ -4245,7 +4331,7 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
When the end of options is encountered, ggeettooppttss exits with a
return value greater than zero. OOPPTTIINNDD is set to the index of
- the first non-option argument, and nnaammee is set to ?.
+ the first non-option argument, and _n_a_m_e is set to ?.
ggeettooppttss normally parses the positional parameters, but if more
arguments are given in _a_r_g_s, ggeettooppttss parses those instead.
@@ -4273,25 +4359,26 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
an error occurs.
hhaasshh [--llrr] [--pp _f_i_l_e_n_a_m_e] [--ddtt] [_n_a_m_e]
- For each _n_a_m_e, the full file name of the command is determined
- by searching the directories in $$PPAATTHH and remembered. If the --pp
- option is supplied, no path search is performed, and _f_i_l_e_n_a_m_e is
- used as the full file name of the command. The --rr option causes
- the shell to forget all remembered locations. The --dd option
- causes the shell to forget the remembered location of each _n_a_m_e.
- If the --tt option is supplied, the full pathname to which each
- _n_a_m_e corresponds is printed. If multiple _n_a_m_e arguments are
- supplied with --tt, the _n_a_m_e is printed before the hashed full
- pathname. The --ll option causes output to be displayed in a for-
- mat that may be reused as input. If no arguments are given, or
- if only --ll is supplied, information about remembered commands is
- printed. The return status is true unless a _n_a_m_e is not found
- or an invalid option is supplied.
+ Each time hhaasshh is invoked, the full pathname of the command _n_a_m_e
+ is determined by searching the directories in $$PPAATTHH and remem-
+ bered. Any previously-remembered pathname is discarded. If the
+ --pp option is supplied, no path search is performed, and _f_i_l_e_n_a_m_e
+ is used as the full file name of the command. The --rr option
+ causes the shell to forget all remembered locations. The --dd
+ option causes the shell to forget the remembered location of
+ each _n_a_m_e. If the --tt option is supplied, the full pathname to
+ which each _n_a_m_e corresponds is printed. If multiple _n_a_m_e argu-
+ ments are supplied with --tt, the _n_a_m_e is printed before the
+ hashed full pathname. The --ll option causes output to be dis-
+ played in a format that may be reused as input. If no arguments
+ are given, or if only --ll is supplied, information about remem-
+ bered commands is printed. The return status is true unless a
+ _n_a_m_e is not found or an invalid option is supplied.
hheellpp [--ddmmss] [_p_a_t_t_e_r_n]
- Display helpful information about builtin commands. If _p_a_t_t_e_r_n
- is specified, hheellpp gives detailed help on all commands matching
- _p_a_t_t_e_r_n; otherwise help for all the builtins and shell control
+ Display helpful information about builtin commands. If _p_a_t_t_e_r_n
+ is specified, hheellpp gives detailed help on all commands matching
+ _p_a_t_t_e_r_n; otherwise help for all the builtins and shell control
structures is printed.
--dd Display a short description of each _p_a_t_t_e_r_n
--mm Display the description of each _p_a_t_t_e_r_n in a manpage-like
@@ -4307,44 +4394,44 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
hhiissttoorryy --ss _a_r_g [_a_r_g _._._.]
With no options, display the command history list with line num-
bers. Lines listed with a ** have been modified. An argument of
- _n lists only the last _n lines. If the shell variable HHIISSTTTTIIMMEE--
- FFOORRMMAATT is set and not null, it is used as a format string for
- _s_t_r_f_t_i_m_e(3) to display the time stamp associated with each dis-
- played history entry. No intervening blank is printed between
- the formatted time stamp and the history line. If _f_i_l_e_n_a_m_e is
- supplied, it is used as the name of the history file; if not,
- the value of HHIISSTTFFIILLEE is used. Options, if supplied, have the
+ _n lists only the last _n lines. If the shell variable HHIISSTTTTIIMMEE--
+ FFOORRMMAATT is set and not null, it is used as a format string for
+ _s_t_r_f_t_i_m_e(3) to display the time stamp associated with each dis-
+ played history entry. No intervening blank is printed between
+ the formatted time stamp and the history line. If _f_i_l_e_n_a_m_e is
+ supplied, it is used as the name of the history file; if not,
+ the value of HHIISSTTFFIILLEE is used. Options, if supplied, have the
following meanings:
--cc Clear the history list by deleting all the entries.
--dd _o_f_f_s_e_t
Delete the history entry at position _o_f_f_s_e_t.
- --aa Append the ``new'' history lines (history lines entered
- since the beginning of the current bbaasshh session) to the
+ --aa Append the ``new'' history lines (history lines entered
+ since the beginning of the current bbaasshh session) to the
history file.
- --nn Read the history lines not already read from the history
- file into the current history list. These are lines
- appended to the history file since the beginning of the
+ --nn Read the history lines not already read from the history
+ file into the current history list. These are lines
+ appended to the history file since the beginning of the
current bbaasshh session.
--rr Read the contents of the history file and use them as the
current history.
- --ww Write the current history to the history file, overwrit-
+ --ww Write the current history to the history file, overwrit-
ing the history file's contents.
- --pp Perform history substitution on the following _a_r_g_s and
- display the result on the standard output. Does not
- store the results in the history list. Each _a_r_g must be
+ --pp Perform history substitution on the following _a_r_g_s and
+ display the result on the standard output. Does not
+ store the results in the history list. Each _a_r_g must be
quoted to disable normal history expansion.
- --ss Store the _a_r_g_s in the history list as a single entry.
- The last command in the history list is removed before
+ --ss Store the _a_r_g_s in the history list as a single entry.
+ The last command in the history list is removed before
the _a_r_g_s are added.
- If the HHIISSTTTTIIMMEEFFOORRMMAATT variable is set, the time stamp informa-
- tion associated with each history entry is written to the his-
- tory file, marked with the history comment character. When the
- history file is read, lines beginning with the history comment
- character followed immediately by a digit are interpreted as
+ If the HHIISSTTTTIIMMEEFFOORRMMAATT variable is set, the time stamp informa-
+ tion associated with each history entry is written to the his-
+ tory file, marked with the history comment character. When the
+ history file is read, lines beginning with the history comment
+ character followed immediately by a digit are interpreted as
timestamps for the previous history line. The return value is 0
- unless an invalid option is encountered, an error occurs while
- reading or writing the history file, an invalid _o_f_f_s_e_t is sup-
+ unless an invalid option is encountered, an error occurs while
+ reading or writing the history file, an invalid _o_f_f_s_e_t is sup-
plied as an argument to --dd, or the history expansion supplied as
an argument to --pp fails.
@@ -4353,127 +4440,141 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
The first form lists the active jobs. The options have the fol-
lowing meanings:
--ll List process IDs in addition to the normal information.
- --pp List only the process ID of the job's process group
- leader.
--nn Display information only about jobs that have changed
status since the user was last notified of their status.
+ --pp List only the process ID of the job's process group
+ leader.
--rr Restrict output to running jobs.
--ss Restrict output to stopped jobs.
- If _j_o_b_s_p_e_c is given, output is restricted to information about
- that job. The return status is 0 unless an invalid option is
+ If _j_o_b_s_p_e_c is given, output is restricted to information about
+ that job. The return status is 0 unless an invalid option is
encountered or an invalid _j_o_b_s_p_e_c is supplied.
If the --xx option is supplied, jjoobbss replaces any _j_o_b_s_p_e_c found in
- _c_o_m_m_a_n_d or _a_r_g_s with the corresponding process group ID, and
+ _c_o_m_m_a_n_d or _a_r_g_s with the corresponding process group ID, and
executes _c_o_m_m_a_n_d passing it _a_r_g_s, returning its exit status.
kkiillll [--ss _s_i_g_s_p_e_c | --nn _s_i_g_n_u_m | --_s_i_g_s_p_e_c] [_p_i_d | _j_o_b_s_p_e_c] ...
kkiillll --ll [_s_i_g_s_p_e_c | _e_x_i_t___s_t_a_t_u_s]
- Send the signal named by _s_i_g_s_p_e_c or _s_i_g_n_u_m to the processes
- named by _p_i_d or _j_o_b_s_p_e_c. _s_i_g_s_p_e_c is either a case-insensitive
- signal name such as SSIIGGKKIILLLL (with or without the SSIIGG prefix) or
- a signal number; _s_i_g_n_u_m is a signal number. If _s_i_g_s_p_e_c is not
- present, then SSIIGGTTEERRMM is assumed. An argument of --ll lists the
- signal names. If any arguments are supplied when --ll is given,
- the names of the signals corresponding to the arguments are
+ Send the signal named by _s_i_g_s_p_e_c or _s_i_g_n_u_m to the processes
+ named by _p_i_d or _j_o_b_s_p_e_c. _s_i_g_s_p_e_c is either a case-insensitive
+ signal name such as SSIIGGKKIILLLL (with or without the SSIIGG prefix) or
+ a signal number; _s_i_g_n_u_m is a signal number. If _s_i_g_s_p_e_c is not
+ present, then SSIIGGTTEERRMM is assumed. An argument of --ll lists the
+ signal names. If any arguments are supplied when --ll is given,
+ the names of the signals corresponding to the arguments are
listed, and the return status is 0. The _e_x_i_t___s_t_a_t_u_s argument to
- --ll is a number specifying either a signal number or the exit
- status of a process terminated by a signal. kkiillll returns true
- if at least one signal was successfully sent, or false if an
+ --ll is a number specifying either a signal number or the exit
+ status of a process terminated by a signal. kkiillll returns true
+ if at least one signal was successfully sent, or false if an
error occurs or an invalid option is encountered.
lleett _a_r_g [_a_r_g ...]
Each _a_r_g is an arithmetic expression to be evaluated (see AARRIITTHH--
- MMEETTIICC EEVVAALLUUAATTIIOONN above). If the last _a_r_g evaluates to 0, lleett
+ MMEETTIICC EEVVAALLUUAATTIIOONN above). If the last _a_r_g evaluates to 0, lleett
returns 1; 0 is returned otherwise.
llooccaall [_o_p_t_i_o_n] [_n_a_m_e[=_v_a_l_u_e] ...]
- For each argument, a local variable named _n_a_m_e is created, and
- assigned _v_a_l_u_e. The _o_p_t_i_o_n can be any of the options accepted
+ For each argument, a local variable named _n_a_m_e is created, and
+ assigned _v_a_l_u_e. The _o_p_t_i_o_n can be any of the options accepted
by ddeeccllaarree. When llooccaall is used within a function, it causes the
- variable _n_a_m_e to have a visible scope restricted to that func-
+ variable _n_a_m_e to have a visible scope restricted to that func-
tion and its children. With no operands, llooccaall writes a list of
- local variables to the standard output. It is an error to use
+ local variables to the standard output. It is an error to use
llooccaall when not within a function. The return status is 0 unless
- llooccaall is used outside a function, an invalid _n_a_m_e is supplied,
+ llooccaall is used outside a function, an invalid _n_a_m_e is supplied,
or _n_a_m_e is a readonly variable.
llooggoouutt Exit a login shell.
- mmaappffiillee [--nn _c_o_u_n_t] [--OO _o_r_i_g_i_n] [--ss _c_o_u_n_t] [--tt] [--uu _f_d] [--CC _c_a_l_l_b_a_c_k]
+ mmaappffiillee [--nn _c_o_u_n_t] [--OO _o_r_i_g_i_n] [--ss _c_o_u_n_t] [--tt] [--uu _f_d] [--CC _c_a_l_l_b_a_c_k]
[--cc _q_u_a_n_t_u_m] [_a_r_r_a_y]
- rreeaaddaarrrraayy [--nn _c_o_u_n_t] [--OO _o_r_i_g_i_n] [--ss _c_o_u_n_t] [--tt] [--uu _f_d] [--CC _c_a_l_l_b_a_c_k]
+ rreeaaddaarrrraayy [--nn _c_o_u_n_t] [--OO _o_r_i_g_i_n] [--ss _c_o_u_n_t] [--tt] [--uu _f_d] [--CC _c_a_l_l_b_a_c_k]
[--cc _q_u_a_n_t_u_m] [_a_r_r_a_y]
- Read lines from the standard input into the indexed array vari-
- able _a_r_r_a_y, or from file descriptor _f_d if the --uu option is sup-
- plied. The variable MMAAPPFFIILLEE is the default _a_r_r_a_y. Options, if
+ Read lines from the standard input into the indexed array vari-
+ able _a_r_r_a_y, or from file descriptor _f_d if the --uu option is sup-
+ plied. The variable MMAAPPFFIILLEE is the default _a_r_r_a_y. Options, if
supplied, have the following meanings:
- --nn Copy at most _c_o_u_n_t lines. If _c_o_u_n_t is 0, all lines are
+ --nn Copy at most _c_o_u_n_t lines. If _c_o_u_n_t is 0, all lines are
copied.
- --OO Begin assigning to _a_r_r_a_y at index _o_r_i_g_i_n. The default
+ --OO Begin assigning to _a_r_r_a_y at index _o_r_i_g_i_n. The default
index is 0.
--ss Discard the first _c_o_u_n_t lines read.
--tt Remove a trailing newline from each line read.
- --uu Read lines from file descriptor _f_d instead of the stan-
+ --uu Read lines from file descriptor _f_d instead of the stan-
dard input.
- --CC Evaluate _c_a_l_l_b_a_c_k each time _q_u_a_n_t_u_m lines are read. The
+ --CC Evaluate _c_a_l_l_b_a_c_k each time _q_u_a_n_t_u_m lines are read. The
--cc option specifies _q_u_a_n_t_u_m.
- --cc Specify the number of lines read between each call to
+ --cc Specify the number of lines read between each call to
_c_a_l_l_b_a_c_k.
- If --CC is specified without --cc, the default quantum is 5000.
+ If --CC is specified without --cc, the default quantum is 5000.
When _c_a_l_l_b_a_c_k is evaluated, it is supplied the index of the next
- array element to be assigned as an additional argument. _c_a_l_l_-
- _b_a_c_k is evaluated after the line is read but before the array
- element is assigned.
+ array element to be assigned and the line to be assigned to that
+ element as additional arguments. _c_a_l_l_b_a_c_k is evaluated after
+ the line is read but before the array element is assigned.
- If not supplied with an explicit origin, mmaappffiillee will clear
+ If not supplied with an explicit origin, mmaappffiillee will clear
_a_r_r_a_y before assigning to it.
- mmaappffiillee returns successfully unless an invalid option or option
- argument is supplied, _a_r_r_a_y is invalid or unassignable, or if
+ mmaappffiillee returns successfully unless an invalid option or option
+ argument is supplied, _a_r_r_a_y is invalid or unassignable, or if
_a_r_r_a_y is not an indexed array.
ppooppdd [-nn] [+_n] [-_n]
- Removes entries from the directory stack. With no arguments,
- removes the top directory from the stack, and performs a ccdd to
+ Removes entries from the directory stack. With no arguments,
+ removes the top directory from the stack, and performs a ccdd to
the new top directory. Arguments, if supplied, have the follow-
ing meanings:
- --nn Suppresses the normal change of directory when removing
- directories from the stack, so that only the stack is
+ --nn Suppresses the normal change of directory when removing
+ directories from the stack, so that only the stack is
manipulated.
- ++_n Removes the _nth entry counting from the left of the list
- shown by ddiirrss, starting with zero. For example: ``popd
+ ++_n Removes the _nth entry counting from the left of the list
+ shown by ddiirrss, starting with zero. For example: ``popd
+0'' removes the first directory, ``popd +1'' the second.
--_n Removes the _nth entry counting from the right of the list
- shown by ddiirrss, starting with zero. For example: ``popd
- -0'' removes the last directory, ``popd -1'' the next to
+ shown by ddiirrss, starting with zero. For example: ``popd
+ -0'' removes the last directory, ``popd -1'' the next to
last.
- If the ppooppdd command is successful, a ddiirrss is performed as well,
- and the return status is 0. ppooppdd returns false if an invalid
+ If the ppooppdd command is successful, a ddiirrss is performed as well,
+ and the return status is 0. ppooppdd returns false if an invalid
option is encountered, the directory stack is empty, a non-exis-
tent directory stack entry is specified, or the directory change
fails.
pprriinnttff [--vv _v_a_r] _f_o_r_m_a_t [_a_r_g_u_m_e_n_t_s]
- Write the formatted _a_r_g_u_m_e_n_t_s to the standard output under the
- control of the _f_o_r_m_a_t. The _f_o_r_m_a_t 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 for-
- mat specifications, each of which causes printing of the next
- successive _a_r_g_u_m_e_n_t. In addition to the standard _p_r_i_n_t_f(1) for-
- mats, %%bb causes pprriinnttff to expand backslash escape sequences in
- the corresponding _a_r_g_u_m_e_n_t (except that \\cc terminates output,
- backslashes in \\'', \\"", and \\?? are not removed, and octal escapes
- beginning with \\00 may contain up to four digits), and %%qq causes
- pprriinnttff to output the corresponding _a_r_g_u_m_e_n_t in a format that can
- be reused as shell input.
-
- The --vv option causes the output to be assigned to the variable
- _v_a_r rather than being printed to the standard output.
+ Write the formatted _a_r_g_u_m_e_n_t_s to the standard output under the
+ control of the _f_o_r_m_a_t. The --vv option causes the output to be
+ assigned to the variable _v_a_r rather than being printed to the
+ standard output.
+
+ The _f_o_r_m_a_t 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 _a_r_g_u_m_e_n_t. In
+ addition to the standard _p_r_i_n_t_f(1) format specifications, pprriinnttff
+ interprets the following extensions:
+ %%bb causes pprriinnttff to expand backslash escape sequences in the
+ corresponding _a_r_g_u_m_e_n_t (except that \\cc terminates output,
+ backslashes in \\'', \\"", and \\?? are not removed, and octal
+ escapes beginning with \\00 may contain up to four digits).
+ %%qq causes pprriinnttff to output the corresponding _a_r_g_u_m_e_n_t in a
+ format that can be reused as shell input.
+ %%((_d_a_t_e_f_m_t))TT
+ causes pprriinnttff to output the date-time string resulting
+ from using _d_a_t_e_f_m_t as a format string for _s_t_r_f_t_i_m_e(3).
+ The corresponding _a_r_g_u_m_e_n_t is an integer representing the
+ number of seconds since the epoch. Two special argument
+ values may be used: -1 represents the current time, and
+ -2 represents the time the shell was invoked.
+
+ Arguments to non-string format specifiers are treated as C con-
+ stants, 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 ASCII value of the following character.
The _f_o_r_m_a_t is reused as necessary to consume all of the _a_r_g_u_-
_m_e_n_t_s. If the _f_o_r_m_a_t requires more _a_r_g_u_m_e_n_t_s than are supplied,
@@ -4612,8 +4713,8 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
status is false. Any command associated with the RREETTUURRNN trap is
executed before execution resumes after the function or script.
- sseett [----aabbeeffhhkkmmnnppttuuvvxxBBCCEEHHPPTT] [--oo _o_p_t_i_o_n] [_a_r_g ...]
- sseett [++aabbeeffhhkkmmnnppttuuvvxxBBCCEEHHPPTT] [++oo _o_p_t_i_o_n] [_a_r_g ...]
+ sseett [----aabbeeffhhkkmmnnppttuuvvxxBBCCEEHHPPTT] [--oo _o_p_t_i_o_n_-_n_a_m_e] [_a_r_g ...]
+ sseett [++aabbeeffhhkkmmnnppttuuvvxxBBCCEEHHPPTT] [++oo _o_p_t_i_o_n_-_n_a_m_e] [_a_r_g ...]
Without options, the name and value of each shell variable are
displayed in a format that can be reused as input for setting or
resetting the currently-set variables. Read-only variables can-
@@ -4856,17 +4957,29 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
easy re-editing of multi-line commands.
ccoommppaatt3311
If set, bbaasshh changes its behavior to that of version 3.1
- with respect to quoted arguments to the conditional com-
- mand's =~ operator.
+ with respect to quoted arguments to the [[[[ conditional
+ command's ==~~ operator.
ccoommppaatt3322
If set, bbaasshh changes its behavior to that of version 3.2
with respect to locale-specific string comparison when
- using the conditional command's < and > operators.
+ using the [[[[ conditional command's << and >> operators.
+ Bash versions prior to bash-4.1 use ASCII collation and
+ _s_t_r_c_m_p(3); bash-4.1 and later use the current locale's
+ collation sequence and _s_t_r_c_o_l_l(3).
ccoommppaatt4400
If set, bbaasshh changes its behavior to that of version 4.0
- with respect to locale-specific string comparison when
- using the conditional command's < and > operators and
- the effect of interrupting a command list.
+ with respect to locale-specific string comparison when
+ using the [[[[ conditional command's << and >> operators
+ (see previous item) and the effect of interrupting a
+ command list.
+ ccoommppaatt4411
+ @item compat41 If set, bbaasshh, when in posix mode, treats
+ a single quote in a double-quoted parameter expansion as
+ a special character. The single quotes must match (an
+ even number) and the characters between the single
+ quotes are considered quoted. This is the behavior of
+ posix mode through version 4.1. The default bash behav-
+ ior remains as in previous versions.
ddiirrssppeellll
If set, bbaasshh attempts spelling correction on directory
names during word completion if the directory name ini-
@@ -4903,7 +5016,7 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
(( _c_o_m_m_a_n_d )) inherit the DDEEBBUUGG and RREETTUURRNN traps.
66.. Error tracing is enabled: command substitution,
shell functions, and subshells invoked with ((
- _c_o_m_m_a_n_d )) inherit the EERRRROORR trap.
+ _c_o_m_m_a_n_d )) inherit the EERRRR trap.
eexxttgglloobb If set, the extended pattern matching features described
above under PPaatthhnnaammee EExxppaannssiioonn are enabled.
eexxttqquuoottee
@@ -4954,6 +5067,10 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
and all remaining characters on that line to be ignored
in an interactive shell (see CCOOMMMMEENNTTSS above). This
option is enabled by default.
+ llaassttppiippee
+ If set, and job control is not active, the shell runs
+ the last command of a pipeline not executed in the back-
+ ground in the current shell environment.
lliitthhiisstt If set, and the ccmmddhhiisstt option is enabled, multi-line
commands are saved to the history with embedded newlines
rather than using semicolon separators where possible.
@@ -5025,10 +5142,11 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
Expressions may be combined using the following operators,
listed in decreasing order of precedence. The evaluation
- depends on the number of arguments; see below.
+ depends on the number of arguments; see below. Operator prece-
+ dence is used when there are five or more arguments.
!! _e_x_p_r True if _e_x_p_r is false.
(( _e_x_p_r ))
- Returns the value of _e_x_p_r. This may be used to override
+ Returns the value of _e_x_p_r. This may be used to override
the normal precedence of operators.
_e_x_p_r_1 -aa _e_x_p_r_2
True if both _e_x_p_r_1 and _e_x_p_r_2 are true.
@@ -5045,13 +5163,14 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
null.
2 arguments
If the first argument is !!, the expression is true if and
- only if the second argument is null. If the first argu-
- ment is one of the unary conditional operators listed
- above under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS, the expression is
+ only if the second argument is null. If the first argu-
+ ment is one of the unary conditional operators listed
+ above under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS, 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.
3 arguments
+ The following conditions are applied in the order listed.
If the second argument is one of the binary conditional
operators listed above under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS, the
result of the expression is the result of the binary test
@@ -5073,31 +5192,34 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
The expression is parsed and evaluated according to
precedence using the rules listed above.
- ttiimmeess Print the accumulated user and system times for the shell and
+ When used with tteesstt or [[, the << and >> operators sort lexico-
+ graphically using ASCII ordering.
+
+ ttiimmeess Print the accumulated user and system times for the shell and
for processes run from the shell. The return status is 0.
ttrraapp [--llpp] [[_a_r_g] _s_i_g_s_p_e_c ...]
- The command _a_r_g is to be read and executed when the shell
- receives signal(s) _s_i_g_s_p_e_c. If _a_r_g is absent (and there is a
- single _s_i_g_s_p_e_c) or --, each specified signal is reset to its
- original disposition (the value it had upon entrance to the
- shell). If _a_r_g is the null string the signal specified by each
- _s_i_g_s_p_e_c is ignored by the shell and by the commands it invokes.
- If _a_r_g is not present and --pp has been supplied, then the trap
- commands associated with each _s_i_g_s_p_e_c are displayed. If no
- arguments are supplied or if only --pp is given, ttrraapp prints the
- list of commands associated with each signal. The --ll option
- causes the shell to print a list of signal names and their cor-
- responding numbers. Each _s_i_g_s_p_e_c is either a signal name
- defined in <_s_i_g_n_a_l_._h>, or a signal number. Signal names are
- case insensitive and the SIG prefix is optional.
-
- If a _s_i_g_s_p_e_c is EEXXIITT (0) the command _a_r_g is executed on exit
- from the shell. If a _s_i_g_s_p_e_c is DDEEBBUUGG, the command _a_r_g is exe-
- cuted before every _s_i_m_p_l_e _c_o_m_m_a_n_d, _f_o_r command, _c_a_s_e command,
- _s_e_l_e_c_t command, every arithmetic _f_o_r command, and before the
- first command executes in a shell function (see SSHHEELLLL GGRRAAMMMMAARR
- above). Refer to the description of the eexxttddeebbuugg option to the
+ The command _a_r_g is to be read and executed when the shell
+ receives signal(s) _s_i_g_s_p_e_c. If _a_r_g is absent (and there is a
+ single _s_i_g_s_p_e_c) or --, each specified signal is reset to its
+ original disposition (the value it had upon entrance to the
+ shell). If _a_r_g is the null string the signal specified by each
+ _s_i_g_s_p_e_c is ignored by the shell and by the commands it invokes.
+ If _a_r_g is not present and --pp has been supplied, then the trap
+ commands associated with each _s_i_g_s_p_e_c are displayed. If no
+ arguments are supplied or if only --pp is given, ttrraapp prints the
+ list of commands associated with each signal. The --ll option
+ causes the shell to print a list of signal names and their cor-
+ responding numbers. Each _s_i_g_s_p_e_c is either a signal name
+ defined in <_s_i_g_n_a_l_._h>, or a signal number. Signal names are
+ case insensitive and the SSIIGG prefix is optional.
+
+ If a _s_i_g_s_p_e_c is EEXXIITT (0) the command _a_r_g is executed on exit
+ from the shell. If a _s_i_g_s_p_e_c is DDEEBBUUGG, the command _a_r_g is exe-
+ cuted before every _s_i_m_p_l_e _c_o_m_m_a_n_d, _f_o_r command, _c_a_s_e command,
+ _s_e_l_e_c_t command, every arithmetic _f_o_r command, and before the
+ first command executes in a shell function (see SSHHEELLLL GGRRAAMMMMAARR
+ above). Refer to the description of the eexxttddeebbuugg option to the
sshhoopptt builtin for details of its effect on the DDEEBBUUGG trap. If a
_s_i_g_s_p_e_c is RREETTUURRNN, the command _a_r_g is executed each time a shell
function or a script executed with the .. or ssoouurrccee builtins fin-
@@ -5105,53 +5227,53 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
If a _s_i_g_s_p_e_c is EERRRR, the command _a_r_g is executed whenever a sim-
ple command has a non-zero exit status, subject to the following
- conditions. The EERRRR trap is not executed if the failed command
- is part of the command list immediately following a wwhhiillee or
- uunnttiill keyword, part of the test in an _i_f statement, part of a
- command executed in a &&&& or |||| list, or if the command's return
- value is being inverted via !!. These are the same conditions
+ conditions. The EERRRR trap is not executed if the failed command
+ is part of the command list immediately following a wwhhiillee or
+ uunnttiill keyword, part of the test in an _i_f statement, part of a
+ command executed in a &&&& or |||| list, or if the command's return
+ value is being inverted via !!. These are the same conditions
obeyed by the eerrrreexxiitt option.
- Signals ignored upon entry to the shell cannot be trapped or
- reset. Trapped signals that are not being ignored are reset to
+ Signals ignored upon entry to the shell cannot be trapped or
+ reset. 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 _s_i_g_s_p_e_c is
+ one is created. The return status is false if any _s_i_g_s_p_e_c is
invalid; otherwise ttrraapp returns true.
ttyyppee [--aaffttppPP] _n_a_m_e [_n_a_m_e ...]
- With no options, indicate how each _n_a_m_e would be interpreted if
+ With no options, indicate how each _n_a_m_e would be interpreted if
used as a command name. If the --tt option is used, ttyyppee prints a
- string which is one of _a_l_i_a_s, _k_e_y_w_o_r_d, _f_u_n_c_t_i_o_n, _b_u_i_l_t_i_n, or
- _f_i_l_e if _n_a_m_e is an alias, shell reserved word, function,
- builtin, or disk file, respectively. If the _n_a_m_e is not found,
- then nothing is printed, and an exit status of false is
- returned. If the --pp option is used, ttyyppee either returns the
+ string which is one of _a_l_i_a_s, _k_e_y_w_o_r_d, _f_u_n_c_t_i_o_n, _b_u_i_l_t_i_n, or
+ _f_i_l_e if _n_a_m_e is an alias, shell reserved word, function,
+ builtin, or disk file, respectively. If the _n_a_m_e is not found,
+ then nothing is printed, and an exit status of false is
+ returned. If the --pp option is used, ttyyppee either returns the
name of the disk file that would be executed if _n_a_m_e were speci-
fied as a command name, or nothing if ``type -t name'' would not
- return _f_i_l_e. The --PP option forces a PPAATTHH search for each _n_a_m_e,
+ return _f_i_l_e. The --PP option forces a PPAATTHH search for each _n_a_m_e,
even if ``type -t name'' would not return _f_i_l_e. If a command is
- hashed, --pp and --PP print the hashed value, not necessarily the
+ hashed, --pp and --PP print the hashed value, not necessarily the
file that appears first in PPAATTHH. If the --aa option is used, ttyyppee
- prints all of the places that contain an executable named _n_a_m_e.
- This includes aliases and functions, if and only if the --pp
- option is not also used. The table of hashed commands is not
- consulted when using --aa. The --ff option suppresses shell func-
- tion lookup, as with the ccoommmmaanndd builtin. ttyyppee returns true if
+ prints all of the places that contain an executable named _n_a_m_e.
+ This includes aliases and functions, if and only if the --pp
+ option is not also used. The table of hashed commands is not
+ consulted when using --aa. The --ff option suppresses shell func-
+ tion lookup, as with the ccoommmmaanndd builtin. ttyyppee returns true if
all of the arguments are found, false if any are not found.
uulliimmiitt [--HHSSTTaabbccddeeffiillmmnnppqqrrssttuuvvxx [_l_i_m_i_t]]
- Provides control over the resources available to the shell and
- to processes started by it, on systems that allow such control.
+ Provides control over the resources available to the shell and
+ to processes started by it, on systems that allow such control.
The --HH and --SS options specify that 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 --HH nor --SS is speci-
+ 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 --HH nor --SS is speci-
fied, both the soft and hard limits are set. The value of _l_i_m_i_t
can be a number in the unit specified for the resource or one of
the special values hhaarrdd, ssoofftt, or uunnlliimmiitteedd, which stand for the
- current hard limit, the current soft limit, and no limit,
- respectively. If _l_i_m_i_t is omitted, the current value of the
- soft limit of the resource is printed, unless the --HH option is
+ current hard limit, the current soft limit, and no limit,
+ respectively. If _l_i_m_i_t is omitted, the current value of the
+ soft limit of the resource is printed, unless the --HH option is
given. When more than one resource is specified, the limit name
and unit are printed before the value. Other options are inter-
preted as follows:
@@ -5160,11 +5282,11 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
--cc The maximum size of core files created
--dd The maximum size of a process's data segment
--ee The maximum scheduling priority ("nice")
- --ff The maximum size of files written by the shell and its
+ --ff The maximum size of files written by the shell and its
children
--ii The maximum number of pending signals
--ll The maximum size that may be locked into memory
- --mm The maximum resident set size (many systems do not honor
+ --mm The maximum resident set size (many systems do not honor
this limit)
--nn The maximum number of open file descriptors (most systems
do not allow this value to be set)
@@ -5173,65 +5295,65 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
--rr The maximum real-time scheduling priority
--ss The maximum stack size
--tt The maximum amount of cpu time in seconds
- --uu The maximum number of processes available to a single
+ --uu The maximum number of processes available to a single
user
- --vv The maximum amount of virtual memory available to the
- shell
+ --vv The maximum amount of virtual memory available to the
+ shell and, on some systems, to its children
--xx The maximum number of file locks
--TT The maximum number of threads
If _l_i_m_i_t is given, it is the new value of the specified resource
(the --aa option is display only). If no option is given, then --ff
- is assumed. Values are in 1024-byte increments, except for --tt,
- which is in seconds, --pp, which is in units of 512-byte blocks,
- and --TT, --bb, --nn, and --uu, which are unscaled values. The return
+ is assumed. Values are in 1024-byte increments, except for --tt,
+ which is in seconds, --pp, which is in units of 512-byte blocks,
+ and --TT, --bb, --nn, and --uu, which are unscaled values. The return
status is 0 unless an invalid option or argument is supplied, or
an error occurs while setting a new limit.
uummaasskk [--pp] [--SS] [_m_o_d_e]
The user file-creation mask is set to _m_o_d_e. If _m_o_d_e 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
- _c_h_m_o_d(1). If _m_o_d_e is omitted, the current value of the mask is
- printed. The --SS option causes the mask to be printed in sym-
- bolic form; the default output is an octal number. If the --pp
+ a digit, it is interpreted as an octal number; otherwise it is
+ interpreted as a symbolic mode mask similar to that accepted by
+ _c_h_m_o_d(1). If _m_o_d_e is omitted, the current value of the mask is
+ printed. The --SS option causes the mask to be printed in sym-
+ bolic form; the default output is an octal number. If the --pp
option is supplied, and _m_o_d_e is omitted, the output is in a form
that may be reused as input. The return status is 0 if the mode
- was successfully changed or if no _m_o_d_e argument was supplied,
+ was successfully changed or if no _m_o_d_e argument was supplied,
and false otherwise.
uunnaalliiaass [-aa] [_n_a_m_e ...]
- Remove each _n_a_m_e from the list of defined aliases. If --aa is
- supplied, all alias definitions are removed. The return value
+ Remove each _n_a_m_e from the list of defined aliases. If --aa is
+ supplied, all alias definitions are removed. The return value
is true unless a supplied _n_a_m_e is not a defined alias.
uunnsseett [-ffvv] [_n_a_m_e ...]
- For each _n_a_m_e, remove the corresponding variable or function.
+ For each _n_a_m_e, remove the corresponding variable or function.
If no options are supplied, or the --vv option is given, each _n_a_m_e
- refers to a shell variable. Read-only variables may not be
- unset. If --ff is specified, each _n_a_m_e refers to a shell func-
- tion, and the function definition is removed. Each unset vari-
- able or function is removed from the environment passed to sub-
- sequent commands. If any of CCOOMMPP__WWOORRDDBBRREEAAKKSS, RRAANNDDOOMM, SSEECCOONNDDSS,
- LLIINNEENNOO, HHIISSTTCCMMDD, FFUUNNCCNNAAMMEE, GGRROOUUPPSS, or DDIIRRSSTTAACCKK are unset, they
- lose their special properties, even if they are subsequently
+ refers to a shell variable. Read-only variables may not be
+ unset. If --ff is specified, each _n_a_m_e refers to a shell func-
+ tion, and the function definition is removed. Each unset vari-
+ able or function is removed from the environment passed to sub-
+ sequent commands. If any of CCOOMMPP__WWOORRDDBBRREEAAKKSS, RRAANNDDOOMM, SSEECCOONNDDSS,
+ LLIINNEENNOO, HHIISSTTCCMMDD, FFUUNNCCNNAAMMEE, GGRROOUUPPSS, or DDIIRRSSTTAACCKK are unset, they
+ lose their special properties, even if they are subsequently
reset. The exit status is true unless a _n_a_m_e is readonly.
wwaaiitt [_n _._._.]
- Wait for each specified process and return its termination sta-
- tus. Each _n may be a process ID or a job specification; if a
- job spec is given, all processes in that job's pipeline are
- waited for. If _n is not given, all currently active child pro-
- cesses are waited for, and the return status is zero. If _n
- specifies a non-existent process or job, the return status is
- 127. Otherwise, the return status is the exit status of the
+ Wait for each specified process and return its termination sta-
+ tus. Each _n may be a process ID or a job specification; if a
+ job spec is given, all processes in that job's pipeline are
+ waited for. If _n is not given, all currently active child pro-
+ cesses are waited for, and the return status is zero. If _n
+ specifies a non-existent process or job, the return status is
+ 127. Otherwise, the return status is the exit status of the
last process or job waited for.
RREESSTTRRIICCTTEEDD SSHHEELLLL
If bbaasshh is started with the name rrbbaasshh, or the --rr option is supplied at
- invocation, the shell becomes restricted. A restricted shell is used
- to set up an environment more controlled than the standard shell. It
- behaves identically to bbaasshh with the exception that the following are
+ invocation, the shell becomes restricted. A restricted shell is used
+ to set up an environment more controlled than the standard shell. It
+ behaves identically to bbaasshh with the exception that the following are
disallowed or not performed:
+o changing directories with ccdd
@@ -5240,16 +5362,16 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL
+o specifying command names containing //
- +o specifying a file name containing a // as an argument to the ..
+ +o specifying a file name containing a // as an argument to the ..
builtin command
- +o Specifying a filename containing a slash as an argument to the
+ +o specifying a filename containing a slash as an argument to the
--pp option to the hhaasshh builtin command
- +o importing function definitions from the shell environment at
+ +o importing function definitions from the shell environment at
startup
- +o parsing the value of SSHHEELLLLOOPPTTSS from the shell environment at
+ +o parsing the value of SSHHEELLLLOOPPTTSS from the shell environment at
startup
+o redirecting output using the >, >|, <>, >&, &>, and >> redirect-
@@ -5258,10 +5380,10 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL
+o using the eexxeecc builtin command to replace the shell with another
command
- +o adding or deleting builtin commands with the --ff and --dd options
+ +o adding or deleting builtin commands with the --ff and --dd options
to the eennaabbllee builtin command
- +o Using the eennaabbllee builtin command to enable disabled shell
+ +o using the eennaabbllee builtin command to enable disabled shell
builtins
+o specifying the --pp option to the ccoommmmaanndd builtin command
@@ -5271,14 +5393,14 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL
These restrictions are enforced after any startup files are read.
When a command that is found to be a shell script is executed (see CCOOMM--
- MMAANNDD EEXXEECCUUTTIIOONN above), rrbbaasshh turns off any restrictions in the shell
+ MMAANNDD EEXXEECCUUTTIIOONN above), rrbbaasshh turns off any restrictions in the shell
spawned to execute the script.
SSEEEE AALLSSOO
_B_a_s_h _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l, Brian Fox and Chet Ramey
_T_h_e _G_n_u _R_e_a_d_l_i_n_e _L_i_b_r_a_r_y, Brian Fox and Chet Ramey
_T_h_e _G_n_u _H_i_s_t_o_r_y _L_i_b_r_a_r_y, Brian Fox and Chet Ramey
- _P_o_r_t_a_b_l_e _O_p_e_r_a_t_i_n_g _S_y_s_t_e_m _I_n_t_e_r_f_a_c_e _(_P_O_S_I_X_) _P_a_r_t _2_: _S_h_e_l_l _a_n_d _U_t_i_l_i_-
+ _P_o_r_t_a_b_l_e _O_p_e_r_a_t_i_n_g _S_y_s_t_e_m _I_n_t_e_r_f_a_c_e _(_P_O_S_I_X_) _P_a_r_t _2_: _S_h_e_l_l _a_n_d _U_t_i_l_i_-
_t_i_e_s, IEEE
_s_h(1), _k_s_h(1), _c_s_h(1)
_e_m_a_c_s(1), _v_i(1)
@@ -5294,7 +5416,7 @@ FFIILLEESS
_~_/_._b_a_s_h_r_c
The individual per-interactive-shell startup file
_~_/_._b_a_s_h___l_o_g_o_u_t
- The individual login shell cleanup file, executed when a login
+ The individual login shell cleanup file, executed when a login
shell exits
_~_/_._i_n_p_u_t_r_c
Individual _r_e_a_d_l_i_n_e initialization file
@@ -5308,14 +5430,14 @@ AAUUTTHHOORRSS
BBUUGG RREEPPOORRTTSS
If you find a bug in bbaasshh,, 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 bbaasshh. The latest version is always available from
- _f_t_p_:_/_/_f_t_p_._g_n_u_._o_r_g_/_p_u_b_/_b_a_s_h_/.
-
- Once you have determined that a bug actually exists, use the _b_a_s_h_b_u_g
- command to submit a bug report. If you have a fix, you are encouraged
- to mail that as well! Suggestions and `philosophical' bug reports may
- be mailed to _b_u_g_-_b_a_s_h_@_g_n_u_._o_r_g or posted to the Usenet newsgroup
+ make sure that it really is a bug, and that it appears in the latest
+ version of bbaasshh. The latest version is always available from
+ _f_t_p_:_/_/_f_t_p_._g_n_u_._o_r_g_/_p_u_b_/_g_n_u_/_b_a_s_h_/.
+
+ Once you have determined that a bug actually exists, use the _b_a_s_h_b_u_g
+ command to submit a bug report. If you have a fix, you are encouraged
+ to mail that as well! Suggestions and `philosophical' bug reports may
+ be mailed to _b_u_g_-_b_a_s_h_@_g_n_u_._o_r_g or posted to the Usenet newsgroup
ggnnuu..bbaasshh..bbuugg.
ALL bug reports should include:
@@ -5326,7 +5448,7 @@ BBUUGG RREEPPOORRTTSS
A description of the bug behaviour
A short script or `recipe' which exercises the bug
- _b_a_s_h_b_u_g inserts the first three items automatically into the template
+ _b_a_s_h_b_u_g inserts the first three items automatically into the template
it provides for filing a bug report.
Comments and bug reports concerning this manual page should be directed
@@ -5343,10 +5465,10 @@ BBUUGGSS
Shell builtin commands and functions are not stoppable/restartable.
Compound commands and command sequences of the form `a ; b ; c' are not
- handled gracefully when process suspension is attempted. When a
- process is stopped, the shell immediately executes the next command in
- the sequence. It suffices to place the sequence of commands between
- parentheses to force it into a subshell, which may be stopped as a
+ handled gracefully when process suspension is attempted. When a
+ process is stopped, the shell immediately executes the next command in
+ the sequence. It suffices to place the sequence of commands between
+ parentheses to force it into a subshell, which may be stopped as a
unit.
Array variables may not (yet) be exported.
@@ -5355,4 +5477,4 @@ BBUUGGSS
-GNU Bash-4.1 2009 December 29 BASH(1)
+GNU Bash-4.2 2010 December 28 BASH(1)