mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-27 07:43:07 +02:00
fix for race condition with process creation and terminal process group; changes to printf builtin for multibyte characters
This commit is contained in:
@@ -40,6 +40,7 @@ builtins/psize.aux
|
||||
doc/Makefile
|
||||
examples/loadables/Makefile
|
||||
examples/loadables/Makefile.inc
|
||||
examples/loadables/Makefile.sample
|
||||
examples/loadables/perl/Makefile
|
||||
lib/glob/Makefile
|
||||
lib/intl/Makefile
|
||||
@@ -82,3 +83,7 @@ tests/printenv
|
||||
tests/recho
|
||||
tests/xcase
|
||||
tests/zecho
|
||||
|
||||
parser-built
|
||||
y.tab.c
|
||||
y.tab.h
|
||||
|
||||
@@ -7563,3 +7563,19 @@ eval.c
|
||||
- parse_command: don't run pending traps if we're parsing a command
|
||||
substitution
|
||||
From a report from Emanuele Torre <torreemanuele6@gmail.com>
|
||||
|
||||
9/8
|
||||
---
|
||||
jobs.c
|
||||
- stop_pipeline: don't have the parent set the terminal pgrp; rely on
|
||||
child processes to do it to avoid potential race conditions.
|
||||
From a discussion beginning at
|
||||
https://lists.gnu.org/archive/html/bug-bash/2023-08/msg00087.html
|
||||
|
||||
builtins/printf.def
|
||||
- bexpand: when parsing the string to be expanded, consume entire
|
||||
multibyte characters at a time, in case their encoding includes a
|
||||
'\\'
|
||||
- printf_builtin: when parsing the format string, consume entire
|
||||
multibyte characters at a time unless they begin with '\\' or '%',
|
||||
to avoid characters whose encoding contains those characters
|
||||
|
||||
+1
-1
@@ -907,7 +907,7 @@ uninstall: .made
|
||||
-( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
|
||||
-( cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
|
||||
|
||||
.PHONY: basic-clean clean realclean maintainer-clean distclean mostlyclean maybe-clean
|
||||
.PHONY: basic-clean clean maintainer-clean distclean mostlyclean maybe-clean
|
||||
|
||||
LIB_SUBDIRS = ${RL_LIBDIR} ${HIST_LIBDIR} ${TERM_LIBDIR} ${GLOB_LIBDIR} \
|
||||
${INTL_LIBDIR} ${TILDE_LIBDIR} ${ALLOC_LIBDIR} ${SH_LIBDIR}
|
||||
|
||||
+26
-8
@@ -268,7 +268,7 @@ printf_builtin (WORD_LIST *list)
|
||||
char convch, thisch, nextch, *format, *modstart, *precstart, *fmt, *start;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
char mbch[25]; /* 25 > MB_LEN_MAX, plus can handle 4-byte UTF-8 and large Unicode characters*/
|
||||
int mbind, mblen;
|
||||
int mbind, mblen, mb_cur_max;
|
||||
#endif
|
||||
#if defined (ARRAY_VARS)
|
||||
int arrayflags;
|
||||
@@ -342,6 +342,8 @@ printf_builtin (WORD_LIST *list)
|
||||
if (format == 0 || *format == 0)
|
||||
return (EXECUTION_SUCCESS);
|
||||
|
||||
mb_cur_max = MB_CUR_MAX;
|
||||
|
||||
/* Basic algorithm is to scan the format string for conversion
|
||||
specifications -- once one is found, find out if the field
|
||||
width or precision is a '*'; if it is, gather up value. Note,
|
||||
@@ -380,7 +382,16 @@ printf_builtin (WORD_LIST *list)
|
||||
|
||||
if (*fmt != '%')
|
||||
{
|
||||
PC (*fmt); /* should print entire multibyte char here */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
size_t l;
|
||||
int i;
|
||||
l = mbcharlen (fmt, mb_cur_max);
|
||||
for (i = 0; i < l; i++, fmt++)
|
||||
PC (*fmt);
|
||||
fmt--; /* for loop will increment it for us again */
|
||||
#else
|
||||
PC (*fmt);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1143,12 +1154,13 @@ tescape (char *estart, char *cp, int *lenp, int *sawc)
|
||||
static char *
|
||||
bexpand (char *string, int len, int *sawc, int *lenp)
|
||||
{
|
||||
int temp;
|
||||
char *ret, *r, *s, c;
|
||||
int temp, c;
|
||||
char *ret, *r, *s, *send;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
char mbch[25];
|
||||
int mbind, mblen;
|
||||
#endif
|
||||
DECLARE_MBSTATE;
|
||||
|
||||
if (string == 0 || len == 0)
|
||||
{
|
||||
@@ -1171,15 +1183,21 @@ bexpand (char *string, int len, int *sawc, int *lenp)
|
||||
ret = (char *)xmalloc (len + 1);
|
||||
#endif
|
||||
|
||||
send = string + len;
|
||||
for (r = ret, s = string; s && *s; )
|
||||
{
|
||||
c = *s++;
|
||||
if (c != '\\' || *s == '\0')
|
||||
if (s[1] == '\0')
|
||||
{
|
||||
*r++ = c;
|
||||
*r++ = *s;
|
||||
break;
|
||||
}
|
||||
else if (*s != '\\')
|
||||
{
|
||||
COPY_CHAR_P (r, s, send);
|
||||
continue;
|
||||
}
|
||||
/* output entire multibyte character here? */
|
||||
else
|
||||
s++; /* *s == '\\' */
|
||||
|
||||
temp = 0;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
|
||||
+16
-5
@@ -3,7 +3,7 @@
|
||||
</HEAD>
|
||||
<BODY><TABLE WIDTH=100%>
|
||||
<TR>
|
||||
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2023 August 15<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2023 August 31<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
</TR>
|
||||
</TABLE>
|
||||
<BR><A HREF="#index">Index</A>
|
||||
@@ -3610,7 +3610,9 @@ Any element of an array may be referenced using
|
||||
${<I>name</I>[<I>subscript</I>]}. The braces are required to avoid
|
||||
conflicts with pathname expansion. If
|
||||
<I>subscript</I> is <B>@</B> or <B>*</B>, the word expands to
|
||||
all members of <I>name</I>. These subscripts differ only when the
|
||||
all members of <I>name</I>,
|
||||
unless noted in the description of a builtin or word expansion.
|
||||
These subscripts differ only when the
|
||||
word appears within double quotes. If the word is double-quoted,
|
||||
${<I>name</I>[*]} expands to a single
|
||||
word with the value of each array member separated by the first
|
||||
@@ -6288,6 +6290,12 @@ True if the shell variable
|
||||
<I>varname</I>
|
||||
|
||||
is set (has been assigned a value).
|
||||
If <I>varname</I> is an indexed
|
||||
array variable name subscripted by <I>@</I> or <I>*</I>,
|
||||
this returns true if the array has any set elements.
|
||||
If <I>varname</I> is an associative
|
||||
array variable name subscripted by <I>@</I> or <I>*</I>,
|
||||
this returns true if an element with that key is set.
|
||||
<DT><B>-R </B><I>varname</I>
|
||||
|
||||
<DD>
|
||||
@@ -12173,6 +12181,9 @@ as a shell variable name.
|
||||
The %s and %c format specifiers accept an l (long) modifier, which forces
|
||||
them to convert the argument string to a wide-character string and apply
|
||||
any supplied field width and precision in terms of characters, not bytes.
|
||||
|
||||
|
||||
|
||||
<P>
|
||||
|
||||
Arguments to non-string format specifiers are treated as C constants,
|
||||
@@ -15115,7 +15126,7 @@ There may be only one active coprocess at a time.
|
||||
<HR>
|
||||
<TABLE WIDTH=100%>
|
||||
<TR>
|
||||
<TH ALIGN=LEFT width=33%>GNU Bash 5.3<TH ALIGN=CENTER width=33%>2023 August 15<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
<TH ALIGN=LEFT width=33%>GNU Bash 5.3<TH ALIGN=CENTER width=33%>2023 August 31<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
</TR>
|
||||
</TABLE>
|
||||
<HR>
|
||||
@@ -15221,7 +15232,7 @@ There may be only one active coprocess at a time.
|
||||
<DT><A HREF="#lbDI">BUGS</A><DD>
|
||||
</DL>
|
||||
<HR>
|
||||
This document was created by man2html from /usr/local/src/bash/bash-20230812/doc/bash.1.<BR>
|
||||
Time: 15 August 2023 16:12:02 EDT
|
||||
This document was created by man2html from /usr/local/src/bash/bash-20230907/doc/bash.1.<BR>
|
||||
Time: 10 September 2023 17:14:39 EDT
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
Binary file not shown.
+6883
-6795
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+17
-7
@@ -4,9 +4,9 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<!-- This text is a brief description of the features that are present in
|
||||
the Bash shell (version 5.3, 15 August 2023).
|
||||
the Bash shell (version 5.3, 31 August 2023).
|
||||
|
||||
This is Edition 5.3, last updated 15 August 2023,
|
||||
This is Edition 5.3, last updated 31 August 2023,
|
||||
of The GNU Bash Reference Manual,
|
||||
for Bash, Version 5.3.
|
||||
|
||||
@@ -77,10 +77,10 @@ Next: <a href="#Introduction" accesskey="n" rel="next">Introduction</a>, Previou
|
||||
<span id="Bash-Features-1"></span><h1 class="top">Bash Features</h1>
|
||||
|
||||
<p>This text is a brief description of the features that are present in
|
||||
the Bash shell (version 5.3, 15 August 2023).
|
||||
the Bash shell (version 5.3, 31 August 2023).
|
||||
The Bash home page is <a href="http://www.gnu.org/software/bash/">http://www.gnu.org/software/bash/</a>.
|
||||
</p>
|
||||
<p>This is Edition 5.3, last updated 15 August 2023,
|
||||
<p>This is Edition 5.3, last updated 31 August 2023,
|
||||
of <cite>The GNU Bash Reference Manual</cite>,
|
||||
for <code>Bash</code>, Version 5.3.
|
||||
</p>
|
||||
@@ -2111,7 +2111,7 @@ When ‘<samp>+=</samp>’ is applied to an array variable using compoun
|
||||
(see <a href="#Arrays">Arrays</a>), the
|
||||
variable’s value is not unset (as it is when using ‘<samp>=</samp>’), and new
|
||||
values are appended to the array beginning at one greater than the array’s
|
||||
maximum index (for indexed arrays), or added as additional key-value pairs
|
||||
maximum index (for indexed arrays), or added as additional key-value pairs
|
||||
in an associative array.
|
||||
When applied to a string-valued variable, <var>value</var> is expanded and
|
||||
appended to the variable’s value.
|
||||
@@ -5594,7 +5594,8 @@ formats quote the argument string using single quotes.
|
||||
<dt><span><code>%Q</code></span></dt>
|
||||
<dd><p>like <code>%q</code>, but applies any supplied precision to the <var>argument</var>
|
||||
before quoting it.
|
||||
</p></dd>
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span><code>%(<var>datefmt</var>)T</code></span></dt>
|
||||
<dd><p>Causes <code>printf</code> to output the date-time string resulting from using
|
||||
<var>datefmt</var> as a format string for <code>strftime</code>(3).
|
||||
@@ -5619,6 +5620,7 @@ as a shell variable name.
|
||||
them to convert the argument string to a wide-character string and apply
|
||||
any supplied field width and precision in terms of characters, not bytes.
|
||||
</p>
|
||||
|
||||
<p>Arguments to non-string format specifiers are treated as C language constants,
|
||||
except that a leading plus or minus sign is allowed, and if the leading
|
||||
character is a single or double quote, the value is the ASCII value of
|
||||
@@ -8590,6 +8592,12 @@ option to the <code>set</code> builtin (see <a href="#The-Set-Builtin">The Set B
|
||||
</dd>
|
||||
<dt><span><code>-v <var>varname</var></code></span></dt>
|
||||
<dd><p>True if the shell variable <var>varname</var> is set (has been assigned a value).
|
||||
If <var>varname</var> is an indexed
|
||||
array variable name subscripted by ‘<samp>@</samp>’ or ‘<samp>*</samp>’,
|
||||
this returns true if the array has any set elements.
|
||||
If <var>varname</var> is an associative
|
||||
array variable name subscripted by ‘<samp>@</samp>’ or ‘<samp>*</samp>’,
|
||||
this returns true if an element with that key is set.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span><code>-R <var>varname</var></code></span></dt>
|
||||
@@ -8950,7 +8958,9 @@ using the compound assignment syntax; see <a href="#Shell-Parameters">Shell Para
|
||||
The braces are required to avoid
|
||||
conflicts with the shell’s filename expansion operators. If the
|
||||
<var>subscript</var> is ‘<samp>@</samp>’ or ‘<samp>*</samp>’, the word expands to all members
|
||||
of the array <var>name</var>. These subscripts differ only when the word
|
||||
of the array <var>name</var>, unless otherwise noted in the description of a
|
||||
builtin or word expansion.
|
||||
These subscripts differ only when the word
|
||||
appears within double quotes.
|
||||
If the word is double-quoted,
|
||||
<code>${<var>name</var>[*]}</code> expands to a single word with
|
||||
|
||||
+49
-25
@@ -1,12 +1,11 @@
|
||||
This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021/MacPorts 2021.58693_0) (preloaded format=etex 2021.8.30) 16 AUG 2023 10:12
|
||||
This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021/MacPorts 2021.58693_0) (preloaded format=pdfetex 2021.8.30) 10 SEP 2023 17:14
|
||||
entering extended mode
|
||||
restricted \write18 enabled.
|
||||
file:line:error style messages enabled.
|
||||
%&-line parsing enabled.
|
||||
**\nonstopmode \input /usr/local/src/bash/bash-20230812/doc/bashref.texi \input
|
||||
/usr/local/src/bash/bash-20230812/doc/bashref.texi
|
||||
(/usr/local/src/bash/bash-20230812/doc/bashref.texi
|
||||
(/usr/local/src/bash/bash-20230812/doc/texinfo.tex
|
||||
**\input /usr/local/src/bash/bash-20230907/doc/bashref.texi
|
||||
(/usr/local/src/bash/bash-20230907/doc/bashref.texi
|
||||
(/usr/local/src/bash/bash-20230907/doc/texinfo.tex
|
||||
Loading texinfo [version 2015-11-22.14]:
|
||||
\outerhsize=\dimen16
|
||||
\outervsize=\dimen17
|
||||
@@ -162,20 +161,23 @@ This is `epsf.tex' v2.7.4 <14 February 2011>
|
||||
texinfo.tex: doing @include of version.texi
|
||||
|
||||
|
||||
(/usr/local/src/bash/bash-20230812/doc/version.texi) [1] [2]
|
||||
(/usr/local/build/bash/bash-20230812/doc/bashref.toc [-1] [-2] [-3]) [-4]
|
||||
Chapter 1
|
||||
(/usr/local/src/bash/bash-20230907/doc/version.texi) [1{/opt/local/var/db/texmf
|
||||
/fonts/map/pdftex/updmap/pdftex.map}] [2]
|
||||
(/usr/local/build/bash/bash-20230907/doc/bashref.toc [-1] [-2] [-3]) [-4]
|
||||
(/usr/local/build/bash/bash-20230907/doc/bashref.toc)
|
||||
(/usr/local/build/bash/bash-20230907/doc/bashref.toc) Chapter 1
|
||||
\openout0 = `bashref.toc'.
|
||||
|
||||
(/usr/local/build/bash/bash-20230812/doc/bashref.aux)
|
||||
|
||||
(/usr/local/build/bash/bash-20230907/doc/bashref.aux)
|
||||
\openout1 = `bashref.aux'.
|
||||
|
||||
Chapter 2
|
||||
[1] [2]
|
||||
Chapter 2 [1] [2]
|
||||
@cpindfile=@write2
|
||||
\openout2 = `bashref.cp'.
|
||||
|
||||
[3] Chapter 3 [4] [5] [6] [7]
|
||||
|
||||
[3] Chapter 3 [4] [5] [6] [7]
|
||||
@vrindfile=@write3
|
||||
\openout3 = `bashref.vr'.
|
||||
|
||||
@@ -227,7 +229,7 @@ Overfull \hbox (5.95723pt too wide) in paragraph at lines 724--725
|
||||
[49] [50] [51]
|
||||
[52] [53] [54] [55] [56] [57] [58] [59] [60] [61] [62] [63] [64] [65] [66]
|
||||
[67] [68]
|
||||
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5401--5401
|
||||
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5407--5407
|
||||
[]@texttt set [-abefhkmnptuvxBCEHPT] [-o @textttsl option-name@texttt ] [--] [
|
||||
-] [@textttsl ar-gu-ment []@texttt ][]
|
||||
|
||||
@@ -240,7 +242,7 @@ Overfull \hbox (38.26585pt too wide) in paragraph at lines 5401--5401
|
||||
.etc.
|
||||
|
||||
|
||||
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5402--5402
|
||||
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5408--5408
|
||||
[]@texttt set [+abefhkmnptuvxBCEHPT] [+o @textttsl option-name@texttt ] [--] [
|
||||
-] [@textttsl ar-gu-ment []@texttt ][]
|
||||
|
||||
@@ -259,7 +261,7 @@ Overfull \hbox (38.26585pt too wide) in paragraph at lines 5402--5402
|
||||
[119] [120]
|
||||
texinfo.tex: doing @include of rluser.texi
|
||||
|
||||
(/usr/local/src/bash/bash-20230812/lib/readline/doc/rluser.texi
|
||||
(/usr/local/src/bash/bash-20230907/lib/readline/doc/rluser.texi
|
||||
Chapter 8 [121] [122] [123] [124] [125] [126] [127] [128] [129] [130] [131]
|
||||
[132]
|
||||
Underfull \hbox (badness 7540) in paragraph at lines 878--884
|
||||
@@ -309,10 +311,10 @@ gnored[]
|
||||
texinfo.tex: doing @include of hsuser.texi
|
||||
|
||||
|
||||
(/usr/local/src/bash/bash-20230812/lib/readline/doc/hsuser.texi Chapter 9
|
||||
(/usr/local/src/bash/bash-20230907/lib/readline/doc/hsuser.texi Chapter 9
|
||||
[158] [159] [160] [161] [162] [163]) Chapter 10 [164] [165] [166] [167]
|
||||
[168]
|
||||
Underfull \hbox (badness 10000) in paragraph at lines 9729--9738
|
||||
Underfull \hbox (badness 10000) in paragraph at lines 9743--9752
|
||||
[]@textrm All of the fol-low-ing op-tions ex-cept for `@texttt alt-array-implem
|
||||
entation[]@textrm '[],
|
||||
|
||||
@@ -325,7 +327,7 @@ entation[]@textrm '[],
|
||||
.etc.
|
||||
|
||||
|
||||
Underfull \hbox (badness 10000) in paragraph at lines 9729--9738
|
||||
Underfull \hbox (badness 10000) in paragraph at lines 9743--9752
|
||||
@textrm `@texttt disabled-builtins[]@textrm '[], `@texttt direxpand-default[]@t
|
||||
extrm '[], `@texttt strict-posix-default[]@textrm '[], and
|
||||
|
||||
@@ -341,16 +343,38 @@ extrm '[], `@texttt strict-posix-default[]@textrm '[], and
|
||||
[178] [179] Appendix C [180]
|
||||
texinfo.tex: doing @include of fdl.texi
|
||||
|
||||
(/usr/local/src/bash/bash-20230812/doc/fdl.texi
|
||||
(/usr/local/src/bash/bash-20230907/doc/fdl.texi
|
||||
[181] [182] [183] [184] [185] [186] [187]) Appendix D [188] [189] [190]
|
||||
[191] [192] [193] [194] [195] [196] [197] )
|
||||
Here is how much of TeX's memory you used:
|
||||
3531 strings out of 497096
|
||||
40273 string characters out of 6206923
|
||||
87718 words of memory out of 5000000
|
||||
4700 multiletter control sequences out of 15000+600000
|
||||
4104 strings out of 497086
|
||||
47614 string characters out of 6206517
|
||||
142215 words of memory out of 5000000
|
||||
4869 multiletter control sequences out of 15000+600000
|
||||
34315 words of font info for 116 fonts, out of 8000000 for 9000
|
||||
51 hyphenation exceptions out of 8191
|
||||
16i,6n,16p,402b,942s stack positions out of 5000i,500n,10000p,200000b,80000s
|
||||
16i,6n,16p,331b,983s stack positions out of 5000i,500n,10000p,200000b,80000s
|
||||
{/opt/local/share/texmf-texlive/font
|
||||
s/enc/dvips/cm-super/cm-super-t1.enc}</opt/local/share/texmf-texlive/fonts/type
|
||||
1/public/amsfonts/cm/cmbx12.pfb></opt/local/share/texmf-texlive/fonts/type1/pub
|
||||
lic/amsfonts/cm/cmcsc10.pfb></opt/local/share/texmf-texlive/fonts/type1/public/
|
||||
amsfonts/cm/cmmi10.pfb></opt/local/share/texmf-texlive/fonts/type1/public/amsfo
|
||||
nts/cm/cmmi12.pfb></opt/local/share/texmf-texlive/fonts/type1/public/amsfonts/c
|
||||
m/cmmi9.pfb></opt/local/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmr1
|
||||
0.pfb></opt/local/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmr9.pfb><
|
||||
/opt/local/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmsl10.pfb></opt/
|
||||
local/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmsltt10.pfb></opt/loc
|
||||
al/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmsy10.pfb></opt/local/sh
|
||||
are/texmf-texlive/fonts/type1/public/amsfonts/cm/cmti10.pfb></opt/local/share/t
|
||||
exmf-texlive/fonts/type1/public/amsfonts/cm/cmtt10.pfb></opt/local/share/texmf-
|
||||
texlive/fonts/type1/public/amsfonts/cm/cmtt12.pfb></opt/local/share/texmf-texli
|
||||
ve/fonts/type1/public/amsfonts/cm/cmtt9.pfb></opt/local/share/texmf-texlive/fon
|
||||
ts/type1/public/cm-super/sfrm1095.pfb></opt/local/share/texmf-texlive/fonts/typ
|
||||
e1/public/cm-super/sfrm1440.pfb>
|
||||
Output written on bashref.pdf (203 pages, 813794 bytes).
|
||||
PDF statistics:
|
||||
2825 PDF objects out of 2984 (max. 8388607)
|
||||
2575 compressed objects within 26 object streams
|
||||
331 named destinations out of 1000 (max. 500000)
|
||||
1157 words of extra memory for PDF output out of 10000 (max. 10000000)
|
||||
|
||||
Output written on bashref.dvi (203 pages, 847040 bytes).
|
||||
|
||||
Binary file not shown.
+146
-137
@@ -1,7 +1,7 @@
|
||||
%!PS-Adobe-2.0
|
||||
%%Creator: dvips(k) 2021.1 Copyright 2021 Radical Eye Software
|
||||
%%Title: bashref.dvi
|
||||
%%CreationDate: Wed Aug 16 14:12:07 2023
|
||||
%%CreationDate: Sun Sep 10 21:14:23 2023
|
||||
%%Pages: 203
|
||||
%%PageOrder: Ascend
|
||||
%%BoundingBox: 0 0 612 792
|
||||
@@ -12,7 +12,7 @@
|
||||
%DVIPSWebPage: (www.radicaleye.com)
|
||||
%DVIPSCommandLine: dvips -D 600 -t letter -o bashref.ps bashref.dvi
|
||||
%DVIPSParameters: dpi=600
|
||||
%DVIPSSource: TeX output 2023.08.16:1012
|
||||
%DVIPSSource: TeX output 2023.09.10:1714
|
||||
%%BeginProcSet: tex.pro 0 0
|
||||
%!
|
||||
/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
|
||||
@@ -7630,9 +7630,9 @@ b(oundation)p 150 5141 3600 17 v eop end
|
||||
%%Page: 2 2
|
||||
TeXDict begin 2 1 bop 150 4279 a Fu(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 4389 y(5.3,)c(15)f(August)f
|
||||
(the)h(Bash)f(shell)h(\(v)m(ersion)150 4389 y(5.3,)c(31)f(August)f
|
||||
(2023\).)150 4523 y(This)e(is)g(Edition)h(5.3,)h(last)f(up)s(dated)e
|
||||
(15)i(August)f(2023,)j(of)e Fr(The)f(GNU)h(Bash)f(Reference)h(Man)m
|
||||
(31)i(August)f(2023,)j(of)e Fr(The)f(GNU)h(Bash)f(Reference)h(Man)m
|
||||
(ual)p Fu(,)h(for)150 4633 y Ft(Bash)p Fu(,)f(V)-8 b(ersion)31
|
||||
b(5.3.)150 4767 y(Cop)m(yrigh)m(t)602 4764 y(c)577 4767
|
||||
y Fq(\015)f Fu(1988{2023)35 b(F)-8 b(ree)31 b(Soft)m(w)m(are)h(F)-8
|
||||
@@ -15463,123 +15463,130 @@ Fr(optname)47 b Fu(is)41 b(enabled.)73 b(The)41 b(list)h(of)f(options)h
|
||||
(app)s(ears)e(in)630 518 y(the)33 b(description)h(of)f(the)g
|
||||
Ft(-o)g Fu(option)g(to)h(the)g Ft(set)e Fu(builtin)h(\(see)h(Section)g
|
||||
(4.3.1)h([The)e(Set)630 628 y(Builtin],)e(page)g(69\).)150
|
||||
783 y Ft(-v)f Fj(varname)630 892 y Fu(T)-8 b(rue)30 b(if)g(the)h(shell)
|
||||
f(v)-5 b(ariable)32 b Fr(v)-5 b(arname)35 b Fu(is)30
|
||||
b(set)h(\(has)g(b)s(een)e(assigned)i(a)g(v)-5 b(alue\).)150
|
||||
1047 y Ft(-R)30 b Fj(varname)630 1157 y Fu(T)-8 b(rue)30
|
||||
b(if)g(the)h(shell)f(v)-5 b(ariable)32 b Fr(v)-5 b(arname)35
|
||||
b Fu(is)30 b(set)h(and)f(is)h(a)f(name)h(reference.)150
|
||||
1312 y Ft(-z)f Fj(string)66 b Fu(T)-8 b(rue)30 b(if)g(the)h(length)g
|
||||
(of)f Fr(string)38 b Fu(is)31 b(zero.)150 1467 y Ft(-n)f
|
||||
Fj(string)150 1576 y(string)192 b Fu(T)-8 b(rue)30 b(if)g(the)h(length)
|
||||
g(of)f Fr(string)38 b Fu(is)31 b(non-zero.)150 1731 y
|
||||
Fj(string1)d Ft(==)i Fj(string2)150 1841 y(string1)e
|
||||
Ft(=)i Fj(string2)630 1951 y Fu(T)-8 b(rue)43 b(if)h(the)g(strings)g
|
||||
772 y Ft(-v)f Fj(varname)630 882 y Fu(T)-8 b(rue)24 b(if)h(the)g(shell)
|
||||
g(v)-5 b(ariable)26 b Fr(v)-5 b(arname)30 b Fu(is)25
|
||||
b(set)g(\(has)g(b)s(een)f(assigned)h(a)h(v)-5 b(alue\).)39
|
||||
b(If)25 b Fr(v)-5 b(arname)630 991 y Fu(is)37 b(an)g(indexed)g(arra)m
|
||||
(y)h(v)-5 b(ariable)38 b(name)f(subscripted)f(b)m(y)h(`)p
|
||||
Ft(@)p Fu(')g(or)h(`)p Ft(*)p Fu(',)h(this)e(returns)f(true)630
|
||||
1101 y(if)g(the)f(arra)m(y)h(has)g(an)m(y)f(set)i(elemen)m(ts.)57
|
||||
b(If)35 b Fr(v)-5 b(arname)41 b Fu(is)35 b(an)h(asso)s(ciativ)m(e)i
|
||||
(arra)m(y)e(v)-5 b(ariable)630 1210 y(name)32 b(subscripted)e(b)m(y)h
|
||||
(`)p Ft(@)p Fu(')h(or)g(`)p Ft(*)p Fu(',)g(this)f(returns)g(true)g(if)h
|
||||
(an)f(elemen)m(t)i(with)e(that)i(k)m(ey)f(is)630 1320
|
||||
y(set.)150 1464 y Ft(-R)e Fj(varname)630 1574 y Fu(T)-8
|
||||
b(rue)30 b(if)g(the)h(shell)f(v)-5 b(ariable)32 b Fr(v)-5
|
||||
b(arname)35 b Fu(is)30 b(set)h(and)f(is)h(a)f(name)h(reference.)150
|
||||
1718 y Ft(-z)f Fj(string)66 b Fu(T)-8 b(rue)30 b(if)g(the)h(length)g
|
||||
(of)f Fr(string)38 b Fu(is)31 b(zero.)150 1862 y Ft(-n)f
|
||||
Fj(string)150 1972 y(string)192 b Fu(T)-8 b(rue)30 b(if)g(the)h(length)
|
||||
g(of)f Fr(string)38 b Fu(is)31 b(non-zero.)150 2116 y
|
||||
Fj(string1)d Ft(==)i Fj(string2)150 2226 y(string1)e
|
||||
Ft(=)i Fj(string2)630 2336 y Fu(T)-8 b(rue)43 b(if)h(the)g(strings)g
|
||||
(are)g(equal.)82 b(When)44 b(used)f(with)g(the)h Ft([[)g
|
||||
Fu(command,)j(this)d(p)s(er-)630 2060 y(forms)d(pattern)g(matc)m(hing)i
|
||||
Fu(command,)j(this)d(p)s(er-)630 2445 y(forms)d(pattern)g(matc)m(hing)i
|
||||
(as)f(describ)s(ed)e(ab)s(o)m(v)m(e)j(\(see)f(Section)g(3.2.5.2)i
|
||||
([Conditional)630 2170 y(Constructs],)30 b(page)h(12\).)630
|
||||
2302 y(`)p Ft(=)p Fu(')g(should)e(b)s(e)h(used)f(with)h(the)h
|
||||
([Conditional)630 2555 y(Constructs],)30 b(page)h(12\).)630
|
||||
2682 y(`)p Ft(=)p Fu(')g(should)e(b)s(e)h(used)f(with)h(the)h
|
||||
Ft(test)e Fu(command)h(for)g Fm(posix)g Fu(conformance.)150
|
||||
2457 y Fj(string1)e Ft(!=)i Fj(string2)630 2567 y Fu(T)-8
|
||||
2826 y Fj(string1)e Ft(!=)i Fj(string2)630 2936 y Fu(T)-8
|
||||
b(rue)30 b(if)g(the)h(strings)f(are)h(not)f(equal.)150
|
||||
2722 y Fj(string1)e Ft(<)i Fj(string2)630 2831 y Fu(T)-8
|
||||
3080 y Fj(string1)e Ft(<)i Fj(string2)630 3189 y Fu(T)-8
|
||||
b(rue)30 b(if)g Fr(string1)38 b Fu(sorts)31 b(b)s(efore)f
|
||||
Fr(string2)38 b Fu(lexicographically)-8 b(.)150 2986
|
||||
y Fj(string1)28 b Ft(>)i Fj(string2)630 3096 y Fu(T)-8
|
||||
Fr(string2)38 b Fu(lexicographically)-8 b(.)150 3334
|
||||
y Fj(string1)28 b Ft(>)i Fj(string2)630 3443 y Fu(T)-8
|
||||
b(rue)30 b(if)g Fr(string1)38 b Fu(sorts)31 b(after)g
|
||||
Fr(string2)38 b Fu(lexicographically)-8 b(.)150 3251
|
||||
y Fj(arg1)29 b Ft(OP)h Fj(arg2)630 3361 y Ft(OP)j Fu(is)h(one)g(of)h(`)
|
||||
Fr(string2)38 b Fu(lexicographically)-8 b(.)150 3588
|
||||
y Fj(arg1)29 b Ft(OP)h Fj(arg2)630 3697 y Ft(OP)j Fu(is)h(one)g(of)h(`)
|
||||
p Ft(-eq)p Fu(',)f(`)p Ft(-ne)p Fu(',)h(`)p Ft(-lt)p
|
||||
Fu(',)g(`)p Ft(-le)p Fu(',)f(`)p Ft(-gt)p Fu(',)h(or)f(`)p
|
||||
Ft(-ge)p Fu('.)51 b(These)34 b(arithmetic)h(binary)630
|
||||
3470 y(op)s(erators)h(return)e(true)i(if)f Fr(arg1)44
|
||||
3807 y(op)s(erators)h(return)e(true)i(if)f Fr(arg1)44
|
||||
b Fu(is)36 b(equal)g(to,)i(not)e(equal)g(to,)i(less)e(than,)h(less)f
|
||||
(than)f(or)630 3580 y(equal)29 b(to,)g(greater)h(than,)e(or)g(greater)i
|
||||
(than)f(or)630 3916 y(equal)29 b(to,)g(greater)h(than,)e(or)g(greater)i
|
||||
(than)d(or)i(equal)f(to)h Fr(arg2)p Fu(,)h(resp)s(ectiv)m(ely)-8
|
||||
b(.)42 b Fr(Arg1)36 b Fu(and)630 3689 y Fr(arg2)41 b
|
||||
b(.)42 b Fr(Arg1)36 b Fu(and)630 4026 y Fr(arg2)41 b
|
||||
Fu(ma)m(y)34 b(b)s(e)f(p)s(ositiv)m(e)h(or)f(negativ)m(e)j(in)m
|
||||
(tegers.)50 b(When)33 b(used)g(with)g(the)g Ft([[)g Fu(command,)630
|
||||
3799 y Fr(Arg1)41 b Fu(and)33 b Fr(Arg2)41 b Fu(are)33
|
||||
4136 y Fr(Arg1)41 b Fu(and)33 b Fr(Arg2)41 b Fu(are)33
|
||||
b(ev)-5 b(aluated)35 b(as)e(arithmetic)i(expressions)d(\(see)j(Section)
|
||||
f(6.5)g([Shell)630 3908 y(Arithmetic],)e(page)f(101\).)150
|
||||
4145 y Fs(6.5)68 b(Shell)45 b(Arithmetic)150 4304 y Fu(The)26
|
||||
f(6.5)g([Shell)630 4245 y(Arithmetic],)e(page)f(101\).)150
|
||||
4471 y Fs(6.5)68 b(Shell)45 b(Arithmetic)150 4630 y Fu(The)26
|
||||
b(shell)h(allo)m(ws)h(arithmetic)f(expressions)g(to)g(b)s(e)f(ev)-5
|
||||
b(aluated,)29 b(as)d(one)h(of)g(the)g(shell)f(expansions)h(or)f(b)m(y)
|
||||
150 4414 y(using)h(the)g Ft(\(\()g Fu(comp)s(ound)e(command,)j(the)g
|
||||
150 4740 y(using)h(the)g Ft(\(\()g Fu(comp)s(ound)e(command,)j(the)g
|
||||
Ft(let)e Fu(builtin,)i(or)f(the)g Ft(-i)g Fu(option)h(to)f(the)h
|
||||
Ft(declare)d Fu(builtin.)275 4546 y(Ev)-5 b(aluation)27
|
||||
Ft(declare)d Fu(builtin.)275 4867 y(Ev)-5 b(aluation)27
|
||||
b(is)g(done)f(in)g(\014xed-width)g(in)m(tegers)i(with)e(no)h(c)m(hec)m
|
||||
(k)h(for)e(o)m(v)m(er\015o)m(w,)j(though)d(division)h(b)m(y)150
|
||||
4656 y(0)g(is)g(trapp)s(ed)f(and)h(\015agged)g(as)h(an)f(error.)39
|
||||
4976 y(0)g(is)g(trapp)s(ed)f(and)h(\015agged)g(as)h(an)f(error.)39
|
||||
b(The)26 b(op)s(erators)h(and)g(their)g(precedence,)h(asso)s(ciativit)m
|
||||
(y)-8 b(,)32 b(and)150 4765 y(v)-5 b(alues)35 b(are)h(the)f(same)g(as)h
|
||||
(y)-8 b(,)32 b(and)150 5086 y(v)-5 b(alues)35 b(are)h(the)f(same)g(as)h
|
||||
(in)e(the)h(C)g(language.)56 b(The)35 b(follo)m(wing)h(list)g(of)f(op)s
|
||||
(erators)g(is)g(group)s(ed)f(in)m(to)150 4875 y(lev)m(els)27
|
||||
(erators)g(is)g(group)s(ed)f(in)m(to)150 5196 y(lev)m(els)27
|
||||
b(of)f(equal-precedence)i(op)s(erators.)39 b(The)25 b(lev)m(els)j(are)e
|
||||
(listed)h(in)e(order)h(of)g(decreasing)g(precedence.)150
|
||||
5030 y Fj(id)p Ft(++)j Fj(id)p Ft(--)67 b Fu(v)-5 b(ariable)31
|
||||
b(p)s(ost-incremen)m(t)g(and)f(p)s(ost-decremen)m(t)150
|
||||
5185 y Ft(++)p Fj(id)f Ft(--)p Fj(id)67 b Fu(v)-5 b(ariable)31
|
||||
b(pre-incremen)m(t)g(and)f(pre-decremen)m(t)150 5340
|
||||
y Ft(-)g(+)354 b Fu(unary)29 b(min)m(us)h(and)g(plus)p
|
||||
5340 y Fj(id)p Ft(++)j Fj(id)p Ft(--)67 b Fu(v)-5 b(ariable)31
|
||||
b(p)s(ost-incremen)m(t)g(and)f(p)s(ost-decremen)m(t)p
|
||||
eop end
|
||||
%%Page: 102 108
|
||||
TeXDict begin 102 107 bop 150 -116 a Fu(Chapter)30 b(6:)41
|
||||
b(Bash)30 b(F)-8 b(eatures)2439 b(102)150 299 y Ft(!)30
|
||||
b(~)354 b Fu(logical)33 b(and)d(bit)m(wise)h(negation)150
|
||||
482 y Ft(**)384 b Fu(exp)s(onen)m(tiation)150 664 y Ft(*)30
|
||||
b(/)g(\045)276 b Fu(m)m(ultiplication,)33 b(division,)d(remainder)150
|
||||
847 y Ft(+)g(-)354 b Fu(addition,)31 b(subtraction)150
|
||||
1030 y Ft(<<)f(>>)258 b Fu(left)31 b(and)f(righ)m(t)h(bit)m(wise)g
|
||||
(shifts)150 1213 y Ft(<=)f(>=)g(<)g(>)102 b Fu(comparison)150
|
||||
1395 y Ft(==)30 b(!=)258 b Fu(equalit)m(y)32 b(and)e(inequalit)m(y)150
|
||||
1578 y Ft(&)432 b Fu(bit)m(wise)31 b(AND)150 1761 y Ft(^)432
|
||||
b Fu(bit)m(wise)31 b(exclusiv)m(e)h(OR)150 1944 y Ft(|)432
|
||||
b Fu(bit)m(wise)31 b(OR)150 2126 y Ft(&&)384 b Fu(logical)33
|
||||
b(AND)150 2309 y Ft(||)384 b Fu(logical)33 b(OR)150 2492
|
||||
y Ft(expr)c(?)h(if-true-expr)d(:)j(if-false-expr)630
|
||||
2601 y Fu(conditional)i(op)s(erator)150 2784 y Ft(=)e(*=)g(/=)g(\045=)f
|
||||
(+=)h(-=)g(<<=)f(>>=)h(&=)g(^=)f(|=)630 2894 y Fu(assignmen)m(t)150
|
||||
3076 y Ft(expr1)g(,)h(expr2)630 3186 y Fu(comma)275 3380
|
||||
b(Bash)30 b(F)-8 b(eatures)2439 b(102)150 299 y Ft(++)p
|
||||
Fj(id)29 b Ft(--)p Fj(id)67 b Fu(v)-5 b(ariable)31 b(pre-incremen)m(t)g
|
||||
(and)f(pre-decremen)m(t)150 463 y Ft(-)g(+)354 b Fu(unary)29
|
||||
b(min)m(us)h(and)g(plus)150 627 y Ft(!)g(~)354 b Fu(logical)33
|
||||
b(and)d(bit)m(wise)h(negation)150 791 y Ft(**)384 b Fu(exp)s(onen)m
|
||||
(tiation)150 955 y Ft(*)30 b(/)g(\045)276 b Fu(m)m(ultiplication,)33
|
||||
b(division,)d(remainder)150 1119 y Ft(+)g(-)354 b Fu(addition,)31
|
||||
b(subtraction)150 1283 y Ft(<<)f(>>)258 b Fu(left)31
|
||||
b(and)f(righ)m(t)h(bit)m(wise)g(shifts)150 1447 y Ft(<=)f(>=)g(<)g(>)
|
||||
102 b Fu(comparison)150 1611 y Ft(==)30 b(!=)258 b Fu(equalit)m(y)32
|
||||
b(and)e(inequalit)m(y)150 1775 y Ft(&)432 b Fu(bit)m(wise)31
|
||||
b(AND)150 1939 y Ft(^)432 b Fu(bit)m(wise)31 b(exclusiv)m(e)h(OR)150
|
||||
2103 y Ft(|)432 b Fu(bit)m(wise)31 b(OR)150 2267 y Ft(&&)384
|
||||
b Fu(logical)33 b(AND)150 2431 y Ft(||)384 b Fu(logical)33
|
||||
b(OR)150 2595 y Ft(expr)c(?)h(if-true-expr)d(:)j(if-false-expr)630
|
||||
2704 y Fu(conditional)i(op)s(erator)150 2868 y Ft(=)e(*=)g(/=)g(\045=)f
|
||||
(+=)h(-=)g(<<=)f(>>=)h(&=)g(^=)f(|=)630 2978 y Fu(assignmen)m(t)150
|
||||
3142 y Ft(expr1)g(,)h(expr2)630 3252 y Fu(comma)275 3418
|
||||
y(Shell)38 b(v)-5 b(ariables)39 b(are)g(allo)m(w)m(ed)i(as)e(op)s
|
||||
(erands;)i(parameter)e(expansion)g(is)f(p)s(erformed)g(b)s(efore)g(the)
|
||||
150 3490 y(expression)g(is)g(ev)-5 b(aluated.)66 b(Within)38
|
||||
150 3528 y(expression)g(is)g(ev)-5 b(aluated.)66 b(Within)38
|
||||
b(an)h(expression,)h(shell)e(v)-5 b(ariables)39 b(ma)m(y)g(also)g(b)s
|
||||
(e)f(referenced)g(b)m(y)150 3600 y(name)31 b(without)f(using)g(the)h
|
||||
(e)f(referenced)g(b)m(y)150 3637 y(name)31 b(without)f(using)g(the)h
|
||||
(parameter)g(expansion)f(syn)m(tax.)42 b(A)31 b(shell)f(v)-5
|
||||
b(ariable)32 b(that)f(is)f(n)m(ull)h(or)f(unset)150 3709
|
||||
b(ariable)32 b(that)f(is)f(n)m(ull)h(or)f(unset)150 3747
|
||||
y(ev)-5 b(aluates)41 b(to)f(0)g(when)e(referenced)h(b)m(y)g(name)h
|
||||
(without)f(using)g(the)g(parameter)h(expansion)f(syn)m(tax.)150
|
||||
3819 y(The)c(v)-5 b(alue)37 b(of)f(a)h(v)-5 b(ariable)36
|
||||
3856 y(The)c(v)-5 b(alue)37 b(of)f(a)h(v)-5 b(ariable)36
|
||||
b(is)g(ev)-5 b(aluated)38 b(as)e(an)g(arithmetic)h(expression)f(when)f
|
||||
(it)h(is)g(referenced,)i(or)150 3928 y(when)27 b(a)h(v)-5
|
||||
(it)h(is)g(referenced,)i(or)150 3966 y(when)27 b(a)h(v)-5
|
||||
b(ariable)29 b(whic)m(h)e(has)h(b)s(een)f(giv)m(en)i(the)f
|
||||
Ft(integer)e Fu(attribute)i(using)g(`)p Ft(declare)g(-i)p
|
||||
Fu(')g(is)g(assigned)150 4038 y(a)33 b(v)-5 b(alue.)49
|
||||
Fu(')g(is)g(assigned)150 4075 y(a)33 b(v)-5 b(alue.)49
|
||||
b(A)33 b(n)m(ull)g(v)-5 b(alue)34 b(ev)-5 b(aluates)34
|
||||
b(to)g(0.)49 b(A)33 b(shell)g(v)-5 b(ariable)34 b(need)e(not)i(ha)m(v)m
|
||||
(e)g(its)f Ft(integer)e Fu(attribute)150 4148 y(turned)e(on)h(to)i(b)s
|
||||
(e)d(used)h(in)g(an)g(expression.)275 4305 y(In)m(teger)41
|
||||
(e)g(its)f Ft(integer)e Fu(attribute)150 4185 y(turned)e(on)h(to)i(b)s
|
||||
(e)d(used)h(in)g(an)g(expression.)275 4324 y(In)m(teger)41
|
||||
b(constan)m(ts)g(follo)m(w)h(the)e(C)g(language)i(de\014nition,)g
|
||||
(without)f(su\016xes)e(or)h(c)m(haracter)i(con-)150 4415
|
||||
(without)f(su\016xes)e(or)h(c)m(haracter)i(con-)150 4434
|
||||
y(stan)m(ts.)f(Constan)m(ts)31 b(with)f(a)g(leading)h(0)f(are)h(in)m
|
||||
(terpreted)f(as)g(o)s(ctal)i(n)m(um)m(b)s(ers.)39 b(A)30
|
||||
b(leading)h(`)p Ft(0x)p Fu(')f(or)g(`)p Ft(0X)p Fu(')150
|
||||
4525 y(denotes)g(hexadecimal.)42 b(Otherwise,)30 b(n)m(um)m(b)s(ers)f
|
||||
4543 y(denotes)g(hexadecimal.)42 b(Otherwise,)30 b(n)m(um)m(b)s(ers)f
|
||||
(tak)m(e)i(the)f(form)g([)p Fr(base)5 b Ft(#)p Fu(])p
|
||||
Fr(n)p Fu(,)30 b(where)f(the)i(optional)g Fr(base)150
|
||||
4634 y Fu(is)e(a)h(decimal)g(n)m(um)m(b)s(er)e(b)s(et)m(w)m(een)h(2)h
|
||||
4653 y Fu(is)e(a)h(decimal)g(n)m(um)m(b)s(er)e(b)s(et)m(w)m(een)h(2)h
|
||||
(and)e(64)i(represen)m(ting)g(the)f(arithmetic)i(base,)e(and)g
|
||||
Fr(n)g Fu(is)g(a)g(n)m(um)m(b)s(er)150 4744 y(in)g(that)i(base.)40
|
||||
Fr(n)g Fu(is)g(a)g(n)m(um)m(b)s(er)150 4763 y(in)g(that)i(base.)40
|
||||
b(If)30 b Fr(base)5 b Ft(#)30 b Fu(is)f(omitted,)i(then)f(base)g(10)g
|
||||
(is)g(used.)40 b(When)30 b(sp)s(ecifying)f Fr(n)p Fu(,)h(if)f(a)i
|
||||
(non-digit)f(is)150 4853 y(required,)k(the)g(digits)h(greater)g(than)e
|
||||
(non-digit)f(is)150 4872 y(required,)k(the)g(digits)h(greater)g(than)e
|
||||
(9)i(are)f(represen)m(ted)g(b)m(y)f(the)h(lo)m(w)m(ercase)j(letters,)f
|
||||
(the)e(upp)s(ercase)150 4963 y(letters,)26 b(`)p Ft(@)p
|
||||
(the)e(upp)s(ercase)150 4982 y(letters,)26 b(`)p Ft(@)p
|
||||
Fu(',)g(and)d(`)p Ft(_)p Fu(',)i(in)e(that)i(order.)38
|
||||
b(If)23 b Fr(base)29 b Fu(is)23 b(less)h(than)g(or)f(equal)h(to)h(36,)h
|
||||
(lo)m(w)m(ercase)g(and)d(upp)s(ercase)150 5073 y(letters)32
|
||||
(lo)m(w)m(ercase)g(and)d(upp)s(ercase)150 5091 y(letters)32
|
||||
b(ma)m(y)f(b)s(e)e(used)h(in)m(terc)m(hangeably)i(to)f(represen)m(t)g
|
||||
(n)m(um)m(b)s(ers)e(b)s(et)m(w)m(een)i(10)g(and)f(35.)275
|
||||
5230 y(Op)s(erators)44 b(are)h(ev)-5 b(aluated)46 b(in)f(order)f(of)h
|
||||
@@ -15754,108 +15761,110 @@ y(The)j(`)p Ft(+=)p Fu(')g(op)s(erator)h(will)g(app)s(end)e(to)i(an)g
|
||||
([Shell)e(P)m(arameters],)i(page)g(21,)f(ab)s(o)m(v)m(e.)275
|
||||
5011 y(An)m(y)d(elemen)m(t)h(of)g(an)f(arra)m(y)g(ma)m(y)h(b)s(e)f
|
||||
(referenced)g(using)g Ft(${)p Fj(name)p Ft([)p Fj(subscript)p
|
||||
Ft(]})p Fu(.)35 b(The)27 b(braces)i(are)150 5121 y(required)f(to)j(a)m
|
||||
(v)m(oid)f(con\015icts)g(with)f(the)h(shell's)f(\014lename)h(expansion)
|
||||
f(op)s(erators.)41 b(If)28 b(the)i Fr(subscript)g Fu(is)150
|
||||
5230 y(`)p Ft(@)p Fu(')f(or)h(`)p Ft(*)p Fu(',)f(the)h(w)m(ord)f
|
||||
(expands)f(to)i(all)g(mem)m(b)s(ers)e(of)i(the)f(arra)m(y)h
|
||||
Fr(name)p Fu(.)40 b(These)29 b(subscripts)f(di\013er)h(only)150
|
||||
5340 y(when)36 b(the)g(w)m(ord)g(app)s(ears)g(within)g(double)g
|
||||
(quotes.)60 b(If)36 b(the)h(w)m(ord)f(is)g(double-quoted,)j
|
||||
Ft(${)p Fj(name)p Ft([*]})p eop end
|
||||
Ft(]})p Fu(.)35 b(The)27 b(braces)i(are)150 5121 y(required)35
|
||||
b(to)i(a)m(v)m(oid)g(con\015icts)g(with)f(the)g(shell's)g(\014lename)g
|
||||
(expansion)g(op)s(erators.)58 b(If)35 b(the)h Fr(subscript)150
|
||||
5230 y Fu(is)g(`)p Ft(@)p Fu(')h(or)f(`)p Ft(*)p Fu(',)i(the)f(w)m(ord)
|
||||
f(expands)f(to)j(all)f(mem)m(b)s(ers)e(of)i(the)f(arra)m(y)h
|
||||
Fr(name)p Fu(,)h(unless)e(otherwise)h(noted)150 5340
|
||||
y(in)g(the)h(description)g(of)g(a)g(builtin)g(or)f(w)m(ord)h
|
||||
(expansion.)63 b(These)37 b(subscripts)g(di\013er)g(only)h(when)f(the)p
|
||||
eop end
|
||||
%%Page: 105 111
|
||||
TeXDict begin 105 110 bop 150 -116 a Fu(Chapter)30 b(6:)41
|
||||
b(Bash)30 b(F)-8 b(eatures)2439 b(105)150 299 y(expands)25
|
||||
b(to)h(a)g(single)h(w)m(ord)e(with)g(the)h(v)-5 b(alue)26
|
||||
b(of)g(eac)m(h)h(arra)m(y)f(mem)m(b)s(er)f(separated)h(b)m(y)g(the)f
|
||||
(\014rst)g(c)m(harac-)150 408 y(ter)j(of)g(the)h Ft(IFS)e
|
||||
Fu(v)-5 b(ariable,)29 b(and)f Ft(${)p Fj(name)p Ft([@]})d
|
||||
Fu(expands)i(eac)m(h)i(elemen)m(t)h(of)e Fr(name)33 b
|
||||
Fu(to)c(a)f(separate)h(w)m(ord.)150 518 y(When)j(there)h(are)f(no)g
|
||||
(arra)m(y)h(mem)m(b)s(ers,)f Ft(${)p Fj(name)p Ft([@]})e
|
||||
Fu(expands)h(to)i(nothing.)47 b(If)31 b(the)i(double-quoted)150
|
||||
628 y(expansion)39 b(o)s(ccurs)h(within)f(a)h(w)m(ord,)i(the)d
|
||||
(expansion)h(of)g(the)f(\014rst)g(parameter)h(is)g(joined)f(with)h(the)
|
||||
150 737 y(b)s(eginning)29 b(part)g(of)h(the)f(original)i(w)m(ord,)e
|
||||
(and)g(the)h(expansion)f(of)h(the)f(last)i(parameter)e(is)h(joined)f
|
||||
(with)150 847 y(the)g(last)h(part)f(of)g(the)g(original)h(w)m(ord.)40
|
||||
b(This)28 b(is)h(analogous)h(to)f(the)h(expansion)e(of)h(the)g(sp)s
|
||||
(ecial)h(param-)150 956 y(eters)g(`)p Ft(@)p Fu(')f(and)g(`)p
|
||||
Ft(*)p Fu('.)41 b Ft(${#)p Fj(name)p Ft([)p Fj(subscript)p
|
||||
Ft(]})24 b Fu(expands)k(to)i(the)g(length)g(of)f Ft(${)p
|
||||
Fj(name)p Ft([)p Fj(subscript)p Ft(]})p Fu(.)35 b(If)150
|
||||
1066 y Fr(subscript)28 b Fu(is)g(`)p Ft(@)p Fu(')f(or)h(`)p
|
||||
Ft(*)p Fu(',)g(the)g(expansion)f(is)g(the)h(n)m(um)m(b)s(er)e(of)i
|
||||
(elemen)m(ts)g(in)f(the)h(arra)m(y)-8 b(.)41 b(If)27
|
||||
b(the)g Fr(subscript)150 1176 y Fu(used)34 b(to)h(reference)g(an)f
|
||||
(elemen)m(t)i(of)f(an)f(indexed)g(arra)m(y)h(ev)-5 b(aluates)36
|
||||
b(to)f(a)g(n)m(um)m(b)s(er)e(less)i(than)f(zero,)i(it)150
|
||||
1285 y(is)c(in)m(terpreted)h(as)f(relativ)m(e)i(to)f(one)f(greater)h
|
||||
(than)f(the)h(maxim)m(um)f(index)f(of)h(the)h(arra)m(y)-8
|
||||
b(,)33 b(so)g(negativ)m(e)150 1395 y(indices)d(coun)m(t)h(bac)m(k)h
|
||||
(from)e(the)g(end)g(of)g(the)h(arra)m(y)-8 b(,)31 b(and)f(an)g(index)g
|
||||
(of)h(-1)g(refers)f(to)h(the)g(last)g(elemen)m(t.)275
|
||||
1544 y(Referencing)41 b(an)f(arra)m(y)h(v)-5 b(ariable)42
|
||||
b(Bash)30 b(F)-8 b(eatures)2439 b(105)150 299 y(w)m(ord)25
|
||||
b(app)s(ears)g(within)g(double)h(quotes.)39 b(If)26 b(the)f(w)m(ord)h
|
||||
(is)f(double-quoted,)i Ft(${)p Fj(name)p Ft([*]})c Fu(expands)i(to)i(a)
|
||||
150 408 y(single)h(w)m(ord)f(with)f(the)i(v)-5 b(alue)27
|
||||
b(of)h(eac)m(h)g(arra)m(y)g(mem)m(b)s(er)e(separated)i(b)m(y)f(the)g
|
||||
(\014rst)f(c)m(haracter)j(of)e(the)h Ft(IFS)150 518 y
|
||||
Fu(v)-5 b(ariable,)34 b(and)e Ft(${)p Fj(name)p Ft([@]})e
|
||||
Fu(expands)h(eac)m(h)j(elemen)m(t)g(of)f Fr(name)k Fu(to)c(a)g
|
||||
(separate)h(w)m(ord.)46 b(When)33 b(there)150 628 y(are)39
|
||||
b(no)f(arra)m(y)g(mem)m(b)s(ers,)i Ft(${)p Fj(name)p
|
||||
Ft([@]})35 b Fu(expands)i(to)i(nothing.)64 b(If)38 b(the)g
|
||||
(double-quoted)g(expansion)150 737 y(o)s(ccurs)26 b(within)g(a)g(w)m
|
||||
(ord,)h(the)g(expansion)f(of)h(the)f(\014rst)g(parameter)g(is)h(joined)
|
||||
f(with)g(the)g(b)s(eginning)g(part)150 847 y(of)j(the)g(original)g(w)m
|
||||
(ord,)g(and)f(the)h(expansion)f(of)h(the)g(last)h(parameter)f(is)f
|
||||
(joined)h(with)f(the)h(last)g(part)g(of)150 956 y(the)h(original)h(w)m
|
||||
(ord.)40 b(This)29 b(is)h(analogous)h(to)f(the)g(expansion)f(of)h(the)g
|
||||
(sp)s(ecial)h(parameters)f(`)p Ft(@)p Fu(')f(and)h(`)p
|
||||
Ft(*)p Fu('.)150 1066 y Ft(${#)p Fj(name)p Ft([)p Fj(subscript)p
|
||||
Ft(]})21 b Fu(expands)k(to)h(the)g(length)h(of)f Ft(${)p
|
||||
Fj(name)p Ft([)p Fj(subscript)p Ft(]})p Fu(.)34 b(If)25
|
||||
b Fr(subscript)i Fu(is)f(`)p Ft(@)p Fu(')g(or)150 1176
|
||||
y(`)p Ft(*)p Fu(',)j(the)g(expansion)g(is)g(the)g(n)m(um)m(b)s(er)e(of)
|
||||
i(elemen)m(ts)h(in)e(the)h(arra)m(y)-8 b(.)41 b(If)29
|
||||
b(the)g Fr(subscript)g Fu(used)f(to)h(reference)150 1285
|
||||
y(an)36 b(elemen)m(t)i(of)e(an)h(indexed)e(arra)m(y)i(ev)-5
|
||||
b(aluates)38 b(to)f(a)g(n)m(um)m(b)s(er)e(less)h(than)g(zero,)j(it)e
|
||||
(is)f(in)m(terpreted)h(as)150 1395 y(relativ)m(e)28 b(to)f(one)f
|
||||
(greater)i(than)d(the)i(maxim)m(um)f(index)f(of)h(the)h(arra)m(y)-8
|
||||
b(,)28 b(so)e(negativ)m(e)i(indices)e(coun)m(t)h(bac)m(k)150
|
||||
1504 y(from)j(the)g(end)g(of)h(the)f(arra)m(y)-8 b(,)32
|
||||
b(and)e(an)g(index)g(of)g(-1)h(refers)f(to)h(the)g(last)g(elemen)m(t.)
|
||||
275 1639 y(Referencing)41 b(an)f(arra)m(y)h(v)-5 b(ariable)42
|
||||
b(without)e(a)h(subscript)e(is)i(equiv)-5 b(alen)m(t)42
|
||||
b(to)f(referencing)g(with)g(a)150 1653 y(subscript)34
|
||||
b(to)f(referencing)g(with)g(a)150 1748 y(subscript)34
|
||||
b(of)i(0.)57 b(An)m(y)35 b(reference)h(to)g(a)g(v)-5
|
||||
b(ariable)37 b(using)e(a)g(v)-5 b(alid)36 b(subscript)f(is)g(legal,)k
|
||||
(and)c(Bash)h(will)150 1763 y(create)c(an)e(arra)m(y)h(if)f(necessary)
|
||||
-8 b(.)275 1912 y(An)35 b(arra)m(y)i(v)-5 b(ariable)37
|
||||
(and)c(Bash)h(will)150 1858 y(create)c(an)e(arra)m(y)h(if)f(necessary)
|
||||
-8 b(.)275 1992 y(An)35 b(arra)m(y)i(v)-5 b(ariable)37
|
||||
b(is)g(considered)f(set)h(if)f(a)h(subscript)e(has)h(b)s(een)g
|
||||
(assigned)g(a)h(v)-5 b(alue.)59 b(The)36 b(n)m(ull)150
|
||||
2021 y(string)30 b(is)h(a)g(v)-5 b(alid)30 b(v)-5 b(alue.)275
|
||||
2170 y(It)29 b(is)h(p)s(ossible)f(to)h(obtain)g(the)f(k)m(eys)i
|
||||
2102 y(string)30 b(is)h(a)g(v)-5 b(alid)30 b(v)-5 b(alue.)275
|
||||
2236 y(It)29 b(is)h(p)s(ossible)f(to)h(obtain)g(the)f(k)m(eys)i
|
||||
(\(indices\))f(of)f(an)h(arra)m(y)g(as)f(w)m(ell)i(as)f(the)f(v)-5
|
||||
b(alues.)41 b($)p Fi({)p Fu(!)p Fr(name)5 b Fu([@])p
|
||||
Fi(})150 2280 y Fu(and)39 b($)p Fi({)p Fu(!)p Fr(name)5
|
||||
Fi(})150 2346 y Fu(and)39 b($)p Fi({)p Fu(!)p Fr(name)5
|
||||
b Fu([*])p Fi(})43 b Fu(expand)c(to)i(the)f(indices)h(assigned)f(in)g
|
||||
(arra)m(y)g(v)-5 b(ariable)41 b Fr(name)p Fu(.)70 b(The)39
|
||||
b(treatmen)m(t)150 2389 y(when)i(in)g(double)g(quotes)h(is)f(similar)h
|
||||
b(treatmen)m(t)150 2455 y(when)i(in)g(double)g(quotes)h(is)f(similar)h
|
||||
(to)h(the)e(expansion)h(of)f(the)h(sp)s(ecial)g(parameters)g(`)p
|
||||
Ft(@)p Fu(')g(and)f(`)p Ft(*)p Fu(')150 2499 y(within)30
|
||||
b(double)g(quotes.)275 2648 y(The)25 b Ft(unset)g Fu(builtin)g(is)h
|
||||
Ft(@)p Fu(')g(and)f(`)p Ft(*)p Fu(')150 2565 y(within)30
|
||||
b(double)g(quotes.)275 2699 y(The)25 b Ft(unset)g Fu(builtin)g(is)h
|
||||
(used)f(to)i(destro)m(y)f(arra)m(ys.)40 b Ft(unset)29
|
||||
b Fj(name)p Ft([)p Fj(subscript)p Ft(])22 b Fu(destro)m(ys)k(the)g
|
||||
(arra)m(y)150 2757 y(elemen)m(t)40 b(at)e(index)g Fr(subscript)p
|
||||
(arra)m(y)150 2809 y(elemen)m(t)40 b(at)e(index)g Fr(subscript)p
|
||||
Fu(.)62 b(Negativ)m(e)41 b(subscripts)c(to)i(indexed)e(arra)m(ys)i(are)
|
||||
f(in)m(terpreted)h(as)f(de-)150 2867 y(scrib)s(ed)30
|
||||
f(in)m(terpreted)h(as)f(de-)150 2918 y(scrib)s(ed)30
|
||||
b(ab)s(o)m(v)m(e.)42 b(Unsetting)31 b(the)g(last)g(elemen)m(t)h(of)f
|
||||
(an)g(arra)m(y)g(v)-5 b(ariable)31 b(do)s(es)f(not)h(unset)f(the)h(v)-5
|
||||
b(ariable.)150 2977 y Ft(unset)29 b Fj(name)p Fu(,)39
|
||||
b(ariable.)150 3028 y Ft(unset)29 b Fj(name)p Fu(,)39
|
||||
b(where)e Fr(name)43 b Fu(is)37 b(an)h(arra)m(y)-8 b(,)41
|
||||
b(remo)m(v)m(es)e(the)f(en)m(tire)g(arra)m(y)-8 b(.)64
|
||||
b Ft(unset)29 b Fj(name)p Ft([)p Fj(subscript)p Ft(])150
|
||||
3086 y Fu(b)s(eha)m(v)m(es)h(di\013eren)m(tly)g(dep)s(ending)d(on)j
|
||||
3137 y Fu(b)s(eha)m(v)m(es)h(di\013eren)m(tly)g(dep)s(ending)d(on)j
|
||||
(the)f(arra)m(y)h(t)m(yp)s(e)f(when)g(giv)m(en)h(a)f(subscript)g(of)g
|
||||
(`)p Ft(*)p Fu(')g(or)h(`)p Ft(@)p Fu('.)40 b(When)150
|
||||
3196 y Fr(name)46 b Fu(is)40 b(an)h(asso)s(ciativ)m(e)i(arra)m(y)-8
|
||||
3247 y Fr(name)46 b Fu(is)40 b(an)h(asso)s(ciativ)m(e)i(arra)m(y)-8
|
||||
b(,)44 b(it)d(remo)m(v)m(es)h(the)f(elemen)m(t)h(with)e(k)m(ey)h(`)p
|
||||
Ft(*)p Fu(')g(or)f(`)p Ft(@)p Fu('.)72 b(If)40 b Fr(name)45
|
||||
b Fu(is)c(an)150 3305 y(indexed)30 b(arra)m(y)-8 b(,)31
|
||||
b Fu(is)c(an)150 3357 y(indexed)30 b(arra)m(y)-8 b(,)31
|
||||
b Ft(unset)e Fu(remo)m(v)m(es)j(all)f(of)g(the)f(elemen)m(ts,)i(but)e
|
||||
(do)s(es)g(not)h(remo)m(v)m(e)h(the)e(arra)m(y)h(itself.)275
|
||||
3454 y(When)k(using)g(a)i(v)-5 b(ariable)36 b(name)g(with)g(a)g
|
||||
3491 y(When)k(using)g(a)i(v)-5 b(ariable)36 b(name)g(with)g(a)g
|
||||
(subscript)e(as)i(an)g(argumen)m(t)g(to)h(a)f(command,)h(suc)m(h)f(as)
|
||||
150 3564 y(with)k Ft(unset)p Fu(,)h(without)e(using)h(the)g(w)m(ord)f
|
||||
150 3600 y(with)k Ft(unset)p Fu(,)h(without)e(using)h(the)g(w)m(ord)f
|
||||
(expansion)h(syn)m(tax)g(describ)s(ed)f(ab)s(o)m(v)m(e,)44
|
||||
b(the)c(argumen)m(t)g(is)150 3673 y(sub)5 b(ject)25 b(to)h(the)g
|
||||
b(the)c(argumen)m(t)g(is)150 3710 y(sub)5 b(ject)25 b(to)h(the)g
|
||||
(shell's)g(\014lename)f(expansion.)39 b(If)25 b(\014lename)h(expansion)
|
||||
f(is)g(not)h(desired,)g(the)f(argumen)m(t)150 3783 y(should)k(b)s(e)h
|
||||
(quoted.)275 3932 y(The)20 b Ft(declare)p Fu(,)h Ft(local)p
|
||||
f(is)g(not)h(desired,)g(the)f(argumen)m(t)150 3820 y(should)k(b)s(e)h
|
||||
(quoted.)275 3954 y(The)20 b Ft(declare)p Fu(,)h Ft(local)p
|
||||
Fu(,)h(and)e Ft(readonly)f Fu(builtins)h(eac)m(h)i(accept)g(a)g
|
||||
Ft(-a)e Fu(option)h(to)h(sp)s(ecify)f(an)f(indexed)150
|
||||
4042 y(arra)m(y)28 b(and)f(a)h Ft(-A)e Fu(option)i(to)g(sp)s(ecify)f
|
||||
4064 y(arra)m(y)28 b(and)f(a)h Ft(-A)e Fu(option)i(to)g(sp)s(ecify)f
|
||||
(an)h(asso)s(ciativ)m(e)i(arra)m(y)-8 b(.)40 b(If)27
|
||||
b(b)s(oth)g(options)h(are)g(supplied,)f Ft(-A)f Fu(tak)m(es)150
|
||||
4151 y(precedence.)55 b(The)35 b Ft(read)f Fu(builtin)h(accepts)h(a)g
|
||||
4173 y(precedence.)55 b(The)35 b Ft(read)f Fu(builtin)h(accepts)h(a)g
|
||||
Ft(-a)e Fu(option)i(to)g(assign)f(a)g(list)h(of)f(w)m(ords)g(read)g
|
||||
(from)g(the)150 4261 y(standard)h(input)g(to)i(an)f(arra)m(y)-8
|
||||
(from)g(the)150 4283 y(standard)h(input)g(to)i(an)f(arra)m(y)-8
|
||||
b(,)40 b(and)c(can)h(read)g(v)-5 b(alues)38 b(from)e(the)h(standard)g
|
||||
(input)f(in)m(to)i(individual)150 4370 y(arra)m(y)f(elemen)m(ts.)62
|
||||
(input)f(in)m(to)i(individual)150 4392 y(arra)m(y)f(elemen)m(ts.)62
|
||||
b(The)36 b Ft(set)g Fu(and)h Ft(declare)d Fu(builtins)j(displa)m(y)g
|
||||
(arra)m(y)g(v)-5 b(alues)37 b(in)g(a)g(w)m(a)m(y)h(that)g(allo)m(ws)150
|
||||
4480 y(them)30 b(to)h(b)s(e)f(reused)g(as)g(input.)150
|
||||
4502 y(them)30 b(to)h(b)s(e)f(reused)g(as)g(input.)150
|
||||
4742 y Fs(6.8)68 b(The)45 b(Directory)g(Stac)l(k)150
|
||||
4902 y Fu(The)21 b(directory)h(stac)m(k)h(is)e(a)h(list)g(of)f(recen)m
|
||||
(tly-visited)j(directories.)39 b(The)20 b Ft(pushd)g
|
||||
|
||||
+2354
-2297
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,6 +1,6 @@
|
||||
%!PS-Adobe-3.0
|
||||
%%Creator: groff version 1.22.4
|
||||
%%CreationDate: Fri Jun 16 12:13:33 2023
|
||||
%%CreationDate: Sun Sep 10 17:14:43 2023
|
||||
%%DocumentNeededResources: font Times-Roman
|
||||
%%+ font Times-Bold
|
||||
%%DocumentSuppliedResources: procset grops 1.22 4
|
||||
|
||||
@@ -126,7 +126,7 @@ finfo_main(int argc, char **argv)
|
||||
case 'p': flags |= OPT_PERM; break;
|
||||
case 'P':
|
||||
flags |= OPT_PMASK;
|
||||
pmask = octal(sh_optarg);
|
||||
pmask = read_octal(sh_optarg);
|
||||
if (pmask < 0) {
|
||||
builtin_error ("invalid mode: %s", sh_optarg);
|
||||
return(1);
|
||||
|
||||
@@ -561,4 +561,25 @@ extern int locale_utf8locale; /* XXX */
|
||||
goto add_string
|
||||
|
||||
#endif /* HANDLE_MULTIBYTE */
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
static inline size_t
|
||||
mbcharlen(char *s, size_t maxlen)
|
||||
{
|
||||
size_t l;
|
||||
DECLARE_MBSTATE;
|
||||
|
||||
if (maxlen == 1 || is_basic (*s))
|
||||
return 1;
|
||||
else if (locale_utf8locale && UTF8_SINGLEBYTE (*s))
|
||||
return (*s != 0);
|
||||
else
|
||||
l = mbrlen (s, maxlen, &state);
|
||||
if (MB_INVALIDCH (l))
|
||||
return (1);
|
||||
return l;
|
||||
}
|
||||
#else
|
||||
#define mbcharlen(s, n) (1)
|
||||
#endif /* HANDLE_MULTIBYTE */
|
||||
#endif /* _SH_MBUTIL_H_ */
|
||||
|
||||
@@ -717,8 +717,11 @@ stop_pipeline (int async, COMMAND *deferred)
|
||||
* in the background.
|
||||
*
|
||||
*/
|
||||
/* 09/08/2023 - rely on child processes to set the terminal pgrp */
|
||||
#if 0
|
||||
if (job_control && newjob->pgrp && (subshell_environment&SUBSHELL_ASYNC) == 0 && running_in_background == 0)
|
||||
maybe_give_terminal_to (shell_pgrp, newjob->pgrp, 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-8
@@ -1,6 +1,6 @@
|
||||
/* fmtulong.c -- Convert unsigned long int to string. */
|
||||
|
||||
/* Copyright (C) 1998-2011 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1998-2011,2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -57,13 +57,9 @@ extern int errno;
|
||||
#define x_digs "0123456789abcdef"
|
||||
#define X_digs "0123456789ABCDEF"
|
||||
|
||||
/* XXX -- assumes uppercase letters, lowercase letters, and digits are
|
||||
contiguous */
|
||||
#define FMTCHAR(x) \
|
||||
((x) < 10) ? (x) + '0' \
|
||||
: (((x) < 36) ? (x) - 10 + 'a' \
|
||||
: (((x) < 62) ? (x) - 36 + 'A' \
|
||||
: (((x) == 62) ? '@' : '_')))
|
||||
static char * const all_digs = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@_";
|
||||
|
||||
#define FMTCHAR(x) all_digs[(x)]
|
||||
|
||||
#ifndef FL_PREFIX
|
||||
# define FL_PREFIX 0x01 /* add 0x, 0X, or 0 prefix as appropriate */
|
||||
|
||||
@@ -1,274 +0,0 @@
|
||||
#!/bin/sh -
|
||||
#
|
||||
# bashbug - create a bug report and mail it to the bug address
|
||||
#
|
||||
# The bug address depends on the release status of the shell. Versions
|
||||
# with status `devel', `alpha', `beta', or `rc' mail bug reports to
|
||||
# chet@cwru.edu and, optionally, to bash-testers@cwru.edu.
|
||||
# Other versions send mail to bug-bash@gnu.org.
|
||||
#
|
||||
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#
|
||||
# configuration section:
|
||||
# these variables are filled in by the make target in Makefile
|
||||
#
|
||||
MACHINE="!MACHINE!"
|
||||
OS="!OS!"
|
||||
CC="!CC!"
|
||||
CFLAGS="!CFLAGS!"
|
||||
RELEASE="!RELEASE!"
|
||||
PATCHLEVEL="!PATCHLEVEL!"
|
||||
RELSTATUS="!RELSTATUS!"
|
||||
MACHTYPE="!MACHTYPE!"
|
||||
|
||||
PATH=/bin:/usr/bin:/usr/local/bin:$PATH
|
||||
export PATH
|
||||
|
||||
# Check if TMPDIR is set, default to /tmp
|
||||
: ${TMPDIR:=/tmp}
|
||||
|
||||
#Securely create a temporary directory for the temporary files
|
||||
TEMPDIR=$TMPDIR/bbug.$$
|
||||
(umask 077 && mkdir "$TEMPDIR") || {
|
||||
echo "$0: could not create temporary directory" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
TEMPFILE1=$TEMPDIR/bbug1
|
||||
TEMPFILE2=$TEMPDIR/bbug2
|
||||
|
||||
USAGE="Usage: $0 [--help] [--version] [bug-report-email-address]"
|
||||
VERSTR="GNU bashbug, version ${RELEASE}.${PATCHLEVEL}-${RELSTATUS}"
|
||||
|
||||
do_help= do_version=
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--help) shift ; do_help=y ;;
|
||||
--version) shift ; do_version=y ;;
|
||||
--) shift ; break ;;
|
||||
-*) echo "bashbug: ${1}: invalid option" >&2
|
||||
echo "$USAGE" >&2
|
||||
exit 2 ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -n "$do_version" ]; then
|
||||
echo "${VERSTR}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -n "$do_help" ]; then
|
||||
echo "${VERSTR}"
|
||||
echo "${USAGE}"
|
||||
echo
|
||||
cat << HERE_EOF
|
||||
Bashbug is used to send mail to the Bash maintainers
|
||||
for when Bash doesn't behave like you'd like, or expect.
|
||||
|
||||
Bashbug will start up your editor (as defined by the shell's
|
||||
EDITOR environment variable) with a preformatted bug report
|
||||
template for you to fill in. The report will be mailed to the
|
||||
bug-bash mailing list by default. See the manual for details.
|
||||
|
||||
If you invoke bashbug by accident, just quit your editor without
|
||||
saving any changes to the template, and no bug report will be sent.
|
||||
HERE_EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Figure out how to echo a string without a trailing newline
|
||||
N=`echo 'hi there\c'`
|
||||
case "$N" in
|
||||
*c) n=-n c= ;;
|
||||
*) n= c='\c' ;;
|
||||
esac
|
||||
|
||||
BASHTESTERS="bash-testers@cwru.edu"
|
||||
|
||||
case "$RELSTATUS" in
|
||||
alpha*|beta*|devel*|rc*) BUGBASH=chet@cwru.edu ;;
|
||||
*) BUGBASH=bug-bash@gnu.org ;;
|
||||
esac
|
||||
|
||||
case "$RELSTATUS" in
|
||||
alpha*|beta*|devel*|rc*)
|
||||
echo "$0: This is a testing release. Would you like your bug report"
|
||||
echo "$0: to be sent to the bash-testers mailing list?"
|
||||
echo $n "$0: Send to bash-testers? $c"
|
||||
read ans
|
||||
case "$ans" in
|
||||
y*|Y*) BUGBASH="${BUGBASH},${BASHTESTERS}" ;;
|
||||
esac ;;
|
||||
esac
|
||||
|
||||
BUGADDR="${1-$BUGBASH}"
|
||||
|
||||
if [ -z "$DEFEDITOR" ] && [ -z "$EDITOR" ]; then
|
||||
if [ -x /usr/bin/editor ]; then
|
||||
DEFEDITOR=editor
|
||||
elif [ -x /usr/local/bin/ce ]; then
|
||||
DEFEDITOR=ce
|
||||
elif [ -x /usr/local/bin/emacs ]; then
|
||||
DEFEDITOR=emacs
|
||||
elif [ -x /usr/contrib/bin/emacs ]; then
|
||||
DEFEDITOR=emacs
|
||||
elif [ -x /usr/bin/emacs ]; then
|
||||
DEFEDITOR=emacs
|
||||
elif [ -x /usr/bin/xemacs ]; then
|
||||
DEFEDITOR=xemacs
|
||||
elif [ -x /usr/bin/nano ]; then
|
||||
DEFEDITOR=nano
|
||||
elif [ -x /usr/contrib/bin/jove ]; then
|
||||
DEFEDITOR=jove
|
||||
elif [ -x /usr/local/bin/jove ]; then
|
||||
DEFEDITOR=jove
|
||||
elif [ -x /usr/bin/vi ]; then
|
||||
DEFEDITOR=vi
|
||||
else
|
||||
echo "$0: No default editor found: attempting to use vi" >&2
|
||||
DEFEDITOR=vi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
: ${EDITOR=$DEFEDITOR}
|
||||
|
||||
: ${USER=${LOGNAME-`whoami`}}
|
||||
|
||||
trap 'rm -rf "$TEMPDIR"; exit 1' 1 2 3 13 15
|
||||
trap 'rm -rf "$TEMPDIR"' 0
|
||||
|
||||
UN=
|
||||
if (uname) >/dev/null 2>&1; then
|
||||
UN=`uname -a`
|
||||
fi
|
||||
|
||||
if [ -f /usr/lib/sendmail ] ; then
|
||||
RMAIL="/usr/lib/sendmail"
|
||||
SMARGS="-i -t"
|
||||
elif [ -f /usr/sbin/sendmail ] ; then
|
||||
RMAIL="/usr/sbin/sendmail"
|
||||
SMARGS="-i -t"
|
||||
else
|
||||
RMAIL=rmail
|
||||
SMARGS="$BUGADDR"
|
||||
fi
|
||||
|
||||
INITIAL_SUBJECT='[50 character or so descriptive subject here (for reference)]'
|
||||
|
||||
cat > "$TEMPFILE1" <<EOF
|
||||
From: ${USER}
|
||||
To: ${BUGADDR}
|
||||
Subject: ${INITIAL_SUBJECT}
|
||||
|
||||
Configuration Information [Automatically generated, do not change]:
|
||||
Machine: $MACHINE
|
||||
OS: $OS
|
||||
Compiler: $CC
|
||||
Compilation CFLAGS: $CFLAGS
|
||||
uname output: $UN
|
||||
Machine Type: $MACHTYPE
|
||||
|
||||
Bash Version: $RELEASE
|
||||
Patch Level: $PATCHLEVEL
|
||||
Release Status: $RELSTATUS
|
||||
|
||||
Description:
|
||||
[Detailed description of the problem, suggestion, or complaint.]
|
||||
|
||||
Repeat-By:
|
||||
[Describe the sequence of events that causes the problem
|
||||
to occur.]
|
||||
|
||||
Fix:
|
||||
[Description of how to fix the problem. If you don't know a
|
||||
fix for the problem, don't include this section.]
|
||||
EOF
|
||||
|
||||
cp "$TEMPFILE1" "$TEMPFILE2"
|
||||
chmod u+w "$TEMPFILE1"
|
||||
|
||||
trap '' 2 # ignore interrupts while in editor
|
||||
|
||||
edstat=1
|
||||
while [ $edstat -ne 0 ]; do
|
||||
$EDITOR "$TEMPFILE1"
|
||||
edstat=$?
|
||||
|
||||
if [ $edstat -ne 0 ]; then
|
||||
echo "$0: editor \`$EDITOR' exited with nonzero status."
|
||||
echo "$0: Perhaps it was interrupted."
|
||||
echo "$0: Type \`y' to give up, and lose your bug report;"
|
||||
echo "$0: type \`n' to re-enter the editor."
|
||||
echo $n "$0: Do you want to give up? $c"
|
||||
|
||||
read ans
|
||||
case "$ans" in
|
||||
[Yy]*) exit 1 ;;
|
||||
esac
|
||||
|
||||
continue
|
||||
fi
|
||||
|
||||
# find the subject from the temp file and see if it's been changed
|
||||
CURR_SUB=`grep '^Subject: ' "$TEMPFILE1" | sed 's|^Subject:[ ]*||' | sed 1q`
|
||||
|
||||
case "$CURR_SUB" in
|
||||
"${INITIAL_SUBJECT}")
|
||||
echo
|
||||
echo "$0: You have not changed the subject from the default."
|
||||
echo "$0: Please use a more descriptive subject header."
|
||||
echo "$0: Type \`y' to give up, and lose your bug report;"
|
||||
echo "$0: type \`n' to re-enter the editor."
|
||||
echo $n "$0: Do you want to give up? $c"
|
||||
|
||||
read ans
|
||||
case "$ans" in
|
||||
[Yy]*) exit 1 ;;
|
||||
esac
|
||||
|
||||
echo "$0: The editor will be restarted in five seconds."
|
||||
sleep 5
|
||||
edstat=1
|
||||
;;
|
||||
esac
|
||||
|
||||
done
|
||||
|
||||
trap 'rm -rf "$TEMPDIR"; exit 1' 2 # restore trap on SIGINT
|
||||
|
||||
if cmp -s "$TEMPFILE1" "$TEMPFILE2"
|
||||
then
|
||||
echo "File not changed, no bug report submitted."
|
||||
exit
|
||||
fi
|
||||
|
||||
echo $n "Send bug report to ${BUGADDR}? [y/n] $c"
|
||||
read ans
|
||||
case "$ans" in
|
||||
[Nn]*) exit 0 ;;
|
||||
esac
|
||||
|
||||
${RMAIL} $SMARGS < "$TEMPFILE1" || {
|
||||
cat "$TEMPFILE1" >> $HOME/dead.bashbug
|
||||
echo "$0: mail to ${BUGADDR} failed: report saved in $HOME/dead.bashbug" >&2
|
||||
echo "$0: please send it manually to ${BUGADDR}" >&2
|
||||
}
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user