doc/{bashref.texi,bash.1}
- a couple of clarifying changes to the description of $_ based on
comments from Glenn Morris <gmorris+mail@ast.cam.ac.uk>
+
+ 2/15
+ ----
+shell.c
+ - use strstr instead of strmatch when checking whether $EMACS contains
+ `term' -- simpler and faster
+
+ 2/18
+ ----
+builtins/cd.def
+ - implement posix requirement that `pwd -P' set $PWD to a directory
+ name containing no symlinks
+ - add new function, setpwd(), just sets (and changes exported value)
+ of PWD
+
+doc/bashref.texi
+ - add note to posix mode section about pwd -P setting $PWD
+
+doc{bash.1,bashref.texi}
+ - added note that BASH_ARGC and BASH_ARGV are only set in extended
+ debug mode
+ - expand description of extdebug option to include everything changed
+ by extended debug mode
+
+ 2/19
+ ----
+pathexp.h
+ - new flag macro, FNMATCH_IGNCASE, evaluates to FNM_CASEFOLD if the
+ match_ignore_case variable is non-zero
+
+execute_cmd.c
+ - new variable, match_ignore_case
+ - change call to strmatch() in execute_case_command so it includes
+ FNMATCH_IGNCASE
+
+test.c
+ - change call to strmatch() in patcomp() so that pattern matching
+ calls for [[ ... ]] obey the match_ignore_case variable
+
+lib/sh/shmatch.c
+ - if match_ignore_case is set, enable REG_ICASE in the regexp match
+ flags
+
+builtins/shopt.def
+ - new settable option, `nocasematch', controls the match_ignore_case
+ variable. Currently alters pattern matching for case and [[ ... ]]
+ commands (==, !=, and =~ operators)
+
+doc/{bashref.texi,bash.1}
+ - updated descriptions of [[ and case to include reference to
+ nocasematch option
<pierre.humblet@ieee.org> to fix pid aliasing and reuse problems on
cygwin
+variables.c
+ - set $_ from the environment if we get it there, set to $0 by
+ default if not in env
+
doc/{bashref.texi,bash.1}
- a couple of clarifying changes to the description of $_ based on
comments from Glenn Morris <gmorris+mail@ast.cam.ac.uk>
+
+ 2/15
+ ----
+shell.c
+ - use strstr instead of strmatch when checking whether $EMACS contains
+ `term' -- simpler and faster
+
+ 2/18
+ ----
+builtins/cd.def
+ - implement posix requirement that `pwd -P' set $PWD to a directory
+ name containing no symlinks
+ - add new function, setpwd(), just sets (and changes exported value)
+ of PWD
+
+doc/bashref.texi
+ - add note to posix mode section about pwd -P setting $PWD
+
+doc{bash.1,bashref.texi}
+ - added note that BASH_ARGC and BASH_ARGV are only set in extended
+ debug mode
+ - expand description of extdebug option to include everything changed
+ by extended debug mode
+
+ 2/19
+ ----
+pathexp.h
+ - new flag macro, FNMATCH_IGNCASE, evaluates to FNM_CASEFOLD if the
+ match_ignore_case variable is non-zero
+
+execute_cmd.c
+ - new variable, match_ignore_case
+ - change call to strmatch() in execute_case_command so it includes
+ FNMATCH_IGNCASE
+
+test.c
+ - change call to strmatch() in patcomp() so that pattern matching
+ calls for [[ ... ]] obey the match_ignore_case variable
+
+lib/sh/shmatch.c
+ - if match_ignore_case is set, enable REG_ICASE in the regexp match
+ flags
+
+builtins/shopt.def
+ - new settable option, `nocasematch', controls the match_ignore_case
+ variable. Currently alters pattern matching for case and [[ ... ]]
+ commands (==, !=, and =~ operators)
This file is cd.def, from which is created cd.c. It implements the
builtins "cd" and "pwd" in Bash.
-Copyright (C) 1987-2004 Free Software Foundation, Inc.
+Copyright (C) 1987-2005 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern char *bash_getcwd_errstr;
static int bindpwd __P((int));
+static void setpwd __P((char *));
static int change_to_directory __P((char *, int));
static char *cdspell __P((char *));
to be followed.
$END
+/* Just set $PWD, don't change OLDPWD. Used by `pwd -P' in posix mode. */
+static void
+setpwd (dirname)
+ char *dirname;
+{
+ int old_anm;
+ SHELL_VAR *tvar;
+
+ old_anm = array_needs_making;
+ tvar = bind_variable ("PWD", dirname ? dirname : "", 0);
+ if (old_anm == 0 && array_needs_making && exported_p (tvar))
+ {
+ update_export_env_inplace ("PWD=", 4, dirname ? dirname : "");
+ array_needs_making = 0;
+ }
+}
+
static int
bindpwd (no_symlinks)
int no_symlinks;
array_needs_making = 0;
}
- tvar = bind_variable ("PWD", dirname ? dirname : "", 0);
- if (old_anm == 0 && array_needs_making && exported_p (tvar))
- {
- update_export_env_inplace ("PWD=", 4, dirname ? dirname : "");
- array_needs_making = 0;
- }
+ setpwd (dirname);
if (dirname && dirname != the_current_working_directory)
free (dirname);
WORD_LIST *list;
{
char *directory;
- int opt;
+ int opt, pflag;
verbatim_pwd = no_symbolic_links;
+ pflag = 0;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "LP")) != -1)
{
switch (opt)
{
case 'P':
- verbatim_pwd = 1;
+ verbatim_pwd = pflag = 1;
break;
case 'L':
verbatim_pwd = 0;
if (directory)
{
printf ("%s\n", directory);
+ /* This is dumb but posix-mandated. */
+ if (posixly_correct && pflag)
+ setpwd (directory);
if (directory != the_current_working_directory)
free (directory);
fflush (stdout);
This file is cd.def, from which is created cd.c. It implements the
builtins "cd" and "pwd" in Bash.
-Copyright (C) 1987-2003 Free Software Foundation, Inc.
+Copyright (C) 1987-2005 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern char *bash_getcwd_errstr;
static int bindpwd __P((int));
+static void setpwd __P((char *));
static int change_to_directory __P((char *, int));
static char *cdspell __P((char *));
return (EXECUTION_SUCCESS);
}
+/* Just set $PWD, don't change OLDPWD. Used by `pwd -P' in posix mode. */
+static void
+setpwd (dirname)
+ char *dirname;
+{
+ int old_anm;
+ SHELL_VAR *tvar;
+
+ old_anm = array_needs_making;
+ tvar = bind_variable ("PWD", dirname ? dirname : "", 0);
+ if (old_anm == 0 && array_needs_making && exported_p (tvar))
+ {
+ update_export_env_inplace ("PWD=", 4, dirname ? dirname : "");
+ array_needs_making = 0;
+ }
+}
+
/* Call get_working_directory to reset the value of
the_current_working_directory () */
static char *
WORD_LIST *list;
{
char *directory;
- int opt;
+ int opt, pflag;
verbatim_pwd = no_symbolic_links;
+ pflag = 0;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "LP")) != -1)
{
switch (opt)
{
case 'P':
- verbatim_pwd = 1;
+ verbatim_pwd = pflag = 1;
break;
case 'L':
verbatim_pwd = 0;
if (directory)
{
printf ("%s\n", directory);
+ /* This is dumb but posix-mandated. */
+ if (posixly_correct && pflag)
+ setpwd (directory);
if (directory != the_current_working_directory)
free (directory);
fflush (stdout);
This file is shopt.def, from which is created shopt.c.
It implements the Bash `shopt' builtin.
-Copyright (C) 1994-2003 Free Software Foundation, Inc.
+Copyright (C) 1994-2005 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern int cdspelling, expand_aliases;
extern int extended_quote;
extern int check_window_size;
-extern int glob_ignore_case;
+extern int glob_ignore_case, match_ignore_case;
extern int hup_on_exit;
extern int xpg_echo;
extern int gnu_error_format;
{ "no_empty_cmd_completion", &no_empty_command_completion, (shopt_set_func_t *)NULL },
#endif
{ "nocaseglob", &glob_ignore_case, (shopt_set_func_t *)NULL },
+ { "nocasematch", &match_ignore_case, (shopt_set_func_t *)NULL },
{ "nullglob", &allow_null_glob_expansion, (shopt_set_func_t *)NULL },
#if defined (PROGRAMMABLE_COMPLETION)
{ "progcomp", &prog_completion_enabled, (shopt_set_func_t *)NULL },
extern int cdspelling, expand_aliases;
extern int extended_quote;
extern int check_window_size;
-extern int glob_ignore_case;
+extern int glob_ignore_case, match_ignore_case;
extern int hup_on_exit;
extern int xpg_echo;
extern int gnu_error_format;
{ "failglob", &fail_glob_expansion, (shopt_set_func_t *)NULL },
#if defined (READLINE)
{ "force_fignore", &force_fignore, (shopt_set_func_t *)NULL },
- { "gnu_errfmt", &gnu_error_format, (shopt_set_func_t *)NULL },
- { "histreedit", &history_reediting, (shopt_set_func_t *)NULL },
#endif
+ { "gnu_errfmt", &gnu_error_format, (shopt_set_func_t *)NULL },
#if defined (HISTORY)
{ "histappend", &force_append_history, (shopt_set_func_t *)NULL },
#endif
#if defined (READLINE)
+ { "histreedit", &history_reediting, (shopt_set_func_t *)NULL },
{ "histverify", &hist_verify, (shopt_set_func_t *)NULL },
{ "hostcomplete", &perform_hostname_completion, enable_hostname_completion },
#endif
{ "no_empty_cmd_completion", &no_empty_command_completion, (shopt_set_func_t *)NULL },
#endif
{ "nocaseglob", &glob_ignore_case, (shopt_set_func_t *)NULL },
+ { "nocasematch", &match_ignore_case, (shopt_set_func_t *)NULL },
{ "nullglob", &allow_null_glob_expansion, (shopt_set_func_t *)NULL },
#if defined (PROGRAMMABLE_COMPLETION)
{ "progcomp", &prog_completion_enabled, (shopt_set_func_t *)NULL },
-This is the Bash FAQ, version 3.29, for Bash version 3.0.
+This is the Bash FAQ, version 3.30, for Bash version 3.0.
This document contains a set of frequently-asked questions concerning
Bash, the GNU Bourne-Again Shell. Bash is a freely-available command
ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-3.0.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-doc-3.0.tar.gz
+Any patches for the current version are available with the URL:
+
+ftp://ftp.cwru.edu/pub/bash/bash-3.0-patches/
+
A4) On what machines will bash run?
Bash has been ported to nearly every version of Unix. All you
+
BASH(1) BASH(1)
b\bba\bas\bsh\bh [options] [file]
C\bCO\bOP\bPY\bYR\bRI\bIG\bGH\bHT\bT
- Bash is Copyright (C) 1989-2004 by the Free Software Foundation, Inc.
+ Bash is Copyright (C) 1989-2005 by the Free Software Foundation, Inc.
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
B\bBa\bas\bsh\bh is an s\bsh\bh-compatible command language interpreter that executes
The following paragraphs describe how b\bba\bas\bsh\bh executes its startup files.
If any of the files exist but cannot be read, b\bba\bas\bsh\bh reports an error.
- Tildes are expanded in file names as described below under T\bTi\bil\bld\bde\be
- E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn in the E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN section.
+ Tildes are expanded in file names as described below under T\bTi\bil\bld\bde\be E\bEx\bxp\bpa\ban\bn-\b-
+ s\bsi\bio\bon\bn in the E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN section.
When b\bba\bas\bsh\bh is invoked as an interactive login shell, or as a non-inter-
active shell with the -\b--\b-l\blo\bog\bgi\bin\bn option, it first reads and executes com-
value, _\bl_\bi_\bs_\bt is executed and the arithmetic expression _\be_\bx_\bp_\br_\b3 is
evaluated. If any expression is omitted, it behaves as if it
evaluates to 1. The return value is the exit status of the last
- command in _\bl_\bi_\bs_\bt that is executed, or false if any of the expres-
- sions is invalid.
+ command in _\bl_\bi_\bs_\bt that is executed, or false if any of the
+ expressions is invalid.
s\bse\bel\ble\bec\bct\bt _\bn_\ba_\bm_\be [ i\bin\bn _\bw_\bo_\br_\bd ] ; d\bdo\bo _\bl_\bi_\bs_\bt ; d\bdo\bon\bne\be
The list of words following i\bin\bn is expanded, generating a list of
The P\bPS\bS3\b3 prompt is then displayed and a line read from the stan-
dard input. If the line consists of a number corresponding to
one of the displayed words, then the value of _\bn_\ba_\bm_\be is set to
- that word. If the line is empty, the words and prompt are
- displayed again. If EOF is read, the command completes. Any
- other value read causes _\bn_\ba_\bm_\be to be set to null. The line read
- is saved in the variable R\bRE\bEP\bPL\bLY\bY. The _\bl_\bi_\bs_\bt is executed after each
+ that word. If the line is empty, the words and prompt are dis-
+ played again. If EOF is read, the command completes. Any other
+ value read causes _\bn_\ba_\bm_\be to be set to null. The line read is
+ saved in the variable R\bRE\bEP\bPL\bLY\bY. The _\bl_\bi_\bs_\bt is executed after each
selection until a b\bbr\bre\bea\bak\bk command is executed. The exit status of
s\bse\bel\ble\bec\bct\bt is the exit status of the last command executed in _\bl_\bi_\bs_\bt,
or zero if no commands were executed.
the string to be executed, if one is present. Otherwise, it is
set to the file name used to invoke b\bba\bas\bsh\bh, as given by argument
zero.
- _\b_ At shell startup, set to the absolute file name of the shell or
- shell script being executed as passed in the argument list.
- Subsequently, expands to the last argument to the previous com-
- mand, after expansion. Also set to the full file name of each
- command executed and placed in the environment exported to that
- command. When checking mail, this parameter holds the name of
- the mail file currently being checked.
+ _\b_ 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-
+ rently being checked.
S\bSh\bhe\bel\bll\bl V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs
The following variables are set by the shell:
- B\bBA\bAS\bSH\bH Expands to the full file name used to invoke this instance of
+ B\bBA\bAS\bSH\bH Expands to the full file name used to invoke this instance of
b\bba\bas\bsh\bh.
B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGC\bC
- 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 bash execution call stack. The number
- of parameters to the current subroutine (shell function or
- script executed with .\b. or s\bso\bou\bur\brc\bce\be) 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 .\b. or s\bso\bou\bur\brc\bce\be) is at the top of the stack.
+ When a subroutine is executed, the number of parameters passed
is pushed onto B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGC\bC.
B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV
- An array variable containing all of the parameters in the cur-
+ An array variable containing all of the parameters in the cur-
rent bash 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 B\bBA\bAS\bSH\bH_\b_A\bAR\bRG\bGV\bV.
B\bBA\bAS\bSH\bH_\b_C\bCO\bOM\bMM\bMA\bAN\bND\bD
- 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.
B\bBA\bAS\bSH\bH_\b_E\bEX\bXE\bEC\bCU\bUT\bTI\bIO\bON\bN_\b_S\bST\bTR\bRI\bIN\bNG\bG
The command argument to the -\b-c\bc invocation option.
B\bBA\bAS\bSH\bH_\b_L\bLI\bIN\bNE\bEN\bNO\bO
- An array variable whose members are the line numbers in source
- files corresponding to each member of F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE.
- $\b${\b{B\bBA\bAS\bSH\bH_\b_L\bLI\bIN\bNE\bEN\bNO\bO[\b[_\b$_\bi]\b]}\b} is the line number in the source file where
- $\b${\b{F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE[\b[_\b$_\bi_\bf_\bP]\b]}\b} _\bw_\ba_\bs _\bc_\ba_\bl_\bl_\be_\bd_\b. _\bT_\bh_\be _\bc_\bo_\br_\br_\be_\bs_\bp_\bo_\bn_\bd_\bi_\bn_\bg _\bs_\bo_\bu_\br_\bc_\be _\bf_\bi_\bl_\be
- _\bn_\ba_\bm_\be _\bi_\bs $\b${\b{B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE[\b[_\b$_\bi]\b]}\b}.\b. U\bUs\bse\be L\bLI\bIN\bNE\bEN\bNO\bO t\bto\bo o\bob\bbt\bta\bai\bin\bn t\bth\bhe\be c\bcu\bur\brr\bre\ben\bnt\bt
+ An array variable whose members are the line numbers in source
+ files corresponding to each member of F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE.
+ $\b${\b{B\bBA\bAS\bSH\bH_\b_L\bLI\bIN\bNE\bEN\bNO\bO[\b[_\b$_\bi]\b]}\b} is the line number in the source file where
+ $\b${\b{F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE[\b[_\b$_\bi_\bf_\bP]\b]}\b} _\bw_\ba_\bs _\bc_\ba_\bl_\bl_\be_\bd_\b. _\bT_\bh_\be _\bc_\bo_\br_\br_\be_\bs_\bp_\bo_\bn_\bd_\bi_\bn_\bg _\bs_\bo_\bu_\br_\bc_\be _\bf_\bi_\bl_\be
+ _\bn_\ba_\bm_\be _\bi_\bs $\b${\b{B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE[\b[_\b$_\bi]\b]}\b}.\b. U\bUs\bse\be L\bLI\bIN\bNE\bEN\bNO\bO t\bto\bo o\bob\bbt\bta\bai\bin\bn t\bth\bhe\be c\bcu\bur\brr\bre\ben\bnt\bt
l\bli\bin\bne\be n\bnu\bum\bmb\bbe\ber\br.\b.
B\bBA\bAS\bSH\bH_\b_R\bRE\bEM\bMA\bAT\bTC\bCH\bH
- An array variable whose members are assigned by the =\b=~\b~ binary
- operator to the [\b[[\b[ conditional command. The element with index
- 0 is the portion of the string matching the entire regular
- expression. The element with index _\bn is the portion of the
+ An array variable whose members are assigned by the =\b=~\b~ binary
+ operator to the [\b[[\b[ conditional command. The element with index
+ 0 is the portion of the string matching the entire regular
+ expression. The element with index _\bn is the portion of the
string matching the _\bnth parenthesized subexpression. This vari-
able is read-only.
B\bBA\bAS\bSH\bH_\b_S\bSO\bOU\bUR\bRC\bCE\bE
- An array variable whose members are the source filenames corre-
+ An array variable whose members are the source filenames corre-
sponding to the elements in the F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE array variable.
B\bBA\bAS\bSH\bH_\b_S\bSU\bUB\bBS\bSH\bHE\bEL\bLL\bL
- 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.
B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO
A readonly array variable whose members hold version information
- for this instance of b\bba\bas\bsh\bh. The values assigned to the array
+ for this instance of b\bba\bas\bsh\bh. The values assigned to the array
members are as follows:
- B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO[\b[0]\b] The major version number (the _\br_\be_\bl_\be_\ba_\bs_\be).
- B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO[\b[1]\b] The minor version number (the _\bv_\be_\br_\bs_\bi_\bo_\bn).
+ B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO[\b[0]\b] The major version number (the _\br_\be_\bl_\be_\ba_\bs_\be).
+ B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO[\b[1]\b] The minor version number (the _\bv_\be_\br_\bs_\bi_\bo_\bn).
B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO[\b[2]\b] The patch level.
B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO[\b[3]\b] The build version.
B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO[\b[4]\b] The release status (e.g., _\bb_\be_\bt_\ba_\b1).
B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIN\bNF\bFO\bO[\b[5]\b] The value of M\bMA\bAC\bCH\bHT\bTY\bYP\bPE\bE.
B\bBA\bAS\bSH\bH_\b_V\bVE\bER\bRS\bSI\bIO\bON\bN
- Expands to a string describing the version of this instance of
+ Expands to a string describing the version of this instance of
b\bba\bas\bsh\bh.
C\bCO\bOM\bMP\bP_\b_C\bCW\bWO\bOR\bRD\bD
- An index into $\b${\b{C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDS\bS}\b} of the word containing the current
+ An index into $\b${\b{C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDS\bS}\b} 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
P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn below).
C\bCO\bOM\bMP\bP_\b_L\bLI\bIN\bNE\bE
- The current command line. This variable is available only in
- shell functions and external commands invoked by the pro-
- grammable completion facilities (see P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn
+ The current command line. This variable is available only in
+ shell functions and external commands invoked by the pro-
+ grammable completion facilities (see P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn
below).
C\bCO\bOM\bMP\bP_\b_P\bPO\bOI\bIN\bNT\bT
- 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 $\b${\b{#\b#C\bCO\bOM\bMP\bP_\b_L\bLI\bIN\bNE\bE}\b}. This variable is available only in
- shell functions and external commands invoked by the pro-
- grammable completion facilities (see P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn
+ equal to $\b${\b{#\b#C\bCO\bOM\bMP\bP_\b_L\bLI\bIN\bNE\bE}\b}. This variable is available only in
+ shell functions and external commands invoked by the pro-
+ grammable completion facilities (see P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn
below).
C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS
- The set of characters that the Readline library treats as word
- separators when performing word completion. If C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS
- is unset, it loses its special properties, even if it is subse-
+ The set of characters that the Readline library treats as word
+ separators when performing word completion. If C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDB\bBR\bRE\bEA\bAK\bKS\bS
+ is unset, it loses its special properties, even if it is subse-
quently reset.
C\bCO\bOM\bMP\bP_\b_W\bWO\bOR\bRD\bDS\bS
- An array variable (see A\bAr\brr\bra\bay\bys\bs below) consisting of the individ-
- ual words in the current command line. This variable is avail-
+ An array variable (see A\bAr\brr\bra\bay\bys\bs below) consisting of the individ-
+ ual words in the current command line. This variable is avail-
able only in shell functions invoked by the programmable comple-
tion facilities (see P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn below).
D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK
An array variable (see A\bAr\brr\bra\bay\bys\bs below) containing the current con-
- tents of the directory stack. Directories appear in the stack
- in the order they are displayed by the d\bdi\bir\brs\bs builtin. Assigning
+ tents of the directory stack. Directories appear in the stack
+ in the order they are displayed by the d\bdi\bir\brs\bs builtin. Assigning
to members of this array variable may be used to modify directo-
- ries already in the stack, but the p\bpu\bus\bsh\bhd\bd and p\bpo\bop\bpd\bd builtins must
- be used to add and remove directories. Assignment to this vari-
- able will not change the current directory. If D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK is
- unset, it loses its special properties, even if it is subse-
+ ries already in the stack, but the p\bpu\bus\bsh\bhd\bd and p\bpo\bop\bpd\bd builtins must
+ be used to add and remove directories. Assignment to this
+ variable will not change the current directory. If D\bDI\bIR\bRS\bST\bTA\bAC\bCK\bK is
+ unset, it loses its special properties, even if it is subse-
quently reset.
- E\bEU\bUI\bID\bD Expands to the effective user ID of the current user, initial-
+ E\bEU\bUI\bID\bD Expands to the effective user ID of the current user, initial-
ized at shell startup. This variable is readonly.
F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE
- 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 F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE have no
- effect and return an error status. If F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE is unset, it
- loses its special properties, even if it is subsequently reset.
-
- G\bGR\bRO\bOU\bUP\bPS\bS An array variable containing the list of groups of which the
- current user is a member. Assignments to G\bGR\bRO\bOU\bUP\bPS\bS have no effect
- and return an error status. If G\bGR\bRO\bOU\bUP\bPS\bS is unset, it loses its
+ tom-most element is "main". This variable exists only when a
+ shell function is executing. Assignments to F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE have no
+ effect and return an error status. If F\bFU\bUN\bNC\bCN\bNA\bAM\bME\bE is unset, it
+ loses its special properties, even if it is subsequently reset.
+
+ G\bGR\bRO\bOU\bUP\bPS\bS An array variable containing the list of groups of which the
+ current user is a member. Assignments to G\bGR\bRO\bOU\bUP\bPS\bS have no effect
+ and return an error status. If G\bGR\bRO\bOU\bUP\bPS\bS is unset, it loses its
special properties, even if it is subsequently reset.
H\bHI\bIS\bST\bTC\bCM\bMD\bD
The history number, or index in the history list, of the current
- command. If H\bHI\bIS\bST\bTC\bCM\bMD\bD is unset, it loses its special properties,
+ command. If H\bHI\bIS\bST\bTC\bCM\bMD\bD is unset, it loses its special properties,
even if it is subsequently reset.
H\bHO\bOS\bST\bTN\bNA\bAM\bME\bE
Automatically set to the name of the current host.
H\bHO\bOS\bST\bTT\bTY\bYP\bPE\bE
- Automatically set to a string that uniquely describes the type
- of machine on which b\bba\bas\bsh\bh is executing. The default is system-
+ Automatically set to a string that uniquely describes the type
+ of machine on which b\bba\bas\bsh\bh is executing. The default is system-
dependent.
- L\bLI\bIN\bNE\bEN\bNO\bO 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
+ L\bLI\bIN\bNE\bEN\bNO\bO 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 L\bLI\bIN\bNE\bEN\bNO\bO is unset, it loses its special proper-
ties, even if it is subsequently reset.
M\bMA\bAC\bCH\bHT\bTY\bYP\bPE\bE
- Automatically set to a string that fully describes the system
- type on which b\bba\bas\bsh\bh is executing, in the standard GNU _\bc_\bp_\bu_\b-_\bc_\bo_\bm_\b-
+ Automatically set to a string that fully describes the system
+ type on which b\bba\bas\bsh\bh is executing, in the standard GNU _\bc_\bp_\bu_\b-_\bc_\bo_\bm_\b-
_\bp_\ba_\bn_\by_\b-_\bs_\by_\bs_\bt_\be_\bm format. The default is system-dependent.
O\bOL\bLD\bDP\bPW\bWD\bD The previous working directory as set by the c\bcd\bd command.
- O\bOP\bPT\bTA\bAR\bRG\bG The value of the last option argument processed by the g\bge\bet\bto\bop\bpt\bts\bs
+ O\bOP\bPT\bTA\bAR\bRG\bG The value of the last option argument processed by the g\bge\bet\bto\bop\bpt\bts\bs
builtin command (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below).
- O\bOP\bPT\bTI\bIN\bND\bD The index of the next argument to be processed by the g\bge\bet\bto\bop\bpt\bts\bs
+ O\bOP\bPT\bTI\bIN\bND\bD The index of the next argument to be processed by the g\bge\bet\bto\bop\bpt\bts\bs
builtin command (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below).
- O\bOS\bST\bTY\bYP\bPE\bE Automatically set to a string that describes the operating sys-
- tem on which b\bba\bas\bsh\bh is executing. The default is system-depen-
+ O\bOS\bST\bTY\bYP\bPE\bE Automatically set to a string that describes the operating sys-
+ tem on which b\bba\bas\bsh\bh is executing. The default is system-depen-
dent.
P\bPI\bIP\bPE\bES\bST\bTA\bAT\bTU\bUS\bS
- An array variable (see A\bAr\brr\bra\bay\bys\bs below) containing a list of exit
- status values from the processes in the most-recently-executed
+ An array variable (see A\bAr\brr\bra\bay\bys\bs below) containing a list of exit
+ status values from the processes in the most-recently-executed
foreground pipeline (which may contain only a single command).
- P\bPP\bPI\bID\bD The process ID of the shell's parent. This variable is read-
+ P\bPP\bPI\bID\bD The process ID of the shell's parent. This variable is read-
only.
P\bPW\bWD\bD The current working directory as set by the c\bcd\bd command.
R\bRA\bAN\bND\bDO\bOM\bM Each time this parameter is referenced, a random integer between
0 and 32767 is generated. The sequence of random numbers may be
initialized by assigning a value to R\bRA\bAN\bND\bDO\bOM\bM. If R\bRA\bAN\bND\bDO\bOM\bM is unset,
- it loses its special properties, even if it is subsequently
+ it loses its special properties, even if it is subsequently
reset.
- R\bRE\bEP\bPL\bLY\bY Set to the line of input read by the r\bre\bea\bad\bd builtin command when
+ R\bRE\bEP\bPL\bLY\bY Set to the line of input read by the r\bre\bea\bad\bd builtin command when
no arguments are supplied.
S\bSE\bEC\bCO\bON\bND\bDS\bS
- Each time this parameter is referenced, the number of seconds
- since shell invocation is returned. If a value is assigned to
- S\bSE\bEC\bCO\bON\bND\bDS\bS, the value returned upon subsequent references is the
- number of seconds since the assignment plus the value assigned.
+ Each time this parameter is referenced, the number of seconds
+ since shell invocation is returned. If a value is assigned to
+ S\bSE\bEC\bCO\bON\bND\bDS\bS, the value returned upon subsequent references is the
+ number of seconds since the assignment plus the value assigned.
If S\bSE\bEC\bCO\bON\bND\bDS\bS is unset, it loses its special properties, even if it
is subsequently reset.
S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS
- A colon-separated list of enabled shell options. Each word in
- the list is a valid argument for the -\b-o\bo option to the s\bse\bet\bt
+ A colon-separated list of enabled shell options. Each word in
+ the list is a valid argument for the -\b-o\bo option to the s\bse\bet\bt
builtin command (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below). The options
- appearing in S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS are those reported as _\bo_\bn by s\bse\bet\bt -\b-o\bo. If
- this variable is in the environment when b\bba\bas\bsh\bh starts up, each
- shell option in the list will be enabled before reading any
+ appearing in S\bSH\bHE\bEL\bLL\bLO\bOP\bPT\bTS\bS are those reported as _\bo_\bn by s\bse\bet\bt -\b-o\bo. If
+ this variable is in the environment when b\bba\bas\bsh\bh starts up, each
+ shell option in the list will be enabled before reading any
startup files. This variable is read-only.
S\bSH\bHL\bLV\bVL\bL Incremented by one each time an instance of b\bba\bas\bsh\bh is started.
U\bUI\bID\bD Expands to the user ID of the current user, initialized at shell
startup. This variable is readonly.
- The following variables are used by the shell. In some cases, b\bba\bas\bsh\bh
+ The following variables are used by the shell. In some cases, b\bba\bas\bsh\bh
assigns a default value to a variable; these cases are noted below.
B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV
- If this parameter is set when b\bba\bas\bsh\bh is executing a shell script,
- its value is interpreted as a filename containing commands to
+ If this parameter is set when b\bba\bas\bsh\bh is executing a shell script,
+ its value is interpreted as a filename containing commands to
initialize the shell, as in _\b~_\b/_\b._\bb_\ba_\bs_\bh_\br_\bc. The value of B\bBA\bAS\bSH\bH_\b_E\bEN\bNV\bV is
- subjected to parameter expansion, command substitution, and
- arithmetic expansion before being interpreted as a file name.
+ subjected to parameter expansion, command substitution, and
+ arithmetic expansion before being interpreted as a file name.
P\bPA\bAT\bTH\bH is not used to search for the resultant file name.
- C\bCD\bDP\bPA\bAT\bTH\bH The search path for the c\bcd\bd command. This is a colon-separated
- list of directories in which the shell looks for destination
- directories specified by the c\bcd\bd command. A sample value is
+ C\bCD\bDP\bPA\bAT\bTH\bH The search path for the c\bcd\bd command. This is a colon-separated
+ list of directories in which the shell looks for destination
+ directories specified by the c\bcd\bd command. A sample value is
".:~:/usr".
C\bCO\bOL\bLU\bUM\bMN\bNS\bS
- Used by the s\bse\bel\ble\bec\bct\bt builtin command to determine the terminal
- width when printing selection lists. Automatically set upon
+ Used by the s\bse\bel\ble\bec\bct\bt builtin command to determine the terminal
+ width when printing selection lists. Automatically set upon
receipt of a SIGWINCH.
C\bCO\bOM\bMP\bPR\bRE\bEP\bPL\bLY\bY
An array variable from which b\bba\bas\bsh\bh reads the possible completions
- generated by a shell function invoked by the programmable com-
+ generated by a shell function invoked by the programmable com-
pletion facility (see P\bPr\bro\bog\bgr\bra\bam\bmm\bma\bab\bbl\ble\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn below).
- E\bEM\bMA\bAC\bCS\bS If b\bba\bas\bsh\bh finds this variable in the environment when the shell
- starts with value "t", it assumes that the shell is running in
+ E\bEM\bMA\bAC\bCS\bS If b\bba\bas\bsh\bh 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.
F\bFC\bCE\bED\bDI\bIT\bT The default editor for the f\bfc\bc builtin command.
F\bFI\bIG\bGN\bNO\bOR\bRE\bE
- A colon-separated list of suffixes to ignore when performing
+ A colon-separated list of suffixes to ignore when performing
filename completion (see R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE below). A filename whose suf-
- fix matches one of the entries in F\bFI\bIG\bGN\bNO\bOR\bRE\bE is excluded from the
+ fix matches one of the entries in F\bFI\bIG\bGN\bNO\bOR\bRE\bE is excluded from the
list of matched filenames. A sample value is ".o:~".
G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE
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
G\bGL\bLO\bOB\bBI\bIG\bGN\bNO\bOR\bRE\bE, it is removed from the list of matches.
H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL
- A colon-separated list of values controlling how commands are
- saved on the history list. If the list of values includes
- _\bi_\bg_\bn_\bo_\br_\be_\bs_\bp_\ba_\bc_\be, lines which begin with a s\bsp\bpa\bac\bce\be character are not
- saved in the history list. A value of _\bi_\bg_\bn_\bo_\br_\be_\bd_\bu_\bp_\bs causes lines
+ A colon-separated list of values controlling how commands are
+ saved on the history list. If the list of values includes
+ _\bi_\bg_\bn_\bo_\br_\be_\bs_\bp_\ba_\bc_\be, lines which begin with a s\bsp\bpa\bac\bce\be character are not
+ saved in the history list. A value of _\bi_\bg_\bn_\bo_\br_\be_\bd_\bu_\bp_\bs causes lines
matching the previous history entry to not be saved. A value of
_\bi_\bg_\bn_\bo_\br_\be_\bb_\bo_\bt_\bh is shorthand for _\bi_\bg_\bn_\bo_\br_\be_\bs_\bp_\ba_\bc_\be and _\bi_\bg_\bn_\bo_\br_\be_\bd_\bu_\bp_\bs. A value
of _\be_\br_\ba_\bs_\be_\bd_\bu_\bp_\bs 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 H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL 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 H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL 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 H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE. The second and subsequent lines of a multi-line
- compound command are not tested, and are added to the history
+ of H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE. 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 H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL.
H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bE
The name of the file in which command history is saved (see H\bHI\bIS\bS-\b-
- T\bTO\bOR\bRY\bY below). The default value is _\b~_\b/_\b._\bb_\ba_\bs_\bh_\b__\bh_\bi_\bs_\bt_\bo_\br_\by. If unset,
- the command history is not saved when an interactive shell
+ T\bTO\bOR\bRY\bY below). The default value is _\b~_\b/_\b._\bb_\ba_\bs_\bh_\b__\bh_\bi_\bs_\bt_\bo_\br_\by. If unset,
+ the command history is not saved when an interactive shell
exits.
H\bHI\bIS\bST\bTF\bFI\bIL\bLE\bES\bSI\bIZ\bZE\bE
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, 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
+ this variable is assigned a value, the history file is trun-
+ cated, if necessary, to contain no more than that number of
+ lines. The default value is 500. The history file is also
+ truncated to this size after writing it when an interactive
shell exits.
H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE
- 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 `*\b*' is appended). Each pattern is
- tested against the line after the checks specified by H\bHI\bIS\bST\bTC\bCO\bON\bN-\b-
- T\bTR\bRO\bOL\bL 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 `*\b*' is appended). Each pattern is
+ tested against the line after the checks specified by H\bHI\bIS\bST\bTC\bCO\bON\bN-\b-
+ T\bTR\bRO\bOL\bL are applied. In addition to the normal shell pattern
matching characters, `&\b&' matches the previous history line. `&\b&'
- 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 H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE.
H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE
- The number of commands to remember in the command history (see
+ The number of commands to remember in the command history (see
H\bHI\bIS\bST\bTO\bOR\bRY\bY below). The default value is 500.
H\bHI\bIS\bST\bTT\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT
- 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 _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be(3) to print the time stamp associated
- with each history entry displayed by the h\bhi\bis\bst\bto\bor\bry\by builtin. If
- this variable is set, time stamps are written to the history
+ with each history entry displayed by the h\bhi\bis\bst\bto\bor\bry\by builtin. If
+ this variable is set, time stamps are written to the history
file so they may be preserved across shell sessions.
H\bHO\bOM\bME\bE The home directory of the current user; the default argument for
the c\bcd\bd builtin command. The value of this variable is also used
when performing tilde expansion.
H\bHO\bOS\bST\bTF\bFI\bIL\bLE\bE
- Contains the name of a file in the same format as _\b/_\be_\bt_\bc_\b/_\bh_\bo_\bs_\bt_\bs
+ Contains the name of a file in the same format as _\b/_\be_\bt_\bc_\b/_\bh_\bo_\bs_\bt_\bs
that should be read when the shell needs to complete a hostname.
- The list of possible hostname completions may be changed while
- the shell is running; the next time hostname completion is
- attempted after the value is changed, b\bba\bas\bsh\bh adds the contents of
- the new file to the existing list. If H\bHO\bOS\bST\bTF\bFI\bIL\bLE\bE is set, but has
+ The list of possible hostname completions may be changed while
+ the shell is running; the next time hostname completion is
+ attempted after the value is changed, b\bba\bas\bsh\bh adds the contents of
+ the new file to the existing list. If H\bHO\bOS\bST\bTF\bFI\bIL\bLE\bE is set, but has
no value, b\bba\bas\bsh\bh attempts to read _\b/_\be_\bt_\bc_\b/_\bh_\bo_\bs_\bt_\bs to obtain the list of
- possible hostname completions. When H\bHO\bOS\bST\bTF\bFI\bIL\bLE\bE is unset, the
+ possible hostname completions. When H\bHO\bOS\bST\bTF\bFI\bIL\bLE\bE is unset, the
hostname list is cleared.
- I\bIF\bFS\bS The _\bI_\bn_\bt_\be_\br_\bn_\ba_\bl _\bF_\bi_\be_\bl_\bd _\bS_\be_\bp_\ba_\br_\ba_\bt_\bo_\br that is used for word splitting
- after expansion and to split lines into words with the r\bre\bea\bad\bd
+ I\bIF\bFS\bS The _\bI_\bn_\bt_\be_\br_\bn_\ba_\bl _\bF_\bi_\be_\bl_\bd _\bS_\be_\bp_\ba_\br_\ba_\bt_\bo_\br that is used for word splitting
+ after expansion and to split lines into words with the r\bre\bea\bad\bd
builtin command. The default value is ``<space><tab><new-
line>''.
I\bIG\bGN\bNO\bOR\bRE\bEE\bEO\bOF\bF
Controls the action of an interactive shell on receipt of an E\bEO\bOF\bF
character as the sole input. If set, the value is the number of
- consecutive E\bEO\bOF\bF characters which must be typed as the first
- characters on an input line before b\bba\bas\bsh\bh 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, E\bEO\bOF\bF signifies the
+ consecutive E\bEO\bOF\bF characters which must be typed as the first
+ characters on an input line before b\bba\bas\bsh\bh 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, E\bEO\bOF\bF signifies the
end of input to the shell.
I\bIN\bNP\bPU\bUT\bTR\bRC\bC
- The filename for the r\bre\bea\bad\bdl\bli\bin\bne\be startup file, overriding the
+ The filename for the r\bre\bea\bad\bdl\bli\bin\bne\be startup file, overriding the
default of _\b~_\b/_\b._\bi_\bn_\bp_\bu_\bt_\br_\bc (see R\bRE\bEA\bAD\bDL\bLI\bIN\bNE\bE below).
- L\bLA\bAN\bNG\bG Used to determine the locale category for any category not
+ L\bLA\bAN\bNG\bG Used to determine the locale category for any category not
specifically selected with a variable starting with L\bLC\bC_\b_.
- L\bLC\bC_\b_A\bAL\bLL\bL This variable overrides the value of L\bLA\bAN\bNG\bG and any other L\bLC\bC_\b_
+ L\bLC\bC_\b_A\bAL\bLL\bL This variable overrides the value of L\bLA\bAN\bNG\bG and any other L\bLC\bC_\b_
variable specifying a locale category.
L\bLC\bC_\b_C\bCO\bOL\bLL\bLA\bAT\bTE\bE
- 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.
L\bLC\bC_\b_C\bCT\bTY\bYP\bPE\bE
- 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.
L\bLC\bC_\b_M\bME\bES\bSS\bSA\bAG\bGE\bES\bS
- This variable determines the locale used to translate double-
+ This variable determines the locale used to translate double-
quoted strings preceded by a $\b$.
L\bLC\bC_\b_N\bNU\bUM\bME\bER\bRI\bIC\bC
- This variable determines the locale category used for number
+ This variable determines the locale category used for number
formatting.
- L\bLI\bIN\bNE\bES\bS Used by the s\bse\bel\ble\bec\bct\bt builtin command to determine the column
- length for printing selection lists. Automatically set upon
+ L\bLI\bIN\bNE\bES\bS Used by the s\bse\bel\ble\bec\bct\bt builtin command to determine the column
+ length for printing selection lists. Automatically set upon
receipt of a SIGWINCH.
- M\bMA\bAI\bIL\bL If this parameter is set to a file name and the M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH vari-
+ M\bMA\bAI\bIL\bL If this parameter is set to a file name and the M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH vari-
able is not set, b\bba\bas\bsh\bh informs the user of the arrival of mail in
the specified file.
M\bMA\bAI\bIL\bLC\bCH\bHE\bEC\bCK\bK
- Specifies how often (in seconds) b\bba\bas\bsh\bh checks for mail. The
- default is 60 seconds. When it is time to check for mail, the
- shell does so before displaying the primary prompt. If this
- variable is unset, or set to a value that is not a number
+ Specifies how often (in seconds) b\bba\bas\bsh\bh checks for mail. The
+ default is 60 seconds. When it is time to check for mail, the
+ shell does so before displaying the primary prompt. If this
+ variable is unset, or set to a value that is not a number
greater than or equal to zero, the shell disables mail checking.
M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH
- A colon-separated list of file names to be checked for mail.
+ A colon-separated list of file names to be checked for mail.
The message to be printed when mail arrives in a particular file
- may be specified by separating the file name from the message
+ may be specified by separating the file name from the message
with a `?'. When used in the text of the message, $\b$_\b_ expands to
the name of the current mailfile. Example:
M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH='/var/mail/bfox?"You have mail":~/shell-mail?"$_ has
mail!"'
- B\bBa\bas\bsh\bh supplies a default value for this variable, but the loca-
- tion of the user mail files that it uses is system dependent
+ B\bBa\bas\bsh\bh supplies a default value for this variable, but the loca-
+ tion of the user mail files that it uses is system dependent
(e.g., /var/mail/$\b$U\bUS\bSE\bER\bR).
O\bOP\bPT\bTE\bER\bRR\bR If set to the value 1, b\bba\bas\bsh\bh displays error messages generated by
- the g\bge\bet\bto\bop\bpt\bts\bs builtin command (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below).
- O\bOP\bPT\bTE\bER\bRR\bR is initialized to 1 each time the shell is invoked or a
+ the g\bge\bet\bto\bop\bpt\bts\bs builtin command (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below).
+ O\bOP\bPT\bTE\bER\bRR\bR is initialized to 1 each time the shell is invoked or a
shell script is executed.
- P\bPA\bAT\bTH\bH The search path for commands. It is a colon-separated list of
- directories in which the shell looks for commands (see C\bCO\bOM\bMM\bMA\bAN\bND\bD
- E\bEX\bXE\bEC\bCU\bUT\bTI\bIO\bON\bN below). A zero-length (null) directory name in the
+ P\bPA\bAT\bTH\bH The search path for commands. It is a colon-separated list of
+ directories in which the shell looks for commands (see C\bCO\bOM\bMM\bMA\bAN\bND\bD
+ E\bEX\bXE\bEC\bCU\bUT\bTI\bIO\bON\bN below). A zero-length (null) directory name in the
value of P\bPA\bAT\bTH\bH indicates the current directory. A null directory
- name may appear as two adjacent colons, or as an initial or
- trailing colon. The default path is system-dependent, and is
- set by the administrator who installs b\bba\bas\bsh\bh. A common value is
+ name may appear as two adjacent colons, or as an initial or
+ trailing colon. The default path is system-dependent, and is
+ set by the administrator who installs b\bba\bas\bsh\bh. A common value is
``/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin''.
P\bPO\bOS\bSI\bIX\bXL\bLY\bY_\b_C\bCO\bOR\bRR\bRE\bEC\bCT\bT
- If this variable is in the environment when b\bba\bas\bsh\bh starts, the
- shell enters _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be before reading the startup files, as if
- the -\b--\b-p\bpo\bos\bsi\bix\bx invocation option had been supplied. If it is set
- while the shell is running, b\bba\bas\bsh\bh enables _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, as if the
+ If this variable is in the environment when b\bba\bas\bsh\bh starts, the
+ shell enters _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be before reading the startup files, as if
+ the -\b--\b-p\bpo\bos\bsi\bix\bx invocation option had been supplied. If it is set
+ while the shell is running, b\bba\bas\bsh\bh enables _\bp_\bo_\bs_\bi_\bx _\bm_\bo_\bd_\be, as if the
command _\bs_\be_\bt _\b-_\bo _\bp_\bo_\bs_\bi_\bx had been executed.
P\bPR\bRO\bOM\bMP\bPT\bT_\b_C\bCO\bOM\bMM\bMA\bAN\bND\bD
If set, the value is executed as a command prior to issuing each
primary prompt.
- P\bPS\bS1\b1 The value of this parameter is expanded (see P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG below)
- and used as the primary prompt string. The default value is
+ P\bPS\bS1\b1 The value of this parameter is expanded (see P\bPR\bRO\bOM\bMP\bPT\bTI\bIN\bNG\bG below)
+ and used as the primary prompt string. The default value is
``\\b\s\bs-\b-\\b\v\bv\\b\$\b$ ''.
- P\bPS\bS2\b2 The value of this parameter is expanded as with P\bPS\bS1\b1 and used as
+ P\bPS\bS2\b2 The value of this parameter is expanded as with P\bPS\bS1\b1 and used as
the secondary prompt string. The default is ``>\b> ''.
P\bPS\bS3\b3 The value of this parameter is used as the prompt for the s\bse\bel\ble\bec\bct\bt
command (see S\bSH\bHE\bEL\bLL\bL G\bGR\bRA\bAM\bMM\bMA\bAR\bR above).
- P\bPS\bS4\b4 The value of this parameter is expanded as with P\bPS\bS1\b1 and the
- value is printed before each command b\bba\bas\bsh\bh displays during an
- execution trace. The first character of P\bPS\bS4\b4 is replicated mul-
- tiple times, as necessary, to indicate multiple levels of indi-
+ P\bPS\bS4\b4 The value of this parameter is expanded as with P\bPS\bS1\b1 and the
+ value is printed before each command b\bba\bas\bsh\bh displays during an
+ execution trace. The first character of P\bPS\bS4\b4 is replicated mul-
+ tiple times, as necessary, to indicate multiple levels of indi-
rection. The default is ``+\b+ ''.
S\bSH\bHE\bEL\bLL\bL The full pathname to the shell is kept in this environment vari-
- able. If it is not set when the shell starts, b\bba\bas\bsh\bh assigns to
+ able. If it is not set when the shell starts, b\bba\bas\bsh\bh assigns to
it the full pathname of the current user's login shell.
T\bTI\bIM\bME\bEF\bFO\bOR\bRM\bMA\bAT\bT
- The value of this parameter is used as a format string specify-
- ing how the timing information for pipelines prefixed with the
- t\bti\bim\bme\be reserved word should be displayed. The %\b% character intro-
- duces an escape sequence that is expanded to a time value or
- other information. The escape sequences and their meanings are
+ The value of this parameter is used as a format string specify-
+ ing how the timing information for pipelines prefixed with the
+ t\bti\bim\bme\be reserved word should be displayed. The %\b% character intro-
+ duces an escape sequence that is expanded to a time value or
+ other information. The escape sequences and their meanings are
as follows; the braces denote optional portions.
%\b%%\b% A literal %\b%.
%\b%[\b[_\bp]\b][\b[l\bl]\b]R\bR The elapsed time in seconds.
%\b%[\b[_\bp]\b][\b[l\bl]\b]S\bS The number of CPU seconds spent in system mode.
%\b%P\bP The CPU percentage, computed as (%U + %S) / %R.
- The optional _\bp is a digit specifying the _\bp_\br_\be_\bc_\bi_\bs_\bi_\bo_\bn, the number
+ The optional _\bp is a digit specifying the _\bp_\br_\be_\bc_\bi_\bs_\bi_\bo_\bn, the number
of fractional digits after a decimal point. A value of 0 causes
no decimal point or fraction to be output. At most three places
- after the decimal point may be specified; values of _\bp greater
- than 3 are changed to 3. If _\bp is not specified, the value 3 is
+ after the decimal point may be specified; values of _\bp greater
+ than 3 are changed to 3. If _\bp is not specified, the value 3 is
used.
- The optional l\bl specifies a longer format, including minutes, of
- the form _\bM_\bMm_\bS_\bS._\bF_\bFs. The value of _\bp determines whether or not
+ The optional l\bl specifies a longer format, including minutes, of
+ the form _\bM_\bMm_\bS_\bS._\bF_\bFs. The value of _\bp determines whether or not
the fraction is included.
- If this variable is not set, b\bba\bas\bsh\bh acts as if it had the value
- $\b$'\b'\\b\n\bnr\bre\bea\bal\bl\\b\t\bt%\b%3\b3l\blR\bR\\b\n\bnu\bus\bse\ber\br\\b\t\bt%\b%3\b3l\blU\bU\\b\n\bns\bsy\bys\bs%\b%3\b3l\blS\bS'\b'. If the value is null, no
- timing information is displayed. A trailing newline is added
+ If this variable is not set, b\bba\bas\bsh\bh acts as if it had the value
+ $\b$'\b'\\b\n\bnr\bre\bea\bal\bl\\b\t\bt%\b%3\b3l\blR\bR\\b\n\bnu\bus\bse\ber\br\\b\t\bt%\b%3\b3l\blU\bU\\b\n\bns\bsy\bys\bs%\b%3\b3l\blS\bS'\b'. If the value is null, no
+ timing information is displayed. A trailing newline is added
when the format string is displayed.
- T\bTM\bMO\bOU\bUT\bT If set to a value greater than zero, T\bTM\bMO\bOU\bUT\bT is treated as the
+ T\bTM\bMO\bOU\bUT\bT If set to a value greater than zero, T\bTM\bMO\bOU\bUT\bT is treated as the
default timeout for the r\bre\bea\bad\bd builtin. The s\bse\bel\ble\bec\bct\bt command termi-
nates if input does not arrive after T\bTM\bMO\bOU\bUT\bT seconds when input is
- coming from a terminal. In an interactive shell, the value is
- interpreted as the number of seconds to wait for input after
- issuing the primary prompt. B\bBa\bas\bsh\bh terminates after waiting for
+ coming from a terminal. In an interactive shell, the value is
+ interpreted as the number of seconds to wait for input after
+ issuing the primary prompt. B\bBa\bas\bsh\bh terminates after waiting for
that number of seconds if input does not arrive.
a\bau\but\bto\bo_\b_r\bre\bes\bsu\bum\bme\be
This variable controls how the shell interacts with the user and
- job control. If this variable is set, single word simple com-
+ job control. If this variable is set, single word simple com-
mands without redirections are treated as candidates for resump-
tion of an existing stopped job. There is no ambiguity allowed;
- if there is more than one job beginning with the string typed,
- the job most recently accessed is selected. The _\bn_\ba_\bm_\be of a
- stopped job, in this context, is the command line used to start
- it. If set to the value _\be_\bx_\ba_\bc_\bt, the string supplied must match
- the name of a stopped job exactly; if set to _\bs_\bu_\bb_\bs_\bt_\br_\bi_\bn_\bg, the
- string supplied needs to match a substring of the name of a
- stopped job. The _\bs_\bu_\bb_\bs_\bt_\br_\bi_\bn_\bg value provides functionality analo-
- gous to the %\b%?\b? job identifier (see J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL below). If set
- to any other value, the supplied string must be a prefix of a
+ if there is more than one job beginning with the string typed,
+ the job most recently accessed is selected. The _\bn_\ba_\bm_\be of a
+ stopped job, in this context, is the command line used to start
+ it. If set to the value _\be_\bx_\ba_\bc_\bt, the string supplied must match
+ the name of a stopped job exactly; if set to _\bs_\bu_\bb_\bs_\bt_\br_\bi_\bn_\bg, the
+ string supplied needs to match a substring of the name of a
+ stopped job. The _\bs_\bu_\bb_\bs_\bt_\br_\bi_\bn_\bg value provides functionality analo-
+ gous to the %\b%?\b? job identifier (see J\bJO\bOB\bB C\bCO\bON\bNT\bTR\bRO\bOL\bL below). If set
+ to any other value, the supplied string must be a prefix of a
stopped job's name; this provides functionality analogous to the
%\b%_\bs_\bt_\br_\bi_\bn_\bg job identifier.
h\bhi\bis\bst\btc\bch\bha\bar\brs\bs
- The two or three characters which control history expansion and
+ The two or three characters which control history expansion and
tokenization (see H\bHI\bIS\bST\bTO\bOR\bRY\bY E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN below). The first character
- is the _\bh_\bi_\bs_\bt_\bo_\br_\by _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn character, the character which signals
- the start of a history expansion, normally `!\b!'. The second
- character is the _\bq_\bu_\bi_\bc_\bk _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\bt_\bi_\bo_\bn character, which is used as
- shorthand for re-running the previous command entered, substi-
- tuting one string for another in the command. The default is
- `^\b^'. The optional third character is the character which indi-
- cates that the remainder of the line is a comment when found as
- the first character of a word, normally `#\b#'. The history com-
- ment character causes history substitution to be skipped for the
- remaining words on the line. It does not necessarily cause the
- shell parser to treat the rest of the line as a comment.
+ is the _\bh_\bi_\bs_\bt_\bo_\br_\by _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn character, the character which signals
+ the start of a history expansion, normally `!\b!'. The second
+ character is the _\bq_\bu_\bi_\bc_\bk _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\bt_\bi_\bo_\bn character, which is used as
+ shorthand for re-running the previous command entered,
+ substituting one string for another in the command. The default
+ is `^\b^'. The optional third character is the character which
+ indicates that the remainder of the line is a comment when found
+ as the first character of a word, normally `#\b#'. The history
+ comment character causes history substitution to be skipped for
+ the remaining words on the line. It does not necessarily cause
+ the shell parser to treat the rest of the line as a comment.
A\bAr\brr\bra\bay\bys\bs
- B\bBa\bas\bsh\bh provides one-dimensional array variables. Any variable may be
+ B\bBa\bas\bsh\bh provides one-dimensional array variables. Any variable may be
used as an array; the d\bde\bec\bcl\bla\bar\bre\be builtin will explicitly declare an array.
- There is no maximum limit on the size of an array, nor any requirement
- that members be indexed or assigned contiguously. Arrays are indexed
+ There is no maximum limit on the size of an array, nor any requirement
+ that members be indexed or assigned contiguously. Arrays are indexed
using integers and are zero-based.
- An array is created automatically if any variable is assigned to using
- the syntax _\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]=_\bv_\ba_\bl_\bu_\be. The _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt is treated as an
- arithmetic expression that must evaluate to a number greater than or
- equal to zero. To explicitly declare an array, use d\bde\bec\bcl\bla\bar\bre\be -\b-a\ba _\bn_\ba_\bm_\be
+ An array is created automatically if any variable is assigned to using
+ the syntax _\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]=_\bv_\ba_\bl_\bu_\be. The _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt is treated as an
+ arithmetic expression that must evaluate to a number greater than or
+ equal to zero. To explicitly declare an array, use d\bde\bec\bcl\bla\bar\bre\be -\b-a\ba _\bn_\ba_\bm_\be
(see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below). d\bde\bec\bcl\bla\bar\bre\be -\b-a\ba _\bn_\ba_\bm_\be[\b[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]\b] is also
accepted; the _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt is ignored. Attributes may be specified for an
array variable using the d\bde\bec\bcl\bla\bar\bre\be and r\bre\bea\bad\bdo\bon\bnl\bly\by builtins. Each attribute
applies to all members of an array.
- Arrays are assigned to using compound assignments of the form
- _\bn_\ba_\bm_\be=(\b(value_\b1 ... value_\bn)\b), where each _\bv_\ba_\bl_\bu_\be is of the form [_\bs_\bu_\bb_\b-
+ Arrays are assigned to using compound assignments of the form
+ _\bn_\ba_\bm_\be=(\b(value_\b1 ... value_\bn)\b), where each _\bv_\ba_\bl_\bu_\be is of the form [_\bs_\bu_\bb_\b-
_\bs_\bc_\br_\bi_\bp_\bt]=_\bs_\bt_\br_\bi_\bn_\bg. Only _\bs_\bt_\br_\bi_\bn_\bg is required. If the optional brackets and
- subscript are supplied, that index is assigned to; otherwise the index
- of the element assigned is the last index assigned to by the statement
- plus one. Indexing starts at zero. This syntax is also accepted by
- the d\bde\bec\bcl\bla\bar\bre\be builtin. Individual array elements may be assigned to
+ subscript are supplied, that index is assigned to; otherwise the index
+ of the element assigned is the last index assigned to by the statement
+ plus one. Indexing starts at zero. This syntax is also accepted by
+ the d\bde\bec\bcl\bla\bar\bre\be builtin. Individual array elements may be assigned to
using the _\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]=_\bv_\ba_\bl_\bu_\be syntax introduced above.
- Any element of an array may be referenced using ${_\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]}.
+ Any element of an array may be referenced using ${_\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]}.
The braces are required to avoid conflicts with pathname expansion. If
- _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt is @\b@ or *\b*, the word expands to all members of _\bn_\ba_\bm_\be. These
- subscripts differ only when the word appears within double quotes. If
+ _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt is @\b@ or *\b*, the word expands to all members of _\bn_\ba_\bm_\be. These
+ subscripts differ only when the word appears within double quotes. If
the word is double-quoted, ${_\bn_\ba_\bm_\be[*]} expands to a single word with the
- value of each array member separated by the first character of the I\bIF\bFS\bS
+ value of each array member separated by the first character of the I\bIF\bFS\bS
special variable, and ${_\bn_\ba_\bm_\be[@]} expands each element of _\bn_\ba_\bm_\be to a sep-
- arate word. When there are no array members, ${_\bn_\ba_\bm_\be[@]} expands to
- nothing. If the double-quoted expansion occurs within a word, the
- expansion of the first parameter is joined with the beginning part of
- the original word, and the expansion of the last parameter is joined
- with the last part of the original word. This is analogous to the
- expansion of the special parameters *\b* and @\b@ (see S\bSp\bpe\bec\bci\bia\bal\bl P\bPa\bar\bra\bam\bme\bet\bte\ber\brs\bs
- above). ${#_\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]} expands to the length of ${_\bn_\ba_\bm_\be[_\bs_\bu_\bb_\b-
- _\bs_\bc_\br_\bi_\bp_\bt]}. If _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt is *\b* or @\b@, the expansion is the number of ele-
- ments in the array. Referencing an array variable without a subscript
+ arate word. When there are no array members, ${_\bn_\ba_\bm_\be[@]} expands to
+ nothing. If the double-quoted expansion occurs within a word, the
+ expansion of the first parameter is joined with the beginning part of
+ the original word, and the expansion of the last parameter is joined
+ with the last part of the original word. This is analogous to the
+ expansion of the special parameters *\b* and @\b@ (see S\bSp\bpe\bec\bci\bia\bal\bl P\bPa\bar\bra\bam\bme\bet\bte\ber\brs\bs
+ above). ${#_\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]} expands to the length of ${_\bn_\ba_\bm_\be[_\bs_\bu_\bb_\b-
+ _\bs_\bc_\br_\bi_\bp_\bt]}. If _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt is *\b* or @\b@, the expansion is the number of ele-
+ ments in the array. Referencing an array variable without a subscript
is equivalent to referencing element zero.
- The u\bun\bns\bse\bet\bt builtin is used to destroy arrays. u\bun\bns\bse\bet\bt _\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]
- destroys the array element at index _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt. u\bun\bns\bse\bet\bt _\bn_\ba_\bm_\be, where _\bn_\ba_\bm_\be
- is an array, or u\bun\bns\bse\bet\bt _\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt], where _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt is *\b* or @\b@,
+ The u\bun\bns\bse\bet\bt builtin is used to destroy arrays. u\bun\bns\bse\bet\bt _\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt]
+ destroys the array element at index _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt. u\bun\bns\bse\bet\bt _\bn_\ba_\bm_\be, where _\bn_\ba_\bm_\be
+ is an array, or u\bun\bns\bse\bet\bt _\bn_\ba_\bm_\be[_\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt], where _\bs_\bu_\bb_\bs_\bc_\br_\bi_\bp_\bt is *\b* or @\b@,
removes the entire array.
- The d\bde\bec\bcl\bla\bar\bre\be, l\blo\boc\bca\bal\bl, and r\bre\bea\bad\bdo\bon\bnl\bly\by builtins each accept a -\b-a\ba option to
- specify an array. The r\bre\bea\bad\bd builtin accepts a -\b-a\ba option to assign a
- list of words read from the standard input to an array. The s\bse\bet\bt and
- d\bde\bec\bcl\bla\bar\bre\be builtins display array values in a way that allows them to be
+ The d\bde\bec\bcl\bla\bar\bre\be, l\blo\boc\bca\bal\bl, and r\bre\bea\bad\bdo\bon\bnl\bly\by builtins each accept a -\b-a\ba option to
+ specify an array. The r\bre\bea\bad\bd builtin accepts a -\b-a\ba option to assign a
+ list of words read from the standard input to an array. The s\bse\bet\bt and
+ d\bde\bec\bcl\bla\bar\bre\be builtins display array values in a way that allows them to be
reused as assignments.
E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN
Expansion is performed on the command line after it has been split into
- words. There are seven kinds of expansion performed: _\bb_\br_\ba_\bc_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn,
- _\bt_\bi_\bl_\bd_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn, _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br _\ba_\bn_\bd _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn, _\bc_\bo_\bm_\bm_\ba_\bn_\bd _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\b-
+ words. There are seven kinds of expansion performed: _\bb_\br_\ba_\bc_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn,
+ _\bt_\bi_\bl_\bd_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn, _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br _\ba_\bn_\bd _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn, _\bc_\bo_\bm_\bm_\ba_\bn_\bd _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\b-
_\bt_\bi_\bo_\bn, _\ba_\br_\bi_\bt_\bh_\bm_\be_\bt_\bi_\bc _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn, _\bw_\bo_\br_\bd _\bs_\bp_\bl_\bi_\bt_\bt_\bi_\bn_\bg, and _\bp_\ba_\bt_\bh_\bn_\ba_\bm_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn.
- The order of expansions is: brace expansion, tilde expansion, parame-
- ter, variable and arithmetic expansion and command substitution (done
+ The order of expansions is: brace expansion, tilde expansion, parame-
+ ter, variable and arithmetic expansion and command substitution (done
in a left-to-right fashion), word splitting, and pathname expansion.
On systems that can support it, there is an additional expansion avail-
able: _\bp_\br_\bo_\bc_\be_\bs_\bs _\bs_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\bt_\bi_\bo_\bn.
Only brace expansion, word splitting, and pathname expansion can change
- the number of words of the expansion; other expansions expand a single
- word to a single word. The only exceptions to this are the expansions
+ the number of words of the expansion; other expansions expand a single
+ word to a single word. The only exceptions to this are the expansions
of "$\b$@\b@" and "$\b${\b{_\bn_\ba_\bm_\be[\b[@\b@]\b]}\b}" as explained above (see P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS).
B\bBr\bra\bac\bce\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
_\bB_\br_\ba_\bc_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn is a mechanism by which arbitrary strings may be gener-
- ated. This mechanism is similar to _\bp_\ba_\bt_\bh_\bn_\ba_\bm_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn, but the file-
+ ated. This mechanism is similar to _\bp_\ba_\bt_\bh_\bn_\ba_\bm_\be _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn, but the file-
names generated need not exist. Patterns to be brace expanded take the
form of an optional _\bp_\br_\be_\ba_\bm_\bb_\bl_\be, followed by either a series of comma-sep-
- arated strings or a sequence expression between a pair of braces, fol-
- lowed by an optional _\bp_\bo_\bs_\bt_\bs_\bc_\br_\bi_\bp_\bt. The preamble is prefixed to each
+ arated strings or a sequence expression between a pair of braces, fol-
+ lowed by an optional _\bp_\bo_\bs_\bt_\bs_\bc_\br_\bi_\bp_\bt. The preamble is prefixed to each
string contained within the braces, and the postscript is then appended
to each resulting string, expanding left to right.
- Brace expansions may be nested. The results of each expanded string
- are not sorted; left to right order is preserved. For example,
+ Brace expansions may be nested. The results of each expanded string
+ are not sorted; left to right order is preserved. For example,
a{\b{d,c,b}\b}e expands into `ade ace abe'.
- A sequence expression takes the form {\b{_\bx.\b..\b._\by}\b}, where _\bx and _\by are either
+ A sequence expression takes the form {\b{_\bx.\b..\b._\by}\b}, where _\bx and _\by are either
integers or single characters. When integers are supplied, the expres-
- sion expands to each number between _\bx and _\by, inclusive. When charac-
- ters are supplied, the expression expands to each character lexico-
+ sion expands to each number between _\bx and _\by, inclusive. When charac-
+ ters are supplied, the expression expands to each character lexico-
graphically between _\bx and _\by, inclusive. Note that both _\bx and _\by must be
of the same type.
Brace expansion is performed before any other expansions, and any char-
- acters special to other expansions are preserved in the result. It is
- strictly textual. B\bBa\bas\bsh\bh does not apply any syntactic interpretation to
+ acters special to other expansions are preserved in the result. It is
+ strictly textual. B\bBa\bas\bsh\bh does not apply any syntactic interpretation to
the context of the expansion or the text between the braces.
- A correctly-formed brace expansion must contain unquoted opening and
- closing braces, and at least one unquoted comma or a valid sequence
- expression. Any incorrectly formed brace expansion is left unchanged.
+ A correctly-formed brace expansion must contain unquoted opening and
+ closing braces, and at least one unquoted comma or a valid sequence
+ expression. Any incorrectly formed brace expansion is left unchanged.
A {\b{ or ,\b, may be quoted with a backslash to prevent its being considered
- part of a brace expression. To avoid conflicts with parameter expan-
+ part of a brace expression. To avoid conflicts with parameter expan-
sion, the string $\b${\b{ is not considered eligible for brace expansion.
This construct is typically used as shorthand when the common prefix of
or
chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}
- Brace expansion introduces a slight incompatibility with historical
- versions of s\bsh\bh. s\bsh\bh does not treat opening or closing braces specially
- when they appear as part of a word, and preserves them in the output.
- B\bBa\bas\bsh\bh removes braces from words as a consequence of brace expansion.
- For example, a word entered to s\bsh\bh as _\bf_\bi_\bl_\be_\b{_\b1_\b,_\b2_\b} appears identically in
- the output. The same word is output as _\bf_\bi_\bl_\be_\b1 _\bf_\bi_\bl_\be_\b2 after expansion by
- b\bba\bas\bsh\bh. If strict compatibility with s\bsh\bh is desired, start b\bba\bas\bsh\bh with the
+ Brace expansion introduces a slight incompatibility with historical
+ versions of s\bsh\bh. s\bsh\bh does not treat opening or closing braces specially
+ when they appear as part of a word, and preserves them in the output.
+ B\bBa\bas\bsh\bh removes braces from words as a consequence of brace expansion.
+ For example, a word entered to s\bsh\bh as _\bf_\bi_\bl_\be_\b{_\b1_\b,_\b2_\b} appears identically in
+ the output. The same word is output as _\bf_\bi_\bl_\be_\b1 _\bf_\bi_\bl_\be_\b2 after expansion by
+ b\bba\bas\bsh\bh. If strict compatibility with s\bsh\bh is desired, start b\bba\bas\bsh\bh with the
+\b+B\bB option or disable brace expansion with the +\b+B\bB option to the s\bse\bet\bt com-
mand (see S\bSH\bHE\bEL\bLL\bL B\bBU\bUI\bIL\bLT\bTI\bIN\bN C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS below).
T\bTi\bil\bld\bde\be E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
- If a word begins with an unquoted tilde character (`~\b~'), all of the
- characters preceding the first unquoted slash (or all characters, if
- there is no unquoted slash) are considered a _\bt_\bi_\bl_\bd_\be_\b-_\bp_\br_\be_\bf_\bi_\bx. If none of
- the characters in the tilde-prefix are quoted, the characters in the
- tilde-prefix following the tilde are treated as a possible _\bl_\bo_\bg_\bi_\bn _\bn_\ba_\bm_\be.
- If this login name is the null string, the tilde is replaced with the
- value of the shell parameter H\bHO\bOM\bME\bE. If H\bHO\bOM\bME\bE is unset, the home direc-
- tory of the user executing the shell is substituted instead. Other-
- wise, the tilde-prefix is replaced with the home directory associated
+ If a word begins with an unquoted tilde character (`~\b~'), all of the
+ characters preceding the first unquoted slash (or all characters, if
+ there is no unquoted slash) are considered a _\bt_\bi_\bl_\bd_\be_\b-_\bp_\br_\be_\bf_\bi_\bx. If none of
+ the characters in the tilde-prefix are quoted, the characters in the
+ tilde-prefix following the tilde are treated as a possible _\bl_\bo_\bg_\bi_\bn _\bn_\ba_\bm_\be.
+ If this login name is the null string, the tilde is replaced with the
+ value of the shell parameter H\bHO\bOM\bME\bE. If H\bHO\bOM\bME\bE is unset, the home direc-
+ tory of the user executing the shell is substituted instead. Other-
+ wise, the tilde-prefix is replaced with the home directory associated
with the specified login name.
- If the tilde-prefix is a `~+', the value of the shell variable P\bPW\bWD\bD
+ If the tilde-prefix is a `~+', the value of the shell variable P\bPW\bWD\bD
replaces the tilde-prefix. If the tilde-prefix is a `~-', the value of
- the shell variable O\bOL\bLD\bDP\bPW\bWD\bD, if it is set, is substituted. If the char-
- acters following the tilde in the tilde-prefix consist of a number _\bN,
- optionally prefixed by a `+' or a `-', the tilde-prefix is replaced
+ the shell variable O\bOL\bLD\bDP\bPW\bWD\bD, if it is set, is substituted. If the char-
+ acters following the tilde in the tilde-prefix consist of a number _\bN,
+ optionally prefixed by a `+' or a `-', the tilde-prefix is replaced
with the corresponding element from the directory stack, as it would be
displayed by the d\bdi\bir\brs\bs builtin invoked with the tilde-prefix as an argu-
- ment. If the characters following the tilde in the tilde-prefix con-
+ ment. If the characters following the tilde in the tilde-prefix con-
sist of a number without a leading `+' or `-', `+' is assumed.
If the login name is invalid, or the tilde expansion fails, the word is
Each variable assignment is checked for unquoted tilde-prefixes immedi-
ately following a :\b: or the first =\b=. In these cases, tilde expansion is
- also performed. Consequently, one may use file names with tildes in
- assignments to P\bPA\bAT\bTH\bH, M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH, and C\bCD\bDP\bPA\bAT\bTH\bH, and the shell assigns the
+ also performed. Consequently, one may use file names with tildes in
+ assignments to P\bPA\bAT\bTH\bH, M\bMA\bAI\bIL\bLP\bPA\bAT\bTH\bH, and C\bCD\bDP\bPA\bAT\bTH\bH, and the shell assigns the
expanded value.
P\bPa\bar\bra\bam\bme\bet\bte\ber\br E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn
The `$\b$' character introduces parameter expansion, command substitution,
- or arithmetic expansion. The parameter name or symbol to be expanded
- may be enclosed in braces, which are optional but serve to protect the
- variable to be expanded from characters immediately following it which
+ or arithmetic expansion. The parameter name or symbol to be expanded
+ may be enclosed in braces, which are optional but serve to protect the
+ variable to be expanded from characters immediately following it which
could be interpreted as part of the name.
- When braces are used, the matching ending brace is the first `}\b}' not
- escaped by a backslash or within a quoted string, and not within an
+ When braces are used, the matching ending brace is the first `}\b}' not
+ escaped by a backslash or within a quoted string, and not within an
embedded arithmetic expansion, command substitution, or parameter
expansion.
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br}
- The value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is substituted. The braces are required
- when _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is a positional parameter with more than one
+ The value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is substituted. The braces are required
+ when _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is a positional parameter with more than one
digit, or when _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is followed by a character which is not
to be interpreted as part of its name.
If the first character of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an exclamation point, a level of
- variable indirection is introduced. B\bBa\bas\bsh\bh uses the value of the vari-
- able formed from the rest of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br as the name of the variable;
- this variable is then expanded and that value is used in the rest of
- the substitution, rather than the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br itself. This is
+ variable indirection is introduced. B\bBa\bas\bsh\bh uses the value of the vari-
+ able formed from the rest of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br as the name of the variable;
+ this variable is then expanded and that value is used in the rest of
+ the substitution, rather than the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br itself. This is
known as _\bi_\bn_\bd_\bi_\br_\be_\bc_\bt _\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn. The exceptions to this are the expansions
- of ${!_\bp_\br_\be_\bf_\bi_\bx*} and ${!\b!_\bn_\ba_\bm_\be[_\b@]} described below. The exclamation point
- must immediately follow the left brace in order to introduce indirec-
+ of ${!_\bp_\br_\be_\bf_\bi_\bx*} and ${!\b!_\bn_\ba_\bm_\be[_\b@]} described below. The exclamation point
+ must immediately follow the left brace in order to introduce indirec-
tion.
In each of the cases below, _\bw_\bo_\br_\bd is subject to tilde expansion, parame-
- ter expansion, command substitution, and arithmetic expansion. When
- not performing substring expansion, b\bba\bas\bsh\bh tests for a parameter that is
- unset or null; omitting the colon results in a test only for a parame-
+ ter expansion, command substitution, and arithmetic expansion. When
+ not performing substring expansion, b\bba\bas\bsh\bh tests for a parameter that is
+ unset or null; omitting the colon results in a test only for a parame-
ter that is unset.
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:-\b-_\bw_\bo_\br_\bd}
- U\bUs\bse\be D\bDe\bef\bfa\bau\bul\blt\bt V\bVa\bal\blu\bue\bes\bs. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is unset or null, the expan-
- sion of _\bw_\bo_\br_\bd is substituted. Otherwise, the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
+ U\bUs\bse\be D\bDe\bef\bfa\bau\bul\blt\bt V\bVa\bal\blu\bue\bes\bs. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is unset or null, the expan-
+ sion of _\bw_\bo_\br_\bd is substituted. Otherwise, the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
is substituted.
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:=\b=_\bw_\bo_\br_\bd}
- A\bAs\bss\bsi\big\bgn\bn D\bDe\bef\bfa\bau\bul\blt\bt V\bVa\bal\blu\bue\bes\bs. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is unset or null, the
+ A\bAs\bss\bsi\big\bgn\bn D\bDe\bef\bfa\bau\bul\blt\bt V\bVa\bal\blu\bue\bes\bs. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is unset or null, the
expansion of _\bw_\bo_\br_\bd is assigned to _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. The value of _\bp_\ba_\br_\ba_\bm_\b-
- _\be_\bt_\be_\br is then substituted. Positional parameters and special
+ _\be_\bt_\be_\br is then substituted. Positional parameters and special
parameters may not be assigned to in this way.
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:?\b?_\bw_\bo_\br_\bd}
- D\bDi\bis\bsp\bpl\bla\bay\by E\bEr\brr\bro\bor\br i\bif\bf N\bNu\bul\bll\bl o\bor\br U\bUn\bns\bse\bet\bt. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is null or unset,
- the expansion of _\bw_\bo_\br_\bd (or a message to that effect if _\bw_\bo_\br_\bd is
- not present) is written to the standard error and the shell, if
+ D\bDi\bis\bsp\bpl\bla\bay\by E\bEr\brr\bro\bor\br i\bif\bf N\bNu\bul\bll\bl o\bor\br U\bUn\bns\bse\bet\bt. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is null or unset,
+ the expansion of _\bw_\bo_\br_\bd (or a message to that effect if _\bw_\bo_\br_\bd is
+ not present) is written to the standard error and the shell, if
it is not interactive, exits. Otherwise, the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
is substituted.
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:+\b+_\bw_\bo_\br_\bd}
- U\bUs\bse\be A\bAl\blt\bte\ber\brn\bna\bat\bte\be V\bVa\bal\blu\bue\be. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is null or unset, nothing is
+ U\bUs\bse\be A\bAl\blt\bte\ber\brn\bna\bat\bte\be V\bVa\bal\blu\bue\be. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is null or unset, nothing is
substituted, otherwise the expansion of _\bw_\bo_\br_\bd is substituted.
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:_\bo_\bf_\bf_\bs_\be_\bt}
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br:\b:_\bo_\bf_\bf_\bs_\be_\bt:\b:_\bl_\be_\bn_\bg_\bt_\bh}
- S\bSu\bub\bbs\bst\btr\bri\bin\bng\bg E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn.\b. Expands to up to _\bl_\be_\bn_\bg_\bt_\bh characters of
- _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br starting at the character specified by _\bo_\bf_\bf_\bs_\be_\bt. If
- _\bl_\be_\bn_\bg_\bt_\bh is omitted, expands to the substring of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
- starting at the character specified by _\bo_\bf_\bf_\bs_\be_\bt. _\bl_\be_\bn_\bg_\bt_\bh and _\bo_\bf_\bf_\b-
- _\bs_\be_\bt are arithmetic expressions (see A\bAR\bRI\bIT\bTH\bHM\bME\bET\bTI\bIC\bC E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN
- below). _\bl_\be_\bn_\bg_\bt_\bh must evaluate to a number greater than or equal
- to zero. If _\bo_\bf_\bf_\bs_\be_\bt evaluates to a number less than zero, the
- value is used as an offset from the end of the value of _\bp_\ba_\br_\ba_\bm_\be_\b-
- _\bt_\be_\br. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@, the result is _\bl_\be_\bn_\bg_\bt_\bh positional parame-
- ters beginning at _\bo_\bf_\bf_\bs_\be_\bt. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an array name indexed
- by @ or *, the result is the _\bl_\be_\bn_\bg_\bt_\bh members of the array begin-
- ning with ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br[_\bo_\bf_\bf_\bs_\be_\bt]}. A negative _\bo_\bf_\bf_\bs_\be_\bt is taken rel-
- ative to one greater than the maximum index of the specified
- array. 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 posi-
- tional parameters are used, in which case the indexing starts at
- 1.
+ S\bSu\bub\bbs\bst\btr\bri\bin\bng\bg E\bEx\bxp\bpa\ban\bns\bsi\bio\bon\bn.\b. Expands to up to _\bl_\be_\bn_\bg_\bt_\bh characters of
+ _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br starting at the character specified by _\bo_\bf_\bf_\bs_\be_\bt. If
+ _\bl_\be_\bn_\bg_\bt_\bh is omitted, expands to the substring of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br start-
+ ing at the character specified by _\bo_\bf_\bf_\bs_\be_\bt. _\bl_\be_\bn_\bg_\bt_\bh and _\bo_\bf_\bf_\bs_\be_\bt are
+ arithmetic expressions (see A\bAR\bRI\bIT\bTH\bHM\bME\bET\bTI\bIC\bC E\bEV\bVA\bAL\bLU\bUA\bAT\bTI\bIO\bON\bN below).
+ _\bl_\be_\bn_\bg_\bt_\bh must evaluate to a number greater than or equal to zero.
+ If _\bo_\bf_\bf_\bs_\be_\bt evaluates to a number less than zero, the value is
+ used as an offset from the end of the value of _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br. If
+ _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is @\b@, the result is _\bl_\be_\bn_\bg_\bt_\bh positional parameters
+ beginning at _\bo_\bf_\bf_\bs_\be_\bt. If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is an array name indexed by @
+ or *, the result is the _\bl_\be_\bn_\bg_\bt_\bh members of the array beginning
+ with ${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br[_\bo_\bf_\bf_\bs_\be_\bt]}. A negative _\bo_\bf_\bf_\bs_\be_\bt is taken relative
+ to one greater than the maximum index of the specified array.
+ Note that a negative offset must be separated from the colon by
+ at least one space to avoid being confused with the :- expan-
+ sion. Substring indexing is zero-based unless the positional
+ parameters are used, in which case the indexing starts at 1.
${!\b!_\bp_\br_\be_\bf_\bi_\bx*\b*}
${!\b!_\bp_\br_\be_\bf_\bi_\bx@\b@}
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br/\b/_\bp_\ba_\bt_\bt_\be_\br_\bn/\b/_\bs_\bt_\br_\bi_\bn_\bg}
${_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br/\b//\b/_\bp_\ba_\bt_\bt_\be_\br_\bn/\b/_\bs_\bt_\br_\bi_\bn_\bg}
The _\bp_\ba_\bt_\bt_\be_\br_\bn is expanded to produce a pattern just as in pathname
- expansion. _\bP_\ba_\br_\ba_\bm_\be_\bt_\be_\br is expanded and the longest match of _\bp_\ba_\bt_\b-
- _\bt_\be_\br_\bn against its value is replaced with _\bs_\bt_\br_\bi_\bn_\bg. In the first
+ expansion. _\bP_\ba_\br_\ba_\bm_\be_\bt_\be_\br is expanded and the longest match of
+ _\bp_\ba_\bt_\bt_\be_\br_\bn against its value is replaced with _\bs_\bt_\br_\bi_\bn_\bg. In the first
form, only the first match is replaced. The second form causes
all matches of _\bp_\ba_\bt_\bt_\be_\br_\bn to be replaced with _\bs_\bt_\br_\bi_\bn_\bg. If _\bp_\ba_\bt_\bt_\be_\br_\bn
begins with #\b#, it must match at the beginning of the expanded
ered. The string is first split using the characters in the I\bIF\bFS\bS spe-
cial variable as delimiters. Shell quoting is honored. Each word is
then expanded using brace expansion, tilde expansion, parameter and
- variable expansion, command substitution, arithmetic expansion, and
- pathname expansion, as described above under E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN. The results
- are split using the rules described above under W\bWo\bor\brd\bd S\bSp\bpl\bli\bit\btt\bti\bin\bng\bg. The
- results of the expansion are prefix-matched against the word being com-
- pleted, and the matching words become the possible completions.
+ variable expansion, command substitution, and arithmetic expansion, as
+ described above under E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN. The results are split using the rules
+ described above under W\bWo\bor\brd\bd S\bSp\bpl\bli\bit\btt\bti\bin\bng\bg. The results of the expansion are
+ prefix-matched against the word being completed, and the matching words
+ become the possible completions.
After these matches have been generated, any shell function or command
specified with the -\b-F\bF and -\b-C\bC options is invoked. When the command or
_\bd_\bi_\br begins with a slash (/), then C\bCD\bDP\bPA\bAT\bTH\bH is not used. The -\b-P\bP
option says to use the physical directory structure instead of
following symbolic links (see also the -\b-P\bP option to the s\bse\bet\bt
- builtin command); the -\b-L\bL option forces symbolic links to be fol-
- lowed. An argument of -\b- is equivalent to $\b$O\bOL\bLD\bDP\bPW\bWD\bD. If a non-
+ builtin command); the -\b-L\bL option forces symbolic links to be
+ followed. An argument of -\b- is equivalent to $\b$O\bOL\bLD\bDP\bPW\bWD\bD. If a non-
empty directory name from C\bCD\bDP\bPA\bAT\bTH\bH is used, or if -\b- is the first
argument, and the directory change is successful, the absolute
pathname of the new working directory is written to the standard
with a -\b-.
-\b- Signal the end of options, cause all remaining _\ba_\br_\bgs to
be assigned to the positional parameters. The -\b-x\bx and -\b-v\bv
- options are turned off. If there are no _\ba_\br_\bgs, the posi-
- tional parameters remain unchanged.
+ options are turned off. If there are no _\ba_\br_\bgs, the
+ positional parameters remain unchanged.
The options are off by default unless otherwise noted. Using +
rather than - causes these options to be turned off. The
whose value is the directory to change to.
c\bcd\bds\bsp\bpe\bel\bll\bl If set, minor errors in the spelling of a directory com-
ponent in a c\bcd\bd command will be corrected. The errors
- checked for are transposed characters, a missing
- character, and one character too many. If a correction
- is found, the corrected file name is printed, and the
- command proceeds. This option is only used by interac-
- tive shells.
+ checked for are transposed characters, a missing charac-
+ ter, and one character too many. If a correction is
+ found, the corrected file name is printed, and the com-
+ mand proceeds. This option is only used by interactive
+ shells.
c\bch\bhe\bec\bck\bkh\bha\bas\bsh\bh
If set, b\bba\bas\bsh\bh checks that a command found in the hash ta-
ble exists before trying to execute it. If a hashed
-GNU Bash-3.1-devel 2004 Dec 22 BASH(1)
+GNU Bash-3.1-devel 2005 Feb 11 BASH(1)
.\" Case Western Reserve University
.\" chet@po.CWRU.Edu
.\"
-.\" Last Change: Fri Feb 11 15:43:40 EST 2005
+.\" Last Change: Sat Feb 19 17:38:29 EST 2005
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
-.TH BASH 1 "2005 Feb 11" "GNU Bash-3.1-devel"
+.TH BASH 1 "2005 Feb 19" "GNU Bash-3.1-devel"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
.TP
.B \-\-debugger
Arrange for the debugger profile to be executed before the shell
-starts. Turns on extended debugging mode (see the description of the
+starts.
+Turns on extended debugging mode (see the description of the
.B extdebug
option to the
.B shopt
-builtin below) and shell function tracing (see the description of the
+builtin below)
+and shell function tracing (see the description of the
\fB\-o functrace\fP option to the
.B set
builtin below).
When the \fB==\fP and \fB!=\fP operators are used, the string to the
right of the operator is considered a pattern and matched according
to the rules described below under \fBPattern Matching\fP.
+If the shell option
+.B nocasematch
+is enabled, the match is performed without regard to the case
+of alphabetic characters.
The return value is 0 if the string matches or does not match
the pattern, respectively, and 1 otherwise.
Any part of the pattern may be quoted to force it to be matched as a
If the regular expression is syntactically incorrect, the conditional
expression's return value is 2.
If the shell option
-.B nocaseglob
+.B nocasematch
is enabled, the match is performed without regard to the case
of alphabetic characters.
Substrings matched by parenthesized subexpressions within the regular
it against each \fIpattern\fP in turn, using the same matching rules
as for pathname expansion (see
.B Pathname Expansion
-below). When a match is found, the
+below).
+If the shell option
+.B nocasematch
+is enabled, the match is performed without regard to the case
+of alphabetic characters.
+When a match is found, the
corresponding \fIlist\fP is executed. After the first match, no
subsequent matches are attempted. The exit status is zero if no
pattern matches. Otherwise, it is the exit status of the
.TP
.B BASH_ARGC
An array variable whose values are the number of parameters in each
-frame of the current bash execution call stack. The number of
+frame of the current bash execution call stack.
+The number of
parameters to the current subroutine (shell function or script executed
-with \fB.\fP or \fBsource\fP) is at the top of the stack. When a
-subroutine is executed, the number of parameters passed is pushed onto
+with \fB.\fP or \fBsource\fP) is at the top of the stack.
+When a subroutine is executed, the number of parameters passed is pushed onto
\fBBASH_ARGC\fP.
+The shell sets \fBBASH_ARGC\fP only when in extended debugging mode
+(see the description of the
+.B extdebug
+option to the
+.B shopt
+builtin below)
.TP
.B BASH_ARGV
An array variable containing all of the parameters in the current bash
is at the top of the stack; the first parameter of the initial call is
at the bottom. When a subroutine is executed, the parameters supplied
are pushed onto \fBBASH_ARGV\fP.
+The shell sets \fBBASH_ARGV\fP only when in extended debugging mode
+(see the description of the
+.B extdebug
+option to the
+.B shopt
+builtin below)
.TP
.B BASH_COMMAND
The command currently being executed or about to be executed, unless the
shell is executing in a subroutine (a shell function or a shell script
executed by the \fB.\fP or \fBsource\fP builtins), a call to
\fBreturn\fP is simulated.
+.TP
+.B 4.
+\fBBASH_ARGC\fP and \fBBASH_ARGV\fP are updated as described in their
+descriptions above.
+.TP
+.B 5.
+Function tracing is enabled: command substitution, shell functions, and
+subshells invoked with \fB(\fP \fIcommand\fP \fB)\fP inherit the
+\fBDEBUG\fP and \fBRETURN\fP traps.
+.TP
+.B 6.
+Error tracing is enabled: command substitution, shell functions, and
+subshells invoked with \fB(\fP \fIcommand\fP \fB)\fP inherit the
+\fBERROR\fP trap.
.RE
.TP 8
.B extglob
.B Pathname Expansion
above).
.TP 8
+.B nocasematch
+If set,
+.B bash
+matches patterns in a case\-insensitive fashion when performing matching
+while executing \fBcase\fP or \fB[[\fP conditional commands.
+.TP 8
.B nullglob
If set,
.B bash
.\" Case Western Reserve University
.\" chet@po.CWRU.Edu
.\"
-.\" Last Change: Tue Jan 4 17:23:59 EST 2005
+.\" Last Change: Sat Feb 19 17:38:29 EST 2005
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
-.TH BASH 1 "2005 Jan 4" "GNU Bash-3.1-devel"
+.TH BASH 1 "2005 Feb 19" "GNU Bash-3.1-devel"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
.TP
.B \-\-debugger
Arrange for the debugger profile to be executed before the shell
-starts. Turns on extended debugging mode (see the description of the
+starts.
+Turns on extended debugging mode (see the description of the
.B extdebug
option to the
.B shopt
-builtin below) and shell function tracing (see the description of the
+builtin below)
+and shell function tracing (see the description of the
\fB\-o functrace\fP option to the
.B set
builtin below).
When the \fB==\fP and \fB!=\fP operators are used, the string to the
right of the operator is considered a pattern and matched according
to the rules described below under \fBPattern Matching\fP.
+If the shell option
+.B nocasematch
+is enabled, the match is performed without regard to the case
+of alphabetic characters.
The return value is 0 if the string matches or does not match
the pattern, respectively, and 1 otherwise.
Any part of the pattern may be quoted to force it to be matched as a
If the regular expression is syntactically incorrect, the conditional
expression's return value is 2.
If the shell option
-.B nocaseglob
+.B nocasematch
is enabled, the match is performed without regard to the case
of alphabetic characters.
Substrings matched by parenthesized subexpressions within the regular
it against each \fIpattern\fP in turn, using the same matching rules
as for pathname expansion (see
.B Pathname Expansion
-below). When a match is found, the
+below).
+If the shell option
+.B nocasematch
+is enabled, the match is performed without regard to the case
+of alphabetic characters.
+When a match is found, the
corresponding \fIlist\fP is executed. After the first match, no
subsequent matches are attempted. The exit status is zero if no
pattern matches. Otherwise, it is the exit status of the
as given by argument zero.
.TP
.B _
-At shell startup, set to the absolute file name of the shell or shell
-script being executed as passed in the argument list.
+At shell startup, set to the absolute pathname used to invoke the
+shell or shell script being executed as passed in the environment
+or argument list.
Subsequently, expands to the last argument to the previous command,
after expansion.
-Also set to the full file name of each command executed and placed in
-the environment exported to that command.
+Also set to the full pathname used to invoke each command executed
+and placed in the environment exported to that command.
When checking mail, this parameter holds the name of the mail file
currently being checked.
.PD
.TP
.B BASH_ARGC
An array variable whose values are the number of parameters in each
-frame of the current bash execution call stack. The number of
+frame of the current bash execution call stack.
+The number of
parameters to the current subroutine (shell function or script executed
-with \fB.\fP or \fBsource\fP) is at the top of the stack. When a
-subroutine is executed, the number of parameters passed is pushed onto
+with \fB.\fP or \fBsource\fP) is at the top of the stack.
+When a subroutine is executed, the number of parameters passed is pushed onto
\fBBASH_ARGC\fP.
+The shell sets \fBBASH_ARGC\fP only when in extended debugging mode
+(see the description of the
+.B extdebug
+option to the
+.B shopt
+builtin below)
.TP
.B BASH_ARGV
An array variable containing all of the parameters in the current bash
is at the top of the stack; the first parameter of the initial call is
at the bottom. When a subroutine is executed, the parameters supplied
are pushed onto \fBBASH_ARGV\fP.
+The shell sets \fBBASH_ARGV\fP only when in extended debugging mode
+(see the description of the
+.B extdebug
+option to the
+.B shopt
+builtin below)
.TP
.B BASH_COMMAND
The command currently being executed or about to be executed, unless the
shell is executing in a subroutine (a shell function or a shell script
executed by the \fB.\fP or \fBsource\fP builtins), a call to
\fBreturn\fP is simulated.
+.TP
+.B 4.
+\fBBASH_ARGC\fP and \fBBASH_ARGV\fP are updated as described in their
+descriptions above.
+.TP
+.B 5.
+Function tracing is enabled: command substitution, shell functions, and
+subshells invoked with \fB(\fP \fIcommand\fP \fB)\fP inherit the
+\fBDEBUG\fP and \fBRETURN\fP traps.
+.TP
+.B 6.
+Error tracing is enabled: command substitution, shell functions, and
+subshells invoked with \fB(\fP \fIcommand\fP \fB)\fP inherit the
+\fBERROR\fP trap.
.RE
.TP 8
.B extglob
<TITLE>BASH(1) Manual Page</TITLE>
</HEAD>
<BODY><TABLE WIDTH=100%>
-<TH ALIGN=LEFT>BASH(1)<TH ALIGN=CENTER>2004 Dec 22<TH ALIGN=RIGHT>BASH(1)
+<TH ALIGN=LEFT>BASH(1)<TH ALIGN=CENTER>2005 Feb 11<TH ALIGN=RIGHT>BASH(1)
</TABLE>
<BR><A HREF="#index">Index</A>
<HR>
<H2>COPYRIGHT</H2>
-Bash is Copyright © 1989-2004 by the Free Software Foundation, Inc.
+Bash is Copyright © 1989-2005 by the Free Software Foundation, Inc.
<A NAME="lbAE"> </A>
<H2>DESCRIPTION</H2>
<DT><B>_</B>
<DD>
-At shell startup, set to the absolute file name of the shell or shell
-script being executed as passed in the argument list.
+At shell startup, set to the absolute pathname used to invoke the
+shell or shell script being executed as passed in the environment
+or argument list.
Subsequently, expands to the last argument to the previous command,
after expansion.
-Also set to the full file name of each command executed and placed in
-the environment exported to that command.
+Also set to the full pathname used to invoke each command executed
+and placed in the environment exported to that command.
When checking mail, this parameter holds the name of the mail file
currently being checked.
Shell quoting is honored.
Each word is then expanded using
brace expansion, tilde expansion, parameter and variable expansion,
-command substitution, arithmetic expansion, and pathname expansion,
+command substitution, and arithmetic expansion,
as described above under
<FONT SIZE=-1><B>EXPANSION</B>.
</DL>
<HR>
This document was created by man2html from bash.1.<BR>
-Time: 30 December 2004 17:01:32 EST
+Time: 14 February 2005 11:56:43 EST
</BODY>
</HTML>
%!PS-Adobe-3.0
%%Creator: groff version 1.18.1
-%%CreationDate: Thu Dec 30 17:01:21 2004
+%%CreationDate: Mon Feb 14 11:56:35 2005
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
%%+ font Palatino-Italic
%%+ font Palatino-Bold
%%DocumentSuppliedResources: procset grops 1.18 1
-%%Pages: 64
+%%Pages: 65
%%PageOrder: Ascend
%%Orientation: Portrait
%%EndComments
%%BeginPageSetup
BP
%%EndPageSetup
+/F0 10/Times-Roman@0 SF(1)535 768 Q 0 Cg EP
+%%Page: 1 2
+%%BeginPageSetup
+BP
+%%EndPageSetup
/F0 10/Times-Roman@0 SF -.35(BA)72 48 S 389.54(SH\(1\) B).35 F(ASH\(1\))
-.35 E/F1 10.95/Times-Bold@0 SF -.219(NA)72 84 S(ME).219 E F0
(bash \255 GNU Bourne-Ag)108 96 Q(ain SHell)-.05 E F1(SYNOPSIS)72 112.8
Q/F2 10/Times-Bold@0 SF(bash)108 124.8 Q F0([options] [\214le])2.5 E F1
(COPYRIGHT)72 141.6 Q F0(Bash is Cop)108 153.6 Q
-(yright \251 1989-2004 by the Free Softw)-.1 E(are F)-.1 E
+(yright \251 1989-2005 by the Free Softw)-.1 E(are F)-.1 E
(oundation, Inc.)-.15 E F1(DESCRIPTION)72 170.4 Q F2(Bash)108 182.4 Q F0
.973(is an)3.474 F F2(sh)3.473 E F0 .973
(-compatible command language interpreter that e)B -.15(xe)-.15 G .973
144 686.4 Q .3 -.15(ve \()-.25 H(see).15 E F4(INV)2.5 E(OCA)-.405 E
(TION)-.855 E F0(belo)2.25 E(w\).)-.25 E F2(\255\255login)108 703.2 Q F0
(Equi)144 715.2 Q -.25(va)-.25 G(lent to).25 E F2<ad6c>2.5 E F0(.)A
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(1)203.45 E 0 Cg EP
-%%Page: 2 2
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(1)204 E 0 Cg EP
+%%Page: 2 3
%%BeginPageSetup
BP
%%EndPageSetup
108 727.2 S 2.5(tt).2 G(he v)-2.5 E(alue of the)-.25 E F3 -.666(PA)2.5 G
(TH)-.189 E F0 -.25(va)2.25 G
(riable is not used to search for the \214le name.).25 E
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(2)203.45 E 0 Cg EP
-%%Page: 3 3
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(2)204 E 0 Cg EP
+%%Page: 3 4
%%BeginPageSetup
BP
%%EndPageSetup
F F1(|)2.92 E F0 5.42(.T)C .42(he format for a pipeline)-5.42 F(is:)108
703.2 Q([)144 720 Q F1(time)A F0([)2.5 E F1<ad70>A F0(]] [ ! ])A F2
(command)2.5 E F0([)2.5 E F1(|)2.5 E F2(command2)2.5 E F0(... ])2.5 E
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(3)203.45 E 0 Cg EP
-%%Page: 4 4
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(3)204 E 0 Cg EP
+%%Page: 4 5
%%BeginPageSetup
BP
%%EndPageSetup
F(SIONS)144 727.2 Q F5(.)A F0 -.8(Wo)5.633 G 1.133
(rd splitting and pathname e).8 F 1.133
(xpansion are not performed on the w)-.15 F 1.133(ords between the)-.1 F
-F3([[)3.632 E F0(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G
-(004 Dec 22)-123.87 E(4)203.45 E 0 Cg EP
-%%Page: 5 5
+F3([[)3.632 E F0(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G
+(005 Feb 11)-124.42 E(4)204 E 0 Cg EP
+%%Page: 5 6
%%BeginPageSetup
BP
%%EndPageSetup
(The line read is sa)5.759 F -.15(ve)-.2 G 3.26(di).15 G 3.26(nt)-3.26 G
.76(he v)-3.26 F(ariable)-.25 E F1(REPL)3.26 E(Y)-.92 E F0 5.76(.T)C(he)
-5.76 E F2(list)3.35 E F0 .76(is e)3.94 F -.15(xe)-.15 G .76
-(cuted after).15 F(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15
-G(004 Dec 22)-123.87 E(5)203.45 E 0 Cg EP
-%%Page: 6 6
+(cuted after).15 F(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15
+G(005 Feb 11)-124.42 E(5)204 E 0 Cg EP
+%%Page: 6 7
%%BeginPageSetup
BP
%%EndPageSetup
G(he)-2.974 E F2 .474(escape c)2.974 F(har)-.15 E(acter)-.15 E F0 5.474
(.I).73 G 2.974(tp)-5.474 G(reserv)-2.974 E .474(es the literal v)-.15 F
.474(alue of the ne)-.25 F .474(xt character that)-.15 F
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(6)203.45 E 0 Cg EP
-%%Page: 7 7
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(6)204 E 0 Cg EP
+%%Page: 7 8
%%BeginPageSetup
BP
%%EndPageSetup
(operator can be used to append to or add to the v)108 729.6 R(ariable')
-.25 E 2.757(sp)-.55 G(re)-2.757 E .257(vious v)-.25 F 2.757(alue. When)
-.25 F .257(+= is applied to a v)2.757 F(ariable)-.25 E(GNU Bash-3.1-de)
-72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(7)203.45 E
-0 Cg EP
-%%Page: 8 8
+72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(7)204 E 0
+Cg EP
+%%Page: 8 9
%%BeginPageSetup
BP
%%EndPageSetup
(-)-.2 E(wise, it is set to the \214le name used to in)144 530.4 Q -.2
(vo)-.4 G -.1(ke).2 G F2(bash)2.6 E F0 2.5(,a)C 2.5(sg)-2.5 G -2.15 -.25
(iv e)-2.5 H 2.5(nb).25 G 2.5(ya)-2.5 G -.18(rg)-2.5 G(ument zero.).18 E
-F2(_)108 542.4 Q F0 .1(At shell startup, set to the absolute \214le nam\
-e of the shell or shell script being e)31 F -.15(xe)-.15 G .1
-(cuted as passed in).15 F 1.706(the ar)144 554.4 R 1.706(gument list.)
--.18 F(Subsequently)6.706 E 4.206(,e)-.65 G 1.705(xpands to the last ar)
--4.356 F 1.705(gument to the pre)-.18 F 1.705(vious command, after)-.25
-F -.15(ex)144 566.4 S 2.515(pansion. Also).15 F .016
-(set to the full \214le name of each command e)2.515 F -.15(xe)-.15 G
-.016(cuted and placed in the en).15 F(vironment)-.4 E -.15(ex)144 578.4
-S 1.006(ported to that command.).15 F 1.006
-(When checking mail, this parameter holds the name of the mail \214le)
-6.006 F(currently being check)144 590.4 Q(ed.)-.1 E F2(Shell V)87 607.2
-Q(ariables)-.92 E F0(The follo)108 619.2 Q(wing v)-.25 E
-(ariables are set by the shell:)-.25 E F2 -.3(BA)108 636 S(SH).3 E F0
-(Expands to the full \214le name used to in)9.07 E -.2(vo)-.4 G .2 -.1
-(ke t).2 H(his instance of).1 E F2(bash)2.5 E F0(.)A F2 -.3(BA)108 648 S
-(SH_ARGC).3 E F0 1.039(An array v)144 660 R 1.039(ariable whose v)-.25 F
-1.039
+F2(_)108 542.4 Q F0 .054
+(At shell startup, set to the absolute pathname used to in)31 F -.2(vo)
+-.4 G .255 -.1(ke t).2 H .055(he shell or shell script being e).1 F -.15
+(xe)-.15 G(cuted).15 E .692(as passed in the en)144 554.4 R .692
+(vironment or ar)-.4 F .691(gument list.)-.18 F(Subsequently)5.691 E
+3.191(,e)-.65 G .691(xpands to the last ar)-3.341 F .691(gument to the)
+-.18 F(pre)144 566.4 Q .57(vious command, after e)-.25 F 3.07
+(xpansion. Also)-.15 F .571(set to the full pathname used to in)3.071 F
+-.2(vo)-.4 G .771 -.1(ke e).2 H .571(ach command).1 F -.15(exe)144 578.4
+S 1.6(cuted and placed in the en).15 F 1.6(vironment e)-.4 F 1.6
+(xported to that command.)-.15 F 1.6(When checking mail, this)6.6 F
+(parameter holds the name of the mail \214le currently being check)144
+590.4 Q(ed.)-.1 E F2(Shell V)87 607.2 Q(ariables)-.92 E F0(The follo)108
+619.2 Q(wing v)-.25 E(ariables are set by the shell:)-.25 E F2 -.3(BA)
+108 636 S(SH).3 E F0(Expands to the full \214le name used to in)9.07 E
+-.2(vo)-.4 G .2 -.1(ke t).2 H(his instance of).1 E F2(bash)2.5 E F0(.)A
+F2 -.3(BA)108 648 S(SH_ARGC).3 E F0 1.039(An array v)144 660 R 1.039
+(ariable whose v)-.25 F 1.039
(alues are the number of parameters in each frame of the current bash)
-.25 F -.15(exe)144 672 S .535(cution call stack.).15 F .535(The number\
of parameters to the current subroutine \(shell function or script)
(When a subroutine is e)5.142 F -.15(xe)-.15 G .142
(cuted, the number of).15 F(parameters passed is pushed onto)144 696 Q
F2 -.3(BA)2.5 G(SH_ARGC).3 E F0(.)A(GNU Bash-3.1-de)72 768 Q -.15(ve)
--.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(8)203.45 E 0 Cg EP
-%%Page: 9 9
+-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(8)204 E 0 Cg EP
+%%Page: 9 10
%%BeginPageSetup
BP
%%EndPageSetup
F(in)144 697.2 Q -.2(vo)-.4 G -.1(ke).2 G 2.5(db).1 G 2.5(yt)-2.5 G
(he programmable completion f)-2.5 E(acilities \(see)-.1 E F1(Pr)2.5 E
(ogrammable Completion)-.18 E F0(belo)2.5 E(w\).)-.25 E(GNU Bash-3.1-de)
-72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(9)203.45 E
-0 Cg EP
-%%Page: 10 10
+72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(9)204 E 0
+Cg EP
+%%Page: 10 11
%%BeginPageSetup
BP
%%EndPageSetup
(gument processed by the)-.18 F F1(getopts)4.127 E F0 -.2(bu)4.127 G
1.626(iltin command \(see).2 F F2(SHELL)4.126 E -.09(BU)144 705.6 S(IL)
.09 E(TIN COMMANDS)-.828 E F0(belo)2.25 E(w\).)-.25 E(GNU Bash-3.1-de)72
-768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(10)198.45 E 0
-Cg EP
-%%Page: 11 11
+768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(10)199 E 0 Cg
+EP
+%%Page: 11 12
%%BeginPageSetup
BP
%%EndPageSetup
(in)144 705.6 Q -.2(vo)-.4 G -.1(ke).2 G 2.5(db).1 G 2.5(yt)-2.5 G
(he programmable completion f)-2.5 E(acility \(see)-.1 E F1(Pr)2.5 E
(ogrammable Completion)-.18 E F0(belo)2.5 E(w\).)-.25 E(GNU Bash-3.1-de)
-72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(11)198.45 E
-0 Cg EP
-%%Page: 12 12
+72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(11)199 E 0
+Cg EP
+%%Page: 12 13
%%BeginPageSetup
BP
%%EndPageSetup
(adds the contents of the ne)3.215 F 3.215<778c>-.25 G .715(le to the e)
-3.215 F .715(xisting list.)-.15 F(If)5.716 E F3(HOSTFILE)3.216 E F0
.716(is set, b)2.966 F .716(ut has no v)-.2 F(alue,)-.25 E
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(12)198.45 E 0 Cg EP
-%%Page: 13 13
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(12)199 E 0 Cg EP
+%%Page: 13 14
%%BeginPageSetup
BP
%%EndPageSetup
-.1 F 26.329(administrator who installs)144 708 R F1(bash)28.829 E F0
31.329(.A)C 26.328(common v)-2.501 F 26.328(alue is)-.25 F/F4 10
/Courier@0 SF(/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin)144 720
-Q F0(.)A(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G
-(004 Dec 22)-123.87 E(13)198.45 E 0 Cg EP
-%%Page: 14 14
+Q F0(.)A(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G
+(005 Feb 11)-124.42 E(13)199 E 0 Cg EP
+%%Page: 14 15
%%BeginPageSetup
BP
%%EndPageSetup
.833(job identi\214er \(see)5.833 F F4 .834(JOB CONTR)3.334 F(OL)-.27 E
F0(belo)3.084 E 3.334(w\). If)-.25 F .834(set to an)3.334 F 3.334(yo)
-.15 G .834(ther v)-3.334 F .834(alue, the supplied string)-.25 F
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(14)198.45 E 0 Cg EP
-%%Page: 15 15
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(14)199 E 0 Cg EP
+%%Page: 15 16
%%BeginPageSetup
BP
%%EndPageSetup
.47(ariable and arithmetic e)-3.221 F(xpansion)-.15 E
(and command substitution \(done in a left-to-right f)108 715.2 Q
(ashion\), w)-.1 E(ord splitting, and pathname e)-.1 E(xpansion.)-.15 E
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(15)198.45 E 0 Cg EP
-%%Page: 16 16
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(15)199 E 0 Cg EP
+%%Page: 16 17
%%BeginPageSetup
BP
%%EndPageSetup
(consist of a number without a leading `+' or `\255', `+' is assumed.)
108 712.8 Q(If the login name is in)108 729.6 Q -.25(va)-.4 G
(lid, or the tilde e).25 E(xpansion f)-.15 E(ails, the w)-.1 E
-(ord is unchanged.)-.1 E(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87
-(l2).15 G(004 Dec 22)-123.87 E(16)198.45 E 0 Cg EP
-%%Page: 17 17
+(ord is unchanged.)-.1 E(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42
+(l2).15 G(005 Feb 11)-124.42 E(16)199 E 0 Cg EP
+%%Page: 17 18
%%BeginPageSetup
BP
%%EndPageSetup
(id being confused with the :- e).2 F 3.141(xpansion. Substring)-.15 F
(inde)3.141 E .641(xing is zero-based unless the)-.15 F
(positional parameters are used, in which case the inde)144 712.8 Q
-(xing starts at 1.)-.15 E(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87
-(l2).15 G(004 Dec 22)-123.87 E(17)198.45 E 0 Cg EP
-%%Page: 18 18
+(xing starts at 1.)-.15 E(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42
+(l2).15 G(005 Feb 11)-124.42 E(17)199 E 0 Cg EP
+%%Page: 18 19
%%BeginPageSetup
BP
%%EndPageSetup
(dard output of the command, with an)108 727.2 R 3.268(yt)-.15 G .768
(railing ne)-3.268 F .768(wlines deleted.)-.25 F .768(Embedded ne)5.768
F .768(wlines are not deleted, b)-.25 F(ut)-.2 E(GNU Bash-3.1-de)72 768
-Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(18)198.45 E 0 Cg
-EP
-%%Page: 19 19
+Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(18)199 E 0 Cg EP
+%%Page: 19 20
%%BeginPageSetup
BP
%%EndPageSetup
2.065(is printed and the command is not e)108 727.2 R -.15(xe)-.15 G
4.565(cuted. If).15 F 2.065(the shell option)4.565 F F1(nocaseglob)4.565
E F0 2.066(is enabled, the match is)4.566 F(GNU Bash-3.1-de)72 768 Q
--.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(19)198.45 E 0 Cg EP
-%%Page: 20 20
+-.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(19)199 E 0 Cg EP
+%%Page: 20 21
%%BeginPageSetup
BP
%%EndPageSetup
(Matches one or more occurrences of the gi)180 682.8 Q -.15(ve)-.25 G
2.5(np).15 G(atterns)-2.5 E F1(@\()144 694.8 Q F3(pattern-list).833 E F1
(\)).833 E F0(Matches one of the gi)180 706.8 Q -.15(ve)-.25 G 2.5(np)
-.15 G(atterns)-2.5 E(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2)
-.15 G(004 Dec 22)-123.87 E(20)198.45 E 0 Cg EP
-%%Page: 21 21
+.15 G(atterns)-2.5 E(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2)
+.15 G(005 Feb 11)-124.42 E(20)199 E 0 Cg EP
+%%Page: 21 22
%%BeginPageSetup
BP
%%EndPageSetup
(is not speci\214ed.)2.74 E
(The general format for redirecting input is:)108 696 Q([)144 712.8 Q F2
(n)A F0(])A F1(<)A F2(wor)A(d)-.37 E F0(GNU Bash-3.1-de)72 768 Q -.15
-(ve)-.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(21)198.45 E 0 Cg EP
-%%Page: 22 22
+(ve)-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(21)199 E 0 Cg EP
+%%Page: 22 23
%%BeginPageSetup
BP
%%EndPageSetup
(<<<)144 679.2 Q F2(wor)A(d)-.37 E F0(The)108 696 Q F2(wor)2.5 E(d)-.37
E F0(is e)2.5 E
(xpanded and supplied to the command on its standard input.)-.15 E
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(22)198.45 E 0 Cg EP
-%%Page: 23 23
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(22)199 E 0 Cg EP
+%%Page: 23 24
%%BeginPageSetup
BP
%%EndPageSetup
(another command does not tak)108 727.2 R 3.662(ee)-.1 G -.25(ff)-3.662
G 1.162(ect until the ne).25 F 1.162(xt line of input is read.)-.15 F
1.162(The commands follo)6.162 F 1.162(wing the)-.25 F(GNU Bash-3.1-de)
-72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(23)198.45 E
-0 Cg EP
-%%Page: 24 24
+72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(23)199 E 0
+Cg EP
+%%Page: 24 25
%%BeginPageSetup
BP
%%EndPageSetup
(multiplication, di)10.72 E(vision, remainder)-.25 E F1 2.5<2bad>108
674.4 S F0(addition, subtraction)19.6 E F1(<< >>)108 686.4 Q F0
(left and right bitwise shifts)10.7 E F1(<= >= < >)108 698.4 Q F0
-(comparison)144 710.4 Q(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87
-(l2).15 G(004 Dec 22)-123.87 E(24)198.45 E 0 Cg EP
-%%Page: 25 25
+(comparison)144 710.4 Q(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42
+(l2).15 G(005 Feb 11)-124.42 E(24)199 E 0 Cg EP
+%%Page: 25 26
%%BeginPageSetup
BP
%%EndPageSetup
(ex)2.5 G(ists and its set-user).15 E(-id bit is set.)-.2 E F1<ad77>108
708 Q F2(\214le)2.5 E F0 -.35(Tr)8.36 G(ue if).35 E F2(\214le)2.5 E F0
-.15(ex)2.5 G(ists and is writable.).15 E(GNU Bash-3.1-de)72 768 Q -.15
-(ve)-.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(25)198.45 E 0 Cg EP
-%%Page: 26 26
+(ve)-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(25)199 E 0 Cg EP
+%%Page: 26 27
%%BeginPageSetup
BP
%%EndPageSetup
.149(ut do not af)-.2 F .149(fect the current shell en)-.25 F 2.649
(vironment. A)-.4 F(redirection error causes the command to e)108 729.6
Q(xit with a non-zero status.)-.15 E(GNU Bash-3.1-de)72 768 Q -.15(ve)
--.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(26)198.45 E 0 Cg EP
-%%Page: 27 27
+-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(26)199 E 0 Cg EP
+%%Page: 27 28
%%BeginPageSetup
BP
%%EndPageSetup
-2.927 G(eparate)-2.927 E -.15(exe)108 698.4 S .134(cution en).15 F .134
(vironment that consists of the follo)-.4 F 2.634(wing. Unless)-.25 F
.133(otherwise noted, the v)2.634 F .133(alues are inherited from)-.25 F
-(the shell.)108 710.4 Q(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87
-(l2).15 G(004 Dec 22)-123.87 E(27)198.45 E 0 Cg EP
-%%Page: 28 28
+(the shell.)108 710.4 Q(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42
+(l2).15 G(005 Feb 11)-124.42 E(27)199 E 0 Cg EP
+%%Page: 28 29
%%BeginPageSetup
BP
%%EndPageSetup
(cuted, unless a syntax error occurs, in which case).15 F(it e)108 705.6
Q(xits with a non-zero v)-.15 E 2.5(alue. See)-.25 F(also the)2.5 E F1
(exit)2.5 E F0 -.2(bu)2.5 G(iltin command belo).2 E -.65(w.)-.25 G
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(28)198.45 E 0 Cg EP
-%%Page: 29 29
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(28)199 E 0 Cg EP
+%%Page: 29 30
%%BeginPageSetup
BP
%%EndPageSetup
724.8 R F2(bash)2.88 E F0 .38(reports an error)2.88 F 5.38(.U)-.55 G
(sing)-5.38 E F2(%?ce)2.88 E F0 2.88(,o)C 2.88(nt)-2.88 G .38
(he other hand, refers to an)-2.88 F 2.88(yj)-.15 G(ob)-2.88 E
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(29)198.45 E 0 Cg EP
-%%Page: 30 30
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(29)199 E 0 Cg EP
+%%Page: 30 31
%%BeginPageSetup
BP
%%EndPageSetup
(end a sequence of non-printing characters)29.89 E .119
(The command number and the history number are usually dif)108 720 R .12
(ferent: the history number of a command is its)-.25 F(GNU Bash-3.1-de)
-72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(30)198.45 E
-0 Cg EP
-%%Page: 31 31
+72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(30)199 E 0
+Cg EP
+%%Page: 31 32
%%BeginPageSetup
BP
%%EndPageSetup
E F4(macr)4.042 E(o)-.45 E F0(,)A F4 -.1(ke)4.042 G(yname)-.2 E F0 1.542
(is the name of a k)4.222 F 1.841 -.15(ey s)-.1 H 1.541(pelled out in)
.15 F 2.5(English. F)108 717.6 R(or e)-.15 E(xample:)-.15 E
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(31)198.45 E 0 Cg EP
-%%Page: 32 32
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(31)199 E 0 Cg EP
+%%Page: 32 33
%%BeginPageSetup
BP
%%EndPageSetup
F0 3.44(,r)C .94(eadline uses a visible bell if one is a)-3.44 F -.25
(va)-.2 G 3.44(ilable. If).25 F .94(set to)3.44 F F2(audible)3.44 E F0
(,)A(readline attempts to ring the terminal')144 724.8 Q 2.5(sb)-.55 G
-(ell.)-2.5 E(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G
-(004 Dec 22)-123.87 E(32)198.45 E 0 Cg EP
-%%Page: 33 33
+(ell.)-2.5 E(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G
+(005 Feb 11)-124.42 E(32)199 E 0 Cg EP
+%%Page: 33 34
%%BeginPageSetup
BP
%%EndPageSetup
.15 E F1(mark\255modi\214ed\255lines \(Off\))108 696 Q F0(If set to)144
708 Q F1(On)2.5 E F0 2.5(,h)C(istory lines that ha)-2.5 E .3 -.15(ve b)
-.2 H(een modi\214ed are displayed with a preceding asterisk \().15 E F1
-(*)A F0(\).)A(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G
-(004 Dec 22)-123.87 E(33)198.45 E 0 Cg EP
-%%Page: 34 34
+(*)A F0(\).)A(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G
+(005 Feb 11)-124.42 E(33)199 E 0 Cg EP
+%%Page: 34 35
%%BeginPageSetup
BP
%%EndPageSetup
(ey s)-.1 H .397(equence that quotes the).15 F(current or pre)180 684 Q
(vious w)-.25 E(ord in Bash:)-.1 E F1($if)180 708 Q F0(Bash)2.5 E 2.5
(#Q)180 720 S(uote the current or pre)-2.5 E(vious w)-.25 E(ord)-.1 E
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(34)198.45 E 0 Cg EP
-%%Page: 35 35
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(34)199 E 0 Cg EP
+%%Page: 35 36
%%BeginPageSetup
BP
%%EndPageSetup
(ack to the start of the current or pre).15 F 1.41(vious w)-.25 F 3.91
(ord. W)-.1 F 1.41(ords are composed of alphanumeric)-.8 F
(characters \(letters and digits\).)144 696 Q(GNU Bash-3.1-de)72 768 Q
--.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(35)198.45 E 0 Cg EP
-%%Page: 36 36
+-.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(35)199 E 0 Cg EP
+%%Page: 36 37
%%BeginPageSetup
BP
%%EndPageSetup
(See)5.939 E F2(HIST)3.439 E(OR)-.162 E 3.189(YE)-.315 G(XP)-3.189 E
(ANSION)-.666 E F0(belo)3.189 E 3.439(wf)-.25 G .939(or a descrip-)
-3.439 F(tion of history e)144 724.8 Q(xpansion.)-.15 E(GNU Bash-3.1-de)
-72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(36)198.45 E
-0 Cg EP
-%%Page: 37 37
+72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(36)199 E 0
+Cg EP
+%%Page: 37 38
%%BeginPageSetup
BP
%%EndPageSetup
(mode. In)144 724.8 R -.15(ove)3.968 G 1.468
(rwrite mode, characters bound to).15 F F1(self\255insert)3.969 E F0
1.469(replace the te)3.969 F 1.469(xt at point rather than)-.15 F
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(37)198.45 E 0 Cg EP
-%%Page: 38 38
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(37)199 E 0 Cg EP
+%%Page: 38 39
%%BeginPageSetup
BP
%%EndPageSetup
(cuting this function the \214rst time mak).15 F .378(es the ar)-.1 F
.378(gument count)-.18 F(four)144 681.6 Q 2.5(,as)-.4 G(econd time mak)
-2.5 E(es the ar)-.1 E(gument count sixteen, and so on.)-.18 E F1
-(Completing)87 698.4 Q F0(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87
-(l2).15 G(004 Dec 22)-123.87 E(38)198.45 E 0 Cg EP
-%%Page: 39 39
+(Completing)87 698.4 Q F0(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42
+(l2).15 G(005 Feb 11)-124.42 E(38)199 E 0 Cg EP
+%%Page: 39 40
%%BeginPageSetup
BP
%%EndPageSetup
E(start\255kbd\255macr)108 688.8 Q 2.5(o\()-.18 G(C\255x \()-2.5 E(\))
.833 E F0(Be)144 700.8 Q(gin sa)-.15 E
(ving the characters typed into the current k)-.2 E -.15(ey)-.1 G
-(board macro.).15 E(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2)
-.15 G(004 Dec 22)-123.87 E(39)198.45 E 0 Cg EP
-%%Page: 40 40
+(board macro.).15 E(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2)
+.15 G(005 Feb 11)-124.42 E(39)199 E 0 Cg EP
+%%Page: 40 41
%%BeginPageSetup
BP
%%EndPageSetup
G .872(umeric ar)-3.372 F .872
(gument is supplied, an asterisk is appended before pathname)-.18 F -.15
(ex)144 724.8 S(pansion.).15 E(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G
-123.87(l2).15 G(004 Dec 22)-123.87 E(40)198.45 E 0 Cg EP
-%%Page: 41 41
+124.42(l2).15 G(005 Feb 11)-124.42 E(40)199 E 0 Cg EP
+%%Page: 41 42
%%BeginPageSetup
BP
%%EndPageSetup
(The string is \214rst split using the)5.32 F .412(characters in the)108
472.8 R F3(IFS)2.912 E F0 .412(special v)2.662 F .412
(ariable as delimiters.)-.25 F .412(Shell quoting is honored.)5.412 F
-.413(Each w)5.412 F .413(ord is then e)-.1 F(xpanded)-.15 E 1.64
-(using brace e)108 484.8 R 1.64(xpansion, tilde e)-.15 F 1.64
-(xpansion, parameter and v)-.15 F 1.64(ariable e)-.25 F 1.64
-(xpansion, command substitution, arith-)-.15 F 1.344(metic e)108 496.8 R
-1.344(xpansion, and pathname e)-.15 F 1.344(xpansion, as described abo)
--.15 F 1.644 -.15(ve u)-.15 H(nder).15 E F3(EXP)3.844 E(ANSION)-.666 E
-/F4 9/Times-Roman@0 SF(.)A F0 1.345(The results are split)5.844 F 1.265
-(using the rules described abo)108 508.8 R 1.565 -.15(ve u)-.15 H(nder)
-.15 E F1 -.75(Wo)3.765 G 1.265(rd Splitting).75 F F0 6.265(.T)C 1.265
-(he results of the e)-6.265 F 1.265(xpansion are pre\214x-matched)-.15 F
-(ag)108 520.8 Q(ainst the w)-.05 E
-(ord being completed, and the matching w)-.1 E
+.413(Each w)5.412 F .413(ord is then e)-.1 F(xpanded)-.15 E .092
+(using brace e)108 484.8 R .092(xpansion, tilde e)-.15 F .092
+(xpansion, parameter and v)-.15 F .092(ariable e)-.25 F .091
+(xpansion, command substitution, and arith-)-.15 F 1.396(metic e)108
+496.8 R 1.396(xpansion, as described abo)-.15 F 1.696 -.15(ve u)-.15 H
+(nder).15 E F3(EXP)3.896 E(ANSION)-.666 E/F4 9/Times-Roman@0 SF(.)A F0
+1.396(The results are split using the rules described)5.896 F(abo)108
+508.8 Q .51 -.15(ve u)-.15 H(nder).15 E F1 -.75(Wo)2.71 G .21
+(rd Splitting).75 F F0 5.21(.T)C .209(he results of the e)-5.21 F .209
+(xpansion are pre\214x-matched ag)-.15 F .209(ainst the w)-.05 F .209
+(ord being com-)-.1 F(pleted, and the matching w)108 520.8 Q
(ords become the possible completions.)-.1 E 1.237
(After these matches ha)108 537.6 R 1.537 -.15(ve b)-.2 H 1.237
(een generated, an).15 F 3.737(ys)-.15 G 1.238
.377(After all of the possible completions are generated, an)108 720 R
2.877<798c>-.15 G .377(lter speci\214ed with the)-2.877 F F1<ad58>2.876
E F0 .376(option is applied to the)2.876 F(GNU Bash-3.1-de)72 768 Q -.15
-(ve)-.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(41)198.45 E 0 Cg EP
-%%Page: 42 42
+(ve)-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(41)199 E 0 Cg EP
+%%Page: 42 43
%%BeginPageSetup
BP
%%EndPageSetup
2.014(can be disabled using the)108 720 R F1(+H)4.514 E F0 2.014
(option to the)4.514 F F1(set)4.514 E F0 -.2(bu)4.514 G 2.014
(iltin command \(see).2 F F4 2.013(SHELL B)4.513 F(UIL)-.09 E 2.013
-(TIN COMMANDS)-.828 F F0(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87
-(l2).15 G(004 Dec 22)-123.87 E(42)198.45 E 0 Cg EP
-%%Page: 43 43
+(TIN COMMANDS)-.828 F F0(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42
+(l2).15 G(005 Feb 11)-124.42 E(42)199 E 0 Cg EP
+%%Page: 43 44
%%BeginPageSetup
BP
%%EndPageSetup
F1(n)108.36 691.2 Q F0(The)30.64 E F1(n)2.5 E F0(th w)A(ord.)-.1 E F2(^)
108 703.2 Q F0(The \214rst ar)32.67 E 2.5(gument. That)-.18 F(is, w)2.5
E(ord 1.)-.1 E F2($)108 715.2 Q F0(The last ar)31 E(gument.)-.18 E
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(43)198.45 E 0 Cg EP
-%%Page: 44 44
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(43)199 E 0 Cg EP
+%%Page: 44 45
%%BeginPageSetup
BP
%%EndPageSetup
(alue of the alias is printed.)-.25 F F1(Alias)6.314 E F0 1.314
(returns true unless a)3.814 F F2(name)3.814 E F0 1.314(is gi)3.814 F
-.15(ve)-.25 G 3.814(nf).15 G(or)-3.814 E(GNU Bash-3.1-de)72 768 Q -.15
-(ve)-.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(44)198.45 E 0 Cg EP
-%%Page: 45 45
+(ve)-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(44)199 E 0 Cg EP
+%%Page: 45 46
%%BeginPageSetup
BP
%%EndPageSetup
(de\214nes the search path for the directory containing)144 724.8 R F2
(dir)3.276 E F0 5.776(.A).73 G(lternati)-5.776 E 1.076 -.15(ve d)-.25 H
.776(irectory names in).15 F F4(CDP)3.276 E -.855(AT)-.666 G(H).855 E F0
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(45)198.45 E 0 Cg EP
-%%Page: 46 46
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(45)199 E 0 Cg EP
+%%Page: 46 47
%%BeginPageSetup
BP
%%EndPageSetup
(options\) should be quoted to protect them from e)3.223 F(xpan-)-.15 E
(sion before the)144 715.2 Q F2(complete)2.5 E F0 -.2(bu)2.5 G
(iltin is in).2 E -.2(vo)-.4 G -.1(ke).2 G(d.).1 E(GNU Bash-3.1-de)72
-768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(46)198.45 E 0
-Cg EP
-%%Page: 47 47
+768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(46)199 E 0 Cg
+EP
+%%Page: 47 48
%%BeginPageSetup
BP
%%EndPageSetup
(May also be speci\214ed as)5 E F1<ad75>2.5 E F0(.)A F1 -.1(va)184 708 S
(riable).1 E F0(Names of all shell v)5.1 E 2.5(ariables. May)-.25 F
(also be speci\214ed as)2.5 E F1<ad76>2.5 E F0(.)A(GNU Bash-3.1-de)72
-768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(47)198.45 E 0
-Cg EP
-%%Page: 48 48
+768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(47)199 E 0 Cg
+EP
+%%Page: 48 49
%%BeginPageSetup
BP
%%EndPageSetup
.801(return v)144 727.2 R .801(alue is 0 unless an in)-.25 F -.25(va)-.4
G .8
(lid option is encountered, an attempt is made to de\214ne a function)
-.25 F(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G
-(004 Dec 22)-123.87 E(48)198.45 E 0 Cg EP
-%%Page: 49 49
+.25 F(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G
+(005 Feb 11)-124.42 E(48)199 E 0 Cg EP
+%%Page: 49 50
%%BeginPageSetup
BP
%%EndPageSetup
(ws a disk command which has)-.25 F .834(the same name as a shell b)144
720 R .834(uiltin to be e)-.2 F -.15(xe)-.15 G .834
(cuted without specifying a full pathname, e).15 F -.15(ve)-.25 G 3.333
-(nt).15 G(hough)-3.333 E(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87
-(l2).15 G(004 Dec 22)-123.87 E(49)198.45 E 0 Cg EP
-%%Page: 50 50
+(nt).15 G(hough)-3.333 E(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42
+(l2).15 G(005 Feb 11)-124.42 E(49)199 E 0 Cg EP
+%%Page: 50 51
%%BeginPageSetup
BP
%%EndPageSetup
(ariable is set,)-.25 F F2(vi)5.116 E F0 .95(is used.)5.116 F .951
(When editing is complete, the edited commands are echoed and)5.95 F
-.15(exe)144 708 S(cuted.).15 E(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G
-123.87(l2).15 G(004 Dec 22)-123.87 E(50)198.45 E 0 Cg EP
-%%Page: 51 51
+124.42(l2).15 G(005 Feb 11)-124.42 E(50)199 E 0 Cg EP
+%%Page: 51 52
%%BeginPageSetup
BP
%%EndPageSetup
(If the)144 722.4 R F3<ad74>4.206 E F0 1.706
(option is supplied, the full pathname to which each)4.206 F F1(name)
4.206 E F0 1.707(corresponds is printed.)4.207 F(If)6.707 E
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(51)198.45 E 0 Cg EP
-%%Page: 52 52
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(51)199 E 0 Cg EP
+%%Page: 52 53
%%BeginPageSetup
BP
%%EndPageSetup
<ad78>4.567 E F0 2.067(option is supplied,)4.567 F F2(jobs)4.567 E F0
2.067(replaces an)4.567 F(y)-.15 E F1(jobspec)6.307 E F0 2.067(found in)
4.877 F F1(command)4.767 E F0(or)5.337 E F1(ar)4.897 E(gs)-.37 E F0
-2.066(with the)4.836 F(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87
-(l2).15 G(004 Dec 22)-123.87 E(52)198.45 E 0 Cg EP
-%%Page: 53 53
+2.066(with the)4.836 F(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42
+(l2).15 G(005 Feb 11)-124.42 E(52)199 E 0 Cg EP
+%%Page: 53 54
%%BeginPageSetup
BP
%%EndPageSetup
.15 G 2.533(faz)-2.533 G .033(ero v)-2.533 F .033(alue or null string,)
-.25 F(as appropriate, had been supplied.)144 693.6 Q(The return v)5 E
(alue is zero on success, non-zero on f)-.25 E(ailure.)-.1 E
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(53)198.45 E 0 Cg EP
-%%Page: 54 54
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(53)199 E 0 Cg EP
+%%Page: 54 55
%%BeginPageSetup
BP
%%EndPageSetup
-.18 G .335(upplied, the line r)-2.835 F .336
(ead is assigned to the variable)-.18 F/F6 9/Palatino-Bold@0 SF(REPL)
2.836 E(Y)-.828 E/F7 9/Palatino-Roman@0 SF(.)A F4 .336(The r)4.836 F
-.336(eturn code)-.18 F F0(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87
-(l2).15 G(004 Dec 22)-123.87 E(54)198.45 E 0 Cg EP
-%%Page: 55 55
+.336(eturn code)-.18 F F0(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42
+(l2).15 G(005 Feb 11)-124.42 E(54)199 E 0 Cg EP
+%%Page: 55 56
%%BeginPageSetup
BP
%%EndPageSetup
-.18 E F2<ad6f>144 662.4 Q F3(option\255name)2.5 E F1(The)184 674.4 Q F3
(option\255name)2.5 E F1(can be one of the following:)2.5 E F2
(allexport)184 686.4 Q F1(Same as)224 698.4 Q F2<ad61>2.5 E F1(.)A F0
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(55)198.45 E 0 Cg EP
-%%Page: 56 56
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(55)199 E 0 Cg EP
+%%Page: 56 57
%%BeginPageSetup
BP
%%EndPageSetup
(fective)-.18 E .752(user id is not r)184 726 R 3.252(eset. T)-.18 F
.752(urning this option of)-.9 F 3.252(fc)-.18 G .752(auses the ef)
-3.252 F .753(fective user and gr)-.18 F(oup)-.18 E F0(GNU Bash-3.1-de)
-72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(56)198.45 E
-0 Cg EP
-%%Page: 57 57
+72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(56)199 E 0
+Cg EP
+%%Page: 57 58
%%BeginPageSetup
BP
%%EndPageSetup
(re)180 710.4 S(turn status is zer).18 E 2.5(oi)-.18 G 2.5(fa)-2.5 G(ll)
-2.5 E F3(optnames)2.5 E F1(ar)2.5 E 2.5(ee)-.18 G(nabled; non-zer)-2.5
E 2.5(oo)-.18 G(therwise.)-2.5 E F0(GNU Bash-3.1-de)72 768 Q -.15(ve)
--.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(57)198.45 E 0 Cg EP
-%%Page: 58 58
+-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(57)199 E 0 Cg EP
+%%Page: 58 59
%%BeginPageSetup
BP
%%EndPageSetup
(uoting is performed within)-2.643 F F1(${)2.643 E F3(parameter)A F1(})A
F2(expansions)2.643 E(enclosed in double quotes.)184 704.4 Q
(This option is enabled by default.)5 E F0(GNU Bash-3.1-de)72 768 Q -.15
-(ve)-.25 G 123.87(l2).15 G(004 Dec 22)-123.87 E(58)198.45 E 0 Cg EP
-%%Page: 59 59
+(ve)-.25 G 124.42(l2).15 G(005 Feb 11)-124.42 E(58)199 E 0 Cg EP
+%%Page: 59 60
%%BeginPageSetup
BP
%%EndPageSetup
(ogrammable completion facilities \(see)-.18 F F1 1.199
(Programmable Completion)3.699 F F2(above\) ar)184 708 Q 2.5(ee)-.18 G
2.5(nabled. This)-2.5 F(option is enabled by default.)2.5 E F0
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(59)198.45 E 0 Cg EP
-%%Page: 60 60
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(59)199 E 0 Cg EP
+%%Page: 60 61
%%BeginPageSetup
BP
%%EndPageSetup
.18 F(exactly)180 724.8 Q F1(\))2.925 E F2 2.925(,t)C .426(he r)-2.925 F
.426(esult is the one-ar)-.18 F .426(gument test of the second ar)-.18 F
2.926(gument. Otherwise,)-.18 F F0(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25
-G 123.87(l2).15 G(004 Dec 22)-123.87 E(60)198.45 E 0 Cg EP
-%%Page: 61 61
+G 124.42(l2).15 G(005 Feb 11)-124.42 E(60)199 E 0 Cg EP
+%%Page: 61 62
%%BeginPageSetup
BP
%%EndPageSetup
7.058 E F1 -.18(re)4.558 G 2.058(turns tr).18 F 2.057
(ue if any of the ar)-.08 F 2.057(guments ar)-.18 F 4.557(ef)-.18 G
2.057(ound, false if none ar)-4.557 F(e)-.18 E(found.)144 698.4 Q F0
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(61)198.45 E 0 Cg EP
-%%Page: 62 62
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(61)199 E 0 Cg EP
+%%Page: 62 63
%%BeginPageSetup
BP
%%EndPageSetup
(is not given, all curr)3.595 F 1.014(ently active child pr)-.18 F 1.014
(ocesses ar)-.18 F 3.514(ew)-.18 G 1.014(aited for)-3.514 F 3.514(,a)
-.74 G 1.014(nd the)-3.514 F F0(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G
-123.87(l2).15 G(004 Dec 22)-123.87 E(62)198.45 E 0 Cg EP
-%%Page: 63 63
+124.42(l2).15 G(005 Feb 11)-124.42 E(62)199 E 0 Cg EP
+%%Page: 63 64
%%BeginPageSetup
BP
%%EndPageSetup
ogin shell exits)144 686.4 Q F2(~/.inputr)109.666 698.4 Q(c)-.18 E F1
(Individual)144 710.4 Q F2 -.18(re)2.5 G(adline).18 E F1
(initialization \214le)2.5 E F0(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G
-123.87(l2).15 G(004 Dec 22)-123.87 E(63)198.45 E 0 Cg EP
-%%Page: 64 64
+124.42(l2).15 G(005 Feb 11)-124.42 E(63)199 E 0 Cg EP
+%%Page: 64 65
%%BeginPageSetup
BP
%%EndPageSetup
-.18 F .431(or messages while the con-)-.18 F(str)108 578.4 Q
(uct is being r)-.08 E(ead.)-.18 E
(Array variables may not \(yet\) be exported.)108 595.2 Q F0
-(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 123.87(l2).15 G(004 Dec 22)
--123.87 E(64)198.45 E 0 Cg EP
+(GNU Bash-3.1-de)72 768 Q -.15(ve)-.25 G 124.42(l2).15 G(005 Feb 11)
+-124.42 E(64)199 E 0 Cg EP
%%Trailer
end
%%EOF
<HTML>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<!-- Created on December, 30 2004 by texi2html 1.64 -->
+<!-- Created on February, 14 2005 by texi2html 1.64 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
<H1>Bash Reference Manual</H1></P><P>
This text is a brief description of the features that are present in
-the Bash shell (version 3.1-devel, 30 December 2004)..
+the Bash shell (version 3.1-devel, 11 February 2005)..
</P><P>
-This is Edition 3.1-devel, last updated 30 December 2004,
+This is Edition 3.1-devel, last updated 11 February 2005,
of <CITE>The GNU Bash Reference Manual</CITE>,
for <CODE>Bash</CODE>, Version 3.1-devel.
</P><P>
<DT><CODE>_</CODE>
<DD><A NAME="IDX63"></A>
(An underscore.)
-At shell startup, set to the absolute filename of the shell or shell
-script being executed as passed in the argument list.
+At shell startup, set to the absolute pathname used to invoke the
+shell or shell script being executed as passed in the environment
+or argument list.
Subsequently, expands to the last argument to the previous command,
after expansion.
-Also set to the full pathname of each command executed and placed in
-the environment exported to that command.
+Also set to the full pathname used to invoke each command executed
+and placed in the environment exported to that command.
When checking mail, this parameter holds the name of the mail file.
</DL>
<P>
Shell quoting is honored.
Each word is then expanded using
brace expansion, tilde expansion, parameter and variable expansion,
-command substitution, arithmetic expansion, and pathname expansion,
+command substitution, and arithmetic expansion,
as described above (see section <A HREF="bashref.html#SEC27">3.5 Shell Expansions</A>).
The results are split using the rules described above
(see section <A HREF="bashref.html#SEC34">3.5.7 Word Splitting</A>).
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="bashref.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1>About this document</H1>
-This document was generated by <I>Chet Ramey</I> on <I>December, 30 2004</I>
+This document was generated by <I>Chet Ramey</I> on <I>February, 14 2005</I>
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>
<P></P>
<BR>
<FONT SIZE="-1">
This document was generated
-by <I>Chet Ramey</I> on <I>December, 30 2004</I>
+by <I>Chet Ramey</I> on <I>February, 14 2005</I>
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>
/Users/chet/src/bash/src/doc/bashref.texi.
This text is a brief description of the features that are present in
-the Bash shell (version 3.1-devel, 30 December 2004).
+the Bash shell (version 3.1-devel, 11 February 2005).
- This is Edition 3.1-devel, last updated 30 December 2004, of `The
+ This is Edition 3.1-devel, last updated 11 February 2005, of `The
GNU Bash Reference Manual', for `Bash', Version 3.1-devel.
- Copyright (C) 1988-2004 Free Software Foundation, Inc.
+ Copyright (C) 1988-2005 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
*************
This text is a brief description of the features that are present in
-the Bash shell (version 3.1-devel, 30 December 2004)..
+the Bash shell (version 3.1-devel, 11 February 2005)..
- This is Edition 3.1-devel, last updated 30 December 2004, of `The
+ This is Edition 3.1-devel, last updated 11 February 2005, of `The
GNU Bash Reference Manual', for `Bash', Version 3.1-devel.
Bash contains features that appear in other popular shells, and some
invoke Bash, as given by argument zero.
`_'
- (An underscore.) At shell startup, set to the absolute filename
- of the shell or shell script being executed as passed in the
- argument list. Subsequently, expands to the last argument to the
- previous command, after expansion. Also set to the full pathname
- of each command executed and placed in the environment exported to
- that command. When checking mail, this parameter holds the name
- of the mail file.
+ (An underscore.) At shell startup, set to the absolute pathname
+ used to invoke the shell or shell script being executed as passed
+ in the environment 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 checking
+ mail, this parameter holds the name of the mail file.
\1f
File: bashref.info, Node: Shell Expansions, Next: Redirections, Prev: Shell Parameters, Up: Basic Shell Features
considered. The string is first split using the characters in the `IFS'
special variable as delimiters. Shell quoting is honored. Each word
is then expanded using brace expansion, tilde expansion, parameter and
-variable expansion, command substitution, arithmetic expansion, and
-pathname expansion, as described above (*note Shell Expansions::). The
-results are split using the rules described above (*note Word
-Splitting::). The results of the expansion are prefix-matched against
-the word being completed, and the matching words become the possible
-completions.
+variable expansion, command substitution, and arithmetic expansion, as
+described above (*note Shell Expansions::). The results are split
+using the rules described above (*note Word Splitting::). The results
+of the expansion are prefix-matched against the word being completed,
+and the matching words become the possible completions.
After these matches have been generated, any shell function or
command specified with the `-F' and `-C' options is invoked. When the
Node: Shell Parameters\7f40354
Node: Positional Parameters\7f42684
Node: Special Parameters\7f43584
-Node: Shell Expansions\7f46509
-Node: Brace Expansion\7f48434
-Node: Tilde Expansion\7f50759
-Node: Shell Parameter Expansion\7f53110
-Node: Command Substitution\7f60619
-Node: Arithmetic Expansion\7f61952
-Node: Process Substitution\7f62802
-Node: Word Splitting\7f63852
-Node: Filename Expansion\7f65313
-Node: Pattern Matching\7f67449
-Node: Quote Removal\7f70774
-Node: Redirections\7f71069
-Node: Executing Commands\7f78799
-Node: Simple Command Expansion\7f79474
-Node: Command Search and Execution\7f81404
-Node: Command Execution Environment\7f83410
-Node: Environment\7f86181
-Node: Exit Status\7f87841
-Node: Signals\7f89045
-Node: Shell Scripts\7f91009
-Node: Shell Builtin Commands\7f93527
-Node: Bourne Shell Builtins\7f95106
-Node: Bash Builtins\7f112059
-Node: The Set Builtin\7f140199
-Node: Special Builtins\7f148606
-Node: Shell Variables\7f149583
-Node: Bourne Shell Variables\7f150023
-Node: Bash Variables\7f152004
-Node: Bash Features\7f171711
-Node: Invoking Bash\7f172594
-Node: Bash Startup Files\7f178415
-Node: Interactive Shells\7f183273
-Node: What is an Interactive Shell?\7f183683
-Node: Is this Shell Interactive?\7f184333
-Node: Interactive Shell Behavior\7f185148
-Node: Bash Conditional Expressions\7f188424
-Node: Shell Arithmetic\7f192003
-Node: Aliases\7f194749
-Node: Arrays\7f197317
-Node: The Directory Stack\7f200584
-Node: Directory Stack Builtins\7f201298
-Node: Printing a Prompt\7f204189
-Node: The Restricted Shell\7f206903
-Node: Bash POSIX Mode\7f208735
-Node: Job Control\7f216068
-Node: Job Control Basics\7f216535
-Node: Job Control Builtins\7f220911
-Node: Job Control Variables\7f225263
-Node: Command Line Editing\7f226421
-Node: Introduction and Notation\7f227420
-Node: Readline Interaction\7f229042
-Node: Readline Bare Essentials\7f230233
-Node: Readline Movement Commands\7f232022
-Node: Readline Killing Commands\7f232987
-Node: Readline Arguments\7f234907
-Node: Searching\7f235951
-Node: Readline Init File\7f238137
-Node: Readline Init File Syntax\7f239196
-Node: Conditional Init Constructs\7f251055
-Node: Sample Init File\7f253588
-Node: Bindable Readline Commands\7f256705
-Node: Commands For Moving\7f257912
-Node: Commands For History\7f258773
-Node: Commands For Text\7f261928
-Node: Commands For Killing\7f264601
-Node: Numeric Arguments\7f266743
-Node: Commands For Completion\7f267882
-Node: Keyboard Macros\7f271475
-Node: Miscellaneous Commands\7f272046
-Node: Readline vi Mode\7f277357
-Node: Programmable Completion\7f278271
-Node: Programmable Completion Builtins\7f284083
-Node: Using History Interactively\7f291679
-Node: Bash History Facilities\7f292359
-Node: Bash History Builtins\7f295054
-Node: History Interaction\7f298911
-Node: Event Designators\7f301467
-Node: Word Designators\7f302482
-Node: Modifiers\7f304121
-Node: Installing Bash\7f305527
-Node: Basic Installation\7f306664
-Node: Compilers and Options\7f309356
-Node: Compiling For Multiple Architectures\7f310097
-Node: Installation Names\7f311761
-Node: Specifying the System Type\7f312579
-Node: Sharing Defaults\7f313295
-Node: Operation Controls\7f313968
-Node: Optional Features\7f314926
-Node: Reporting Bugs\7f323735
-Node: Major Differences From The Bourne Shell\7f324929
-Node: Copying This Manual\7f340837
-Node: GNU Free Documentation License\7f341113
-Node: Builtin Index\7f363519
-Node: Reserved Word Index\7f370068
-Node: Variable Index\7f372504
-Node: Function Index\7f383364
-Node: Concept Index\7f390084
+Node: Shell Expansions\7f46548
+Node: Brace Expansion\7f48473
+Node: Tilde Expansion\7f50798
+Node: Shell Parameter Expansion\7f53149
+Node: Command Substitution\7f60658
+Node: Arithmetic Expansion\7f61991
+Node: Process Substitution\7f62841
+Node: Word Splitting\7f63891
+Node: Filename Expansion\7f65352
+Node: Pattern Matching\7f67488
+Node: Quote Removal\7f70813
+Node: Redirections\7f71108
+Node: Executing Commands\7f78838
+Node: Simple Command Expansion\7f79513
+Node: Command Search and Execution\7f81443
+Node: Command Execution Environment\7f83449
+Node: Environment\7f86220
+Node: Exit Status\7f87880
+Node: Signals\7f89084
+Node: Shell Scripts\7f91048
+Node: Shell Builtin Commands\7f93566
+Node: Bourne Shell Builtins\7f95145
+Node: Bash Builtins\7f112098
+Node: The Set Builtin\7f140238
+Node: Special Builtins\7f148645
+Node: Shell Variables\7f149622
+Node: Bourne Shell Variables\7f150062
+Node: Bash Variables\7f152043
+Node: Bash Features\7f171750
+Node: Invoking Bash\7f172633
+Node: Bash Startup Files\7f178454
+Node: Interactive Shells\7f183312
+Node: What is an Interactive Shell?\7f183722
+Node: Is this Shell Interactive?\7f184372
+Node: Interactive Shell Behavior\7f185187
+Node: Bash Conditional Expressions\7f188463
+Node: Shell Arithmetic\7f192042
+Node: Aliases\7f194788
+Node: Arrays\7f197356
+Node: The Directory Stack\7f200623
+Node: Directory Stack Builtins\7f201337
+Node: Printing a Prompt\7f204228
+Node: The Restricted Shell\7f206942
+Node: Bash POSIX Mode\7f208774
+Node: Job Control\7f216107
+Node: Job Control Basics\7f216574
+Node: Job Control Builtins\7f220950
+Node: Job Control Variables\7f225302
+Node: Command Line Editing\7f226460
+Node: Introduction and Notation\7f227459
+Node: Readline Interaction\7f229081
+Node: Readline Bare Essentials\7f230272
+Node: Readline Movement Commands\7f232061
+Node: Readline Killing Commands\7f233026
+Node: Readline Arguments\7f234946
+Node: Searching\7f235990
+Node: Readline Init File\7f238176
+Node: Readline Init File Syntax\7f239235
+Node: Conditional Init Constructs\7f251094
+Node: Sample Init File\7f253627
+Node: Bindable Readline Commands\7f256744
+Node: Commands For Moving\7f257951
+Node: Commands For History\7f258812
+Node: Commands For Text\7f261967
+Node: Commands For Killing\7f264640
+Node: Numeric Arguments\7f266782
+Node: Commands For Completion\7f267921
+Node: Keyboard Macros\7f271514
+Node: Miscellaneous Commands\7f272085
+Node: Readline vi Mode\7f277396
+Node: Programmable Completion\7f278310
+Node: Programmable Completion Builtins\7f284102
+Node: Using History Interactively\7f291698
+Node: Bash History Facilities\7f292378
+Node: Bash History Builtins\7f295073
+Node: History Interaction\7f298930
+Node: Event Designators\7f301486
+Node: Word Designators\7f302501
+Node: Modifiers\7f304140
+Node: Installing Bash\7f305546
+Node: Basic Installation\7f306683
+Node: Compilers and Options\7f309375
+Node: Compiling For Multiple Architectures\7f310116
+Node: Installation Names\7f311780
+Node: Specifying the System Type\7f312598
+Node: Sharing Defaults\7f313314
+Node: Operation Controls\7f313987
+Node: Optional Features\7f314945
+Node: Reporting Bugs\7f323754
+Node: Major Differences From The Bourne Shell\7f324948
+Node: Copying This Manual\7f340856
+Node: GNU Free Documentation License\7f341132
+Node: Builtin Index\7f363538
+Node: Reserved Word Index\7f370087
+Node: Variable Index\7f372523
+Node: Function Index\7f383383
+Node: Concept Index\7f390103
\1f
End Tag Table
-This is TeX, Version 3.14159 (Web2C 7.4.5) (format=tex 2003.12.31) 30 DEC 2004 17:01
+This is TeX, Version 3.14159 (Web2C 7.4.5) (format=tex 2003.12.31) 14 FEB 2005 11:56
**/Users/chet/src/bash/src/doc/bashref.texi
(/Users/chet/src/bash/src/doc/bashref.texi (./texinfo.tex
Loading texinfo [version 2003-02-03.16]: Basics,
[11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25]
[26] [27] [28] [29] [30] [31] Chapter 4 [32] [33] [34] [35] [36] [37] [38]
-Underfull \hbox (badness 5231) in paragraph at lines 3132--3145
+Underfull \hbox (badness 5231) in paragraph at lines 3133--3146
@texttt emacs-meta[]@textrm , @texttt emacs-ctlx[]@textrm , @texttt vi[]@textr
m , @texttt vi-move[]@textrm , @texttt vi-command[]@textrm , and
.etc.
[39] [40] [41] [42] [43]
-Overfull \hbox (43.33536pt too wide) in paragraph at lines 3470--3470
+Overfull \hbox (43.33536pt too wide) in paragraph at lines 3471--3471
[]@texttt read [-ers] [-a @textttsl aname@texttt ] [-d @textttsl de-lim@texttt
] [-n @textttsl nchars@texttt ] [-p @textttsl prompt@texttt ] [-t @textttsl ti
me-
.etc.
[44] [45] [46] [47] [48] [49] [50] [51]
-Underfull \hbox (badness 4036) in paragraph at lines 4082--4089
+Underfull \hbox (badness 4036) in paragraph at lines 4083--4090
@texttt -x[]@textrm Print a trace of sim-ple com-mands, @texttt \@textrm fB-fo
r@texttt \@textrm fP com-mands,
.etc.
[52] [53] Chapter 5 [54] [55] [56] [57] [58] [59] [60] [61] Chapter 6 [62]
-Overfull \hbox (51.96864pt too wide) in paragraph at lines 4801--4801
+Overfull \hbox (51.96864pt too wide) in paragraph at lines 4802--4802
[]@texttt bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@t
exttt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
.etc.
-Overfull \hbox (76.23077pt too wide) in paragraph at lines 4802--4802
+Overfull \hbox (76.23077pt too wide) in paragraph at lines 4803--4803
[]@texttt bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@texttt
] [-O @textttsl shopt_option@texttt ] -c @textttsl string @texttt [@textttsl ar
-
.etc.
-Overfull \hbox (34.72258pt too wide) in paragraph at lines 4803--4803
+Overfull \hbox (34.72258pt too wide) in paragraph at lines 4804--4804
[]@texttt bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@text
tt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
.etc.
[63] [64]
-Underfull \hbox (badness 2245) in paragraph at lines 4977--4979
+Underfull \hbox (badness 2245) in paragraph at lines 4978--4980
[]@textrm When a lo-gin shell ex-its, Bash reads and ex-e-cutes com-mands from
the file
[109]) (/Users/chet/src/bash/src/lib/readline/doc/hsuser.texi Chapter 9
[110] [111] [112] [113] [114]) Chapter 10 [115] [116] [117] [118] [119]
-Underfull \hbox (badness 2772) in paragraph at lines 6675--6679
+Underfull \hbox (badness 2772) in paragraph at lines 6676--6680
[]@textrm Enable sup-port for large files (@texttt http://www.sas.com/standard
s/large_
19 hyphenation exceptions out of 1000
15i,8n,11p,269b,465s stack positions out of 1500i,500n,5000p,200000b,5000s
-Output written on bashref.dvi (156 pages, 585544 bytes).
+Output written on bashref.dvi (156 pages, 585568 bytes).
%DVIPSWebPage: (www.radicaleye.com)
%DVIPSCommandLine: dvips -D 600 -t letter -o bashref.ps bashref.dvi
%DVIPSParameters: dpi=600, compressed
-%DVIPSSource: TeX output 2004.12.30:1701
+%DVIPSSource: TeX output 2005.02.14:1156
%%BeginProcSet: texc.pro
%!
/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
TeXDict begin 1 0 bop 150 1318 a Fu(Bash)64 b(Reference)j(Man)-5
b(ual)p 150 1385 3600 34 v 2361 1481 a Ft(Reference)31
b(Do)s(cumen)m(tation)i(for)d(Bash)1963 1589 y(Edition)h(3.1-dev)m(el,)
-i(for)d Fs(Bash)f Ft(V)-8 b(ersion)31 b(3.1-dev)m(el.)3145
-1697 y(Decem)m(b)s(er)g(2004)150 4935 y Fr(Chet)45 b(Ramey)-11
-b(,)46 b(Case)g(W)-11 b(estern)46 b(Reserv)l(e)g(Univ)l(ersit)l(y)150
-5068 y(Brian)f(F)-11 b(o)l(x,)45 b(F)-11 b(ree)45 b(Soft)l(w)l(are)h(F)
--11 b(oundation)p 150 5141 3600 17 v eop end
+i(for)d Fs(Bash)f Ft(V)-8 b(ersion)31 b(3.1-dev)m(el.)3180
+1697 y(F)-8 b(ebruary)30 b(2005)150 4935 y Fr(Chet)45
+b(Ramey)-11 b(,)46 b(Case)g(W)-11 b(estern)46 b(Reserv)l(e)g(Univ)l
+(ersit)l(y)150 5068 y(Brian)f(F)-11 b(o)l(x,)45 b(F)-11
+b(ree)45 b(Soft)l(w)l(are)h(F)-11 b(oundation)p 150 5141
+3600 17 v eop end
%%Page: 2 2
TeXDict begin 2 1 bop 150 2889 a Ft(This)35 b(text)h(is)g(a)g(brief)f
(description)h(of)f(the)h(features)g(that)g(are)g(presen)m(t)g(in)f
-(the)h(Bash)f(shell)h(\(v)m(ersion)150 2999 y(3.1-dev)m(el,)d(30)e
-(Decem)m(b)s(er)g(2004\).)150 3133 y(This)39 b(is)g(Edition)h(3.1-dev)m
-(el,)45 b(last)40 b(up)s(dated)f(30)h(Decem)m(b)s(er)g(2004,)k(of)c
-Fq(The)f(GNU)h(Bash)g(Reference)150 3243 y(Man)m(ual)p
-Ft(,)32 b(for)e Fs(Bash)p Ft(,)f(V)-8 b(ersion)31 b(3.1-dev)m(el.)150
-3377 y(Cop)m(yrigh)m(t)602 3374 y(c)577 3377 y Fp(\015)f
-Ft(1988-2004)k(F)-8 b(ree)32 b(Soft)m(w)m(are)f(F)-8
-b(oundation,)32 b(Inc.)150 3512 y(P)m(ermission)g(is)h(gran)m(ted)g(to)
-f(mak)m(e)i(and)d(distribute)h(v)m(erbatim)h(copies)g(of)f(this)g(man)m
-(ual)h(pro)m(vided)f(the)150 3621 y(cop)m(yrigh)m(t)g(notice)f(and)f
-(this)g(p)s(ermission)g(notice)h(are)g(preserv)m(ed)f(on)h(all)g
-(copies.)390 3756 y(P)m(ermission)k(is)h(gran)m(ted)f(to)h(cop)m(y)-8
-b(,)38 b(distribute)d(and/or)g(mo)s(dify)f(this)h(do)s(cumen)m(t)g
-(under)390 3866 y(the)j(terms)g(of)g(the)g(GNU)h(F)-8
-b(ree)39 b(Do)s(cumen)m(tation)h(License,)g(V)-8 b(ersion)39
-b(1.1)g(or)f(an)m(y)g(later)390 3975 y(v)m(ersion)28
+(the)h(Bash)f(shell)h(\(v)m(ersion)150 2999 y(3.1-dev)m(el,)d(11)e(F)-8
+b(ebruary)30 b(2005\).)150 3133 y(This)41 b(is)i(Edition)f(3.1-dev)m
+(el,)48 b(last)43 b(up)s(dated)e(11)i(F)-8 b(ebruary)42
+b(2005,)47 b(of)42 b Fq(The)g(GNU)h(Bash)f(Reference)150
+3243 y(Man)m(ual)p Ft(,)32 b(for)e Fs(Bash)p Ft(,)f(V)-8
+b(ersion)31 b(3.1-dev)m(el.)150 3377 y(Cop)m(yrigh)m(t)602
+3374 y(c)577 3377 y Fp(\015)f Ft(1988-2005)k(F)-8 b(ree)32
+b(Soft)m(w)m(are)f(F)-8 b(oundation,)32 b(Inc.)150 3512
+y(P)m(ermission)g(is)h(gran)m(ted)g(to)f(mak)m(e)i(and)d(distribute)h
+(v)m(erbatim)h(copies)g(of)f(this)g(man)m(ual)h(pro)m(vided)f(the)150
+3621 y(cop)m(yrigh)m(t)g(notice)f(and)f(this)g(p)s(ermission)g(notice)h
+(are)g(preserv)m(ed)f(on)h(all)g(copies.)390 3756 y(P)m(ermission)k(is)
+h(gran)m(ted)f(to)h(cop)m(y)-8 b(,)38 b(distribute)d(and/or)g(mo)s
+(dify)f(this)h(do)s(cumen)m(t)g(under)390 3866 y(the)j(terms)g(of)g
+(the)g(GNU)h(F)-8 b(ree)39 b(Do)s(cumen)m(tation)h(License,)g(V)-8
+b(ersion)39 b(1.1)g(or)f(an)m(y)g(later)390 3975 y(v)m(ersion)28
b(published)d(b)m(y)j(the)f(F)-8 b(ree)29 b(Soft)m(w)m(are)f(F)-8
b(oundation;)30 b(with)d(no)g(In)m(v)-5 b(arian)m(t)28
b(Sections,)390 4085 y(with)i(the)h(F)-8 b(ron)m(t-Co)m(v)m(er)33
f(executed,)i(if)f(one)g(is)f(presen)m(t.)42 b(Otherwise,)31
b(it)g(is)f(set)630 3613 y(to)h(the)g(\014lename)f(used)g(to)h(in)m(v)m
(ok)m(e)h(Bash,)f(as)g(giv)m(en)g(b)m(y)f(argumen)m(t)h(zero.)150
-3773 y Fs(_)432 b Ft(\(An)34 b(underscore.\))50 b(A)m(t)34
-b(shell)g(startup,)h(set)f(to)g(the)g(absolute)g(\014lename)g(of)g(the)
-g(shell)g(or)630 3882 y(shell)j(script)h(b)s(eing)e(executed)i(as)g
-(passed)f(in)g(the)g(argumen)m(t)h(list.)62 b(Subsequen)m(tly)-8
-b(,)38 b(ex-)630 3992 y(pands)e(to)i(the)g(last)g(argumen)m(t)g(to)h
-(the)e(previous)g(command,)i(after)f(expansion.)62 b(Also)630
-4102 y(set)30 b(to)f(the)h(full)e(pathname)h(of)h(eac)m(h)g(command)f
-(executed)h(and)e(placed)i(in)e(the)i(en)m(viron-)630
-4211 y(men)m(t)37 b(exp)s(orted)f(to)h(that)h(command.)58
-b(When)37 b(c)m(hec)m(king)h(mail,)h(this)d(parameter)h(holds)630
-4321 y(the)31 b(name)f(of)h(the)f(mail)h(\014le.)150
-4580 y Fr(3.5)68 b(Shell)45 b(Expansions)275 4825 y Ft(Expansion)29
-b(is)h(p)s(erformed)e(on)i(the)g(command)g(line)g(after)h(it)f(has)g(b)
-s(een)f(split)h(in)m(to)h Fs(token)p Ft(s.)39 b(There)150
-4935 y(are)31 b(sev)m(en)g(kinds)e(of)i(expansion)f(p)s(erformed:)225
-5070 y Fp(\017)60 b Ft(brace)31 b(expansion)225 5205
-y Fp(\017)60 b Ft(tilde)31 b(expansion)225 5340 y Fp(\017)60
-b Ft(parameter)31 b(and)f(v)-5 b(ariable)31 b(expansion)p
-eop end
+3773 y Fs(_)432 b Ft(\(An)27 b(underscore.\))39 b(A)m(t)29
+b(shell)e(startup,)h(set)f(to)h(the)g(absolute)g(pathname)f(used)f(to)i
+(in)m(v)m(ok)m(e)630 3882 y(the)22 b(shell)g(or)g(shell)g(script)f(b)s
+(eing)h(executed)h(as)f(passed)f(in)g(the)h(en)m(vironmen)m(t)h(or)e
+(argumen)m(t)630 3992 y(list.)72 b(Subsequen)m(tly)-8
+b(,)43 b(expands)c(to)j(the)e(last)i(argumen)m(t)f(to)g(the)g(previous)
+f(command,)630 4102 y(after)35 b(expansion.)54 b(Also)36
+b(set)f(to)h(the)f(full)f(pathname)h(used)f(to)h(in)m(v)m(ok)m(e)i(eac)
+m(h)f(command)630 4211 y(executed)42 b(and)e(placed)i(in)e(the)h(en)m
+(vironmen)m(t)h(exp)s(orted)f(to)g(that)h(command.)72
+b(When)630 4321 y(c)m(hec)m(king)32 b(mail,)f(this)g(parameter)g(holds)
+e(the)i(name)f(of)h(the)g(mail)g(\014le.)150 4580 y Fr(3.5)68
+b(Shell)45 b(Expansions)275 4825 y Ft(Expansion)29 b(is)h(p)s(erformed)
+e(on)i(the)g(command)g(line)g(after)h(it)f(has)g(b)s(een)f(split)h(in)m
+(to)h Fs(token)p Ft(s.)39 b(There)150 4935 y(are)31 b(sev)m(en)g(kinds)
+e(of)i(expansion)f(p)s(erformed:)225 5070 y Fp(\017)60
+b Ft(brace)31 b(expansion)225 5205 y Fp(\017)60 b Ft(tilde)31
+b(expansion)225 5340 y Fp(\017)60 b Ft(parameter)31 b(and)f(v)-5
+b(ariable)31 b(expansion)p eop end
%%Page: 17 23
TeXDict begin 17 22 bop 150 -116 a Ft(Chapter)30 b(3:)41
b(Basic)32 b(Shell)e(F)-8 b(eatures)2246 b(17)225 299
b(The)33 b(string)150 1340 y(is)g(\014rst)e(split)i(using)f(the)h(c)m
(haracters)h(in)e(the)h Fs(IFS)e Ft(sp)s(ecial)j(v)-5
b(ariable)33 b(as)g(delimiters.)48 b(Shell)32 b(quoting)h(is)150
-1450 y(honored.)k(Eac)m(h)21 b(w)m(ord)g(is)g(then)f(expanded)g(using)h
-(brace)g(expansion,)i(tilde)e(expansion,)i(parameter)f(and)150
-1559 y(v)-5 b(ariable)26 b(expansion,)g(command)f(substitution,)h
-(arithmetic)g(expansion,)g(and)f(pathname)g(expansion,)150
-1669 y(as)j(describ)s(ed)e(ab)s(o)m(v)m(e)j(\(see)f(Section)h(3.5)f
-([Shell)g(Expansions],)f(page)i(16\).)41 b(The)27 b(results)g(are)h
-(split)f(using)150 1778 y(the)33 b(rules)g(describ)s(ed)e(ab)s(o)m(v)m
-(e)j(\(see)g(Section)g(3.5.7)h([W)-8 b(ord)33 b(Splitting],)i(page)e
-(22\).)50 b(The)32 b(results)h(of)g(the)150 1888 y(expansion)h(are)h
-(pre\014x-matc)m(hed)f(against)i(the)e(w)m(ord)g(b)s(eing)g(completed,)
-j(and)d(the)g(matc)m(hing)h(w)m(ords)150 1998 y(b)s(ecome)c(the)f(p)s
-(ossible)g(completions.)275 2134 y(After)f(these)g(matc)m(hes)i(ha)m(v)
-m(e)f(b)s(een)f(generated,)h(an)m(y)g(shell)f(function)g(or)g(command)g
-(sp)s(eci\014ed)f(with)150 2244 y(the)i(`)p Fs(-F)p Ft(')g(and)f(`)p
-Fs(-C)p Ft(')h(options)g(is)g(in)m(v)m(ok)m(ed.)41 b(When)30
-b(the)g(command)g(or)f(function)h(is)g(in)m(v)m(ok)m(ed,)h(the)f
-Fs(COMP_)150 2354 y(LINE)21 b Ft(and)h Fs(COMP_POINT)d
+1450 y(honored.)56 b(Eac)m(h)37 b(w)m(ord)e(is)h(then)f(expanded)g
+(using)h(brace)g(expansion,)h(tilde)f(expansion,)h(parameter)150
+1559 y(and)44 b(v)-5 b(ariable)46 b(expansion,)j(command)44
+b(substitution,)49 b(and)44 b(arithmetic)i(expansion,)j(as)c(describ)s
+(ed)150 1669 y(ab)s(o)m(v)m(e)38 b(\(see)f(Section)h(3.5)g([Shell)e
+(Expansions],)i(page)f(16\).)61 b(The)36 b(results)h(are)g(split)f
+(using)h(the)f(rules)150 1778 y(describ)s(ed)29 b(ab)s(o)m(v)m(e)i
+(\(see)f(Section)h(3.5.7)h([W)-8 b(ord)30 b(Splitting],)h(page)f(22\).)
+42 b(The)30 b(results)f(of)h(the)g(expansion)150 1888
+y(are)f(pre\014x-matc)m(hed)h(against)g(the)f(w)m(ord)g(b)s(eing)f
+(completed,)j(and)d(the)i(matc)m(hing)g(w)m(ords)e(b)s(ecome)i(the)150
+1998 y(p)s(ossible)g(completions.)275 2134 y(After)f(these)g(matc)m
+(hes)i(ha)m(v)m(e)f(b)s(een)f(generated,)h(an)m(y)g(shell)f(function)g
+(or)g(command)g(sp)s(eci\014ed)f(with)150 2244 y(the)i(`)p
+Fs(-F)p Ft(')g(and)f(`)p Fs(-C)p Ft(')h(options)g(is)g(in)m(v)m(ok)m
+(ed.)41 b(When)30 b(the)g(command)g(or)f(function)h(is)g(in)m(v)m(ok)m
+(ed,)h(the)f Fs(COMP_)150 2354 y(LINE)21 b Ft(and)h Fs(COMP_POINT)d
Ft(v)-5 b(ariables)23 b(are)g(assigned)g(v)-5 b(alues)22
b(as)h(describ)s(ed)e(ab)s(o)m(v)m(e)j(\(see)f(Section)g(5.2)h([Bash)
150 2463 y(V)-8 b(ariables],)33 b(page)f(55\).)44 b(If)30
@code{case} will selectively execute the @var{command-list} corresponding to
the first @var{pattern} that matches @var{word}.
+If the shell option @code{nocasematch}
+(see the description of @code{shopt} in @ref{Bash Builtins})
+is enabled, the match is performed without regard to the case
+of alphabetic characters.
The @samp{|} is used to separate multiple patterns, and the @samp{)}
operator terminates a pattern list.
A list of patterns and an associated command-list is known
When the @samp{==} and @samp{!=} operators are used, the string to the
right of the operator is considered a pattern and matched according
to the rules described below in @ref{Pattern Matching}.
+If the shell option @code{nocasematch}
+(see the description of @code{shopt} in @ref{Bash Builtins})
+is enabled, the match is performed without regard to the case
+of alphabetic characters.
The return value is 0 if the string matches or does not match
the pattern, respectively, and 1 otherwise.
Any part of the pattern may be quoted to force it to be matched as a
the pattern, and 1 otherwise.
If the regular expression is syntactically incorrect, the conditional
expression's return value is 2.
-If the shell option @code{nocaseglob}
+If the shell option @code{nocasematch}
(see the description of @code{shopt} in @ref{Bash Builtins})
is enabled, the match is performed without regard to the case
of alphabetic characters.
shell is executing in a subroutine (a shell function or a shell script
executed by the @code{.} or @code{source} builtins), a call to
@code{return} is simulated.
+
+@item
+@code{BASH_ARGC} and @code{BASH_ARGV} are updated as described in their
+descriptions (@pxref{Bash Variables}).
+
+@item
+Function tracing is enabled: command substitution, shell functions, and
+subshells invoked with @code{( @var{command} )} inherit the
+@code{DEBUG} and @code{RETURN} traps.
+
+@item
+Error tracing is enabled: command substitution, shell functions, and
+subshells invoked with @code{( @var{command} )} inherit the
+@code{ERROR} trap.
@end enumerate
@item extglob
If set, Bash matches filenames in a case-insensitive fashion when
performing filename expansion.
+@item nocasematch
+If set, Bash matches patterns in a case-insensitive fashion when
+performing matching while executing @code{case} or @code{[[}
+conditional commands.
+
@item nullglob
If set, Bash allows filename patterns which match no
files to expand to a null string, rather than themselves.
with @code{.} or @code{source}) is at the top of the stack. When a
subroutine is executed, the number of parameters passed is pushed onto
@code{BASH_ARGC}.
+The shell sets @code{BASH_ARGC} only when in extended debugging mode
+(see @ref{Bash Builtins}
+for a description of the @code{extdebug} option to the @code{shopt}
+builtin).
@item BASH_ARGV
An array variable containing all of the parameters in the current bash
is at the top of the stack; the first parameter of the initial call is
at the bottom. When a subroutine is executed, the parameters supplied
are pushed onto @code{BASH_ARGV}.
+The shell sets @code{BASH_ARGV} only when in extended debugging mode
+(see @ref{Bash Builtins}
+for a description of the @code{extdebug} option to the @code{shopt}
+builtin).
@item BASH_COMMAND
The command currently being executed or about to be executed, unless the
does not refer to an existing directory, @code{cd} will fail instead of
falling back to @var{physical} mode.
+@item
+When the @code{pwd} builtin is supplied the @opt{-P} option, it resets
+@code{$PWD} to a pathname containing no symlinks.
+
@item
When listing the history, the @code{fc} builtin does not include an
indication of whether or not a history entry has been modified.
of @cite{The GNU Bash Reference Manual},
for @code{Bash}, Version @value{VERSION}.
-Copyright @copyright{} 1988-2003 Free Software Foundation, Inc.
+Copyright @copyright{} 1988-2005 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
for the @sc{gnu} operating system.
The name is an acronym for the @samp{Bourne-Again SHell},
a pun on Stephen Bourne, the author of the direct ancestor of
-the current Unix shell @code{/bin/sh},
+the current Unix shell @code{sh},
which appeared in the Seventh Edition Bell Labs Research version
of Unix.
Like other @sc{gnu} software, Bash is quite portable. It currently runs
on nearly every version of Unix and a few other operating systems @minus{}
independently-supported ports exist for @sc{ms-dos}, @sc{os/2},
-Windows @sc{95/98}, and Windows @sc{nt}.
+and Windows platforms.
@node What is a shell?
@section What is a shell?
At its base, a shell is simply a macro processor that executes
-commands. A Unix shell is both a command interpreter, which
-provides the user interface to the rich set of @sc{gnu} utilities,
-and a programming language, allowing these utilitites to be
-combined. Files containing commands can be created, and become
+commands. The term macro processor means functionality where text
+and symbols are expanded to create larger expressions.
+
+A Unix shell is both a command interpreter and a programming
+language. As a command interpreter, the shell provides the user
+interface to the rich set of @sc{gnu} utilities. The programming
+language features allow these utilitites to be combined.
+Files containing commands can be created, and become
commands themselves. These new commands have the same status as
system commands in directories such as @file{/bin}, allowing users
-or groups to establish custom environments.
+or groups to establish custom environments to automate their common
+tasks.
+
+Shells may be used interactively or non-interactively. In
+interactive mode, they accept input typed from the keyboard.
+When executing non-interactively, shells execute commands read
+from a file.
A shell allows execution of @sc{gnu} commands, both synchronously and
asynchronously.
fine-grained control of the input and output of those commands.
Moreover, the shell allows control over the contents of commands'
environments.
-Shells may be used interactively or non-interactively: they accept
-input typed from the keyboard or from a file.
Shells also provide a small set of built-in
commands (@dfn{builtins}) implementing functionality impossible
Shells offer features geared specifically for
interactive use rather than to augment the programming language.
These interactive features include job control, command line
-editing, history and aliases. Each of these features is
+editing, command history and aliases. Each of these features is
described in this manual.
@node Definitions
The Bourne shell is
the traditional Unix shell originally written by Stephen Bourne.
All of the Bourne shell builtin commands are available in Bash,
-and the rules for evaluation and quoting are taken from the @sc{posix}
-1003.2 specification for the `standard' Unix shell.
+The rules for evaluation and quoting are taken from the @sc{posix}
+specification for the `standard' Unix shell.
This chapter briefly summarizes the shell's `building blocks':
commands, control structures, shell functions, shell @i{parameters},
Each of the shell metacharacters (@pxref{Definitions})
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, the
+When the command history expansion facilities are being used
+(@pxref{History Interaction}), the
@var{history expansion} character, usually @samp{!}, must be quoted
to prevent history expansion. @xref{Bash History Facilities}, for
more details concerning history expansion.
Enclosing characters in double quotes (@samp{"}) preserves the literal value
of all characters within the quotes, with the exception of
-@samp{$}, @samp{`}, and @samp{\}.
+@samp{$}, @samp{`}, @samp{\},
+and, when history expansion is enabled, @samp{!}.
The characters @samp{$} and @samp{`}
retain their special meaning within double quotes (@pxref{Shell Expansions}).
The backslash retains its special meaning only when followed by one of
special meaning are left unmodified.
A double quote may be quoted within double quotes by preceding it with
a backslash.
-When command history is being used, the double quote may not be used to
-quote the history expansion character.
+If enabled, history expansion will be performed unless an @samp{!}
+appearing in double quotes is escaped using a backslash.
+The backslash preceding the @samp{!} is not removed.
The special parameters @samp{*} and @samp{@@} have special meaning
when in double quotes (@pxref{Shell Parameter Expansion}).
* Pipelines:: Connecting the input and output of several
commands.
* Lists:: How to execute commands sequentially.
-* Looping Constructs:: Shell commands for iterative action.
-* Conditional Constructs:: Shell commands for conditional execution.
-* Command Grouping:: Ways to group commands.
+* Compound Commands:: Shell commands for control flow.
@end menu
@node Simple Commands
Each command in a pipeline is executed in its own subshell
(@pxref{Command Execution Environment}). The exit
status of a pipeline is the exit status of the last command in the
-pipeline. If the reserved word @samp{!} precedes the pipeline, the
-exit status is the logical negation of the exit status of the last command.
+pipeline, unless the @code{pipefail} option is enabled
+(@pxref{The Set Builtin}).
+If @code{pipefail} 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 successfully.
+If the reserved word @samp{!} precedes the pipeline, the
+exit status 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.
@node Lists
@subsection Lists of Commands
@sc{and} and @sc{or} lists is the exit status of the last command
executed in the list.
+@node Compound Commands
+@subsection Compound Commands
+@cindex commands, compound
+
+@menu
+* Looping Constructs:: Shell commands for iterative action.
+* Conditional Constructs:: Shell commands for conditional execution.
+* Command Grouping:: Ways to group commands.
+@end menu
+
+Compound commands are the shell programming constructs.
+Each construct begins with a reserved word or control operator and is
+terminated by a corresponding reserved word or operator.
+Any redirections (@pxref{Redirections}) associated with a compound command
+apply to all commands within that compound command unless explicitly overridden.
+
+Bash provides looping constructs, conditional commands, and mechanisms
+to group commands and execute them as a unit.
+
@node Looping Constructs
-@subsection Looping Constructs
+@subsubsection Looping Constructs
@cindex commands, looping
Bash supports the following looping constructs.
may be used to control loop execution.
@node Conditional Constructs
-@subsection Conditional Constructs
+@subsubsection Conditional Constructs
@cindex commands, conditional
@table @code
Any part of the pattern may be quoted to force it to be matched as a
string.
+An additional binary operator, @samp{=~}, is available, with the same
+precedence as @samp{==} and @samp{!=}.
+When it is used, the string to the right of the operator is considered
+an extended regular expression and matched accordingly (as in @i{regex}3)).
+The return value is 0 if the string matches
+the pattern, and 1 otherwise.
+If the regular expression is syntactically incorrect, the conditional
+expression's return value is 2.
+If the shell option @code{nocaseglob}
+(see the description of @code{shopt} in @ref{Bash Builtins})
+is enabled, the match is performed without regard to the case
+of alphabetic characters.
+Substrings matched by parenthesized subexpressions within the regular
+expression are saved in the array variable @code{BASH_REMATCH}.
+The element of @code{BASH_REMATCH} with index 0 is the portion of the string
+matching the entire regular expression.
+The element of @code{BASH_REMATCH} with index @var{n} is the portion of the
+string matching the @var{n}th parenthesized subexpression.
+
Expressions may be combined using the following operators, listed
in decreasing order of precedence:
@end table
@node Command Grouping
-@subsection Grouping Commands
+@subsubsection Grouping Commands
@cindex commands, grouping
Bash provides two ways to group a list of commands to be executed
@end example
Placing a list of commands between parentheses causes a subshell
-to be created, and each of the commands in @var{list} to be executed
-in that subshell. Since the @var{list} is executed in a subshell,
-variable assignments do not remain in effect after the subshell completes.
+environment to be created (@pxref{Command Execution Environment}), and each
+of the commands in @var{list} to be executed in that subshell. Since the
+@var{list} is executed in a subshell, variable assignments do not remain in
+effect after the subshell completes.
@item @{@}
@rwindex @{
Functions are declared using this syntax:
@rwindex function
@example
-[ @code{function} ] @var{name} () @{ @var{command-list}; @}
+[ @code{function} ] @var{name} () @var{compound-command} [ @var{redirections} ]
@end example
This defines a shell function named @var{name}. The reserved
word @code{function} is optional.
If the @code{function} reserved
word is supplied, the parentheses are optional.
-The @var{body} of the function is the @var{command-list} between @{ and @}.
-This list is executed whenever @var{name} is specified as the
-name of a command. The exit status of a function is
-the exit status of the last command executed in the body.
-
-Note that for historical reasons, the curly braces that surround
-the body of the function must be separated from the body by
+The @var{body} of the function is the compound command
+@var{compound-command} (@pxref{Compound Commands}).
+That command is usually a @var{list} enclosed between @{ and @}, but
+may be any compound command listed above.
+@var{compound-command} is executed whenever @var{name} is specified as the
+name of a command.
+Any redirections (@pxref{Redirections}) associated with the shell function
+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 the body.
+
+Note that for historical reasons, in the most common usage the curly braces
+that surround the body of the function must be separated from the body by
@code{blank}s or newlines.
This is because the braces are reserved words and are only recognized
as such when they are separated by whitespace.
-Also, the @var{command-list} must be terminated by a semicolon,
+Also, when using the braces, the @var{list} must be terminated by a semicolon,
a @samp{&}, or a newline.
When a function is executed, the arguments to the
during its execution (@pxref{Positional Parameters}).
The special parameter @samp{#} that expands to the number of
positional parameters is updated to reflect the change.
-Positional parameter @code{0} is unchanged.
+Special parameter @code{0} is unchanged.
The first element of the @env{FUNCNAME} variable is set to the
name of the function while the function is executing.
All other aspects of the shell execution
environment are identical between a function and its caller
-with the exception that the @env{DEBUG} trap
-below) is not inherited unless the function has been given the
+with the exception that the @env{DEBUG} and @env{RETURN} traps
+are not inherited unless the function has been given the
@code{trace} attribute using the @code{declare} builtin or
the @code{-o functrace} option has been enabled with
the @code{set} builtin,
-(in which case all functions inherit the @code{DEBUG} trap).
+(in which case all functions inherit the @env{DEBUG} and @env{RETURN} traps).
@xref{Bourne Shell Builtins}, for the description of the
@code{trap} builtin.
of @code{"$@@"} as explained below.
Filename expansion is not performed.
Assignment statements may also appear as arguments to the
+@code{alias},
@code{declare}, @code{typeset}, @code{export}, @code{readonly},
and @code{local} builtin commands.
+In the context where an assignment statement is assigning a value
+to a shell variable or array index (@pxref{Arrays}), the @samp{+=}
+operator can be used to
+append to or add to the variable's previous value.
+When @samp{+=} is applied to a variable for which the integer attribute
+has been set, @var{value} is evaluated as an arithmetic expression and
+added to the variable's current value, which is also evaluated.
+When @samp{+=} is applied to an array variable using compound assignment
+(@pxref{Arrays}), the
+variable's value is not unset (as it is when using @samp{=}), and new
+values are appended to the array beginning at one greater than the array's
+maximum index.
+When applied to a string-valued variable, @var{value} is expanded and
+appended to the variable's value.
+
@node Positional Parameters
@subsection Positional Parameters
@cindex parameters, positional
expansion occurs within double quotes, each parameter expands to a
separate word. That is, @code{"$@@"} is equivalent to
@code{"$1" "$2" @dots{}}.
+If the double-quoted expansion occurs within a word, the expansion of
+the first parameter is joined with the beginning 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, @code{"$@@"} and
@code{$@@}
expand to nothing (i.e., they are removed).
@item _
(An underscore.)
-At shell startup, set to the absolute filename of the shell or shell
-script being executed as passed in the argument list.
+At shell startup, set to the absolute pathname used to invoke the
+shell or shell script being executed as passed in the environment
+or argument list.
Subsequently, expands to the last argument to the previous command,
after expansion.
-Also set to the full pathname of each command executed and placed in
-the environment exported to that command.
+Also set to the full pathname used to invoke each command executed
+and placed in the environment exported to that command.
When checking mail, this parameter holds the name of the mail file.
@end vtable
left unchanged.
Each variable assignment is checked for unquoted tilde-prefixes immediately
-following a @samp{:} or @samp{=}.
+following a @samp{:} or the first @samp{=}.
In these cases, tilde expansion is also performed.
Consequently, one may use file names with tildes in assignments to
@env{PATH}, @env{MAILPATH}, and @env{CDPATH},
If @var{parameter}
is unset or null, the expansion of @var{word}
is assigned to @var{parameter}.
-The value of @var{parameter}
-is then substituted. Positional parameters and special parameters may
-not be assigned to in this way.
+The value of @var{parameter} is then substituted.
+Positional parameters and special parameters may not be assigned to
+in this way.
@item $@{@var{parameter}:?@var{word}@}
If @var{parameter}
If @var{parameter} is an array name indexed by @samp{@@} or @samp{*},
the result is the @var{length}
members of the array beginning with @code{$@{@var{parameter}[@var{offset}]@}}.
+A negative @var{offset} is taken relative to one greater than the maximum
+index of the specified array.
+Note that a negative offset must be separated from the colon by at least
+one space to avoid being confused with the @samp{:-} expansion.
Substring indexing is zero-based unless the positional parameters
are used, in which case the indexing starts at 1.
unchanged.
If the @code{nullglob} option is set, and no matches are found, the word
is removed.
+If the @code{failglob} shell option is set, and no matches are found,
+an error message is printed and the command is not executed.
If the shell option @code{nocaseglob} is enabled, the match is performed
without regard to the case of alphabetic characters.
See the description of @code{shopt} in @ref{Bash Builtins},
for a description of the @code{nocaseglob}, @code{nullglob},
-and @code{dotglob} options.
+@code{failglob}, and @code{dotglob} options.
The @env{GLOBIGNORE}
shell variable may be used to restrict the set of filenames matching a
Matches one or more occurrences of the given patterns.
@item @@(@var{pattern-list})
-Matches exactly one of the given patterns.
+Matches one of the given patterns.
@item !(@var{pattern-list})
Matches anything except one of the given patterns.
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
+internally.
+
@subsection Redirecting Input
Redirection of input causes the file whose name results from
the expansion of @var{word}
A command invoked in this separate environment cannot affect the
shell's execution environment.
-Command substitution and asynchronous commands are invoked in a
+Command substitution, commands grouped with parentheses,
+and asynchronous commands are invoked in a
subshell environment that is a duplicate of the shell environment,
except that traps caught by the shell are reset to the values
that the shell inherited from its parent at invocation. Builtin
If job control is in effect (@pxref{Job Control}), Bash
ignores @code{SIGTTIN}, @code{SIGTTOU}, and @code{SIGTSTP}.
-Commands started by Bash have signal handlers set to the
+Non-builtin commands started by Bash have signal handlers set to the
values inherited by the shell from its parent.
When job control is not in effect, asynchronous commands
-ignore @code{SIGINT} and @code{SIGQUIT} as well.
+ignore @code{SIGINT} and @code{SIGQUIT} in addition to these inherited
+handlers.
Commands run as a result of
command substitution ignore the keyboard-generated job control signals
@code{SIGTTIN}, @code{SIGTTOU}, and @code{SIGTSTP}.
(@pxref{Bash Builtins}), Bash sends a @code{SIGHUP} to all jobs when
an interactive login shell exits.
-When Bash receives a signal for which a trap has been set while waiting
-for a command to complete, the trap will not be executed until the
-command completes.
+If Bash is waiting for a command to complete and receives a signal
+for which a trap has been set, the trap will not be executed until
+the command completes.
When Bash is waiting for an asynchronous
command via the @code{wait} builtin, the reception of a signal for
which a trap has been set will cause the @code{wait} builtin to return
Many of the builtins have been extended by @sc{posix} or Bash.
+Unless otherwise noted, each builtin command documented as accepting
+options preceded by @samp{-} accepts @samp{--}
+to signify the end of the options.
+
@node Bourne Shell Builtins
@section Bourne Shell Builtins
@example
cd [-L|-P] [@var{directory}]
@end example
-Change the current working directory to @var{directory}. If @var{directory}
-is not given, the value of the @env{HOME} shell variable is used. If the
-shell variable @env{CDPATH} exists, it is used as a search path. If
-@var{directory} begins with a slash, @env{CDPATH} is not used.
-The @option{-P} option means
-to not follow symbolic links; symbolic links are followed by default
-or with the @option{-L} option.
+Change the current working directory to @var{directory}.
+If @var{directory} is not given, the value of the @env{HOME} shell
+variable is used.
+If the shell variable @env{CDPATH} exists, it is used as a search path.
+If @var{directory} begins with a slash, @env{CDPATH} is not used.
+
+The @option{-P} option means to not follow symbolic links; symbolic
+links are followed by default or with the @option{-L} option.
If @var{directory} is @samp{-}, it is equivalent to @env{$OLDPWD}.
+
+If a non-empty directory name from @env{CDPATH} is used, or if
+@samp{-} 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 status is zero if the directory is successfully changed,
non-zero otherwise.
trap [-lp] [@var{arg}] [@var{sigspec} @dots{}]
@end example
The commands in @var{arg} are to be read and executed when the
-shell receives signal @var{sigspec}. If @var{arg} is absent or
-equal to @samp{-}, all specified signals are reset to the values
-they had when the shell was started.
+shell receives signal @var{sigspec}. If @var{arg} is absent (and
+there is a single @var{sigspec}) or
+equal to @samp{-}, each specified signal's disposition is reset
+to the value it had when the shell was started.
If @var{arg} is the null string, then the signal specified by
each @var{sigspec} is ignored by the shell and commands it invokes.
If @var{arg} is not present and @option{-p} has been supplied,
shell input.
The @option{-l} option causes the shell to print a list of signal names
and their corresponding numbers.
-
-Each @var{sigspec} is either a signal name such as @code{SIGINT} (with
-or without the @code{SIG} prefix) or a signal number.
+Each @var{sigspec} is either a signal name or a signal number.
+Signal names are case insensitive and the @code{SIG} prefix is optional.
If a @var{sigspec}
is @code{0} or @code{EXIT}, @var{arg} is executed when the shell exits.
If a @var{sigspec} is @code{DEBUG}, the command @var{arg} is executed
@code{shopt} builtin (@pxref{Bash Builtins}) for details of its
effect on the @code{DEBUG} trap.
If a @var{sigspec} is @code{ERR}, the command @var{arg}
-is executed whenever a simple command has a non-zero exit status.
+is executed whenever a simple command has a non-zero exit status,
+subject to the following conditions.
The @code{ERR} trap is not executed if the failed command is part of the
command list immediately following an @code{until} or @code{while} keyword,
part of the test in an @code{if} statement,
part of a @code{&&} or @code{||} list, or if the command's return
status is being inverted using @code{!}.
+These are the same conditions obeyed by the @code{errexit} option.
If a @var{sigspec} is @code{RETURN}, the command @var{arg} is executed
each time a shell function or a script executed with the @code{.} or
@code{source} builtins finishes executing.
caller [@var{expr}]
@end example
Returns the context of any active subroutine call (a shell function or
-a script executed with the @code{.} or @code{source} builtins.
+a script executed with the @code{.} or @code{source} builtins).
Without @var{expr}, @code{caller} displays the line number and source
filename of the current subroutine call.
@item -t
Give each @var{name} the @code{trace} attribute.
-Traced functions inherit the @code{DEBUG} trap from the calling shell.
+Traced functions inherit the @code{DEBUG} and @code{RETURN} traps from
+the calling shell.
The trace attribute has no special meaning for variables.
@item -x
@var{argument}.
In addition to the standard @code{printf(1)} formats, @samp{%b} causes
@code{printf} to expand backslash escape sequences in the corresponding
-@var{argument}, and @samp{%q} causes @code{printf} to output the
+@var{argument},
+(except that @samp{\c} terminates output, backslashes in
+@samp{\'}, @samp{\"}, and @samp{\?} are not removed, and octal escapes
+beginning with @samp{\0} may contain up to four digits),
+and @samp{%q} causes @code{printf} to output the
corresponding @var{argument} in a format that can be reused as shell input.
The @var{format} is reused as necessary to consume all of the @var{arguments}.
shell is executing in a subroutine (a shell function or a shell script
executed by the @code{.} or @code{source} builtins), a call to
@code{return} is simulated.
+
+@item
+@code{BASH_ARGC} and @code{BASH_ARGV} are updated as described in their
+descriptions (@pxref{Bash Variables}).
+
+@item
+Function tracing is enabled: command substitution, shell functions, and
+subshells invoked with @code{( @var{command} )} inherit the
+@code{DEBUG} and @code{RETURN} traps.
+
+@item
+Error tracing is enabled: command substitution, shell functions, and
+subshells invoked with @code{( @var{command} )} inherit the
+@code{ERROR} trap.
@end enumerate
@item extglob
performed within @code{$@{@var{parameter}@}} expansions
enclosed in double quotes. This option is enabled by default.
+@item failglob
+If set, patterns which fail to match filenames during pathname expansion
+result in an expansion error.
+
+@item force_fignore
+If set, the suffixes specified by the @env{FIGNORE} shell variable
+cause words to be ignored when performing word completion even if
+the ignored words are the only possible completions.
+@xref{Bash Variables}, for a description of @env{FIGNORE}.
+This option is enabled by default.
+
+@item gnu_errfmt
+If set, shell error messages are written in the standard @sc{gnu} error
+message format.
+
@item histappend
If set, the history list is appended to the file named by the value
of the @env{HISTFILE}
This option is enabled by default.
@item promptvars
-If set, prompt strings undergo variable and parameter expansion after
-being expanded (@pxref{Printing a Prompt}).
+If set, prompt strings undergo
+parameter expansion, command substitution, arithmetic
+expansion, and quote removal after being expanded
+as described below (@pxref{Printing a Prompt}).
This option is enabled by default.
@item restricted_shell
If no options or arguments are supplied, @code{set} displays the names
and values of all shell variables and functions, sorted according to the
-current locale, in a format that may be reused as input.
+current locale, in a format that may be reused as input
+for setting or resetting the currently-set variables.
+Read-only variables cannot be reset.
+In @sc{posix} mode, only shell variables are listed.
When options are supplied, they set or unset shell attributes.
Options, if specified, have the following meanings:
@item physical
Same as @code{-P}.
+@item pipefail
+If set, the return value of a pipeline is the value of the last
+(rightmost) command to exit with a non-zero status, or zero if all
+commands in the pipeline exit successfully.
+This option is disabled by default.
+
@item posix
Change the behavior of Bash where the default operation differs
from the @sc{posix} 1003.2 standard to match the standard
@end example
@item -T
-If set, any trap on @code{DEBUG} is inherited by shell functions, command
-substitutions, and commands executed in a subshell environment.
-The @code{DEBUG} trap is normally not inherited in such cases.
+If set, any trap on @code{DEBUG} and @code{RETURN} are inherited by
+shell functions, command substitutions, and commands executed
+in a subshell environment.
+The @code{DEBUG} and @code{RETURN} traps are normally not inherited
+in such cases.
@item --
If no arguments follow this option, then the positional parameters are
with @code{.} or @code{source}) is at the top of the stack. When a
subroutine is executed, the number of parameters passed is pushed onto
@code{BASH_ARGC}.
+The shell sets @code{BASH_ARGC} only when in extended debugging mode
+(see @ref{Bash Builtins}
+for a description of the @code{extdebug} option to the @code{shopt}
+builtin).
@item BASH_ARGV
An array variable containing all of the parameters in the current bash
is at the top of the stack; the first parameter of the initial call is
at the bottom. When a subroutine is executed, the parameters supplied
are pushed onto @code{BASH_ARGV}.
+The shell sets @code{BASH_ARGV} only when in extended debugging mode
+(see @ref{Bash Builtins}
+for a description of the @code{extdebug} option to the @code{shopt}
+builtin).
@item BASH_COMMAND
The command currently being executed or about to be executed, unless the
An array variable whose members are the line numbers in source files
corresponding to each member of @var{FUNCNAME}.
@code{$@{BASH_LINENO[$i]@}} is the line number in the source file where
-@code{$@{FUNCNAME[$i + 1]@}} was called.
-The corresponding source file name is @code{$@{BASH_SOURCE[$i + 1]@}}.
+@code{$@{FUNCNAME[$i]@}} was called.
+The corresponding source file name is @code{$@{BASH_SOURCE[$i]@}}.
Use @code{LINENO} to obtain the current line number.
+@item BASH_REMATCH
+An array variable whose members are assigned by the @samp{=~} binary
+operator to the @code{[[} conditional command
+(@pxref{Conditional Constructs}).
+The element with index 0 is the portion of the string
+matching the entire regular expression.
+The element with index @var{n} is the portion of the
+string matching the @var{n}th parenthesized subexpression.
+This variable is read-only.
+
@item BASH_SOURCE
An array variable whose members are the source filenames corresponding
to the elements in the @code{FUNCNAME} array variable.
The maximum number of commands to remember on the history list.
The default value is 500.
+@item HISTTIMEFORMAT
+If this variable is set and not null, its value is used as a format string
+for @var{strftime} to print the time stamp associated with each history
+entry displayed by the @code{history} builtin.
+If this variable is set, time stamps are written to the history file so
+they may be preserved across shell sessions.
+
@item HOSTFILE
Contains the name of a file in the same format as @file{/etc/hosts} that
should be read when the shell needs to complete a hostname.
becomes the value assigned plus the number of seconds
since the assignment.
+@item SHELL
+The full pathname to the shell is kept in this environment variable.
+If it is not set when the shell starts,
+Bash assigns to it the full pathname of the current user's login shell.
+
@item SHELLOPTS
A colon-separated list of enabled shell options. Each word in
the list is a valid argument for the @option{-o} option to the
@item --dump-po-strings
A list of all double-quoted strings preceded by @samp{$}
-is printed on the standard ouput
+is printed on the standard output
in the @sc{gnu} @code{gettext} PO (portable object) file format.
Equivalent to @option{-D} except for the output format.
@item -D
A list of all double-quoted strings preceded by @samp{$}
-is printed on the standard ouput.
+is printed on the standard output.
These are the strings that
are subject to language translation when the current locale
is not @code{C} or @code{POSIX} (@pxref{Locale Translation}).
An interactive shell
is one started without non-option arguments, unless @option{-s} is
specified, without specifiying the @option{-c} option, and
-whose input and output are both
+whose input and error output are both
connected to terminals (as determined by @code{isatty(3)}),
or one started with the @option{-i} option.
@file{/dev/stdin}, @file{/dev/stdout}, or @file{/dev/stderr}, file
descriptor 0, 1, or 2, respectively, is checked.
+Unless otherwise specified, primaries that operate on files follow symbolic
+links and operate on the target of the link, rather than the link itself.
+
@table @code
@item -a @var{file}
True if @var{file} exists.
The digits greater than 9 are represented by the lowercase letters,
the uppercase letters, @samp{@@}, and @samp{_}, in that order.
If @var{base} is less than or equal to 36, lowercase and uppercase
-letters may be used interchangably to represent numbers between 10
+letters may be used interchangeably to represent numbers between 10
and 35.
Operators are evaluated in order of precedence. Sub-expressions in
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 alias name and the replacement text may contain any valid
-shell input, including shell metacharacters, with the exception
-that the alias name may not contain @samp{=}.
+The characters @samp{/}, @samp{$}, @samp{`}, @samp{=} and any of the
+shell metacharacters 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
-@code{ls} to @code{"ls -F"},
+is not expanded a second time.
+This means that one may alias @code{ls} to @code{"ls -F"},
for instance, and Bash does not try to recursively expand the
replacement text. If the last character of the alias value is a
space or tab character, then the next command word following the
conflicts with the shell's filename expansion operators. If the
@var{subscript} is @samp{@@} or @samp{*}, the word expands to all members
of the array @var{name}. These subscripts differ only when the word
-appears within double quotes. If the word is double-quoted,
+appears within double quotes.
+If the word is double-quoted,
@code{$@{name[*]@}} expands to a single word with
the value of each array member separated by the first character of the
@env{IFS} variable, and @code{$@{name[@@]@}} expands each element of
@var{name} to a separate word. When there are no array members,
-@code{$@{name[@@]@}} expands to nothing. This is analogous to the
+@code{$@{name[@@]@}} expands to nothing.
+If the double-quoted expansion occurs within a word, the expansion of
+the first parameter is joined with the beginning part of the original
+word, and the expansion of the last parameter is joined with the last
+part of the original word.
+This is analogous to the
expansion of the special parameters @samp{@@} and @samp{*}.
@code{$@{#name[}@var{subscript}@code{]@}} expands to the length of
@code{$@{name[}@var{subscript}@code{]@}}.
@item \V
The release of Bash, version + patchlevel (e.g., 2.00.0)
@item \w
-The current working directory.
+The current working directory, with @env{$HOME} abbreviated with a tilde.
@item \W
-The basename of @env{$PWD}.
+The basename of @env{$PWD}, with @env{$HOME} abbreviated with a tilde.
@item \!
The history number of this command.
@item \#
and parameter expansion is performed on the values of @env{PS1} and
@env{PS2} regardless of the setting of the @code{promptvars} option.
-@item
-Interactive comments are enabled by default. (Bash has them on by
-default anyway.)
-
@item
The @sc{posix} 1003.2 startup files are executed (@env{$ENV}) rather than
the normal Bash files.
@item
The output of @samp{kill -l} prints all the signal names on a single line,
-separated by spaces.
+separated by spaces, without the @samp{SIG} prefix.
+
+@item
+The @code{kill} builtin does not accept signal names with a @samp{SIG}
+prefix.
@item
Non-interactive shells exit if @var{filename} in @code{.} @var{filename}
The @code{trap} builtin displays signal names without the leading
@code{SIG}.
+@item
+The @code{trap} builtin doesn't check the first argument for a possible
+signal specification and revert the signal handling to the original
+disposition if it is, unless that argument consists solely of digits and
+is a valid signal number. If users want to reset the handler for a given
+signal to the original disposition, they should use @samp{-} as the
+first argument.
+
@item
The @code{.} and @code{source} builtins do not search the current directory
for the filename argument if it is not found by searching @env{PATH}.
@item
Alias expansion is always enabled, even in non-interactive shells.
+@item
+When the @code{alias} builtin displays alias definitions, it does not
+display them with a leading @samp{alias } unless the @option{-p} option
+is supplied.
+
@item
When the @code{set} builtin is invoked without options, it does not display
shell function names and definitions.
constructed from @code{$PWD} and the directory name supplied as an argument
does not refer to an existing directory, @code{cd} will fail instead of
falling back to @var{physical} mode.
+
+@item
+When the @code{pwd} builtin is supplied the @opt{-P} option, it resets
+@code{$PWD} to a pathname containing no symlinks.
+
+@item
+When listing the history, the @code{fc} builtin does not include an
+indication of whether or not a history entry has been modified.
+
+@item
+The default editor used by @code{fc} is @code{ed}.
+
+@item
+The @code{type} and @code{command} builtins will not report a non-executable
+file as having been found, though the shell will attempt to execute such a
+file if it is the only so-named file found in @code{$PATH}.
+
+@item
+When the @code{xpg_echo} option is enabled, Bash does not attempt to interpret
+any arguments to @code{echo} as options. Each argument is displayed, after
+escape characters are converted.
+
@end enumerate
There is other @sc{posix} 1003.2 behavior that Bash does not implement.
character @samp{%} introduces a job name.
Job number @code{n} may be referred to as @samp{%n}.
-The symbols @samp{%%} and
-@samp{%+} refer to the shell's notion of the current job, which
-is the last job stopped while it was in the foreground or started
-in the background. The
-previous job may be referenced using @samp{%-}. In output
+The symbols @samp{%%} and @samp{%+} refer to the shell's notion of the
+current job, which is the last job stopped while it was in the foreground
+or started in the background.
+A single @samp{%} (with no accompanying job specification) also refers
+to the current job.
+The previous job may be referenced using @samp{%-}. In output
pertaining to jobs (e.g., the output of the @code{jobs} command),
the current job is always flagged with a @samp{+}, and the
previous job with a @samp{-}.
Any trap on @code{SIGCHLD} is executed for each child process
that exits.
-If an attempt to exit Bash is while jobs are stopped, the
+If an attempt to exit Bash is made while jobs are stopped, the
shell prints a message warning that there are stopped jobs.
The @code{jobs} command may then be used to inspect their status.
If a second attempt to exit is made without an intervening command,
@item bg
@btindex bg
@example
-bg [@var{jobspec}]
+bg [@var{jobspec} @dots{}]
@end example
-Resume the suspended job @var{jobspec} in the background, as if it
+Resume each suspended job @var{jobspec} in the background, as if it
had been started with @samp{&}.
If @var{jobspec} is not supplied, the current job is used.
The return status is zero unless it is run when job control is not
-enabled, or, when run with job control enabled, if @var{jobspec} was
-not found or @var{jobspec} specifies a job that was started without
-job control.
+enabled, or, when run with job control enabled, if the last
+@var{jobspec} was not found or the last @var{jobspec} specifies a job
+that was started without job control.
@item fg
@btindex fg
@end example
Send a signal specified by @var{sigspec} or @var{signum} to the process
named by job specification @var{jobspec} or process @sc{id} @var{pid}.
-@var{sigspec} is either a signal name such as @code{SIGINT} (with or without
-the @code{SIG} prefix) or a signal number; @var{signum} is a signal number.
+@var{sigspec} is either a case-insensitive signal name such as
+@code{SIGINT} (with or without the @code{SIG} prefix)
+or a signal number; @var{signum} is a signal number.
If @var{sigspec} and @var{signum} are not present, @code{SIGTERM} is used.
The @option{-l} option lists the signal names.
If any arguments are supplied when @option{-l} is given, the names of the
@item wait
@btindex wait
@example
-wait [@var{jobspec} or @var{pid}]
+wait [@var{jobspec} or @var{pid} ...]
@end example
-Wait until the child process specified by process @sc{id} @var{pid} or job
-specification @var{jobspec} exits and return the exit status of the last
-command waited for.
+Wait until the child process specified by each process @sc{id} @var{pid}
+or job specification @var{jobspec} exits and return the exit status of the
+last command waited for.
If a job spec is given, all processes in the job are waited for.
If no arguments are given, all currently active child processes are
waited for, and the return status is zero.
@sc{gnu} operating systems, nearly every version of Unix, and several
non-Unix systems such as BeOS and Interix.
Other independent ports exist for
-@sc{ms-dos}, @sc{os/2}, Windows @sc{95/98}, and Windows @sc{nt}.
+@sc{ms-dos}, @sc{os/2}, and Windows platforms.
@menu
* Basic Installation:: Installation instructions.
@item --with-installed-readline[=@var{PREFIX}]
Define this to make Bash link with a locally-installed version of Readline
rather than the version in @file{lib/readline}. This works only with
-Readline 4.3 and later versions. If @var{PREFIX} is @code{yes} or not
+Readline 5.0 and later versions. If @var{PREFIX} is @code{yes} or not
supplied, @code{configure} uses the values of the make variables
@code{includedir} and @code{libdir}, which are subdirectories of @code{prefix}
by default, to find the installed version of Readline if it is not in
This allows pipelines as well as shell builtins and functions to be timed.
@item --enable-cond-command
-Include support for the @code{[[} conditional command
+Include support for the @code{[[} conditional command.
+(@pxref{Conditional Constructs}).
+
+@item --enable-cond-regexp
+Include support for matching POSIX regular expressions using the
+@samp{=~} binary operator in the @code{[[} conditional command.
(@pxref{Conditional Constructs}).
+@item --enable-debugger
+Include support for the bash debugger (distributed separately).
+
@item --enable-directory-stack
Include support for a @code{csh}-like directory stack and the
@code{pushd}, @code{popd}, and @code{dirs} builtins
This enables process substitution (@pxref{Process Substitution}) if
the operating system provides the necessary support.
+@item --enable-progcomp
+Enable the programmable completion facilities
+(@pxref{Programmable Completion}).
+If Readline is not enabled, this option has no effect.
+
@item --enable-prompt-string-decoding
Turn on the interpretation of a number of backslash-escaped characters
in the @env{$PS1}, @env{$PS2}, @env{$PS3}, and @env{$PS4} prompt
strings. See @ref{Printing a Prompt}, for a complete list of prompt
string escape sequences.
-@item --enable-progcomp
-Enable the programmable completion facilities
-(@pxref{Programmable Completion}).
-If Readline is not enabled, this option has no effect.
-
@item --enable-readline
Include support for command-line editing and history with the Bash
version of the Readline library (@pxref{Command Line Editing}).
Include the @code{select} builtin, which allows the generation of simple
menus (@pxref{Conditional Constructs}).
+@item --enable-separate-helpfiles
+Use external files for the documentation displayed by the @code{help} builtin
+instead of storing the text internally.
+
+@item --enable-single-help-strings
+Store the text displayed by the @code{help} builtin as a single string for
+each help topic. This aids in translating the text to different languages.
+You may need to disable this if your compiler cannot handle very long string
+literals.
+
@item --enable-usg-echo-default
A synonym for @code{--enable-xpg-echo-default}.
without requiring the @option{-e} option.
This sets the default value of the @code{xpg_echo} shell option to @code{on},
which makes the Bash @code{echo} behave more like the version specified in
-the Single Unix Specification, version 2.
+the Single Unix Specification, version 3.
@xref{Bash Builtins}, for a description of the escape sequences that
@code{echo} recognizes.
@item
Bash has command history (@pxref{Bash History Facilities}) and the
@code{history} and @code{fc} builtins to manipulate it.
+The Bash history list maintains timestamp information and uses the
+value of the @code{HISTTIMEFORMAT} variable to display it.
@item
Bash implements @code{csh}-like history expansion
Bash has much more optional behavior controllable with the @code{set}
builtin (@pxref{The Set Builtin}).
+@item
+The @samp{-x} (@code{xtrace}) option displays commands other than
+simple commands when performing an execution trace
+(@pxref{The Set Builtin}).
+
@item
The @code{test} builtin (@pxref{Bourne Shell Builtins})
is slightly different, as it implements the @sc{posix} algorithm,
which specifies the behavior based on the number of arguments.
+@item
+Bash includes the @code{caller} builtin, which displays the context of
+any active subroutine call (a shell function or a script executed with
+the @code{.} or @code{source} builtins). This supports the bash
+debugger.
+
@item
The @code{trap} builtin (@pxref{Bourne Shell Builtins}) allows a
@code{DEBUG} pseudo-signal specification, similar to @code{EXIT}.
Commands specified with an @code{RETURN} trap are executed before
execution resumes after a shell function or a shell script executed with
@code{.} or @code{source} returns.
-The @code{RETURN} trap is not inherited by shell functions.
+The @code{RETURN} trap is not inherited by shell functions unless the
+function has been given the @code{trace} attribute or the
+@code{functrace} option has been enabled using the @code{shopt} builtin.
@item
The Bash @code{type} builtin is more extensive and gives more information
@code{case} will selectively execute the @var{command-list} corresponding to
the first @var{pattern} that matches @var{word}.
+If the shell option @code{nocasematch}
+(see the description of @code{shopt} in @ref{Bash Builtins})
+is enabled, the match is performed without regard to the case
+of alphabetic characters.
The @samp{|} is used to separate multiple patterns, and the @samp{)}
operator terminates a pattern list.
A list of patterns and an associated command-list is known
When the @samp{==} and @samp{!=} operators are used, the string to the
right of the operator is considered a pattern and matched according
to the rules described below in @ref{Pattern Matching}.
+If the shell option @code{nocasematch}
+(see the description of @code{shopt} in @ref{Bash Builtins})
+is enabled, the match is performed without regard to the case
+of alphabetic characters.
The return value is 0 if the string matches or does not match
the pattern, respectively, and 1 otherwise.
Any part of the pattern may be quoted to force it to be matched as a
the pattern, and 1 otherwise.
If the regular expression is syntactically incorrect, the conditional
expression's return value is 2.
-If the shell option @code{nocaseglob}
+If the shell option @code{nocasematch}
(see the description of @code{shopt} in @ref{Bash Builtins})
is enabled, the match is performed without regard to the case
of alphabetic characters.
@item _
(An underscore.)
-At shell startup, set to the absolute file name used to invoke the
+At shell startup, set to the absolute pathname used to invoke the
shell or shell script being executed as passed in the environment
or argument list.
Subsequently, expands to the last argument to the previous command,
shell is executing in a subroutine (a shell function or a shell script
executed by the @code{.} or @code{source} builtins), a call to
@code{return} is simulated.
+
+@item
+@code{BASH_ARGC} and @code{BASH_ARGV} are updated as described in their
+descriptions (@pxref{Bash Variables}).
+
+@item
+Function tracing is enabled: command substitution, shell functions, and
+subshells invoked with @code{( @var{command} )} inherit the
+@code{DEBUG} and @code{RETURN} traps.
+
+@item
+Error tracing is enabled: command substitution, shell functions, and
+subshells invoked with @code{( @var{command} )} inherit the
+@code{ERROR} trap.
@end enumerate
@item extglob
with @code{.} or @code{source}) is at the top of the stack. When a
subroutine is executed, the number of parameters passed is pushed onto
@code{BASH_ARGC}.
+The shell sets @code{BASH_ARGC} only when in extended debugging mode
+(see @ref{Bash Builtins}
+for a description of the @code{extdebug} option to the @code{shopt}
+builtin).
@item BASH_ARGV
An array variable containing all of the parameters in the current bash
is at the top of the stack; the first parameter of the initial call is
at the bottom. When a subroutine is executed, the parameters supplied
are pushed onto @code{BASH_ARGV}.
+The shell sets @code{BASH_ARGV} only when in extended debugging mode
+(see @ref{Bash Builtins}
+for a description of the @code{extdebug} option to the @code{shopt}
+builtin).
@item BASH_COMMAND
The command currently being executed or about to be executed, unless the
does not refer to an existing directory, @code{cd} will fail instead of
falling back to @var{physical} mode.
+@item
+When the @code{pwd} builtin is supplied the @opt{-P} option, it resets
+@code{$PWD} to a pathname containing no symlinks.
+
@item
When listing the history, the @code{fc} builtin does not include an
indication of whether or not a history entry has been modified.
%!PS-Adobe-3.0
%%Creator: groff version 1.18.1
-%%CreationDate: Thu Dec 30 17:01:22 2004
+%%CreationDate: Mon Feb 14 11:56:35 2005
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
From: chet@po.cwru.edu (Chet Ramey)
To: bug-bash@gnu.org
-Subject: BASH Frequently-Asked Questions (FAQ version 3.29)
+Subject: BASH Frequently-Asked Questions (FAQ version 3.30)
Reply-To: chet@po.cwru.edu
Newsgroups: comp.unix.shell,comp.unix.questions
Distribution: world
From: chet@po.cwru.edu (Chet Ramey)
-Subject: BASH Frequently-Asked Questions (FAQ version 3.29)
+Subject: BASH Frequently-Asked Questions (FAQ version 3.30)
Organization: Case Western Reserve University
Summary: A's to Q's about BASH, the Bourne-Again SHell
Reply-To: chet@po.cwru.edu
Newsgroups: comp.unix.shell,comp.unix.questions,comp.answers,news.answers
From: chet@po.cwru.edu (Chet Ramey)
-Subject: [gnu.bash.bug] BASH Frequently-Asked Questions (FAQ version 3.29)
+Subject: [gnu.bash.bug] BASH Frequently-Asked Questions (FAQ version 3.30)
Organization: Case Western Reserve University
Summary: A's to Q's about BASH, the Bourne-Again SHell
Reply-To: chet@po.cwru.edu
From: chet@po.cwru.edu (Chet Ramey)
To: bug-bash@gnu.org
-Subject: BASH Frequently-Asked Questions (FAQ version 3.29)
+Subject: BASH Frequently-Asked Questions (FAQ version 3.30)
Reply-To: chet@po.cwru.edu
Archive-name: unix-faq/shell/bash
Posting-Frequency: monthly
Submitted-By: chet@po.cwru.edu (Chet Ramey)
-Last-Modified: Mon Sep 13 09:03:53 EDT 2004
-FAQ-Version: 3.29
+Last-Modified: Mon Feb 14 11:57:02 EST 2005
+FAQ-Version: 3.30
Bash-Version: 3.0
URL: ftp://ftp.cwru.edu/pub/bash/FAQ
Maintainer: chet@po.cwru.edu (Chet Ramey)
-This is the Bash FAQ, version 3.29, for Bash version 3.0.
+This is the Bash FAQ, version 3.30, for Bash version 3.0.
This document contains a set of frequently-asked questions concerning
Bash, the GNU Bourne-Again Shell. Bash is a freely-available command
ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-3.0.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-doc-3.0.tar.gz
+Any patches for the current version are available with the URL:
+
+ftp://ftp.cwru.edu/pub/bash/bash-3.0-patches/
+
A4) On what machines will bash run?
Bash has been ported to nearly every version of Unix. All you
Newsgroups: comp.unix.shell,comp.unix.questions
Distribution: world
From: chet@po.cwru.edu (Chet Ramey)
-Subject: BASH Frequently-Asked Questions (FAQ version 3.29)
+Subject: BASH Frequently-Asked Questions (FAQ version 3.30)
Organization: Case Western Reserve University
Summary: A's to Q's about BASH, the Bourne-Again SHell
Reply-To: chet@po.cwru.edu
Archive-name: unix-faq/shell/bash
Posting-Frequency: monthly
Submitted-By: chet@po.cwru.edu (Chet Ramey)
-Last-Modified: Mon Sep 13 09:03:53 EDT 2004
-FAQ-Version: 3.29
+Last-Modified: Mon Feb 14 11:57:02 EST 2005
+FAQ-Version: 3.30
Bash-Version: 3.0
URL: ftp://ftp.cwru.edu/pub/bash/FAQ
Maintainer: chet@po.cwru.edu (Chet Ramey)
-This is the Bash FAQ, version 3.29, for Bash version 3.0.
+This is the Bash FAQ, version 3.30, for Bash version 3.0.
This document contains a set of frequently-asked questions concerning
Bash, the GNU Bourne-Again Shell. Bash is a freely-available command
ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-3.0.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-doc-3.0.tar.gz
+Any patches for the current version are available with the URL:
+
+ftp://ftp.cwru.edu/pub/bash/bash-3.0-patches/
+
A4) On what machines will bash run?
Bash has been ported to nearly every version of Unix. All you
Newsgroups: comp.unix.shell,comp.unix.questions,comp.answers,news.answers
From: chet@po.cwru.edu (Chet Ramey)
-Subject: [gnu.bash.bug] BASH Frequently-Asked Questions (FAQ version 3.29)
+Subject: [gnu.bash.bug] BASH Frequently-Asked Questions (FAQ version 3.30)
Organization: Case Western Reserve University
Summary: A's to Q's about BASH, the Bourne-Again SHell
Reply-To: chet@po.cwru.edu
Archive-name: unix-faq/shell/bash
Posting-Frequency: monthly
Submitted-By: chet@po.cwru.edu (Chet Ramey)
-Last-Modified: Mon Sep 13 09:03:53 EDT 2004
-FAQ-Version: 3.29
+Last-Modified: Mon Feb 14 11:57:02 EST 2005
+FAQ-Version: 3.30
Bash-Version: 3.0
URL: ftp://ftp.cwru.edu/pub/bash/FAQ
Maintainer: chet@po.cwru.edu (Chet Ramey)
-This is the Bash FAQ, version 3.29, for Bash version 3.0.
+This is the Bash FAQ, version 3.30, for Bash version 3.0.
This document contains a set of frequently-asked questions concerning
Bash, the GNU Bourne-Again Shell. Bash is a freely-available command
ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-3.0.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-doc-3.0.tar.gz
+Any patches for the current version are available with the URL:
+
+ftp://ftp.cwru.edu/pub/bash/bash-3.0-patches/
+
A4) On what machines will bash run?
Bash has been ported to nearly every version of Unix. All you
Archive-name: unix-faq/shell/bash
Posting-Frequency: monthly
Submitted-By: chet@po.cwru.edu (Chet Ramey)
-Last-Modified: Mon Sep 13 09:03:53 EDT 2004
-FAQ-Version: 3.29
+Last-Modified: Mon Feb 14 11:57:02 EST 2005
+FAQ-Version: 3.30
Bash-Version: 3.0
URL: ftp://ftp.cwru.edu/pub/bash/FAQ
Maintainer: chet@po.cwru.edu (Chet Ramey)
%!PS-Adobe-3.0
%%Creator: groff version 1.18.1
-%%CreationDate: Thu Dec 30 17:01:22 2004
+%%CreationDate: Mon Feb 14 11:56:35 2005
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%DocumentSuppliedResources: procset grops 1.18 1
Copyright (C) 1988-2005 Free Software Foundation, Inc.
@end ignore
-@set LASTCHANGE Fri Feb 11 15:43:59 EST 2005
+@set LASTCHANGE Sat Feb 19 17:38:46 EST 2005
@set EDITION 3.1-devel
@set VERSION 3.1-devel
-@set UPDATED 11 February 2005
+@set UPDATED 19 February 2005
@set UPDATED-MONTH February 2005
Copyright (C) 1988-2005 Free Software Foundation, Inc.
@end ignore
-@set LASTCHANGE Thu Dec 30 17:00:22 EST 2004
+@set LASTCHANGE Fri Feb 18 22:22:06 EST 2005
@set EDITION 3.1-devel
@set VERSION 3.1-devel
-@set UPDATED 30 December 2004
-@set UPDATED-MONTH December 2004
+@set UPDATED 18 February 2005
+@set UPDATED-MONTH February 2005
/* Currently-executing shell function. */
SHELL_VAR *this_shell_function;
+/* If non-zero, matches in case and [[ ... ]] are case-insensitive */
+int match_ignore_case = 0;
+
struct fd_bitmap *current_fds_to_close = (struct fd_bitmap *)NULL;
#define FD_BITMAP_DEFAULT_SIZE 32
/* Since the pattern does not undergo quote removal (as per
Posix.2, section 3.9.4.3), the strmatch () call must be able
to recognize backslashes as escape characters. */
- match = strmatch (pattern, word, FNMATCH_EXTFLAG) != FNM_NOMATCH;
+ match = strmatch (pattern, word, FNMATCH_EXTFLAG|FNMATCH_IGNCASE) != FNM_NOMATCH;
free (pattern);
dispose_words (es);
/* execute_command.c -- Execute a COMMAND structure. */
-/* Copyright (C) 1987-2004 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Base may be >=2 and <=64. If base is <= 36, the numbers are drawn
from [0-9][a-zA-Z], and lowercase and uppercase letters may be used
interchangably. If base is > 36 and <= 64, the numbers are drawn
- from [0-9][a-z][A-Z]_@ (a = 10, z = 35, A = 36, Z = 61, _ = 62, @ = 63 --
+ from [0-9][a-z][A-Z]_@ (a = 10, z = 35, A = 36, Z = 61, @ = 62, _ = 63 --
you get the picture). */
static intmax_t
else
break;
}
+
return (val);
}
#include "variables.h"
#include "externs.h"
-extern int glob_ignore_case;
+extern int glob_ignore_case, match_ignore_case;
int
sh_regmatch (string, pattern, flags)
#endif
rflags = REG_EXTENDED;
- if (glob_ignore_case)
+ if (glob_ignore_case || match_ignore_case)
rflags |= REG_ICASE;
#if !defined (ARRAY_VARS)
rflags |= REG_NOSUB;
--- /dev/null
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Bash, the Bourne Again SHell.
+
+ Bash is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2, or (at your option) any later
+ version.
+
+ Bash is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with Bash; see the file COPYING. If not, write to the Free Software
+ Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+/*
+ * shmatch.c -- shell interface to posix regular expression matching.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if defined (HAVE_POSIX_REGEXP)
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "bashansi.h"
+
+#include <stdio.h>
+#include <regex.h>
+
+#include "shell.h"
+#include "variables.h"
+#include "externs.h"
+
+extern int glob_ignore_case;
+
+int
+sh_regmatch (string, pattern, flags)
+ const char *string;
+ const char *pattern;
+ int flags;
+{
+ regex_t regex = { 0 };
+ regmatch_t *matches;
+ int rflags;
+#if defined (ARRAY_VARS)
+ SHELL_VAR *rematch;
+ ARRAY *amatch;
+ int subexp_ind;
+ char *subexp_str;
+ int subexp_len;
+#endif
+ int result;
+
+
+#if defined (ARRAY_VARS)
+ rematch = (SHELL_VAR *)NULL;
+#endif
+
+ rflags = REG_EXTENDED;
+ if (glob_ignore_case)
+ rflags |= REG_ICASE;
+#if !defined (ARRAY_VARS)
+ rflags |= REG_NOSUB;
+#endif
+
+ if (regcomp (®ex, pattern, rflags))
+ return 2; /* flag for printing a warning here. */
+
+#if defined (ARRAY_VARS)
+ matches = (regmatch_t *)malloc (sizeof (regmatch_t) * (regex.re_nsub + 1));
+#else
+ matches = NULL;
+#endif
+
+ if (regexec (®ex, string, regex.re_nsub + 1, matches, 0))
+ result = EXECUTION_FAILURE;
+ else
+ result = EXECUTION_SUCCESS; /* match */
+
+#if defined (ARRAY_VARS)
+ subexp_len = strlen (string) + 10;
+ subexp_str = malloc (subexp_len + 1);
+
+ /* Store the parenthesized subexpressions in the array BASH_REMATCH.
+ Element 0 is the portion that matched the entire regexp. Element 1
+ is the part that matched the first subexpression, and so on. */
+ unbind_variable ("BASH_REMATCH");
+ rematch = make_new_array_variable ("BASH_REMATCH");
+ amatch = array_cell (rematch);
+
+ if ((flags & SHMAT_SUBEXP) && result == EXECUTION_SUCCESS && subexp_str)
+ {
+ for (subexp_ind = 0; subexp_ind <= regex.re_nsub; subexp_ind++)
+ {
+ memset (subexp_str, 0, subexp_len);
+ strncpy (subexp_str, string + matches[subexp_ind].rm_so,
+ matches[subexp_ind].rm_eo - matches[subexp_ind].rm_so);
+ array_insert (amatch, subexp_ind, subexp_str);
+ }
+ }
+
+ VSETATTR (rematch, att_readonly);
+
+ free (subexp_str);
+ free (matches);
+#endif /* ARRAY_VARS */
+
+ regfree (®ex);
+
+ return result;
+}
+
+#endif /* HAVE_POSIX_REGEXP */
/* pathexp.h -- The shell interface to the globbing library. */
-/* Copyright (C) 1987,1989 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
# define FNMATCH_EXTFLAG 0
#endif /* !EXTENDED_GLOB */
+#define FNMATCH_IGNCASE (match_ignore_case ? FNM_CASEFOLD : 0)
+
extern int glob_dot_filenames;
extern int extended_glob;
+extern int match_ignore_case; /* doesn't really belong here */
extern int unquoted_glob_pattern_p __P((char *));
--- /dev/null
+/* pathexp.h -- The shell interface to the globbing library. */
+
+/* Copyright (C) 1987,1989 Free Software Foundation, Inc.
+
+ This file is part of GNU Bash, the Bourne Again SHell.
+
+ Bash is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2, or (at your option) any later
+ version.
+
+ Bash is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with Bash; see the file COPYING. If not, write to the Free Software
+ Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#if !defined (_PATHEXP_H_)
+#define _PATHEXP_H_
+
+#if defined (USE_POSIX_GLOB_LIBRARY)
+# define GLOB_FAILED(glist) !(glist)
+#else /* !USE_POSIX_GLOB_LIBRARY */
+# define GLOB_FAILED(glist) (glist) == (char **)&glob_error_return
+extern int noglob_dot_filenames;
+extern char *glob_error_return;
+#endif /* !USE_POSIX_GLOB_LIBRARY */
+
+/* Flag values for quote_string_for_globbing */
+#define QGLOB_CVTNULL 0x01 /* convert QUOTED_NULL strings to '\0' */
+#define QGLOB_FILENAME 0x02 /* do correct quoting for matching filenames */
+
+#if defined (EXTENDED_GLOB)
+/* Flags to OR with other flag args to strmatch() to enabled the extended
+ pattern matching. */
+# define FNMATCH_EXTFLAG (extended_glob ? FNM_EXTMATCH : 0)
+#else
+# define FNMATCH_EXTFLAG 0
+#endif /* !EXTENDED_GLOB */
+
+#define FNMATCH_IGNCASE (match_ignore_case ? FNM_CASEFOLD : 0)
+
+extern int glob_dot_filenames;
+extern int extended_glob;
+
+extern int unquoted_glob_pattern_p __P((char *));
+
+/* PATHNAME can contain characters prefixed by CTLESC; this indicates
+ that the character is to be quoted. We quote it here in the style
+ that the glob library recognizes. If flags includes QGLOB_CVTNULL,
+ we change quoted null strings (pathname[0] == CTLNUL) into empty
+ strings (pathname[0] == 0). If this is called after quote removal
+ is performed, (flags & QGLOB_CVTNULL) should be 0; if called when quote
+ removal has not been done (for example, before attempting to match a
+ pattern while executing a case statement), flags should include
+ QGLOB_CVTNULL. If flags includes QGLOB_FILENAME, appropriate quoting
+ to match a filename should be performed. */
+extern char *quote_string_for_globbing __P((const char *, int));
+
+extern char *quote_globbing_chars __P((char *));
+
+/* Call the glob library to do globbing on PATHNAME. */
+extern char **shell_glob_filename __P((const char *));
+
+/* Filename completion ignore. Used to implement the "fignore" facility of
+ tcsh and GLOBIGNORE (like ksh-93 FIGNORE).
+
+ It is passed a NULL-terminated array of (char *)'s that must be
+ free()'d if they are deleted. The first element (names[0]) is the
+ least-common-denominator string of the matching patterns (i.e.
+ u<TAB> produces names[0] = "und", names[1] = "under.c", names[2] =
+ "undun.c", name[3] = NULL). */
+
+struct ign {
+ char *val;
+ int len, flags;
+};
+
+typedef int sh_iv_item_func_t __P((struct ign *));
+
+struct ignorevar {
+ char *varname; /* FIGNORE or GLOBIGNORE */
+ struct ign *ignores; /* Store the ignore strings here */
+ int num_ignores; /* How many are there? */
+ char *last_ignoreval; /* Last value of variable - cached for speed */
+ sh_iv_item_func_t *item_func; /* Called when each item is parsed from $`varname' */
+};
+
+extern void setup_ignore_patterns __P((struct ignorevar *));
+
+extern void setup_glob_ignore __P((char *));
+extern int should_ignore_glob_matches __P((void));
+extern void ignore_glob_matches __P((char **));
+
+#endif
term = get_string_value ("TERM");
no_line_editing |= term && (STREQ (term, "emacs"));
emacs = get_string_value ("EMACS");
- running_under_emacs = emacs ? ((strmatch ("*term*", emacs, 0) == 0) ? 2 : 1)
- : 0;
+ running_under_emacs = emacs ? ((strstr (emacs, "term") != 0) ? 2 : 1) : 0;
#if 0
no_line_editing |= emacs && emacs[0] == 't' && emacs[1] == '\0';
#else
/* Modified to run with the GNU shell Apr 25, 1988 by bfox. */
-/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
{
int m;
- m = strmatch (pat, string, FNMATCH_EXTFLAG);
+ m = strmatch (pat, string, FNMATCH_EXTFLAG|FNMATCH_IGNCASE);
return ((op == EQ) ? (m == 0) : (m != 0));
}
--- /dev/null
+/* GNU test program (ksb and mjb) */
+
+/* Modified to run with the GNU shell Apr 25, 1988 by bfox. */
+
+/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
+
+ This file is part of GNU Bash, the Bourne Again SHell.
+
+ Bash is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2, or (at your option) any later
+ version.
+
+ Bash is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with Bash; see the file COPYING. If not, write to the Free Software
+ Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+/* Define PATTERN_MATCHING to get the csh-like =~ and !~ pattern-matching
+ binary operators. */
+/* #define PATTERN_MATCHING */
+
+#if defined (HAVE_CONFIG_H)
+# include <config.h>
+#endif
+
+#include <stdio.h>
+
+#include "bashtypes.h"
+
+#if !defined (HAVE_LIMITS_H)
+# include <sys/param.h>
+#endif
+
+#if defined (HAVE_UNISTD_H)
+# include <unistd.h>
+#endif
+
+#include <errno.h>
+#if !defined (errno)
+extern int errno;
+#endif /* !errno */
+
+#if !defined (_POSIX_VERSION) && defined (HAVE_SYS_FILE_H)
+# include <sys/file.h>
+#endif /* !_POSIX_VERSION */
+#include "posixstat.h"
+#include "filecntl.h"
+
+#include "bashintl.h"
+
+#include "shell.h"
+#include "pathexp.h"
+#include "test.h"
+#include "builtins/common.h"
+
+#include <glob/strmatch.h>
+
+#if !defined (STRLEN)
+# define STRLEN(s) ((s)[0] ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0)
+#endif
+
+#if !defined (STREQ)
+# define STREQ(a, b) ((a)[0] == (b)[0] && strcmp (a, b) == 0)
+#endif /* !STREQ */
+
+#if !defined (R_OK)
+#define R_OK 4
+#define W_OK 2
+#define X_OK 1
+#define F_OK 0
+#endif /* R_OK */
+
+#define EQ 0
+#define NE 1
+#define LT 2
+#define GT 3
+#define LE 4
+#define GE 5
+
+#define NT 0
+#define OT 1
+#define EF 2
+
+/* The following few defines control the truth and false output of each stage.
+ TRUE and FALSE are what we use to compute the final output value.
+ SHELL_BOOLEAN is the form which returns truth or falseness in shell terms.
+ Default is TRUE = 1, FALSE = 0, SHELL_BOOLEAN = (!value). */
+#define TRUE 1
+#define FALSE 0
+#define SHELL_BOOLEAN(value) (!(value))
+
+#define TEST_ERREXIT_STATUS 2
+
+static procenv_t test_exit_buf;
+static int test_error_return;
+#define test_exit(val) \
+ do { test_error_return = val; longjmp (test_exit_buf, 1); } while (0)
+
+/* We have to use access(2) for machines running AFS, because it's
+ not a Unix file system. This may produce incorrect answers for
+ non-AFS files. I hate AFS. */
+#if defined (AFS)
+# define EACCESS(path, mode) access(path, mode)
+#else
+# define EACCESS(path, mode) test_eaccess(path, mode)
+#endif /* AFS */
+
+static int pos; /* The offset of the current argument in ARGV. */
+static int argc; /* The number of arguments present in ARGV. */
+static char **argv; /* The argument list. */
+static int noeval;
+
+static void test_syntax_error __P((char *, char *)) __attribute__((__noreturn__));
+static void beyond __P((void)) __attribute__((__noreturn__));
+static void integer_expected_error __P((char *)) __attribute__((__noreturn__));
+
+static int test_stat __P((char *, struct stat *));
+
+static int unary_operator __P((void));
+static int binary_operator __P((void));
+static int two_arguments __P((void));
+static int three_arguments __P((void));
+static int posixtest __P((void));
+
+static int expr __P((void));
+static int term __P((void));
+static int and __P((void));
+static int or __P((void));
+
+static int filecomp __P((char *, char *, int));
+static int arithcomp __P((char *, char *, int, int));
+static int patcomp __P((char *, char *, int));
+
+static void
+test_syntax_error (format, arg)
+ char *format, *arg;
+{
+ builtin_error (format, arg);
+ test_exit (TEST_ERREXIT_STATUS);
+}
+
+/*
+ * beyond - call when we're beyond the end of the argument list (an
+ * error condition)
+ */
+static void
+beyond ()
+{
+ test_syntax_error (_("argument expected"), (char *)NULL);
+}
+
+/* Syntax error for when an integer argument was expected, but
+ something else was found. */
+static void
+integer_expected_error (pch)
+ char *pch;
+{
+ test_syntax_error (_("%s: integer expression expected"), pch);
+}
+
+/* A wrapper for stat () which disallows pathnames that are empty strings
+ and handles /dev/fd emulation on systems that don't have it. */
+static int
+test_stat (path, finfo)
+ char *path;
+ struct stat *finfo;
+{
+ if (*path == '\0')
+ {
+ errno = ENOENT;
+ return (-1);
+ }
+ if (path[0] == '/' && path[1] == 'd' && strncmp (path, "/dev/fd/", 8) == 0)
+ {
+#if !defined (HAVE_DEV_FD)
+ intmax_t fd;
+ int r;
+
+ if (legal_number (path + 8, &fd) && fd == (int)fd)
+ {
+ r = fstat ((int)fd, finfo);
+ if (r == 0 || errno != EBADF)
+ return (r);
+ }
+ errno = ENOENT;
+ return (-1);
+#else
+ /* If HAVE_DEV_FD is defined, DEV_FD_PREFIX is defined also, and has a
+ trailing slash. Make sure /dev/fd/xx really uses DEV_FD_PREFIX/xx.
+ On most systems, with the notable exception of linux, this is
+ effectively a no-op. */
+ char pbuf[32];
+ strcpy (pbuf, DEV_FD_PREFIX);
+ strcat (pbuf, path + 8);
+ return (stat (pbuf, finfo));
+#endif /* !HAVE_DEV_FD */
+ }
+#if !defined (HAVE_DEV_STDIN)
+ else if (STREQN (path, "/dev/std", 8))
+ {
+ if (STREQ (path+8, "in"))
+ return (fstat (0, finfo));
+ else if (STREQ (path+8, "out"))
+ return (fstat (1, finfo));
+ else if (STREQ (path+8, "err"))
+ return (fstat (2, finfo));
+ else
+ return (stat (path, finfo));
+ }
+#endif /* !HAVE_DEV_STDIN */
+ return (stat (path, finfo));
+}
+
+/* Do the same thing access(2) does, but use the effective uid and gid,
+ and don't make the mistake of telling root that any file is
+ executable. */
+int
+test_eaccess (path, mode)
+ char *path;
+ int mode;
+{
+ struct stat st;
+
+ if (test_stat (path, &st) < 0)
+ return (-1);
+
+ if (current_user.euid == 0)
+ {
+ /* Root can read or write any file. */
+ if (mode != X_OK)
+ return (0);
+
+ /* Root can execute any file that has any one of the execute
+ bits set. */
+ if (st.st_mode & S_IXUGO)
+ return (0);
+ }
+
+ if (st.st_uid == current_user.euid) /* owner */
+ mode <<= 6;
+ else if (group_member (st.st_gid))
+ mode <<= 3;
+
+ if (st.st_mode & mode)
+ return (0);
+
+ errno = EACCES;
+ return (-1);
+}
+
+/* Increment our position in the argument list. Check that we're not
+ past the end of the argument list. This check is supressed if the
+ argument is FALSE. Made a macro for efficiency. */
+#define advance(f) do { ++pos; if (f && pos >= argc) beyond (); } while (0)
+#define unary_advance() do { advance (1); ++pos; } while (0)
+
+/*
+ * expr:
+ * or
+ */
+static int
+expr ()
+{
+ if (pos >= argc)
+ beyond ();
+
+ return (FALSE ^ or ()); /* Same with this. */
+}
+
+/*
+ * or:
+ * and
+ * and '-o' or
+ */
+static int
+or ()
+{
+ int value, v2;
+
+ value = and ();
+ if (pos < argc && argv[pos][0] == '-' && argv[pos][1] == 'o' && !argv[pos][2])
+ {
+ advance (0);
+ v2 = or ();
+ return (value || v2);
+ }
+
+ return (value);
+}
+
+/*
+ * and:
+ * term
+ * term '-a' and
+ */
+static int
+and ()
+{
+ int value, v2;
+
+ value = term ();
+ if (pos < argc && argv[pos][0] == '-' && argv[pos][1] == 'a' && !argv[pos][2])
+ {
+ advance (0);
+ v2 = and ();
+ return (value && v2);
+ }
+ return (value);
+}
+
+/*
+ * term - parse a term and return 1 or 0 depending on whether the term
+ * evaluates to true or false, respectively.
+ *
+ * term ::=
+ * '-'('a'|'b'|'c'|'d'|'e'|'f'|'g'|'h'|'k'|'p'|'r'|'s'|'u'|'w'|'x') filename
+ * '-'('G'|'L'|'O'|'S'|'N') filename
+ * '-t' [int]
+ * '-'('z'|'n') string
+ * '-o' option
+ * string
+ * string ('!='|'='|'==') string
+ * <int> '-'(eq|ne|le|lt|ge|gt) <int>
+ * file '-'(nt|ot|ef) file
+ * '(' <expr> ')'
+ * int ::=
+ * positive and negative integers
+ */
+static int
+term ()
+{
+ int value;
+
+ if (pos >= argc)
+ beyond ();
+
+ /* Deal with leading `not's. */
+ if (argv[pos][0] == '!' && argv[pos][1] == '\0')
+ {
+ value = 0;
+ while (pos < argc && argv[pos][0] == '!' && argv[pos][1] == '\0')
+ {
+ advance (1);
+ value = 1 - value;
+ }
+
+ return (value ? !term() : term());
+ }
+
+ /* A paren-bracketed argument. */
+ if (argv[pos][0] == '(' && argv[pos][1] == '\0') /* ) */
+ {
+ advance (1);
+ value = expr ();
+ if (argv[pos] == 0) /* ( */
+ test_syntax_error (_("`)' expected"), (char *)NULL);
+ else if (argv[pos][0] != ')' || argv[pos][1]) /* ( */
+ test_syntax_error (_("`)' expected, found %s"), argv[pos]);
+ advance (0);
+ return (value);
+ }
+
+ /* are there enough arguments left that this could be dyadic? */
+ if ((pos + 3 <= argc) && test_binop (argv[pos + 1]))
+ value = binary_operator ();
+
+ /* Might be a switch type argument */
+ else if (argv[pos][0] == '-' && argv[pos][2] == '\0')
+ {
+ if (test_unop (argv[pos]))
+ value = unary_operator ();
+ else
+ test_syntax_error (_("%s: unary operator expected"), argv[pos]);
+ }
+ else
+ {
+ value = argv[pos][0] != '\0';
+ advance (0);
+ }
+
+ return (value);
+}
+
+static int
+filecomp (s, t, op)
+ char *s, *t;
+ int op;
+{
+ struct stat st1, st2;
+ int r1, r2;
+
+ if ((r1 = test_stat (s, &st1)) < 0)
+ {
+ if (op == EF)
+ return (FALSE);
+ }
+ if ((r2 = test_stat (t, &st2)) < 0)
+ {
+ if (op == EF)
+ return (FALSE);
+ }
+
+ switch (op)
+ {
+ case OT: return (r1 < r2 || (r2 == 0 && st1.st_mtime < st2.st_mtime));
+ case NT: return (r1 > r2 || (r1 == 0 && st1.st_mtime > st2.st_mtime));
+ case EF: return ((st1.st_dev == st2.st_dev) && (st1.st_ino == st2.st_ino));
+ }
+ return (FALSE);
+}
+
+static int
+arithcomp (s, t, op, flags)
+ char *s, *t;
+ int op, flags;
+{
+ intmax_t l, r;
+ int expok;
+
+ if (flags & TEST_ARITHEXP)
+ {
+ l = evalexp (s, &expok);
+ if (expok == 0)
+ return (FALSE); /* should probably longjmp here */
+ r = evalexp (t, &expok);
+ if (expok == 0)
+ return (FALSE); /* ditto */
+ }
+ else
+ {
+ if (legal_number (s, &l) == 0)
+ integer_expected_error (s);
+ if (legal_number (t, &r) == 0)
+ integer_expected_error (t);
+ }
+
+ switch (op)
+ {
+ case EQ: return (l == r);
+ case NE: return (l != r);
+ case LT: return (l < r);
+ case GT: return (l > r);
+ case LE: return (l <= r);
+ case GE: return (l >= r);
+ }
+
+ return (FALSE);
+}
+
+static int
+patcomp (string, pat, op)
+ char *string, *pat;
+ int op;
+{
+ int m;
+
+ m = strmatch (pat, string, FNMATCH_EXTFLAG|FNMATCH_IGNCASE);
+ return ((op == EQ) ? (m == 0) : (m != 0));
+}
+
+int
+binary_test (op, arg1, arg2, flags)
+ char *op, *arg1, *arg2;
+ int flags;
+{
+ int patmatch;
+
+ patmatch = (flags & TEST_PATMATCH);
+
+ if (op[0] == '=' && (op[1] == '\0' || (op[1] == '=' && op[2] == '\0')))
+ return (patmatch ? patcomp (arg1, arg2, EQ) : STREQ (arg1, arg2));
+
+ else if ((op[0] == '>' || op[0] == '<') && op[1] == '\0')
+ return ((op[0] == '>') ? (strcmp (arg1, arg2) > 0) : (strcmp (arg1, arg2) < 0));
+
+ else if (op[0] == '!' && op[1] == '=' && op[2] == '\0')
+ return (patmatch ? patcomp (arg1, arg2, NE) : (STREQ (arg1, arg2) == 0));
+
+ else if (op[2] == 't')
+ {
+ switch (op[1])
+ {
+ case 'n': return (filecomp (arg1, arg2, NT)); /* -nt */
+ case 'o': return (filecomp (arg1, arg2, OT)); /* -ot */
+ case 'l': return (arithcomp (arg1, arg2, LT, flags)); /* -lt */
+ case 'g': return (arithcomp (arg1, arg2, GT, flags)); /* -gt */
+ }
+ }
+ else if (op[1] == 'e')
+ {
+ switch (op[2])
+ {
+ case 'f': return (filecomp (arg1, arg2, EF)); /* -ef */
+ case 'q': return (arithcomp (arg1, arg2, EQ, flags)); /* -eq */
+ }
+ }
+ else if (op[2] == 'e')
+ {
+ switch (op[1])
+ {
+ case 'n': return (arithcomp (arg1, arg2, NE, flags)); /* -ne */
+ case 'g': return (arithcomp (arg1, arg2, GE, flags)); /* -ge */
+ case 'l': return (arithcomp (arg1, arg2, LE, flags)); /* -le */
+ }
+ }
+
+ return (FALSE); /* should never get here */
+}
+
+
+static int
+binary_operator ()
+{
+ int value;
+ char *w;
+
+ w = argv[pos + 1];
+ if ((w[0] == '=' && (w[1] == '\0' || (w[1] == '=' && w[2] == '\0'))) || /* =, == */
+ ((w[0] == '>' || w[0] == '<') && w[1] == '\0') || /* <, > */
+ (w[0] == '!' && w[1] == '=' && w[2] == '\0')) /* != */
+ {
+ value = binary_test (w, argv[pos], argv[pos + 2], 0);
+ pos += 3;
+ return (value);
+ }
+
+#if defined (PATTERN_MATCHING)
+ if ((w[0] == '=' || w[0] == '!') && w[1] == '~' && w[2] == '\0')
+ {
+ value = patcomp (argv[pos], argv[pos + 2], w[0] == '=' ? EQ : NE);
+ pos += 3;
+ return (value);
+ }
+#endif
+
+ if ((w[0] != '-' || w[3] != '\0') || test_binop (w) == 0)
+ {
+ test_syntax_error (_("%s: binary operator expected"), w);
+ /* NOTREACHED */
+ return (FALSE);
+ }
+
+ value = binary_test (w, argv[pos], argv[pos + 2], 0);
+ pos += 3;
+ return value;
+}
+
+static int
+unary_operator ()
+{
+ char *op;
+ intmax_t r;
+
+ op = argv[pos];
+ if (test_unop (op) == 0)
+ return (FALSE);
+
+ /* the only tricky case is `-t', which may or may not take an argument. */
+ if (op[1] == 't')
+ {
+ advance (0);
+ if (pos < argc)
+ {
+ if (legal_number (argv[pos], &r))
+ {
+ advance (0);
+ return (unary_test (op, argv[pos - 1]));
+ }
+ else
+ return (FALSE);
+ }
+ else
+ return (unary_test (op, "1"));
+ }
+
+ /* All of the unary operators take an argument, so we first call
+ unary_advance (), which checks to make sure that there is an
+ argument, and then advances pos right past it. This means that
+ pos - 1 is the location of the argument. */
+ unary_advance ();
+ return (unary_test (op, argv[pos - 1]));
+}
+
+int
+unary_test (op, arg)
+ char *op, *arg;
+{
+ intmax_t r;
+ struct stat stat_buf;
+
+ switch (op[1])
+ {
+ case 'a': /* file exists in the file system? */
+ case 'e':
+ return (test_stat (arg, &stat_buf) == 0);
+
+ case 'r': /* file is readable? */
+ return (EACCESS (arg, R_OK) == 0);
+
+ case 'w': /* File is writeable? */
+ return (EACCESS (arg, W_OK) == 0);
+
+ case 'x': /* File is executable? */
+ return (EACCESS (arg, X_OK) == 0);
+
+ case 'O': /* File is owned by you? */
+ return (test_stat (arg, &stat_buf) == 0 &&
+ (uid_t) current_user.euid == (uid_t) stat_buf.st_uid);
+
+ case 'G': /* File is owned by your group? */
+ return (test_stat (arg, &stat_buf) == 0 &&
+ (gid_t) current_user.egid == (gid_t) stat_buf.st_gid);
+
+ case 'N':
+ return (test_stat (arg, &stat_buf) == 0 &&
+ stat_buf.st_atime <= stat_buf.st_mtime);
+
+ case 'f': /* File is a file? */
+ if (test_stat (arg, &stat_buf) < 0)
+ return (FALSE);
+
+ /* -f is true if the given file exists and is a regular file. */
+#if defined (S_IFMT)
+ return (S_ISREG (stat_buf.st_mode) || (stat_buf.st_mode & S_IFMT) == 0);
+#else
+ return (S_ISREG (stat_buf.st_mode));
+#endif /* !S_IFMT */
+
+ case 'd': /* File is a directory? */
+ return (test_stat (arg, &stat_buf) == 0 && (S_ISDIR (stat_buf.st_mode)));
+
+ case 's': /* File has something in it? */
+ return (test_stat (arg, &stat_buf) == 0 && stat_buf.st_size > (off_t) 0);
+
+ case 'S': /* File is a socket? */
+#if !defined (S_ISSOCK)
+ return (FALSE);
+#else
+ return (test_stat (arg, &stat_buf) == 0 && S_ISSOCK (stat_buf.st_mode));
+#endif /* S_ISSOCK */
+
+ case 'c': /* File is character special? */
+ return (test_stat (arg, &stat_buf) == 0 && S_ISCHR (stat_buf.st_mode));
+
+ case 'b': /* File is block special? */
+ return (test_stat (arg, &stat_buf) == 0 && S_ISBLK (stat_buf.st_mode));
+
+ case 'p': /* File is a named pipe? */
+#ifndef S_ISFIFO
+ return (FALSE);
+#else
+ return (test_stat (arg, &stat_buf) == 0 && S_ISFIFO (stat_buf.st_mode));
+#endif /* S_ISFIFO */
+
+ case 'L': /* Same as -h */
+ case 'h': /* File is a symbolic link? */
+#if !defined (S_ISLNK) || !defined (HAVE_LSTAT)
+ return (FALSE);
+#else
+ return ((arg[0] != '\0') &&
+ (lstat (arg, &stat_buf) == 0) && S_ISLNK (stat_buf.st_mode));
+#endif /* S_IFLNK && HAVE_LSTAT */
+
+ case 'u': /* File is setuid? */
+ return (test_stat (arg, &stat_buf) == 0 && (stat_buf.st_mode & S_ISUID) != 0);
+
+ case 'g': /* File is setgid? */
+ return (test_stat (arg, &stat_buf) == 0 && (stat_buf.st_mode & S_ISGID) != 0);
+
+ case 'k': /* File has sticky bit set? */
+#if !defined (S_ISVTX)
+ /* This is not Posix, and is not defined on some Posix systems. */
+ return (FALSE);
+#else
+ return (test_stat (arg, &stat_buf) == 0 && (stat_buf.st_mode & S_ISVTX) != 0);
+#endif
+
+ case 't': /* File fd is a terminal? */
+ if (legal_number (arg, &r) == 0)
+ return (FALSE);
+ return ((r == (int)r) && isatty ((int)r));
+
+ case 'n': /* True if arg has some length. */
+ return (arg[0] != '\0');
+
+ case 'z': /* True if arg has no length. */
+ return (arg[0] == '\0');
+
+ case 'o': /* True if option `arg' is set. */
+ return (minus_o_option_value (arg) == 1);
+ }
+
+ /* We can't actually get here, but this shuts up gcc. */
+ return (FALSE);
+}
+
+/* Return TRUE if OP is one of the test command's binary operators. */
+int
+test_binop (op)
+ char *op;
+{
+ if (op[0] == '=' && op[1] == '\0')
+ return (1); /* '=' */
+ else if ((op[0] == '<' || op[0] == '>') && op[1] == '\0') /* string <, > */
+ return (1);
+ else if ((op[0] == '=' || op[0] == '!') && op[1] == '=' && op[2] == '\0')
+ return (1); /* `==' and `!=' */
+#if defined (PATTERN_MATCHING)
+ else if (op[2] == '\0' && op[1] == '~' && (op[0] == '=' || op[0] == '!'))
+ return (1);
+#endif
+ else if (op[0] != '-' || op[2] == '\0' || op[3] != '\0')
+ return (0);
+ else
+ {
+ if (op[2] == 't')
+ switch (op[1])
+ {
+ case 'n': /* -nt */
+ case 'o': /* -ot */
+ case 'l': /* -lt */
+ case 'g': /* -gt */
+ return (1);
+ default:
+ return (0);
+ }
+ else if (op[1] == 'e')
+ switch (op[2])
+ {
+ case 'q': /* -eq */
+ case 'f': /* -ef */
+ return (1);
+ default:
+ return (0);
+ }
+ else if (op[2] == 'e')
+ switch (op[1])
+ {
+ case 'n': /* -ne */
+ case 'g': /* -ge */
+ case 'l': /* -le */
+ return (1);
+ default:
+ return (0);
+ }
+ else
+ return (0);
+ }
+}
+
+/* Return non-zero if OP is one of the test command's unary operators. */
+int
+test_unop (op)
+ char *op;
+{
+ if (op[0] != '-')
+ return (0);
+
+ switch (op[1])
+ {
+ case 'a': case 'b': case 'c': case 'd': case 'e':
+ case 'f': case 'g': case 'h': case 'k': case 'n':
+ case 'o': case 'p': case 'r': case 's': case 't':
+ case 'u': case 'w': case 'x': case 'z':
+ case 'G': case 'L': case 'O': case 'S': case 'N':
+ return (1);
+ }
+
+ return (0);
+}
+
+static int
+two_arguments ()
+{
+ if (argv[pos][0] == '!' && argv[pos][1] == '\0')
+ return (argv[pos + 1][0] == '\0');
+ else if (argv[pos][0] == '-' && argv[pos][2] == '\0')
+ {
+ if (test_unop (argv[pos]))
+ return (unary_operator ());
+ else
+ test_syntax_error (_("%s: unary operator expected"), argv[pos]);
+ }
+ else
+ test_syntax_error (_("%s: unary operator expected"), argv[pos]);
+
+ return (0);
+}
+
+#define ANDOR(s) (s[0] == '-' && !s[2] && (s[1] == 'a' || s[1] == 'o'))
+
+/* This could be augmented to handle `-t' as equivalent to `-t 1', but
+ POSIX requires that `-t' be given an argument. */
+#define ONE_ARG_TEST(s) ((s)[0] != '\0')
+
+static int
+three_arguments ()
+{
+ int value;
+
+ if (test_binop (argv[pos+1]))
+ {
+ value = binary_operator ();
+ pos = argc;
+ }
+ else if (ANDOR (argv[pos+1]))
+ {
+ if (argv[pos+1][1] == 'a')
+ value = ONE_ARG_TEST(argv[pos]) && ONE_ARG_TEST(argv[pos+2]);
+ else
+ value = ONE_ARG_TEST(argv[pos]) || ONE_ARG_TEST(argv[pos+2]);
+ pos = argc;
+ }
+ else if (argv[pos][0] == '!' && argv[pos][1] == '\0')
+ {
+ advance (1);
+ value = !two_arguments ();
+ }
+ else if (argv[pos][0] == '(' && argv[pos+2][0] == ')')
+ {
+ value = ONE_ARG_TEST(argv[pos+1]);
+ pos = argc;
+ }
+ else
+ test_syntax_error (_("%s: binary operator expected"), argv[pos+1]);
+
+ return (value);
+}
+
+/* This is an implementation of a Posix.2 proposal by David Korn. */
+static int
+posixtest ()
+{
+ int value;
+
+ switch (argc - 1) /* one extra passed in */
+ {
+ case 0:
+ value = FALSE;
+ pos = argc;
+ break;
+
+ case 1:
+ value = ONE_ARG_TEST(argv[1]);
+ pos = argc;
+ break;
+
+ case 2:
+ value = two_arguments ();
+ pos = argc;
+ break;
+
+ case 3:
+ value = three_arguments ();
+ break;
+
+ case 4:
+ if (argv[pos][0] == '!' && argv[pos][1] == '\0')
+ {
+ advance (1);
+ value = !three_arguments ();
+ break;
+ }
+ /* FALLTHROUGH */
+ default:
+ value = expr ();
+ }
+
+ return (value);
+}
+
+/*
+ * [:
+ * '[' expr ']'
+ * test:
+ * test expr
+ */
+int
+test_command (margc, margv)
+ int margc;
+ char **margv;
+{
+ int value;
+ int code;
+
+ USE_VAR(margc);
+
+ code = setjmp (test_exit_buf);
+
+ if (code)
+ return (test_error_return);
+
+ argv = margv;
+
+ if (margv[0] && margv[0][0] == '[' && margv[0][1] == '\0')
+ {
+ --margc;
+
+ if (margv[margc] && (margv[margc][0] != ']' || margv[margc][1]))
+ test_syntax_error (_("missing `]'"), (char *)NULL);
+
+ if (margc < 2)
+ test_exit (SHELL_BOOLEAN (FALSE));
+ }
+
+ argc = margc;
+ pos = 1;
+
+ if (pos >= argc)
+ test_exit (SHELL_BOOLEAN (FALSE));
+
+ noeval = 0;
+ value = posixtest ();
+
+ if (pos != argc)
+ test_syntax_error (_("too many arguments"), (char *)NULL);
+
+ test_exit (SHELL_BOOLEAN (value));
+}
-BUILD_DIR=/usr/local/build/chet/bash/bash-current
+BUILD_DIR=/usr/local/build/bash/bash-current
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR
argv[1] = <-^?->
argv[1] = <^?>
argv[1] = <-^?->
+ok
recho ${*:1}
recho -${*:1}-
+
+shift $#
+
+DEL=`awk 'END{printf("%c", 0+127)}' </dev/null`
+T1=a\ $DEL
+T2="a $DEL"
+set -- x $(echo $T1|wc -c) $(echo $T2|wc -c); shift
+L1=$1; L2=$2
+case "$L1/$L2" in
+4/4) echo ok;;
+*) echo CTLNUL bug: L1=$L1, L2=$L2;;
+esac
shopt -u mailwarn
shopt -u no_empty_cmd_completion
shopt -u nocaseglob
+shopt -u nocasematch
shopt -u nullglob
shopt -s progcomp
shopt -s promptvars
shopt -u mailwarn
shopt -u no_empty_cmd_completion
shopt -u nocaseglob
+shopt -u nocasematch
shopt -u nullglob
shopt -u restricted_shell
shopt -u shift_verbose
mailwarn off
no_empty_cmd_completion off
nocaseglob off
+nocasematch off
nullglob off
restricted_shell off
shift_verbose off