mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-28 16:09:51 +02:00
commit bash-20090305 snapshot
This commit is contained in:
@@ -7633,3 +7633,75 @@ execute_cmd.c
|
||||
execute_disk_command if we're executing in a shell function
|
||||
- change execute_function to call unlink_fifo_list before returning
|
||||
if it's the top-level function
|
||||
|
||||
3/2
|
||||
---
|
||||
builtins/read.def
|
||||
- if read times out, make sure we remove the top element from the
|
||||
unwind-protect stack (the free of input_string) and run the rest,
|
||||
to reset the tty and readline and alarm states. Then we jump to
|
||||
assigning the variables to any partial input. Fixes bug reported
|
||||
by Christopher F. A. Johnson <cfajohnson@gmail.com>
|
||||
|
||||
3/3
|
||||
---
|
||||
parse.y
|
||||
- break comment checking code into a common COMMENT_BEGIN define so
|
||||
we can use it in multiple places in parse_comsub
|
||||
- in parse_comsub, don't alter the LEX_RESWDOK flag if we read a
|
||||
`#' and we're checking comments, even though `#' isn't a `shell break'
|
||||
character. Fixes bug reported by Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
braces.c
|
||||
- in expand_seqterm, decrease the total length of the rhs by the length
|
||||
of any (optional) increment, so we don't end up with unwanted zero
|
||||
padding because the rhs length is wrong. Fixes bug reported by
|
||||
Carl Albing <albing@comcast.net>
|
||||
|
||||
3/4
|
||||
---
|
||||
doc/{bash.1,bashref.texi}
|
||||
- changes to clean up some of the language describing the effects of
|
||||
terminal process groups on the ability to read from and write to
|
||||
the terminal
|
||||
|
||||
3/5
|
||||
---
|
||||
support/shobj-conf
|
||||
- add host_vendor to string tested in switch to handle things like
|
||||
gentoo/freebsd
|
||||
- beginning with version 7, FreeBSD no longer has /usr/bin/objformat
|
||||
or a.out binaries and libraries. It's always ELF. Fix from
|
||||
Timothy Redaelli <drizzt@gentoo.org>
|
||||
|
||||
parse.y
|
||||
- in parse_comsub, allow comments if we are ready to read a
|
||||
reserved word (tflags & LEX_RESWDOK), haven't read anything from
|
||||
one yet (lex_rwlen == 0) and the current character is a '#'
|
||||
|
||||
3/6
|
||||
---
|
||||
parse.y
|
||||
- new lex flag for parse_comsub: LEX_INWORD. Turn it off when
|
||||
we see a shell break character; turn it on or keep it on when
|
||||
not a break character. Keep track of word length (reset to 0
|
||||
when we turn on LEX_INWORD when it was off).
|
||||
- don't use COMMENT_BEGIN in parse_comsub any more; test
|
||||
whether or not LEX_INWORD is set and lex_wlen == 0 in addition
|
||||
to tests for LEX_RESWDOK and lex_rwlen. Comments are valid
|
||||
when at the start of a word
|
||||
- move LEX_PASSNEXT code to the top of parse_comsub, so the rest
|
||||
of the function doesn't have to check for the flag at different
|
||||
places
|
||||
|
||||
3/7
|
||||
---
|
||||
parse.y
|
||||
- in parse_comsub, when looking for a reserved word (LEX_RESWDOK
|
||||
non-zero), and in a case statement, we can see either an esac
|
||||
or a pattern list. We handle an esac separately. We should
|
||||
turn off LEX_RESWDOK if we see anything but a newline, since
|
||||
we'll be reading a pattern list. Other part of fix for bug
|
||||
reported by Mike Frysinger <vapier@gentoo.org> (rest of fix
|
||||
on 3/3)
|
||||
|
||||
|
||||
@@ -7627,3 +7627,69 @@ sig.c
|
||||
jobs.c
|
||||
- if fork() fails, set last_command_exit_value to 126 before calling
|
||||
throw_to_top_level
|
||||
|
||||
execute_cmd.c
|
||||
- defer calling unlink_fifo_list in parent branch of
|
||||
execute_disk_command if we're executing in a shell function
|
||||
- change execute_function to call unlink_fifo_list before returning
|
||||
if it's the top-level function
|
||||
|
||||
3/2
|
||||
---
|
||||
builtins/read.def
|
||||
- if read times out, make sure we remove the top element from the
|
||||
unwind-protect stack (the free of input_string) and run the rest,
|
||||
to reset the tty and readline and alarm states. Then we jump to
|
||||
assigning the variables to any partial input. Fixes bug reported
|
||||
by Christopher F. A. Johnson <cfajohnson@gmail.com>
|
||||
|
||||
3/3
|
||||
---
|
||||
parse.y
|
||||
- break comment checking code into a common COMMENT_BEGIN define so
|
||||
we can use it in multiple places in parse_comsub
|
||||
- in parse_comsub, don't turn off the LEX_RESWDOK flag if we read a
|
||||
`#' and we're checking comments, even though `#' isn't a `shell break'
|
||||
character. Fixes bug reported by Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
braces.c
|
||||
- in expand_seqterm, decrease the total length of the rhs by the length
|
||||
of any (optional) increment, so we don't end up with unwanted zero
|
||||
padding because the rhs length is wrong. Fixes bug reported by
|
||||
Carl Albing <albing@comcast.net>
|
||||
|
||||
3/4
|
||||
---
|
||||
doc/{bash.1,bashref.texi}
|
||||
- changes to clean up some of the language describing the effects of
|
||||
terminal process groups on the ability to read from and write to
|
||||
the terminal
|
||||
|
||||
3/5
|
||||
---
|
||||
support/shobj-conf
|
||||
- add host_vendor to string tested in switch to handle things like
|
||||
gentoo/freebsd
|
||||
- beginning with version 7, FreeBSD no longer has /usr/bin/objformat
|
||||
or a.out binaries and libraries. It's always ELF. Fix from
|
||||
Timothy Redaelli <drizzt@gentoo.org>
|
||||
|
||||
parse.y
|
||||
- in parse_comsub, allow comments if we are ready to read a
|
||||
reserved word (tflags & LEX_RESWDOK), haven't read anything from
|
||||
one yet (lex_rwlen == 0) and the current character is a '#'
|
||||
|
||||
3/6
|
||||
---
|
||||
parse.y
|
||||
- new lex flag for parse_comsub: LEX_INWORD. Turn it off when
|
||||
we see a shell break character; turn it on or keep it on when
|
||||
not a break character. Keep track of word length (reset to 0
|
||||
when we turn on LEX_INWORD when it was off).
|
||||
- don't use COMMENT_BEGIN in parse_comsub any more; test
|
||||
whether or not LEX_INWORD is set and lex_wlen == 0 in addition
|
||||
to tests for LEX_RESWDOK and lex_rwlen. Comments are valid
|
||||
when at the start of a word
|
||||
- move LEX_PASSNEXT code to the top of parse_comsub, so the rest
|
||||
of the function doesn't have to check for the flag at different
|
||||
places
|
||||
|
||||
@@ -771,6 +771,7 @@ tests/casemod.tests f
|
||||
tests/casemod.right f
|
||||
tests/comsub.tests f
|
||||
tests/comsub.right f
|
||||
tests/comsub1.sub f
|
||||
tests/comsub-eof.tests f
|
||||
tests/comsub-eof0.sub f
|
||||
tests/comsub-eof1.sub f
|
||||
|
||||
@@ -364,7 +364,7 @@ expand_seqterm (text, tlen)
|
||||
char *t, *lhs, *rhs;
|
||||
int i, lhs_t, rhs_t, lhs_v, rhs_v, incr, lhs_l, rhs_l, width;
|
||||
intmax_t tl, tr;
|
||||
char **result, *ep;
|
||||
char **result, *ep, *oep;
|
||||
|
||||
t = strstr (text, BRACE_SEQ_SPECIFIER);
|
||||
if (t == 0)
|
||||
@@ -410,10 +410,12 @@ expand_seqterm (text, tlen)
|
||||
incr = 1;
|
||||
if (rhs_t != ST_BAD)
|
||||
{
|
||||
oep = ep;
|
||||
if (ep && *ep == '.' && ep[1] == '.' && ep[2])
|
||||
incr = strtoimax (ep + 2, &ep, 10);
|
||||
if (*ep != 0)
|
||||
rhs_t = ST_BAD; /* invalid incr */
|
||||
tlen -= ep - oep;
|
||||
}
|
||||
|
||||
if (lhs_t != rhs_t || lhs_t == ST_BAD || rhs_t == ST_BAD)
|
||||
|
||||
+5
-5
@@ -369,14 +369,14 @@ read_builtin (list)
|
||||
code = setjmp (alrmbuf);
|
||||
if (code)
|
||||
{
|
||||
#if 0
|
||||
/* Tricky. The top of the unwind-protect stack is the free of
|
||||
input_string. We want to run all the rest and use input_string,
|
||||
so we have to remove it from the stack. */
|
||||
remove_unwind_protect ();
|
||||
run_unwind_frame ("read_builtin");
|
||||
return (EXECUTION_FAILURE);
|
||||
#else
|
||||
input_string[i] = '\0'; /* make sure it's terminated */
|
||||
retval = 128+SIGALRM;;
|
||||
retval = 128+SIGALRM;
|
||||
goto assign_vars;
|
||||
#endif
|
||||
}
|
||||
old_alrm = set_signal_handler (SIGALRM, sigalrm);
|
||||
add_unwind_protect (reset_alarm, (char *)NULL);
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
*** /fs1/chet/scratch/bash-4.0-patched/parse.y 2009-03-07 15:18:35.000000000 -0500
|
||||
--- parse.y 2009-03-07 14:16:32.000000000 -0500
|
||||
***************
|
||||
*** 3404,3423 ****
|
||||
{
|
||||
tflags |= LEX_INCASE;
|
||||
! /*itrace("parse_comsub:%d: found `case', lex_incase -> 1", line_number);*/
|
||||
}
|
||||
else if (STREQN (ret + retind - 4, "esac", 4))
|
||||
{
|
||||
tflags &= ~LEX_INCASE;
|
||||
! /*itrace("parse_comsub:%d: found `esac', lex_incase -> 0", line_number);*/
|
||||
}
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
}
|
||||
! else if (shellbreak (ch) == 0)
|
||||
{
|
||||
! tflags &= ~LEX_RESWDOK;
|
||||
/*itrace("parse_comsub:%d: found `%c', lex_reswordok -> 0", line_number, ch);*/
|
||||
}
|
||||
}
|
||||
|
||||
if MBTEST((tflags & LEX_INCOMMENT) == 0 && (tflags & LEX_CKCASE) && ch == '<')
|
||||
{
|
||||
--- 3407,3439 ----
|
||||
{
|
||||
tflags |= LEX_INCASE;
|
||||
! /*itrace("parse_comsub:%d: found `case', lex_incase -> 1 lex_reswdok -> 0", line_number);*/
|
||||
}
|
||||
else if (STREQN (ret + retind - 4, "esac", 4))
|
||||
{
|
||||
tflags &= ~LEX_INCASE;
|
||||
! /*itrace("parse_comsub:%d: found `esac', lex_incase -> 0 lex_reswdok -> 0", line_number);*/
|
||||
}
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
}
|
||||
! else if MBTEST((tflags & LEX_CKCOMMENT) && ch == '#' && (lex_rwlen == 0 || ((tflags & LEX_INWORD) && lex_wlen == 0)))
|
||||
! ; /* don't modify LEX_RESWDOK if we're starting a comment */
|
||||
! else if MBTEST((tflags & LEX_INCASE) && ch != '\n')
|
||||
! /* If we can read a reserved word and we're in case, we're at the
|
||||
! point where we can read a new pattern list or an esac. We
|
||||
! handle the esac case above. If we read a newline, we want to
|
||||
! leave LEX_RESWDOK alone. If we read anything else, we want to
|
||||
! turn off LEX_RESWDOK, since we're going to read a pattern list. */
|
||||
{
|
||||
! tflags &= ~LEX_RESWDOK;
|
||||
! /*itrace("parse_comsub:%d: lex_incase == 1 found `%c', lex_reswordok -> 0", line_number, ch);*/
|
||||
! }
|
||||
! else if MBTEST(shellbreak (ch) == 0)
|
||||
! {
|
||||
! tflags &= ~LEX_RESWDOK;
|
||||
/*itrace("parse_comsub:%d: found `%c', lex_reswordok -> 0", line_number, ch);*/
|
||||
}
|
||||
}
|
||||
|
||||
+ /* Might be the start of a here-doc delimiter */
|
||||
if MBTEST((tflags & LEX_INCOMMENT) == 0 && (tflags & LEX_CKCASE) && ch == '<')
|
||||
{
|
||||
+1196
-1193
File diff suppressed because it is too large
Load Diff
+9
-6
@@ -5,12 +5,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet@po.cwru.edu
|
||||
.\"
|
||||
.\" Last Change: Sat Feb 7 20:50:40 EST 2009
|
||||
.\" Last Change: Wed Mar 4 15:55:47 EST 2009
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2009 February 7" "GNU Bash-4.0"
|
||||
.TH BASH 1 "2009 March 4" "GNU Bash-4.0"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -4255,7 +4255,7 @@ refers to the ability to selectively stop (\fIsuspend\fP)
|
||||
the execution of processes and continue (\fIresume\fP)
|
||||
their execution at a later point. A user typically employs
|
||||
this facility via an interactive interface supplied jointly
|
||||
by the system's terminal driver and
|
||||
by the operating system kernel's terminal driver and
|
||||
.BR bash .
|
||||
.PP
|
||||
The shell associates a
|
||||
@@ -4293,12 +4293,15 @@ These processes are said to be in the
|
||||
.I Background
|
||||
processes are those whose process group ID differs from the terminal's;
|
||||
such processes are immune to keyboard-generated signals.
|
||||
Only foreground processes are allowed to read from or write to the
|
||||
terminal. Background processes which attempt to read from (write to) the
|
||||
Only foreground processes are allowed to read from or, if the
|
||||
user so specifies with \f(CWstty tostop\fP, write to the
|
||||
terminal.
|
||||
Background processes which attempt to read from (write to when
|
||||
\f(CWstty tostop\fP is in effect) the
|
||||
terminal are sent a
|
||||
.SM
|
||||
.B SIGTTIN (SIGTTOU)
|
||||
signal by the terminal driver,
|
||||
signal by the kernel's terminal driver,
|
||||
which, unless caught, suspends the process.
|
||||
.PP
|
||||
If the operating system on which
|
||||
|
||||
+10
-7
@@ -3,7 +3,7 @@
|
||||
</HEAD>
|
||||
<BODY><TABLE WIDTH=100%>
|
||||
<TR>
|
||||
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2009 February 7<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2009 March 4<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
</TR>
|
||||
</TABLE>
|
||||
<BR><A HREF="#index">Index</A>
|
||||
@@ -5481,7 +5481,7 @@ refers to the ability to selectively stop (<I>suspend</I>)
|
||||
the execution of processes and continue (<I>resume</I>)
|
||||
their execution at a later point. A user typically employs
|
||||
this facility via an interactive interface supplied jointly
|
||||
by the system's terminal driver and
|
||||
by the operating system kernel's terminal driver and
|
||||
<B>bash</B>.
|
||||
|
||||
<P>
|
||||
@@ -5534,13 +5534,16 @@ These processes are said to be in the
|
||||
|
||||
processes are those whose process group ID differs from the terminal's;
|
||||
such processes are immune to keyboard-generated signals.
|
||||
Only foreground processes are allowed to read from or write to the
|
||||
terminal. Background processes which attempt to read from (write to) the
|
||||
Only foreground processes are allowed to read from or, if the
|
||||
user so specifies with <TT>stty tostop</TT>, write to the
|
||||
terminal.
|
||||
Background processes which attempt to read from (write to when
|
||||
<TT>stty tostop</TT> is in effect) the
|
||||
terminal are sent a
|
||||
<FONT SIZE=-1><B>SIGTTIN (SIGTTOU)</B>
|
||||
|
||||
</FONT>
|
||||
signal by the terminal driver,
|
||||
signal by the kernel's terminal driver,
|
||||
which, unless caught, suspends the process.
|
||||
<P>
|
||||
|
||||
@@ -12070,7 +12073,7 @@ There may be only one active coprocess at a time.
|
||||
<HR>
|
||||
<TABLE WIDTH=100%>
|
||||
<TR>
|
||||
<TH ALIGN=LEFT width=33%>GNU Bash-4.0<TH ALIGN=CENTER width=33%>2009 February 7<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
<TH ALIGN=LEFT width=33%>GNU Bash-4.0<TH ALIGN=CENTER width=33%>2009 March 4<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
</TR>
|
||||
</TABLE>
|
||||
<HR>
|
||||
@@ -12176,6 +12179,6 @@ There may be only one active coprocess at a time.
|
||||
</DL>
|
||||
<HR>
|
||||
This document was created by man2html from bash.1.<BR>
|
||||
Time: 23 February 2009 11:56:09 EST
|
||||
Time: 05 March 2009 07:55:02 EST
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
+2017
-2020
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+13
-11
@@ -1,6 +1,6 @@
|
||||
<HTML>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<!-- Created on February, 23 2009 by texi2html 1.64 -->
|
||||
<!-- Created on March, 5 2009 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 4.0, 13 February 2009).
|
||||
the Bash shell (version 4.0, 4 March 2009).
|
||||
</P><P>
|
||||
|
||||
This is Edition 4.0, last updated 13 February 2009,
|
||||
This is Edition 4.0, last updated 4 March 2009,
|
||||
of <CITE>The GNU Bash Reference Manual</CITE>,
|
||||
for <CODE>Bash</CODE>, Version 4.0.
|
||||
</P><P>
|
||||
@@ -8651,7 +8651,7 @@ refers to the ability to selectively stop (suspend)
|
||||
the execution of processes and continue (resume)
|
||||
their execution at a later point. A user typically employs
|
||||
this facility via an interactive interface supplied jointly
|
||||
by the system's terminal driver and Bash.
|
||||
by the operating system kernel's terminal driver and Bash.
|
||||
</P><P>
|
||||
|
||||
The shell associates a <VAR>job</VAR> with each pipeline. It keeps a
|
||||
@@ -8675,11 +8675,13 @@ ID) receive keyboard-generated signals such as <CODE>SIGINT</CODE>.
|
||||
These processes are said to be in the foreground. Background
|
||||
processes are those whose process group ID differs from the
|
||||
terminal's; such processes are immune to keyboard-generated
|
||||
signals. Only foreground processes are allowed to read from or
|
||||
write to the terminal. Background processes which attempt to
|
||||
read from (write to) the terminal are sent a <CODE>SIGTTIN</CODE>
|
||||
(<CODE>SIGTTOU</CODE>) signal by the terminal driver, which, unless
|
||||
caught, suspends the process.
|
||||
signals. Only foreground processes are allowed to read from or, if
|
||||
the user so specifies with <CODE>stty tostop</CODE>, write to the terminal.
|
||||
Background processes which attempt to
|
||||
read from (write to when <CODE>stty tostop</CODE> is in effect) the
|
||||
terminal are sent a <CODE>SIGTTIN</CODE> (<CODE>SIGTTOU</CODE>)
|
||||
signal by the kernel's terminal driver,
|
||||
which, unless caught, suspends the process.
|
||||
</P><P>
|
||||
|
||||
If the operating system on which Bash is running supports
|
||||
@@ -15800,7 +15802,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>February, 23 2009</I>
|
||||
This document was generated by <I>Chet Ramey</I> on <I>March, 5 2009</I>
|
||||
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
|
||||
"><I>texi2html</I></A>
|
||||
<P></P>
|
||||
@@ -15962,7 +15964,7 @@ the following structure:
|
||||
<BR>
|
||||
<FONT SIZE="-1">
|
||||
This document was generated
|
||||
by <I>Chet Ramey</I> on <I>February, 23 2009</I>
|
||||
by <I>Chet Ramey</I> on <I>March, 5 2009</I>
|
||||
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
|
||||
"><I>texi2html</I></A>
|
||||
|
||||
|
||||
+138
-136
@@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 4.13 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 4.0, 13 February 2009).
|
||||
the Bash shell (version 4.0, 4 March 2009).
|
||||
|
||||
This is Edition 4.0, last updated 13 February 2009, of `The GNU Bash
|
||||
This is Edition 4.0, last updated 4 March 2009, of `The GNU Bash
|
||||
Reference Manual', for `Bash', Version 4.0.
|
||||
|
||||
Copyright (C) 1988-2009 Free Software Foundation, Inc.
|
||||
@@ -38,9 +38,9 @@ Bash Features
|
||||
*************
|
||||
|
||||
This text is a brief description of the features that are present in
|
||||
the Bash shell (version 4.0, 13 February 2009).
|
||||
the Bash shell (version 4.0, 4 March 2009).
|
||||
|
||||
This is Edition 4.0, last updated 13 February 2009, of `The GNU Bash
|
||||
This is Edition 4.0, last updated 4 March 2009, of `The GNU Bash
|
||||
Reference Manual', for `Bash', Version 4.0.
|
||||
|
||||
Bash contains features that appear in other popular shells, and some
|
||||
@@ -5815,7 +5815,8 @@ File: bashref.info, Node: Job Control Basics, Next: Job Control Builtins, Up:
|
||||
Job control refers to the ability to selectively stop (suspend) the
|
||||
execution of processes and continue (resume) their execution at a later
|
||||
point. A user typically employs this facility via an interactive
|
||||
interface supplied jointly by the system's terminal driver and Bash.
|
||||
interface supplied jointly by the operating system kernel's terminal
|
||||
driver and Bash.
|
||||
|
||||
The shell associates a JOB with each pipeline. It keeps a table of
|
||||
currently executing jobs, which may be listed with the `jobs' command.
|
||||
@@ -5834,10 +5835,11 @@ receive keyboard-generated signals such as `SIGINT'. These processes
|
||||
are said to be in the foreground. Background processes are those whose
|
||||
process group ID differs from the terminal's; such processes are immune
|
||||
to keyboard-generated signals. Only foreground processes are allowed
|
||||
to read from or write to the terminal. Background processes which
|
||||
attempt to read from (write to) the terminal are sent a `SIGTTIN'
|
||||
(`SIGTTOU') signal by the terminal driver, which, unless caught,
|
||||
suspends the process.
|
||||
to read from or, if the user so specifies with `stty tostop', write to
|
||||
the terminal. Background processes which attempt to read from (write
|
||||
to when `stty tostop' is in effect) the terminal are sent a `SIGTTIN'
|
||||
(`SIGTTOU') signal by the kernel's terminal driver, which, unless
|
||||
caught, suspends the process.
|
||||
|
||||
If the operating system on which Bash is running supports job
|
||||
control, Bash contains facilities to use it. Typing the SUSPEND
|
||||
@@ -10010,132 +10012,132 @@ D.5 Concept Index
|
||||
|
||||
|
||||
Tag Table:
|
||||
Node: Top1346
|
||||
Node: Introduction3185
|
||||
Node: What is Bash?3413
|
||||
Node: What is a shell?4526
|
||||
Node: Definitions7066
|
||||
Node: Basic Shell Features9984
|
||||
Node: Shell Syntax11203
|
||||
Node: Shell Operation12233
|
||||
Node: Quoting13527
|
||||
Node: Escape Character14830
|
||||
Node: Single Quotes15315
|
||||
Node: Double Quotes15663
|
||||
Node: ANSI-C Quoting16788
|
||||
Node: Locale Translation17744
|
||||
Node: Comments18640
|
||||
Node: Shell Commands19258
|
||||
Node: Simple Commands20082
|
||||
Node: Pipelines20713
|
||||
Node: Lists22969
|
||||
Node: Compound Commands24698
|
||||
Node: Looping Constructs25502
|
||||
Node: Conditional Constructs27949
|
||||
Node: Command Grouping35955
|
||||
Node: Coprocesses37434
|
||||
Node: Shell Functions39078
|
||||
Node: Shell Parameters43539
|
||||
Node: Positional Parameters45955
|
||||
Node: Special Parameters46855
|
||||
Node: Shell Expansions49819
|
||||
Node: Brace Expansion51744
|
||||
Node: Tilde Expansion54497
|
||||
Node: Shell Parameter Expansion56848
|
||||
Node: Command Substitution65746
|
||||
Node: Arithmetic Expansion67079
|
||||
Node: Process Substitution67929
|
||||
Node: Word Splitting68979
|
||||
Node: Filename Expansion70602
|
||||
Node: Pattern Matching72742
|
||||
Node: Quote Removal76381
|
||||
Node: Redirections76676
|
||||
Node: Executing Commands84824
|
||||
Node: Simple Command Expansion85494
|
||||
Node: Command Search and Execution87424
|
||||
Node: Command Execution Environment89761
|
||||
Node: Environment92747
|
||||
Node: Exit Status94407
|
||||
Node: Signals96028
|
||||
Node: Shell Scripts97996
|
||||
Node: Shell Builtin Commands100514
|
||||
Node: Bourne Shell Builtins102542
|
||||
Node: Bash Builtins119883
|
||||
Node: Modifying Shell Behavior144182
|
||||
Node: The Set Builtin144527
|
||||
Node: The Shopt Builtin153971
|
||||
Node: Special Builtins164833
|
||||
Node: Shell Variables165812
|
||||
Node: Bourne Shell Variables166252
|
||||
Node: Bash Variables168233
|
||||
Node: Bash Features190572
|
||||
Node: Invoking Bash191455
|
||||
Node: Bash Startup Files197264
|
||||
Node: Interactive Shells202233
|
||||
Node: What is an Interactive Shell?202643
|
||||
Node: Is this Shell Interactive?203292
|
||||
Node: Interactive Shell Behavior204107
|
||||
Node: Bash Conditional Expressions207387
|
||||
Node: Shell Arithmetic210966
|
||||
Node: Aliases213712
|
||||
Node: Arrays216284
|
||||
Node: The Directory Stack220126
|
||||
Node: Directory Stack Builtins220840
|
||||
Node: Printing a Prompt223732
|
||||
Node: The Restricted Shell226484
|
||||
Node: Bash POSIX Mode228316
|
||||
Node: Job Control236169
|
||||
Node: Job Control Basics236629
|
||||
Node: Job Control Builtins241242
|
||||
Node: Job Control Variables245606
|
||||
Node: Command Line Editing246764
|
||||
Node: Introduction and Notation248331
|
||||
Node: Readline Interaction249953
|
||||
Node: Readline Bare Essentials251144
|
||||
Node: Readline Movement Commands252933
|
||||
Node: Readline Killing Commands253898
|
||||
Node: Readline Arguments255818
|
||||
Node: Searching256862
|
||||
Node: Readline Init File259048
|
||||
Node: Readline Init File Syntax260195
|
||||
Node: Conditional Init Constructs273429
|
||||
Node: Sample Init File275962
|
||||
Node: Bindable Readline Commands279079
|
||||
Node: Commands For Moving280286
|
||||
Node: Commands For History281430
|
||||
Node: Commands For Text284585
|
||||
Node: Commands For Killing287258
|
||||
Node: Numeric Arguments289709
|
||||
Node: Commands For Completion290848
|
||||
Node: Keyboard Macros294615
|
||||
Node: Miscellaneous Commands295186
|
||||
Node: Readline vi Mode300497
|
||||
Node: Programmable Completion301411
|
||||
Node: Programmable Completion Builtins307244
|
||||
Node: Using History Interactively315670
|
||||
Node: Bash History Facilities316354
|
||||
Node: Bash History Builtins319268
|
||||
Node: History Interaction323125
|
||||
Node: Event Designators325830
|
||||
Node: Word Designators326845
|
||||
Node: Modifiers328484
|
||||
Node: Installing Bash329888
|
||||
Node: Basic Installation331025
|
||||
Node: Compilers and Options333717
|
||||
Node: Compiling For Multiple Architectures334458
|
||||
Node: Installation Names336122
|
||||
Node: Specifying the System Type336940
|
||||
Node: Sharing Defaults337656
|
||||
Node: Operation Controls338329
|
||||
Node: Optional Features339287
|
||||
Node: Reporting Bugs348689
|
||||
Node: Major Differences From The Bourne Shell349886
|
||||
Node: GNU Free Documentation License366573
|
||||
Node: Indexes389034
|
||||
Node: Builtin Index389488
|
||||
Node: Reserved Word Index396315
|
||||
Node: Variable Index398763
|
||||
Node: Function Index410569
|
||||
Node: Concept Index417301
|
||||
Node: Top1338
|
||||
Node: Introduction3169
|
||||
Node: What is Bash?3397
|
||||
Node: What is a shell?4510
|
||||
Node: Definitions7050
|
||||
Node: Basic Shell Features9968
|
||||
Node: Shell Syntax11187
|
||||
Node: Shell Operation12217
|
||||
Node: Quoting13511
|
||||
Node: Escape Character14814
|
||||
Node: Single Quotes15299
|
||||
Node: Double Quotes15647
|
||||
Node: ANSI-C Quoting16772
|
||||
Node: Locale Translation17728
|
||||
Node: Comments18624
|
||||
Node: Shell Commands19242
|
||||
Node: Simple Commands20066
|
||||
Node: Pipelines20697
|
||||
Node: Lists22953
|
||||
Node: Compound Commands24682
|
||||
Node: Looping Constructs25486
|
||||
Node: Conditional Constructs27933
|
||||
Node: Command Grouping35939
|
||||
Node: Coprocesses37418
|
||||
Node: Shell Functions39062
|
||||
Node: Shell Parameters43523
|
||||
Node: Positional Parameters45939
|
||||
Node: Special Parameters46839
|
||||
Node: Shell Expansions49803
|
||||
Node: Brace Expansion51728
|
||||
Node: Tilde Expansion54481
|
||||
Node: Shell Parameter Expansion56832
|
||||
Node: Command Substitution65730
|
||||
Node: Arithmetic Expansion67063
|
||||
Node: Process Substitution67913
|
||||
Node: Word Splitting68963
|
||||
Node: Filename Expansion70586
|
||||
Node: Pattern Matching72726
|
||||
Node: Quote Removal76365
|
||||
Node: Redirections76660
|
||||
Node: Executing Commands84808
|
||||
Node: Simple Command Expansion85478
|
||||
Node: Command Search and Execution87408
|
||||
Node: Command Execution Environment89745
|
||||
Node: Environment92731
|
||||
Node: Exit Status94391
|
||||
Node: Signals96012
|
||||
Node: Shell Scripts97980
|
||||
Node: Shell Builtin Commands100498
|
||||
Node: Bourne Shell Builtins102526
|
||||
Node: Bash Builtins119867
|
||||
Node: Modifying Shell Behavior144166
|
||||
Node: The Set Builtin144511
|
||||
Node: The Shopt Builtin153955
|
||||
Node: Special Builtins164817
|
||||
Node: Shell Variables165796
|
||||
Node: Bourne Shell Variables166236
|
||||
Node: Bash Variables168217
|
||||
Node: Bash Features190556
|
||||
Node: Invoking Bash191439
|
||||
Node: Bash Startup Files197248
|
||||
Node: Interactive Shells202217
|
||||
Node: What is an Interactive Shell?202627
|
||||
Node: Is this Shell Interactive?203276
|
||||
Node: Interactive Shell Behavior204091
|
||||
Node: Bash Conditional Expressions207371
|
||||
Node: Shell Arithmetic210950
|
||||
Node: Aliases213696
|
||||
Node: Arrays216268
|
||||
Node: The Directory Stack220110
|
||||
Node: Directory Stack Builtins220824
|
||||
Node: Printing a Prompt223716
|
||||
Node: The Restricted Shell226468
|
||||
Node: Bash POSIX Mode228300
|
||||
Node: Job Control236153
|
||||
Node: Job Control Basics236613
|
||||
Node: Job Control Builtins241330
|
||||
Node: Job Control Variables245694
|
||||
Node: Command Line Editing246852
|
||||
Node: Introduction and Notation248419
|
||||
Node: Readline Interaction250041
|
||||
Node: Readline Bare Essentials251232
|
||||
Node: Readline Movement Commands253021
|
||||
Node: Readline Killing Commands253986
|
||||
Node: Readline Arguments255906
|
||||
Node: Searching256950
|
||||
Node: Readline Init File259136
|
||||
Node: Readline Init File Syntax260283
|
||||
Node: Conditional Init Constructs273517
|
||||
Node: Sample Init File276050
|
||||
Node: Bindable Readline Commands279167
|
||||
Node: Commands For Moving280374
|
||||
Node: Commands For History281518
|
||||
Node: Commands For Text284673
|
||||
Node: Commands For Killing287346
|
||||
Node: Numeric Arguments289797
|
||||
Node: Commands For Completion290936
|
||||
Node: Keyboard Macros294703
|
||||
Node: Miscellaneous Commands295274
|
||||
Node: Readline vi Mode300585
|
||||
Node: Programmable Completion301499
|
||||
Node: Programmable Completion Builtins307332
|
||||
Node: Using History Interactively315758
|
||||
Node: Bash History Facilities316442
|
||||
Node: Bash History Builtins319356
|
||||
Node: History Interaction323213
|
||||
Node: Event Designators325918
|
||||
Node: Word Designators326933
|
||||
Node: Modifiers328572
|
||||
Node: Installing Bash329976
|
||||
Node: Basic Installation331113
|
||||
Node: Compilers and Options333805
|
||||
Node: Compiling For Multiple Architectures334546
|
||||
Node: Installation Names336210
|
||||
Node: Specifying the System Type337028
|
||||
Node: Sharing Defaults337744
|
||||
Node: Operation Controls338417
|
||||
Node: Optional Features339375
|
||||
Node: Reporting Bugs348777
|
||||
Node: Major Differences From The Bourne Shell349974
|
||||
Node: GNU Free Documentation License366661
|
||||
Node: Indexes389122
|
||||
Node: Builtin Index389576
|
||||
Node: Reserved Word Index396403
|
||||
Node: Variable Index398851
|
||||
Node: Function Index410657
|
||||
Node: Concept Index417389
|
||||
|
||||
End Tag Table
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
This is TeX, Version 3.141592 (Web2C 7.5.4) (format=tex 2008.12.11) 23 FEB 2009 11:56
|
||||
This is TeX, Version 3.141592 (Web2C 7.5.4) (format=tex 2008.12.11) 5 MAR 2009 07:54
|
||||
**/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,
|
||||
@@ -325,7 +325,7 @@ Underfull \hbox (badness 2753) in paragraph at lines 1827--1830
|
||||
|
||||
[118] [119]) (/Users/chet/src/bash/src/lib/readline/doc/hsuser.texi Chapter 9
|
||||
[120] [121] [122] [123] [124]) Chapter 10 [125] [126] [127] [128] [129]
|
||||
Underfull \hbox (badness 2772) in paragraph at lines 7138--7142
|
||||
Underfull \hbox (badness 2772) in paragraph at lines 7140--7144
|
||||
[]@textrm Enable sup-port for large files (@texttt http://www.sas.com/standard
|
||||
s/large_
|
||||
|
||||
@@ -368,10 +368,10 @@ Overfull \vbox (40.58205pt too high) has occurred while \output is active
|
||||
Here is how much of TeX's memory you used:
|
||||
1735 strings out of 97980
|
||||
23684 string characters out of 1221004
|
||||
52965 words of memory out of 1500000
|
||||
52957 words of memory out of 1500000
|
||||
2586 multiletter control sequences out of 10000+50000
|
||||
31953 words of font info for 111 fonts, out of 1200000 for 2000
|
||||
19 hyphenation exceptions out of 8191
|
||||
15i,8n,11p,269b,474s stack positions out of 5000i,500n,6000p,200000b,5000s
|
||||
|
||||
Output written on bashref.dvi (164 pages, 638856 bytes).
|
||||
Output written on bashref.dvi (164 pages, 639008 bytes).
|
||||
|
||||
+190
-188
@@ -11,7 +11,7 @@
|
||||
%DVIPSWebPage: (www.radicaleye.com)
|
||||
%DVIPSCommandLine: dvips -D 600 -t letter -o bashref.ps bashref.dvi
|
||||
%DVIPSParameters: dpi=600
|
||||
%DVIPSSource: TeX output 2009.02.23:1156
|
||||
%DVIPSSource: TeX output 2009.03.05:0754
|
||||
%%BeginProcSet: tex.pro 0 0
|
||||
%!
|
||||
/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
|
||||
@@ -4537,26 +4537,25 @@ letter
|
||||
TeXDict begin 1 0 bop 150 1318 a Fu(Bash)64 b(Reference)j(Man)-5
|
||||
b(ual)p 150 1385 3600 34 v 2361 1481 a Ft(Reference)31
|
||||
b(Do)s(cumen)m(tation)i(for)d(Bash)2428 1589 y(Edition)h(4.0,)g(for)f
|
||||
Fs(Bash)g Ft(V)-8 b(ersion)31 b(4.0.)3180 1697 y(F)-8
|
||||
b(ebruary)30 b(2009)150 4935 y Fr(Chet)45 b(Ramey)-11
|
||||
b(,)46 b(Case)g(W)-11 b(estern)46 b(Reserv)l(e)g(Univ)l(ersit)l(y)150
|
||||
5068 y(Brian)f(F)-11 b(o)l(x,)45 b(F)-11 b(ree)45 b(Soft)l(w)l(are)h(F)
|
||||
-11 b(oundation)p 150 5141 3600 17 v eop end
|
||||
Fs(Bash)g Ft(V)-8 b(ersion)31 b(4.0.)3285 1697 y(Marc)m(h)g(2009)150
|
||||
4935 y Fr(Chet)45 b(Ramey)-11 b(,)46 b(Case)g(W)-11 b(estern)46
|
||||
b(Reserv)l(e)g(Univ)l(ersit)l(y)150 5068 y(Brian)f(F)-11
|
||||
b(o)l(x,)45 b(F)-11 b(ree)45 b(Soft)l(w)l(are)h(F)-11
|
||||
b(oundation)p 150 5141 3600 17 v eop end
|
||||
%%Page: 2 2
|
||||
TeXDict begin 2 1 bop 150 2889 a Ft(This)35 b(text)h(is)g(a)g(brief)f
|
||||
(description)h(of)f(the)h(features)g(that)g(are)g(presen)m(t)g(in)f
|
||||
(the)h(Bash)f(shell)h(\(v)m(ersion)150 2999 y(4.0,)c(13)f(F)-8
|
||||
b(ebruary)30 b(2009\).)150 3133 y(This)g(is)h(Edition)g(4.0,)h(last)g
|
||||
(up)s(dated)e(13)h(F)-8 b(ebruary)31 b(2009,)i(of)e Fq(The)g(GNU)g
|
||||
(Bash)g(Reference)h(Man)m(ual)p Ft(,)150 3243 y(for)e
|
||||
Fs(Bash)p Ft(,)g(V)-8 b(ersion)31 b(4.0.)150 3377 y(Cop)m(yrigh)m(t)602
|
||||
3374 y(c)577 3377 y Fp(\015)f Ft(1988{2009)35 b(F)-8
|
||||
b(ree)31 b(Soft)m(w)m(are)h(F)-8 b(oundation,)31 b(Inc.)150
|
||||
3512 y(P)m(ermission)h(is)h(gran)m(ted)g(to)f(mak)m(e)i(and)d
|
||||
(distribute)h(v)m(erbatim)h(copies)g(of)f(this)g(man)m(ual)h(pro)m
|
||||
(vided)f(the)150 3621 y(cop)m(yrigh)m(t)g(notice)f(and)f(this)g(p)s
|
||||
(ermission)g(notice)h(are)g(preserv)m(ed)f(on)h(all)g(copies.)390
|
||||
3756 y(P)m(ermission)k(is)h(gran)m(ted)f(to)h(cop)m(y)-8
|
||||
(the)h(Bash)f(shell)h(\(v)m(ersion)150 2999 y(4.0,)c(4)e(Marc)m(h)i
|
||||
(2009\).)150 3133 y(This)h(is)g(Edition)h(4.0,)i(last)e(up)s(dated)e(4)
|
||||
i(Marc)m(h)g(2009,)j(of)c Fq(The)h(GNU)g(Bash)f(Reference)i(Man)m(ual)p
|
||||
Ft(,)g(for)150 3243 y Fs(Bash)p Ft(,)29 b(V)-8 b(ersion)31
|
||||
b(4.0.)150 3377 y(Cop)m(yrigh)m(t)602 3374 y(c)577 3377
|
||||
y Fp(\015)f Ft(1988{2009)35 b(F)-8 b(ree)31 b(Soft)m(w)m(are)h(F)-8
|
||||
b(oundation,)31 b(Inc.)150 3512 y(P)m(ermission)h(is)h(gran)m(ted)g(to)
|
||||
f(mak)m(e)i(and)d(distribute)h(v)m(erbatim)h(copies)g(of)f(this)g(man)m
|
||||
(ual)h(pro)m(vided)f(the)150 3621 y(cop)m(yrigh)m(t)g(notice)f(and)f
|
||||
(this)g(p)s(ermission)g(notice)h(are)g(preserv)m(ed)f(on)h(all)g
|
||||
(copies.)390 3756 y(P)m(ermission)k(is)h(gran)m(ted)f(to)h(cop)m(y)-8
|
||||
b(,)38 b(distribute)d(and/or)g(mo)s(dify)f(this)h(do)s(cumen)m(t)g
|
||||
(under)390 3866 y(the)j(terms)g(of)g(the)g(GNU)h(F)-8
|
||||
b(ree)39 b(Do)s(cumen)m(tation)h(License,)g(V)-8 b(ersion)39
|
||||
@@ -11084,273 +11083,276 @@ b(Con)l(trol)275 550 y Ft(This)34 b(c)m(hapter)i(discusses)f(what)g
|
||||
(cesses)150 1290 y(and)24 b(con)m(tin)m(ue)i(\(resume\))f(their)g
|
||||
(execution)h(at)f(a)h(later)f(p)s(oin)m(t.)39 b(A)25
|
||||
b(user)f(t)m(ypically)j(emplo)m(ys)e(this)g(facilit)m(y)150
|
||||
1400 y(via)31 b(an)f(in)m(teractiv)m(e)j(in)m(terface)f(supplied)e
|
||||
(join)m(tly)h(b)m(y)f(the)h(system's)f(terminal)h(driv)m(er)f(and)g
|
||||
(Bash.)275 1540 y(The)23 b(shell)i(asso)s(ciates)h(a)f
|
||||
Fq(job)h Ft(with)e(eac)m(h)i(pip)s(eline.)38 b(It)25
|
||||
b(k)m(eeps)f(a)h(table)h(of)e(curren)m(tly)h(executing)g(jobs,)150
|
||||
1650 y(whic)m(h)33 b(ma)m(y)i(b)s(e)e(listed)h(with)f(the)h
|
||||
1400 y(via)i(an)e(in)m(teractiv)m(e)k(in)m(terface)f(supplied)d(join)m
|
||||
(tly)h(b)m(y)g(the)h(op)s(erating)f(system)g(k)m(ernel's)h(terminal)f
|
||||
(driv)m(er)150 1510 y(and)k(Bash.)275 1650 y(The)23 b(shell)i(asso)s
|
||||
(ciates)h(a)f Fq(job)h Ft(with)e(eac)m(h)i(pip)s(eline.)38
|
||||
b(It)25 b(k)m(eeps)f(a)h(table)h(of)e(curren)m(tly)h(executing)g(jobs,)
|
||||
150 1759 y(whic)m(h)33 b(ma)m(y)i(b)s(e)e(listed)h(with)f(the)h
|
||||
Fs(jobs)f Ft(command.)50 b(When)33 b(Bash)h(starts)g(a)g(job)g(async)m
|
||||
(hronously)-8 b(,)34 b(it)150 1759 y(prin)m(ts)c(a)h(line)f(that)h(lo)s
|
||||
(oks)g(lik)m(e:)390 1899 y Fs([1])47 b(25647)150 2040
|
||||
(hronously)-8 b(,)34 b(it)150 1869 y(prin)m(ts)c(a)h(line)f(that)h(lo)s
|
||||
(oks)g(lik)m(e:)390 2009 y Fs([1])47 b(25647)150 2149
|
||||
y Ft(indicating)34 b(that)g(this)f(job)g(is)g(job)g(n)m(um)m(b)s(er)f
|
||||
(1)i(and)f(that)g(the)h(pro)s(cess)f Fl(id)g Ft(of)g(the)h(last)g(pro)s
|
||||
(cess)f(in)g(the)150 2149 y(pip)s(eline)42 b(asso)s(ciated)i(with)e
|
||||
(cess)f(in)g(the)150 2259 y(pip)s(eline)42 b(asso)s(ciated)i(with)e
|
||||
(this)g(job)g(is)h(25647.)78 b(All)43 b(of)g(the)g(pro)s(cesses)f(in)g
|
||||
(a)h(single)g(pip)s(eline)f(are)150 2259 y(mem)m(b)s(ers)30
|
||||
(a)h(single)g(pip)s(eline)f(are)150 2368 y(mem)m(b)s(ers)30
|
||||
b(of)g(the)h(same)f(job.)41 b(Bash)30 b(uses)g(the)h
|
||||
Fq(job)h Ft(abstraction)f(as)g(the)g(basis)f(for)g(job)g(con)m(trol.)
|
||||
275 2399 y(T)-8 b(o)23 b(facilitate)j(the)d(implemen)m(tation)i(of)f
|
||||
275 2509 y(T)-8 b(o)23 b(facilitate)j(the)d(implemen)m(tation)i(of)f
|
||||
(the)f(user)f(in)m(terface)j(to)f(job)f(con)m(trol,)j(the)d(op)s
|
||||
(erating)h(system)150 2509 y(main)m(tains)j(the)f(notion)h(of)f(a)g
|
||||
(erating)h(system)150 2618 y(main)m(tains)j(the)f(notion)h(of)f(a)g
|
||||
(curren)m(t)g(terminal)g(pro)s(cess)g(group)g Fl(id)p
|
||||
Ft(.)39 b(Mem)m(b)s(ers)26 b(of)g(this)g(pro)s(cess)f(group)150
|
||||
2618 y(\(pro)s(cesses)h(whose)g(pro)s(cess)g(group)g
|
||||
2728 y(\(pro)s(cesses)h(whose)g(pro)s(cess)g(group)g
|
||||
Fl(id)g Ft(is)h(equal)g(to)g(the)f(curren)m(t)g(terminal)h(pro)s(cess)f
|
||||
(group)f Fl(id)p Ft(\))i(receiv)m(e)150 2728 y(k)m(eyb)s
|
||||
(group)f Fl(id)p Ft(\))i(receiv)m(e)150 2837 y(k)m(eyb)s
|
||||
(oard-generated)22 b(signals)g(suc)m(h)e(as)h Fs(SIGINT)p
|
||||
Ft(.)36 b(These)21 b(pro)s(cesses)g(are)g(said)g(to)g(b)s(e)g(in)f(the)
|
||||
h(foreground.)150 2837 y(Bac)m(kground)38 b(pro)s(cesses)f(are)h(those)
|
||||
h(foreground.)150 2947 y(Bac)m(kground)38 b(pro)s(cesses)f(are)h(those)
|
||||
g(whose)f(pro)s(cess)g(group)g Fl(id)h Ft(di\013ers)f(from)g(the)g
|
||||
(terminal's;)42 b(suc)m(h)150 2947 y(pro)s(cesses)24
|
||||
(terminal's;)42 b(suc)m(h)150 3057 y(pro)s(cesses)24
|
||||
b(are)g(imm)m(une)g(to)g(k)m(eyb)s(oard-generated)h(signals.)40
|
||||
b(Only)23 b(foreground)g(pro)s(cesses)h(are)g(allo)m(w)m(ed)150
|
||||
3057 y(to)35 b(read)f(from)f(or)h(write)g(to)h(the)f(terminal.)52
|
||||
b(Bac)m(kground)34 b(pro)s(cesses)g(whic)m(h)g(attempt)h(to)g(read)e
|
||||
(from)150 3166 y(\(write)e(to\))g(the)g(terminal)g(are)g(sen)m(t)g(a)f
|
||||
Fs(SIGTTIN)f Ft(\()p Fs(SIGTTOU)p Ft(\))g(signal)i(b)m(y)f(the)h
|
||||
(terminal)g(driv)m(er,)f(whic)m(h,)150 3276 y(unless)g(caugh)m(t,)h
|
||||
(susp)s(ends)d(the)j(pro)s(cess.)275 3416 y(If)j(the)i(op)s(erating)g
|
||||
(system)f(on)h(whic)m(h)f(Bash)g(is)h(running)d(supp)s(orts)h(job)h
|
||||
(con)m(trol,)j(Bash)e(con)m(tains)150 3525 y(facilities)30
|
||||
b(to)f(use)f(it.)40 b(T)m(yping)28 b(the)g Fq(susp)s(end)h
|
||||
Ft(c)m(haracter)h(\(t)m(ypically)g(`)p Fs(^Z)p Ft(',)f(Con)m(trol-Z\))g
|
||||
(while)f(a)g(pro)s(cess)150 3635 y(is)42 b(running)f(causes)i(that)g
|
||||
(pro)s(cess)f(to)h(b)s(e)f(stopp)s(ed)f(and)h(returns)f(con)m(trol)j
|
||||
(to)f(Bash.)77 b(T)m(yping)42 b(the)150 3745 y Fq(dela)m(y)m(ed)k(susp)
|
||||
s(end)f Ft(c)m(haracter)h(\(t)m(ypically)g(`)p Fs(^Y)p
|
||||
Ft(',)i(Con)m(trol-Y\))e(causes)e(the)h(pro)s(cess)e(to)i(b)s(e)f
|
||||
(stopp)s(ed)150 3854 y(when)26 b(it)i(attempts)h(to)f(read)f(input)g
|
||||
(from)f(the)i(terminal,)h(and)e(con)m(trol)h(to)g(b)s(e)f(returned)f
|
||||
(to)j(Bash.)39 b(The)150 3964 y(user)e(then)g(manipulates)h(the)g
|
||||
(state)h(of)f(this)f(job,)j(using)d(the)h Fs(bg)f Ft(command)g(to)h
|
||||
(con)m(tin)m(ue)h(it)f(in)g(the)150 4073 y(bac)m(kground,)g(the)f
|
||||
Fs(fg)g Ft(command)f(to)i(con)m(tin)m(ue)g(it)f(in)f(the)h(foreground,)
|
||||
h(or)f(the)g Fs(kill)f Ft(command)g(to)150 4183 y(kill)27
|
||||
b(it.)40 b(A)27 b(`)p Fs(^Z)p Ft(')g(tak)m(es)h(e\013ect)g(immediately)
|
||||
-8 b(,)29 b(and)d(has)h(the)f(additional)i(side)e(e\013ect)j(of)d
|
||||
(causing)h(p)s(ending)150 4293 y(output)j(and)g(t)m(yp)s(eahead)h(to)g
|
||||
(b)s(e)e(discarded.)275 4433 y(There)j(are)g(a)h(n)m(um)m(b)s(er)e(of)i
|
||||
(w)m(a)m(ys)g(to)h(refer)e(to)h(a)g(job)f(in)g(the)h(shell.)47
|
||||
3166 y(to)g(read)e(from)h(or,)h(if)f(the)g(user)f(so)i(sp)s(eci\014es)e
|
||||
(with)h Fs(stty)29 b(tostop)p Ft(,)23 b(write)g(to)g(the)h(terminal.)38
|
||||
b(Bac)m(kground)150 3276 y(pro)s(cesses)27 b(whic)m(h)g(attempt)h(to)f
|
||||
(read)g(from)g(\(write)g(to)h(when)e Fs(stty)j(tostop)d
|
||||
Ft(is)h(in)f(e\013ect\))j(the)e(terminal)150 3385 y(are)32
|
||||
b(sen)m(t)g(a)g Fs(SIGTTIN)e Ft(\()p Fs(SIGTTOU)p Ft(\))g(signal)i(b)m
|
||||
(y)g(the)g(k)m(ernel's)g(terminal)g(driv)m(er,)g(whic)m(h,)g(unless)f
|
||||
(caugh)m(t,)150 3495 y(susp)s(ends)d(the)i(pro)s(cess.)275
|
||||
3635 y(If)k(the)i(op)s(erating)g(system)f(on)h(whic)m(h)f(Bash)g(is)h
|
||||
(running)d(supp)s(orts)h(job)h(con)m(trol,)j(Bash)e(con)m(tains)150
|
||||
3745 y(facilities)30 b(to)f(use)f(it.)40 b(T)m(yping)28
|
||||
b(the)g Fq(susp)s(end)h Ft(c)m(haracter)h(\(t)m(ypically)g(`)p
|
||||
Fs(^Z)p Ft(',)f(Con)m(trol-Z\))g(while)f(a)g(pro)s(cess)150
|
||||
3854 y(is)42 b(running)f(causes)i(that)g(pro)s(cess)f(to)h(b)s(e)f
|
||||
(stopp)s(ed)f(and)h(returns)f(con)m(trol)j(to)f(Bash.)77
|
||||
b(T)m(yping)42 b(the)150 3964 y Fq(dela)m(y)m(ed)k(susp)s(end)f
|
||||
Ft(c)m(haracter)h(\(t)m(ypically)g(`)p Fs(^Y)p Ft(',)i(Con)m(trol-Y\))e
|
||||
(causes)e(the)h(pro)s(cess)e(to)i(b)s(e)f(stopp)s(ed)150
|
||||
4073 y(when)26 b(it)i(attempts)h(to)f(read)f(input)g(from)f(the)i
|
||||
(terminal,)h(and)e(con)m(trol)h(to)g(b)s(e)f(returned)f(to)j(Bash.)39
|
||||
b(The)150 4183 y(user)e(then)g(manipulates)h(the)g(state)h(of)f(this)f
|
||||
(job,)j(using)d(the)h Fs(bg)f Ft(command)g(to)h(con)m(tin)m(ue)h(it)f
|
||||
(in)g(the)150 4293 y(bac)m(kground,)g(the)f Fs(fg)g Ft(command)f(to)i
|
||||
(con)m(tin)m(ue)g(it)f(in)f(the)h(foreground,)h(or)f(the)g
|
||||
Fs(kill)f Ft(command)g(to)150 4402 y(kill)27 b(it.)40
|
||||
b(A)27 b(`)p Fs(^Z)p Ft(')g(tak)m(es)h(e\013ect)g(immediately)-8
|
||||
b(,)29 b(and)d(has)h(the)f(additional)i(side)e(e\013ect)j(of)d(causing)
|
||||
h(p)s(ending)150 4512 y(output)j(and)g(t)m(yp)s(eahead)h(to)g(b)s(e)e
|
||||
(discarded.)275 4652 y(There)j(are)g(a)h(n)m(um)m(b)s(er)e(of)i(w)m(a)m
|
||||
(ys)g(to)h(refer)e(to)h(a)g(job)f(in)g(the)h(shell.)47
|
||||
b(The)32 b(c)m(haracter)i(`)p Fs(\045)p Ft(')f(in)m(tro)s(duces)150
|
||||
4542 y(a)e(job)f(sp)s(eci\014cation)h(\()p Fq(jobsp)s(ec)6
|
||||
b Ft(\).)275 4682 y(Job)31 b(n)m(um)m(b)s(er)f Fs(n)h
|
||||
4761 y(a)e(job)f(sp)s(eci\014cation)h(\()p Fq(jobsp)s(ec)6
|
||||
b Ft(\).)275 4902 y(Job)31 b(n)m(um)m(b)s(er)f Fs(n)h
|
||||
Ft(ma)m(y)h(b)s(e)f(referred)g(to)h(as)g(`)p Fs(\045n)p
|
||||
Ft('.)44 b(The)31 b(sym)m(b)s(ols)g(`)p Fs(\045\045)p
|
||||
Ft(')h(and)f(`)p Fs(\045+)p Ft(')g(refer)h(to)g(the)g(shell's)150
|
||||
4792 y(notion)k(of)f(the)g(curren)m(t)g(job,)h(whic)m(h)f(is)g(the)g
|
||||
5011 y(notion)k(of)f(the)g(curren)m(t)g(job,)h(whic)m(h)f(is)g(the)g
|
||||
(last)h(job)f(stopp)s(ed)f(while)h(it)h(w)m(as)g(in)e(the)i(foreground)
|
||||
e(or)150 4902 y(started)27 b(in)g(the)g(bac)m(kground.)40
|
||||
e(or)150 5121 y(started)27 b(in)g(the)g(bac)m(kground.)40
|
||||
b(A)27 b(single)g(`)p Fs(\045)p Ft(')g(\(with)g(no)g(accompan)m(ying)i
|
||||
(job)d(sp)s(eci\014cation\))i(also)g(refers)150 5011
|
||||
(job)d(sp)s(eci\014cation\))i(also)g(refers)150 5230
|
||||
y(to)k(the)e(curren)m(t)h(job.)42 b(The)30 b(previous)g(job)h(ma)m(y)g
|
||||
(b)s(e)f(referenced)h(using)f(`)p Fs(\045-)p Ft('.)42
|
||||
b(If)30 b(there)h(is)g(only)g(a)g(single)150 5121 y(job,)g(`)p
|
||||
b(If)30 b(there)h(is)g(only)g(a)g(single)150 5340 y(job,)g(`)p
|
||||
Fs(\045+)p Ft(')g(and)f(`)p Fs(\045-)p Ft(')h(can)h(b)s(oth)e(b)s(e)g
|
||||
(used)h(to)g(refer)g(to)h(that)g(job.)42 b(In)30 b(output)h(p)s
|
||||
(ertaining)g(to)g(jobs)g(\(e.g.,)150 5230 y(the)39 b(output)f(of)g(the)
|
||||
h Fs(jobs)e Ft(command\),)k(the)d(curren)m(t)h(job)f(is)g(alw)m(a)m(ys)
|
||||
i(\015agged)f(with)f(a)h(`)p Fs(+)p Ft(',)i(and)d(the)150
|
||||
5340 y(previous)30 b(job)g(with)g(a)h(`)p Fs(-)p Ft('.)p
|
||||
eop end
|
||||
(ertaining)g(to)g(jobs)g(\(e.g.,)p eop end
|
||||
%%Page: 90 96
|
||||
TeXDict begin 90 95 bop 150 -116 a Ft(90)2572 b(Bash)31
|
||||
b(Reference)g(Man)m(ual)275 299 y(A)38 b(job)g(ma)m(y)h(also)g(b)s(e)f
|
||||
(referred)f(to)j(using)d(a)i(pre\014x)e(of)i(the)f(name)h(used)e(to)i
|
||||
(start)g(it,)i(or)e(using)f(a)150 408 y(substring)29
|
||||
b(that)i(app)s(ears)f(in)g(its)h(command)f(line.)41 b(F)-8
|
||||
b(or)31 b(example,)g(`)p Fs(\045ce)p Ft(')f(refers)g(to)h(a)g(stopp)s
|
||||
(ed)e Fs(ce)h Ft(job.)150 518 y(Using)d(`)p Fs(\045?ce)p
|
||||
Ft(',)g(on)f(the)h(other)g(hand,)g(refers)f(to)h(an)m(y)g(job)g(con)m
|
||||
(taining)h(the)f(string)f(`)p Fs(ce)p Ft(')h(in)f(its)h(command)150
|
||||
628 y(line.)41 b(If)30 b(the)h(pre\014x)e(or)h(substring)f(matc)m(hes)j
|
||||
(more)e(than)h(one)f(job,)h(Bash)f(rep)s(orts)g(an)g(error.)275
|
||||
767 y(Simply)g(naming)h(a)g(job)g(can)g(b)s(e)f(used)h(to)g(bring)f(it)
|
||||
i(in)m(to)g(the)f(foreground:)41 b(`)p Fs(\0451)p Ft(')31
|
||||
b(is)g(a)h(synon)m(ym)e(for)150 876 y(`)p Fs(fg)g(\0451)p
|
||||
b(Reference)g(Man)m(ual)150 299 y(the)39 b(output)f(of)g(the)h
|
||||
Fs(jobs)e Ft(command\),)k(the)d(curren)m(t)h(job)f(is)g(alw)m(a)m(ys)i
|
||||
(\015agged)f(with)f(a)h(`)p Fs(+)p Ft(',)i(and)d(the)150
|
||||
408 y(previous)30 b(job)g(with)g(a)h(`)p Fs(-)p Ft('.)275
|
||||
550 y(A)38 b(job)g(ma)m(y)h(also)g(b)s(e)f(referred)f(to)j(using)d(a)i
|
||||
(pre\014x)e(of)i(the)f(name)h(used)e(to)i(start)g(it,)i(or)e(using)f(a)
|
||||
150 659 y(substring)29 b(that)i(app)s(ears)f(in)g(its)h(command)f
|
||||
(line.)41 b(F)-8 b(or)31 b(example,)g(`)p Fs(\045ce)p
|
||||
Ft(')f(refers)g(to)h(a)g(stopp)s(ed)e Fs(ce)h Ft(job.)150
|
||||
769 y(Using)d(`)p Fs(\045?ce)p Ft(',)g(on)f(the)h(other)g(hand,)g
|
||||
(refers)f(to)h(an)m(y)g(job)g(con)m(taining)h(the)f(string)f(`)p
|
||||
Fs(ce)p Ft(')h(in)f(its)h(command)150 878 y(line.)41
|
||||
b(If)30 b(the)h(pre\014x)e(or)h(substring)f(matc)m(hes)j(more)e(than)h
|
||||
(one)f(job,)h(Bash)f(rep)s(orts)g(an)g(error.)275 1020
|
||||
y(Simply)g(naming)h(a)g(job)g(can)g(b)s(e)f(used)h(to)g(bring)f(it)i
|
||||
(in)m(to)g(the)f(foreground:)41 b(`)p Fs(\0451)p Ft(')31
|
||||
b(is)g(a)h(synon)m(ym)e(for)150 1129 y(`)p Fs(fg)g(\0451)p
|
||||
Ft(',)i(bringing)f(job)g(1)g(from)g(the)h(bac)m(kground)f(in)m(to)i
|
||||
(the)e(foreground.)44 b(Similarly)-8 b(,)32 b(`)p Fs(\0451)e(&)p
|
||||
Ft(')i(resumes)150 986 y(job)e(1)h(in)f(the)g(bac)m(kground,)h(equiv)-5
|
||||
b(alen)m(t)32 b(to)f(`)p Fs(bg)f(\0451)p Ft(')275 1125
|
||||
y(The)g(shell)i(learns)f(immediately)i(whenev)m(er)e(a)h(job)f(c)m
|
||||
Ft(')i(resumes)150 1239 y(job)e(1)h(in)f(the)g(bac)m(kground,)h(equiv)
|
||||
-5 b(alen)m(t)32 b(to)f(`)p Fs(bg)f(\0451)p Ft(')275
|
||||
1380 y(The)g(shell)i(learns)f(immediately)i(whenev)m(er)e(a)h(job)f(c)m
|
||||
(hanges)h(state.)45 b(Normally)-8 b(,)33 b(Bash)e(w)m(aits)i(un)m(til)
|
||||
150 1235 y(it)25 b(is)g(ab)s(out)f(to)i(prin)m(t)e(a)h(prompt)f(b)s
|
||||
150 1489 y(it)25 b(is)g(ab)s(out)f(to)i(prin)m(t)e(a)h(prompt)f(b)s
|
||||
(efore)g(rep)s(orting)h(c)m(hanges)g(in)g(a)g(job's)f(status)h(so)g(as)
|
||||
g(to)g(not)g(in)m(terrupt)150 1344 y(an)m(y)g(other)g(output.)39
|
||||
g(to)g(not)g(in)m(terrupt)150 1599 y(an)m(y)g(other)g(output.)39
|
||||
b(If)24 b(the)i(`)p Fs(-b)p Ft(')e(option)i(to)f(the)g
|
||||
Fs(set)f Ft(builtin)h(is)g(enabled,)h(Bash)f(rep)s(orts)f(suc)m(h)h(c)m
|
||||
(hanges)150 1454 y(immediately)g(\(see)g(Section)g(4.3.1)g([The)f(Set)g
|
||||
(hanges)150 1709 y(immediately)g(\(see)g(Section)g(4.3.1)g([The)f(Set)g
|
||||
(Builtin],)i(page)f(51\).)40 b(An)m(y)24 b(trap)f(on)h
|
||||
Fs(SIGCHLD)e Ft(is)i(executed)150 1564 y(for)30 b(eac)m(h)i(c)m(hild)e
|
||||
(pro)s(cess)g(that)h(exits.)275 1703 y(If)25 b(an)h(attempt)h(to)g
|
||||
Fs(SIGCHLD)e Ft(is)i(executed)150 1818 y(for)30 b(eac)m(h)i(c)m(hild)e
|
||||
(pro)s(cess)g(that)h(exits.)275 1959 y(If)25 b(an)h(attempt)h(to)g
|
||||
(exit)g(Bash)f(is)h(made)f(while)g(jobs)f(are)i(stopp)s(ed,)f(\(or)h
|
||||
(running,)e(if)h(the)g Fs(checkjobs)150 1812 y Ft(option)e(is)f
|
||||
(running,)e(if)h(the)g Fs(checkjobs)150 2069 y Ft(option)e(is)f
|
||||
(enabled)h({)g(see)g(Section)g(4.3.2)h([The)e(Shopt)g(Builtin],)j(page)
|
||||
e(55\),)i(the)e(shell)f(prin)m(ts)g(a)h(w)m(arning)150
|
||||
1922 y(message,)k(and)c(if)i(the)f Fs(checkjobs)e Ft(option)j(is)f
|
||||
2178 y(message,)k(and)c(if)i(the)f Fs(checkjobs)e Ft(option)j(is)f
|
||||
(enabled,)i(lists)e(the)h(jobs)f(and)f(their)i(statuses.)39
|
||||
b(The)25 b Fs(jobs)150 2032 y Ft(command)36 b(ma)m(y)h(then)f(b)s(e)f
|
||||
b(The)25 b Fs(jobs)150 2288 y Ft(command)36 b(ma)m(y)h(then)f(b)s(e)f
|
||||
(used)g(to)i(insp)s(ect)f(their)g(status.)59 b(If)36
|
||||
b(a)g(second)g(attempt)i(to)f(exit)g(is)f(made)150 2141
|
||||
b(a)g(second)g(attempt)i(to)f(exit)g(is)f(made)150 2398
|
||||
y(without)e(an)f(in)m(terv)m(ening)i(command,)f(Bash)g(do)s(es)f(not)h
|
||||
(prin)m(t)g(another)f(w)m(arning,)i(and)e(an)m(y)h(stopp)s(ed)150
|
||||
2251 y(jobs)c(are)h(terminated.)150 2520 y Fr(7.2)68
|
||||
b(Job)45 b(Con)l(trol)h(Builtins)150 2766 y Fs(bg)870
|
||||
2903 y(bg)h([)p Fj(jobspec)56 b Fs(...)o(])630 3040 y
|
||||
2507 y(jobs)c(are)h(terminated.)150 2781 y Fr(7.2)68
|
||||
b(Job)45 b(Con)l(trol)h(Builtins)150 3029 y Fs(bg)870
|
||||
3166 y(bg)h([)p Fj(jobspec)56 b Fs(...)o(])630 3304 y
|
||||
Ft(Resume)24 b(eac)m(h)h(susp)s(ended)d(job)i Fq(jobsp)s(ec)29
|
||||
b Ft(in)24 b(the)g(bac)m(kground,)h(as)g(if)f(it)h(had)e(b)s(een)g
|
||||
(started)630 3150 y(with)32 b(`)p Fs(&)p Ft('.)45 b(If)31
|
||||
(started)630 3414 y(with)32 b(`)p Fs(&)p Ft('.)45 b(If)31
|
||||
b Fq(jobsp)s(ec)37 b Ft(is)32 b(not)g(supplied,)f(the)h(curren)m(t)g
|
||||
(job)f(is)h(used.)45 b(The)31 b(return)g(status)630 3259
|
||||
(job)f(is)h(used.)45 b(The)31 b(return)g(status)630 3523
|
||||
y(is)i(zero)g(unless)f(it)h(is)g(run)e(when)h(job)g(con)m(trol)i(is)f
|
||||
(not)g(enabled,)h(or,)f(when)f(run)f(with)h(job)630 3369
|
||||
(not)g(enabled,)h(or,)f(when)f(run)f(with)h(job)630 3633
|
||||
y(con)m(trol)h(enabled,)g(an)m(y)f Fq(jobsp)s(ec)37 b
|
||||
Ft(w)m(as)32 b(not)g(found)f(or)g(sp)s(eci\014es)h(a)g(job)g(that)g(w)m
|
||||
(as)g(started)630 3478 y(without)e(job)g(con)m(trol.)150
|
||||
3643 y Fs(fg)870 3779 y(fg)47 b([)p Fj(jobspec)11 b Fs(])630
|
||||
3916 y Ft(Resume)43 b(the)g(job)g Fq(jobsp)s(ec)48 b
|
||||
(as)g(started)630 3743 y(without)e(job)g(con)m(trol.)150
|
||||
3909 y Fs(fg)870 4046 y(fg)47 b([)p Fj(jobspec)11 b Fs(])630
|
||||
4184 y Ft(Resume)43 b(the)g(job)g Fq(jobsp)s(ec)48 b
|
||||
Ft(in)43 b(the)g(foreground)g(and)f(mak)m(e)j(it)e(the)h(curren)m(t)f
|
||||
(job.)78 b(If)630 4026 y Fq(jobsp)s(ec)41 b Ft(is)c(not)f(supplied,)h
|
||||
(job.)78 b(If)630 4294 y Fq(jobsp)s(ec)41 b Ft(is)c(not)f(supplied,)h
|
||||
(the)f(curren)m(t)h(job)f(is)g(used.)58 b(The)36 b(return)f(status)h
|
||||
(is)h(that)g(of)630 4136 y(the)d(command)g(placed)h(in)m(to)g(the)f
|
||||
(is)h(that)g(of)630 4403 y(the)d(command)g(placed)h(in)m(to)g(the)f
|
||||
(foreground,)g(or)g(non-zero)h(if)f(run)f(when)g(job)g(con)m(trol)630
|
||||
4245 y(is)i(disabled)g(or,)i(when)d(run)g(with)h(job)g(con)m(trol)h
|
||||
4513 y(is)i(disabled)g(or,)i(when)d(run)g(with)h(job)g(con)m(trol)h
|
||||
(enabled,)h Fq(jobsp)s(ec)j Ft(do)s(es)35 b(not)h(sp)s(ecify)f(a)630
|
||||
4355 y(v)-5 b(alid)31 b(job)f(or)g Fq(jobsp)s(ec)35 b
|
||||
4623 y(v)-5 b(alid)31 b(job)f(or)g Fq(jobsp)s(ec)35 b
|
||||
Ft(sp)s(eci\014es)30 b(a)h(job)f(that)h(w)m(as)g(started)g(without)f
|
||||
(job)g(con)m(trol.)150 4519 y Fs(jobs)870 4656 y(jobs)47
|
||||
b([-lnprs])e([)p Fj(jobspec)11 b Fs(])870 4765 y(jobs)47
|
||||
(job)g(con)m(trol.)150 4789 y Fs(jobs)870 4927 y(jobs)47
|
||||
b([-lnprs])e([)p Fj(jobspec)11 b Fs(])870 5036 y(jobs)47
|
||||
b(-x)g Fj(command)56 b Fs([)p Fj(arguments)11 b Fs(])630
|
||||
4902 y Ft(The)30 b(\014rst)f(form)h(lists)h(the)g(activ)m(e)h(jobs.)41
|
||||
5174 y Ft(The)30 b(\014rst)f(form)h(lists)h(the)g(activ)m(e)h(jobs.)41
|
||||
b(The)30 b(options)g(ha)m(v)m(e)i(the)e(follo)m(wing)i(meanings:)630
|
||||
5066 y Fs(-l)384 b Ft(List)31 b(pro)s(cess)f Fl(id)p
|
||||
Ft(s)g(in)g(addition)h(to)g(the)f(normal)h(information.)630
|
||||
5230 y Fs(-n)384 b Ft(Displa)m(y)26 b(information)f(only)h(ab)s(out)e
|
||||
(jobs)h(that)g(ha)m(v)m(e)i(c)m(hanged)e(status)h(since)1110
|
||||
5340 y(the)31 b(user)e(w)m(as)i(last)g(noti\014ed)f(of)h(their)f
|
||||
(status.)p eop end
|
||||
5340 y Fs(-l)384 b Ft(List)31 b(pro)s(cess)f Fl(id)p
|
||||
Ft(s)g(in)g(addition)h(to)g(the)f(normal)h(information.)p
|
||||
eop end
|
||||
%%Page: 91 97
|
||||
TeXDict begin 91 96 bop 150 -116 a Ft(Chapter)30 b(7:)41
|
||||
b(Job)30 b(Con)m(trol)2571 b(91)630 299 y Fs(-p)384 b
|
||||
Ft(List)31 b(only)f(the)h(pro)s(cess)f Fl(id)g Ft(of)h(the)f(job's)g
|
||||
(pro)s(cess)g(group)g(leader.)630 447 y Fs(-r)384 b Ft(Restrict)31
|
||||
b(output)f(to)i(running)c(jobs.)630 594 y Fs(-s)384 b
|
||||
Ft(Restrict)31 b(output)f(to)i(stopp)s(ed)d(jobs.)630
|
||||
742 y(If)23 b Fq(jobsp)s(ec)28 b Ft(is)c(giv)m(en,)i(output)d(is)h
|
||||
b(Job)30 b(Con)m(trol)2571 b(91)630 299 y Fs(-n)384 b
|
||||
Ft(Displa)m(y)26 b(information)f(only)h(ab)s(out)e(jobs)h(that)g(ha)m
|
||||
(v)m(e)i(c)m(hanged)e(status)h(since)1110 408 y(the)31
|
||||
b(user)e(w)m(as)i(last)g(noti\014ed)f(of)h(their)f(status.)630
|
||||
575 y Fs(-p)384 b Ft(List)31 b(only)f(the)h(pro)s(cess)f
|
||||
Fl(id)g Ft(of)h(the)f(job's)g(pro)s(cess)g(group)g(leader.)630
|
||||
742 y Fs(-r)384 b Ft(Restrict)31 b(output)f(to)i(running)c(jobs.)630
|
||||
909 y Fs(-s)384 b Ft(Restrict)31 b(output)f(to)i(stopp)s(ed)d(jobs.)630
|
||||
1076 y(If)23 b Fq(jobsp)s(ec)28 b Ft(is)c(giv)m(en,)i(output)d(is)h
|
||||
(restricted)g(to)g(information)g(ab)s(out)f(that)h(job.)39
|
||||
b(If)23 b Fq(jobsp)s(ec)630 852 y Ft(is)30 b(not)h(supplied,)e(the)i
|
||||
(status)g(of)f(all)h(jobs)f(is)h(listed.)630 980 y(If)g(the)g(`)p
|
||||
b(If)23 b Fq(jobsp)s(ec)630 1185 y Ft(is)30 b(not)h(supplied,)e(the)i
|
||||
(status)g(of)f(all)h(jobs)f(is)h(listed.)630 1323 y(If)g(the)g(`)p
|
||||
Fs(-x)p Ft(')g(option)h(is)f(supplied,)g Fs(jobs)f Ft(replaces)i(an)m
|
||||
(y)f Fq(jobsp)s(ec)37 b Ft(found)29 b(in)i Fq(command)k
|
||||
Ft(or)630 1090 y Fq(argumen)m(ts)41 b Ft(with)c(the)h(corresp)s(onding)
|
||||
Ft(or)630 1433 y Fq(argumen)m(ts)41 b Ft(with)c(the)h(corresp)s(onding)
|
||||
e(pro)s(cess)h(group)f Fl(id)p Ft(,)k(and)c(executes)j
|
||||
Fq(command)p Ft(,)630 1199 y(passing)30 b(it)h Fq(argumen)m(t)r
|
||||
Ft(s,)g(returning)f(its)g(exit)i(status.)150 1347 y Fs(kill)870
|
||||
1476 y(kill)47 b([-s)g Fj(sigspec)11 b Fs(])45 b([-n)i
|
||||
Fq(command)p Ft(,)630 1542 y(passing)30 b(it)h Fq(argumen)m(t)r
|
||||
Ft(s,)g(returning)f(its)g(exit)i(status.)150 1709 y Fs(kill)870
|
||||
1847 y(kill)47 b([-s)g Fj(sigspec)11 b Fs(])45 b([-n)i
|
||||
Fj(signum)11 b Fs(])45 b([-)p Fj(sigspec)11 b Fs(])44
|
||||
b Fj(jobspec)57 b Fs(or)47 b Fj(pid)870 1585 y Fs(kill)g(-l)g([)p
|
||||
Fj(exit_status)11 b Fs(])630 1714 y Ft(Send)22 b(a)i(signal)g(sp)s
|
||||
b Fj(jobspec)57 b Fs(or)47 b Fj(pid)870 1957 y Fs(kill)g(-l)g([)p
|
||||
Fj(exit_status)11 b Fs(])630 2095 y Ft(Send)22 b(a)i(signal)g(sp)s
|
||||
(eci\014ed)f(b)m(y)g Fq(sigsp)s(ec)29 b Ft(or)24 b Fq(sign)m(um)f
|
||||
Ft(to)h(the)g(pro)s(cess)f(named)g(b)m(y)g(job)g(sp)s(eci\014-)630
|
||||
1824 y(cation)k Fq(jobsp)s(ec)j Ft(or)25 b(pro)s(cess)g
|
||||
2205 y(cation)k Fq(jobsp)s(ec)j Ft(or)25 b(pro)s(cess)g
|
||||
Fl(id)h Fq(pid)p Ft(.)38 b Fq(sigsp)s(ec)31 b Ft(is)25
|
||||
b(either)h(a)g(case-insensitiv)m(e)i(signal)e(name)630
|
||||
1933 y(suc)m(h)k(as)h Fs(SIGINT)d Ft(\(with)j(or)f(without)h(the)f
|
||||
2314 y(suc)m(h)k(as)h Fs(SIGINT)d Ft(\(with)j(or)f(without)h(the)f
|
||||
Fs(SIG)g Ft(pre\014x\))f(or)i(a)f(signal)h(n)m(um)m(b)s(er;)f
|
||||
Fq(sign)m(um)g Ft(is)630 2043 y(a)i(signal)g(n)m(um)m(b)s(er.)43
|
||||
Fq(sign)m(um)g Ft(is)630 2424 y(a)i(signal)g(n)m(um)m(b)s(er.)43
|
||||
b(If)31 b Fq(sigsp)s(ec)37 b Ft(and)31 b Fq(sign)m(um)g
|
||||
Ft(are)h(not)f(presen)m(t,)h Fs(SIGTERM)e Ft(is)h(used.)43
|
||||
b(The)630 2152 y(`)p Fs(-l)p Ft(')34 b(option)g(lists)h(the)f(signal)h
|
||||
b(The)630 2534 y(`)p Fs(-l)p Ft(')34 b(option)g(lists)h(the)f(signal)h
|
||||
(names.)51 b(If)33 b(an)m(y)i(argumen)m(ts)f(are)g(supplied)f(when)g(`)
|
||||
p Fs(-l)p Ft(')h(is)630 2262 y(giv)m(en,)e(the)g(names)e(of)i(the)f
|
||||
p Fs(-l)p Ft(')h(is)630 2643 y(giv)m(en,)e(the)g(names)e(of)i(the)f
|
||||
(signals)g(corresp)s(onding)f(to)i(the)f(argumen)m(ts)g(are)h(listed,)g
|
||||
(and)630 2372 y(the)c(return)f(status)h(is)g(zero.)41
|
||||
b Fq(exit)p 1796 2372 28 4 v 41 w(status)32 b Ft(is)c(a)g(n)m(um)m(b)s
|
||||
(and)630 2753 y(the)c(return)f(status)h(is)g(zero.)41
|
||||
b Fq(exit)p 1796 2753 28 4 v 41 w(status)32 b Ft(is)c(a)g(n)m(um)m(b)s
|
||||
(er)f(sp)s(ecifying)g(a)i(signal)f(n)m(um)m(b)s(er)f(or)630
|
||||
2481 y(the)35 b(exit)h(status)f(of)g(a)g(pro)s(cess)g(terminated)g(b)m
|
||||
2862 y(the)35 b(exit)h(status)f(of)g(a)g(pro)s(cess)g(terminated)g(b)m
|
||||
(y)g(a)g(signal.)55 b(The)34 b(return)g(status)h(is)g(zero)630
|
||||
2591 y(if)c(at)h(least)g(one)g(signal)f(w)m(as)h(successfully)f(sen)m
|
||||
2972 y(if)c(at)h(least)g(one)g(signal)f(w)m(as)h(successfully)f(sen)m
|
||||
(t,)h(or)f(non-zero)h(if)f(an)g(error)f(o)s(ccurs)h(or)g(an)630
|
||||
2700 y(in)m(v)-5 b(alid)31 b(option)g(is)f(encoun)m(tered.)150
|
||||
2848 y Fs(wait)870 2977 y(wait)47 b([)p Fj(jobspec)56
|
||||
b Fs(or)47 b Fj(pid)57 b Fs(...])630 3105 y Ft(W)-8 b(ait)28
|
||||
3081 y(in)m(v)-5 b(alid)31 b(option)g(is)f(encoun)m(tered.)150
|
||||
3248 y Fs(wait)870 3386 y(wait)47 b([)p Fj(jobspec)56
|
||||
b Fs(or)47 b Fj(pid)57 b Fs(...])630 3525 y Ft(W)-8 b(ait)28
|
||||
b(un)m(til)f(the)f(c)m(hild)h(pro)s(cess)f(sp)s(eci\014ed)g(b)m(y)g
|
||||
(eac)m(h)h(pro)s(cess)f Fl(id)h Fq(pid)i Ft(or)d(job)g(sp)s
|
||||
(eci\014cation)630 3215 y Fq(jobsp)s(ec)40 b Ft(exits)35
|
||||
(eci\014cation)630 3634 y Fq(jobsp)s(ec)40 b Ft(exits)35
|
||||
b(and)f(return)g(the)g(exit)i(status)f(of)g(the)g(last)g(command)f(w)m
|
||||
(aited)i(for.)53 b(If)35 b(a)630 3324 y(job)g(sp)s(ec)f(is)h(giv)m(en,)
|
||||
(aited)i(for.)53 b(If)35 b(a)630 3744 y(job)g(sp)s(ec)f(is)h(giv)m(en,)
|
||||
i(all)f(pro)s(cesses)f(in)f(the)h(job)g(are)g(w)m(aited)h(for.)54
|
||||
b(If)35 b(no)f(argumen)m(ts)i(are)630 3434 y(giv)m(en,)d(all)f(curren)m
|
||||
b(If)35 b(no)f(argumen)m(ts)i(are)630 3853 y(giv)m(en,)d(all)f(curren)m
|
||||
(tly)f(activ)m(e)i(c)m(hild)f(pro)s(cesses)f(are)g(w)m(aited)h(for,)g
|
||||
(and)e(the)i(return)e(status)630 3544 y(is)h(zero.)44
|
||||
(and)e(the)i(return)e(status)630 3963 y(is)h(zero.)44
|
||||
b(If)30 b(neither)h Fq(jobsp)s(ec)36 b Ft(nor)31 b Fq(pid)i
|
||||
Ft(sp)s(eci\014es)e(an)g(activ)m(e)i(c)m(hild)f(pro)s(cess)e(of)h(the)g
|
||||
(shell,)630 3653 y(the)g(return)e(status)i(is)f(127.)150
|
||||
3801 y Fs(disown)870 3930 y(disown)46 b([-ar])g([-h])h([)p
|
||||
Fj(jobspec)56 b Fs(...)o(])630 4058 y Ft(Without)32 b(options,)g(eac)m
|
||||
(shell,)630 4073 y(the)g(return)e(status)i(is)f(127.)150
|
||||
4239 y Fs(disown)870 4377 y(disown)46 b([-ar])g([-h])h([)p
|
||||
Fj(jobspec)56 b Fs(...)o(])630 4516 y Ft(Without)32 b(options,)g(eac)m
|
||||
(h)h Fq(jobsp)s(ec)j Ft(is)c(remo)m(v)m(ed)g(from)f(the)h(table)g(of)g
|
||||
(activ)m(e)h(jobs.)44 b(If)31 b(the)630 4168 y(`)p Fs(-h)p
|
||||
(activ)m(e)h(jobs.)44 b(If)31 b(the)630 4625 y(`)p Fs(-h)p
|
||||
Ft(')36 b(option)h(is)g(giv)m(en,)i(the)e(job)f(is)h(not)f(remo)m(v)m
|
||||
(ed)i(from)e(the)h(table,)i(but)d(is)g(mark)m(ed)h(so)630
|
||||
4277 y(that)d Fs(SIGHUP)d Ft(is)j(not)f(sen)m(t)h(to)g(the)f(job)g(if)g
|
||||
4735 y(that)d Fs(SIGHUP)d Ft(is)j(not)f(sen)m(t)h(to)g(the)f(job)g(if)g
|
||||
(the)h(shell)f(receiv)m(es)i(a)f Fs(SIGHUP)p Ft(.)47
|
||||
b(If)33 b Fq(jobsp)s(ec)38 b Ft(is)630 4387 y(not)32
|
||||
b(If)33 b Fq(jobsp)s(ec)38 b Ft(is)630 4844 y(not)32
|
||||
b(presen)m(t,)f(and)g(neither)h(the)f(`)p Fs(-a)p Ft(')g(nor)g(`)p
|
||||
Fs(-r)p Ft(')g(option)h(is)g(supplied,)e(the)i(curren)m(t)f(job)g(is)
|
||||
630 4497 y(used.)58 b(If)36 b(no)g Fq(jobsp)s(ec)41 b
|
||||
630 4954 y(used.)58 b(If)36 b(no)g Fq(jobsp)s(ec)41 b
|
||||
Ft(is)36 b(supplied,)h(the)g(`)p Fs(-a)p Ft(')f(option)h(means)f(to)h
|
||||
(remo)m(v)m(e)h(or)e(mark)g(all)630 4606 y(jobs;)28 b(the)f(`)p
|
||||
(remo)m(v)m(e)h(or)e(mark)g(all)630 5064 y(jobs;)28 b(the)f(`)p
|
||||
Fs(-r)p Ft(')g(option)g(without)g(a)g Fq(jobsp)s(ec)32
|
||||
b Ft(argumen)m(t)27 b(restricts)h(op)s(eration)f(to)h(running)630
|
||||
4716 y(jobs.)150 4863 y Fs(suspend)870 4992 y(suspend)46
|
||||
b([-f])630 5121 y Ft(Susp)s(end)31 b(the)i(execution)h(of)g(this)f
|
||||
(shell)g(un)m(til)h(it)g(receiv)m(es)h(a)e Fs(SIGCONT)f
|
||||
Ft(signal.)50 b(A)33 b(login)630 5230 y(shell)24 b(cannot)h(b)s(e)e
|
||||
(susp)s(ended;)h(the)g(`)p Fs(-f)p Ft(')g(option)g(can)h(b)s(e)e(used)g
|
||||
(to)i(o)m(v)m(erride)g(this)f(and)f(force)630 5340 y(the)31
|
||||
b(susp)s(ension.)p eop end
|
||||
5173 y(jobs.)150 5340 y Fs(suspend)p eop end
|
||||
%%Page: 92 98
|
||||
TeXDict begin 92 97 bop 150 -116 a Ft(92)2572 b(Bash)31
|
||||
b(Reference)g(Man)m(ual)275 299 y(When)f(job)f(con)m(trol)j(is)e(not)h
|
||||
(activ)m(e,)i(the)d Fs(kill)f Ft(and)h Fs(wait)f Ft(builtins)g(do)h
|
||||
(not)h(accept)h Fq(jobsp)s(ec)j Ft(argu-)150 408 y(men)m(ts.)41
|
||||
b(They)30 b(m)m(ust)g(b)s(e)g(supplied)f(pro)s(cess)h
|
||||
Fl(id)p Ft(s.)150 666 y Fr(7.3)68 b(Job)45 b(Con)l(trol)h(V)-11
|
||||
b(ariables)150 910 y Fs(auto_resume)630 1020 y Ft(This)31
|
||||
b(v)-5 b(ariable)32 b(con)m(trols)g(ho)m(w)g(the)f(shell)h(in)m
|
||||
(teracts)h(with)e(the)h(user)e(and)h(job)g(con)m(trol.)45
|
||||
b(If)630 1129 y(this)28 b(v)-5 b(ariable)30 b(exists)f(then)f(single)h
|
||||
(w)m(ord)f(simple)h(commands)f(without)g(redirections)i(are)630
|
||||
1239 y(treated)h(as)g(candidates)f(for)g(resumption)g(of)g(an)g
|
||||
(existing)h(job.)41 b(There)29 b(is)h(no)h(am)m(biguit)m(y)630
|
||||
1348 y(allo)m(w)m(ed;)f(if)d(there)g(is)g(more)g(than)f(one)h(job)g(b)s
|
||||
(eginning)f(with)g(the)h(string)g(t)m(yp)s(ed,)g(then)g(the)630
|
||||
1458 y(most)j(recen)m(tly)h(accessed)f(job)f(will)h(b)s(e)f(selected.)
|
||||
42 b(The)29 b(name)g(of)h(a)g(stopp)s(ed)e(job,)i(in)f(this)630
|
||||
1567 y(con)m(text,)h(is)e(the)g(command)g(line)g(used)f(to)h(start)g
|
||||
(it.)41 b(If)27 b(this)h(v)-5 b(ariable)28 b(is)g(set)g(to)h(the)e(v)-5
|
||||
b(alue)630 1677 y(`)p Fs(exact)p Ft(',)33 b(the)g(string)g(supplied)f
|
||||
b(Reference)g(Man)m(ual)870 299 y Fs(suspend)46 b([-f])630
|
||||
433 y Ft(Susp)s(end)31 b(the)i(execution)h(of)g(this)f(shell)g(un)m
|
||||
(til)h(it)g(receiv)m(es)h(a)e Fs(SIGCONT)f Ft(signal.)50
|
||||
b(A)33 b(login)630 543 y(shell)24 b(cannot)h(b)s(e)e(susp)s(ended;)h
|
||||
(the)g(`)p Fs(-f)p Ft(')g(option)g(can)h(b)s(e)e(used)g(to)i(o)m(v)m
|
||||
(erride)g(this)f(and)f(force)630 653 y(the)31 b(susp)s(ension.)275
|
||||
812 y(When)f(job)f(con)m(trol)j(is)e(not)h(activ)m(e,)i(the)d
|
||||
Fs(kill)f Ft(and)h Fs(wait)f Ft(builtins)g(do)h(not)h(accept)h
|
||||
Fq(jobsp)s(ec)j Ft(argu-)150 922 y(men)m(ts.)41 b(They)30
|
||||
b(m)m(ust)g(b)s(e)g(supplied)f(pro)s(cess)h Fl(id)p Ft(s.)150
|
||||
1179 y Fr(7.3)68 b(Job)45 b(Con)l(trol)h(V)-11 b(ariables)150
|
||||
1423 y Fs(auto_resume)630 1533 y Ft(This)31 b(v)-5 b(ariable)32
|
||||
b(con)m(trols)g(ho)m(w)g(the)f(shell)h(in)m(teracts)h(with)e(the)h
|
||||
(user)e(and)h(job)g(con)m(trol.)45 b(If)630 1642 y(this)28
|
||||
b(v)-5 b(ariable)30 b(exists)f(then)f(single)h(w)m(ord)f(simple)h
|
||||
(commands)f(without)g(redirections)i(are)630 1752 y(treated)h(as)g
|
||||
(candidates)f(for)g(resumption)g(of)g(an)g(existing)h(job.)41
|
||||
b(There)29 b(is)h(no)h(am)m(biguit)m(y)630 1861 y(allo)m(w)m(ed;)f(if)d
|
||||
(there)g(is)g(more)g(than)f(one)h(job)g(b)s(eginning)f(with)g(the)h
|
||||
(string)g(t)m(yp)s(ed,)g(then)g(the)630 1971 y(most)j(recen)m(tly)h
|
||||
(accessed)f(job)f(will)h(b)s(e)f(selected.)42 b(The)29
|
||||
b(name)g(of)h(a)g(stopp)s(ed)e(job,)i(in)f(this)630 2081
|
||||
y(con)m(text,)h(is)e(the)g(command)g(line)g(used)f(to)h(start)g(it.)41
|
||||
b(If)27 b(this)h(v)-5 b(ariable)28 b(is)g(set)g(to)h(the)e(v)-5
|
||||
b(alue)630 2190 y(`)p Fs(exact)p Ft(',)33 b(the)g(string)g(supplied)f
|
||||
(m)m(ust)h(matc)m(h)g(the)h(name)f(of)g(a)g(stopp)s(ed)f(job)h
|
||||
(exactly;)j(if)630 1787 y(set)29 b(to)h(`)p Fs(substring)p
|
||||
(exactly;)j(if)630 2300 y(set)29 b(to)h(`)p Fs(substring)p
|
||||
Ft(',)d(the)i(string)g(supplied)e(needs)i(to)g(matc)m(h)h(a)f
|
||||
(substring)f(of)h(the)g(name)630 1896 y(of)38 b(a)f(stopp)s(ed)g(job.)
|
||||
(substring)f(of)h(the)g(name)630 2409 y(of)38 b(a)f(stopp)s(ed)g(job.)
|
||||
62 b(The)37 b(`)p Fs(substring)p Ft(')e(v)-5 b(alue)38
|
||||
b(pro)m(vides)f(functionalit)m(y)i(analogous)g(to)630
|
||||
2006 y(the)f(`)p Fs(\045?)p Ft(')f(job)h Fl(id)f Ft(\(see)i(Section)f
|
||||
2519 y(the)f(`)p Fs(\045?)p Ft(')f(job)h Fl(id)f Ft(\(see)i(Section)f
|
||||
(7.1)h([Job)f(Con)m(trol)g(Basics],)j(page)d(89\).)64
|
||||
b(If)37 b(set)h(to)h(an)m(y)630 2115 y(other)32 b(v)-5
|
||||
b(If)37 b(set)h(to)h(an)m(y)630 2628 y(other)32 b(v)-5
|
||||
b(alue,)32 b(the)g(supplied)e(string)i(m)m(ust)f(b)s(e)g(a)h(pre\014x)f
|
||||
(of)h(a)g(stopp)s(ed)e(job's)i(name;)g(this)630 2225
|
||||
(of)h(a)g(stopp)s(ed)e(job's)i(name;)g(this)630 2738
|
||||
y(pro)m(vides)e(functionalit)m(y)i(analogous)g(to)f(the)g(`)p
|
||||
Fs(\045)p Ft(')f(job)g Fl(id)p Ft(.)p eop end
|
||||
%%Page: 93 99
|
||||
|
||||
+8
-6
@@ -6566,7 +6566,7 @@ refers to the ability to selectively stop (suspend)
|
||||
the execution of processes and continue (resume)
|
||||
their execution at a later point. A user typically employs
|
||||
this facility via an interactive interface supplied jointly
|
||||
by the system's terminal driver and Bash.
|
||||
by the operating system kernel's terminal driver and Bash.
|
||||
|
||||
The shell associates a @var{job} with each pipeline. It keeps a
|
||||
table of currently executing jobs, which may be listed with the
|
||||
@@ -6591,11 +6591,13 @@ process group @sc{id} is equal to the current terminal process group
|
||||
These processes are said to be in the foreground. Background
|
||||
processes are those whose process group @sc{id} differs from the
|
||||
terminal's; such processes are immune to keyboard-generated
|
||||
signals. Only foreground processes are allowed to read from or
|
||||
write to the terminal. Background processes which attempt to
|
||||
read from (write to) the terminal are sent a @code{SIGTTIN}
|
||||
(@code{SIGTTOU}) signal by the terminal driver, which, unless
|
||||
caught, suspends the process.
|
||||
signals. Only foreground processes are allowed to read from or, if
|
||||
the user so specifies with @code{stty tostop}, write to the terminal.
|
||||
Background processes which attempt to
|
||||
read from (write to when @code{stty tostop} is in effect) the
|
||||
terminal are sent a @code{SIGTTIN} (@code{SIGTTOU})
|
||||
signal by the kernel's terminal driver,
|
||||
which, unless caught, suspends the process.
|
||||
|
||||
If the operating system on which Bash is running supports
|
||||
job control, Bash contains facilities to use it. Typing the
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
%!PS-Adobe-3.0
|
||||
%%Creator: groff version 1.19.2
|
||||
%%CreationDate: Mon Feb 23 11:56:03 2009
|
||||
%%CreationDate: Thu Mar 5 07:54:57 2009
|
||||
%%DocumentNeededResources: font Times-Roman
|
||||
%%+ font Times-Bold
|
||||
%%+ font Times-Italic
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
%!PS-Adobe-3.0
|
||||
%%Creator: groff version 1.19.2
|
||||
%%CreationDate: Mon Feb 23 11:56:03 2009
|
||||
%%CreationDate: Thu Mar 5 07:54:57 2009
|
||||
%%DocumentNeededResources: font Times-Roman
|
||||
%%+ font Times-Bold
|
||||
%%DocumentSuppliedResources: procset grops 1.19 2
|
||||
|
||||
+3
-3
@@ -2,9 +2,9 @@
|
||||
Copyright (C) 1988-2009 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Fri Feb 13 18:29:03 EST 2009
|
||||
@set LASTCHANGE Wed Mar 4 15:56:07 EST 2009
|
||||
|
||||
@set EDITION 4.0
|
||||
@set VERSION 4.0
|
||||
@set UPDATED 13 February 2009
|
||||
@set UPDATED-MONTH February 2009
|
||||
@set UPDATED 4 March 2009
|
||||
@set UPDATED-MONTH March 2009
|
||||
|
||||
@@ -2931,6 +2931,7 @@ tokword:
|
||||
#define LEX_INHEREDOC 0x080
|
||||
#define LEX_HEREDELIM 0x100 /* reading here-doc delimiter */
|
||||
#define LEX_STRIPDOC 0x200 /* <<- strip tabs from here doc delim */
|
||||
#define LEX_INWORD 0x400
|
||||
|
||||
#define COMSUB_META(ch) ((ch) == ';' || (ch) == '&' || (ch) == '|')
|
||||
|
||||
@@ -2966,7 +2967,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
|
||||
char *ret, *nestret, *ttrans;
|
||||
int retind, retsize, rflags;
|
||||
|
||||
/* itrace("parse_matched_pair: open = %c close = %c flags = %d", open, close, flags); */
|
||||
/*itrace("parse_matched_pair: open = %c close = %c flags = %d", open, close, flags); */
|
||||
count = 1;
|
||||
tflags = 0;
|
||||
|
||||
@@ -3186,7 +3187,7 @@ parse_comsub (qc, open, close, lenp, flags)
|
||||
int open, close;
|
||||
int *lenp, flags;
|
||||
{
|
||||
int count, ch, peekc, tflags, lex_rwlen, lex_firstind;
|
||||
int count, ch, peekc, tflags, lex_rwlen, lex_wlen, lex_firstind;
|
||||
int nestlen, ttranslen, start_lineno;
|
||||
char *ret, *nestret, *ttrans, *heredelim;
|
||||
int retind, retsize, rflags, hdlen;
|
||||
@@ -3207,7 +3208,7 @@ parse_comsub (qc, open, close, lenp, flags)
|
||||
retind = 0;
|
||||
|
||||
start_lineno = line_number;
|
||||
lex_rwlen = 0;
|
||||
lex_rwlen = lex_wlen = 0;
|
||||
|
||||
heredelim = 0;
|
||||
lex_firstind = -1;
|
||||
@@ -3269,11 +3270,54 @@ eof_error:
|
||||
ret[retind++] = ch;
|
||||
|
||||
if ((tflags & LEX_INCOMMENT) && ch == '\n')
|
||||
{
|
||||
/*itrace("parse_comsub:%d: lex_incomment -> 0 ch = `%c'", line_number, ch);*/
|
||||
tflags &= ~LEX_INCOMMENT;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tflags & LEX_PASSNEXT) /* last char was backslash */
|
||||
{
|
||||
/*itrace("parse_comsub:%d: lex_passnext -> 0 ch = `%c' (%d)", line_number, ch, __LINE__);*/
|
||||
tflags &= ~LEX_PASSNEXT;
|
||||
if (qc != '\'' && ch == '\n') /* double-quoted \<newline> disappears. */
|
||||
{
|
||||
if (retind > 0)
|
||||
retind--; /* swallow previously-added backslash */
|
||||
continue;
|
||||
}
|
||||
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
|
||||
if MBTEST(ch == CTLESC || ch == CTLNUL)
|
||||
ret[retind++] = CTLESC;
|
||||
ret[retind++] = ch;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If this is a shell break character, we are not in a word. If not,
|
||||
we either start or continue a word. */
|
||||
if MBTEST(shellbreak (ch))
|
||||
{
|
||||
tflags &= ~LEX_INWORD;
|
||||
/*itrace("parse_comsub:%d: lex_inword -> 0 ch = `%c' (%d)", line_number, ch, __LINE__);*/
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tflags & LEX_INWORD)
|
||||
{
|
||||
lex_wlen++;
|
||||
/*itrace("parse_comsub:%d: lex_inword == 1 ch = `%c' lex_wlen = %d (%d)", line_number, ch, lex_wlen, __LINE__);*/
|
||||
}
|
||||
else
|
||||
{
|
||||
/*itrace("parse_comsub:%d: lex_inword -> 1 ch = `%c' (%d)", line_number, ch, __LINE__);*/
|
||||
tflags |= LEX_INWORD;
|
||||
lex_wlen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Skip whitespace */
|
||||
if MBTEST(shellblank (ch) && lex_rwlen == 0)
|
||||
{
|
||||
@@ -3313,7 +3357,7 @@ eof_error:
|
||||
}
|
||||
|
||||
/* Meta-characters that can introduce a reserved word. Not perfect yet. */
|
||||
if MBTEST((tflags & LEX_PASSNEXT) == 0 && (tflags & LEX_RESWDOK) == 0 && (tflags & LEX_CKCASE) && (tflags & LEX_INCOMMENT) == 0 && shellmeta(ch))
|
||||
if MBTEST((tflags & LEX_RESWDOK) == 0 && (tflags & LEX_CKCASE) && (tflags & LEX_INCOMMENT) == 0 && shellmeta(ch))
|
||||
{
|
||||
/* Add this character. */
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 1, retsize, 64);
|
||||
@@ -3323,7 +3367,7 @@ eof_error:
|
||||
{
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 1, retsize, 64);
|
||||
ret[retind++] = peekc;
|
||||
/*itrace("parse_comsub:%d: set lex_reswordok = 1, ch = `%c'", line_number, ch); */
|
||||
/*itrace("parse_comsub:%d: set lex_reswordok = 1, ch = `%c'", line_number, ch);*/
|
||||
tflags |= LEX_RESWDOK;
|
||||
lex_rwlen = 0;
|
||||
continue;
|
||||
@@ -3331,8 +3375,8 @@ eof_error:
|
||||
else if (ch == '\n' || COMSUB_META(ch))
|
||||
{
|
||||
shell_ungetc (peekc);
|
||||
tflags |= LEX_RESWDOK;
|
||||
/*itrace("parse_comsub:%d: set lex_reswordok = 1, ch = `%c'", line_number, ch);*/
|
||||
tflags |= LEX_RESWDOK;
|
||||
lex_rwlen = 0;
|
||||
continue;
|
||||
}
|
||||
@@ -3362,22 +3406,35 @@ eof_error:
|
||||
if (STREQN (ret + retind - 4, "case", 4))
|
||||
{
|
||||
tflags |= LEX_INCASE;
|
||||
/*itrace("parse_comsub:%d: found `case', lex_incase -> 1", line_number);*/
|
||||
/*itrace("parse_comsub:%d: found `case', lex_incase -> 1 lex_reswdok -> 0", line_number);*/
|
||||
}
|
||||
else if (STREQN (ret + retind - 4, "esac", 4))
|
||||
{
|
||||
tflags &= ~LEX_INCASE;
|
||||
/*itrace("parse_comsub:%d: found `esac', lex_incase -> 0", line_number);*/
|
||||
/*itrace("parse_comsub:%d: found `esac', lex_incase -> 0 lex_reswdok -> 0", line_number);*/
|
||||
}
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
}
|
||||
else if (shellbreak (ch) == 0)
|
||||
else if MBTEST((tflags & LEX_CKCOMMENT) && ch == '#' && (lex_rwlen == 0 || ((tflags & LEX_INWORD) && lex_wlen == 0)))
|
||||
; /* don't modify LEX_RESWDOK if we're starting a comment */
|
||||
else if MBTEST((tflags & LEX_INCASE) && ch != '\n')
|
||||
/* If we can read a reserved word and we're in case, we're at the
|
||||
point where we can read a new pattern list or an esac. We
|
||||
handle the esac case above. If we read a newline, we want to
|
||||
leave LEX_RESWDOK alone. If we read anything else, we want to
|
||||
turn off LEX_RESWDOK, since we're going to read a pattern list. */
|
||||
{
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
/*itrace("parse_comsub:%d: lex_incase == 1 found `%c', lex_reswordok -> 0", line_number, ch);*/
|
||||
}
|
||||
else if MBTEST(shellbreak (ch) == 0)
|
||||
{
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
/*itrace("parse_comsub:%d: found `%c', lex_reswordok -> 0", line_number, ch);*/
|
||||
}
|
||||
}
|
||||
|
||||
/* Might be the start of a here-doc delimiter */
|
||||
if MBTEST((tflags & LEX_INCOMMENT) == 0 && (tflags & LEX_CKCASE) && ch == '<')
|
||||
{
|
||||
/* Add this character. */
|
||||
@@ -3409,31 +3466,15 @@ eof_error:
|
||||
continue;
|
||||
}
|
||||
else
|
||||
ch = peekc; /* fall through and continue XXX - this skips comments if peekc == '#' */
|
||||
ch = peekc; /* fall through and continue XXX */
|
||||
}
|
||||
/* Not exactly right yet, should handle shell metacharacters, too. If
|
||||
any changes are made to this test, make analogous changes to subst.c:
|
||||
extract_delimited_string(). */
|
||||
else if MBTEST((tflags & LEX_CKCOMMENT) && (tflags & LEX_INCOMMENT) == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || shellblank (ret[retind - 1])))
|
||||
else if MBTEST((tflags & LEX_CKCOMMENT) && (tflags & LEX_INCOMMENT) == 0 && ch == '#' && (((tflags & LEX_RESWDOK) && lex_rwlen == 0) || ((tflags & LEX_INWORD) && lex_wlen == 0)))
|
||||
{
|
||||
/*itrace("parse_comsub:%d: lex_incomment -> 1 (%d)", line_number, __LINE__);*/
|
||||
tflags |= LEX_INCOMMENT;
|
||||
}
|
||||
|
||||
if (tflags & LEX_PASSNEXT) /* last char was backslash */
|
||||
{
|
||||
tflags &= ~LEX_PASSNEXT;
|
||||
if (qc != '\'' && ch == '\n') /* double-quoted \<newline> disappears. */
|
||||
{
|
||||
if (retind > 0)
|
||||
retind--; /* swallow previously-added backslash */
|
||||
continue;
|
||||
}
|
||||
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
|
||||
if MBTEST(ch == CTLESC || ch == CTLNUL)
|
||||
ret[retind++] = CTLESC;
|
||||
ret[retind++] = ch;
|
||||
continue;
|
||||
}
|
||||
else if MBTEST(ch == CTLESC || ch == CTLNUL) /* special shell escapes */
|
||||
if MBTEST(ch == CTLESC || ch == CTLNUL) /* special shell escapes */
|
||||
{
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
|
||||
ret[retind++] = CTLESC;
|
||||
@@ -3450,7 +3491,10 @@ eof_error:
|
||||
/*itrace("parse_comsub:%d: found close: count = %d", line_number, count);*/
|
||||
}
|
||||
else if MBTEST(((flags & P_FIRSTCLOSE) == 0) && (tflags & LEX_INCASE) == 0 && ch == open) /* nested begin */
|
||||
{
|
||||
count++;
|
||||
/*itrace("parse_comsub:%d: found open: count = %d", line_number, count);*/
|
||||
}
|
||||
|
||||
/* Add this character. */
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 1, retsize, 64);
|
||||
|
||||
+326
@@ -0,0 +1,326 @@
|
||||
*** ../bash-4.0/parse.y 2009-01-08 08:29:12.000000000 -0500
|
||||
--- parse.y 2009-03-06 20:32:35.000000000 -0500
|
||||
***************
|
||||
*** 1616,1623 ****
|
||||
int *ret;
|
||||
|
||||
! ret = (int *)xmalloc (3 * sizeof (int));
|
||||
ret[0] = last_read_token;
|
||||
ret[1] = token_before_that;
|
||||
ret[2] = two_tokens_ago;
|
||||
return ret;
|
||||
}
|
||||
--- 1616,1624 ----
|
||||
int *ret;
|
||||
|
||||
! ret = (int *)xmalloc (4 * sizeof (int));
|
||||
ret[0] = last_read_token;
|
||||
ret[1] = token_before_that;
|
||||
ret[2] = two_tokens_ago;
|
||||
+ ret[3] = current_token;
|
||||
return ret;
|
||||
}
|
||||
***************
|
||||
*** 1632,1635 ****
|
||||
--- 1633,1637 ----
|
||||
token_before_that = ts[1];
|
||||
two_tokens_ago = ts[2];
|
||||
+ current_token = ts[3];
|
||||
}
|
||||
|
||||
***************
|
||||
*** 2669,2672 ****
|
||||
--- 2671,2675 ----
|
||||
word_desc_to_read = (WORD_DESC *)NULL;
|
||||
|
||||
+ current_token = '\n'; /* XXX */
|
||||
last_read_token = '\n';
|
||||
token_to_read = '\n';
|
||||
***************
|
||||
*** 2916,2919 ****
|
||||
--- 2919,2923 ----
|
||||
#define P_COMMAND 0x08 /* parsing a command, so look for comments */
|
||||
#define P_BACKQUOTE 0x10 /* parsing a backquoted command substitution */
|
||||
+ #define P_ARRAYSUB 0x20 /* parsing a [...] array subscript for assignment */
|
||||
|
||||
/* Lexical state while parsing a grouping construct or $(...). */
|
||||
***************
|
||||
*** 2928,2931 ****
|
||||
--- 2932,2936 ----
|
||||
#define LEX_HEREDELIM 0x100 /* reading here-doc delimiter */
|
||||
#define LEX_STRIPDOC 0x200 /* <<- strip tabs from here doc delim */
|
||||
+ #define LEX_INWORD 0x400
|
||||
|
||||
#define COMSUB_META(ch) ((ch) == ';' || (ch) == '&' || (ch) == '|')
|
||||
***************
|
||||
*** 2963,2967 ****
|
||||
int retind, retsize, rflags;
|
||||
|
||||
! /* itrace("parse_matched_pair: open = %c close = %c flags = %d", open, close, flags); */
|
||||
count = 1;
|
||||
tflags = 0;
|
||||
--- 2968,2972 ----
|
||||
int retind, retsize, rflags;
|
||||
|
||||
! /*itrace("parse_matched_pair: open = %c close = %c flags = %d", open, close, flags); */
|
||||
count = 1;
|
||||
tflags = 0;
|
||||
***************
|
||||
*** 3130,3133 ****
|
||||
--- 3135,3140 ----
|
||||
FREE (nestret);
|
||||
}
|
||||
+ else if ((flags & P_ARRAYSUB) && (tflags & LEX_WASDOL) && (ch == '(' || ch == '{' || ch == '[')) /* ) } ] */
|
||||
+ goto parse_dollar_word;
|
||||
}
|
||||
/* Parse an old-style command substitution within double quotes as a
|
||||
***************
|
||||
*** 3146,3149 ****
|
||||
--- 3153,3157 ----
|
||||
/* check for $(), $[], or ${} inside quoted string. */
|
||||
{
|
||||
+ parse_dollar_word:
|
||||
if (open == ch) /* undo previous increment */
|
||||
count--;
|
||||
***************
|
||||
*** 3180,3184 ****
|
||||
int *lenp, flags;
|
||||
{
|
||||
! int count, ch, peekc, tflags, lex_rwlen, lex_firstind;
|
||||
int nestlen, ttranslen, start_lineno;
|
||||
char *ret, *nestret, *ttrans, *heredelim;
|
||||
--- 3188,3192 ----
|
||||
int *lenp, flags;
|
||||
{
|
||||
! int count, ch, peekc, tflags, lex_rwlen, lex_wlen, lex_firstind;
|
||||
int nestlen, ttranslen, start_lineno;
|
||||
char *ret, *nestret, *ttrans, *heredelim;
|
||||
***************
|
||||
*** 3201,3205 ****
|
||||
|
||||
start_lineno = line_number;
|
||||
! lex_rwlen = 0;
|
||||
|
||||
heredelim = 0;
|
||||
--- 3209,3213 ----
|
||||
|
||||
start_lineno = line_number;
|
||||
! lex_rwlen = lex_wlen = 0;
|
||||
|
||||
heredelim = 0;
|
||||
***************
|
||||
*** 3268,3271 ****
|
||||
--- 3276,3319 ----
|
||||
}
|
||||
|
||||
+ if (tflags & LEX_PASSNEXT) /* last char was backslash */
|
||||
+ {
|
||||
+ /*itrace("parse_comsub:%d: lex_passnext -> 0 ch = `%c' (%d)", line_number, ch, __LINE__);*/
|
||||
+ tflags &= ~LEX_PASSNEXT;
|
||||
+ if (qc != '\'' && ch == '\n') /* double-quoted \<newline> disappears. */
|
||||
+ {
|
||||
+ if (retind > 0)
|
||||
+ retind--; /* swallow previously-added backslash */
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
|
||||
+ if MBTEST(ch == CTLESC || ch == CTLNUL)
|
||||
+ ret[retind++] = CTLESC;
|
||||
+ ret[retind++] = ch;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ /* If this is a shell break character, we are not in a word. If not,
|
||||
+ we either start or continue a word. */
|
||||
+ if MBTEST(shellbreak (ch))
|
||||
+ {
|
||||
+ tflags &= ~LEX_INWORD;
|
||||
+ /*itrace("parse_comsub:%d: lex_inword -> 0 ch = `%c' (%d)", line_number, ch, __LINE__);*/
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (tflags & LEX_INWORD)
|
||||
+ {
|
||||
+ lex_wlen++;
|
||||
+ /*itrace("parse_comsub:%d: lex_inword == 1 ch = `%c' lex_wlen = %d (%d)", line_number, ch, lex_wlen, __LINE__);*/
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /*itrace("parse_comsub:%d: lex_inword -> 1 ch = `%c' (%d)", line_number, ch, __LINE__);*/
|
||||
+ tflags |= LEX_INWORD;
|
||||
+ lex_wlen = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* Skip whitespace */
|
||||
if MBTEST(shellblank (ch) && lex_rwlen == 0)
|
||||
***************
|
||||
*** 3317,3321 ****
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 1, retsize, 64);
|
||||
ret[retind++] = peekc;
|
||||
! /*itrace("parse_comsub:%d: set lex_reswordok = 1, ch = `%c'", line_number, ch); */
|
||||
tflags |= LEX_RESWDOK;
|
||||
lex_rwlen = 0;
|
||||
--- 3365,3369 ----
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 1, retsize, 64);
|
||||
ret[retind++] = peekc;
|
||||
! /*itrace("parse_comsub:%d: set lex_reswordok = 1, ch = `%c'", line_number, ch);*/
|
||||
tflags |= LEX_RESWDOK;
|
||||
lex_rwlen = 0;
|
||||
***************
|
||||
*** 3325,3330 ****
|
||||
{
|
||||
shell_ungetc (peekc);
|
||||
- tflags |= LEX_RESWDOK;
|
||||
/*itrace("parse_comsub:%d: set lex_reswordok = 1, ch = `%c'", line_number, ch);*/
|
||||
lex_rwlen = 0;
|
||||
continue;
|
||||
--- 3373,3378 ----
|
||||
{
|
||||
shell_ungetc (peekc);
|
||||
/*itrace("parse_comsub:%d: set lex_reswordok = 1, ch = `%c'", line_number, ch);*/
|
||||
+ tflags |= LEX_RESWDOK;
|
||||
lex_rwlen = 0;
|
||||
continue;
|
||||
***************
|
||||
*** 3365,3369 ****
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
}
|
||||
! else if (shellbreak (ch) == 0)
|
||||
{
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
--- 3413,3419 ----
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
}
|
||||
! else if MBTEST((tflags & LEX_CKCOMMENT) && ch == '#' && (lex_rwlen == 0 || ((tflags & LEX_INWORD) && lex_wlen == 0)))
|
||||
! ; /* don't turn off LEX_RESWDOK if we're starting a comment */
|
||||
! else if MBTEST(shellbreak (ch) == 0)
|
||||
{
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
***************
|
||||
*** 3372,3375 ****
|
||||
--- 3422,3426 ----
|
||||
}
|
||||
|
||||
+ /* Might be the start of a here-doc delimiter */
|
||||
if MBTEST((tflags & LEX_INCOMMENT) == 0 && (tflags & LEX_CKCASE) && ch == '<')
|
||||
{
|
||||
***************
|
||||
*** 3395,3428 ****
|
||||
else
|
||||
shell_ungetc (peekc);
|
||||
! tflags |= LEX_HEREDELIM;
|
||||
! lex_firstind = -1;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
! ch = peekc; /* fall through and continue XXX - this skips comments if peekc == '#' */
|
||||
}
|
||||
! /* Not exactly right yet, should handle shell metacharacters, too. If
|
||||
! any changes are made to this test, make analogous changes to subst.c:
|
||||
! extract_delimited_string(). */
|
||||
! else if MBTEST((tflags & LEX_CKCOMMENT) && (tflags & LEX_INCOMMENT) == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || shellblank (ret[retind - 1])))
|
||||
tflags |= LEX_INCOMMENT;
|
||||
|
||||
! if (tflags & LEX_PASSNEXT) /* last char was backslash */
|
||||
! {
|
||||
! tflags &= ~LEX_PASSNEXT;
|
||||
! if (qc != '\'' && ch == '\n') /* double-quoted \<newline> disappears. */
|
||||
! {
|
||||
! if (retind > 0)
|
||||
! retind--; /* swallow previously-added backslash */
|
||||
! continue;
|
||||
! }
|
||||
!
|
||||
! RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
|
||||
! if MBTEST(ch == CTLESC || ch == CTLNUL)
|
||||
! ret[retind++] = CTLESC;
|
||||
! ret[retind++] = ch;
|
||||
! continue;
|
||||
! }
|
||||
! else if MBTEST(ch == CTLESC || ch == CTLNUL) /* special shell escapes */
|
||||
{
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
|
||||
--- 3446,3466 ----
|
||||
else
|
||||
shell_ungetc (peekc);
|
||||
! if (peekc != '<')
|
||||
! {
|
||||
! tflags |= LEX_HEREDELIM;
|
||||
! lex_firstind = -1;
|
||||
! }
|
||||
continue;
|
||||
}
|
||||
else
|
||||
! ch = peekc; /* fall through and continue XXX */
|
||||
}
|
||||
! else if MBTEST((tflags & LEX_CKCOMMENT) && (tflags & LEX_INCOMMENT) == 0 && ch == '#' && (((tflags & LEX_RESWDOK) && lex_rwlen == 0) || ((tflags & LEX_INWORD) && lex_wlen == 0)))
|
||||
! {
|
||||
! /*itrace("parse_comsub:%d: lex_incomment -> 1 (%d)", line_number, __LINE__);*/
|
||||
tflags |= LEX_INCOMMENT;
|
||||
+ }
|
||||
|
||||
! if MBTEST(ch == CTLESC || ch == CTLNUL) /* special shell escapes */
|
||||
{
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
|
||||
***************
|
||||
*** 4249,4253 ****
|
||||
(token_index == 0 && (parser_state&PST_COMPASSIGN))))
|
||||
{
|
||||
! ttok = parse_matched_pair (cd, '[', ']', &ttoklen, 0);
|
||||
if (ttok == &matched_pair_error)
|
||||
return -1; /* Bail immediately. */
|
||||
--- 4287,4291 ----
|
||||
(token_index == 0 && (parser_state&PST_COMPASSIGN))))
|
||||
{
|
||||
! ttok = parse_matched_pair (cd, '[', ']', &ttoklen, P_ARRAYSUB);
|
||||
if (ttok == &matched_pair_error)
|
||||
return -1; /* Bail immediately. */
|
||||
***************
|
||||
*** 4450,4453 ****
|
||||
--- 4488,4492 ----
|
||||
case AND_AND:
|
||||
case BANG:
|
||||
+ case BAR_AND:
|
||||
case DO:
|
||||
case DONE:
|
||||
***************
|
||||
*** 5184,5188 ****
|
||||
if (interactive && EOF_Reached)
|
||||
EOF_Reached = 0;
|
||||
! last_command_exit_value = EX_USAGE;
|
||||
return;
|
||||
}
|
||||
--- 5223,5227 ----
|
||||
if (interactive && EOF_Reached)
|
||||
EOF_Reached = 0;
|
||||
! last_command_exit_value = EX_BADUSAGE;
|
||||
return;
|
||||
}
|
||||
***************
|
||||
*** 5199,5203 ****
|
||||
print_offending_line ();
|
||||
|
||||
! last_command_exit_value = EX_USAGE;
|
||||
return;
|
||||
}
|
||||
--- 5238,5242 ----
|
||||
print_offending_line ();
|
||||
|
||||
! last_command_exit_value = EX_BADUSAGE;
|
||||
return;
|
||||
}
|
||||
***************
|
||||
*** 5230,5234 ****
|
||||
}
|
||||
|
||||
! last_command_exit_value = EX_USAGE;
|
||||
}
|
||||
|
||||
--- 5269,5273 ----
|
||||
}
|
||||
|
||||
! last_command_exit_value = EX_BADUSAGE;
|
||||
}
|
||||
|
||||
+5671
File diff suppressed because it is too large
Load Diff
+94
-51
@@ -2670,6 +2670,7 @@ reset_parser ()
|
||||
FREE (word_desc_to_read);
|
||||
word_desc_to_read = (WORD_DESC *)NULL;
|
||||
|
||||
current_token = '\n'; /* XXX */
|
||||
last_read_token = '\n';
|
||||
token_to_read = '\n';
|
||||
}
|
||||
@@ -2917,19 +2918,21 @@ tokword:
|
||||
#define P_DQUOTE 0x04
|
||||
#define P_COMMAND 0x08 /* parsing a command, so look for comments */
|
||||
#define P_BACKQUOTE 0x10 /* parsing a backquoted command substitution */
|
||||
#define P_ARRAY 0x20 /* parsing a [...] array assignment */
|
||||
#define P_ARRAYSUB 0x20 /* parsing a [...] array subscript for assignment */
|
||||
|
||||
/* Lexical state while parsing a grouping construct or $(...). */
|
||||
#define LEX_WASDOL 0x001
|
||||
#define LEX_CKCOMMENT 0x002
|
||||
#define LEX_INCOMMENT 0x004
|
||||
#define LEX_PASSNEXT 0x008
|
||||
#define LEX_RESWDOK 0x010
|
||||
#define LEX_CKCASE 0x020
|
||||
#define LEX_INCASE 0x040
|
||||
#define LEX_INHEREDOC 0x080
|
||||
#define LEX_HEREDELIM 0x100 /* reading here-doc delimiter */
|
||||
#define LEX_STRIPDOC 0x200 /* <<- strip tabs from here doc delim */
|
||||
#define LEX_WASDOL 0x0001
|
||||
#define LEX_CKCOMMENT 0x0002
|
||||
#define LEX_INCOMMENT 0x0004
|
||||
#define LEX_PASSNEXT 0x0008
|
||||
#define LEX_RESWDOK 0x0010
|
||||
#define LEX_CKCASE 0x0020
|
||||
#define LEX_INCASE 0x0040
|
||||
#define LEX_INHEREDOC 0x0080
|
||||
#define LEX_HEREDELIM 0x0100 /* reading here-doc delimiter */
|
||||
#define LEX_STRIPDOC 0x0200 /* <<- strip tabs from here doc delim */
|
||||
#define LEX_WASQUOTED 0x0400
|
||||
#define LEX_INWORD 0x0800
|
||||
|
||||
#define COMSUB_META(ch) ((ch) == ';' || (ch) == '&' || (ch) == '|')
|
||||
|
||||
@@ -2952,6 +2955,11 @@ tokword:
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Not exactly right yet, should handle shell metacharacters, too. If
|
||||
any changes are made to this test, make analogous changes to subst.c:
|
||||
extract_delimited_string(). */
|
||||
#define COMMENT_BEGIN(x) ((x) == '#' && (retind == 0 || ret[retind-1] == '\n' || shellblank (ret[retind - 1])))
|
||||
|
||||
static char matched_pair_error;
|
||||
|
||||
static char *
|
||||
@@ -2965,7 +2973,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
|
||||
char *ret, *nestret, *ttrans;
|
||||
int retind, retsize, rflags;
|
||||
|
||||
/* itrace("parse_matched_pair: open = %c close = %c flags = %d", open, close, flags); */
|
||||
/*itrace("parse_matched_pair: open = %c close = %c flags = %d", open, close, flags); */
|
||||
count = 1;
|
||||
tflags = 0;
|
||||
|
||||
@@ -3009,10 +3017,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Not exactly right yet, should handle shell metacharacters, too. If
|
||||
any changes are made to this test, make analogous changes to subst.c:
|
||||
extract_delimited_string(). */
|
||||
else if MBTEST((tflags & LEX_CKCOMMENT) && (tflags & LEX_INCOMMENT) == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || shellblank (ret[retind - 1])))
|
||||
else if MBTEST((tflags & LEX_CKCOMMENT) && (tflags & LEX_INCOMMENT) == 0 && COMMENT_BEGIN (ch))
|
||||
tflags |= LEX_INCOMMENT;
|
||||
|
||||
if (tflags & LEX_PASSNEXT) /* last char was backslash */
|
||||
@@ -3132,6 +3137,8 @@ parse_matched_pair (qc, open, close, lenp, flags)
|
||||
APPEND_NESTRET ();
|
||||
FREE (nestret);
|
||||
}
|
||||
else if ((flags & P_ARRAYSUB) && (tflags & LEX_WASDOL) && (ch == '(' || ch == '{' || ch == '[')) /* ) } ] */
|
||||
goto parse_dollar_word;
|
||||
}
|
||||
/* Parse an old-style command substitution within double quotes as a
|
||||
single word. */
|
||||
@@ -3148,6 +3155,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
|
||||
else if MBTEST(open != '`' && (tflags & LEX_WASDOL) && (ch == '(' || ch == '{' || ch == '[')) /* ) } ] */
|
||||
/* check for $(), $[], or ${} inside quoted string. */
|
||||
{
|
||||
parse_dollar_word:
|
||||
if (open == ch) /* undo previous increment */
|
||||
count--;
|
||||
if (ch == '(') /* ) */
|
||||
@@ -3182,14 +3190,14 @@ parse_comsub (qc, open, close, lenp, flags)
|
||||
int open, close;
|
||||
int *lenp, flags;
|
||||
{
|
||||
int count, ch, peekc, tflags, lex_rwlen, lex_firstind;
|
||||
int count, ch, peekc, tflags, lex_rwlen, lex_wlen, lex_firstind;
|
||||
int nestlen, ttranslen, start_lineno;
|
||||
char *ret, *nestret, *ttrans, *heredelim;
|
||||
int retind, retsize, rflags, hdlen;
|
||||
|
||||
/*itrace("parse_comsub: qc = `%c' open = %c close = %c", qc, open, close);*/
|
||||
count = 1;
|
||||
tflags = LEX_RESWDOK;
|
||||
tflags = LEX_RESWDOK|LEX_INWORD;
|
||||
|
||||
if ((flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0)
|
||||
tflags |= LEX_CKCASE;
|
||||
@@ -3203,7 +3211,7 @@ parse_comsub (qc, open, close, lenp, flags)
|
||||
retind = 0;
|
||||
|
||||
start_lineno = line_number;
|
||||
lex_rwlen = 0;
|
||||
lex_rwlen = lex_wlen = 0;
|
||||
|
||||
heredelim = 0;
|
||||
lex_firstind = -1;
|
||||
@@ -3270,6 +3278,46 @@ eof_error:
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tflags & LEX_PASSNEXT) /* last char was backslash */
|
||||
{
|
||||
/*itrace("parse_comsub:%d: lex_passnext -> 0 ch = `%c' (%d)", line_number, ch, __LINE__);*/
|
||||
tflags &= ~LEX_PASSNEXT;
|
||||
if (qc != '\'' && ch == '\n') /* double-quoted \<newline> disappears. */
|
||||
{
|
||||
if (retind > 0)
|
||||
retind--; /* swallow previously-added backslash */
|
||||
continue;
|
||||
}
|
||||
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
|
||||
if MBTEST(ch == CTLESC || ch == CTLNUL)
|
||||
ret[retind++] = CTLESC;
|
||||
ret[retind++] = ch;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If this is a shell break character, we are not in a word. If not,
|
||||
we either start or continue a word. */
|
||||
if MBTEST(shellbreak (ch))
|
||||
{
|
||||
tflags &= ~LEX_INWORD;
|
||||
/*itrace("parse_comsub:%d: lex_inword -> 0 ch = `%c' (%d)", line_number, ch, __LINE__);*/
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tflags & LEX_INWORD)
|
||||
{
|
||||
lex_wlen++;
|
||||
/*itrace("parse_comsub:%d: lex_inword == 1 ch = `%c' lex_wlen = %d (%d)", line_number, ch, lex_wlen, __LINE__);*/
|
||||
}
|
||||
else
|
||||
{
|
||||
/*itrace("parse_comsub:%d: lex_inword -> 1 ch = `%c' (%d)", line_number, ch, __LINE__);*/
|
||||
tflags |= LEX_INWORD;
|
||||
lex_wlen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Skip whitespace */
|
||||
if MBTEST(shellblank (ch) && lex_rwlen == 0)
|
||||
{
|
||||
@@ -3319,7 +3367,7 @@ eof_error:
|
||||
{
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 1, retsize, 64);
|
||||
ret[retind++] = peekc;
|
||||
/*itrace("parse_comsub:%d: set lex_reswordok = 1, ch = `%c'", line_number, ch); */
|
||||
/*itrace("parse_comsub:%d: set lex_reswordok = 1, ch = `%c'", line_number, ch);*/
|
||||
tflags |= LEX_RESWDOK;
|
||||
lex_rwlen = 0;
|
||||
continue;
|
||||
@@ -3327,8 +3375,8 @@ eof_error:
|
||||
else if (ch == '\n' || COMSUB_META(ch))
|
||||
{
|
||||
shell_ungetc (peekc);
|
||||
tflags |= LEX_RESWDOK;
|
||||
/*itrace("parse_comsub:%d: set lex_reswordok = 1, ch = `%c'", line_number, ch);*/
|
||||
tflags |= LEX_RESWDOK;
|
||||
lex_rwlen = 0;
|
||||
continue;
|
||||
}
|
||||
@@ -3367,14 +3415,17 @@ eof_error:
|
||||
}
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
}
|
||||
else if (shellbreak (ch) == 0)
|
||||
else if MBTEST((tflags & LEX_CKCOMMENT) && ((lex_rwlen == 0 && ch == '#') || COMMENT_BEGIN(ch)))
|
||||
; /* don't turn off LEX_RESWDOK if we're starting a comment */
|
||||
else if MBTEST(shellbreak (ch) == 0)
|
||||
{
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
/*itrace("parse_comsub:%d: found `%c', lex_reswordok -> 0", line_number, ch);*/
|
||||
}
|
||||
}
|
||||
|
||||
if MBTEST((tflags & LEX_INCOMMENT) == 0 && (tflags & LEX_CKCASE) && ch == '<')
|
||||
/* Might be the start of a here-doc delimiter */
|
||||
if MBTEST((tflags & (LEX_PASSNEXT|LEX_INCOMMENT)) == 0 && (tflags & LEX_CKCASE) && ch == '<')
|
||||
{
|
||||
/* Add this character. */
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 1, retsize, 64);
|
||||
@@ -3397,36 +3448,27 @@ eof_error:
|
||||
}
|
||||
else
|
||||
shell_ungetc (peekc);
|
||||
tflags |= LEX_HEREDELIM;
|
||||
lex_firstind = -1;
|
||||
if (peekc != '<')
|
||||
{
|
||||
tflags |= LEX_HEREDELIM;
|
||||
lex_firstind = -1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else
|
||||
ch = peekc; /* fall through and continue XXX - this skips comments if peekc == '#' */
|
||||
ch = peekc; /* fall through and continue XXX */
|
||||
}
|
||||
/* Not exactly right yet, should handle shell metacharacters, too. If
|
||||
any changes are made to this test, make analogous changes to subst.c:
|
||||
extract_delimited_string(). */
|
||||
else if MBTEST((tflags & LEX_CKCOMMENT) && (tflags & LEX_INCOMMENT) == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || shellblank (ret[retind - 1])))
|
||||
#if 0
|
||||
else if MBTEST((tflags & LEX_CKCOMMENT) && (tflags & LEX_INCOMMENT) == 0 && ch == '#' && (((tflags & LEX_RESWDOK) && lex_rwlen == 0) || ((tflags & LEX_INWORD) && lex_wlen == 0) || COMMENT_BEGIN(ch)))
|
||||
#else
|
||||
else if MBTEST((tflags & LEX_CKCOMMENT) && (tflags & LEX_INCOMMENT) == 0 && ch == '#' && (((tflags & LEX_RESWDOK) && lex_rwlen == 0) || ((tflags & LEX_INWORD) && lex_wlen == 0)))
|
||||
#endif
|
||||
{
|
||||
/*itrace("parse_comsub:%d: lex_incomment -> 1 (%d)", line_number, __LINE__);*/
|
||||
tflags |= LEX_INCOMMENT;
|
||||
}
|
||||
|
||||
if (tflags & LEX_PASSNEXT) /* last char was backslash */
|
||||
{
|
||||
tflags &= ~LEX_PASSNEXT;
|
||||
if (qc != '\'' && ch == '\n') /* double-quoted \<newline> disappears. */
|
||||
{
|
||||
if (retind > 0)
|
||||
retind--; /* swallow previously-added backslash */
|
||||
continue;
|
||||
}
|
||||
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
|
||||
if MBTEST(ch == CTLESC || ch == CTLNUL)
|
||||
ret[retind++] = CTLESC;
|
||||
ret[retind++] = ch;
|
||||
continue;
|
||||
}
|
||||
else if MBTEST(ch == CTLESC || ch == CTLNUL) /* special shell escapes */
|
||||
if MBTEST(ch == CTLESC || ch == CTLNUL) /* special shell escapes */
|
||||
{
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
|
||||
ret[retind++] = CTLESC;
|
||||
@@ -4251,7 +4293,7 @@ read_token_word (character)
|
||||
((token_index > 0 && assignment_acceptable (last_read_token) && token_is_ident (token, token_index)) ||
|
||||
(token_index == 0 && (parser_state&PST_COMPASSIGN))))
|
||||
{
|
||||
ttok = parse_matched_pair (cd, '[', ']', &ttoklen, 0);
|
||||
ttok = parse_matched_pair (cd, '[', ']', &ttoklen, P_ARRAYSUB);
|
||||
if (ttok == &matched_pair_error)
|
||||
return -1; /* Bail immediately. */
|
||||
RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 2,
|
||||
@@ -4452,6 +4494,7 @@ reserved_word_acceptable (toksym)
|
||||
case '}': /* XXX */
|
||||
case AND_AND:
|
||||
case BANG:
|
||||
case BAR_AND:
|
||||
case DO:
|
||||
case DONE:
|
||||
case ELIF:
|
||||
@@ -5186,7 +5229,7 @@ report_syntax_error (message)
|
||||
parser_error (line_number, "%s", message);
|
||||
if (interactive && EOF_Reached)
|
||||
EOF_Reached = 0;
|
||||
last_command_exit_value = EX_USAGE;
|
||||
last_command_exit_value = EX_BADUSAGE;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5201,7 +5244,7 @@ report_syntax_error (message)
|
||||
if (interactive == 0)
|
||||
print_offending_line ();
|
||||
|
||||
last_command_exit_value = EX_USAGE;
|
||||
last_command_exit_value = EX_BADUSAGE;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5232,7 +5275,7 @@ report_syntax_error (message)
|
||||
EOF_Reached = 0;
|
||||
}
|
||||
|
||||
last_command_exit_value = EX_USAGE;
|
||||
last_command_exit_value = EX_BADUSAGE;
|
||||
}
|
||||
|
||||
/* ??? Needed function. ??? We have to be able to discard the constructs
|
||||
|
||||
@@ -2931,6 +2931,7 @@ tokword:
|
||||
#define LEX_INHEREDOC 0x080
|
||||
#define LEX_HEREDELIM 0x100 /* reading here-doc delimiter */
|
||||
#define LEX_STRIPDOC 0x200 /* <<- strip tabs from here doc delim */
|
||||
#define LEX_INWORD 0x400
|
||||
|
||||
#define COMSUB_META(ch) ((ch) == ';' || (ch) == '&' || (ch) == '|')
|
||||
|
||||
@@ -2966,7 +2967,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
|
||||
char *ret, *nestret, *ttrans;
|
||||
int retind, retsize, rflags;
|
||||
|
||||
/* itrace("parse_matched_pair: open = %c close = %c flags = %d", open, close, flags); */
|
||||
/*itrace("parse_matched_pair: open = %c close = %c flags = %d", open, close, flags); */
|
||||
count = 1;
|
||||
tflags = 0;
|
||||
|
||||
@@ -3186,7 +3187,7 @@ parse_comsub (qc, open, close, lenp, flags)
|
||||
int open, close;
|
||||
int *lenp, flags;
|
||||
{
|
||||
int count, ch, peekc, tflags, lex_rwlen, lex_firstind;
|
||||
int count, ch, peekc, tflags, lex_rwlen, lex_wlen, lex_firstind;
|
||||
int nestlen, ttranslen, start_lineno;
|
||||
char *ret, *nestret, *ttrans, *heredelim;
|
||||
int retind, retsize, rflags, hdlen;
|
||||
@@ -3207,7 +3208,7 @@ parse_comsub (qc, open, close, lenp, flags)
|
||||
retind = 0;
|
||||
|
||||
start_lineno = line_number;
|
||||
lex_rwlen = 0;
|
||||
lex_rwlen = lex_wlen = 0;
|
||||
|
||||
heredelim = 0;
|
||||
lex_firstind = -1;
|
||||
@@ -3269,11 +3270,54 @@ eof_error:
|
||||
ret[retind++] = ch;
|
||||
|
||||
if ((tflags & LEX_INCOMMENT) && ch == '\n')
|
||||
{
|
||||
/*itrace("parse_comsub:%d: lex_incomment -> 0 ch = `%c'", line_number, ch);*/
|
||||
tflags &= ~LEX_INCOMMENT;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tflags & LEX_PASSNEXT) /* last char was backslash */
|
||||
{
|
||||
/*itrace("parse_comsub:%d: lex_passnext -> 0 ch = `%c' (%d)", line_number, ch, __LINE__);*/
|
||||
tflags &= ~LEX_PASSNEXT;
|
||||
if (qc != '\'' && ch == '\n') /* double-quoted \<newline> disappears. */
|
||||
{
|
||||
if (retind > 0)
|
||||
retind--; /* swallow previously-added backslash */
|
||||
continue;
|
||||
}
|
||||
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
|
||||
if MBTEST(ch == CTLESC || ch == CTLNUL)
|
||||
ret[retind++] = CTLESC;
|
||||
ret[retind++] = ch;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If this is a shell break character, we are not in a word. If not,
|
||||
we either start or continue a word. */
|
||||
if MBTEST(shellbreak (ch))
|
||||
{
|
||||
tflags &= ~LEX_INWORD;
|
||||
/*itrace("parse_comsub:%d: lex_inword -> 0 ch = `%c' (%d)", line_number, ch, __LINE__);*/
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tflags & LEX_INWORD)
|
||||
{
|
||||
lex_wlen++;
|
||||
/*itrace("parse_comsub:%d: lex_inword == 1 ch = `%c' lex_wlen = %d (%d)", line_number, ch, lex_wlen, __LINE__);*/
|
||||
}
|
||||
else
|
||||
{
|
||||
/*itrace("parse_comsub:%d: lex_inword -> 1 ch = `%c' (%d)", line_number, ch, __LINE__);*/
|
||||
tflags |= LEX_INWORD;
|
||||
lex_wlen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Skip whitespace */
|
||||
if MBTEST(shellblank (ch) && lex_rwlen == 0)
|
||||
{
|
||||
@@ -3313,7 +3357,7 @@ eof_error:
|
||||
}
|
||||
|
||||
/* Meta-characters that can introduce a reserved word. Not perfect yet. */
|
||||
if MBTEST((tflags & LEX_PASSNEXT) == 0 && (tflags & LEX_RESWDOK) == 0 && (tflags & LEX_CKCASE) && (tflags & LEX_INCOMMENT) == 0 && shellmeta(ch))
|
||||
if MBTEST((tflags & LEX_RESWDOK) == 0 && (tflags & LEX_CKCASE) && (tflags & LEX_INCOMMENT) == 0 && shellmeta(ch))
|
||||
{
|
||||
/* Add this character. */
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 1, retsize, 64);
|
||||
@@ -3323,7 +3367,7 @@ eof_error:
|
||||
{
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 1, retsize, 64);
|
||||
ret[retind++] = peekc;
|
||||
/*itrace("parse_comsub:%d: set lex_reswordok = 1, ch = `%c'", line_number, ch); */
|
||||
/*itrace("parse_comsub:%d: set lex_reswordok = 1, ch = `%c'", line_number, ch);*/
|
||||
tflags |= LEX_RESWDOK;
|
||||
lex_rwlen = 0;
|
||||
continue;
|
||||
@@ -3331,8 +3375,8 @@ eof_error:
|
||||
else if (ch == '\n' || COMSUB_META(ch))
|
||||
{
|
||||
shell_ungetc (peekc);
|
||||
tflags |= LEX_RESWDOK;
|
||||
/*itrace("parse_comsub:%d: set lex_reswordok = 1, ch = `%c'", line_number, ch);*/
|
||||
tflags |= LEX_RESWDOK;
|
||||
lex_rwlen = 0;
|
||||
continue;
|
||||
}
|
||||
@@ -3362,22 +3406,35 @@ eof_error:
|
||||
if (STREQN (ret + retind - 4, "case", 4))
|
||||
{
|
||||
tflags |= LEX_INCASE;
|
||||
/*itrace("parse_comsub:%d: found `case', lex_incase -> 1", line_number);*/
|
||||
/*itrace("parse_comsub:%d: found `case', lex_incase -> 1 lex_reswdok -> 0", line_number);*/
|
||||
}
|
||||
else if (STREQN (ret + retind - 4, "esac", 4))
|
||||
{
|
||||
tflags &= ~LEX_INCASE;
|
||||
/*itrace("parse_comsub:%d: found `esac', lex_incase -> 0", line_number);*/
|
||||
/*itrace("parse_comsub:%d: found `esac', lex_incase -> 0 lex_reswdok -> 0", line_number);*/
|
||||
}
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
}
|
||||
else if (shellbreak (ch) == 0)
|
||||
else if MBTEST((tflags & LEX_CKCOMMENT) && ch == '#' && (lex_rwlen == 0 || ((tflags & LEX_INWORD) && lex_wlen == 0)))
|
||||
; /* don't modify LEX_RESWDOK if we're starting a comment */
|
||||
else if MBTEST((tflags & LEX_INCASE) && ch != '\n')
|
||||
/* If we can read a reserved word and we're in case, we're at the
|
||||
point where we can read a new pattern list or an esac. We
|
||||
handle the esac case above. If we read a newline, we want to
|
||||
leave LEX_RESWDOK alone. If we read anything else, we want to
|
||||
turn off LEX_RESWDOK, since we're going to read a pattern list. */
|
||||
{
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
/*itrace("parse_comsub:%d: lex_incase == 1 found `%c', lex_reswordok -> 0", line_number, ch);*/
|
||||
}
|
||||
else if MBTEST(shellbreak (ch) == 0)
|
||||
{
|
||||
tflags &= ~LEX_RESWDOK;
|
||||
/*itrace("parse_comsub:%d: found `%c', lex_reswordok -> 0", line_number, ch);*/
|
||||
}
|
||||
}
|
||||
|
||||
/* Might be the start of a here-doc delimiter */
|
||||
if MBTEST((tflags & LEX_INCOMMENT) == 0 && (tflags & LEX_CKCASE) && ch == '<')
|
||||
{
|
||||
/* Add this character. */
|
||||
@@ -3409,31 +3466,15 @@ eof_error:
|
||||
continue;
|
||||
}
|
||||
else
|
||||
ch = peekc; /* fall through and continue XXX - this skips comments if peekc == '#' */
|
||||
ch = peekc; /* fall through and continue XXX */
|
||||
}
|
||||
/* Not exactly right yet, should handle shell metacharacters, too. If
|
||||
any changes are made to this test, make analogous changes to subst.c:
|
||||
extract_delimited_string(). */
|
||||
else if MBTEST((tflags & LEX_CKCOMMENT) && (tflags & LEX_INCOMMENT) == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || shellblank (ret[retind - 1])))
|
||||
else if MBTEST((tflags & LEX_CKCOMMENT) && (tflags & LEX_INCOMMENT) == 0 && ch == '#' && (((tflags & LEX_RESWDOK) && lex_rwlen == 0) || ((tflags & LEX_INWORD) && lex_wlen == 0)))
|
||||
{
|
||||
itrace("parse_comsub:%d: lex_incomment -> 1 (%d)", line_number, __LINE__);
|
||||
tflags |= LEX_INCOMMENT;
|
||||
}
|
||||
|
||||
if (tflags & LEX_PASSNEXT) /* last char was backslash */
|
||||
{
|
||||
tflags &= ~LEX_PASSNEXT;
|
||||
if (qc != '\'' && ch == '\n') /* double-quoted \<newline> disappears. */
|
||||
{
|
||||
if (retind > 0)
|
||||
retind--; /* swallow previously-added backslash */
|
||||
continue;
|
||||
}
|
||||
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
|
||||
if MBTEST(ch == CTLESC || ch == CTLNUL)
|
||||
ret[retind++] = CTLESC;
|
||||
ret[retind++] = ch;
|
||||
continue;
|
||||
}
|
||||
else if MBTEST(ch == CTLESC || ch == CTLNUL) /* special shell escapes */
|
||||
if MBTEST(ch == CTLESC || ch == CTLNUL) /* special shell escapes */
|
||||
{
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
|
||||
ret[retind++] = CTLESC;
|
||||
@@ -3447,10 +3488,13 @@ eof_error:
|
||||
else if MBTEST(ch == close && (tflags & LEX_INCASE) == 0) /* ending delimiter */
|
||||
{
|
||||
count--;
|
||||
/*itrace("parse_comsub:%d: found close: count = %d", line_number, count);*/
|
||||
itrace("parse_comsub:%d: found close: count = %d", line_number, count);
|
||||
}
|
||||
else if MBTEST(((flags & P_FIRSTCLOSE) == 0) && (tflags & LEX_INCASE) == 0 && ch == open) /* nested begin */
|
||||
{
|
||||
count++;
|
||||
itrace("parse_comsub:%d: found open: count = %d", line_number, count);
|
||||
}
|
||||
|
||||
/* Add this character. */
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, 1, retsize, 64);
|
||||
@@ -5194,7 +5238,7 @@ report_syntax_error (message)
|
||||
parser_error (line_number, "%s", message);
|
||||
if (interactive && EOF_Reached)
|
||||
EOF_Reached = 0;
|
||||
last_command_exit_value = EX_USAGE;
|
||||
last_command_exit_value = EX_BADUSAGE;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5209,7 +5253,7 @@ report_syntax_error (message)
|
||||
if (interactive == 0)
|
||||
print_offending_line ();
|
||||
|
||||
last_command_exit_value = EX_USAGE;
|
||||
last_command_exit_value = EX_BADUSAGE;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5240,7 +5284,7 @@ report_syntax_error (message)
|
||||
EOF_Reached = 0;
|
||||
}
|
||||
|
||||
last_command_exit_value = EX_USAGE;
|
||||
last_command_exit_value = EX_BADUSAGE;
|
||||
}
|
||||
|
||||
/* ??? Needed function. ??? We have to be able to discard the constructs
|
||||
|
||||
@@ -1110,7 +1110,7 @@ extract_delimited_string (string, sindex, opener, alt_opener, closer, flags)
|
||||
}
|
||||
|
||||
/* Not exactly right yet; should handle shell metacharacters and
|
||||
multibyte characters, too. */
|
||||
multibyte characters, too. See COMMENT_BEGIN define in parse.y */
|
||||
if ((flags & SX_COMMAND) && c == '#' && (i == 0 || string[i - 1] == '\n' || shellblank (string[i - 1])))
|
||||
{
|
||||
in_comment = 1;
|
||||
|
||||
+15
-4
@@ -64,7 +64,7 @@ while [ $# -gt 0 ]; do
|
||||
esac
|
||||
done
|
||||
|
||||
case "${host_os}-${SHOBJ_CC}" in
|
||||
case "${host_os}-${SHOBJ_CC}-${host_vendor}" in
|
||||
sunos4*-*gcc*)
|
||||
SHOBJ_CFLAGS=-fpic
|
||||
SHOBJ_LD=/usr/bin/ld
|
||||
@@ -108,8 +108,8 @@ sunos5*|solaris2*)
|
||||
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
|
||||
;;
|
||||
|
||||
# All versions of Linux or the semi-mythical GNU Hurd.
|
||||
linux*-*|gnu*-*|k*bsd*-gnu-*)
|
||||
# All versions of Linux (including Gentoo/FreeBSD) or the semi-mythical GNU Hurd.
|
||||
linux*-*|gnu*-*|k*bsd*-gnu-*|freebsd*-gentoo)
|
||||
SHOBJ_CFLAGS=-fPIC
|
||||
SHOBJ_LD='${CC}'
|
||||
SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
|
||||
@@ -128,7 +128,7 @@ freebsd2*)
|
||||
;;
|
||||
|
||||
# FreeBSD-3.x ELF
|
||||
freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*)
|
||||
freebsd[3-6]*|freebsdelf[3-6]*|freebsdaout[3-6]*|dragonfly*)
|
||||
SHOBJ_CFLAGS=-fPIC
|
||||
SHOBJ_LD='${CC}'
|
||||
|
||||
@@ -145,6 +145,17 @@ freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*)
|
||||
fi
|
||||
;;
|
||||
|
||||
# FreeBSD-7.x and later have only ELF
|
||||
freebsd[7-9]*|freebsdelf[7-9]*)
|
||||
SHOBJ_CFLAGS=-fPIC
|
||||
SHOBJ_LD='${CC}'
|
||||
|
||||
SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
|
||||
SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
|
||||
|
||||
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
|
||||
;;
|
||||
|
||||
# Darwin/MacOS X
|
||||
darwin[89]*|darwin10*)
|
||||
SHOBJ_STATUS=supported
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
BUILD_DIR=/usr/local/build/chet/bash/bash-current
|
||||
BUILD_DIR=/usr/local/build/bash/bash-current
|
||||
THIS_SH=$BUILD_DIR/bash
|
||||
PATH=$PATH:$BUILD_DIR
|
||||
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
BUILD_DIR=/usr/local/build/chet/bash/bash-current
|
||||
THIS_SH=$BUILD_DIR/bash
|
||||
PATH=$PATH:$BUILD_DIR
|
||||
|
||||
export THIS_SH PATH
|
||||
|
||||
rm -f /tmp/xx
|
||||
|
||||
/bin/sh "$@"
|
||||
+5
-2
@@ -52,11 +52,14 @@ a-{bdef-g-c a-{bdef-i-c
|
||||
10 8 6 4 2
|
||||
1 3 5 7 9 11 13 15 17 19
|
||||
1
|
||||
0100 0095 0090 0085 0080 0075 0070 0065 0060 0055 0050 0045 0040 0035 0030 0025 0020 0015 0010 0005 0000
|
||||
00100 00095 00090 00085 00080 00075 00070 00065 00060 00055 00050 00045 00040 00035 00030 00025 00020 00015 00010 00005 00000
|
||||
100 95 90 85 80 75 70 65 60 55 50 45 40 35 30 25 20 15 10 5 0
|
||||
100 95 90 85 80 75 70 65 60 55 50 45 40 35 30 25 20 15 10 5 0
|
||||
a b c d e f g h i j k l m n o p q r s t u v w x y z
|
||||
a c e g i k m o q s u w y
|
||||
z x v t r p n l j h f d b
|
||||
10 8 6 4 2 0
|
||||
10 8 6 4 2 0
|
||||
-50 -45 -40 -35 -30 -25 -20 -15 -10 -5 0
|
||||
{1..10.f}
|
||||
{1..ff}
|
||||
{1..10..ff}
|
||||
|
||||
@@ -94,6 +94,11 @@ echo {a..z}
|
||||
echo {a..z..2}
|
||||
echo {z..a..-2}
|
||||
|
||||
# unwanted zero-padding -- fixed post-bash-4.0
|
||||
echo {10..0..2}
|
||||
echo {10..0..-2}
|
||||
echo {-50..-0..5}
|
||||
|
||||
# bad
|
||||
echo {1..10.f}
|
||||
echo {1..ff}
|
||||
|
||||
@@ -202,3 +202,6 @@ ${THIS_SH} ./comsub-posix1.sub
|
||||
: $(echo foo)"
|
||||
"
|
||||
|
||||
# fixed after bash-4.0 released
|
||||
: $(case a in a) echo ;; # comment
|
||||
esac)
|
||||
|
||||
@@ -19,3 +19,11 @@ argv[1] = <sed> argv[2] = <-e> argv[3] = <s/[^I:]//g>
|
||||
argv[1] = <foo\^Jbar>
|
||||
argv[1] = <foobar>
|
||||
argv[1] = <foo\^Jbar>
|
||||
#esac
|
||||
a
|
||||
ok 1
|
||||
ok 2
|
||||
ok 3
|
||||
ok 4
|
||||
ok 5
|
||||
ok 6
|
||||
|
||||
@@ -40,3 +40,5 @@ bar'`
|
||||
|
||||
echo $(recho 'foo\
|
||||
bar')
|
||||
|
||||
${THIS_SH} ./comsub1.sub
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
# command substution parsing tests
|
||||
|
||||
TABSIZE=`grep -v '^[ #]' $CAPS </dev/null | grep -v "^$" | grep -v "^capalias"| grep -v "^infoalias" | wc -l`
|
||||
|
||||
recho `echo ab cd #efg
|
||||
hijkl`
|
||||
|
||||
recho ab$(echo mn; echo op)yz
|
||||
|
||||
a=`echo 'a b c' | sed 's/ /\\
|
||||
/g' | grep 'b'`
|
||||
recho $a
|
||||
|
||||
recho `echo 'a\' b`
|
||||
|
||||
recho `echo '\$' bab`
|
||||
|
||||
recho `echo '\`' ab`
|
||||
|
||||
recho `echo '\\' ab`
|
||||
|
||||
# old-style command substitution parsing compatibility tests -- post bash-3.1
|
||||
recho 'foo \\
|
||||
bar'
|
||||
|
||||
recho 'foo \
|
||||
bar'
|
||||
|
||||
echo `recho sed -e 's/[ :]/\\
|
||||
/g'`
|
||||
|
||||
echo `recho sed -e 's/[ :]/\
|
||||
/g'`
|
||||
|
||||
echo `recho 'foo\\
|
||||
bar'`
|
||||
|
||||
echo `recho 'foo\
|
||||
bar'`
|
||||
|
||||
echo $(recho 'foo\
|
||||
bar')
|
||||
@@ -0,0 +1,48 @@
|
||||
: $(echo \;)
|
||||
|
||||
: $(case a in a) echo ;;# comment
|
||||
esac)
|
||||
|
||||
: $(case a in a) echo ;; # comment
|
||||
esac)
|
||||
|
||||
: $(: \;# not a comment )
|
||||
|
||||
: $(: \ # not a comment)
|
||||
|
||||
echo $(case a in a) echo \#esac ;;
|
||||
esac)
|
||||
|
||||
: $(case a in a) : ;#esac ;;
|
||||
esac)
|
||||
|
||||
: $(case a in a) : ;#esac comment )
|
||||
esac)
|
||||
|
||||
: $(case a in a) : ;
|
||||
esac)
|
||||
|
||||
echo $(#comment )
|
||||
echo a)
|
||||
|
||||
echo $(case a in (a) echo ok 1;; # comment
|
||||
esac)
|
||||
|
||||
echo $(case a in (a) echo ok 2;; # comment
|
||||
(b) echo moo;;
|
||||
esac)
|
||||
|
||||
echo $(case a in (a) echo ok 3 # comment
|
||||
;;
|
||||
esac)
|
||||
|
||||
echo $(case a in a) echo ok 4;; # comment
|
||||
esac)
|
||||
|
||||
echo $(case a in a) echo ok 5;; # comment
|
||||
b) echo moo;;
|
||||
esac)
|
||||
|
||||
echo $(case a in (a) echo ok 6 # comment
|
||||
;;
|
||||
esac)
|
||||
@@ -0,0 +1,26 @@
|
||||
: $(echo \;)
|
||||
|
||||
: $(case a in a) echo ;;# comment
|
||||
esac)
|
||||
|
||||
: $(case a in a) echo ;; # comment
|
||||
esac)
|
||||
|
||||
: $(: \;# not a comment )
|
||||
|
||||
: $(: \ # not a comment)
|
||||
|
||||
echo $(case a in a) echo \#esac ;;
|
||||
esac)
|
||||
|
||||
: $(case a in a) : ;#esac ;;
|
||||
esac)
|
||||
|
||||
: $(case a in a) : ;#esac comment )
|
||||
esac)
|
||||
|
||||
: $(case a in a) : ;
|
||||
esac)
|
||||
|
||||
echo $(#comment )
|
||||
echo a)
|
||||
Reference in New Issue
Block a user