commit bash-20041124 snapshot

This commit is contained in:
Chet Ramey
2011-12-03 13:40:27 -05:00
parent eb2bb5621f
commit 54cdd75ae4
28 changed files with 2599 additions and 1133 deletions
+31 -1
View File
@@ -2874,7 +2874,7 @@ lib/sh/stringlist.c
subst.c
- in skip_to_delim(), if we have an unclosed ${, and it's at the end
of the string (string[i] == '{', string[i+1] == '{' and
string[i+2] == 0, return si (i +2) immediately without bothering
string[i+2] == 0, return si (i + 2) immediately without bothering
to call extract_dollar_brace_string or extract_delimited_string
- in skip_to_delim(), if string[i] is 0 after a call to
extract_dollar_brace_string or extract_delimited_string (meaning we
@@ -10614,3 +10614,33 @@ execute_cmd.c
- changes so that BASH_COMMAND preserves its value into a DEBUG trap:
for commands, arithmetic for command expressions, select commands,
case commands, (( commands, [[ commands, simple commands
11/24
-----
doc/{bash.1,bashref.texi}
- changed description of `set' builtin slightly so that it is clear
that only variables are displayed in posix mode and that read-only
variables can't be reset by simply sourcing the output of `set'
lib/sh/strftime.c
- don't try to redefine `inline' if it's already defined
11/26
-----
execute_cmd.c
- fix execute_function to check funcname_a after function execution,
since FUNCNAME can be changed or unset within a function
11/27
-----
builtins/evalfile.c
- make same changes as 11/26, this time to _evalfile
execute_cmd.c
- change execute_function to run the return trap after a function
completes execution even if the shell is compiled without DEBUGGER
defined
trap.c
- change reset_or_restore_signal_handlers so that the RETURN trap is
not inherited by command substitution when DEBUGGER is not defined
+33 -1
View File
@@ -10611,4 +10611,36 @@ doc/bash.1,lib/readline/doc/{readline.3,rluser.texi}
11/23
-----
execute_cmd.c
- changes so that BASH_COMMAND preserves its value into a DEBUG trap
- changes so that BASH_COMMAND preserves its value into a DEBUG trap:
for commands, arithmetic for command expressions, select commands,
case commands, (( commands, [[ commands, simple commands
11/24
-----
doc/{bash.1,bashref.texi}
- changed description of `set' builtin slightly so that it is clear
that only variables are displayed in posix mode and that read-only
variables can't be reset by simply sourcing the output of `set'
lib/sh/strftime.c
- don't try to redefine `inline' if it's already defined
11/26
-----
execute_cmd.c
- fix execute_function to check funcname_a after function execution,
since FUNCNAME can be changed or unset within a function
11/27
-----
builtins/evalfile.c
- make same changes as 11/26, this time to _evalfile
execute_cmd.c
- change execute_function to run the return trap after a function
completes execution even if the shell is compiled without DEBUGGER
defined
trap.c
- change reset_or_restore_signal_handlers so that the RETURN trap is
not inherited by command substitution when DEBUGGER is not defined
+9 -2
View File
@@ -83,7 +83,7 @@ _evalfile (filename, flags)
size_t file_size;
sh_vmsg_func_t *errfunc;
#if defined (ARRAY_VARS)
SHELL_VAR *funcname_v, *bash_source_v, *bash_lineno_v;
SHELL_VAR *funcname_v, *nfv, *bash_source_v, *bash_lineno_v;
ARRAY *funcname_a, *bash_source_a, *bash_lineno_a;
# if defined (DEBUGGER)
SHELL_VAR *bash_argv_v, *bash_argc_v;
@@ -247,9 +247,16 @@ file_error_and_exit:
}
#if defined (ARRAY_VARS)
/* These two variables cannot be unset, and cannot be affected by the
sourced file. */
array_pop (bash_source_a);
array_pop (bash_lineno_a);
array_pop (funcname_a);
/* FUNCNAME can be unset, and so can potentially be changed by the
sourced file. */
GET_ARRAY_FROM_VAR ("FUNCNAME", nfv, funcname_a);
if (nfv == funcname_v)
array_pop (funcname_a);
# if defined (DEBUGGER)
if ((flags & FEVAL_NOPUSHARGS) == 0)
{
+320
View File
@@ -0,0 +1,320 @@
/* Copyright (C) 1996-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. */
#include <config.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include "../bashtypes.h"
#include "posixstat.h"
#include "filecntl.h"
#include <stdio.h>
#include <signal.h>
#include <errno.h>
#include "../bashansi.h"
#include "../bashintl.h"
#include "../shell.h"
#include "../jobs.h"
#include "../builtins.h"
#include "../flags.h"
#include "../input.h"
#include "../execute_cmd.h"
#include "../trap.h"
#if defined (HISTORY)
# include "../bashhist.h"
#endif
#include "common.h"
#if !defined (errno)
extern int errno;
#endif
/* Flags for _evalfile() */
#define FEVAL_ENOENTOK 0x001
#define FEVAL_BUILTIN 0x002
#define FEVAL_UNWINDPROT 0x004
#define FEVAL_NONINT 0x008
#define FEVAL_LONGJMP 0x010
#define FEVAL_HISTORY 0x020
#define FEVAL_CHECKBINARY 0x040
#define FEVAL_REGFILE 0x080
#define FEVAL_NOPUSHARGS 0x100
extern int posixly_correct;
extern int indirection_level, startup_state, subshell_environment;
extern int return_catch_flag, return_catch_value;
extern int last_command_exit_value;
/* How many `levels' of sourced files we have. */
int sourcelevel = 0;
static int
_evalfile (filename, flags)
const char *filename;
int flags;
{
volatile int old_interactive;
procenv_t old_return_catch;
int return_val, fd, result, pflags;
char *string;
struct stat finfo;
size_t file_size;
sh_vmsg_func_t *errfunc;
#if defined (ARRAY_VARS)
SHELL_VAR *funcname_v, *nfv, *bash_source_v, *bash_lineno_v;
ARRAY *funcname_a, *bash_source_a, *bash_lineno_a;
# if defined (DEBUGGER)
SHELL_VAR *bash_argv_v, *bash_argc_v;
ARRAY *bash_argv_a, *bash_argc_a;
# endif
char *t, tt[2];
#endif
USE_VAR(pflags);
#if defined (ARRAY_VARS)
GET_ARRAY_FROM_VAR ("FUNCNAME", funcname_v, funcname_a);
GET_ARRAY_FROM_VAR ("BASH_SOURCE", bash_source_v, bash_source_a);
GET_ARRAY_FROM_VAR ("BASH_LINENO", bash_lineno_v, bash_lineno_a);
# if defined (DEBUGGER)
GET_ARRAY_FROM_VAR ("BASH_ARGV", bash_argv_v, bash_argv_a);
GET_ARRAY_FROM_VAR ("BASH_ARGC", bash_argc_v, bash_argc_a);
# endif
#endif
fd = open (filename, O_RDONLY);
if (fd < 0 || (fstat (fd, &finfo) == -1))
{
file_error_and_exit:
if (((flags & FEVAL_ENOENTOK) == 0) || errno != ENOENT)
file_error (filename);
if (flags & FEVAL_LONGJMP)
{
last_command_exit_value = 1;
jump_to_top_level (EXITPROG);
}
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE
: ((errno == ENOENT) ? 0 : -1));
}
errfunc = ((flags & FEVAL_BUILTIN) ? builtin_error : internal_error);
if (S_ISDIR (finfo.st_mode))
{
(*errfunc) (_("%s: is a directory"), filename);
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE : -1);
}
else if ((flags & FEVAL_REGFILE) && S_ISREG (finfo.st_mode) == 0)
{
(*errfunc) (_("%s: not a regular file"), filename);
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE : -1);
}
file_size = (size_t)finfo.st_size;
/* Check for overflow with large files. */
if (file_size != finfo.st_size || file_size + 1 < file_size)
{
(*errfunc) (_("%s: file is too large"), filename);
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE : -1);
}
#if defined (__CYGWIN__) && defined (O_TEXT)
setmode (fd, O_TEXT);
#endif
string = (char *)xmalloc (1 + file_size);
result = read (fd, string, file_size);
string[result] = '\0';
return_val = errno;
close (fd);
errno = return_val;
if (result < 0) /* XXX was != file_size, not < 0 */
{
free (string);
goto file_error_and_exit;
}
if (result == 0)
{
free (string);
return ((flags & FEVAL_BUILTIN) ? EXECUTION_SUCCESS : 1);
}
if ((flags & FEVAL_CHECKBINARY) &&
check_binary_file (string, (result > 80) ? 80 : result))
{
free (string);
(*errfunc) ("%s: cannot execute binary file", filename);
return ((flags & FEVAL_BUILTIN) ? EX_BINARY_FILE : -1);
}
if (flags & FEVAL_UNWINDPROT)
{
begin_unwind_frame ("_evalfile");
unwind_protect_int (return_catch_flag);
unwind_protect_jmp_buf (return_catch);
if (flags & FEVAL_NONINT)
unwind_protect_int (interactive);
unwind_protect_int (sourcelevel);
}
else
{
COPY_PROCENV (return_catch, old_return_catch);
if (flags & FEVAL_NONINT)
old_interactive = interactive;
}
if (flags & FEVAL_NONINT)
interactive = 0;
return_catch_flag++;
sourcelevel++;
#if defined (ARRAY_VARS)
array_push (bash_source_a, (char *)filename);
t = itos (executing_line_number ());
array_push (bash_lineno_a, t);
free (t);
array_push (funcname_a, "source"); /* not exactly right */
# if defined (DEBUGGER)
/* Have to figure out a better way to do this when `source' is supplied
arguments */
if ((flags & FEVAL_NOPUSHARGS) == 0)
{
array_push (bash_argv_a, (char *)filename);
tt[0] = '1'; tt[1] = '\0';
array_push (bash_argc_a, tt);
}
# endif
#endif
/* set the flags to be passed to parse_and_execute */
pflags = SEVAL_RESETLINE;
pflags |= (flags & FEVAL_HISTORY) ? 0 : SEVAL_NOHIST;
if (flags & FEVAL_BUILTIN)
result = EXECUTION_SUCCESS;
return_val = setjmp (return_catch);
/* If `return' was seen outside of a function, but in the script, then
force parse_and_execute () to clean up. */
if (return_val)
{
parse_and_execute_cleanup ();
result = return_catch_value;
}
else
result = parse_and_execute (string, filename, pflags);
if (flags & FEVAL_UNWINDPROT)
run_unwind_frame ("_evalfile");
else
{
if (flags & FEVAL_NONINT)
interactive = old_interactive;
return_catch_flag--;
sourcelevel--;
COPY_PROCENV (old_return_catch, return_catch);
}
#if defined (ARRAY_VARS)
/* These two variables cannot be unset, and cannot be affected by the
function. */
array_pop (bash_source_a);
array_pop (bash_lineno_a);
/* FUNCNAME can be unset, and so can potentially be changed by the
function. */
GET_ARRAY_FROM_VAR ("FUNCNAME", nfv, funcname_a);
if (nfv == funcname_v)
array_pop (funcname_a);
# if defined (DEBUGGER)
if ((flags & FEVAL_NOPUSHARGS) == 0)
{
array_pop (bash_argc_a);
array_pop (bash_argv_a);
}
# endif
#endif
return ((flags & FEVAL_BUILTIN) ? result : 1);
}
int
maybe_execute_file (fname, force_noninteractive)
const char *fname;
int force_noninteractive;
{
char *filename;
int result, flags;
filename = bash_tilde_expand (fname, 0);
flags = FEVAL_ENOENTOK;
if (force_noninteractive)
flags |= FEVAL_NONINT;
result = _evalfile (filename, flags);
free (filename);
return result;
}
#if defined (HISTORY)
int
fc_execute_file (filename)
const char *filename;
{
int flags;
/* We want these commands to show up in the history list if
remember_on_history is set. */
flags = FEVAL_ENOENTOK|FEVAL_HISTORY|FEVAL_REGFILE;
return (_evalfile (filename, flags));
}
#endif /* HISTORY */
int
source_file (filename, sflags)
const char *filename;
int sflags;
{
int flags, rval;
flags = FEVAL_BUILTIN|FEVAL_UNWINDPROT|FEVAL_NONINT;
if (sflags)
flags |= FEVAL_NOPUSHARGS;
/* POSIX shells exit if non-interactive and file error. */
if (posixly_correct && !interactive_shell)
flags |= FEVAL_LONGJMP;
rval = _evalfile (filename, flags);
run_return_trap ();
return rval;
}
+10 -8
View File
@@ -4166,13 +4166,15 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
sseett [----aabbeeffhhkkmmnnppttuuvvxxBBCCHHPP] [--oo _o_p_t_i_o_n] [_a_r_g ...]
Without options, the name and value of each shell variable are
displayed in a format that can be reused as input. The output
is sorted according to the current locale. When options are
specified, they set or unset shell attributes. Any arguments
remaining after the options are processed are treated as values
for the positional parameters and are assigned, in order, to $$11,
$$22, ...... $$_n. Options, if specified, have the following mean-
ings:
displayed in a format that can be reused as input for setting or
resetting the currently-set variables. Read-only variables can-
not be reset. In _p_o_s_i_x _m_o_d_e, only shell variables are listed.
The output is sorted according to the current locale. When
options are specified, they set or unset shell attributes. Any
arguments remaining after the options are processed are treated
as values for the positional parameters and are assigned, in
order, to $$11, $$22, ...... $$_n. Options, if specified, have the fol-
lowing meanings:
--aa Automatically mark variables and functions which are
modified or created for export to the environment of
subsequent commands.
@@ -4246,7 +4248,7 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
is disabled by default.
ppoossiixx Change the behavior of bbaasshh where the default
operation differs from the POSIX 1003.2 standard
to match the standard (_`_p_o_s_i_x _m_o_d_e).
to match the standard (_p_o_s_i_x _m_o_d_e).
pprriivviilleeggeedd
Same as --pp.
vveerrbboossee Same as --vv.
+5 -2
View File
@@ -7483,7 +7483,10 @@ before execution resumes after the function or script.
.TP
\fBset\fP [\fB\-\-abefhkmnptuvxBCHP\fP] [\fB\-o\fP \fIoption\fP] [\fIarg\fP ...]
Without options, the name and value of each shell variable are displayed
in a format that can be reused as input.
in a format that can be reused as input
for setting or resetting the currently-set variables.
Read-only variables cannot be reset.
In \fIposix mode\fP, only shell variables are listed.
The output is sorted according to the current locale.
When options are specified, they set or unset shell attributes.
Any arguments remaining after the options are processed are treated
@@ -7656,7 +7659,7 @@ This option is disabled by default.
Change the behavior of
.B bash
where the default operation differs
from the POSIX 1003.2 standard to match the standard (\fI`posix mode\fP).
from the POSIX 1003.2 standard to match the standard (\fIposix mode\fP).
.TP 8
.B privileged
Same as
+6 -3
View File
@@ -9611,7 +9611,10 @@ Any command associated with the <B>RETURN</B> trap is executed
before execution resumes after the function or script.
<DT><B>set</B> [<B>--abefhkmnptuvxBCHP</B>] [<B>-o</B> <I>option</I>] [<I>arg</I> ...]<DD>
Without options, the name and value of each shell variable are displayed
in a format that can be reused as input.
in a format that can be reused as input
for setting or resetting the currently-set variables.
Read-only variables cannot be reset.
In <I>posix mode</I>, only shell variables are listed.
The output is sorted according to the current locale.
When options are specified, they set or unset shell attributes.
Any arguments remaining after the options are processed are treated
@@ -9849,7 +9852,7 @@ Change the behavior of
<B>bash</B>
where the default operation differs
from the POSIX 1003.2 standard to match the standard (<I>`posix mode</I>).
from the POSIX 1003.2 standard to match the standard (<I>posix mode</I>).
<DT><B>privileged</B>
<DD>
@@ -11406,6 +11409,6 @@ Array variables may not (yet) be exported.
</DL>
<HR>
This document was created by man2html from bash.1.<BR>
Time: 22 November 2004 12:04:08 EST
Time: 24 November 2004 15:49:41 EST
</BODY>
</HTML>
+613 -613
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -149,7 +149,7 @@
@xrdef{The Set Builtin-pg}{50}
@xrdef{The Set Builtin-snt}{Section@tie 4.3}
@xrdef{Special Builtins-title}{Special Builtins}
@xrdef{Special Builtins-pg}{53}
@xrdef{Special Builtins-pg}{54}
@xrdef{Special Builtins-snt}{Section@tie 4.4}
@xrdef{Shell Variables-title}{Shell Variables}
@xrdef{Shell Variables-pg}{55}
+1 -1
View File
@@ -70,7 +70,7 @@
\entry{exit status}{31}{exit status}
\entry{signal handling}{31}{signal handling}
\entry{shell script}{32}{shell script}
\entry{special builtin}{53}{special builtin}
\entry{special builtin}{54}{special builtin}
\entry{login shell}{65}{login shell}
\entry{interactive shell}{65}{interactive shell}
\entry{startup files}{65}{startup files}
+1 -1
View File
@@ -119,7 +119,7 @@
\entry {shell, interactive}{67}
\entry {signal}{4}
\entry {signal handling}{31}
\entry {special builtin}{4, 53}
\entry {special builtin}{4, 54}
\entry {startup files}{65}
\entry {suspending jobs}{81}
\initial {T}
BIN
View File
Binary file not shown.
+9 -6
View File
@@ -1,6 +1,6 @@
<HTML>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created on November, 22 2004 by texi2html 1.64 -->
<!-- Created on November, 24 2004 by texi2html 1.64 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
@@ -33,10 +33,10 @@ Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
<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, 22 November 2004)..
the Bash shell (version 3.1-devel, 24 November 2004)..
</P><P>
This is Edition 3.1-devel, last updated 22 November 2004,
This is Edition 3.1-devel, last updated 24 November 2004,
of <CITE>The GNU Bash Reference Manual</CITE>,
for <CODE>Bash</CODE>, Version 3.1-devel.
</P><P>
@@ -5122,7 +5122,10 @@ This builtin is so complicated that it deserves its own section.
If no options or arguments are supplied, <CODE>set</CODE> 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 POSIX mode, only shell variables are listed.
</P><P>
When options are supplied, they set or unset shell attributes.
@@ -15097,7 +15100,7 @@ to permit their use in free software.
<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>November, 22 2004</I>
This document was generated by <I>Chet Ramey</I> on <I>November, 24 2004</I>
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>
<P></P>
@@ -15259,7 +15262,7 @@ the following structure:
<BR>
<FONT SIZE="-1">
This document was generated
by <I>Chet Ramey</I> on <I>November, 22 2004</I>
by <I>Chet Ramey</I> on <I>November, 24 2004</I>
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>
+81 -78
View File
@@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 4.7 from
/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, 22 November 2004).
the Bash shell (version 3.1-devel, 24 November 2004).
This is Edition 3.1-devel, last updated 22 November 2004, of `The
This is Edition 3.1-devel, last updated 24 November 2004, of `The
GNU Bash Reference Manual', for `Bash', Version 3.1-devel.
Copyright (C) 1988-2004 Free Software Foundation, Inc.
@@ -37,9 +37,9 @@ Bash Features
*************
This text is a brief description of the features that are present in
the Bash shell (version 3.1-devel, 22 November 2004)..
the Bash shell (version 3.1-devel, 24 November 2004)..
This is Edition 3.1-devel, last updated 22 November 2004, of `The
This is Edition 3.1-devel, last updated 24 November 2004, of `The
GNU Bash Reference Manual', for `Bash', Version 3.1-devel.
Bash contains features that appear in other popular shells, and some
@@ -3357,7 +3357,10 @@ This builtin is so complicated that it deserves its own section.
If no options or arguments are supplied, `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.
to the 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 POSIX mode, only shell variables
are listed.
When options are supplied, they set or unset shell attributes.
Options, if specified, have the following meanings:
@@ -9490,78 +9493,78 @@ Node: Shell Builtin Commands93376
Node: Bourne Shell Builtins94955
Node: Bash Builtins111908
Node: The Set Builtin140035
Node: Special Builtins148258
Node: Shell Variables149235
Node: Bourne Shell Variables149675
Node: Bash Variables151656
Node: Bash Features171363
Node: Invoking Bash172246
Node: Bash Startup Files178067
Node: Interactive Shells182925
Node: What is an Interactive Shell?183335
Node: Is this Shell Interactive?183985
Node: Interactive Shell Behavior184800
Node: Bash Conditional Expressions188076
Node: Shell Arithmetic191655
Node: Aliases194401
Node: Arrays196969
Node: The Directory Stack200236
Node: Directory Stack Builtins200950
Node: Printing a Prompt203841
Node: The Restricted Shell206555
Node: Bash POSIX Mode208387
Node: Job Control215720
Node: Job Control Basics216187
Node: Job Control Builtins220563
Node: Job Control Variables224915
Node: Command Line Editing226073
Node: Introduction and Notation227072
Node: Readline Interaction228694
Node: Readline Bare Essentials229885
Node: Readline Movement Commands231674
Node: Readline Killing Commands232639
Node: Readline Arguments234559
Node: Searching235603
Node: Readline Init File237789
Node: Readline Init File Syntax238848
Node: Conditional Init Constructs250707
Node: Sample Init File253240
Node: Bindable Readline Commands256357
Node: Commands For Moving257564
Node: Commands For History258425
Node: Commands For Text261580
Node: Commands For Killing264253
Node: Numeric Arguments266395
Node: Commands For Completion267534
Node: Keyboard Macros271127
Node: Miscellaneous Commands271698
Node: Readline vi Mode277009
Node: Programmable Completion277923
Node: Programmable Completion Builtins283735
Node: Using History Interactively291331
Node: Bash History Facilities292011
Node: Bash History Builtins294706
Node: History Interaction298563
Node: Event Designators301119
Node: Word Designators302134
Node: Modifiers303773
Node: Installing Bash305179
Node: Basic Installation306316
Node: Compilers and Options309008
Node: Compiling For Multiple Architectures309749
Node: Installation Names311413
Node: Specifying the System Type312231
Node: Sharing Defaults312947
Node: Operation Controls313620
Node: Optional Features314578
Node: Reporting Bugs322857
Node: Major Differences From The Bourne Shell324051
Node: Copying This Manual339823
Node: GNU Free Documentation License340099
Node: Builtin Index362505
Node: Reserved Word Index369054
Node: Variable Index371490
Node: Function Index382350
Node: Concept Index389070
Node: Special Builtins148413
Node: Shell Variables149390
Node: Bourne Shell Variables149830
Node: Bash Variables151811
Node: Bash Features171518
Node: Invoking Bash172401
Node: Bash Startup Files178222
Node: Interactive Shells183080
Node: What is an Interactive Shell?183490
Node: Is this Shell Interactive?184140
Node: Interactive Shell Behavior184955
Node: Bash Conditional Expressions188231
Node: Shell Arithmetic191810
Node: Aliases194556
Node: Arrays197124
Node: The Directory Stack200391
Node: Directory Stack Builtins201105
Node: Printing a Prompt203996
Node: The Restricted Shell206710
Node: Bash POSIX Mode208542
Node: Job Control215875
Node: Job Control Basics216342
Node: Job Control Builtins220718
Node: Job Control Variables225070
Node: Command Line Editing226228
Node: Introduction and Notation227227
Node: Readline Interaction228849
Node: Readline Bare Essentials230040
Node: Readline Movement Commands231829
Node: Readline Killing Commands232794
Node: Readline Arguments234714
Node: Searching235758
Node: Readline Init File237944
Node: Readline Init File Syntax239003
Node: Conditional Init Constructs250862
Node: Sample Init File253395
Node: Bindable Readline Commands256512
Node: Commands For Moving257719
Node: Commands For History258580
Node: Commands For Text261735
Node: Commands For Killing264408
Node: Numeric Arguments266550
Node: Commands For Completion267689
Node: Keyboard Macros271282
Node: Miscellaneous Commands271853
Node: Readline vi Mode277164
Node: Programmable Completion278078
Node: Programmable Completion Builtins283890
Node: Using History Interactively291486
Node: Bash History Facilities292166
Node: Bash History Builtins294861
Node: History Interaction298718
Node: Event Designators301274
Node: Word Designators302289
Node: Modifiers303928
Node: Installing Bash305334
Node: Basic Installation306471
Node: Compilers and Options309163
Node: Compiling For Multiple Architectures309904
Node: Installation Names311568
Node: Specifying the System Type312386
Node: Sharing Defaults313102
Node: Operation Controls313775
Node: Optional Features314733
Node: Reporting Bugs323012
Node: Major Differences From The Bourne Shell324206
Node: Copying This Manual339978
Node: GNU Free Documentation License340254
Node: Builtin Index362660
Node: Reserved Word Index369209
Node: Variable Index371645
Node: Function Index382505
Node: Concept Index389225

End Tag Table
+8 -8
View File
@@ -1,4 +1,4 @@
This is TeX, Version 3.14159 (Web2C 7.4.5) (format=tex 2003.12.31) 22 NOV 2004 12:04
This is TeX, Version 3.14159 (Web2C 7.4.5) (format=tex 2003.12.31) 24 NOV 2004 15:49
**/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,
@@ -199,7 +199,7 @@ me-
.etc.
[44] [45] [46] [47] [48] [49] [50] [51]
Underfull \hbox (badness 4036) in paragraph at lines 4075--4082
Underfull \hbox (badness 4036) in paragraph at lines 4078--4085
@texttt -x[]@textrm Print a trace of sim-ple com-mands, @texttt \@textrm fB-fo
r@texttt \@textrm fP com-mands,
@@ -212,7 +212,7 @@ 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 4792--4792
Overfull \hbox (51.96864pt too wide) in paragraph at lines 4795--4795
[]@texttt bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@t
exttt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
@@ -225,7 +225,7 @@ exttt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
.etc.
Overfull \hbox (76.23077pt too wide) in paragraph at lines 4793--4793
Overfull \hbox (76.23077pt too wide) in paragraph at lines 4796--4796
[]@texttt bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@texttt
] [-O @textttsl shopt_option@texttt ] -c @textttsl string @texttt [@textttsl ar
-
@@ -239,7 +239,7 @@ Overfull \hbox (76.23077pt too wide) in paragraph at lines 4793--4793
.etc.
Overfull \hbox (34.72258pt too wide) in paragraph at lines 4794--4794
Overfull \hbox (34.72258pt too wide) in paragraph at lines 4797--4797
[]@texttt bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@text
tt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
@@ -252,7 +252,7 @@ tt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
.etc.
[63] [64]
Underfull \hbox (badness 2245) in paragraph at lines 4968--4970
Underfull \hbox (badness 2245) in paragraph at lines 4971--4973
[]@textrm When a lo-gin shell ex-its, Bash reads and ex-e-cutes com-mands from
the file
@@ -320,7 +320,7 @@ Underfull \hbox (badness 2753) in paragraph at lines 1758--1761
[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 6666--6670
Underfull \hbox (badness 2772) in paragraph at lines 6669--6673
[]@textrm Enable sup-port for large files (@texttt http://www.sas.com/standard
s/large_
@@ -365,4 +365,4 @@ Here is how much of TeX's memory you used:
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, 584368 bytes).
Output written on bashref.dvi (156 pages, 584548 bytes).
+190 -187
View File
@@ -10,7 +10,7 @@
%DVIPSWebPage: (www.radicaleye.com)
%DVIPSCommandLine: dvips -D 600 -t letter -o bashref.ps bashref.dvi
%DVIPSParameters: dpi=600, compressed
%DVIPSSource: TeX output 2004.11.22:1204
%DVIPSSource: TeX output 2004.11.24:1549
%%BeginProcSet: texc.pro
%!
/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
@@ -4235,9 +4235,9 @@ b(ree)45 b(Soft)l(w)l(are)h(F)-11 b(oundation)p 150 5141
%%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(22)e(No)m
(the)h(Bash)f(shell)h(\(v)m(ersion)150 2999 y(3.1-dev)m(el,)d(24)e(No)m
(v)m(em)m(b)s(er)h(2004\).)150 3133 y(This)38 b(is)i(Edition)f(3.1-dev)
m(el,)44 b(last)c(up)s(dated)e(22)i(No)m(v)m(em)m(b)s(er)g(2004,)j(of)c
m(el,)44 b(last)c(up)s(dated)e(24)i(No)m(v)m(em)m(b)s(er)g(2004,)j(of)c
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
@@ -7735,7 +7735,7 @@ Fs(enable)e Ft(to)i(the)f Fl(posix)g Ft(sp)s(ecial)h(builtins.)40
b(If)27 b(`)p Fs(-s)p Ft(')i(is)f(used)g(with)g(`)p Fs(-f)p
Ft(',)h(the)f(new)630 2136 y(builtin)i(b)s(ecomes)h(a)f(sp)s(ecial)h
(builtin)f(\(see)i(Section)f(4.4)g([Sp)s(ecial)g(Builtins],)g(page)g
(53\).)630 2266 y(The)26 b(return)f(status)h(is)g(zero)h(unless)e(a)i
(54\).)630 2266 y(The)26 b(return)f(status)h(is)g(zero)h(unless)e(a)i
Fq(name)k Ft(is)26 b(not)g(a)h(shell)f(builtin)g(or)g(there)g(is)g(an)g
(error)630 2376 y(loading)31 b(a)g(new)f(builtin)g(from)g(a)g(shared)g
(ob)5 b(ject.)150 2527 y Fs(help)870 2658 y(help)47 b([-s])f([)p
@@ -8171,261 +8171,264 @@ p eop end
TeXDict begin 50 55 bop 150 -116 a Ft(50)2572 b(Bash)31
b(Reference)g(Man)m(ual)630 299 y Fs(-u)384 b Ft(The)30
b(maxim)m(um)g(n)m(um)m(b)s(er)f(of)i(pro)s(cesses)f(a)m(v)-5
b(ailable)33 b(to)e(a)f(single)i(user.)630 458 y Fs(-v)384
b(ailable)33 b(to)e(a)f(single)i(user.)630 461 y Fs(-v)384
b Ft(The)29 b(maxim)m(um)h(amoun)m(t)g(of)g(virtual)g(memory)g(a)m(v)-5
b(ailable)32 b(to)e(the)g(pro)s(cess.)630 617 y(If)j
b(ailable)32 b(to)e(the)g(pro)s(cess.)630 624 y(If)j
Fq(limit)j Ft(is)e(giv)m(en,)h(it)f(is)g(the)g(new)f(v)-5
b(alue)34 b(of)f(the)h(sp)s(eci\014ed)f(resource;)i(the)f(sp)s(ecial)g
Fq(limit)630 727 y Ft(v)-5 b(alues)27 b Fs(hard)p Ft(,)g
Fq(limit)630 733 y Ft(v)-5 b(alues)27 b Fs(hard)p Ft(,)g
Fs(soft)p Ft(,)g(and)g Fs(unlimited)d Ft(stand)j(for)g(the)g(curren)m
(t)g(hard)f(limit,)j(the)e(curren)m(t)630 836 y(soft)35
(t)g(hard)f(limit,)j(the)e(curren)m(t)630 843 y(soft)35
b(limit,)i(and)e(no)f(limit,)j(resp)s(ectiv)m(ely)-8
b(.)56 b(Otherwise,)36 b(the)f(curren)m(t)g(v)-5 b(alue)35
b(of)g(the)h(soft)630 946 y(limit)41 b(for)f(the)h(sp)s(eci\014ed)f
b(of)g(the)h(soft)630 953 y(limit)41 b(for)f(the)h(sp)s(eci\014ed)f
(resource)h(is)f(prin)m(ted,)j(unless)d(the)g(`)p Fs(-H)p
Ft(')h(option)f(is)h(supplied.)630 1056 y(When)29 b(setting)h(new)e
Ft(')h(option)f(is)h(supplied.)630 1062 y(When)29 b(setting)h(new)e
(limits,)i(if)f(neither)g(`)p Fs(-H)p Ft(')f(nor)h(`)p
Fs(-S)p Ft(')f(is)h(supplied,)g(b)s(oth)f(the)h(hard)f(and)630
1165 y(soft)37 b(limits)g(are)g(set.)60 b(If)36 b(no)g(option)h(is)g
1172 y(soft)37 b(limits)g(are)g(set.)60 b(If)36 b(no)g(option)h(is)g
(giv)m(en,)i(then)d(`)p Fs(-f)p Ft(')h(is)f(assumed.)59
b(V)-8 b(alues)37 b(are)g(in)630 1275 y(1024-b)m(yte)27
b(V)-8 b(alues)37 b(are)g(in)630 1281 y(1024-b)m(yte)27
b(incremen)m(ts,)g(except)e(for)f(`)p Fs(-t)p Ft(',)i(whic)m(h)e(is)h
(in)f(seconds,)i(`)p Fs(-p)p Ft(',)g(whic)m(h)e(is)g(in)h(units)630
1384 y(of)31 b(512-b)m(yte)h(blo)s(c)m(ks,)f(and)f(`)p
1391 y(of)31 b(512-b)m(yte)h(blo)s(c)m(ks,)f(and)f(`)p
Fs(-n)p Ft(')g(and)g(`)p Fs(-u)p Ft(',)h(whic)m(h)f(are)g(unscaled)h(v)
-5 b(alues.)630 1519 y(The)34 b(return)g(status)h(is)f(zero)i(unless)e
-5 b(alues.)630 1527 y(The)34 b(return)g(status)h(is)f(zero)i(unless)e
(an)g(in)m(v)-5 b(alid)36 b(option)f(or)f(argumen)m(t)i(is)e(supplied,)
h(or)630 1628 y(an)30 b(error)g(o)s(ccurs)g(while)h(setting)g(a)g(new)f
(limit.)150 1787 y Fs(unalias)870 1922 y(unalias)46 b([-a])g([)p
Fj(name)57 b Fs(...)47 b(])630 2056 y Ft(Remo)m(v)m(e)39
h(or)630 1637 y(an)30 b(error)g(o)s(ccurs)g(while)h(setting)g(a)g(new)f
(limit.)150 1799 y Fs(unalias)870 1935 y(unalias)46 b([-a])g([)p
Fj(name)57 b Fs(...)47 b(])630 2071 y Ft(Remo)m(v)m(e)39
b(eac)m(h)f Fq(name)k Ft(from)36 b(the)h(list)h(of)f(aliases.)61
b(If)36 b(`)p Fs(-a)p Ft(')h(is)g(supplied,)h(all)f(aliases)i(are)630
2166 y(remo)m(v)m(ed.)j(Aliases)31 b(are)g(describ)s(ed)e(in)h(Section)
i(6.6)f([Aliases],)h(page)f(71.)150 2423 y Fr(4.3)68
b(The)45 b(Set)g(Builtin)275 2667 y Ft(This)29 b(builtin)h(is)g(so)h
2181 y(remo)m(v)m(ed.)j(Aliases)31 b(are)g(describ)s(ed)e(in)h(Section)
i(6.6)f([Aliases],)h(page)f(71.)150 2446 y Fr(4.3)68
b(The)45 b(Set)g(Builtin)275 2693 y Ft(This)29 b(builtin)h(is)g(so)h
(complicated)h(that)f(it)g(deserv)m(es)g(its)g(o)m(wn)f(section.)150
2826 y Fs(set)870 2960 y(set)47 b([--abefhkmnptuvxBCHP])42
2857 y Fs(set)870 2993 y(set)47 b([--abefhkmnptuvxBCHP])42
b([-o)47 b Fj(option)11 b Fs(])45 b([)p Fj(argument)56
b Fs(...)o(])630 3095 y Ft(If)31 b(no)h(options)h(or)e(argumen)m(ts)i
(are)f(supplied,)f Fs(set)g Ft(displa)m(ys)h(the)g(names)g(and)g(v)-5
b(alues)32 b(of)630 3204 y(all)41 b(shell)f(v)-5 b(ariables)40
b(and)f(functions,)j(sorted)e(according)g(to)h(the)f(curren)m(t)f(lo)s
(cale,)44 b(in)c(a)630 3314 y(format)31 b(that)g(ma)m(y)g(b)s(e)e
(reused)h(as)h(input.)630 3448 y(When)e(options)g(are)g(supplied,)f
(they)h(set)h(or)f(unset)f(shell)h(attributes.)41 b(Options,)29
b(if)g(sp)s(ec-)630 3558 y(i\014ed,)h(ha)m(v)m(e)i(the)e(follo)m(wing)i
(meanings:)630 3717 y Fs(-a)384 b Ft(Mark)32 b(v)-5 b(ariables)33
b(and)e(function)h(whic)m(h)g(are)g(mo)s(di\014ed)f(or)h(created)h(for)
f(ex-)1110 3827 y(p)s(ort)e(to)h(the)f(en)m(vironmen)m(t)h(of)g
(subsequen)m(t)f(commands.)630 3986 y Fs(-b)384 b Ft(Cause)44
b(the)h(status)g(of)f(terminated)h(bac)m(kground)g(jobs)f(to)h(b)s(e)f
(rep)s(orted)1110 4095 y(immediately)-8 b(,)30 b(rather)d(than)f(b)s
(efore)h(prin)m(ting)g(the)g(next)g(primary)g(prompt.)630
4255 y Fs(-e)384 b Ft(Exit)37 b(immediately)h(if)e(a)h(simple)f
(command)g(\(see)i(Section)f(3.2.1)h([Simple)1110 4364
y(Commands],)31 b(page)i(8\))f(exits)g(with)g(a)g(non-zero)g(status,)g
(unless)f(the)h(com-)1110 4474 y(mand)f(that)h(fails)h(is)f(part)f(of)h
(the)g(command)g(list)g(immediately)h(follo)m(wing)1110
4583 y(a)41 b Fs(while)d Ft(or)j Fs(until)e Ft(k)m(eyw)m(ord,)k(part)d
(of)g(the)h(test)g(in)f(an)g Fs(if)g Ft(statemen)m(t,)1110
4693 y(part)33 b(of)h(a)g Fs(&&)f Ft(or)g Fs(||)g Ft(list,)i(or)e(if)h
(the)f(command's)h(return)e(status)i(is)f(b)s(eing)1110
4802 y(in)m(v)m(erted)e(using)e Fs(!)p Ft(.)40 b(A)30
b(trap)f(on)h Fs(ERR)p Ft(,)f(if)h(set,)g(is)g(executed)h(b)s(efore)e
(the)h(shell)1110 4912 y(exits.)630 5071 y Fs(-f)384
b Ft(Disable)31 b(\014le)g(name)f(generation)i(\(globbing\).)630
5230 y Fs(-h)384 b Ft(Lo)s(cate)33 b(and)e(remem)m(b)s(er)h(\(hash\))g
(commands)f(as)h(they)g(are)g(lo)s(ok)m(ed)h(up)e(for)1110
5340 y(execution.)42 b(This)29 b(option)i(is)g(enabled)f(b)m(y)g
(default.)p eop end
b Fs(...)o(])630 3129 y Ft(If)22 b(no)h(options)g(or)g(argumen)m(ts)g
(are)g(supplied,)g Fs(set)f Ft(displa)m(ys)g(the)h(names)g(and)f(v)-5
b(alues)23 b(of)g(all)630 3239 y(shell)j(v)-5 b(ariables)27
b(and)e(functions,)h(sorted)g(according)h(to)g(the)f(curren)m(t)f(lo)s
(cale,)k(in)c(a)i(format)630 3348 y(that)i(ma)m(y)h(b)s(e)e(reused)g
(as)h(input)f(for)h(setting)h(or)e(resetting)i(the)f(curren)m(tly-set)h
(v)-5 b(ariables.)630 3458 y(Read-only)37 b(v)-5 b(ariables)37
b(cannot)h(b)s(e)e(reset.)59 b(In)36 b Fl(posix)g Ft(mo)s(de,)i(only)f
(shell)f(v)-5 b(ariables)38 b(are)630 3568 y(listed.)630
3704 y(When)29 b(options)g(are)g(supplied,)f(they)h(set)h(or)f(unset)f
(shell)h(attributes.)41 b(Options,)29 b(if)g(sp)s(ec-)630
3813 y(i\014ed,)h(ha)m(v)m(e)i(the)e(follo)m(wing)i(meanings:)630
3976 y Fs(-a)384 b Ft(Mark)32 b(v)-5 b(ariables)33 b(and)e(function)h
(whic)m(h)g(are)g(mo)s(di\014ed)f(or)h(created)h(for)f(ex-)1110
4085 y(p)s(ort)e(to)h(the)f(en)m(vironmen)m(t)h(of)g(subsequen)m(t)f
(commands.)630 4248 y Fs(-b)384 b Ft(Cause)44 b(the)h(status)g(of)f
(terminated)h(bac)m(kground)g(jobs)f(to)h(b)s(e)f(rep)s(orted)1110
4357 y(immediately)-8 b(,)30 b(rather)d(than)f(b)s(efore)h(prin)m(ting)
g(the)g(next)g(primary)g(prompt.)630 4520 y Fs(-e)384
b Ft(Exit)37 b(immediately)h(if)e(a)h(simple)f(command)g(\(see)i
(Section)f(3.2.1)h([Simple)1110 4630 y(Commands],)31
b(page)i(8\))f(exits)g(with)g(a)g(non-zero)g(status,)g(unless)f(the)h
(com-)1110 4739 y(mand)f(that)h(fails)h(is)f(part)f(of)h(the)g(command)
g(list)g(immediately)h(follo)m(wing)1110 4849 y(a)41
b Fs(while)d Ft(or)j Fs(until)e Ft(k)m(eyw)m(ord,)k(part)d(of)g(the)h
(test)g(in)f(an)g Fs(if)g Ft(statemen)m(t,)1110 4958
y(part)33 b(of)h(a)g Fs(&&)f Ft(or)g Fs(||)g Ft(list,)i(or)e(if)h(the)f
(command's)h(return)e(status)i(is)f(b)s(eing)1110 5068
y(in)m(v)m(erted)e(using)e Fs(!)p Ft(.)40 b(A)30 b(trap)f(on)h
Fs(ERR)p Ft(,)f(if)h(set,)g(is)g(executed)h(b)s(efore)e(the)h(shell)
1110 5177 y(exits.)630 5340 y Fs(-f)384 b Ft(Disable)31
b(\014le)g(name)f(generation)i(\(globbing\).)p eop end
%%Page: 51 57
TeXDict begin 51 56 bop 150 -116 a Ft(Chapter)30 b(4:)41
b(Shell)30 b(Builtin)h(Commands)2069 b(51)630 299 y Fs(-k)384
b Ft(All)34 b(argumen)m(ts)g(in)f(the)h(form)f(of)g(assignmen)m(t)h
(statemen)m(ts)i(are)d(placed)h(in)1110 408 y(the)k(en)m(vironmen)m(t)g
(for)g(a)g(command,)h(not)f(just)f(those)i(that)f(precede)g(the)1110
518 y(command)30 b(name.)630 677 y Fs(-m)384 b Ft(Job)30
b(con)m(trol)i(is)e(enabled)h(\(see)g(Chapter)f(7)g([Job)h(Con)m
(trol],)g(page)g(81\).)630 837 y Fs(-n)384 b Ft(Read)21
b(commands)f(but)g(do)h(not)g(execute)h(them;)i(this)d(ma)m(y)g(b)s(e)f
(used)g(to)h(c)m(hec)m(k)1110 946 y(a)42 b(script)g(for)g(syn)m(tax)g
(errors.)75 b(This)41 b(option)h(is)g(ignored)g(b)m(y)g(in)m(teractiv)m
(e)1110 1056 y(shells.)630 1215 y Fs(-o)30 b Fj(option-name)1110
1325 y Ft(Set)h(the)f(option)h(corresp)s(onding)e(to)i
Fq(option-name)5 b Ft(:)1110 1484 y Fs(allexport)1590
1594 y Ft(Same)30 b(as)h Fs(-a)p Ft(.)1110 1753 y Fs(braceexpand)1590
1863 y Ft(Same)f(as)h Fs(-B)p Ft(.)1110 2022 y Fs(emacs)240
b(Shell)30 b(Builtin)h(Commands)2069 b(51)630 299 y Fs(-h)384
b Ft(Lo)s(cate)33 b(and)e(remem)m(b)s(er)h(\(hash\))g(commands)f(as)h
(they)g(are)g(lo)s(ok)m(ed)h(up)e(for)1110 408 y(execution.)42
b(This)29 b(option)i(is)g(enabled)f(b)m(y)g(default.)630
570 y Fs(-k)384 b Ft(All)34 b(argumen)m(ts)g(in)f(the)h(form)f(of)g
(assignmen)m(t)h(statemen)m(ts)i(are)d(placed)h(in)1110
680 y(the)k(en)m(vironmen)m(t)g(for)g(a)g(command,)h(not)f(just)f
(those)i(that)f(precede)g(the)1110 789 y(command)30 b(name.)630
951 y Fs(-m)384 b Ft(Job)30 b(con)m(trol)i(is)e(enabled)h(\(see)g
(Chapter)f(7)g([Job)h(Con)m(trol],)g(page)g(81\).)630
1113 y Fs(-n)384 b Ft(Read)21 b(commands)f(but)g(do)h(not)g(execute)h
(them;)i(this)d(ma)m(y)g(b)s(e)f(used)g(to)h(c)m(hec)m(k)1110
1223 y(a)42 b(script)g(for)g(syn)m(tax)g(errors.)75 b(This)41
b(option)h(is)g(ignored)g(b)m(y)g(in)m(teractiv)m(e)1110
1332 y(shells.)630 1494 y Fs(-o)30 b Fj(option-name)1110
1604 y Ft(Set)h(the)f(option)h(corresp)s(onding)e(to)i
Fq(option-name)5 b Ft(:)1110 1765 y Fs(allexport)1590
1875 y Ft(Same)30 b(as)h Fs(-a)p Ft(.)1110 2037 y Fs(braceexpand)1590
2146 y Ft(Same)f(as)h Fs(-B)p Ft(.)1110 2308 y Fs(emacs)240
b Ft(Use)25 b(an)f Fs(emacs)p Ft(-st)m(yle)h(line)f(editing)h(in)m
(terface)h(\(see)g(Chapter)e(8)1590 2132 y([Command)30
b(Line)g(Editing],)h(page)g(85\).)1110 2291 y Fs(errexit)144
b Ft(Same)30 b(as)h Fs(-e)p Ft(.)1110 2451 y Fs(errtrace)96
b Ft(Same)30 b(as)h Fs(-E)p Ft(.)1110 2610 y Fs(functrace)1590
2720 y Ft(Same)f(as)h Fs(-T)p Ft(.)1110 2879 y Fs(hashall)144
b Ft(Same)30 b(as)h Fs(-h)p Ft(.)1110 3039 y Fs(histexpand)1590
3148 y Ft(Same)f(as)h Fs(-H)p Ft(.)1110 3308 y Fs(history)144
(terface)h(\(see)g(Chapter)e(8)1590 2418 y([Command)30
b(Line)g(Editing],)h(page)g(85\).)1110 2579 y Fs(errexit)144
b Ft(Same)30 b(as)h Fs(-e)p Ft(.)1110 2741 y Fs(errtrace)96
b Ft(Same)30 b(as)h Fs(-E)p Ft(.)1110 2903 y Fs(functrace)1590
3013 y Ft(Same)f(as)h Fs(-T)p Ft(.)1110 3174 y Fs(hashall)144
b Ft(Same)30 b(as)h Fs(-h)p Ft(.)1110 3336 y Fs(histexpand)1590
3446 y Ft(Same)f(as)h Fs(-H)p Ft(.)1110 3607 y Fs(history)144
b Ft(Enable)39 b(command)g(history)-8 b(,)42 b(as)d(describ)s(ed)f(in)h
(Section)h(9.1)1590 3417 y([Bash)d(History)g(F)-8 b(acilities],)41
b(page)c(111.)60 b(This)36 b(option)h(is)f(on)1590 3527
(Section)h(9.1)1590 3717 y([Bash)d(History)g(F)-8 b(acilities],)41
b(page)c(111.)60 b(This)36 b(option)h(is)f(on)1590 3827
y(b)m(y)30 b(default)h(in)f(in)m(teractiv)m(e)j(shells.)1110
3686 y Fs(ignoreeof)1590 3796 y Ft(An)d(in)m(teractiv)m(e)j(shell)e
(will)g(not)f(exit)h(up)s(on)e(reading)i(EOF.)1110 3955
3988 y Fs(ignoreeof)1590 4098 y Ft(An)d(in)m(teractiv)m(e)j(shell)e
(will)g(not)f(exit)h(up)s(on)e(reading)i(EOF.)1110 4260
y Fs(keyword)144 b Ft(Same)30 b(as)h Fs(-k)p Ft(.)1110
4115 y Fs(monitor)144 b Ft(Same)30 b(as)h Fs(-m)p Ft(.)1110
4274 y Fs(noclobber)1590 4384 y Ft(Same)f(as)h Fs(-C)p
Ft(.)1110 4543 y Fs(noexec)192 b Ft(Same)30 b(as)h Fs(-n)p
Ft(.)1110 4702 y Fs(noglob)192 b Ft(Same)30 b(as)h Fs(-f)p
Ft(.)1110 4862 y Fs(nolog)240 b Ft(Curren)m(tly)30 b(ignored.)1110
5021 y Fs(notify)192 b Ft(Same)30 b(as)h Fs(-b)p Ft(.)1110
5181 y Fs(nounset)144 b Ft(Same)30 b(as)h Fs(-u)p Ft(.)1110
5340 y Fs(onecmd)192 b Ft(Same)30 b(as)h Fs(-t)p Ft(.)p
4422 y Fs(monitor)144 b Ft(Same)30 b(as)h Fs(-m)p Ft(.)1110
4583 y Fs(noclobber)1590 4693 y Ft(Same)f(as)h Fs(-C)p
Ft(.)1110 4855 y Fs(noexec)192 b Ft(Same)30 b(as)h Fs(-n)p
Ft(.)1110 5016 y Fs(noglob)192 b Ft(Same)30 b(as)h Fs(-f)p
Ft(.)1110 5178 y Fs(nolog)240 b Ft(Curren)m(tly)30 b(ignored.)1110
5340 y Fs(notify)192 b Ft(Same)30 b(as)h Fs(-b)p Ft(.)p
eop end
%%Page: 52 58
TeXDict begin 52 57 bop 150 -116 a Ft(52)2572 b(Bash)31
b(Reference)g(Man)m(ual)1110 299 y Fs(physical)96 b Ft(Same)30
b(as)h Fs(-P)p Ft(.)1110 448 y Fs(pipefail)96 b Ft(If)44
b(Reference)g(Man)m(ual)1110 299 y Fs(nounset)144 b Ft(Same)30
b(as)h Fs(-u)p Ft(.)1110 452 y Fs(onecmd)192 b Ft(Same)30
b(as)h Fs(-t)p Ft(.)1110 606 y Fs(physical)96 b Ft(Same)30
b(as)h Fs(-P)p Ft(.)1110 759 y Fs(pipefail)96 b Ft(If)44
b(set,)k(the)d(return)e(v)-5 b(alue)45 b(of)f(a)h(pip)s(eline)e(is)i
(the)f(v)-5 b(alue)45 b(of)1590 557 y(the)33 b(last)h(\(righ)m(tmost\))
h(command)e(to)h(exit)g(with)f(a)g(non-zero)1590 667
(the)f(v)-5 b(alue)45 b(of)1590 869 y(the)33 b(last)h(\(righ)m(tmost\))
h(command)e(to)h(exit)g(with)f(a)g(non-zero)1590 978
y(status,)28 b(or)f(zero)g(if)f(all)i(commands)e(in)g(the)h(pip)s
(eline)f(exit)i(suc-)1590 776 y(cessfully)-8 b(.)41 b(This)30
b(option)h(is)f(disabled)g(b)m(y)h(default.)1110 925
y Fs(posix)240 b Ft(Change)36 b(the)g(b)s(eha)m(vior)g(of)g(Bash)g
(where)f(the)h(default)g(op)s(er-)1590 1035 y(ation)c(di\013ers)e(from)
(eline)f(exit)i(suc-)1590 1088 y(cessfully)-8 b(.)41
b(This)30 b(option)h(is)f(disabled)g(b)m(y)h(default.)1110
1241 y Fs(posix)240 b Ft(Change)36 b(the)g(b)s(eha)m(vior)g(of)g(Bash)g
(where)f(the)h(default)g(op)s(er-)1590 1351 y(ation)c(di\013ers)e(from)
g(the)h Fl(posix)f Ft(1003.2)k(standard)c(to)h(matc)m(h)1590
1144 y(the)44 b(standard)f(\(see)h(Section)h(6.11)g([Bash)f(POSIX)e(Mo)
s(de],)1590 1254 y(page)35 b(76\).)55 b(This)34 b(is)g(in)m(tended)h
1461 y(the)44 b(standard)f(\(see)h(Section)h(6.11)g([Bash)f(POSIX)e(Mo)
s(de],)1590 1570 y(page)35 b(76\).)55 b(This)34 b(is)g(in)m(tended)h
(to)g(mak)m(e)h(Bash)e(b)s(eha)m(v)m(e)i(as)f(a)1590
1363 y(strict)c(sup)s(erset)e(of)i(that)g(standard.)1110
1512 y Fs(privileged)1590 1622 y Ft(Same)f(as)h Fs(-p)p
Ft(.)1110 1771 y Fs(verbose)144 b Ft(Same)30 b(as)h Fs(-v)p
Ft(.)1110 1919 y Fs(vi)384 b Ft(Use)31 b(a)g Fs(vi)p
Ft(-st)m(yle)g(line)g(editing)g(in)m(terface.)1110 2068
1680 y(strict)c(sup)s(erset)e(of)i(that)g(standard.)1110
1833 y Fs(privileged)1590 1943 y Ft(Same)f(as)h Fs(-p)p
Ft(.)1110 2096 y Fs(verbose)144 b Ft(Same)30 b(as)h Fs(-v)p
Ft(.)1110 2250 y Fs(vi)384 b Ft(Use)31 b(a)g Fs(vi)p
Ft(-st)m(yle)g(line)g(editing)g(in)m(terface.)1110 2403
y Fs(xtrace)192 b Ft(Same)30 b(as)h Fs(-x)p Ft(.)630
2217 y Fs(-p)384 b Ft(T)-8 b(urn)33 b(on)h(privileged)h(mo)s(de.)51
2556 y Fs(-p)384 b Ft(T)-8 b(urn)33 b(on)h(privileged)h(mo)s(de.)51
b(In)34 b(this)g(mo)s(de,)h(the)f Fs($BASH_ENV)e Ft(and)h
Fs($ENV)1110 2326 y Ft(\014les)k(are)h(not)g(pro)s(cessed,)h(shell)f
Fs($ENV)1110 2666 y Ft(\014les)k(are)h(not)g(pro)s(cessed,)h(shell)f
(functions)f(are)h(not)f(inherited)h(from)f(the)1110
2436 y(en)m(vironmen)m(t,)f(and)d(the)h Fs(SHELLOPTS)e
2776 y(en)m(vironmen)m(t,)f(and)d(the)h Fs(SHELLOPTS)e
Ft(v)-5 b(ariable,)35 b(if)f(it)h(app)s(ears)e(in)h(the)g(en-)1110
2545 y(vironmen)m(t,)d(is)f(ignored.)41 b(If)29 b(the)i(shell)f(is)g
(started)h(with)f(the)g(e\013ectiv)m(e)j(user)1110 2655
2885 y(vironmen)m(t,)d(is)f(ignored.)41 b(If)29 b(the)i(shell)f(is)g
(started)h(with)f(the)g(e\013ectiv)m(e)j(user)1110 2995
y(\(group\))d(id)g(not)g(equal)h(to)f(the)g(real)h(user)e(\(group\))i
(id,)f(and)f(the)h Fs(-p)f Ft(option)1110 2765 y(is)40
(id,)f(and)f(the)h Fs(-p)f Ft(option)1110 3104 y(is)40
b(not)g(supplied,)i(these)e(actions)i(are)e(tak)m(en)h(and)f(the)g
(e\013ectiv)m(e)j(user)c(id)1110 2874 y(is)d(set)h(to)h(the)e(real)h
(e\013ectiv)m(e)j(user)c(id)1110 3214 y(is)d(set)h(to)h(the)e(real)h
(user)f(id.)58 b(If)36 b(the)h Fs(-p)f Ft(option)g(is)h(supplied)e(at)i
(startup,)1110 2984 y(the)29 b(e\013ectiv)m(e)j(user)d(id)g(is)g(not)h
(startup,)1110 3324 y(the)29 b(e\013ectiv)m(e)j(user)d(id)g(is)g(not)h
(reset.)40 b(T)-8 b(urning)29 b(this)g(option)g(o\013)h(causes)g(the)
1110 3093 y(e\013ectiv)m(e)e(user)d(and)g(group)g(ids)h(to)g(b)s(e)f
1110 3433 y(e\013ectiv)m(e)e(user)d(and)g(group)g(ids)h(to)g(b)s(e)f
(set)h(to)h(the)f(real)g(user)f(and)g(group)g(ids.)630
3242 y Fs(-t)384 b Ft(Exit)31 b(after)g(reading)f(and)g(executing)h
(one)g(command.)630 3391 y Fs(-u)384 b Ft(T)-8 b(reat)38
3587 y Fs(-t)384 b Ft(Exit)31 b(after)g(reading)f(and)g(executing)h
(one)g(command.)630 3740 y Fs(-u)384 b Ft(T)-8 b(reat)38
b(unset)e(v)-5 b(ariables)37 b(as)h(an)e(error)h(when)e(p)s(erforming)h
(parameter)h(ex-)1110 3500 y(pansion.)58 b(An)36 b(error)f(message)j
(parameter)h(ex-)1110 3850 y(pansion.)58 b(An)36 b(error)f(message)j
(will)e(b)s(e)g(written)g(to)h(the)g(standard)e(error,)1110
3610 y(and)30 b(a)h(non-in)m(teractiv)m(e)i(shell)d(will)h(exit.)630
3759 y Fs(-v)384 b Ft(Prin)m(t)30 b(shell)h(input)e(lines)i(as)g(they)f
(are)h(read.)630 3907 y Fs(-x)384 b Ft(Prin)m(t)82 b(a)h(trace)h(of)e
3959 y(and)30 b(a)h(non-in)m(teractiv)m(e)i(shell)d(will)h(exit.)630
4113 y Fs(-v)384 b Ft(Prin)m(t)30 b(shell)h(input)e(lines)i(as)g(they)f
(are)h(read.)630 4266 y Fs(-x)384 b Ft(Prin)m(t)82 b(a)h(trace)h(of)e
(simple)g(commands,)96 b Fs(\\)p Ft(fBfor)p Fs(\\)p Ft(fP)81
b(commands,)1110 4017 y Fs(\\)p Ft(fBcase)p Fs(\\)p Ft(fP)50
b(commands,)1110 4376 y Fs(\\)p Ft(fBcase)p Fs(\\)p Ft(fP)50
b(commands,)55 b Fs(\\)p Ft(fBselect)p Fs(\\)p Ft(fP)c(commands,)k(and)
50 b(arithmetic)1110 4127 y Fs(\\)p Ft(fBfor)p Fs(\\)p
50 b(arithmetic)1110 4485 y Fs(\\)p Ft(fBfor)p Fs(\\)p
Ft(fP)31 b(commands)g(and)g(their)h(argumen)m(ts)g(or)f(asso)s(ciated)i
(w)m(ord)e(lists)1110 4236 y(after)k(they)g(are)g(expanded)f(and)h(b)s
(w)m(ord)e(lists)1110 4595 y(after)k(they)g(are)g(expanded)f(and)h(b)s
(efore)f(they)h(are)g(executed.)55 b(The)34 b(v)-5 b(alue)1110
4346 y(of)34 b(the)g Fs(PS4)f Ft(v)-5 b(ariable)35 b(is)f(expanded)g
4704 y(of)34 b(the)g Fs(PS4)f Ft(v)-5 b(ariable)35 b(is)f(expanded)g
(and)f(the)h(resultan)m(t)h(v)-5 b(alue)34 b(is)g(prin)m(ted)1110
4455 y(b)s(efore)c(the)h(command)f(and)f(its)i(expanded)f(argumen)m
(ts.)630 4604 y Fs(-B)384 b Ft(The)41 b(shell)g(will)g(p)s(erform)f
4814 y(b)s(efore)c(the)h(command)f(and)f(its)i(expanded)f(argumen)m
(ts.)630 4967 y Fs(-B)384 b Ft(The)41 b(shell)g(will)g(p)s(erform)f
(brace)h(expansion)g(\(see)h(Section)g(3.5.1)g([Brace)1110
4714 y(Expansion],)30 b(page)h(17\).)42 b(This)30 b(option)h(is)f(on)g
(b)m(y)h(default.)630 4862 y Fs(-C)384 b Ft(Prev)m(en)m(t)25
5077 y(Expansion],)30 b(page)h(17\).)42 b(This)30 b(option)h(is)f(on)g
(b)m(y)h(default.)630 5230 y Fs(-C)384 b Ft(Prev)m(en)m(t)25
b(output)e(redirection)h(using)f(`)p Fs(>)p Ft(',)i(`)p
Fs(>&)p Ft(',)g(and)e(`)p Fs(<>)p Ft(')g(from)h(o)m(v)m(erwriting)1110
4972 y(existing)31 b(\014les.)630 5121 y Fs(-E)384 b
Ft(If)39 b(set,)j(an)m(y)e(trap)f(on)g Fs(ERR)g Ft(is)g(inherited)g(b)m
(y)g(shell)h(functions,)h(command)1110 5230 y(substitutions,)35
b(and)e(commands)g(executed)i(in)f(a)g(subshell)f(en)m(vironmen)m(t.)
1110 5340 y(The)d Fs(ERR)f Ft(trap)i(is)f(normally)h(not)f(inherited)g
(in)g(suc)m(h)g(cases.)p eop end
5340 y(existing)31 b(\014les.)p eop end
%%Page: 53 59
TeXDict begin 53 58 bop 150 -116 a Ft(Chapter)30 b(4:)41
b(Shell)30 b(Builtin)h(Commands)2069 b(53)630 299 y Fs(-H)384
b Ft(Enable)38 b(`)p Fs(!)p Ft(')h(st)m(yle)h(history)e(substitution)g
(\(see)h(Section)h(9.3)f([History)g(In-)1110 408 y(teraction],)g(page)d
(113\).)57 b(This)34 b(option)i(is)f(on)g(b)m(y)h(default)f(for)g(in)m
(teractiv)m(e)1110 518 y(shells.)630 682 y Fs(-P)384
b(Shell)30 b(Builtin)h(Commands)2069 b(53)630 299 y Fs(-E)384
b Ft(If)39 b(set,)j(an)m(y)e(trap)f(on)g Fs(ERR)g Ft(is)g(inherited)g
(b)m(y)g(shell)h(functions,)h(command)1110 408 y(substitutions,)35
b(and)e(commands)g(executed)i(in)f(a)g(subshell)f(en)m(vironmen)m(t.)
1110 518 y(The)d Fs(ERR)f Ft(trap)i(is)f(normally)h(not)f(inherited)g
(in)g(suc)m(h)g(cases.)630 735 y Fs(-H)384 b Ft(Enable)38
b(`)p Fs(!)p Ft(')h(st)m(yle)h(history)e(substitution)g(\(see)h
(Section)h(9.3)f([History)g(In-)1110 845 y(teraction],)g(page)d(113\).)
57 b(This)34 b(option)i(is)f(on)g(b)m(y)h(default)f(for)g(in)m
(teractiv)m(e)1110 954 y(shells.)630 1172 y Fs(-P)384
b Ft(If)43 b(set,)k(do)c(not)g(follo)m(w)h(sym)m(b)s(olic)g(links)e
(when)g(p)s(erforming)g(commands)1110 792 y(suc)m(h)29
(when)g(p)s(erforming)g(commands)1110 1281 y(suc)m(h)29
b(as)h Fs(cd)f Ft(whic)m(h)g(c)m(hange)h(the)g(curren)m(t)f(directory)
-8 b(.)42 b(The)28 b(ph)m(ysical)j(direc-)1110 902 y(tory)j(is)g(used)f
(instead.)52 b(By)34 b(default,)h(Bash)f(follo)m(ws)h(the)f(logical)i
(c)m(hain)f(of)1110 1011 y(directories)j(when)d(p)s(erforming)h
-8 b(.)42 b(The)28 b(ph)m(ysical)j(direc-)1110 1391 y(tory)j(is)g(used)
f(instead.)52 b(By)34 b(default,)h(Bash)f(follo)m(ws)h(the)f(logical)i
(c)m(hain)f(of)1110 1500 y(directories)j(when)d(p)s(erforming)h
(commands)g(whic)m(h)g(c)m(hange)i(the)f(curren)m(t)1110
1121 y(directory)-8 b(.)1110 1258 y(F)g(or)31 b(example,)g(if)f(`)p
1610 y(directory)-8 b(.)1110 1773 y(F)g(or)31 b(example,)g(if)f(`)p
Fs(/usr/sys)p Ft(')e(is)i(a)g(sym)m(b)s(olic)h(link)f(to)g(`)p
Fs(/usr/local/sys)p Ft(')1110 1367 y(then:)1350 1504
y Fs($)47 b(cd)h(/usr/sys;)d(echo)i($PWD)1350 1614 y(/usr/sys)1350
1723 y($)g(cd)h(..;)f(pwd)1350 1833 y(/usr)1110 1970
y Ft(If)30 b Fs(set)f(-P)h Ft(is)h(on,)f(then:)1350 2107
y Fs($)47 b(cd)h(/usr/sys;)d(echo)i($PWD)1350 2216 y(/usr/local/sys)
1350 2326 y($)g(cd)h(..;)f(pwd)1350 2436 y(/usr/local)630
2600 y(-T)384 b Ft(If)31 b(set,)h(an)m(y)f(trap)g(on)g
Fs(/usr/local/sys)p Ft(')1110 1883 y(then:)1350 2046
y Fs($)47 b(cd)h(/usr/sys;)d(echo)i($PWD)1350 2156 y(/usr/sys)1350
2266 y($)g(cd)h(..;)f(pwd)1350 2375 y(/usr)1110 2539
y Ft(If)30 b Fs(set)f(-P)h Ft(is)h(on,)f(then:)1350 2702
y Fs($)47 b(cd)h(/usr/sys;)d(echo)i($PWD)1350 2812 y(/usr/local/sys)
1350 2921 y($)g(cd)h(..;)f(pwd)1350 3031 y(/usr/local)630
3248 y(-T)384 b Ft(If)31 b(set,)h(an)m(y)f(trap)g(on)g
Fs(DEBUG)e Ft(is)i(inherited)g(b)m(y)g(shell)g(functions,)g(command)
1110 2710 y(substitutions,)k(and)e(commands)g(executed)i(in)f(a)g
(subshell)f(en)m(vironmen)m(t.)1110 2819 y(The)d Fs(DEBUG)f
1110 3358 y(substitutions,)k(and)e(commands)g(executed)i(in)f(a)g
(subshell)f(en)m(vironmen)m(t.)1110 3467 y(The)d Fs(DEBUG)f
Ft(trap)h(is)g(normally)h(not)g(inherited)f(in)g(suc)m(h)g(cases.)630
2983 y Fs(--)384 b Ft(If)31 b(no)h(argumen)m(ts)f(follo)m(w)i(this)f
3684 y Fs(--)384 b Ft(If)31 b(no)h(argumen)m(ts)f(follo)m(w)i(this)f
(option,)g(then)f(the)h(p)s(ositional)h(parameters)1110
3093 y(are)h(unset.)49 b(Otherwise,)34 b(the)g(p)s(ositional)g
(parameters)g(are)g(set)g(to)g(the)g Fq(ar-)1110 3203
3794 y(are)h(unset.)49 b(Otherwise,)34 b(the)g(p)s(ositional)g
(parameters)g(are)g(set)g(to)g(the)g Fq(ar-)1110 3904
y(gumen)m(ts)p Ft(,)d(ev)m(en)g(if)f(some)h(of)g(them)f(b)s(egin)g
(with)g(a)h(`)p Fs(-)p Ft('.)630 3367 y Fs(-)432 b Ft(Signal)45
(with)g(a)h(`)p Fs(-)p Ft('.)630 4121 y Fs(-)432 b Ft(Signal)45
b(the)g(end)f(of)h(options,)k(cause)c(all)h(remaining)e
Fq(argumen)m(ts)49 b Ft(to)d(b)s(e)1110 3477 y(assigned)38
Fq(argumen)m(ts)49 b Ft(to)d(b)s(e)1110 4230 y(assigned)38
b(to)h(the)f(p)s(ositional)h(parameters.)65 b(The)37
b(`)p Fs(-x)p Ft(')h(and)g(`)p Fs(-v)p Ft(')g(options)1110
3586 y(are)25 b(turned)e(o\013.)40 b(If)24 b(there)h(are)g(no)f
4340 y(are)25 b(turned)e(o\013.)40 b(If)24 b(there)h(are)g(no)f
(argumen)m(ts,)i(the)f(p)s(ositional)h(parameters)1110
3696 y(remain)k(unc)m(hanged.)630 3860 y(Using)d(`)p
4450 y(remain)k(unc)m(hanged.)630 4667 y(Using)d(`)p
Fs(+)p Ft(')h(rather)f(than)g(`)p Fs(-)p Ft(')g(causes)h(these)f
(options)h(to)g(b)s(e)e(turned)g(o\013.)40 b(The)27 b(options)h(can)630
3970 y(also)36 b(b)s(e)f(used)f(up)s(on)g(in)m(v)m(o)s(cation)j(of)e
4776 y(also)36 b(b)s(e)f(used)f(up)s(on)g(in)m(v)m(o)s(cation)j(of)e
(the)g(shell.)56 b(The)34 b(curren)m(t)h(set)h(of)f(options)h(ma)m(y)g
(b)s(e)630 4079 y(found)29 b(in)h Fs($-)p Ft(.)630 4216
(b)s(e)630 4886 y(found)29 b(in)h Fs($-)p Ft(.)630 5049
y(The)43 b(remaining)h(N)f Fq(argumen)m(ts)48 b Ft(are)c(p)s(ositional)
g(parameters)g(and)f(are)h(assigned,)j(in)630 4326 y(order,)30
g(parameters)g(and)f(are)h(assigned,)j(in)630 5159 y(order,)30
b(to)h Fs($1)p Ft(,)f Fs($2)p Ft(,)36 b(.)22 b(.)g(.)42
b Fs($N)p Ft(.)e(The)30 b(sp)s(ecial)h(parameter)g Fs(#)f
Ft(is)g(set)h(to)g(N.)630 4463 y(The)f(return)f(status)i(is)f(alw)m(a)m
Ft(is)g(set)h(to)g(N.)630 5322 y(The)f(return)f(status)i(is)f(alw)m(a)m
(ys)i(zero)f(unless)f(an)g(in)m(v)-5 b(alid)31 b(option)g(is)f
(supplied.)150 4732 y Fr(4.4)68 b(Sp)t(ecial)45 b(Builtins)275
4981 y Ft(F)-8 b(or)25 b(historical)h(reasons,)g(the)e
Fl(posix)g Ft(1003.2)j(standard)d(has)g(classi\014ed)h(sev)m(eral)h
(builtin)e(commands)150 5091 y(as)37 b Fm(sp)-5 b(e)g(cial)p
Ft(.)60 b(When)36 b(Bash)h(is)g(executing)g(in)f Fl(posix)g
Ft(mo)s(de,)i(the)f(sp)s(ecial)g(builtins)e(di\013er)i(from)f(other)150
5201 y(builtin)30 b(commands)g(in)g(three)h(resp)s(ects:)199
5340 y(1.)61 b(Sp)s(ecial)31 b(builtins)e(are)i(found)e(b)s(efore)h
(shell)h(functions)f(during)f(command)h(lo)s(okup.)p
eop end
(supplied.)p eop end
%%Page: 54 60
TeXDict begin 54 59 bop 150 -116 a Ft(54)2572 b(Bash)31
b(Reference)g(Man)m(ual)199 299 y(2.)61 b(If)30 b(a)h(sp)s(ecial)g
(builtin)f(returns)f(an)h(error)g(status,)h(a)g(non-in)m(teractiv)m(e)i
(shell)d(exits.)199 433 y(3.)61 b(Assignmen)m(t)30 b(statemen)m(ts)h
(preceding)f(the)f(command)g(sta)m(y)i(in)e(e\013ect)i(in)e(the)h
(shell)f(en)m(vironmen)m(t)330 543 y(after)i(the)f(command)h
(completes.)275 702 y(When)36 b(Bash)g(is)h(not)f(executing)i(in)e
Fl(posix)f Ft(mo)s(de,)j(these)f(builtins)f(b)s(eha)m(v)m(e)h(no)f
(di\013eren)m(tly)h(than)150 812 y(the)31 b(rest)f(of)h(the)f(Bash)h
(builtin)e(commands.)41 b(The)30 b(Bash)g Fl(posix)g
Ft(mo)s(de)g(is)g(describ)s(ed)f(in)h(Section)h(6.11)150
922 y([Bash)g(POSIX)e(Mo)s(de],)i(page)g(76.)275 1056
y(These)f(are)g(the)h Fl(posix)f Ft(sp)s(ecial)h(builtins:)390
1191 y Fs(break)46 b(:)i(.)f(continue)f(eval)g(exec)h(exit)g(export)f
(readonly)f(return)h(set)390 1300 y(shift)g(trap)h(unset)p
eop end
b(Reference)g(Man)m(ual)150 299 y Fr(4.4)68 b(Sp)t(ecial)45
b(Builtins)275 543 y Ft(F)-8 b(or)25 b(historical)h(reasons,)g(the)e
Fl(posix)g Ft(1003.2)j(standard)d(has)g(classi\014ed)h(sev)m(eral)h
(builtin)e(commands)150 653 y(as)37 b Fm(sp)-5 b(e)g(cial)p
Ft(.)60 b(When)36 b(Bash)h(is)g(executing)g(in)f Fl(posix)g
Ft(mo)s(de,)i(the)f(sp)s(ecial)g(builtins)e(di\013er)i(from)f(other)150
762 y(builtin)30 b(commands)g(in)g(three)h(resp)s(ects:)199
897 y(1.)61 b(Sp)s(ecial)31 b(builtins)e(are)i(found)e(b)s(efore)h
(shell)h(functions)f(during)f(command)h(lo)s(okup.)199
1031 y(2.)61 b(If)30 b(a)h(sp)s(ecial)g(builtin)f(returns)f(an)h(error)
g(status,)h(a)g(non-in)m(teractiv)m(e)i(shell)d(exits.)199
1166 y(3.)61 b(Assignmen)m(t)30 b(statemen)m(ts)h(preceding)f(the)f
(command)g(sta)m(y)i(in)e(e\013ect)i(in)e(the)h(shell)f(en)m(vironmen)m
(t)330 1275 y(after)i(the)f(command)h(completes.)275
1435 y(When)36 b(Bash)g(is)h(not)f(executing)i(in)e Fl(posix)f
Ft(mo)s(de,)j(these)f(builtins)f(b)s(eha)m(v)m(e)h(no)f(di\013eren)m
(tly)h(than)150 1544 y(the)31 b(rest)f(of)h(the)f(Bash)h(builtin)e
(commands.)41 b(The)30 b(Bash)g Fl(posix)g Ft(mo)s(de)g(is)g(describ)s
(ed)f(in)h(Section)h(6.11)150 1654 y([Bash)g(POSIX)e(Mo)s(de],)i(page)g
(76.)275 1788 y(These)f(are)g(the)h Fl(posix)f Ft(sp)s(ecial)h
(builtins:)390 1923 y Fs(break)46 b(:)i(.)f(continue)f(eval)g(exec)h
(exit)g(export)f(readonly)f(return)h(set)390 2032 y(shift)g(trap)h
(unset)p eop end
%%Page: 55 61
TeXDict begin 55 60 bop 150 -116 a Ft(Chapter)30 b(5:)41
b(Shell)30 b(V)-8 b(ariables)2459 b(55)150 299 y Fo(5)80
@@ -15097,7 +15100,7 @@ b(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g
(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)44 b Fb(31)2025
1433 y(sp)r(ecial)27 b(builtin)12 b Fc(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g
(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)
g(.)g(.)h(.)38 b Fb(4,)26 b(53)2025 1521 y(startup)f(\014les)20
g(.)g(.)h(.)38 b Fb(4,)26 b(54)2025 1521 y(startup)f(\014les)20
b Fc(.)12 b(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f
(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)45
b Fb(65)2025 1608 y(susp)r(ending)25 b(jobs)7 b Fc(.)14
+4 -1
View File
@@ -3912,7 +3912,10 @@ set [--abefhkmnptuvxBCHP] [-o @var{option}] [@var{argument} @dots{}]
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:
+14 -12
View File
@@ -841,13 +841,15 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
sseett [----aabbeeffhhkkmmnnppttuuvvxxBBCCHHPP] [--oo _o_p_t_i_o_n] [_a_r_g ...]
Without options, the name and value of each shell variable are
displayed in a format that can be reused as input. The output
is sorted according to the current locale. When options are
specified, they set or unset shell attributes. Any arguments
remaining after the options are processed are treated as values
for the positional parameters and are assigned, in order, to $$11,
$$22, ...... $$_n. Options, if specified, have the following mean-
ings:
displayed in a format that can be reused as input for setting or
resetting the currently-set variables. Read-only variables can-
not be reset. In _p_o_s_i_x _m_o_d_e, only shell variables are listed.
The output is sorted according to the current locale. When
options are specified, they set or unset shell attributes. Any
arguments remaining after the options are processed are treated
as values for the positional parameters and are assigned, in
order, to $$11, $$22, ...... $$_n. Options, if specified, have the fol-
lowing meanings:
--aa Automatically mark variables and functions which are
modified or created for export to the environment of
subsequent commands.
@@ -921,7 +923,7 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
is disabled by default.
ppoossiixx Change the behavior of bbaasshh where the default
operation differs from the POSIX 1003.2 standard
to match the standard (_`_p_o_s_i_x _m_o_d_e).
to match the standard (_p_o_s_i_x _m_o_d_e).
pprriivviilleeggeedd
Same as --pp.
vveerrbboossee Same as --vv.
@@ -1006,8 +1008,8 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
ior. With no options, or with the --pp option, a list of all set-
table options is displayed, with an indication of whether or not
each is set. The --pp option causes output to be displayed in a
form that may be reused as input. Other options have the
following meanings:
form that may be reused as input. Other options have the fol-
lowing meanings:
--ss Enable (set) each _o_p_t_n_a_m_e.
--uu Disable (unset) each _o_p_t_n_a_m_e.
--qq Suppresses normal output (quiet mode); the return status
@@ -1310,8 +1312,8 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
_l_i_m_i_t is omitted, the current value of the soft limit of the
resource is printed, unless the --HH option is given. When more
than one resource is specified, the limit name and unit are
printed before the value. Other options are interpreted as
follows:
printed before the value. Other options are interpreted as fol-
lows:
--aa All current limits are reported
--cc The maximum size of core files created
--dd The maximum size of a process's data segment
+186 -182
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.18.1
%%CreationDate: Mon Nov 22 12:03:34 2004
%%CreationDate: Wed Nov 24 15:49:24 2004
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
@@ -1530,305 +1530,309 @@ R .54(If used outside a function and not)5.54 F .037
E F8(\255\255abefhkmnptuvxBCHP)A F4 2.5(][)C F8<ad6f>-2.5 E F5(option)
2.5 E F4 2.5(][)C F5(ar)-2.5 E(g)-.18 E F4(...])2.5 E -.55(Wi)144 643.2
S .246(thout options, the name and value of each shell variable ar).55 F
2.745(ed)-.18 G .245(isplayed in a format that)-2.745 F 2.183(can be r)
144 655.2 R 2.183(eused as input.)-.18 F 2.184
(The output is sorted accor)7.183 F 2.184(ding to the curr)-.18 F 2.184
(ent locale.)-.18 F(When)7.184 E 1.006(options ar)144 667.2 R 3.506(es)
-.18 G 1.006(peci\214ed, they set or unset shell attributes.)-3.506 F
1.006(Any ar)6.006 F 1.005(guments r)-.18 F 1.005(emaining after)-.18 F
1.981(the options ar)144 679.2 R 4.481(ep)-.18 G -.18(ro)-4.481 G 1.981
(cessed ar).18 F 4.481(et)-.18 G -.18(re)-4.481 G 1.982
(ated as values for the positional parameters and ar).18 F(e)-.18 E
(assigned, in or)144 691.2 Q(der)-.18 E 2.5(,t)-.74 G(o)-2.5 E F8($1)2.5
E F4(,)A F8($2)2.5 E F4(,)A F8 2.5(... $)2.5 F F5(n)A F4 5(.O)C
(ptions, if speci\214ed, have the following meanings:)-5 E F8<ad61>144
703.2 Q F4 1.063(Automatically mark variables and functions which ar)
28.94 F 3.563(em)-.18 G 1.063(odi\214ed or cr)-3.563 F 1.063(eated for)
-.18 F(export to the envir)184 715.2 Q(onment of subsequent commands.)
-.18 E F0(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(11)198.725 E 0 Cg
EP
2.745(ed)-.18 G .245(isplayed in a format that)-2.745 F .233(can be r)
144 655.2 R .233(eused as input for setting or r)-.18 F .233
(esetting the curr)-.18 F .233(ently-set variables.)-.18 F .234
(Read-only vari-)5.233 F .748(ables cannot be r)144 667.2 R 3.248
(eset. In)-.18 F F5 .748(posix mode)3.248 F F4 3.248(,o)C .748
(nly shell variables ar)-3.248 F 3.248(el)-.18 G 3.248(isted. The)-3.248
F .748(output is sorted)3.248 F(accor)144 679.2 Q 2.607
(ding to the curr)-.18 F 2.607(ent locale.)-.18 F 2.608(When options ar)
7.608 F 5.108(es)-.18 G 2.608(peci\214ed, they set or unset shell)-5.108
F 3.455(attributes. Any)144 691.2 R(ar)3.455 E .955(guments r)-.18 F
.955(emaining after the options ar)-.18 F 3.455(ep)-.18 G -.18(ro)-3.455
G .955(cessed ar).18 F 3.455(et)-.18 G -.18(re)-3.455 G .955
(ated as val-).18 F .67(ues for the positional parameters and ar)144
703.2 R 3.17(ea)-.18 G .67(ssigned, in or)-3.17 F(der)-.18 E 3.17(,t)
-.74 G(o)-3.17 E F8($1)3.17 E F4(,)A F8($2)3.17 E F4(,)A F8 3.17(... $)
3.17 F F5(n)A F4 5.67(.O)C .67(ptions, if)-5.67 F
(speci\214ed, have the following meanings:)144 715.2 Q F0(GNU Bash-3.0)
72 768 Q(2004 Apr 20)148.735 E(11)198.725 E 0 Cg EP
%%Page: 12 12
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF -.35(BA)72 48 S(SH_B).35 E(UIL)-.1 E 290.48
(TINS\(1\) B)-.92 F(ASH_B)-.35 E(UIL)-.1 E(TINS\(1\))-.92 E/F1 10
/Palatino-Bold@0 SF<ad62>144 84 Q/F2 10/Palatino-Roman@0 SF .096
(Report the status of terminated backgr)27.83 F .096
(ound jobs immediately)-.18 F 2.596(,r)-1.11 G .096(ather than befor)
-2.596 F(e)-.18 E(the next primary pr)184 96 Q 2.5(ompt. This)-.18 F
(is ef)2.5 E(fective only when job contr)-.18 E(ol is enabled.)-.18 E F1
<ad65>144 108 Q F2 .179(Exit immediately if a)28.94 F/F3 10
/Palatino-Italic@0 SF .178(simple command)2.679 F F2(\(see)2.678 E/F4 9
/Palatino-Bold@0 SF .178(SHELL GRAMMAR)2.678 F F2 .178
(above\) exits with a)2.428 F(non-zer)184 120 Q 3.232(os)-.18 G 3.232
/Palatino-Bold@0 SF<ad61>144 84 Q/F2 10/Palatino-Roman@0 SF 1.063
(Automatically mark variables and functions which ar)28.94 F 3.563(em)
-.18 G 1.063(odi\214ed or cr)-3.563 F 1.063(eated for)-.18 F
(export to the envir)184 96 Q(onment of subsequent commands.)-.18 E F1
<ad62>144 108 Q F2 .096(Report the status of terminated backgr)27.83 F
.096(ound jobs immediately)-.18 F 2.596(,r)-1.11 G .096
(ather than befor)-2.596 F(e)-.18 E(the next primary pr)184 120 Q 2.5
(ompt. This)-.18 F(is ef)2.5 E(fective only when job contr)-.18 E
(ol is enabled.)-.18 E F1<ad65>144 132 Q F2 .179(Exit immediately if a)
28.94 F/F3 10/Palatino-Italic@0 SF .178(simple command)2.679 F F2(\(see)
2.678 E/F4 9/Palatino-Bold@0 SF .178(SHELL GRAMMAR)2.678 F F2 .178
(above\) exits with a)2.428 F(non-zer)184 144 Q 3.232(os)-.18 G 3.232
(tatus. The)-3.232 F .733
(shell does not exit if the command that fails is part of the)3.232 F
.696(command list immediately following a)184 132 R F1(while)3.196 E F2
.696(command list immediately following a)184 156 R F1(while)3.196 E F2
(or)3.196 E F1(until)3.196 E F2(keywor)3.196 E .696(d, part of the test)
-.18 F .98(in an)184 144 R F3(if)3.64 E F2 .98(statement, part of a)5.33
-.18 F .98(in an)184 168 R F3(if)3.64 E F2 .98(statement, part of a)5.33
F F1(&&)3.48 E F2(or)3.481 E/F5 10/Symbol SF<efef>3.481 E F2 .981
(list, or if the command's r)3.481 F .981(eturn value is)-.18 F
(being inverted via)184 156 Q F1(!)2.5 E F2 5(.A)C(trap on)-2.5 E F1
(being inverted via)184 180 Q F1(!)2.5 E F2 5(.A)C(trap on)-2.5 E F1
(ERR)2.5 E F2 2.5(,i)C 2.5(fs)-2.5 G(et, is executed befor)-2.5 E 2.5
(et)-.18 G(he shell exits.)-2.5 E F1<ad66>144 168 Q F2
(Disable pathname expansion.)30.05 E F1<ad68>144 180 Q F2 .592
(et)-.18 G(he shell exits.)-2.5 E F1<ad66>144 192 Q F2
(Disable pathname expansion.)30.05 E F1<ad68>144 204 Q F2 .592
(Remember the location of commands as they ar)27.83 F 3.092(el)-.18 G
.591(ooked up for execution.)-3.092 F(This)5.591 E
(is enabled by default.)184 192 Q F1<ad6b>144 204 Q F2 .934(All ar)27.83
(is enabled by default.)184 216 Q F1<ad6b>144 228 Q F2 .934(All ar)27.83
F .934(guments in the form of assignment statements ar)-.18 F 3.434(ep)
-.18 G .935(laced in the envir)-3.434 F(on-)-.18 E
(ment for a command, not just those that pr)184 216 Q
(ecede the command name.)-.18 E F1<ad6d>144 228 Q F2 .711(Monitor mode.)
(ment for a command, not just those that pr)184 240 Q
(ecede the command name.)-.18 E F1<ad6d>144 252 Q F2 .711(Monitor mode.)
25.05 F .711(Job contr)5.711 F .711(ol is enabled.)-.18 F .711
(This option is on by default for interac-)5.711 F 1.164
(tive shells on systems that support it \(see)184 240 R F4 1.165
(tive shells on systems that support it \(see)184 264 R F4 1.165
(JOB CONTROL)3.665 F F2 3.665(above\). Backgr)3.415 F(ound)-.18 E(pr)184
252 Q .54(ocesses r)-.18 F .54(un in a separate pr)-.08 F .539(ocess gr)
276 Q .54(ocesses r)-.18 F .54(un in a separate pr)-.08 F .539(ocess gr)
-.18 F .539(oup and a line containing their exit status)-.18 F
(is printed upon their completion.)184 264 Q F1<ad6e>144 276 Q F2 1.313
(is printed upon their completion.)184 288 Q F1<ad6e>144 300 Q F2 1.313
(Read commands but do not execute them.)27.83 F 1.313
(This may be used to check a shell)6.313 F(script for syntax err)184 288
(This may be used to check a shell)6.313 F(script for syntax err)184 312
Q 2.5(ors. This)-.18 F(is ignor)2.5 E(ed by interactive shells.)-.18 E
F1<ad6f>144 300 Q F3(option\255name)2.5 E F2(The)184 312 Q F3
F1<ad6f>144 324 Q F3(option\255name)2.5 E F2(The)184 336 Q F3
(option\255name)2.5 E F2(can be one of the following:)2.5 E F1
(allexport)184 324 Q F2(Same as)224 336 Q F1<ad61>2.5 E F2(.)A F1
(braceexpand)184 348 Q F2(Same as)224 360 Q F1<ad42>2.5 E F2(.)A F1
(emacs)184 372 Q F2 .412
(allexport)184 348 Q F2(Same as)224 360 Q F1<ad61>2.5 E F2(.)A F1
(braceexpand)184 372 Q F2(Same as)224 384 Q F1<ad42>2.5 E F2(.)A F1
(emacs)184 396 Q F2 .412
(Use an emacs-style command line editing interface.)12.23 F .412
(This is enabled by)5.412 F .358(default when the shell is interactive,\
unless the shell is started with the)224 384 R F1(\255\255noediting)224
396 Q F2(option.)2.5 E F1(errtrace)184 408 Q F2(Same as)5.56 E F1<ad45>
2.5 E F2(.)A F1(functrace)184 420 Q F2(Same as)224 432 Q F1<ad54>2.5 E
F2(.)A F1(errexit)184 444 Q F2(Same as)10.56 E F1<ad65>2.5 E F2(.)A F1
(hashall)184 456 Q F2(Same as)6.68 E F1<ad68>2.5 E F2(.)A F1(histexpand)
184 468 Q F2(Same as)224 480 Q F1<ad48>2.5 E F2(.)A F1(history)184 492 Q
unless the shell is started with the)224 408 R F1(\255\255noediting)224
420 Q F2(option.)2.5 E F1(errtrace)184 432 Q F2(Same as)5.56 E F1<ad45>
2.5 E F2(.)A F1(functrace)184 444 Q F2(Same as)224 456 Q F1<ad54>2.5 E
F2(.)A F1(errexit)184 468 Q F2(Same as)10.56 E F1<ad65>2.5 E F2(.)A F1
(hashall)184 480 Q F2(Same as)6.68 E F1<ad68>2.5 E F2(.)A F1(histexpand)
184 492 Q F2(Same as)224 504 Q F1<ad48>2.5 E F2(.)A F1(history)184 516 Q
F2 2.271(Enable command history)7.78 F 4.771(,a)-1.11 G 4.771(sd)-4.771
G 2.271(escribed above under)-4.771 F F4(HISTOR)4.771 E(Y)-.495 E/F6 9
/Palatino-Roman@0 SF(.)A F2(This)6.77 E
(option is on by default in interactive shells.)224 504 Q F1(ignoreeof)
184 516 Q F2 1.673(The ef)224 528 R 1.673
(option is on by default in interactive shells.)224 528 Q F1(ignoreeof)
184 540 Q F2 1.673(The ef)224 552 R 1.673
(fect is as if the shell command)-.18 F/F7 10/Courier@0 SF(IGNOREEOF=10)
4.174 E F2 1.674(had been exe-)4.174 F(cuted \(see)224 540 Q F1(Shell V)
2.5 E(ariables)-1.11 E F2(above\).)2.5 E F1(keyword)184 552 Q F2
(Same as)224 564 Q F1<ad6b>2.5 E F2(.)A F1(monitor)184 576 Q F2(Same as)
224 588 Q F1<ad6d>2.5 E F2(.)A F1(noclobber)184 600 Q F2(Same as)224 612
Q F1<ad43>2.5 E F2(.)A F1(noexec)184 624 Q F2(Same as)8.89 E F1<ad6e>2.5
E F2(.)A F1(noglob)184 636 Q F2(Same as)7.77 E F1<ad66>2.5 E F2(.)A F1
(nolog)5 E F2(Curr)2.5 E(ently ignor)-.18 E(ed.)-.18 E F1(notify)184 648
Q F2(Same as)12.22 E F1<ad62>2.5 E F2(.)A F1(nounset)184 660 Q F2
(Same as)224 672 Q F1<ad75>2.5 E F2(.)A F1(onecmd)184 684 Q F2(Same as)
224 696 Q F1<ad74>2.5 E F2(.)A F0(GNU Bash-3.0)72 768 Q(2004 Apr 20)
148.735 E(12)198.725 E 0 Cg EP
4.174 E F2 1.674(had been exe-)4.174 F(cuted \(see)224 564 Q F1(Shell V)
2.5 E(ariables)-1.11 E F2(above\).)2.5 E F1(keyword)184 576 Q F2
(Same as)224 588 Q F1<ad6b>2.5 E F2(.)A F1(monitor)184 600 Q F2(Same as)
224 612 Q F1<ad6d>2.5 E F2(.)A F1(noclobber)184 624 Q F2(Same as)224 636
Q F1<ad43>2.5 E F2(.)A F1(noexec)184 648 Q F2(Same as)8.89 E F1<ad6e>2.5
E F2(.)A F1(noglob)184 660 Q F2(Same as)7.77 E F1<ad66>2.5 E F2(.)A F1
(nolog)5 E F2(Curr)2.5 E(ently ignor)-.18 E(ed.)-.18 E F1(notify)184 672
Q F2(Same as)12.22 E F1<ad62>2.5 E F2(.)A F1(nounset)184 684 Q F2
(Same as)224 696 Q F1<ad75>2.5 E F2(.)A F0(GNU Bash-3.0)72 768 Q
(2004 Apr 20)148.735 E(12)198.725 E 0 Cg EP
%%Page: 13 13
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF -.35(BA)72 48 S(SH_B).35 E(UIL)-.1 E 290.48
(TINS\(1\) B)-.92 F(ASH_B)-.35 E(UIL)-.1 E(TINS\(1\))-.92 E/F1 10
/Palatino-Bold@0 SF(physical)184 84 Q/F2 10/Palatino-Roman@0 SF(Same as)
224 96 Q F1<ad50>2.5 E F2(.)A F1(pipefail)184 108 Q F2 .735
(If set, the r)224 120 R .734
(eturn value of a pipeline is the value of the last \(rightmost\))-.18 F
.31(command to exit with a non-zer)224 132 R 2.811(os)-.18 G .311
/Palatino-Bold@0 SF(onecmd)184 84 Q/F2 10/Palatino-Roman@0 SF(Same as)
224 96 Q F1<ad74>2.5 E F2(.)A F1(physical)184 108 Q F2(Same as)224 120 Q
F1<ad50>2.5 E F2(.)A F1(pipefail)184 132 Q F2 .735(If set, the r)224 144
R .734(eturn value of a pipeline is the value of the last \(rightmost\))
-.18 F .31(command to exit with a non-zer)224 156 R 2.811(os)-.18 G .311
(tatus, or zer)-2.811 F 2.811(oi)-.18 G 2.811(fa)-2.811 G .311
(ll commands in the)-2.811 F(pipeline exit successfully)224 144 Q 5(.T)
-1.11 G(his option is disabled by default.)-5 E F1(posix)184 156 Q F2
(ll commands in the)-2.811 F(pipeline exit successfully)224 168 Q 5(.T)
-1.11 G(his option is disabled by default.)-5 E F1(posix)184 180 Q F2
.815(Change the behavior of)15.56 F F1(bash)3.315 E F2(wher)3.315 E
3.315(et)-.18 G .815(he default operation dif)-3.315 F .815(fers fr)-.18
F(om)-.18 E(the POSIX 1003.2 standar)224 168 Q 2.5(dt)-.18 G 2.5(om)-2.5
F(om)-.18 E(the POSIX 1003.2 standar)224 192 Q 2.5(dt)-.18 G 2.5(om)-2.5
G(atch the standar)-2.5 E 2.5(d\()-.18 G/F3 10/Palatino-Italic@0 SF
(`posix mode)-2.5 E F2(\).)A F1(privileged)184 180 Q F2(Same as)224 192
Q F1<ad70>2.5 E F2(.)A F1(verbose)184 204 Q F2(Same as)224 216 Q F1
<ad76>2.5 E F2(.)A F1(vi)184 228 Q F2
(posix mode)-2.5 E F2(\).)A F1(privileged)184 204 Q F2(Same as)224 216 Q
F1<ad70>2.5 E F2(.)A F1(verbose)184 228 Q F2(Same as)224 240 Q F1<ad76>
2.5 E F2(.)A F1(vi)184 252 Q F2
(Use a vi-style command line editing interface.)31.11 E F1(xtrace)184
240 Q F2(Same as)13.34 E F1<ad78>2.5 E F2(.)A(If)184 258 Q F1<ad6f>4.63
264 Q F2(Same as)13.34 E F1<ad78>2.5 E F2(.)A(If)184 282 Q F1<ad6f>4.63
E F2 2.131(is supplied with no)4.63 F F3(option\255name)4.631 E F2 4.631
(,t)C 2.131(he values of the curr)-4.631 F 2.131(ent options ar)-.18 F
(e)-.18 E 4.412(printed. If)184 270 R F1(+o)4.412 E F2 1.912
(e)-.18 E 4.412(printed. If)184 294 R F1(+o)4.412 E F2 1.912
(is supplied with no)4.412 F F3(option\255name)4.412 E F2 4.411(,as)C
1.911(eries of)-4.411 F F1(set)4.411 E F2 1.911(commands to)4.411 F -.18
(re)184 282 S(cr).18 E(eate the curr)-.18 E
(re)184 306 S(cr).18 E(eate the curr)-.18 E
(ent option settings is displayed on the standar)-.18 E 2.5(do)-.18 G
(utput.)-2.5 E F1<ad70>144 294 Q F2 -.9(Tu)27.83 G .853(rn on).9 F F3
(utput.)-2.5 E F1<ad70>144 318 Q F2 -.9(Tu)27.83 G .853(rn on).9 F F3
(privileged)3.923 E F2 3.353(mode. In)3.683 F .853(this mode, the)3.353
F/F4 9/Palatino-Bold@0 SF($ENV)3.353 E F2(and)3.103 E F4($BASH_ENV)3.354
E F2 .854(\214les ar)3.104 F 3.354(en)-.18 G(ot)-3.354 E(pr)184 306 Q
E F2 .854(\214les ar)3.104 F 3.354(en)-.18 G(ot)-3.354 E(pr)184 330 Q
2.873(ocessed, shell functions ar)-.18 F 5.373(en)-.18 G 2.873
(ot inherited fr)-5.373 F 2.873(om the envir)-.18 F 2.873
(onment, and the)-.18 F F4(SHELLOPTS)184 318 Q F2 .548
(onment, and the)-.18 F F4(SHELLOPTS)184 342 Q F2 .548
(variable, if it appears in the envir)2.798 F .548(onment, is ignor)-.18
F 3.049(ed. If)-.18 F .549(the shell is)3.049 F 1.115
(started with the ef)184 330 R 1.115(fective user \(gr)-.18 F 1.115
(started with the ef)184 354 R 1.115(fective user \(gr)-.18 F 1.115
(oup\) id not equal to the r)-.18 F 1.115(eal user \(gr)-.18 F 1.115
(oup\) id,)-.18 F .497(and the)184 342 R F1<ad70>2.997 E F2 .498
(oup\) id,)-.18 F .497(and the)184 366 R F1<ad70>2.997 E F2 .498
(option is not supplied, these actions ar)2.998 F 2.998(et)-.18 G .498
(aken and the ef)-2.998 F .498(fective user)-.18 F .685
(id is set to the r)184 354 R .685(eal user id.)-.18 F .685(If the)5.685
(id is set to the r)184 378 R .685(eal user id.)-.18 F .685(If the)5.685
F F1<ad70>3.185 E F2 .684(option is supplied at startup, the ef)3.185 F
(fective)-.18 E .752(user id is not r)184 366 R 3.252(eset. T)-.18 F
(fective)-.18 E .752(user id is not r)184 390 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
(ids to be set to the r)184 378 Q(eal user and gr)-.18 E(oup ids.)-.18 E
F1<ad74>144 390 Q F2(Exit after r)30.61 E
(eading and executing one command.)-.18 E F1<ad75>144 402 Q F2 -.88 -.9
(ids to be set to the r)184 402 Q(eal user and gr)-.18 E(oup ids.)-.18 E
F1<ad74>144 414 Q F2(Exit after r)30.61 E
(eading and executing one command.)-.18 E F1<ad75>144 426 Q F2 -.88 -.9
(Tr e)27.83 H 2.498(at unset variables as an err).9 F 2.498
(or when performing parameter expansion.)-.18 F(If)7.498 E .869
(expansion is attempted on an unset variable, the shell prints an err)
184 414 R .87(or message,)-.18 F
(and, if not interactive, exits with a non-zer)184 426 Q 2.5(os)-.18 G
(tatus.)-2.5 E F1<ad76>144 438 Q F2(Print shell input lines as they ar)
28.38 E 2.5(er)-.18 G(ead.)-2.68 E F1<ad78>144 450 Q F2 2.637
184 438 R .87(or message,)-.18 F
(and, if not interactive, exits with a non-zer)184 450 Q 2.5(os)-.18 G
(tatus.)-2.5 E F1<ad76>144 462 Q F2(Print shell input lines as they ar)
28.38 E 2.5(er)-.18 G(ead.)-2.68 E F1<ad78>144 474 Q F2 2.637
(After expanding each)28.94 F F3 2.637(simple command)5.137 F F2(,)A F1
(for)5.137 E F2(command,)5.137 E F1(case)5.136 E F2(command,)5.136 E F1
(select)5.136 E F2 .954(command, or arithmetic)184 462 R F1(for)3.454 E
(select)5.136 E F2 .954(command, or arithmetic)184 486 R F1(for)3.454 E
F2 .955(command, display the expanded value of)3.455 F F4(PS4)3.455 E/F5
9/Palatino-Roman@0 SF(,)A F2(fol-)3.205 E
(lowed by the command and its expanded ar)184 474 Q
(lowed by the command and its expanded ar)184 498 Q
(guments or associated wor)-.18 E 2.5(dl)-.18 G(ist.)-2.5 E F1<ad42>144
486 Q F2 .484(The shell performs brace expansion \(see)27.27 F F1 .484
510 Q F2 .484(The shell performs brace expansion \(see)27.27 F F1 .484
(Brace Expansion)2.984 F F2 2.984(above\). This)2.984 F .484(is on by)
2.984 F(default.)184 498 Q F1<ad43>144 510 Q F2 .077(If set,)26.72 F F1
2.984 F(default.)184 522 Q F1<ad43>144 534 Q F2 .077(If set,)26.72 F F1
(bash)2.577 E F2 .077(does not overwrite an existing \214le with the)
2.577 F F1(>)2.578 E F2(,)A F1(>&)2.578 E F2 2.578(,a)C(nd)-2.578 E F1
(<>)2.578 E F2 -.18(re)2.578 G(dir).18 E(ection)-.18 E 2.645
(operators. This)184 522 R .145(may be overridden when cr)2.645 F .145
(eating output \214les by using the r)-.18 F(edi-)-.18 E -.18(re)184 534
(operators. This)184 546 R .145(may be overridden when cr)2.645 F .145
(eating output \214les by using the r)-.18 F(edi-)-.18 E -.18(re)184 558
S(ction operator).18 E F1(>|)2.5 E F2(instead of)2.5 E F1(>)2.5 E F2(.)A
F1<ad45>144 546 Q F2 .901(If set, any trap on)27.83 F F1(ERR)3.402 E F2
F1<ad45>144 570 Q F2 .901(If set, any trap on)27.83 F F1(ERR)3.402 E F2
.902(is inherited by shell functions, command substitutions,)3.402 F .75
(and commands executed in a subshell envir)184 558 R 3.25(onment. The)
(and commands executed in a subshell envir)184 582 R 3.25(onment. The)
-.18 F F1(ERR)3.25 E F2 .75(trap is normally)3.25 F
(not inherited in such cases.)184 570 Q F1<ad48>144 582 Q F2(Enable)
(not inherited in such cases.)184 594 Q F1<ad48>144 606 Q F2(Enable)
25.61 E F1(!)2.515 E F2 .015(style history substitution.)5.015 F .016
(This option is on by default when the shell is)5.016 F(interactive.)184
594 Q F1<ad50>144 606 Q F2 .693(If set, the shell does not follow symbo\
lic links when executing commands such)27.83 F(as)184 618 Q F1(cd)3.569
618 Q F1<ad50>144 630 Q F2 .693(If set, the shell does not follow symbo\
lic links when executing commands such)27.83 F(as)184 642 Q F1(cd)3.569
E F2 1.069(that change the curr)3.569 F 1.069(ent working dir)-.18 F
(ectory)-.18 E 6.069(.I)-1.11 G 3.569(tu)-6.069 G 1.07
(ses the physical dir)-3.569 F(ectory)-.18 E(str)184 630 Q(uctur)-.08 E
(ses the physical dir)-3.569 F(ectory)-.18 E(str)184 654 Q(uctur)-.08 E
2.912(ei)-.18 G 2.912(nstead. By)-2.912 F(default,)2.912 E F1(bash)2.912
E F2 .412(follows the logical chain of dir)2.912 F .411(ectories when)
-.18 F(performing commands which change the curr)184 642 Q(ent dir)-.18
E(ectory)-.18 E(.)-1.11 E F1<ad54>144 654 Q F2 1.25(If set, any trap on)
-.18 F(performing commands which change the curr)184 666 Q(ent dir)-.18
E(ectory)-.18 E(.)-1.11 E F1<ad54>144 678 Q F2 1.25(If set, any trap on)
27.27 F F1(DEBUG)3.751 E F2 1.251
(is inherited by shell functions, command substitu-)3.751 F .712
(tions, and commands executed in a subshell envir)184 666 R 3.212
(tions, and commands executed in a subshell envir)184 690 R 3.212
(onment. The)-.18 F F1(DEBUG)3.212 E F2 .711(trap is)3.211 F
(normally not inherited in such cases.)184 678 Q F1<adad>144 690 Q F2
(normally not inherited in such cases.)184 702 Q F1<adad>144 714 Q F2
1.781(If no ar)27.88 F 1.782
(guments follow this option, then the positional parameters ar)-.18 F
4.282(eu)-.18 G(nset.)-4.282 E 1.303
(Otherwise, the positional parameters ar)184 702 R 3.803(es)-.18 G 1.303
(Otherwise, the positional parameters ar)184 726 R 3.803(es)-.18 G 1.303
(et to the)-3.803 F F3(ar)3.803 E(g)-.18 E F2 1.303
(s, even if some of them)B(begin with a)184 714 Q F1<ad>2.5 E F2(.)A F0
(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735 E(13)198.725 E 0 Cg EP
(s, even if some of them)B F0(GNU Bash-3.0)72 768 Q(2004 Apr 20)148.735
E(13)198.725 E 0 Cg EP
%%Page: 14 14
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF -.35(BA)72 48 S(SH_B).35 E(UIL)-.1 E 290.48
(TINS\(1\) B)-.92 F(ASH_B)-.35 E(UIL)-.1 E(TINS\(1\))-.92 E/F1 10
/Palatino-Bold@0 SF<ad>144 84 Q/F2 10/Palatino-Roman@0 SF 1.295
/Palatino-Roman@0 SF(begin with a)184 84 Q/F2 10/Palatino-Bold@0 SF<ad>
2.5 E F1(.)A F2<ad>144 96 Q F1 1.295
(Signal the end of options, cause all r)33.94 F(emaining)-.18 E/F3 10
/Palatino-Italic@0 SF(ar)3.796 E(g)-.18 E F2 3.796(st)C 3.796(ob)-3.796
/Palatino-Italic@0 SF(ar)3.796 E(g)-.18 E F1 3.796(st)C 3.796(ob)-3.796
G 3.796(ea)-3.796 G 1.296(ssigned to the posi-)-3.796 F .042
(tional parameters.)184 96 R(The)5.042 E F1<ad78>2.542 E F2(and)2.542 E
F1<ad76>2.542 E F2 .041(options ar)2.541 F 2.541(et)-.18 G .041
(tional parameters.)184 108 R(The)5.042 E F2<ad78>2.542 E F1(and)2.542 E
F2<ad76>2.542 E F1 .041(options ar)2.541 F 2.541(et)-.18 G .041
(urned of)-2.541 F 2.541(f. If)-.18 F(ther)2.541 E 2.541(ea)-.18 G .401
-.18(re n)-2.541 H(o).18 E F3(ar)2.541 E(g)-.18 E F2 .041(s, the)B
(positional parameters r)184 108 Q(emain unchanged.)-.18 E .12
(The options ar)144 124.8 R 2.62(eo)-.18 G .48 -.18(ff b)-2.62 H 2.62
-.18(re n)-2.541 H(o).18 E F3(ar)2.541 E(g)-.18 E F1 .041(s, the)B
(positional parameters r)184 120 Q(emain unchanged.)-.18 E .12
(The options ar)144 136.8 R 2.62(eo)-.18 G .48 -.18(ff b)-2.62 H 2.62
(yd).18 G .121(efault unless otherwise noted.)-2.62 F .121
(Using + rather than \255 causes these)5.121 F .278
(options to be turned of)144 136.8 R 2.778(f. The)-.18 F .277
(options to be turned of)144 148.8 R 2.778(f. The)-.18 F .277
(options can also be speci\214ed as ar)2.777 F .277
(guments to an invocation)-.18 F .722(of the shell.)144 148.8 R .723
(The curr)5.723 F .723(ent set of options may be found in)-.18 F F1
<24ad>3.223 E F2 5.723(.T)C .723(he r)-5.723 F .723
(eturn status is always)-.18 F(tr)144 160.8 Q
(ue unless an invalid option is encounter)-.08 E(ed.)-.18 E F1(shift)108
177.6 Q F2([)2.5 E F3(n)A F2(])A .807(The positional parameters fr)144
189.6 R(om)-.18 E F3(n)3.306 E F2 .806(+1 ... ar)B 3.306(er)-.18 G .806
(enamed to)-3.486 F F1 .806($1 ....)3.306 F F2 .806(Parameters r)5.806 F
(epr)-.18 E .806(esented by)-.18 F .055(the numbers)144 201.6 R F1($#)
2.555 E F2 .055(down to)2.555 F F1($#)2.555 E F2<ad>A F3(n)A F2 .055
(+1 ar)B 2.555(eu)-.18 G(nset.)-2.555 E F3(n)5.315 E F2 .055
(guments to an invocation)-.18 F .722(of the shell.)144 160.8 R .723
(The curr)5.723 F .723(ent set of options may be found in)-.18 F F2
<24ad>3.223 E F1 5.723(.T)C .723(he r)-5.723 F .723
(eturn status is always)-.18 F(tr)144 172.8 Q
(ue unless an invalid option is encounter)-.08 E(ed.)-.18 E F2(shift)108
189.6 Q F1([)2.5 E F3(n)A F1(])A .807(The positional parameters fr)144
201.6 R(om)-.18 E F3(n)3.306 E F1 .806(+1 ... ar)B 3.306(er)-.18 G .806
(enamed to)-3.486 F F2 .806($1 ....)3.306 F F1 .806(Parameters r)5.806 F
(epr)-.18 E .806(esented by)-.18 F .055(the numbers)144 213.6 R F2($#)
2.555 E F1 .055(down to)2.555 F F2($#)2.555 E F1<ad>A F3(n)A F1 .055
(+1 ar)B 2.555(eu)-.18 G(nset.)-2.555 E F3(n)5.315 E F1 .055
(must be a non-negative number less than or)2.635 F .495(equal to)144
213.6 R F1($#)2.995 E F2 5.495(.I)C(f)-5.495 E F3(n)3.255 E F2 .494
225.6 R F2($#)2.995 E F1 5.495(.I)C(f)-5.495 E F3(n)3.255 E F1 .494
(is 0, no parameters ar)3.075 F 2.994(ec)-.18 G 2.994(hanged. If)-2.994
F F3(n)3.254 E F2 .494(is not given, it is assumed to be 1.)3.074 F(If)
144 225.6 Q F3(n)4.052 E F2 1.292(is gr)3.872 F 1.292(eater than)-.18 F
F1($#)3.792 E F2 3.792(,t)C 1.292(he positional parameters ar)-3.792 F
F F3(n)3.254 E F1 .494(is not given, it is assumed to be 1.)3.074 F(If)
144 237.6 Q F3(n)4.052 E F1 1.292(is gr)3.872 F 1.292(eater than)-.18 F
F2($#)3.792 E F1 3.792(,t)C 1.292(he positional parameters ar)-3.792 F
3.792(en)-.18 G 1.292(ot changed.)-3.792 F 1.292(The r)6.292 F 1.292
(eturn status is)-.18 F(gr)144 237.6 Q(eater than zer)-.18 E 2.5(oi)-.18
G(f)-2.5 E F3(n)2.76 E F2(is gr)2.58 E(eater than)-.18 E F1($#)2.5 E F2
(or less than zer)2.5 E(o; otherwise 0.)-.18 E F1(shopt)108 254.4 Q F2
([)2.5 E F1(\255pqsu)A F2 2.5(][)C F1<ad6f>-2.5 E F2 2.5(][)C F3
(optname)-2.5 E F2(...])2.5 E -.92(To)144 266.4 S 1.523
(eturn status is)-.18 F(gr)144 249.6 Q(eater than zer)-.18 E 2.5(oi)-.18
G(f)-2.5 E F3(n)2.76 E F1(is gr)2.58 E(eater than)-.18 E F2($#)2.5 E F1
(or less than zer)2.5 E(o; otherwise 0.)-.18 E F2(shopt)108 266.4 Q F1
([)2.5 E F2(\255pqsu)A F1 2.5(][)C F2<ad6f>-2.5 E F1 2.5(][)C F3
(optname)-2.5 E F1(...])2.5 E -.92(To)144 278.4 S 1.523
(ggle the values of variables contr).92 F 1.522
(olling optional shell behavior)-.18 F 6.522(.W)-.74 G 1.522
(ith no options, or)-7.072 F 2.531(with the)144 278.4 R F1<ad70>5.031 E
F2 2.531(option, a list of all settable options is displayed, with an i\
ndication of)5.031 F .962(whether or not each is set.)144 290.4 R(The)
5.962 E F1<ad70>3.462 E F2 .962
(ith no options, or)-7.072 F 2.531(with the)144 290.4 R F2<ad70>5.031 E
F1 2.531(option, a list of all settable options is displayed, with an i\
ndication of)5.031 F .962(whether or not each is set.)144 302.4 R(The)
5.962 E F2<ad70>3.462 E F1 .962
(option causes output to be displayed in a form that)3.462 F(may be r)
144 302.4 Q(eused as input.)-.18 E
(Other options have the following meanings:)5 E F1<ad73>144 314.4 Q F2
(Enable \(set\) each)25.5 E F3(optname)2.5 E F2(.)A F1<ad75>144 326.4 Q
F2(Disable \(unset\) each)23.83 E F3(optname)2.5 E F2(.)A F1<ad71>144
338.4 Q F2(Suppr)23.83 E .903(esses normal output \(quiet mode\); the r)
144 314.4 Q(eused as input.)-.18 E
(Other options have the following meanings:)5 E F2<ad73>144 326.4 Q F1
(Enable \(set\) each)25.5 E F3(optname)2.5 E F1(.)A F2<ad75>144 338.4 Q
F1(Disable \(unset\) each)23.83 E F3(optname)2.5 E F1(.)A F2<ad71>144
350.4 Q F1(Suppr)23.83 E .903(esses normal output \(quiet mode\); the r)
-.18 F .903(eturn status indicates whether the)-.18 F F3(optname)180
350.4 Q F2 1.679(is set or unset.)4.179 F 1.679(If multiple)6.679 F F3
(optname)4.178 E F2(ar)4.178 E 1.678(guments ar)-.18 F 4.178(eg)-.18 G
1.678(iven with)-4.178 F F1<ad71>4.178 E F2 4.178(,t)C(he)-4.178 E -.18
(re)180 362.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 F2(ar)2.5 E 2.5(ee)-.18 G(nabled; non-zer)-2.5
E 2.5(oo)-.18 G(therwise.)-2.5 E F1<ad6f>144 374.4 Q F2 1.348
(Restricts the values of)24.38 F F3(optname)3.848 E F2 1.348
(to be those de\214ned for the)3.848 F F1<ad6f>3.848 E F2 1.348
(option to the)3.848 F F1(set)3.848 E F2(builtin.)180 386.4 Q 1.86
(If either)144 403.2 R F1<ad73>4.36 E F2(or)4.36 E F1<ad75>4.36 E F2
1.86(is used with no)4.36 F F3(optname)4.36 E F2(ar)4.36 E 1.86
362.4 Q F1 1.679(is set or unset.)4.179 F 1.679(If multiple)6.679 F F3
(optname)4.178 E F1(ar)4.178 E 1.678(guments ar)-.18 F 4.178(eg)-.18 G
1.678(iven with)-4.178 F F2<ad71>4.178 E F1 4.178(,t)C(he)-4.178 E -.18
(re)180 374.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 F2<ad6f>144 386.4 Q F1 1.348
(Restricts the values of)24.38 F F3(optname)3.848 E F1 1.348
(to be those de\214ned for the)3.848 F F2<ad6f>3.848 E F1 1.348
(option to the)3.848 F F2(set)3.848 E F1(builtin.)180 398.4 Q 1.86
(If either)144 415.2 R F2<ad73>4.36 E F1(or)4.36 E F2<ad75>4.36 E F1
1.86(is used with no)4.36 F F3(optname)4.36 E F1(ar)4.36 E 1.86
(guments, the display is limited to those)-.18 F 1.061(options which ar)
144 415.2 R 3.561(es)-.18 G 1.062(et or unset, r)-3.561 F(espectively)
-.18 E 6.062(.U)-1.11 G 1.062(nless otherwise noted, the)-6.062 F F1
(shopt)3.562 E F2(options)3.562 E(ar)144 427.2 Q 2.5(ed)-.18 G
(isabled \(unset\) by default.)-2.5 E .473(The r)144 444 R .473
144 427.2 R 3.561(es)-.18 G 1.062(et or unset, r)-3.561 F(espectively)
-.18 E 6.062(.U)-1.11 G 1.062(nless otherwise noted, the)-6.062 F F2
(shopt)3.562 E F1(options)3.562 E(ar)144 439.2 Q 2.5(ed)-.18 G
(isabled \(unset\) by default.)-2.5 E .473(The r)144 456 R .473
(eturn status when listing options is zer)-.18 F 2.973(oi)-.18 G 2.973
(fa)-2.973 G(ll)-2.973 E F3(optnames)2.973 E F2(ar)2.973 E 2.973(ee)-.18
(fa)-2.973 G(ll)-2.973 E F3(optnames)2.973 E F1(ar)2.973 E 2.973(ee)-.18
G .472(nabled, non-zer)-2.973 F 2.972(oo)-.18 G(ther)-2.972 E(-)-.18 E
2.601(wise. When)144 456 R .101(setting or unsetting options, the r)
2.601(wise. When)144 468 R .101(setting or unsetting options, the r)
2.601 F .101(eturn status is zer)-.18 F 2.602(ou)-.18 G .102(nless an)
-2.602 F F3(optname)2.602 E F2 .102(is not)2.602 F 2.5(av)144 468 S
(alid shell option.)-2.5 E(The list of)144 484.8 Q F1(shopt)2.5 E F2
(options is:)2.5 E F1(cdable_vars)144 502.8 Q F2 .364(If set, an ar)184
514.8 R .364(gument to the)-.18 F F1(cd)2.864 E F2 .364
-2.602 F F3(optname)2.602 E F1 .102(is not)2.602 F 2.5(av)144 480 S
(alid shell option.)-2.5 E(The list of)144 496.8 Q F2(shopt)2.5 E F1
(options is:)2.5 E F2(cdable_vars)144 514.8 Q F1 .364(If set, an ar)184
526.8 R .364(gument to the)-.18 F F2(cd)2.864 E F1 .364
(builtin command that is not a dir)2.864 F .364(ectory is assumed)-.18 F
(to be the name of a variable whose value is the dir)184 526.8 Q
(ectory to change to.)-.18 E F1(cdspell)144 538.8 Q F2 1.137
(to be the name of a variable whose value is the dir)184 538.8 Q
(ectory to change to.)-.18 E F2(cdspell)144 550.8 Q F1 1.137
(If set, minor err)7.24 F 1.138(ors in the spelling of a dir)-.18 F
1.138(ectory component in a)-.18 F F1(cd)3.638 E F2(command)3.638 E
1.289(will be corr)184 550.8 R 3.788(ected. The)-.18 F(err)3.788 E 1.288
1.138(ectory component in a)-.18 F F2(cd)3.638 E F1(command)3.638 E
1.289(will be corr)184 562.8 R 3.788(ected. The)-.18 F(err)3.788 E 1.288
(ors checked for ar)-.18 F 3.788(et)-.18 G 1.288
(ransposed characters, a missing)-3.788 F(character)184 562.8 Q 2.74(,a)
(ransposed characters, a missing)-3.788 F(character)184 574.8 Q 2.74(,a)
-.74 G .24(nd one character too many)-2.74 F 5.241(.I)-1.11 G 2.741(fac)
-5.241 G(orr)-2.741 E .241(ection is found, the corr)-.18 F .241
(ected \214le)-.18 F .431(name is printed, and the command pr)184 574.8
(ected \214le)-.18 F .431(name is printed, and the command pr)184 586.8
R 2.931(oceeds. This)-.18 F .43(option is only used by inter)2.931 F(-)
-.18 E(active shells.)184 586.8 Q F1(checkhash)144 598.8 Q F2 .762
(If set,)184 610.8 R F1(bash)3.262 E F2 .763
-.18 E(active shells.)184 598.8 Q F2(checkhash)144 610.8 Q F1 .762
(If set,)184 622.8 R F2(bash)3.262 E F1 .763
(checks that a command found in the hash table exists befor)3.263 F
3.263(et)-.18 G(rying)-3.263 E .023(to execute it.)184 622.8 R .023
3.263(et)-.18 G(rying)-3.263 E .023(to execute it.)184 634.8 R .023
(If a hashed command no longer exists, a normal path sear)5.023 F .022
(ch is per)-.18 F(-)-.18 E(formed.)184 634.8 Q F1(checkwinsize)144 646.8
Q F2 2.584(If set,)184 658.8 R F1(bash)5.084 E F2 2.584
(ch is per)-.18 F(-)-.18 E(formed.)184 646.8 Q F2(checkwinsize)144 658.8
Q F1 2.584(If set,)184 670.8 R F2(bash)5.084 E F1 2.584
(checks the window size after each command and, if necessary)5.084 F(,)
-1.11 E(updates the values of)184 670.8 Q/F4 9/Palatino-Bold@0 SF(LINES)
2.5 E F2(and)2.25 E F4(COLUMNS)2.5 E/F5 9/Palatino-Roman@0 SF(.)A F1
(cmdhist)144 682.8 Q F2 1.298(If set,)184 694.8 R F1(bash)3.798 E F2
-1.11 E(updates the values of)184 682.8 Q/F4 9/Palatino-Bold@0 SF(LINES)
2.5 E F1(and)2.25 E F4(COLUMNS)2.5 E/F5 9/Palatino-Roman@0 SF(.)A F2
(cmdhist)144 694.8 Q F1 1.298(If set,)184 706.8 R F2(bash)3.798 E F1
1.297(attempts to save all lines of a multiple-line command in the same)
3.797 F(history entry)184 706.8 Q 5(.T)-1.11 G(his allows easy r)-5 E
3.797 F(history entry)184 718.8 Q 5(.T)-1.11 G(his allows easy r)-5 E
(e-editing of multi-line commands.)-.18 E F0(GNU Bash-3.0)72 768 Q
(2004 Apr 20)148.735 E(14)198.725 E 0 Cg EP
%%Page: 15 15
+1 -1
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.18.1
%%CreationDate: Mon Nov 22 12:03:34 2004
%%CreationDate: Wed Nov 24 15:49:24 2004
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%DocumentSuppliedResources: procset grops 1.18 1
+2 -2
View File
@@ -2,9 +2,9 @@
Copyright (C) 1988-2004 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Mon Nov 22 11:08:58 EST 2004
@set LASTCHANGE Wed Nov 24 14:11:51 EST 2004
@set EDITION 3.1-devel
@set VERSION 3.1-devel
@set UPDATED 22 November 2004
@set UPDATED 24 November 2004
@set UPDATED-MONTH November 2004
+24 -3
View File
@@ -3114,7 +3114,7 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
COMMAND *tc, *fc, *save_current;
char *debug_trap, *error_trap, *return_trap;
#if defined (ARRAY_VARS)
SHELL_VAR *funcname_v, *bash_source_v, *bash_lineno_v;
SHELL_VAR *funcname_v, *nfv, *bash_source_v, *bash_lineno_v;
ARRAY *funcname_a, *bash_source_a, *bash_lineno_a;
#endif
FUNCTION_DEF *shell_fn;
@@ -3240,7 +3240,17 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
return_val = setjmp (return_catch);
if (return_val)
result = return_catch_value;
{
result = return_catch_value;
#if 0
/* Run the RETURN trap in the function's context. XXX - have to talk
to Rocky about why his bashdb code doesn't have `return' run the
RETURN trap. */
save_current = currently_executing_command;
run_return_trap ();
currently_executing_command = save_current;
#endif
}
else
{
/* Run the debug trap here so we can trap at the start of a function's
@@ -3264,6 +3274,10 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
}
#else
result = execute_command_internal (fc, 0, NO_PIPE, NO_PIPE, fds_to_close);
save_current = currently_executing_command;
run_return_trap ();
currently_executing_command = save_current;
#endif
showing_function_line = 0;
}
@@ -3277,9 +3291,16 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
funcnest--;
#if defined (ARRAY_VARS)
/* These two variables cannot be unset, and cannot be affected by the
function. */
array_pop (bash_source_a);
array_pop (funcname_a);
array_pop (bash_lineno_a);
/* FUNCNAME can be unset, and so can potentially be changed by the
function. */
GET_ARRAY_FROM_VAR ("FUNCNAME", nfv, funcname_a);
if (nfv == funcname_v)
array_pop (funcname_a);
#endif
if (variable_context == 0 || this_shell_function == 0)
+49 -15
View File
@@ -1619,8 +1619,9 @@ execute_for_command (for_command)
if (echo_command_at_execute)
xtrace_print_for_command_head (for_command);
/* Save this command unless it's a trap command. */
if (this_command_name == 0 || (STREQ (this_command_name, "trap") == 0))
/* Save this command unless it's a trap command and we're not running
a debug trap. */
if (signal_in_progress (DEBUG_TRAP) == 0 && (this_command_name == 0 || (STREQ (this_command_name, "trap") == 0)))
{
FREE (the_printed_command_except_trap);
the_printed_command_except_trap = savestring (the_printed_command);
@@ -1728,8 +1729,11 @@ eval_arith_for_expr (l, okp)
command_string_index = 0;
print_arith_command (new);
FREE (the_printed_command_except_trap);
the_printed_command_except_trap = savestring (the_printed_command);
if (signal_in_progress (DEBUG_TRAP) == 0)
{
FREE (the_printed_command_except_trap);
the_printed_command_except_trap = savestring (the_printed_command);
}
r = run_debug_trap ();
/* In debugging mode, if the DEBUG trap returns a non-zero status, we
@@ -2036,8 +2040,11 @@ execute_select_command (select_command)
if (echo_command_at_execute)
xtrace_print_select_command_head (select_command);
FREE (the_printed_command_except_trap);
the_printed_command_except_trap = savestring (the_printed_command);
if (signal_in_progress (DEBUG_TRAP) == 0 && (this_command_name == 0 || (STREQ (this_command_name, "trap") == 0)))
{
FREE (the_printed_command_except_trap);
the_printed_command_except_trap = savestring (the_printed_command);
}
retval = run_debug_trap ();
#if defined (DEBUGGER)
@@ -2165,7 +2172,7 @@ execute_case_command (case_command)
if (echo_command_at_execute)
xtrace_print_case_command_head (case_command);
if (this_command_name == 0 || (STREQ (this_command_name, "trap") == 0))
if (signal_in_progress (DEBUG_TRAP == 0) && (this_command_name == 0 || (STREQ (this_command_name, "trap") == 0)))
{
FREE (the_printed_command_except_trap);
the_printed_command_except_trap = savestring (the_printed_command);
@@ -2375,8 +2382,12 @@ execute_arith_command (arith_command)
command_string_index = 0;
print_arith_command (arith_command->exp);
FREE (the_printed_command_except_trap);
the_printed_command_except_trap = savestring (the_printed_command);
if (signal_in_progress (DEBUG_TRAP) == 0)
{
FREE (the_printed_command_except_trap);
the_printed_command_except_trap = savestring (the_printed_command);
}
/* Run the debug trap before each arithmetic command, but do it after we
update the line number information and before we expand the various
@@ -2532,8 +2543,12 @@ execute_cond_command (cond_command)
command_string_index = 0;
print_cond_command (cond_command);
FREE (the_printed_command_except_trap);
the_printed_command_except_trap = savestring (the_printed_command);
if (signal_in_progress (DEBUG_TRAP) == 0)
{
FREE (the_printed_command_except_trap);
the_printed_command_except_trap = savestring (the_printed_command);
}
/* Run the debug trap before each conditional command, but do it after we
update the line number information. */
@@ -2686,7 +2701,7 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
command_string_index = 0;
print_simple_command (simple_command);
if (this_command_name == 0 || (STREQ (this_command_name, "trap") == 0))
if (signal_in_progress (DEBUG_TRAP) == 0 && (this_command_name == 0 || (STREQ (this_command_name, "trap") == 0)))
{
FREE (the_printed_command_except_trap);
the_printed_command_except_trap = the_printed_command ? savestring (the_printed_command) : (char *)0;
@@ -3099,7 +3114,7 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
COMMAND *tc, *fc, *save_current;
char *debug_trap, *error_trap, *return_trap;
#if defined (ARRAY_VARS)
SHELL_VAR *funcname_v, *bash_source_v, *bash_lineno_v;
SHELL_VAR *funcname_v, *nfv, *bash_source_v, *bash_lineno_v;
ARRAY *funcname_a, *bash_source_a, *bash_lineno_a;
#endif
FUNCTION_DEF *shell_fn;
@@ -3225,7 +3240,15 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
return_val = setjmp (return_catch);
if (return_val)
result = return_catch_value;
{
result = return_catch_value;
#if 0
/* Run the RETURN trap in the function's context */
save_current = currently_executing_command;
run_return_trap ();
currently_executing_command = save_current;
#endif
}
else
{
/* Run the debug trap here so we can trap at the start of a function's
@@ -3249,6 +3272,10 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
}
#else
result = execute_command_internal (fc, 0, NO_PIPE, NO_PIPE, fds_to_close);
save_current = currently_executing_command;
run_return_trap ();
currently_executing_command = save_current;
#endif
showing_function_line = 0;
}
@@ -3262,9 +3289,16 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
funcnest--;
#if defined (ARRAY_VARS)
/* These two variables cannot be unset, and cannot be affected by the
function. */
array_pop (bash_source_a);
array_pop (funcname_a);
array_pop (bash_lineno_a);
/* FUNCNAME can be unset, and so can potentially be changed by the
function. */
GET_ARRAY_FROM_VAR ("FUNCNAME", nfv, funcname_a);
if (nfv == funcname_v)
array_pop (funcname_a);
#endif
if (variable_context == 0 || this_shell_function == 0)
+2
View File
@@ -88,11 +88,13 @@ extern void tzset(void);
static int weeknumber(const struct tm *timeptr, int firstweekday);
static int iso8601wknum(const struct tm *timeptr);
#ifndef inline
#ifdef __GNUC__
#define inline __inline__
#else
#define inline /**/
#endif
#endif
#define range(low, item, hi) max(low, min(item, hi))
+3 -3
View File
@@ -56,7 +56,7 @@ fn4() {
#
# Test of support for debugging facilities in bash
#
# Test debugger set option fntrace - set on. Not in vanilla Bash 2.05
# Test debugger set option functrace - set on. Not in vanilla Bash 2.05
#
set -o functrace
trap 'print_debug_trap $LINENO' DEBUG
@@ -72,7 +72,7 @@ fn2
fn3
source ./dbg-support.sub
# Test debugger set option fntrace - set off
# Test debugger set option functrace - set off
set +T
# We should not trace into this.
@@ -82,7 +82,7 @@ fn3
fn4
source ./dbg-support.sub
# Another way to say: set -o fntrace
# Another way to say: set -o functrace
set -T
# We should trace into this.
+1 -1
View File
@@ -62,7 +62,7 @@ set -o functrace
trap 'print_debug_trap $LINENO' DEBUG
trap 'print_return_trap $LINENO' RETURN
# Funcname is now an array. Vanilla Bash 2.05 doesn't have FUNCNAME array.
# Funcname is now an array, but you still can't see it outside a function
echo "FUNCNAME" ${FUNCNAME[0]:-main}
# We should trace into the below.
+1 -1
View File
@@ -903,8 +903,8 @@ reset_or_restore_signal_handlers (reset)
sigmodes[ERROR_TRAP] &= ~SIG_TRAPPED;
#if defined (DEBUGGER)
if (debugging_mode == 0 || function_trace_mode == 0)
sigmodes[RETURN_TRAP] &= ~SIG_TRAPPED;
#endif
sigmodes[RETURN_TRAP] &= ~SIG_TRAPPED;
}
/* Reset trapped signals to their original values, but don't free the
+994
View File
@@ -0,0 +1,994 @@
/* trap.c -- Not the trap command, but useful functions for manipulating
those objects. The trap command is in builtins/trap.def. */
/* Copyright (C) 1987-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. */
#include "config.h"
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#include "bashtypes.h"
#include "bashansi.h"
#include <stdio.h>
#include <errno.h>
#include "bashintl.h"
#include "trap.h"
#include "shell.h"
#include "flags.h"
#include "input.h" /* for save_token_state, restore_token_state */
#include "signames.h"
#include "builtins.h"
#include "builtins/common.h"
#include "builtins/builtext.h"
#ifndef errno
extern int errno;
#endif
/* Flags which describe the current handling state of a signal. */
#define SIG_INHERITED 0x0 /* Value inherited from parent. */
#define SIG_TRAPPED 0x1 /* Currently trapped. */
#define SIG_HARD_IGNORE 0x2 /* Signal was ignored on shell entry. */
#define SIG_SPECIAL 0x4 /* Treat this signal specially. */
#define SIG_NO_TRAP 0x8 /* Signal cannot be trapped. */
#define SIG_INPROGRESS 0x10 /* Signal handler currently executing. */
#define SIG_CHANGED 0x20 /* Trap value changed in trap handler. */
#define SIG_IGNORED 0x40 /* The signal is currently being ignored. */
#define SPECIAL_TRAP(s) ((s) == EXIT_TRAP || (s) == DEBUG_TRAP || (s) == ERROR_TRAP || (s) == RETURN_TRAP)
/* An array of such flags, one for each signal, describing what the
shell will do with a signal. DEBUG_TRAP == NSIG; some code below
assumes this. */
static int sigmodes[BASH_NSIG];
static void free_trap_command __P((int));
static void change_signal __P((int, char *));
static void get_original_signal __P((int));
static int _run_trap_internal __P((int, char *));
static void reset_signal __P((int));
static void restore_signal __P((int));
static void reset_or_restore_signal_handlers __P((sh_resetsig_func_t *));
/* Variables used here but defined in other files. */
extern int interrupt_immediately;
extern int last_command_exit_value;
extern int line_number;
extern char *this_command_name;
extern sh_builtin_func_t *this_shell_builtin;
extern procenv_t wait_intr_buf;
extern int return_catch_flag, return_catch_value;
extern int subshell_level;
/* The list of things to do originally, before we started trapping. */
SigHandler *original_signals[NSIG];
/* For each signal, a slot for a string, which is a command to be
executed when that signal is recieved. The slot can also contain
DEFAULT_SIG, which means do whatever you were going to do before
you were so rudely interrupted, or IGNORE_SIG, which says ignore
this signal. */
char *trap_list[BASH_NSIG];
/* A bitmap of signals received for which we have trap handlers. */
int pending_traps[NSIG];
/* Set to the number of the signal we're running the trap for + 1.
Used in execute_cmd.c and builtins/common.c to clean up when
parse_and_execute does not return normally after executing the
trap command (e.g., when `return' is executed in the trap command). */
int running_trap;
/* Set to last_command_exit_value before running a trap. */
int trap_saved_exit_value;
/* The (trapped) signal received while executing in the `wait' builtin */
int wait_signal_received;
/* A value which can never be the target of a trap handler. */
#define IMPOSSIBLE_TRAP_HANDLER (SigHandler *)initialize_traps
void
initialize_traps ()
{
register int i;
trap_list[EXIT_TRAP] = trap_list[DEBUG_TRAP] = trap_list[ERROR_TRAP] = trap_list[RETURN_TRAP] = (char *)NULL;
sigmodes[EXIT_TRAP] = sigmodes[DEBUG_TRAP] = sigmodes[ERROR_TRAP] = sigmodes[RETURN_TRAP] = SIG_INHERITED;
original_signals[EXIT_TRAP] = IMPOSSIBLE_TRAP_HANDLER;
for (i = 1; i < NSIG; i++)
{
pending_traps[i] = 0;
trap_list[i] = (char *)DEFAULT_SIG;
sigmodes[i] = SIG_INHERITED;
original_signals[i] = IMPOSSIBLE_TRAP_HANDLER;
}
/* Show which signals are treated specially by the shell. */
#if defined (SIGCHLD)
original_signals[SIGCHLD] =
(SigHandler *) set_signal_handler (SIGCHLD, SIG_DFL);
set_signal_handler (SIGCHLD, original_signals[SIGCHLD]);
sigmodes[SIGCHLD] |= (SIG_SPECIAL | SIG_NO_TRAP);
#endif /* SIGCHLD */
original_signals[SIGINT] =
(SigHandler *) set_signal_handler (SIGINT, SIG_DFL);
set_signal_handler (SIGINT, original_signals[SIGINT]);
sigmodes[SIGINT] |= SIG_SPECIAL;
#if defined (__BEOS__)
/* BeOS sets SIGINT to SIG_IGN! */
original_signals[SIGINT] = SIG_DFL;
#endif
original_signals[SIGQUIT] =
(SigHandler *) set_signal_handler (SIGQUIT, SIG_DFL);
set_signal_handler (SIGQUIT, original_signals[SIGQUIT]);
sigmodes[SIGQUIT] |= SIG_SPECIAL;
if (interactive)
{
original_signals[SIGTERM] =
(SigHandler *)set_signal_handler (SIGTERM, SIG_DFL);
set_signal_handler (SIGTERM, original_signals[SIGTERM]);
sigmodes[SIGTERM] |= SIG_SPECIAL;
}
}
#ifdef INCLUDE_UNUSED
/* Return a printable representation of the trap handler for SIG. */
static char *
trap_handler_string (sig)
int sig;
{
if (trap_list[sig] == (char *)DEFAULT_SIG)
return "DEFAULT_SIG";
else if (trap_list[sig] == (char *)IGNORE_SIG)
return "IGNORE_SIG";
else if (trap_list[sig] == (char *)IMPOSSIBLE_TRAP_HANDLER)
return "IMPOSSIBLE_TRAP_HANDLER";
else if (trap_list[sig])
return trap_list[sig];
else
return "NULL";
}
#endif
/* Return the print name of this signal. */
char *
signal_name (sig)
int sig;
{
char *ret;
/* on cygwin32, signal_names[sig] could be null */
ret = (sig >= BASH_NSIG || sig < 0 || signal_names[sig] == NULL)
? _("invalid signal number")
: signal_names[sig];
return ret;
}
/* Turn a string into a signal number, or a number into
a signal number. If STRING is "2", "SIGINT", or "INT",
then (int)2 is returned. Return NO_SIG if STRING doesn't
contain a valid signal descriptor. */
int
decode_signal (string, flags)
char *string;
int flags;
{
intmax_t sig;
char *name;
if (legal_number (string, &sig))
return ((sig >= 0 && sig < NSIG) ? (int)sig : NO_SIG);
/* A leading `SIG' may be omitted. */
for (sig = 0; sig < BASH_NSIG; sig++)
{
name = signal_names[sig];
if (name == 0 || name[0] == '\0')
continue;
/* Check name without the SIG prefix first case sensitivly or
insensitively depending on whether flags includes DSIG_NOCASE */
if (STREQN (name, "SIG", 3))
{
name += 3;
if ((flags & DSIG_NOCASE) && strcasecmp (string, name) == 0)
return ((int)sig);
else if ((flags & DSIG_NOCASE) == 0 && strcmp (string, name) == 0)
return ((int)sig);
/* If we can't use the `SIG' prefix to match, punt on this
name now. */
else if ((flags & DSIG_SIGPREFIX) == 0)
continue;
}
/* Check name with SIG prefix case sensitively or insensitively
depending on whether flags includes DSIG_NOCASE */
name = signal_names[sig];
if ((flags & DSIG_NOCASE) && strcasecmp (string, name) == 0)
return ((int)sig);
else if ((flags & DSIG_NOCASE) == 0 && strcmp (string, name) == 0)
return ((int)sig);
}
return (NO_SIG);
}
/* Non-zero when we catch a trapped signal. */
static int catch_flag;
void
run_pending_traps ()
{
register int sig;
int old_exit_value, *token_state;
if (catch_flag == 0) /* simple optimization */
return;
catch_flag = 0;
/* Preserve $? when running trap. */
old_exit_value = last_command_exit_value;
for (sig = 1; sig < NSIG; sig++)
{
/* XXX this could be made into a counter by using
while (pending_traps[sig]--) instead of the if statement. */
if (pending_traps[sig])
{
#if defined (HAVE_POSIX_SIGNALS)
sigset_t set, oset;
sigemptyset (&set);
sigemptyset (&oset);
sigaddset (&set, sig);
sigprocmask (SIG_BLOCK, &set, &oset);
#else
# if defined (HAVE_BSD_SIGNALS)
int oldmask = sigblock (sigmask (sig));
# endif
#endif /* HAVE_POSIX_SIGNALS */
if (sig == SIGINT)
{
run_interrupt_trap ();
CLRINTERRUPT;
}
else if (trap_list[sig] == (char *)DEFAULT_SIG ||
trap_list[sig] == (char *)IGNORE_SIG ||
trap_list[sig] == (char *)IMPOSSIBLE_TRAP_HANDLER)
{
/* This is possible due to a race condition. Say a bash
process has SIGTERM trapped. A subshell is spawned
using { list; } & and the parent does something and kills
the subshell with SIGTERM. It's possible for the subshell
to set pending_traps[SIGTERM] to 1 before the code in
execute_cmd.c eventually calls restore_original_signals
to reset the SIGTERM signal handler in the subshell. The
next time run_pending_traps is called, pending_traps[SIGTERM]
will be 1, but the trap handler in trap_list[SIGTERM] will
be invalid (probably DEFAULT_SIG, but it could be IGNORE_SIG).
Unless we catch this, the subshell will dump core when
trap_list[SIGTERM] == DEFAULT_SIG, because DEFAULT_SIG is
usually 0x0. */
internal_warning (_("run_pending_traps: bad value in trap_list[%d]: %p"),
sig, trap_list[sig]);
if (trap_list[sig] == (char *)DEFAULT_SIG)
{
internal_warning (_("run_pending_traps: signal handler is SIG_DFL, resending %d (%s) to myself"), sig, signal_name (sig));
kill (getpid (), sig);
}
}
else
{
token_state = save_token_state ();
parse_and_execute (savestring (trap_list[sig]), "trap", SEVAL_NONINT|SEVAL_NOHIST);
restore_token_state (token_state);
free (token_state);
}
pending_traps[sig] = 0;
#if defined (HAVE_POSIX_SIGNALS)
sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);
#else
# if defined (HAVE_BSD_SIGNALS)
sigsetmask (oldmask);
# endif
#endif /* POSIX_VERSION */
}
}
last_command_exit_value = old_exit_value;
}
sighandler
trap_handler (sig)
int sig;
{
int oerrno;
if ((sig >= NSIG) ||
(trap_list[sig] == (char *)DEFAULT_SIG) ||
(trap_list[sig] == (char *)IGNORE_SIG))
programming_error (_("trap_handler: bad signal %d"), sig);
else
{
oerrno = errno;
#if defined (MUST_REINSTALL_SIGHANDLERS)
set_signal_handler (sig, trap_handler);
#endif /* MUST_REINSTALL_SIGHANDLERS */
catch_flag = 1;
pending_traps[sig]++;
if (interrupt_immediately && this_shell_builtin && (this_shell_builtin == wait_builtin))
{
wait_signal_received = sig;
longjmp (wait_intr_buf, 1);
}
if (interrupt_immediately)
run_pending_traps ();
errno = oerrno;
}
SIGRETURN (0);
}
#if defined (JOB_CONTROL) && defined (SIGCHLD)
#ifdef INCLUDE_UNUSED
/* Make COMMAND_STRING be executed when SIGCHLD is caught. */
void
set_sigchld_trap (command_string)
char *command_string;
{
set_signal (SIGCHLD, command_string);
}
#endif
/* Make COMMAND_STRING be executed when SIGCHLD is caught iff SIGCHLD
is not already trapped. */
void
maybe_set_sigchld_trap (command_string)
char *command_string;
{
if ((sigmodes[SIGCHLD] & SIG_TRAPPED) == 0)
set_signal (SIGCHLD, command_string);
}
#endif /* JOB_CONTROL && SIGCHLD */
void
set_debug_trap (command)
char *command;
{
set_signal (DEBUG_TRAP, command);
}
void
set_error_trap (command)
char *command;
{
set_signal (ERROR_TRAP, command);
}
void
set_return_trap (command)
char *command;
{
set_signal (RETURN_TRAP, command);
}
#ifdef INCLUDE_UNUSED
void
set_sigint_trap (command)
char *command;
{
set_signal (SIGINT, command);
}
#endif
/* Reset the SIGINT handler so that subshells that are doing `shellsy'
things, like waiting for command substitution or executing commands
in explicit subshells ( ( cmd ) ), can catch interrupts properly. */
SigHandler *
set_sigint_handler ()
{
if (sigmodes[SIGINT] & SIG_HARD_IGNORE)
return ((SigHandler *)SIG_IGN);
else if (sigmodes[SIGINT] & SIG_IGNORED)
return ((SigHandler *)set_signal_handler (SIGINT, SIG_IGN)); /* XXX */
else if (sigmodes[SIGINT] & SIG_TRAPPED)
return ((SigHandler *)set_signal_handler (SIGINT, trap_handler));
/* The signal is not trapped, so set the handler to the shell's special
interrupt handler. */
else if (interactive) /* XXX - was interactive_shell */
return (set_signal_handler (SIGINT, sigint_sighandler));
else
return (set_signal_handler (SIGINT, termination_unwind_protect));
}
/* Return the correct handler for signal SIG according to the values in
sigmodes[SIG]. */
SigHandler *
trap_to_sighandler (sig)
int sig;
{
if (sigmodes[sig] & (SIG_IGNORED|SIG_HARD_IGNORE))
return (SIG_IGN);
else if (sigmodes[sig] & SIG_TRAPPED)
return (trap_handler);
else
return (SIG_DFL);
}
/* Set SIG to call STRING as a command. */
void
set_signal (sig, string)
int sig;
char *string;
{
if (SPECIAL_TRAP (sig))
{
change_signal (sig, savestring (string));
if (sig == EXIT_TRAP && interactive == 0)
initialize_terminating_signals ();
return;
}
/* A signal ignored on entry to the shell cannot be trapped or reset, but
no error is reported when attempting to do so. -- Posix.2 */
if (sigmodes[sig] & SIG_HARD_IGNORE)
return;
/* Make sure we have original_signals[sig] if the signal has not yet
been trapped. */
if ((sigmodes[sig] & SIG_TRAPPED) == 0)
{
/* If we aren't sure of the original value, check it. */
if (original_signals[sig] == IMPOSSIBLE_TRAP_HANDLER)
{
original_signals[sig] = (SigHandler *)set_signal_handler (sig, SIG_DFL);
set_signal_handler (sig, original_signals[sig]);
}
/* Signals ignored on entry to the shell cannot be trapped or reset. */
if (original_signals[sig] == SIG_IGN)
{
sigmodes[sig] |= SIG_HARD_IGNORE;
return;
}
}
/* Only change the system signal handler if SIG_NO_TRAP is not set.
The trap command string is changed in either case. The shell signal
handlers for SIGINT and SIGCHLD run the user specified traps in an
environment in which it is safe to do so. */
if ((sigmodes[sig] & SIG_NO_TRAP) == 0)
{
set_signal_handler (sig, SIG_IGN);
change_signal (sig, savestring (string));
set_signal_handler (sig, trap_handler);
}
else
change_signal (sig, savestring (string));
}
static void
free_trap_command (sig)
int sig;
{
if ((sigmodes[sig] & SIG_TRAPPED) && trap_list[sig] &&
(trap_list[sig] != (char *)IGNORE_SIG) &&
(trap_list[sig] != (char *)DEFAULT_SIG) &&
(trap_list[sig] != (char *)IMPOSSIBLE_TRAP_HANDLER))
free (trap_list[sig]);
}
/* If SIG has a string assigned to it, get rid of it. Then give it
VALUE. */
static void
change_signal (sig, value)
int sig;
char *value;
{
if ((sigmodes[sig] & SIG_INPROGRESS) == 0)
free_trap_command (sig);
trap_list[sig] = value;
sigmodes[sig] |= SIG_TRAPPED;
if (value == (char *)IGNORE_SIG)
sigmodes[sig] |= SIG_IGNORED;
else
sigmodes[sig] &= ~SIG_IGNORED;
if (sigmodes[sig] & SIG_INPROGRESS)
sigmodes[sig] |= SIG_CHANGED;
}
#define GET_ORIGINAL_SIGNAL(sig) \
if (sig && sig < NSIG && original_signals[sig] == IMPOSSIBLE_TRAP_HANDLER) \
get_original_signal (sig)
static void
get_original_signal (sig)
int sig;
{
/* If we aren't sure the of the original value, then get it. */
if (original_signals[sig] == (SigHandler *)IMPOSSIBLE_TRAP_HANDLER)
{
original_signals[sig] =
(SigHandler *) set_signal_handler (sig, SIG_DFL);
set_signal_handler (sig, original_signals[sig]);
/* Signals ignored on entry to the shell cannot be trapped. */
if (original_signals[sig] == SIG_IGN)
sigmodes[sig] |= SIG_HARD_IGNORE;
}
}
/* Restore the default action for SIG; i.e., the action the shell
would have taken before you used the trap command. This is called
from trap_builtin (), which takes care to restore the handlers for
the signals the shell treats specially. */
void
restore_default_signal (sig)
int sig;
{
if (SPECIAL_TRAP (sig))
{
if ((sig != DEBUG_TRAP && sig != ERROR_TRAP && sig != RETURN_TRAP) ||
(sigmodes[sig] & SIG_INPROGRESS) == 0)
free_trap_command (sig);
trap_list[sig] = (char *)NULL;
sigmodes[sig] &= ~SIG_TRAPPED;
if (sigmodes[sig] & SIG_INPROGRESS)
sigmodes[sig] |= SIG_CHANGED;
return;
}
GET_ORIGINAL_SIGNAL (sig);
/* A signal ignored on entry to the shell cannot be trapped or reset, but
no error is reported when attempting to do so. Thanks Posix.2. */
if (sigmodes[sig] & SIG_HARD_IGNORE)
return;
/* If we aren't trapping this signal, don't bother doing anything else. */
if ((sigmodes[sig] & SIG_TRAPPED) == 0)
return;
/* Only change the signal handler for SIG if it allows it. */
if ((sigmodes[sig] & SIG_NO_TRAP) == 0)
set_signal_handler (sig, original_signals[sig]);
/* Change the trap command in either case. */
change_signal (sig, (char *)DEFAULT_SIG);
/* Mark the signal as no longer trapped. */
sigmodes[sig] &= ~SIG_TRAPPED;
}
/* Make this signal be ignored. */
void
ignore_signal (sig)
int sig;
{
if (SPECIAL_TRAP (sig) && ((sigmodes[sig] & SIG_IGNORED) == 0))
{
change_signal (sig, (char *)IGNORE_SIG);
return;
}
GET_ORIGINAL_SIGNAL (sig);
/* A signal ignored on entry to the shell cannot be trapped or reset.
No error is reported when the user attempts to do so. */
if (sigmodes[sig] & SIG_HARD_IGNORE)
return;
/* If already trapped and ignored, no change necessary. */
if (sigmodes[sig] & SIG_IGNORED)
return;
/* Only change the signal handler for SIG if it allows it. */
if ((sigmodes[sig] & SIG_NO_TRAP) == 0)
set_signal_handler (sig, SIG_IGN);
/* Change the trap command in either case. */
change_signal (sig, (char *)IGNORE_SIG);
}
/* Handle the calling of "trap 0". The only sticky situation is when
the command to be executed includes an "exit". This is why we have
to provide our own place for top_level to jump to. */
int
run_exit_trap ()
{
char *trap_command;
int code, function_code, retval;
trap_saved_exit_value = last_command_exit_value;
function_code = 0;
/* Run the trap only if signal 0 is trapped and not ignored, and we are not
currently running in the trap handler (call to exit in the list of
commands given to trap 0). */
if ((sigmodes[EXIT_TRAP] & SIG_TRAPPED) &&
(sigmodes[EXIT_TRAP] & (SIG_IGNORED|SIG_INPROGRESS)) == 0)
{
trap_command = savestring (trap_list[EXIT_TRAP]);
sigmodes[EXIT_TRAP] &= ~SIG_TRAPPED;
sigmodes[EXIT_TRAP] |= SIG_INPROGRESS;
retval = trap_saved_exit_value;
running_trap = 1;
code = setjmp (top_level);
/* If we're in a function, make sure return longjmps come here, too. */
if (return_catch_flag)
function_code = setjmp (return_catch);
if (code == 0 && function_code == 0)
{
reset_parser ();
parse_and_execute (trap_command, "exit trap", SEVAL_NONINT|SEVAL_NOHIST);
}
else if (code == ERREXIT)
retval = last_command_exit_value;
else if (code == EXITPROG)
retval = last_command_exit_value;
else if (function_code != 0)
retval = return_catch_value;
else
retval = trap_saved_exit_value;
running_trap = 0;
return retval;
}
return (trap_saved_exit_value);
}
void
run_trap_cleanup (sig)
int sig;
{
sigmodes[sig] &= ~(SIG_INPROGRESS|SIG_CHANGED);
}
/* Run a trap command for SIG. SIG is one of the signals the shell treats
specially. Returns the exit status of the executed trap command list. */
static int
_run_trap_internal (sig, tag)
int sig;
char *tag;
{
char *trap_command, *old_trap;
int trap_exit_value, *token_state;
int save_return_catch_flag, function_code;
procenv_t save_return_catch;
trap_exit_value = function_code = 0;
/* Run the trap only if SIG is trapped and not ignored, and we are not
currently executing in the trap handler. */
if ((sigmodes[sig] & SIG_TRAPPED) && ((sigmodes[sig] & SIG_IGNORED) == 0) &&
(trap_list[sig] != (char *)IMPOSSIBLE_TRAP_HANDLER) &&
((sigmodes[sig] & SIG_INPROGRESS) == 0))
{
old_trap = trap_list[sig];
sigmodes[sig] |= SIG_INPROGRESS;
sigmodes[sig] &= ~SIG_CHANGED; /* just to be sure */
trap_command = savestring (old_trap);
running_trap = sig + 1;
trap_saved_exit_value = last_command_exit_value;
token_state = save_token_state ();
/* If we're in a function, make sure return longjmps come here, too. */
save_return_catch_flag = return_catch_flag;
if (return_catch_flag)
{
COPY_PROCENV (return_catch, save_return_catch);
function_code = setjmp (return_catch);
}
if (function_code == 0)
parse_and_execute (trap_command, tag, SEVAL_NONINT|SEVAL_NOHIST);
restore_token_state (token_state);
free (token_state);
trap_exit_value = last_command_exit_value;
last_command_exit_value = trap_saved_exit_value;
running_trap = 0;
sigmodes[sig] &= ~SIG_INPROGRESS;
if (sigmodes[sig] & SIG_CHANGED)
{
#if 0
/* Special traps like EXIT, DEBUG, RETURN are handled explicitly in
the places where they can be changed using unwind-protects. For
example, look at execute_cmd.c:execute_function(). */
if (SPECIAL_TRAP (sig) == 0)
#endif
free (old_trap);
sigmodes[sig] &= ~SIG_CHANGED;
}
if (save_return_catch_flag)
{
return_catch_flag = save_return_catch_flag;
return_catch_value = trap_exit_value;
COPY_PROCENV (save_return_catch, return_catch);
if (function_code)
longjmp (return_catch, 1);
}
}
return trap_exit_value;
}
int
run_debug_trap ()
{
int trap_exit_value;
/* XXX - question: should the DEBUG trap inherit the RETURN trap? */
trap_exit_value = 0;
if ((sigmodes[DEBUG_TRAP] & SIG_TRAPPED) && ((sigmodes[DEBUG_TRAP] & SIG_IGNORED) == 0) && ((sigmodes[DEBUG_TRAP] & SIG_INPROGRESS) == 0))
{
trap_exit_value = _run_trap_internal (DEBUG_TRAP, "debug trap");
#if defined (DEBUGGER)
/* If we're in the debugger and the DEBUG trap returns 2 while we're in
a function or sourced script, we force a `return'. */
if (debugging_mode && trap_exit_value == 2 && return_catch_flag)
{
return_catch_value = trap_exit_value;
longjmp (return_catch, 1);
}
#endif
}
return trap_exit_value;
}
void
run_error_trap ()
{
if ((sigmodes[ERROR_TRAP] & SIG_TRAPPED) && ((sigmodes[ERROR_TRAP] & SIG_IGNORED) == 0) && (sigmodes[ERROR_TRAP] & SIG_INPROGRESS) == 0)
_run_trap_internal (ERROR_TRAP, "error trap");
}
void
run_return_trap ()
{
int old_exit_value;
if ((sigmodes[RETURN_TRAP] & SIG_TRAPPED) && ((sigmodes[RETURN_TRAP] & SIG_IGNORED) == 0) && (sigmodes[RETURN_TRAP] & SIG_INPROGRESS) == 0)
{
old_exit_value = last_command_exit_value;
_run_trap_internal (RETURN_TRAP, "return trap");
last_command_exit_value = old_exit_value;
}
}
/* Run a trap set on SIGINT. This is called from throw_to_top_level (), and
declared here to localize the trap functions. */
void
run_interrupt_trap ()
{
_run_trap_internal (SIGINT, "interrupt trap");
}
#ifdef INCLUDE_UNUSED
/* Free all the allocated strings in the list of traps and reset the trap
values to the default. */
void
free_trap_strings ()
{
register int i;
for (i = 0; i < BASH_NSIG; i++)
{
free_trap_command (i);
trap_list[i] = (char *)DEFAULT_SIG;
sigmodes[i] &= ~SIG_TRAPPED;
}
trap_list[DEBUG_TRAP] = trap_list[EXIT_TRAP] = trap_list[ERROR_TRAP] = trap_list[RETURN_TRAP] = (char *)NULL;
}
#endif
/* Reset the handler for SIG to the original value. */
static void
reset_signal (sig)
int sig;
{
set_signal_handler (sig, original_signals[sig]);
sigmodes[sig] &= ~SIG_TRAPPED;
}
/* Set the handler signal SIG to the original and free any trap
command associated with it. */
static void
restore_signal (sig)
int sig;
{
set_signal_handler (sig, original_signals[sig]);
change_signal (sig, (char *)DEFAULT_SIG);
sigmodes[sig] &= ~SIG_TRAPPED;
}
static void
reset_or_restore_signal_handlers (reset)
sh_resetsig_func_t *reset;
{
register int i;
/* Take care of the exit trap first */
if (sigmodes[EXIT_TRAP] & SIG_TRAPPED)
{
free_trap_command (EXIT_TRAP);
trap_list[EXIT_TRAP] = (char *)NULL;
sigmodes[EXIT_TRAP] &= ~SIG_TRAPPED;
}
for (i = 1; i < NSIG; i++)
{
if (sigmodes[i] & SIG_TRAPPED)
{
if (trap_list[i] == (char *)IGNORE_SIG)
set_signal_handler (i, SIG_IGN);
else
(*reset) (i);
}
else if (sigmodes[i] & SIG_SPECIAL)
(*reset) (i);
}
/* Command substitution and other child processes don't inherit the
debug, error, or return traps. If we're in the debugger, and the
`functrace' or `errtrace' options have been set, then let command
substitutions inherit them. Let command substitution inherit the
RETURN trap if we're in the debugger and tracing functions. */
#if defined (DEBUGGER)
if (debugging_mode == 0 || function_trace_mode == 0)
#endif
sigmodes[DEBUG_TRAP] &= ~SIG_TRAPPED;
#if defined (DEBUGGER)
if (debugging_mode == 0 || error_trace_mode == 0)
#endif
sigmodes[ERROR_TRAP] &= ~SIG_TRAPPED;
#if defined (DEBUGGER)
if (debugging_mode == 0 || function_trace_mode == 0)
sigmodes[RETURN_TRAP] &= ~SIG_TRAPPED;
#endif
}
/* Reset trapped signals to their original values, but don't free the
trap strings. Called by the command substitution code. */
void
reset_signal_handlers ()
{
reset_or_restore_signal_handlers (reset_signal);
}
/* Reset all trapped signals to their original values. Signals set to be
ignored with trap '' SIGNAL should be ignored, so we make sure that they
are. Called by child processes after they are forked. */
void
restore_original_signals ()
{
reset_or_restore_signal_handlers (restore_signal);
}
/* If a trap handler exists for signal SIG, then call it; otherwise just
return failure. */
int
maybe_call_trap_handler (sig)
int sig;
{
/* Call the trap handler for SIG if the signal is trapped and not ignored. */
if ((sigmodes[sig] & SIG_TRAPPED) && ((sigmodes[sig] & SIG_IGNORED) == 0))
{
switch (sig)
{
case SIGINT:
run_interrupt_trap ();
break;
case EXIT_TRAP:
run_exit_trap ();
break;
case DEBUG_TRAP:
run_debug_trap ();
break;
case ERROR_TRAP:
run_error_trap ();
break;
default:
trap_handler (sig);
break;
}
return (1);
}
else
return (0);
}
int
signal_is_trapped (sig)
int sig;
{
return (sigmodes[sig] & SIG_TRAPPED);
}
int
signal_is_special (sig)
int sig;
{
return (sigmodes[sig] & SIG_SPECIAL);
}
int
signal_is_ignored (sig)
int sig;
{
return (sigmodes[sig] & SIG_IGNORED);
}
void
set_signal_ignored (sig)
int sig;
{
sigmodes[sig] |= SIG_HARD_IGNORE;
original_signals[sig] = SIG_IGN;
}
int
signal_in_progress (sig)
int sig;
{
return (sigmodes[sig] & SIG_INPROGRESS);
}