mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-27 07:43:07 +02:00
declare builtin changes to reject -i when used with -n; readline changes to make control characters visible in search strings; readline signal handling changes to avoid data corruption and UAF; documentation updates for more consistent quoting
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
# don't push out -i
|
||||
-i
|
||||
tests/-i
|
||||
builtins/-i
|
||||
CWRU/-i
|
||||
CWRU/old-changelogs/-i
|
||||
lib/readline/-i
|
||||
doc/-i
|
||||
|
||||
*.save
|
||||
.DS_Store
|
||||
|
||||
@@ -11650,3 +11650,36 @@ bashline.c
|
||||
Otherwise, it's a prefix and likely doesn't exist, so we'll stick
|
||||
with the default backslash completion quoting style.
|
||||
Fixes completion quoting issue from Aaron Laws <dartme18@gmail.com>
|
||||
|
||||
8/29
|
||||
----
|
||||
builtins/declare.def
|
||||
- declare_invalid_opts: reject attempts to use -n with -i, since you
|
||||
can't have nameref variables referring to positional parameters
|
||||
|
||||
lib/readline/isearch.c
|
||||
- rl_display_search: if the search string contains a control char,
|
||||
display it using the same translation (^C) as in other places
|
||||
Report and patch from Grisha Levit <grishalevit@gmail.com>
|
||||
|
||||
9/4
|
||||
---
|
||||
lib/readline/input.c
|
||||
- rl_getc: add RL_STATE_MOREINPUT to the list of states that cause
|
||||
a received SIGINT to call _rl_abort_internal
|
||||
|
||||
lib/readline/display.c
|
||||
- rl_redisplay: put setting RL_STATE_REDISPLAYING outside the calls
|
||||
to _rl_block_sigint and _rl_release_sigint
|
||||
|
||||
lib/readline/text.c
|
||||
- _rl_readstr_init: set RL_STATE_READSTR before calling rl_message
|
||||
to prompt for the command name so we know we're in readstr if we
|
||||
get a SIGINT
|
||||
|
||||
lib/readline/signals.c
|
||||
- _rl_release_sigint: after calling RL_CHECK_SIGNALS, call _rl_abort_internal
|
||||
if the state indicates that we are in one of the places that can
|
||||
call rl_message. That takes care of the case where redisplay gets a
|
||||
SIGINT while `blocking' it.
|
||||
Report from Grisha Levit <grishalevit@gmail.com>
|
||||
|
||||
+13779
File diff suppressed because it is too large
Load Diff
@@ -252,6 +252,12 @@ declare_invalid_opts (int flags_on, int flags_off)
|
||||
sh_invalidopt ("-a");
|
||||
return (EX_BADUSAGE);
|
||||
}
|
||||
/* Ineffective, since you can't have namerefs referencing positional parameters */
|
||||
else if ((flags_on & att_nameref) && (flags_on & att_integer))
|
||||
{
|
||||
builtin_error ("cannot use -n with -i");
|
||||
return (EX_BADUSAGE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+1210
-1194
File diff suppressed because it is too large
Load Diff
+30
-4
@@ -5,7 +5,7 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\"
|
||||
.\" Last Change: Wed Jul 30 14:47:58 EDT 2025
|
||||
.\" Last Change: Mon Aug 25 11:35:58 EDT 2025
|
||||
.\"
|
||||
.\" For bash_builtins, strip all but "SHELL BUILTIN COMMANDS" section
|
||||
.\" For rbash, strip all but "RESTRICTED SHELL" section
|
||||
@@ -21,7 +21,7 @@
|
||||
.ds zY \" empty
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2025 July 30" "GNU Bash 5.3"
|
||||
.TH BASH 1 "2025 August 25" "GNU Bash 5.3"
|
||||
.\"
|
||||
.ie \n(.g \{\
|
||||
.ds ' \(aq
|
||||
@@ -4938,9 +4938,9 @@ This allows
|
||||
here-documents within shell scripts to be indented in a
|
||||
natural fashion.
|
||||
.PP
|
||||
If the delimiter is not quoted, the
|
||||
If the delimiter is not quoted, the shell treats the
|
||||
.B \e<newline>
|
||||
sequence is treated as a line continuation: the two lines are joined
|
||||
sequence as a line continuation: the two lines are joined
|
||||
and the backslash-newline is removed.
|
||||
This happens while reading the here-document, before the check for
|
||||
the ending delimiter, so joined lines can form the end delimiter.
|
||||
@@ -8368,6 +8368,32 @@ standard output.
|
||||
Backslash will escape a newline, if necessary.
|
||||
These are added to the set of possible completions.
|
||||
.PP
|
||||
External commands that are invoked to generate completions (
|
||||
.Q "external completers" )
|
||||
receive the word preceding the completion word as an argument,
|
||||
as described above.
|
||||
This provides context that is sometimes useful, but may include
|
||||
information that is considered sensitive or part of a word expansion
|
||||
that will not appear in the command line after expansion.
|
||||
That word may be visible in process listings or in audit logs.
|
||||
This may be a concern to users and completion specification authors
|
||||
if there is sensitive information on the command line before
|
||||
expansion, since completion takes place before words are expanded.
|
||||
If this is an issue, completion authors should use functions as
|
||||
wrappers around external commands and pass context information to the
|
||||
external command in a different way.
|
||||
External completers can infer context from the
|
||||
.SM
|
||||
.B COMP_LINE
|
||||
and
|
||||
.SM
|
||||
.B COMP_POINT
|
||||
environment variables, but they need to ensure
|
||||
they break words in the same way \fBreadline\fP does, using the
|
||||
.SM
|
||||
.B COMP_WORDBREAKS
|
||||
variable.
|
||||
.PP
|
||||
After generating all of the possible completions,
|
||||
\fBbash\fP applies any filter
|
||||
specified with the \fB\-X\fP option to the completions in the list.
|
||||
|
||||
+40
-5
@@ -3,7 +3,7 @@
|
||||
</HEAD>
|
||||
<BODY><TABLE WIDTH=100%>
|
||||
<TR>
|
||||
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2025 April 7<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2025 August 25<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
</TR>
|
||||
</TABLE>
|
||||
<BR><A HREF="#index">Index</A>
|
||||
@@ -6785,7 +6785,7 @@ when it is referenced, or when a variable which has been given the
|
||||
<I>integer</I> attribute using <B>declare -i</B> is assigned a value.
|
||||
A null value evaluates to 0.
|
||||
A shell variable need not have its <I>integer</I> attribute
|
||||
turned on to be used in an expression.
|
||||
enabled to be used in an expression.
|
||||
<P>
|
||||
|
||||
Integer constants follow the C language definition, without suffixes or
|
||||
@@ -8770,6 +8770,10 @@ Type
|
||||
|
||||
at a <B>bash</B> prompt to see your current terminal settings,
|
||||
including the special control characters (usually <B>cchars</B>).
|
||||
This binding takes place on each call to <B>readline</B>,
|
||||
so changes made by
|
||||
|
||||
can take effect.
|
||||
<DT><B>blink-matching-paren (Off)</B>
|
||||
|
||||
<DD>
|
||||
@@ -10528,6 +10532,36 @@ Backslash will escape a newline, if necessary.
|
||||
These are added to the set of possible completions.
|
||||
<P>
|
||||
|
||||
External commands that are invoked to generate completions (
|
||||
|
||||
receive the word preceding the completion word as an argument,
|
||||
as described above.
|
||||
This provides context that is sometimes useful, but may include
|
||||
information that is considered sensitive or part of a word expansion
|
||||
that will not appear in the command line after expansion.
|
||||
That word may be visible in process listings or in audit logs.
|
||||
This may be a concern to users and completion specification authors
|
||||
if there is sensitive information on the command line before
|
||||
expansion, since completion takes place before words are expanded.
|
||||
If this is an issue, completion authors should use functions as
|
||||
wrappers around external commands and pass context information to the
|
||||
external command in a different way.
|
||||
External completers can infer context from the
|
||||
<FONT SIZE=-1><B>COMP_LINE</B>
|
||||
|
||||
</FONT>
|
||||
and
|
||||
<FONT SIZE=-1><B>COMP_POINT</B>
|
||||
|
||||
</FONT>
|
||||
environment variables, but they need to ensure
|
||||
they break words in the same way <B>readline</B> does, using the
|
||||
<FONT SIZE=-1><B>COMP_WORDBREAKS</B>
|
||||
|
||||
</FONT>
|
||||
variable.
|
||||
<P>
|
||||
|
||||
After generating all of the possible completions,
|
||||
<B>bash</B> applies any filter
|
||||
specified with the <B>-X</B> option to the completions in the list.
|
||||
@@ -11629,6 +11663,7 @@ if <I>dir</I> is not supplied, the value of the
|
||||
|
||||
</FONT>
|
||||
shell variable is used as <I>dir</I>.
|
||||
If <I>dir</I> is the empty string, <B>cd</B> treats it as an error.
|
||||
The variable
|
||||
<FONT SIZE=-1><B>CDPATH</B>
|
||||
|
||||
@@ -16821,7 +16856,7 @@ Array variables may not (yet) be exported.
|
||||
<HR>
|
||||
<TABLE WIDTH=100%>
|
||||
<TR>
|
||||
<TH ALIGN=LEFT width=33%>GNU Bash 5.3<TH ALIGN=CENTER width=33%>2025 April 7<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
<TH ALIGN=LEFT width=33%>GNU Bash 5.3<TH ALIGN=CENTER width=33%>2025 August 25<TH ALIGN=RIGHT width=33%>BASH(1)
|
||||
</TR>
|
||||
</TABLE>
|
||||
<HR>
|
||||
@@ -16930,7 +16965,7 @@ Array variables may not (yet) be exported.
|
||||
<DT><A HREF="#lbDJ">BUGS</A><DD>
|
||||
</DL>
|
||||
<HR>
|
||||
This document was created by man2html from /usr/local/src/bash/bash-20250502/doc/bash.1.<BR>
|
||||
Time: 04 May 2025 17:25:09 EDT
|
||||
This document was created by man2html from /usr/local/src/bash/bash-20250822/doc/bash.1.<BR>
|
||||
Time: 25 August 2025 11:45:48 EDT
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
+43
-27
@@ -10351,6 +10351,22 @@ of completions, one per line, to the standard output. Backslash will
|
||||
escape a newline, if necessary. These are added to the set of possible
|
||||
completions.
|
||||
|
||||
External commands that are invoked to generate completions ("external
|
||||
completers") receive the word preceding the completion word as an
|
||||
argument, as described above. This provides context that is sometimes
|
||||
useful, but may include information that is considered sensitive or part
|
||||
of a word expansion that will not appear in the command line after
|
||||
expansion. That word may be visible in process listings or in audit
|
||||
logs. This may be a concern to users and completion specification
|
||||
authors if there is sensitive information on the command line before
|
||||
expansion, since completion takes place before words are expanded. If
|
||||
this is an issue, completion authors should use functions as wrappers
|
||||
around external commands and pass context information to the external
|
||||
command in a different way. External completers can infer context from
|
||||
the COMP_LINE and COMP_POINT environment variables, but they need to
|
||||
ensure they break words in the same way Readline does, using the
|
||||
COMP_WORDBREAKS variable.
|
||||
|
||||
After generating all of the possible completions, Bash applies any
|
||||
filter specified with the ‘-X’ option to the completions in the list.
|
||||
The filter is a pattern as used for pathname expansion; a ‘&’ in the
|
||||
@@ -13724,33 +13740,33 @@ Node: Keyboard Macros454096
|
||||
Node: Miscellaneous Commands454797
|
||||
Node: Readline vi Mode461364
|
||||
Node: Programmable Completion462341
|
||||
Node: Programmable Completion Builtins471078
|
||||
Node: A Programmable Completion Example482815
|
||||
Node: Using History Interactively488160
|
||||
Node: Bash History Facilities488841
|
||||
Node: Bash History Builtins492576
|
||||
Node: History Interaction499047
|
||||
Node: Event Designators503997
|
||||
Node: Word Designators505575
|
||||
Node: Modifiers507967
|
||||
Node: Installing Bash509904
|
||||
Node: Basic Installation511020
|
||||
Node: Compilers and Options514896
|
||||
Node: Compiling For Multiple Architectures515646
|
||||
Node: Installation Names517399
|
||||
Node: Specifying the System Type519633
|
||||
Node: Sharing Defaults520379
|
||||
Node: Operation Controls521093
|
||||
Node: Optional Features522112
|
||||
Node: Reporting Bugs534835
|
||||
Node: Major Differences From The Bourne Shell536192
|
||||
Node: GNU Free Documentation License557619
|
||||
Node: Indexes582796
|
||||
Node: Builtin Index583247
|
||||
Node: Reserved Word Index590345
|
||||
Node: Variable Index592790
|
||||
Node: Function Index610203
|
||||
Node: Concept Index624198
|
||||
Node: Programmable Completion Builtins472077
|
||||
Node: A Programmable Completion Example483814
|
||||
Node: Using History Interactively489159
|
||||
Node: Bash History Facilities489840
|
||||
Node: Bash History Builtins493575
|
||||
Node: History Interaction500046
|
||||
Node: Event Designators504996
|
||||
Node: Word Designators506574
|
||||
Node: Modifiers508966
|
||||
Node: Installing Bash510903
|
||||
Node: Basic Installation512019
|
||||
Node: Compilers and Options515895
|
||||
Node: Compiling For Multiple Architectures516645
|
||||
Node: Installation Names518398
|
||||
Node: Specifying the System Type520632
|
||||
Node: Sharing Defaults521378
|
||||
Node: Operation Controls522092
|
||||
Node: Optional Features523111
|
||||
Node: Reporting Bugs535834
|
||||
Node: Major Differences From The Bourne Shell537191
|
||||
Node: GNU Free Documentation License558618
|
||||
Node: Indexes583795
|
||||
Node: Builtin Index584246
|
||||
Node: Reserved Word Index591344
|
||||
Node: Variable Index593789
|
||||
Node: Function Index611202
|
||||
Node: Concept Index625197
|
||||
|
||||
End Tag Table
|
||||
|
||||
|
||||
Binary file not shown.
+1
-1
@@ -56,6 +56,6 @@
|
||||
\entry{suspend}{128}{\code {suspend}}
|
||||
\entry{compgen}{161}{\code {compgen}}
|
||||
\entry{complete}{161}{\code {complete}}
|
||||
\entry{compopt}{164}{\code {compopt}}
|
||||
\entry{compopt}{165}{\code {compopt}}
|
||||
\entry{fc}{169}{\code {fc}}
|
||||
\entry{history}{169}{\code {history}}
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
\entry{\code {command}}{63}
|
||||
\entry{\code {compgen}}{161}
|
||||
\entry{\code {complete}}{161}
|
||||
\entry{\code {compopt}}{164}
|
||||
\entry{\code {compopt}}{165}
|
||||
\entry{\code {continue}}{54}
|
||||
\initial {D}
|
||||
\entry{\code {declare}}{64}
|
||||
|
||||
Binary file not shown.
+44
-13
@@ -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, 18 May 2025).
|
||||
the Bash shell (version 5.3, 7 August 2025).
|
||||
|
||||
This is Edition 5.3, last updated 18 May 2025,
|
||||
This is Edition 5.3, last updated 7 August 2025,
|
||||
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
|
||||
<h1 class="top" id="Bash-Features-1"><span>Bash Features<a class="copiable-link" href="#Bash-Features-1"> ¶</a></span></h1>
|
||||
|
||||
<p>This text is a brief description of the features that are present in
|
||||
the Bash shell (version 5.3, 18 May 2025).
|
||||
the Bash shell (version 5.3, 7 August 2025).
|
||||
The Bash home page is <a class="url" href="http://www.gnu.org/software/bash/">http://www.gnu.org/software/bash/</a>.
|
||||
</p>
|
||||
<p>This is Edition 5.3, last updated 18 May 2025,
|
||||
<p>This is Edition 5.3, last updated 7 August 2025,
|
||||
of <cite class="cite">The GNU Bash Reference Manual</cite>,
|
||||
for <code class="code">Bash</code>, Version 5.3.
|
||||
</p>
|
||||
@@ -4434,7 +4434,7 @@ parameter $? (see <a class="pxref" href="#Special-Parameters">Special Parameters
|
||||
<p>Bash itself returns the exit status of the last command
|
||||
executed, unless a syntax error occurs, in which case it exits
|
||||
with a non-zero value.
|
||||
See also the <code class="code">exit</code> builtin command (see <a class="pxref" href="#Bourne-Shell-Builtins">Bourne Shell Builtins</a>.
|
||||
See also the <code class="code">exit</code> builtin command (see <a class="pxref" href="#Bourne-Shell-Builtins">Bourne Shell Builtins</a>).
|
||||
</p>
|
||||
<hr>
|
||||
</div>
|
||||
@@ -4457,7 +4457,7 @@ If job control is in effect (see <a class="pxref" href="#Job-Control">Job Contro
|
||||
ignores <code class="code">SIGTTIN</code>, <code class="code">SIGTTOU</code>, and <code class="code">SIGTSTP</code>.
|
||||
</p>
|
||||
<p>The <code class="code">trap</code> builtin modifies the shell’s signal handling, as
|
||||
described below (see <a class="pxref" href="#Bourne-Shell-Builtins">Bourne Shell Builtins</a>.
|
||||
described below (see <a class="pxref" href="#Bourne-Shell-Builtins">Bourne Shell Builtins</a>).
|
||||
</p>
|
||||
<p>Non-builtin commands Bash executes have signal handlers set to the
|
||||
values inherited by the shell from its parent,
|
||||
@@ -4758,6 +4758,7 @@ cd -P [-e] [-@] [<var class="var">directory</var>]
|
||||
<p>Change the current working directory to <var class="var">directory</var>.
|
||||
If <var class="var">directory</var> is not supplied, the value of the <code class="env">HOME</code>
|
||||
shell variable is used as <var class="var">directory</var>.
|
||||
If <var class="var">directory</var> is the empty string, <code class="code">cd</code> treats it as an error.
|
||||
If the shell variable
|
||||
<code class="env">CDPATH</code> exists,
|
||||
and <var class="var">directory</var> does not begin with a slash,
|
||||
@@ -7252,7 +7253,7 @@ performing filename expansion.
|
||||
<dt><code class="code">nocasematch</code></dt>
|
||||
<dd><p>If set, Bash matches patterns in a case-insensitive fashion when
|
||||
performing matching while executing <code class="code">case</code> or <code class="code">[[</code>
|
||||
conditional commands (see <a class="pxref" href="#Conditional-Constructs">Conditional Constructs</a>,
|
||||
conditional commands (see <a class="pxref" href="#Conditional-Constructs">Conditional Constructs</a>),
|
||||
when performing pattern substitution word expansions,
|
||||
or when filtering possible completions as part of programmable completion.
|
||||
</p>
|
||||
@@ -8413,7 +8414,7 @@ subsequently reset.
|
||||
<dt><a id="index-READLINE_005fARGUMENT"></a><span><code class="code">READLINE_ARGUMENT</code><a class="copiable-link" href="#index-READLINE_005fARGUMENT"> ¶</a></span></dt>
|
||||
<dd><p>Any numeric argument given to a Readline
|
||||
command that was defined using
|
||||
‘<samp class="samp">bind -x</samp>’ (see <a class="pxref" href="#Bash-Builtins">Bash Builtin Commands</a>
|
||||
‘<samp class="samp">bind -x</samp>’ (see <a class="pxref" href="#Bash-Builtins">Bash Builtin Commands</a>)
|
||||
when it was invoked.
|
||||
</p>
|
||||
</dd>
|
||||
@@ -9465,7 +9466,7 @@ by name in an expression.
|
||||
when it is referenced, or when a variable which has been given the
|
||||
<code class="code">integer</code> attribute using ‘<samp class="samp">declare -i</samp>’ is assigned a value.
|
||||
A null value evaluates to 0.
|
||||
A shell variable need not have its <code class="code">integer</code> attribute turned on
|
||||
A shell variable need not have its <code class="code">integer</code> attribute enabled
|
||||
to be used in an expression.
|
||||
</p>
|
||||
<p>Integer constants follow the C language definition, without suffixes or
|
||||
@@ -10219,7 +10220,7 @@ startup files.
|
||||
|
||||
</li><li> Bash reads and executes the <small class="sc">POSIX</small> startup files
|
||||
(<code class="env">$ENV</code>) rather than
|
||||
the normal Bash files (see <a class="pxref" href="#Bash-Startup-Files">Bash Startup Files</a>.
|
||||
the normal Bash files (see <a class="pxref" href="#Bash-Startup-Files">Bash Startup Files</a>).
|
||||
|
||||
</li><li> Alias expansion is always enabled, even in non-interactive shells.
|
||||
|
||||
@@ -11724,6 +11725,10 @@ Readline equivalents.
|
||||
These override the default Readline bindings described here.
|
||||
Type ‘<samp class="samp">stty -a</samp>’ at a Bash prompt to see your current terminal settings,
|
||||
including the special control characters (usually <code class="code">cchars</code>).
|
||||
This binding takes place on each call to <code class="code">readline()</code>,
|
||||
so changes made by
|
||||
‘<samp class="samp">stty</samp>’
|
||||
can take effect.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><a id="index-blink_002dmatching_002dparen"></a><span><code class="code">blink-matching-paren</code><a class="copiable-link" href="#index-blink_002dmatching_002dparen"> ¶</a></span></dt>
|
||||
@@ -13643,6 +13648,25 @@ the standard output.
|
||||
Backslash will escape a newline, if necessary.
|
||||
These are added to the set of possible completions.
|
||||
</p>
|
||||
<p>External commands that are invoked to generate completions
|
||||
("external completers")
|
||||
receive the word preceding the completion word as an argument,
|
||||
as described above.
|
||||
This provides context that is sometimes useful, but may include
|
||||
information that is considered sensitive or part of a word expansion
|
||||
that will not appear in the command line after expansion.
|
||||
That word may be visible in process listings or in audit logs.
|
||||
This may be a concern to users and completion specification authors
|
||||
if there is sensitive information on the command line before
|
||||
expansion, since completion takes place before words are expanded.
|
||||
If this is an issue, completion authors should use functions as
|
||||
wrappers around external commands and pass context information to the
|
||||
external command in a different way.
|
||||
External completers can infer context from the <var class="var">COMP_LINE</var>
|
||||
and <var class="var">COMP_POINT</var> environment variables, but they need to ensure
|
||||
they break words in the same way Readline does, using the
|
||||
<var class="var">COMP_WORDBREAKS</var> variable.
|
||||
</p>
|
||||
<p>After generating all of the possible completions,
|
||||
Bash applies any filter
|
||||
specified with the <samp class="option">-X</samp> option to the completions in the list.
|
||||
@@ -15266,10 +15290,17 @@ which this should be turned off, and <code class="code">configure</code> disable
|
||||
option automatically for a number of systems.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><code class="code">--with-curses</code></dt>
|
||||
<dd><p>Use the curses library instead of the termcap library.
|
||||
<dt><code class="code">--with-curses[=<var class="var">LIBNAME</var>]</code></dt>
|
||||
<dd><p>Use the curses library instead of the termcap library as the library
|
||||
where the linker can find the termcap functions.
|
||||
<code class="code">configure</code> usually chooses this automatically, since most systems
|
||||
include the termcap functions in the curses library.
|
||||
If <var class="var">LIBNAME</var> is supplied, <code class="code">configure</code> does not search for an
|
||||
appropriate library and uses <var class="var">LIBNAME</var> instead.
|
||||
<var class="var">LIBNAME</var> should be either an argument for the linker
|
||||
(e.g., <samp class="option">-l<var class="var">libname</var></samp>)
|
||||
or a filename
|
||||
(e.g., <samp class="file">/opt/local/lib/libncursesw.so</samp>).
|
||||
</p>
|
||||
</dd>
|
||||
<dt><code class="code">--with-gnu-malloc</code></dt>
|
||||
@@ -15935,7 +15966,7 @@ command, and what the zeroth argument to the command is to be
|
||||
using <code class="code">export -f</code> (see <a class="pxref" href="#Shell-Functions">Shell Functions</a>).
|
||||
|
||||
</li><li>The Bash <code class="code">export</code> and <code class="code">readonly</code> builtins
|
||||
(see <a class="pxref" href="#Bourne-Shell-Builtins">Bourne Shell Builtins</a> can
|
||||
(see <a class="pxref" href="#Bourne-Shell-Builtins">Bourne Shell Builtins</a>) can
|
||||
take a <samp class="option">-f</samp> option to act on shell functions, a <samp class="option">-p</samp> option to
|
||||
display variables with various attributes set in a format that can be
|
||||
used as shell input, a <samp class="option">-n</samp> option to remove various variable
|
||||
|
||||
+43
-27
@@ -10352,6 +10352,22 @@ of completions, one per line, to the standard output. Backslash will
|
||||
escape a newline, if necessary. These are added to the set of possible
|
||||
completions.
|
||||
|
||||
External commands that are invoked to generate completions ("external
|
||||
completers") receive the word preceding the completion word as an
|
||||
argument, as described above. This provides context that is sometimes
|
||||
useful, but may include information that is considered sensitive or part
|
||||
of a word expansion that will not appear in the command line after
|
||||
expansion. That word may be visible in process listings or in audit
|
||||
logs. This may be a concern to users and completion specification
|
||||
authors if there is sensitive information on the command line before
|
||||
expansion, since completion takes place before words are expanded. If
|
||||
this is an issue, completion authors should use functions as wrappers
|
||||
around external commands and pass context information to the external
|
||||
command in a different way. External completers can infer context from
|
||||
the COMP_LINE and COMP_POINT environment variables, but they need to
|
||||
ensure they break words in the same way Readline does, using the
|
||||
COMP_WORDBREAKS variable.
|
||||
|
||||
After generating all of the possible completions, Bash applies any
|
||||
filter specified with the ‘-X’ option to the completions in the list.
|
||||
The filter is a pattern as used for pathname expansion; a ‘&’ in the
|
||||
@@ -13725,33 +13741,33 @@ Node: Keyboard Macros454402
|
||||
Node: Miscellaneous Commands455106
|
||||
Node: Readline vi Mode461676
|
||||
Node: Programmable Completion462656
|
||||
Node: Programmable Completion Builtins471396
|
||||
Node: A Programmable Completion Example483136
|
||||
Node: Using History Interactively488484
|
||||
Node: Bash History Facilities489168
|
||||
Node: Bash History Builtins492906
|
||||
Node: History Interaction499380
|
||||
Node: Event Designators504333
|
||||
Node: Word Designators505914
|
||||
Node: Modifiers508309
|
||||
Node: Installing Bash510249
|
||||
Node: Basic Installation511368
|
||||
Node: Compilers and Options515247
|
||||
Node: Compiling For Multiple Architectures516000
|
||||
Node: Installation Names517756
|
||||
Node: Specifying the System Type519993
|
||||
Node: Sharing Defaults520742
|
||||
Node: Operation Controls521459
|
||||
Node: Optional Features522481
|
||||
Node: Reporting Bugs535207
|
||||
Node: Major Differences From The Bourne Shell536567
|
||||
Node: GNU Free Documentation License557997
|
||||
Node: Indexes583177
|
||||
Node: Builtin Index583631
|
||||
Node: Reserved Word Index590732
|
||||
Node: Variable Index593180
|
||||
Node: Function Index610596
|
||||
Node: Concept Index624594
|
||||
Node: Programmable Completion Builtins472395
|
||||
Node: A Programmable Completion Example484135
|
||||
Node: Using History Interactively489483
|
||||
Node: Bash History Facilities490167
|
||||
Node: Bash History Builtins493905
|
||||
Node: History Interaction500379
|
||||
Node: Event Designators505332
|
||||
Node: Word Designators506913
|
||||
Node: Modifiers509308
|
||||
Node: Installing Bash511248
|
||||
Node: Basic Installation512367
|
||||
Node: Compilers and Options516246
|
||||
Node: Compiling For Multiple Architectures516999
|
||||
Node: Installation Names518755
|
||||
Node: Specifying the System Type520992
|
||||
Node: Sharing Defaults521741
|
||||
Node: Operation Controls522458
|
||||
Node: Optional Features523480
|
||||
Node: Reporting Bugs536206
|
||||
Node: Major Differences From The Bourne Shell537566
|
||||
Node: GNU Free Documentation License558996
|
||||
Node: Indexes584176
|
||||
Node: Builtin Index584630
|
||||
Node: Reserved Word Index591731
|
||||
Node: Variable Index594179
|
||||
Node: Function Index611595
|
||||
Node: Concept Index625593
|
||||
|
||||
End Tag Table
|
||||
|
||||
|
||||
+21
-21
@@ -1,11 +1,11 @@
|
||||
This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024/MacPorts 2024.70613_1) (preloaded format=pdfetex 2024.4.9) 30 MAY 2025 08:52
|
||||
This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024/MacPorts 2024.70613_1) (preloaded format=pdfetex 2024.4.9) 25 AUG 2025 11:45
|
||||
entering extended mode
|
||||
restricted \write18 enabled.
|
||||
file:line:error style messages enabled.
|
||||
%&-line parsing enabled.
|
||||
**\input /usr/local/src/bash/bash-20250529/doc/bashref.texi
|
||||
(/usr/local/src/bash/bash-20250529/doc/bashref.texi
|
||||
(/usr/local/src/bash/bash-20250529/doc/texinfo.tex
|
||||
**\input /usr/local/src/bash/bash-20250822/doc/bashref.texi
|
||||
(/usr/local/src/bash/bash-20250822/doc/bashref.texi
|
||||
(/usr/local/src/bash/bash-20250822/doc/texinfo.tex
|
||||
Loading texinfo [version 2015-11-22.14]:
|
||||
\outerhsize=\dimen16
|
||||
\outervsize=\dimen17
|
||||
@@ -161,15 +161,15 @@ This is `epsf.tex' v2.7.4 <14 February 2011>
|
||||
texinfo.tex: doing @include of version.texi
|
||||
|
||||
|
||||
(/usr/local/src/bash/bash-20250529/doc/version.texi) [1{/opt/local/var/db/texmf
|
||||
(/usr/local/src/bash/bash-20250822/doc/version.texi) [1{/opt/local/var/db/texmf
|
||||
/fonts/map/pdftex/updmap/pdftex.map}] [2]
|
||||
(/usr/local/build/bash/bash-20250529/doc/bashref.toc [-1] [-2] [-3]) [-4]
|
||||
(/usr/local/build/bash/bash-20250529/doc/bashref.toc)
|
||||
(/usr/local/build/bash/bash-20250529/doc/bashref.toc) Chapter 1
|
||||
(/usr/local/build/bash/bash-20250822/doc/bashref.toc [-1] [-2] [-3]) [-4]
|
||||
(/usr/local/build/bash/bash-20250822/doc/bashref.toc)
|
||||
(/usr/local/build/bash/bash-20250822/doc/bashref.toc) Chapter 1
|
||||
\openout0 = `bashref.toc'.
|
||||
|
||||
|
||||
(/usr/local/build/bash/bash-20250529/doc/bashref.aux)
|
||||
(/usr/local/build/bash/bash-20250822/doc/bashref.aux)
|
||||
\openout1 = `bashref.aux'.
|
||||
|
||||
[1] Chapter 2 [2]
|
||||
@@ -231,7 +231,7 @@ exlive/fonts/enc/dvips/cm-super/cm-super-t1.enc}] [21] [22] [23] [24]
|
||||
[52]
|
||||
[53] [54] [55] [56] [57] [58] [59] [60] [61] [62] [63] [64] [65] [66] [67]
|
||||
[68] [69] [70] [71] [72] [73]
|
||||
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5898--5898
|
||||
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5899--5899
|
||||
[]@texttt set [-abefhkmnptuvxBCEHPT] [-o @textttsl option-name@texttt ] [--] [
|
||||
-] [@textttsl ar-gu-ment []@texttt ][]
|
||||
|
||||
@@ -244,7 +244,7 @@ Overfull \hbox (38.26585pt too wide) in paragraph at lines 5898--5898
|
||||
.etc.
|
||||
|
||||
|
||||
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5899--5899
|
||||
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5900--5900
|
||||
[]@texttt set [+abefhkmnptuvxBCEHPT] [+o @textttsl option-name@texttt ] [--] [
|
||||
-] [@textttsl ar-gu-ment []@texttt ][]
|
||||
|
||||
@@ -264,9 +264,9 @@ Chapter 7 [124] [125] [126] [127] [128]
|
||||
texinfo.tex: doing @include of rluser.texi
|
||||
|
||||
|
||||
(/usr/local/src/bash/bash-20250529/lib/readline/doc/rluser.texi Chapter 8
|
||||
(/usr/local/src/bash/bash-20250822/lib/readline/doc/rluser.texi Chapter 8
|
||||
[129] [130] [131] [132] [133] [134] [135] [136] [137] [138] [139] [140]
|
||||
Underfull \hbox (badness 7540) in paragraph at lines 964--970
|
||||
Underfull \hbox (badness 7540) in paragraph at lines 968--974
|
||||
[]@textrm In the ex-am-ple above, @textttsl C-u[] @textrm is bound to the func
|
||||
-tion
|
||||
|
||||
@@ -279,7 +279,7 @@ Underfull \hbox (badness 7540) in paragraph at lines 964--970
|
||||
.etc.
|
||||
|
||||
|
||||
Underfull \hbox (badness 10000) in paragraph at lines 964--970
|
||||
Underfull \hbox (badness 10000) in paragraph at lines 968--974
|
||||
@texttt universal-argument[]@textrm , @textttsl M-DEL[] @textrm is bound to th
|
||||
e func-tion
|
||||
|
||||
@@ -292,7 +292,7 @@ e func-tion
|
||||
.etc.
|
||||
|
||||
[141] [142] [143] [144]
|
||||
Overfull \hbox (26.43913pt too wide) in paragraph at lines 1210--1210
|
||||
Overfull \hbox (26.43913pt too wide) in paragraph at lines 1214--1214
|
||||
[]@texttt Meta-Control-h: backward-kill-word Text after the function name is i
|
||||
gnored[]
|
||||
|
||||
@@ -313,10 +313,10 @@ gnored[]
|
||||
texinfo.tex: doing @include of hsuser.texi
|
||||
|
||||
|
||||
(/usr/local/src/bash/bash-20250529/lib/readline/doc/hsuser.texi Chapter 9
|
||||
(/usr/local/src/bash/bash-20250822/lib/readline/doc/hsuser.texi Chapter 9
|
||||
[167] [168] [169] [170] [171] [172] [173]) Chapter 10 [174] [175] [176]
|
||||
[177] [178]
|
||||
Underfull \hbox (badness 10000) in paragraph at lines 10695--10704
|
||||
Underfull \hbox (badness 10000) in paragraph at lines 10703--10712
|
||||
[]@textrm All of the fol-low-ing op-tions ex-cept for `@texttt alt-array-implem
|
||||
entation[]@textrm '[],
|
||||
|
||||
@@ -329,7 +329,7 @@ entation[]@textrm '[],
|
||||
.etc.
|
||||
|
||||
|
||||
Underfull \hbox (badness 10000) in paragraph at lines 10695--10704
|
||||
Underfull \hbox (badness 10000) in paragraph at lines 10703--10712
|
||||
@textrm `@texttt disabled-builtins[]@textrm '[], `@texttt direxpand-default[]@t
|
||||
extrm '[], `@texttt strict-posix-default[]@textrm '[], and
|
||||
|
||||
@@ -346,13 +346,13 @@ extrm '[], `@texttt strict-posix-default[]@textrm '[], and
|
||||
texinfo.tex: doing @include of fdl.texi
|
||||
|
||||
|
||||
(/usr/local/src/bash/bash-20250529/doc/fdl.texi [192] [193] [194] [195]
|
||||
(/usr/local/src/bash/bash-20250822/doc/fdl.texi [192] [193] [194] [195]
|
||||
[196] [197] [198]) Appendix D [199] [200] [201] [202] [203] [204] [205]
|
||||
[206] [207] [208] )
|
||||
Here is how much of TeX's memory you used:
|
||||
4116 strings out of 495840
|
||||
47662 string characters out of 6171739
|
||||
145154 words of memory out of 5000000
|
||||
145158 words of memory out of 5000000
|
||||
5048 multiletter control sequences out of 15000+600000
|
||||
34315 words of font info for 116 fonts, out of 8000000 for 9000
|
||||
701 hyphenation exceptions out of 8191
|
||||
@@ -373,7 +373,7 @@ fonts/type1/public/amsfonts/cm/cmti10.pfb></opt/local/share/texmf-texlive/fonts
|
||||
lic/amsfonts/cm/cmtt9.pfb></opt/local/share/texmf-texlive/fonts/type1/public/cm
|
||||
-super/sfrm1095.pfb></opt/local/share/texmf-texlive/fonts/type1/public/cm-super
|
||||
/sfrm1440.pfb>
|
||||
Output written on bashref.pdf (214 pages, 855783 bytes).
|
||||
Output written on bashref.pdf (214 pages, 857538 bytes).
|
||||
PDF statistics:
|
||||
2948 PDF objects out of 2984 (max. 8388607)
|
||||
2686 compressed objects within 27 object streams
|
||||
|
||||
Binary file not shown.
+9
-9
@@ -317,9 +317,9 @@ The Bourne shell is
|
||||
the traditional Unix shell originally written by Stephen Bourne.
|
||||
All of the Bourne shell builtin commands are available in Bash, and
|
||||
the rules for evaluation and quoting are taken from the @sc{posix}
|
||||
specification for the `standard' Unix shell.
|
||||
specification for the ``standard'' Unix shell.
|
||||
|
||||
This chapter briefly summarizes the shell's `building blocks':
|
||||
This chapter briefly summarizes the shell's ``building blocks'':
|
||||
commands, control structures, shell functions, shell @i{parameters},
|
||||
shell expansions,
|
||||
@i{redirections}, which are a way to direct input and output from
|
||||
@@ -3520,14 +3520,14 @@ and @samp{\} must be used to quote the characters
|
||||
however, double quote characters have no special meaning.
|
||||
|
||||
If the redirection operator is @samp{<<-},
|
||||
the shell strips leading tab characters are stripped from input lines
|
||||
the shell strips leading tab characters from input lines
|
||||
and the line containing @var{delimiter}.
|
||||
This allows here-documents within shell scripts to be indented in a
|
||||
natural fashion.
|
||||
|
||||
If the delimiter is not quoted, the
|
||||
If the delimiter is not quoted, the shell treats the
|
||||
@code{\<newline>}
|
||||
sequence is treated as a line continuation: the two lines are joined
|
||||
sequence as a line continuation: the two lines are joined
|
||||
and the backslash-newline is removed.
|
||||
This happens while reading the here-document, before the check for
|
||||
the ending delimiter, so joined lines can form the end delimiter.
|
||||
@@ -9304,11 +9304,11 @@ from a @env{$PATH} search.
|
||||
|
||||
@item
|
||||
The message printed by the job control code and builtins when a job
|
||||
exits with a non-zero status is `Done(status)'.
|
||||
exits with a non-zero status is ``Done(status)''.
|
||||
|
||||
@item
|
||||
The message printed by the job control code and builtins when a job
|
||||
is stopped is `Stopped(@var{signame})', where @var{signame} is, for
|
||||
is stopped is ``Stopped(@var{signame})'', where @var{signame} is, for
|
||||
example, @code{SIGTSTP}.
|
||||
|
||||
@item
|
||||
@@ -10923,7 +10923,7 @@ Once you have determined that a bug actually exists, use the
|
||||
@code{bashbug} command to submit a bug report or use the form at the
|
||||
@uref{https://savannah.gnu.org/projects/bash/,Bash project page}.
|
||||
If you have a fix, you are encouraged to submit that as well!
|
||||
Suggestions and `philosophical' bug reports may be mailed
|
||||
Suggestions and ``philosophical'' bug reports may be mailed
|
||||
to @email{bug-bash@@gnu.org} or @email{help-bash@@gnu.org}.
|
||||
|
||||
All bug reports should include:
|
||||
@@ -10937,7 +10937,7 @@ The compiler used to compile Bash.
|
||||
@item
|
||||
A description of the bug behavior.
|
||||
@item
|
||||
A short script or `recipe' which exercises the bug and may be used
|
||||
A short script or ``recipe'' which exercises the bug and may be used
|
||||
to reproduce it.
|
||||
@end itemize
|
||||
|
||||
|
||||
+7
-6
@@ -194,12 +194,13 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
|
||||
ccdd [--LL] [--@@] [_d_i_r]
|
||||
ccdd --PP [--ee] [--@@] [_d_i_r]
|
||||
Change the current directory to _d_i_r. if _d_i_r is not supplied,
|
||||
the value of the HHOOMMEE shell variable is used as _d_i_r. The vari-
|
||||
able CCDDPPAATTHH exists, and _d_i_r does not begin with a slash (/), ccdd
|
||||
uses it as a search path: the shell searches each directory name
|
||||
in CCDDPPAATTHH for _d_i_r. Alternative directory names in CCDDPPAATTHH are
|
||||
separated by a colon (:). A null directory name in CCDDPPAATTHH is
|
||||
the same as the current directory, i.e.,
|
||||
the value of the HHOOMMEE shell variable is used as _d_i_r. If _d_i_r is
|
||||
the empty string, ccdd treats it as an error. The variable CCDDPPAATTHH
|
||||
exists, and _d_i_r does not begin with a slash (/), ccdd uses it as a
|
||||
search path: the shell searches each directory name in CCDDPPAATTHH
|
||||
for _d_i_r. Alternative directory names in CCDDPPAATTHH are separated by
|
||||
a colon (:). A null directory name in CCDDPPAATTHH is the same as the
|
||||
current directory, i.e.,
|
||||
|
||||
The --PP option causes ccdd to use the physical directory structure
|
||||
by resolving symbolic links while traversing _d_i_r and before pro-
|
||||
|
||||
Binary file not shown.
@@ -1601,9 +1601,17 @@ execute_in_subshell (COMMAND *command, int asynchronous, int pipe_in, int pipe_o
|
||||
USE_VAR(asynchronous);
|
||||
|
||||
subshell_level++;
|
||||
/* should_redir_stdin reflects whether we are executing an asynchronous
|
||||
command terminated by a `&'. */
|
||||
should_redir_stdin = (asynchronous && (command->flags & CMD_STDIN_REDIR) &&
|
||||
pipe_in == NO_PIPE &&
|
||||
#if 0 /*TAG:bash-5.4 POSIX interp 1913 */
|
||||
/* POSIX interp 1913 says that the redirection of fd 0
|
||||
from /dev/null is unconditional. */
|
||||
(posixly_correct || stdin_redirects (command->redirects) == 0));
|
||||
#else
|
||||
stdin_redirects (command->redirects) == 0);
|
||||
#endif
|
||||
|
||||
invert = (command->flags & CMD_INVERT_RETURN) != 0;
|
||||
user_subshell = command->type == cm_subshell || ((command->flags & CMD_WANT_SUBSHELL) != 0);
|
||||
@@ -2848,10 +2856,20 @@ execute_connection (COMMAND *command, int asynchronous, int pipe_in, int pipe_ou
|
||||
if we are currently in a subshell via `( xxx )', or if job
|
||||
control is not active then the standard input for an
|
||||
asynchronous command is forced to /dev/null. */
|
||||
/* If we want to make this /dev/null redirection unconditional in posix
|
||||
mode, change this to check posixly_correct */
|
||||
#if defined (JOB_CONTROL)
|
||||
#if 0 /*TAG:bash-5.4 POSIX interp 1913 */
|
||||
if (((subshell_environment || !job_control) && !stdin_redir) || posixly_correct)
|
||||
#else
|
||||
if ((subshell_environment || !job_control) && !stdin_redir)
|
||||
#endif
|
||||
#else
|
||||
#if 0 /*TAG:bash-5.4 POSIX interp 1913 */
|
||||
if (!stdin_redir || posixly_correct)
|
||||
#else
|
||||
if (!stdin_redir)
|
||||
#endif
|
||||
#endif /* JOB_CONTROL */
|
||||
tc->flags |= CMD_STDIN_REDIR;
|
||||
|
||||
@@ -4803,7 +4821,13 @@ run_builtin:
|
||||
{
|
||||
if ((cmdflags & CMD_STDIN_REDIR) &&
|
||||
pipe_in == NO_PIPE &&
|
||||
#if 0 /*TAG:bash-5.4 POSIX interp 1913 */
|
||||
/* POSIX interp 1913 says that the redirection of fd 0
|
||||
from /dev/null is unconditional. */
|
||||
(posixly_correct || stdin_redirects (simple_command->redirects) == 0))
|
||||
#else
|
||||
(stdin_redirects (simple_command->redirects) == 0))
|
||||
#endif
|
||||
async_redirect_stdin ();
|
||||
setup_async_signals ();
|
||||
}
|
||||
@@ -5817,7 +5841,13 @@ execute_disk_command (WORD_LIST *words, REDIRECT *redirects, char *command_line,
|
||||
{
|
||||
if ((cmdflags & CMD_STDIN_REDIR) &&
|
||||
pipe_in == NO_PIPE &&
|
||||
#if 0 /*TAG:bash-5.4 POSIX interp 1913 */
|
||||
/* POSIX interp 1913 says that the redirection of fd 0
|
||||
from /dev/null is unconditional. */
|
||||
(posixly_correct || stdin_redirects (redirects) == 0))
|
||||
#else
|
||||
(stdin_redirects (redirects) == 0))
|
||||
#endif
|
||||
async_redirect_stdin ();
|
||||
setup_async_signals ();
|
||||
}
|
||||
|
||||
@@ -826,10 +826,10 @@ rl_redisplay (void)
|
||||
if (_rl_echoing_p == 0)
|
||||
return;
|
||||
|
||||
RL_SETSTATE (RL_STATE_REDISPLAYING);
|
||||
/* Block keyboard interrupts because this function manipulates global
|
||||
data structures. */
|
||||
_rl_block_sigint ();
|
||||
RL_SETSTATE (RL_STATE_REDISPLAYING);
|
||||
|
||||
cur_face = FACE_NORMAL;
|
||||
/* Can turn this into an array for multiple highlighted objects in addition
|
||||
@@ -1708,8 +1708,8 @@ rl_redisplay (void)
|
||||
_rl_quick_redisplay = 0;
|
||||
}
|
||||
|
||||
RL_UNSETSTATE (RL_STATE_REDISPLAYING);
|
||||
_rl_release_sigint ();
|
||||
RL_UNSETSTATE (RL_STATE_REDISPLAYING);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -696,7 +696,7 @@ This determines the current keymap and key bindings.
|
||||
* Terminal Management:: Functions to manage terminal settings.
|
||||
* Utility Functions:: Generally useful functions and hooks.
|
||||
* Miscellaneous Functions:: Functions that don't fall into any category.
|
||||
* Alternate Interface:: Using Readline in a `callback' fashion.
|
||||
* Alternate Interface:: Using Readline in a ``callback'' fashion.
|
||||
* A Readline Example:: An example Readline function.
|
||||
* Alternate Interface Example:: An example program using the alternate interface.
|
||||
@end menu
|
||||
@@ -1545,7 +1545,7 @@ Some applications need to interleave keyboard I/O with file, device,
|
||||
or window system I/O, typically by using a main loop to @code{select()}
|
||||
on various file descriptors.
|
||||
To accommodate this use case, Readline can
|
||||
also be invoked as a `callback' function from an event loop.
|
||||
also be invoked as a ``callback'' function from an event loop.
|
||||
There are functions available to make this easy.
|
||||
|
||||
@deftypefun void rl_callback_handler_install (const char *prompt, rl_vcpfunc_t *line_handler)
|
||||
|
||||
@@ -85,11 +85,11 @@ Line editing can be enabled at any time using the @option{-o emacs} or
|
||||
The following paragraphs use Emacs style to
|
||||
describe the notation used to represent keystrokes.
|
||||
|
||||
The text @kbd{C-k} is read as `Control-K' and describes the character
|
||||
The text @kbd{C-k} is read as ``Control-K'' and describes the character
|
||||
produced when the @key{k} key is pressed while the Control key
|
||||
is depressed.
|
||||
|
||||
The text @kbd{M-k} is read as `Meta-K' and describes the character
|
||||
The text @kbd{M-k} is read as ``Meta-K'' and describes the character
|
||||
produced when the Meta key (if you have one) is depressed, and the @key{k}
|
||||
key is pressed (a @dfn{meta character}), then both are released.
|
||||
The Meta key is labeled @key{ALT} or @key{Option} on many keyboards.
|
||||
@@ -120,7 +120,7 @@ you can make @kbd{M-key} key bindings you specify
|
||||
(see @code{Key Bindings} in @ref{Readline Init File Syntax})
|
||||
do the same thing by setting the @code{force-meta-prefix} variable.
|
||||
|
||||
The text @kbd{M-C-k} is read as `Meta-Control-k' and describes the
|
||||
The text @kbd{M-C-k} is read as ``Meta-Control-k'' and describes the
|
||||
character produced by metafying @kbd{C-k}.
|
||||
|
||||
In addition, several keys have their own names.
|
||||
@@ -178,10 +178,10 @@ and then correct your mistake.
|
||||
Afterwards, you can move the cursor to the right with @kbd{C-f}.
|
||||
|
||||
When you add text in the middle of a line, you will notice that characters
|
||||
to the right of the cursor are `pushed over' to make room for the text
|
||||
to the right of the cursor are ``pushed over'' to make room for the text
|
||||
that you have inserted.
|
||||
Likewise, when you delete text behind the cursor,
|
||||
characters to the right of the cursor are `pulled back' to fill in the
|
||||
characters to the right of the cursor are ``pulled back'' to fill in the
|
||||
blank space created by the removal of the text.
|
||||
These are the bare
|
||||
essentials for editing the text of an input line:
|
||||
@@ -244,9 +244,9 @@ operate on characters while meta keystrokes operate on words.
|
||||
@dfn{Killing} text means to delete the text from the line, but to save
|
||||
it away for later use, usually by @dfn{yanking} (re-inserting)
|
||||
it back into the line.
|
||||
(`Cut' and `paste' are more recent jargon for `kill' and `yank'.)
|
||||
(``Cut'' and ``paste'' are more recent jargon for ``kill'' and ``yank''.)
|
||||
|
||||
If the description for a command says that it `kills' text, then you can
|
||||
If the description for a command says that it ``kills'' text, then you can
|
||||
be sure that you can get the text back in a different (or the same)
|
||||
place later.
|
||||
|
||||
@@ -307,9 +307,10 @@ act in a backward direction.
|
||||
For example, to kill text back to the
|
||||
start of the line, you might type @samp{M-- C-k}.
|
||||
|
||||
The general way to pass numeric arguments to a command is to type meta
|
||||
digits before the command.
|
||||
If the first `digit' typed is a minus
|
||||
The general way to pass numeric arguments to a command is to type
|
||||
the Meta key and then digits (``meta digits'')
|
||||
before the command.
|
||||
If the first ``digit'' typed is a minus
|
||||
sign (@samp{-}), then the sign of the argument will be negative.
|
||||
Once you have typed one meta digit to get the argument started, you can
|
||||
type the remainder of the digits, and then the command.
|
||||
@@ -1420,11 +1421,11 @@ If this line is a modified history line, then restore the history line
|
||||
to its original state.
|
||||
|
||||
@item previous-history (C-p)
|
||||
Move `back' through the history list, fetching the previous command.
|
||||
Move ``back'' through the history list, fetching the previous command.
|
||||
This may also be bound to the up arrow key on some keyboards.
|
||||
|
||||
@item next-history (C-n)
|
||||
Move `forward' through the history list, fetching the next command.
|
||||
Move ``forward'' through the history list, fetching the next command.
|
||||
This may also be bound to the down arrow key on some keyboards.
|
||||
|
||||
@item beginning-of-history (M-<)
|
||||
@@ -1435,25 +1436,26 @@ Move to the end of the input history, i.e., the line currently
|
||||
being entered.
|
||||
|
||||
@item reverse-search-history (C-r)
|
||||
Search backward starting at the current line and moving `up' through
|
||||
Search backward starting at the current line and moving ``up'' through
|
||||
the history as necessary.
|
||||
This is an incremental search.
|
||||
This command sets the region to the matched text and activates the region.
|
||||
|
||||
@item forward-search-history (C-s)
|
||||
Search forward starting at the current line and moving `down' through
|
||||
Search forward starting at the current line and moving ``down'' through
|
||||
the history as necessary.
|
||||
This is an incremental search.
|
||||
This command sets the region to the matched text and activates the region.
|
||||
|
||||
@item non-incremental-reverse-search-history (M-p)
|
||||
Search backward starting at the current line and moving `up'
|
||||
Search backward starting at the current line and moving ``up''
|
||||
|
||||
through the history as necessary using a non-incremental search
|
||||
for a string supplied by the user.
|
||||
The search string may match anywhere in a history line.
|
||||
|
||||
@item non-incremental-forward-search-history (M-n)
|
||||
Search forward starting at the current line and moving `down'
|
||||
Search forward starting at the current line and moving ``down''
|
||||
through the history as necessary using a non-incremental search
|
||||
for a string supplied by the user.
|
||||
The search string may match anywhere in a history line.
|
||||
@@ -2135,8 +2137,8 @@ when in @code{vi} mode and to vi-editing-mode in @code{emacs} mode).
|
||||
The Readline default is @code{emacs} mode.
|
||||
|
||||
When you enter a line in @code{vi} mode, you are already placed in
|
||||
`insertion' mode, as if you had typed an @samp{i}. Pressing @key{ESC}
|
||||
switches you into `command' mode, where you can edit the text of the
|
||||
``insertion'' mode, as if you had typed an @samp{i}. Pressing @key{ESC}
|
||||
switches you into ``command'' mode, where you can edit the text of the
|
||||
line with the standard @code{vi} movement keys, move to previous
|
||||
history lines with @samp{k} and subsequent lines with @samp{j}, and
|
||||
so forth.
|
||||
@@ -2259,6 +2261,25 @@ the standard output.
|
||||
Backslash will escape a newline, if necessary.
|
||||
These are added to the set of possible completions.
|
||||
|
||||
External commands that are invoked to generate completions
|
||||
("external completers")
|
||||
receive the word preceding the completion word as an argument,
|
||||
as described above.
|
||||
This provides context that is sometimes useful, but may include
|
||||
information that is considered sensitive or part of a word expansion
|
||||
that will not appear in the command line after expansion.
|
||||
That word may be visible in process listings or in audit logs.
|
||||
This may be a concern to users and completion specification authors
|
||||
if there is sensitive information on the command line before
|
||||
expansion, since completion takes place before words are expanded.
|
||||
If this is an issue, completion authors should use functions as
|
||||
wrappers around external commands and pass context information to the
|
||||
external command in a different way.
|
||||
External completers can infer context from the @var{COMP_LINE}
|
||||
and @var{COMP_POINT} environment variables, but they need to ensure
|
||||
they break words in the same way Readline does, using the
|
||||
@var{COMP_WORDBREAKS} variable.
|
||||
|
||||
After generating all of the possible completions,
|
||||
Bash applies any filter
|
||||
specified with the @option{-X} option to the completions in the list.
|
||||
|
||||
@@ -5,7 +5,7 @@ Copyright (C) 1988-2025 Free Software Foundation, Inc.
|
||||
@set EDITION 8.3
|
||||
@set VERSION 8.3
|
||||
|
||||
@set UPDATED 15 July 2025
|
||||
@set UPDATED-MONTH July 2025
|
||||
@set UPDATED 25 August 2025
|
||||
@set UPDATED-MONTH August 2025
|
||||
|
||||
@set LASTCHANGE Tue Jul 15 10:18:40 EDT 2025
|
||||
@set LASTCHANGE Mon Aug 25 11:33:46 EDT 2025
|
||||
|
||||
@@ -825,14 +825,14 @@ rl_read_key (void)
|
||||
{
|
||||
if (rl_get_char (&c) == 0)
|
||||
c = (*rl_getc_function) (rl_instream);
|
||||
if (_rl_caught_signal)
|
||||
{
|
||||
fprintf(stderr, "rl_read_key: calling RL_CHECK_SIGNALS: c = %d _rl_caught_signal = %d\r\n", c, _rl_caught_signal);
|
||||
if (c > 0)
|
||||
rl_stuff_char (c);
|
||||
c = -1;
|
||||
RL_CHECK_SIGNALS ();
|
||||
}
|
||||
/* This can happen if rl_getc_function != rl_getc */
|
||||
if (_rl_caught_signal)
|
||||
{
|
||||
if (c > 0)
|
||||
rl_stuff_char (c);
|
||||
c = -1;
|
||||
RL_CHECK_SIGNALS ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1005,7 +1005,7 @@ postproc_signal:
|
||||
(*rl_signal_event_hook) ();
|
||||
/* If the application's SIGINT handler returns, make sure we abort out of
|
||||
searches and numeric arguments because we've freed necessary state. */
|
||||
if (osig == SIGINT && (ostate & (RL_STATE_ISEARCH|RL_STATE_NSEARCH|RL_STATE_NUMERICARG)))
|
||||
if (osig == SIGINT && (ostate & (RL_STATE_ISEARCH|RL_STATE_NSEARCH|RL_STATE_NUMERICARG|RL_STATE_MOREINPUT)))
|
||||
/* just these cases for now */
|
||||
_rl_abort_internal ();
|
||||
}
|
||||
|
||||
+12
-4
@@ -153,10 +153,11 @@ rl_display_search (char *search_string, int flags, int where)
|
||||
{
|
||||
char *message;
|
||||
size_t msglen, searchlen;
|
||||
unsigned char c;
|
||||
|
||||
searchlen = (search_string && *search_string) ? strlen (search_string) : 0;
|
||||
|
||||
message = (char *)xmalloc (searchlen + 64);
|
||||
message = (char *)xmalloc (searchlen * 2 + 64);
|
||||
msglen = 0;
|
||||
|
||||
#if defined (NOTDEF)
|
||||
@@ -186,8 +187,15 @@ rl_display_search (char *search_string, int flags, int where)
|
||||
|
||||
if (search_string && *search_string)
|
||||
{
|
||||
strcpy (message + msglen, search_string);
|
||||
msglen += searchlen;
|
||||
for ( ; c = *search_string; search_string++)
|
||||
{
|
||||
if (CTRL_CHAR (c) || c == RUBOUT)
|
||||
{
|
||||
message[msglen++] = '^';
|
||||
c = CTRL_CHAR (c) ? UNCTRL (c) : '?';
|
||||
}
|
||||
message[msglen++] = c;
|
||||
}
|
||||
}
|
||||
else
|
||||
_rl_optimize_redisplay ();
|
||||
@@ -319,7 +327,7 @@ _rl_search_getchar (_rl_search_cxt *cxt)
|
||||
|
||||
/* Read a key and decide how to proceed. */
|
||||
RL_SETSTATE(RL_STATE_MOREINPUT);
|
||||
c = cxt->lastc = rl_read_key ();
|
||||
c = cxt->lastc = rl_read_key (); /* XXX */
|
||||
RL_UNSETSTATE(RL_STATE_MOREINPUT);
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
|
||||
@@ -672,12 +672,19 @@ _rl_block_sigint (void)
|
||||
void
|
||||
_rl_release_sigint (void)
|
||||
{
|
||||
int osig, ostate;
|
||||
|
||||
if (sigint_blocked == 0)
|
||||
return;
|
||||
|
||||
sigint_blocked = 0;
|
||||
osig = _rl_caught_signal;
|
||||
ostate = rl_readline_state;
|
||||
if (RL_ISSTATE (RL_STATE_SIGHANDLER) == 0)
|
||||
RL_CHECK_SIGNALS ();
|
||||
/* These are basically all the places that call rl_message() */
|
||||
if (osig == SIGINT && (ostate & (RL_STATE_ISEARCH|RL_STATE_NSEARCH|RL_STATE_NUMERICARG|RL_STATE_MOREINPUT|RL_STATE_READSTR)))
|
||||
_rl_abort_internal ();
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
+2
-2
@@ -2026,12 +2026,12 @@ _rl_readstr_init (int pchar, int flags)
|
||||
rl_end = rl_point = 0;
|
||||
|
||||
p = _rl_make_prompt_for_search (pchar ? pchar : '@');
|
||||
|
||||
RL_SETSTATE (RL_STATE_READSTR);
|
||||
cxt->flags |= READSTR_FREEPMT;
|
||||
rl_message ("%s", p);
|
||||
xfree (p);
|
||||
|
||||
RL_SETSTATE (RL_STATE_READSTR);
|
||||
|
||||
_rl_rscxt = cxt;
|
||||
|
||||
return cxt;
|
||||
|
||||
+11
-4
@@ -1,12 +1,13 @@
|
||||
alias: 0
|
||||
alias: 0
|
||||
./alias.tests: line 38: qfoo: command not found
|
||||
./alias.tests: line 44: unalias: foo: not found
|
||||
./alias.tests: line 40: qfoo: command not found
|
||||
./alias.tests: line 46: unalias: foo: not found
|
||||
quux
|
||||
hi
|
||||
declare -a m=([0]="x")
|
||||
./alias.tests: line 66: alias: `\$': invalid alias name
|
||||
./alias.tests: line 67: `\$': invalid alias name
|
||||
./alias.tests: line 68: alias: `\$': invalid alias name
|
||||
./alias.tests: line 69: `\$': invalid alias name
|
||||
alias1.sub
|
||||
bar
|
||||
value
|
||||
bar
|
||||
@@ -15,6 +16,7 @@ OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
alias2.sub
|
||||
one
|
||||
two
|
||||
three
|
||||
@@ -23,6 +25,8 @@ one
|
||||
two
|
||||
three
|
||||
four
|
||||
alias3.sub
|
||||
alias4.sub
|
||||
Error: bar
|
||||
ok 1
|
||||
ok 2
|
||||
@@ -40,14 +44,17 @@ bar
|
||||
bad
|
||||
0
|
||||
<|cat>
|
||||
alias5.sub
|
||||
foo
|
||||
bar
|
||||
baz
|
||||
foo
|
||||
bar
|
||||
baz
|
||||
alias6.sub
|
||||
<áa>
|
||||
<aá>
|
||||
alias7.sub
|
||||
bar
|
||||
foo bar x
|
||||
foo
|
||||
|
||||
+9
-7
@@ -12,6 +12,8 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# place holder for future alias testing
|
||||
. ./test-aux-functions
|
||||
|
||||
shopt -s expand_aliases
|
||||
|
||||
# alias/unalias tests originally in builtins.tests
|
||||
@@ -66,10 +68,10 @@ declare -p m
|
||||
alias '\$'=xx
|
||||
BASH_ALIASES['\$']=xx
|
||||
|
||||
${THIS_SH} ./alias1.sub
|
||||
${THIS_SH} ./alias2.sub
|
||||
${THIS_SH} ./alias3.sub
|
||||
${THIS_SH} ./alias4.sub
|
||||
${THIS_SH} ./alias5.sub
|
||||
${THIS_SH} ./alias6.sub
|
||||
${THIS_SH} ./alias7.sub
|
||||
test_runsub ./alias1.sub
|
||||
test_runsub ./alias2.sub
|
||||
test_runsub ./alias3.sub
|
||||
test_runsub ./alias4.sub
|
||||
test_runsub ./alias5.sub
|
||||
test_runsub ./alias6.sub
|
||||
test_runsub ./alias7.sub
|
||||
|
||||
@@ -15,12 +15,14 @@
|
||||
4
|
||||
9
|
||||
16
|
||||
./appendop.tests: line 97: x: readonly variable
|
||||
./appendop.tests: line 99: x: readonly variable
|
||||
appendop1.sub
|
||||
declare -A foo=([two]="baz" [three]="quux" [one]="bar" )
|
||||
declare -A foo=([0]="zero" [two]="baz" [three]="quux" [one]="bar" )
|
||||
declare -A foo=([four]="four" [0]="zero" [two]="baz" [three]="quux" [one]="bar" )
|
||||
declare -ai iarr=([0]="3" [1]="2" [2]="3")
|
||||
declare -ai iarr=([0]="3" [1]="2" [2]="3" [3]="4" [4]="5" [5]="6")
|
||||
appendop2.sub
|
||||
25 25
|
||||
7 7
|
||||
14
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
. ./test-aux-functions
|
||||
|
||||
# basic cases
|
||||
a=1
|
||||
a+=4
|
||||
@@ -96,5 +98,5 @@ echo $x
|
||||
|
||||
x+=5
|
||||
|
||||
${THIS_SH} ./appendop1.sub
|
||||
${THIS_SH} ./appendop2.sub
|
||||
test_runsub ./appendop1.sub
|
||||
test_runsub ./appendop2.sub
|
||||
|
||||
+42
-31
@@ -61,7 +61,7 @@
|
||||
1,i+=2
|
||||
30
|
||||
1,j+=2
|
||||
./arith.tests: line 129: 1 ? 20 : x+=2: attempted assignment to non-variable (error token is "+=2")
|
||||
./arith.tests: line 131: 1 ? 20 : x+=2: attempted assignment to non-variable (error token is "+=2")
|
||||
20
|
||||
6
|
||||
6,5,3
|
||||
@@ -83,18 +83,18 @@
|
||||
36
|
||||
62
|
||||
63
|
||||
./arith.tests: line 168: 3425#56: invalid arithmetic base (error token is "3425#56")
|
||||
./arith.tests: line 171: 2#: invalid integer constant (error token is "2#")
|
||||
./arith.tests: line 174: 7 = 43 : attempted assignment to non-variable (error token is "= 43 ")
|
||||
./arith.tests: line 175: 2#44: value too great for base (error token is "2#44")
|
||||
./arith.tests: line 176: 44 / 0 : division by 0 (error token is "0 ")
|
||||
./arith.tests: line 177: let: jv += $iv: arithmetic syntax error: operand expected (error token is "$iv")
|
||||
./arith.tests: line 178: jv += $iv : arithmetic syntax error: operand expected (error token is "$iv ")
|
||||
./arith.tests: line 179: let: rv = 7 + (43 * 6: missing `)' (error token is "6")
|
||||
./arith.tests: line 182: b / 0 : division by 0 (error token is "0 ")
|
||||
./arith.tests: line 183: b /= 0 : division by 0 (error token is "0 ")
|
||||
./arith.tests: line 188: 0#4: invalid number (error token is "0#4")
|
||||
./arith.tests: line 189: 2#110#11: invalid number (error token is "2#110#11")
|
||||
./arith.tests: line 170: 3425#56: invalid arithmetic base (error token is "3425#56")
|
||||
./arith.tests: line 173: 2#: invalid integer constant (error token is "2#")
|
||||
./arith.tests: line 176: 7 = 43 : attempted assignment to non-variable (error token is "= 43 ")
|
||||
./arith.tests: line 177: 2#44: value too great for base (error token is "2#44")
|
||||
./arith.tests: line 178: 44 / 0 : division by 0 (error token is "0 ")
|
||||
./arith.tests: line 179: let: jv += $iv: arithmetic syntax error: operand expected (error token is "$iv")
|
||||
./arith.tests: line 180: jv += $iv : arithmetic syntax error: operand expected (error token is "$iv ")
|
||||
./arith.tests: line 181: let: rv = 7 + (43 * 6: missing `)' (error token is "6")
|
||||
./arith.tests: line 184: b / 0 : division by 0 (error token is "0 ")
|
||||
./arith.tests: line 185: b /= 0 : division by 0 (error token is "0 ")
|
||||
./arith.tests: line 190: 0#4: invalid number (error token is "0#4")
|
||||
./arith.tests: line 191: 2#110#11: invalid number (error token is "2#110#11")
|
||||
abc
|
||||
def
|
||||
ghi
|
||||
@@ -102,15 +102,15 @@ ok
|
||||
6
|
||||
1
|
||||
0
|
||||
./arith.tests: line 207: 4 + : arithmetic syntax error: operand expected (error token is "+ ")
|
||||
./arith.tests: line 209: 4 + : arithmetic syntax error: operand expected (error token is "+ ")
|
||||
16
|
||||
./arith.tests: line 212: 4 ? : 3 + 5 : expression expected (error token is ": 3 + 5 ")
|
||||
./arith.tests: line 213: 1 ? 20 : `:' expected for conditional expression (error token is "20 ")
|
||||
./arith.tests: line 214: 4 ? 20 : : expression expected (error token is ": ")
|
||||
./arith.tests: line 214: 4 ? : 3 + 5 : expression expected (error token is ": 3 + 5 ")
|
||||
./arith.tests: line 215: 1 ? 20 : `:' expected for conditional expression (error token is "20 ")
|
||||
./arith.tests: line 216: 4 ? 20 : : expression expected (error token is ": ")
|
||||
9
|
||||
./arith.tests: line 220: 0 && B=42 : attempted assignment to non-variable (error token is "=42 ")
|
||||
./arith.tests: line 222: 0 && B=42 : attempted assignment to non-variable (error token is "=42 ")
|
||||
9
|
||||
./arith.tests: line 223: 1 || B=88 : attempted assignment to non-variable (error token is "=88 ")
|
||||
./arith.tests: line 225: 1 || B=88 : attempted assignment to non-variable (error token is "=88 ")
|
||||
9
|
||||
0
|
||||
9
|
||||
@@ -126,7 +126,7 @@ ok
|
||||
131072
|
||||
2147483647
|
||||
1
|
||||
./arith.tests: line 255: 2**-1 : exponent less than 0 (error token is "1 ")
|
||||
./arith.tests: line 257: 2**-1 : exponent less than 0 (error token is "1 ")
|
||||
4
|
||||
4
|
||||
5
|
||||
@@ -137,19 +137,20 @@ ok
|
||||
4
|
||||
4
|
||||
7
|
||||
./arith.tests: line 274: 7-- : arithmetic syntax error: operand expected (error token is "- ")
|
||||
./arith.tests: line 276: --x=7 : attempted assignment to non-variable (error token is "=7 ")
|
||||
./arith.tests: line 277: ++x=7 : attempted assignment to non-variable (error token is "=7 ")
|
||||
./arith.tests: line 279: x++=7 : attempted assignment to non-variable (error token is "=7 ")
|
||||
./arith.tests: line 280: x--=7 : attempted assignment to non-variable (error token is "=7 ")
|
||||
./arith.tests: line 276: 7-- : arithmetic syntax error: operand expected (error token is "- ")
|
||||
./arith.tests: line 278: --x=7 : attempted assignment to non-variable (error token is "=7 ")
|
||||
./arith.tests: line 279: ++x=7 : attempted assignment to non-variable (error token is "=7 ")
|
||||
./arith.tests: line 281: x++=7 : attempted assignment to non-variable (error token is "=7 ")
|
||||
./arith.tests: line 282: x--=7 : attempted assignment to non-variable (error token is "=7 ")
|
||||
4
|
||||
7
|
||||
-7
|
||||
7
|
||||
7
|
||||
./arith.tests: line 292: --x++ : ++: assignment requires lvalue (error token is "++ ")
|
||||
./arith.tests: line 294: --x++ : ++: assignment requires lvalue (error token is "++ ")
|
||||
2
|
||||
2
|
||||
arith1.sub
|
||||
./arith1.sub: line 15: 4-- : arithmetic syntax error: operand expected (error token is "- ")
|
||||
./arith1.sub: line 16: 4++ : arithmetic syntax error: operand expected (error token is "+ ")
|
||||
./arith1.sub: line 17: 4 -- : arithmetic syntax error: operand expected (error token is "- ")
|
||||
@@ -172,6 +173,7 @@ ok
|
||||
7
|
||||
7
|
||||
./arith1.sub: line 51: ((: -- : arithmetic syntax error: operand expected (error token is "- ")
|
||||
arith2.sub
|
||||
7
|
||||
7
|
||||
7
|
||||
@@ -200,6 +202,7 @@ ok
|
||||
-7
|
||||
7
|
||||
7
|
||||
arith3.sub
|
||||
1
|
||||
1
|
||||
4
|
||||
@@ -209,11 +212,13 @@ ok
|
||||
4
|
||||
5000
|
||||
5000
|
||||
arith4.sub
|
||||
1
|
||||
0
|
||||
0
|
||||
1
|
||||
2147483649
|
||||
arith5.sub
|
||||
0
|
||||
0
|
||||
0
|
||||
@@ -231,6 +236,7 @@ ok
|
||||
-9223372036854775808
|
||||
-9223372036854775808
|
||||
9223372036854775805 9223372036854775806 9223372036854775807
|
||||
arith6.sub
|
||||
123 456
|
||||
123 456
|
||||
123 456
|
||||
@@ -243,12 +249,14 @@ ok
|
||||
0
|
||||
0, 0
|
||||
0, 1
|
||||
arith7.sub
|
||||
efg
|
||||
e
|
||||
efg
|
||||
e
|
||||
abcdefg
|
||||
efg
|
||||
arith8.sub
|
||||
0
|
||||
0
|
||||
0
|
||||
@@ -256,6 +264,7 @@ efg
|
||||
0
|
||||
0
|
||||
0
|
||||
arith9.sub
|
||||
./arith9.sub: line 4: a: unbound variable
|
||||
./arith9.sub: line 5: a: unbound variable
|
||||
0
|
||||
@@ -281,6 +290,7 @@ after 4 0
|
||||
+ set +x
|
||||
./arith9.sub: line 37: 4+: arithmetic syntax error: operand expected (error token is "+")
|
||||
x = 4+ y =
|
||||
arith10.sub
|
||||
== arraysub ==
|
||||
=== assoc_expand_once unset ===
|
||||
declare -a a=([0]="10")
|
||||
@@ -355,6 +365,7 @@ declare -a a=([0]="0")
|
||||
3 1
|
||||
./arith10.sub: line 95: let: 0 - "": arithmetic syntax error: operand expected (error token is """")
|
||||
4 1
|
||||
arith11.sub
|
||||
0
|
||||
declare -a yy=([0]="10")
|
||||
|
||||
@@ -365,14 +376,14 @@ declare -a yy=([0]="10")
|
||||
Y
|
||||
./arith11.sub: line 65: 'foo' : arithmetic syntax error: operand expected (error token is "'foo' ")
|
||||
8 12
|
||||
./arith.tests: line 338: ((: x=9 y=41 : arithmetic syntax error in expression (error token is "y=41 ")
|
||||
./arith.tests: line 342: a b: arithmetic syntax error in expression (error token is "b")
|
||||
./arith.tests: line 343: ((: a b: arithmetic syntax error in expression (error token is "b")
|
||||
./arith.tests: line 340: ((: x=9 y=41 : arithmetic syntax error in expression (error token is "y=41 ")
|
||||
./arith.tests: line 344: a b: arithmetic syntax error in expression (error token is "b")
|
||||
./arith.tests: line 345: ((: a b: arithmetic syntax error in expression (error token is "b")
|
||||
42
|
||||
42
|
||||
42
|
||||
42
|
||||
42
|
||||
42
|
||||
./arith.tests: line 358: 'foo' : arithmetic syntax error: operand expected (error token is "'foo' ")
|
||||
./arith.tests: line 361: b[c]d: arithmetic syntax error in expression (error token is "d")
|
||||
./arith.tests: line 360: 'foo' : arithmetic syntax error: operand expected (error token is "'foo' ")
|
||||
./arith.tests: line 363: b[c]d: arithmetic syntax error in expression (error token is "d")
|
||||
|
||||
+13
-11
@@ -11,6 +11,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
. ./test-aux-functions
|
||||
|
||||
set +o posix
|
||||
declare -i iv jv
|
||||
|
||||
@@ -296,36 +298,36 @@ unset -v x
|
||||
echo $(( "`echo 1+1`" ))
|
||||
echo $(( `echo 1+1` ))
|
||||
|
||||
${THIS_SH} ./arith1.sub
|
||||
${THIS_SH} ./arith2.sub
|
||||
${THIS_SH} ./arith3.sub
|
||||
${THIS_SH} ./arith4.sub
|
||||
test_runsub ./arith1.sub
|
||||
test_runsub ./arith2.sub
|
||||
test_runsub ./arith3.sub
|
||||
test_runsub ./arith4.sub
|
||||
|
||||
# make sure arithmetic expansion handles ints > 2**31 - 1 using intmax_t
|
||||
echo $(( 2147483645 + 4 ))
|
||||
|
||||
# other tests using INTMAX_MIN and INTMAX_MAX that cause exceptions if not
|
||||
# handled correctly -- problem through bash-4.2
|
||||
${THIS_SH} ./arith5.sub
|
||||
test_runsub ./arith5.sub
|
||||
|
||||
# problems with suppressing evaluation present through bash-4.2
|
||||
${THIS_SH} ./arith6.sub
|
||||
test_runsub ./arith6.sub
|
||||
|
||||
# problems with parsing arithmetic expressions containing colons that are
|
||||
# part of word expansions such as substring extraction
|
||||
${THIS_SH} ./arith7.sub
|
||||
test_runsub ./arith7.sub
|
||||
|
||||
# problems with evaluation of conditional expressions
|
||||
${THIS_SH} ./arith8.sub
|
||||
test_runsub ./arith8.sub
|
||||
|
||||
# expressions with unset variables and nounset enabled
|
||||
${THIS_SH} ./arith9.sub
|
||||
test_runsub ./arith9.sub
|
||||
|
||||
# empty expressions in various arithmetic evaluation contexts
|
||||
${THIS_SH} ./arith10.sub
|
||||
test_runsub ./arith10.sub
|
||||
|
||||
# internal quoting for array subscripts
|
||||
${THIS_SH} ./arith11.sub
|
||||
test_runsub ./arith11.sub
|
||||
|
||||
x=4
|
||||
y=7
|
||||
|
||||
+58
-25
@@ -1,12 +1,12 @@
|
||||
|
||||
./array.tests: line 34: syntax error near unexpected token `&'
|
||||
./array.tests: line 34: `test=(first & second)'
|
||||
./array.tests: line 35: syntax error near unexpected token `&'
|
||||
./array.tests: line 35: `test=(first & second)'
|
||||
1
|
||||
abcde
|
||||
abcde
|
||||
abcde bdef
|
||||
abcde bdef
|
||||
declare -a BASH_ARGC=()
|
||||
declare -a BASH_ARGC=([0]="0")
|
||||
declare -a BASH_ARGV=()
|
||||
declare -a BASH_LINENO=([0]="0")
|
||||
declare -a BASH_SOURCE=([0]="./array.tests")
|
||||
@@ -26,7 +26,7 @@ hello world
|
||||
11
|
||||
3
|
||||
bdef hello world test expression test 2
|
||||
./array.tests: line 98: readonly: `a[5]': not a valid identifier
|
||||
./array.tests: line 99: readonly: `a[5]': not a valid identifier
|
||||
declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
|
||||
declare -ar c
|
||||
declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
|
||||
@@ -34,7 +34,7 @@ declare -ar c
|
||||
readonly -a a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
|
||||
readonly -a c
|
||||
a test
|
||||
declare -a BASH_ARGC=()
|
||||
declare -a BASH_ARGC=([0]="0")
|
||||
declare -a BASH_ARGV=()
|
||||
declare -a BASH_LINENO=([0]="0")
|
||||
declare -a BASH_SOURCE=([0]="./array.tests")
|
||||
@@ -46,18 +46,18 @@ declare -ar c
|
||||
declare -a d=([1]="" [2]="bdef" [5]="hello world" [6]="test" [9]="ninth element")
|
||||
declare -a e=([0]="test")
|
||||
declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
|
||||
./array.tests: line 122: a: readonly variable
|
||||
./array.tests: line 124: b[]: bad array subscript
|
||||
./array.tests: line 125: b[*]: bad array subscript
|
||||
./array.tests: line 123: a: readonly variable
|
||||
./array.tests: line 125: b[]: bad array subscript
|
||||
./array.tests: line 126: b[*]: bad array subscript
|
||||
this
|
||||
./array.tests: line 128: c[-2]: bad array subscript
|
||||
./array.tests: line 129: c: bad array subscript
|
||||
./array.tests: line 129: c[-2]: bad array subscript
|
||||
./array.tests: line 130: c: bad array subscript
|
||||
|
||||
./array.tests: line 131: d[7]: cannot assign list to array member
|
||||
./array.tests: line 133: []=abcde: bad array subscript
|
||||
./array.tests: line 134: [*]=last: cannot assign to non-numeric index
|
||||
./array.tests: line 135: [-65]=negative: bad array subscript
|
||||
declare -a BASH_ARGC=()
|
||||
./array.tests: line 132: d[7]: cannot assign list to array member
|
||||
./array.tests: line 134: []=abcde: bad array subscript
|
||||
./array.tests: line 135: [*]=last: cannot assign to non-numeric index
|
||||
./array.tests: line 136: [-65]=negative: bad array subscript
|
||||
declare -a BASH_ARGC=([0]="0")
|
||||
declare -a BASH_ARGV=()
|
||||
declare -a BASH_LINENO=([0]="0")
|
||||
declare -a BASH_SOURCE=([0]="./array.tests")
|
||||
@@ -69,13 +69,13 @@ declare -ar c
|
||||
declare -a d=([1]="test test")
|
||||
declare -a e=()
|
||||
declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
|
||||
./array.tests: line 143: unset: ps1: not an array variable
|
||||
./array.tests: line 147: declare: c: readonly variable
|
||||
./array.tests: line 144: unset: ps1: not an array variable
|
||||
./array.tests: line 148: declare: c: readonly variable
|
||||
this of
|
||||
this is a test of read using arrays
|
||||
this test
|
||||
this is a test of arrays
|
||||
declare -a BASH_ARGC=()
|
||||
declare -a BASH_ARGC=([0]="0")
|
||||
declare -a BASH_ARGV=()
|
||||
declare -a BASH_LINENO=([0]="0")
|
||||
declare -a BASH_SOURCE=([0]="./array.tests")
|
||||
@@ -123,7 +123,7 @@ argv[1] = </>
|
||||
55
|
||||
49
|
||||
6 -- 6
|
||||
./array.tests: line 238: [-10]: bad array subscript
|
||||
./array.tests: line 239: [-10]: bad array subscript
|
||||
0
|
||||
42 14 44
|
||||
grep [ 123 ] *
|
||||
@@ -131,20 +131,24 @@ grep [ 123 ] *
|
||||
6 7 9 5
|
||||
length = 3
|
||||
value = new1 new2 new3
|
||||
./array.tests: line 267: syntax error near unexpected token `&'
|
||||
./array.tests: line 267: `badarray=( metacharacters like & need to be quoted in compound assignments)'
|
||||
./array.tests: line 271: narray[4]: unbound variable
|
||||
./array.tests: line 268: syntax error near unexpected token `&'
|
||||
./array.tests: line 268: `badarray=( metacharacters like & need to be quoted in compound assignments)'
|
||||
./array.tests: line 272: narray[4]: unbound variable
|
||||
array1.sub
|
||||
./array1.sub: line 1: syntax error near unexpected token `('
|
||||
./array1.sub: line 1: `printf "%s\n" -a a=(a 'b c')'
|
||||
array2.sub
|
||||
./array2.sub: line 1: declare: `[]=asdf': not a valid identifier
|
||||
./array2.sub: line 2: a[]: bad array subscript
|
||||
./array2.sub: line 4: syntax error near unexpected token `('
|
||||
./array2.sub: line 4: `declare -a ''=(a 'b c')'
|
||||
array3.sub
|
||||
9
|
||||
9
|
||||
|
||||
|
||||
7 8 9
|
||||
array4.sub
|
||||
8 11
|
||||
8 11
|
||||
6
|
||||
@@ -160,10 +164,10 @@ for case if then else
|
||||
12 14 16 18 20
|
||||
4414758999202
|
||||
aaa bbb
|
||||
./array.tests: line 321: syntax error near unexpected token `<>'
|
||||
./array.tests: line 321: `metas=( <> < > ! )'
|
||||
./array.tests: line 322: syntax error near unexpected token `<>'
|
||||
./array.tests: line 322: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
|
||||
./array.tests: line 322: `metas=( <> < > ! )'
|
||||
./array.tests: line 323: syntax error near unexpected token `<>'
|
||||
./array.tests: line 323: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
|
||||
abc 3
|
||||
case 4
|
||||
abc case if then else 5
|
||||
@@ -217,11 +221,13 @@ FIN3:0
|
||||
FIN4:0
|
||||
FIN5:0
|
||||
FIN6:0
|
||||
array5.sub
|
||||
t
|
||||
[3]=abcde r s t u v
|
||||
e
|
||||
9
|
||||
2
|
||||
array6.sub
|
||||
a b c
|
||||
argv[1] = <-iname 'a>
|
||||
argv[2] = <-iname 'b>
|
||||
@@ -284,6 +290,7 @@ argv[1] = <element1 with spaces>
|
||||
argv[2] = <element2 with spaces>
|
||||
argv[1] = <element1 with spaces>
|
||||
argv[2] = <element2 with spaces>
|
||||
array7.sub
|
||||
nord!olz
|
||||
|
||||
rdholz
|
||||
@@ -292,6 +299,7 @@ rdholz
|
||||
rdho
|
||||
|
||||
|
||||
array8.sub
|
||||
argv[1] = <fooq//barq/>
|
||||
argv[1] = <fooq>
|
||||
argv[2] = <>
|
||||
@@ -317,6 +325,7 @@ argv[1] = <FOOQ>
|
||||
argv[2] = <>
|
||||
argv[3] = <BARQ>
|
||||
argv[4] = <>
|
||||
array9.sub
|
||||
126
|
||||
127
|
||||
128
|
||||
@@ -330,6 +339,7 @@ argv[3] = <
|
||||
argv[1] = <~>
|
||||
argv[2] = <^?>
|
||||
argv[3] = <€>
|
||||
array10.sub
|
||||
Monday Tuesday Wednesday Thursday Friday Saturday Sunday
|
||||
Monday
|
||||
Monday
|
||||
@@ -359,6 +369,7 @@ ednesday
|
||||
onday
|
||||
uesday
|
||||
ednesday
|
||||
array11.sub
|
||||
version[agent]
|
||||
version.agent
|
||||
version[agent]
|
||||
@@ -369,15 +380,18 @@ foobar] foo foo[bar]
|
||||
bleh bbb bleh
|
||||
ab]
|
||||
bar
|
||||
array12.sub
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
array13.sub
|
||||
main main
|
||||
function function
|
||||
function function
|
||||
array14.sub
|
||||
declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="5")
|
||||
declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4")
|
||||
declare -a x=([0]="0" [1]="1" [2]="2" [4]="4")
|
||||
@@ -389,6 +403,7 @@ declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="foo")
|
||||
declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="5")
|
||||
declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4four" [5]="5")
|
||||
strlen(4four) = 5
|
||||
array15.sub
|
||||
1 2 0 3
|
||||
1 2 0 3
|
||||
1 2 0 3
|
||||
@@ -396,6 +411,7 @@ strlen(4four) = 5
|
||||
1 2 0 3
|
||||
declare -ai arr=([0]="2" [1]="4" [2]="6")
|
||||
declare -a arr=([0]="hello" [1]="world")
|
||||
array16.sub
|
||||
foo index 1: ok
|
||||
foo index 2: ok
|
||||
foo: implicit reference to element 0: ok
|
||||
@@ -408,6 +424,7 @@ qux: unset array element 0: ok
|
||||
0
|
||||
0
|
||||
0
|
||||
array17.sub
|
||||
2
|
||||
2
|
||||
2
|
||||
@@ -431,6 +448,7 @@ one
|
||||
two
|
||||
two
|
||||
./array17.sub: line 89: ~ : arithmetic syntax error: operand expected (error token is "~ ")
|
||||
array18.sub
|
||||
1
|
||||
argv[1] = <>
|
||||
argv[2] = <>
|
||||
@@ -454,6 +472,7 @@ argv[1] = <qux>
|
||||
argv[1] = <->
|
||||
argv[2] = <->
|
||||
argv[1] = < >
|
||||
array19.sub
|
||||
declare -a foo=([0]="( zeroind )")
|
||||
declare -a foo=([0]="zeroind")
|
||||
declare -a foo=([0]="zeroind")
|
||||
@@ -498,6 +517,7 @@ declare -A b=([0]="/scratch/bash" )
|
||||
declare -A c=([1]="2" )
|
||||
declare -A d=(["a b"]="" )
|
||||
declare -A e=([Darwin]="" )
|
||||
array20.sub
|
||||
a+b+c
|
||||
x+b+c
|
||||
a+b+c
|
||||
@@ -508,6 +528,7 @@ a b c
|
||||
x b c
|
||||
a b c
|
||||
x b c
|
||||
array21.sub
|
||||
declare -a a=([1]="2" [2]="3" [3]="4")
|
||||
abcd
|
||||
unset
|
||||
@@ -516,6 +537,7 @@ declare -A A=([four]="4" [two]="2" [three]="3" [one]="1" )
|
||||
declare -a a=()
|
||||
declare -A A=()
|
||||
declare -a foo=([0]="1" [1]="(4 5 6)" [2]="3")
|
||||
array22.sub
|
||||
a1
|
||||
argv[1] = <>
|
||||
argv[2] = <>
|
||||
@@ -537,6 +559,7 @@ p3
|
||||
argv[1] = <y>
|
||||
<X> <X> <X> <X>
|
||||
<X> <X> <X> <X>
|
||||
array23.sub
|
||||
./array23.sub: line 22: $( echo >&2 foo ) : arithmetic syntax error: operand expected (error token is "$( echo >&2 foo ) ")
|
||||
./array23.sub: line 23: $( echo >&2 foo ) : arithmetic syntax error: operand expected (error token is "$( echo >&2 foo ) ")
|
||||
./array23.sub: line 24: $( echo >&2 foo ) : arithmetic syntax error: operand expected (error token is "$( echo >&2 foo ) ")
|
||||
@@ -548,6 +571,7 @@ argv[1] = <y>
|
||||
0
|
||||
0
|
||||
0
|
||||
array24.sub
|
||||
IFS=: ${var-$*}
|
||||
abc
|
||||
def ghi
|
||||
@@ -595,6 +619,7 @@ jkl
|
||||
abc
|
||||
def ghi
|
||||
jkl
|
||||
array25.sub
|
||||
1. indexed:
|
||||
reference:
|
||||
1. 0
|
||||
@@ -639,6 +664,7 @@ arithmetic:
|
||||
6.declare -A a=([1]="1" [0]="0" [" "]="10" ["\" \""]="11" )
|
||||
7.declare -A a=([1]="1" [0]="0" [" "]="12" ["\" \""]="11" )
|
||||
8.declare -A a=([1]="1" [0]="0" [" "]="12" ["\" \""]="13" )
|
||||
array26.sub
|
||||
argv[1] = <aa>
|
||||
argv[2] = <bb>
|
||||
argv[1] = <aa>
|
||||
@@ -759,6 +785,7 @@ argv[2] = <a>
|
||||
argv[1] = <b>
|
||||
argv[2] = <a>
|
||||
argv[1] = <b+a>
|
||||
array27.sub
|
||||
7
|
||||
7
|
||||
declare -A A=([$'\t']="2" [" "]="2" )
|
||||
@@ -774,12 +801,14 @@ declare -A A=(["*"]="X" ["@"]="X" )
|
||||
declare -A A=(["*"]="X" ["@"]="X" )
|
||||
./array27.sub: line 81: y[]: bad array subscript
|
||||
./array27.sub: line 81: y[]: bad array subscript
|
||||
array28.sub
|
||||
declare -a bug4=([0]="" [1]="5" [2]="" [3]="1" [4]="")
|
||||
declare -a bug=([0]="" [1]="5" [2]="" [3]="1" [4]="")
|
||||
declare -a bug2=([0]="")
|
||||
declare -a bug3=([0]="" [1]="5" [2]="" [3]="1" [4]="")
|
||||
declare -a not_bug=([0]="no" [1]="nulls")
|
||||
declare -a workaround=([0]="")
|
||||
array29.sub
|
||||
declare -a var=([0]=$'\001\001\001\001')
|
||||
declare -A v2=([$'\001']=$'ab\001c' )
|
||||
declare -a foo=([0]=$'\001\001\001\001')
|
||||
@@ -790,6 +819,7 @@ declare -A foo=([v]=$'\001\001\001\001' )
|
||||
declare -A foo=([v]=$'\001\001\001\001' )
|
||||
declare -A foo=([$'\001']=$'ab\001c' )
|
||||
declare -A foo=([$'\001']=$'ab\001c' )
|
||||
array30.sub
|
||||
foo
|
||||
declare -a a=([42]="foo")
|
||||
foo
|
||||
@@ -802,12 +832,14 @@ FOO
|
||||
declare -Au A=([Darwin]="FOO" )
|
||||
FOO
|
||||
declare -Au A=(["@"]="FOO" )
|
||||
array31.sub
|
||||
declare -a aa=([0]="/homes/cj/Desktop")
|
||||
declare -a aa=([0]="/homes/cj/Desktop")
|
||||
declare -a aa=([0]="/homes/cj/Desktop:/homes/cj/Library:/homes/cj/Documents")
|
||||
declare -a aa=([0]="/homes/cj/Desktop:/homes/cj/Library:/homes/cj/Documents")
|
||||
declare -a aa=([0]="/homes/cj/Desktop:/homes/cj/Library:/homes/cj/Documents" [1]="/homes/cj/Applications")
|
||||
declare -a aa=([0]="/homes/cj/Desktop:/homes/cj/Library:/homes/cj/Documents" [1]="/homes/cj/Applications")
|
||||
array32.sub
|
||||
./array32.sub: line 20: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 21: declare: a: not found
|
||||
./array32.sub: line 24: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
@@ -837,6 +869,7 @@ declare -a a
|
||||
declare -a a=()
|
||||
./array32.sub: line 95: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
declare -a a=()
|
||||
array33.sub
|
||||
declare -A A=([x]="x" )
|
||||
declare -A A=([1]="1" )
|
||||
./array33.sub: line 27: f: A: cannot convert associative to indexed array
|
||||
|
||||
+34
-33
@@ -11,6 +11,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
. ./test-aux-functions
|
||||
|
||||
# Filter stdin to remove builtin array variables that are
|
||||
# automatically set and possibly contain values that vary.
|
||||
@@ -270,14 +271,14 @@ badarray=( metacharacters like & need to be quoted in compound assignments)
|
||||
set -u
|
||||
( echo ${#narray[4]} )
|
||||
|
||||
${THIS_SH} ./array1.sub
|
||||
${THIS_SH} ./array2.sub
|
||||
test_runsub ./array1.sub
|
||||
test_runsub ./array2.sub
|
||||
|
||||
# some old bugs and ksh93 compatibility tests
|
||||
${THIS_SH} ./array3.sub
|
||||
test_runsub ./array3.sub
|
||||
|
||||
# some compound assignment parsing problems that showed up in bash-3.1-release
|
||||
${THIS_SH} ./array4.sub
|
||||
test_runsub ./array4.sub
|
||||
|
||||
set +u
|
||||
cd ${TMPDIR:=/tmp}
|
||||
@@ -426,35 +427,35 @@ BASH_ARGV[1]=foo ; echo FIN5:$?
|
||||
declare BASH_ARGV[1]=foo ; echo FIN6:$?
|
||||
|
||||
# tests for bash-3.1 problems
|
||||
${THIS_SH} ./array5.sub
|
||||
test_runsub ./array5.sub
|
||||
|
||||
# tests for post-bash-3.2 problems, most fixed in bash-3.2 patches
|
||||
${THIS_SH} ./array6.sub
|
||||
${THIS_SH} ./array7.sub
|
||||
test_runsub ./array6.sub
|
||||
test_runsub ./array7.sub
|
||||
|
||||
${THIS_SH} ./array8.sub
|
||||
${THIS_SH} ./array9.sub
|
||||
${THIS_SH} ./array10.sub
|
||||
${THIS_SH} ./array11.sub
|
||||
${THIS_SH} ./array12.sub
|
||||
${THIS_SH} ./array13.sub
|
||||
${THIS_SH} ./array14.sub
|
||||
${THIS_SH} ./array15.sub
|
||||
${THIS_SH} ./array16.sub
|
||||
${THIS_SH} ./array17.sub
|
||||
${THIS_SH} ./array18.sub
|
||||
${THIS_SH} ./array19.sub
|
||||
${THIS_SH} ./array20.sub
|
||||
${THIS_SH} ./array21.sub
|
||||
${THIS_SH} ./array22.sub
|
||||
${THIS_SH} ./array23.sub
|
||||
${THIS_SH} ./array24.sub
|
||||
${THIS_SH} ./array25.sub
|
||||
${THIS_SH} ./array26.sub
|
||||
${THIS_SH} ./array27.sub
|
||||
${THIS_SH} ./array28.sub
|
||||
${THIS_SH} ./array29.sub
|
||||
${THIS_SH} ./array30.sub
|
||||
${THIS_SH} ./array31.sub
|
||||
${THIS_SH} ./array32.sub
|
||||
${THIS_SH} ./array33.sub
|
||||
test_runsub ./array8.sub
|
||||
test_runsub ./array9.sub
|
||||
test_runsub ./array10.sub
|
||||
test_runsub ./array11.sub
|
||||
test_runsub ./array12.sub
|
||||
test_runsub ./array13.sub
|
||||
test_runsub ./array14.sub
|
||||
test_runsub ./array15.sub
|
||||
test_runsub ./array16.sub
|
||||
test_runsub ./array17.sub
|
||||
test_runsub ./array18.sub
|
||||
test_runsub ./array19.sub
|
||||
test_runsub ./array20.sub
|
||||
test_runsub ./array21.sub
|
||||
test_runsub ./array22.sub
|
||||
test_runsub ./array23.sub
|
||||
test_runsub ./array24.sub
|
||||
test_runsub ./array25.sub
|
||||
test_runsub ./array26.sub
|
||||
test_runsub ./array27.sub
|
||||
test_runsub ./array28.sub
|
||||
test_runsub ./array29.sub
|
||||
test_runsub ./array30.sub
|
||||
test_runsub ./array31.sub
|
||||
test_runsub ./array32.sub
|
||||
test_runsub ./array33.sub
|
||||
|
||||
+25
-6
@@ -7,15 +7,15 @@ declare -A fluff=([foo]="one" [bar]="two" )
|
||||
declare -A fluff=([foo]="one" [bar]="two" )
|
||||
declare -A fluff=([bar]="two" )
|
||||
declare -A fluff=([qux]="assigned" [bar]="newval" )
|
||||
./assoc.tests: line 39: chaff: four: must use subscript when assigning associative array
|
||||
./assoc.tests: line 41: chaff: four: must use subscript when assigning associative array
|
||||
declare -A BASH_ALIASES=()
|
||||
declare -A BASH_CMDS=()
|
||||
declare -Ai chaff=([one]="10" [zero]="5" )
|
||||
declare -Ar waste=([pid]="42134" [lineno]="41" [source]="./assoc.tests" [version]="4.0-devel" )
|
||||
declare -Ar waste=([pid]="42134" [lineno]="43" [source]="./assoc.tests" [version]="4.0-devel" )
|
||||
declare -A wheat=([two]="b" [three]="c" [one]="a" [zero]="0" )
|
||||
declare -A chaff=(["hello world"]="flip" [one]="10" [zero]="5" )
|
||||
./assoc.tests: line 51: waste: readonly variable
|
||||
./assoc.tests: line 52: unset: waste: cannot unset: readonly variable
|
||||
./assoc.tests: line 53: waste: readonly variable
|
||||
./assoc.tests: line 54: unset: waste: cannot unset: readonly variable
|
||||
declare -A chaff=(["*"]="12" ["hello world"]="flip" [one]="a" )
|
||||
flip
|
||||
argv[1] = <multiple>
|
||||
@@ -33,14 +33,14 @@ argv[3] = <12>
|
||||
argv[4] = <flip>
|
||||
argv[5] = <a>
|
||||
argv[1] = <multiple words 12 flip a>
|
||||
./assoc.tests: line 71: declare: chaff: cannot destroy array variables in this way
|
||||
./assoc.tests: line 73: declare: chaff: cannot destroy array variables in this way
|
||||
declare -A wheat=([six]="6" ["foo bar"]="qux qix" )
|
||||
argv[1] = <qux>
|
||||
argv[2] = <qix>
|
||||
argv[1] = <qux qix>
|
||||
declare -A wheat=([six]="6" ["foo bar"]="qux qix" )
|
||||
argv[1] = <2>
|
||||
./assoc.tests: line 99: [$unset]: bad array subscript
|
||||
./assoc.tests: line 101: [$unset]: bad array subscript
|
||||
0
|
||||
argv[1] = <7>
|
||||
argv[1] = <qux>
|
||||
@@ -78,6 +78,7 @@ bin bin . bin ucb sbin bin sbin
|
||||
\usr\local\bin \bin . \usr\bin \usr\ucb \usr\sbin \bin \sbin
|
||||
\usr\local\bin \bin . \usr\bin \usr\ucb \usr\sbin \bin \sbin
|
||||
([a]=1)
|
||||
assoc1.sub
|
||||
|
||||
foo qux
|
||||
/usr/sbin/foo /usr/local/bin/qux
|
||||
@@ -88,6 +89,7 @@ hits command
|
||||
0 /usr/local/bin/qux
|
||||
foo sh blat qux
|
||||
/usr/sbin/foo /bin/sh /sbin/blat /usr/local/bin/qux
|
||||
assoc2.sub
|
||||
|
||||
foo qux
|
||||
argv[1] = </usr/sbin/foo>
|
||||
@@ -102,6 +104,7 @@ argv[1] = <cd /blat ; echo $PWD>
|
||||
argv[2] = </usr/sbin/foo>
|
||||
argv[3] = </bin/bash --login -o posix>
|
||||
argv[4] = </usr/local/bin/qux -l>
|
||||
assoc3.sub
|
||||
outside: outside
|
||||
declare -A BASH_ALIASES=()
|
||||
declare -A BASH_CMDS=()
|
||||
@@ -110,6 +113,7 @@ argv[1] = <inside:>
|
||||
argv[2] = <six>
|
||||
argv[3] = <foo quux>
|
||||
outside 2: outside
|
||||
assoc4.sub
|
||||
argv[1] = </barq//fooq>
|
||||
argv[1] = <>
|
||||
argv[2] = <barq>
|
||||
@@ -135,6 +139,7 @@ argv[1] = <>
|
||||
argv[2] = <BARQ>
|
||||
argv[3] = <>
|
||||
argv[4] = <FOOQ>
|
||||
assoc5.sub
|
||||
abc
|
||||
def
|
||||
def
|
||||
@@ -144,6 +149,7 @@ myarray=(["]"]="def" [foo]="bleh" ["a]a"]="abc" ["a]=test1;#a"]="123" )
|
||||
|
||||
123
|
||||
myarray=(["]"]="def" ["a]=test2;#a"]="def" [foo]="bleh" ["a]a"]="abc" ["a]=test1;#a"]="123" )
|
||||
assoc6.sub
|
||||
bar"bie
|
||||
doll
|
||||
declare -A foo=(["bar\"bie"]="doll" )
|
||||
@@ -189,6 +195,7 @@ declare -A foo=(["bar\\]bie"]="doll" )
|
||||
bar${foo}bie
|
||||
doll
|
||||
declare -A foo=(["bar\${foo}bie"]="doll" )
|
||||
assoc7.sub
|
||||
bar
|
||||
after printf
|
||||
after use: 0
|
||||
@@ -198,6 +205,8 @@ declare -A assoc=([two]="twoless" [three]="three" [one]="onemore" )
|
||||
declare -Ar assoc=([two]="twoless" [three]="three" [one]="onemore" )
|
||||
declare -A hash=([key]="value1" )
|
||||
declare -A hash=([key]="value1 value2" )
|
||||
assoc8.sub
|
||||
assoc9.sub
|
||||
declare -A b=([")"]="" ["\""]="" ["]"]="" ["\\"]="" ["\`"]="" )
|
||||
declare -A b=(["]"]="" ["\`"]="" )
|
||||
declare -A dict=(["'"]="3" ["\""]="1" ["\\"]="4" ["\`"]="2" )
|
||||
@@ -228,6 +237,7 @@ declare -A assoc=()
|
||||
foo]bar
|
||||
bip
|
||||
declare -A foo=(["foo]bar"]="bip" )
|
||||
assoc10.sub
|
||||
./assoc10.sub: line 14: declare: a: cannot convert indexed to associative array
|
||||
f: declare -a a
|
||||
./assoc10.sub: line 17: declare: a: cannot convert associative to indexed array
|
||||
@@ -237,6 +247,7 @@ f: declare -a a
|
||||
main: declare -- a="7"
|
||||
f: declare -A a
|
||||
main: declare -- a="42"
|
||||
assoc11.sub
|
||||
declare -A a=([3]="" [1]="2" )
|
||||
declare -A foo=([d]="4" [c]="3" [b]="2" [a]="1" )
|
||||
foo=( d "4" c "3" b "2" a "1" )
|
||||
@@ -263,6 +274,7 @@ declare -A a=([")"]="rparen" ["\""]="dquote" ["]"]="rbracket" ["\\"]="bs" )
|
||||
declare -A a=([")"]="rparen" ["\""]="dquote" ["]"]="rbracket" ["\\"]="bs" )
|
||||
declare -Arx foo=([two]="2" [three]="3" [one]="1" )
|
||||
./assoc11.sub: line 90: foo: readonly variable
|
||||
assoc12.sub
|
||||
declare -A v1=(["1 2"]="3" )
|
||||
declare -A v2=(["1 2"]="3" )
|
||||
declare -A v3=(["1 2"]="3" )
|
||||
@@ -281,6 +293,7 @@ declare -A v3=(["1 2"]="3 4 5" ["\$xtra"]="xtra" )
|
||||
declare -A v1=(["20 40 80"]="new xtra" ["1 2"]="3 4 5" )
|
||||
declare -A v2=(["20 40 80"]="new xtra" ["1 2"]="3 4 5" )
|
||||
declare -A v3=(["1 2"]="3 4 5" ["\$xtra"]="new xtra" )
|
||||
assoc13.sub
|
||||
declare -A assoc=(["*"]="star" ["!"]="bang" ["@"]="at" )
|
||||
at
|
||||
star
|
||||
@@ -290,6 +303,7 @@ declare -a ia
|
||||
declare -A a=(["@"]="at2" )
|
||||
declare -A a=(["@"]=" string" )
|
||||
declare -A a=(["*"]="star2" ["@"]="at" )
|
||||
assoc14.sub
|
||||
declare -A assoc=([hello]="world" ["key with spaces"]="value with spaces" [foo]="bar" [one]="1" )
|
||||
argv[1] = <world>
|
||||
argv[2] = <value with spaces>
|
||||
@@ -331,6 +345,7 @@ argv[7] = <'foo'>
|
||||
argv[8] = <'bar'>
|
||||
declare -A clone=([hello]="world" ["key with spaces"]="value with spaces" [foo]="bar" [one]="1" )
|
||||
declare -A posparams=([hello]="world" ["key with spaces"]="value with spaces" [foo]="bar" [one]="1" )
|
||||
assoc15.sub
|
||||
declare -A var=([$'\001']=$'\001\001\001\001' )
|
||||
declare -A v2=([$'\001']=$'\001\001\001\001' )
|
||||
argv[1] = <^A>
|
||||
@@ -354,6 +369,7 @@ declare -A var=([two]=$'ab\001cd' [one]=$'\001\001\001\001' )
|
||||
declare -A foo=([two]=$'ab\001cd' [one]=$'\001\001\001\001' )
|
||||
declare -A foo=([$'\001']=$'ab\001cd' )
|
||||
declare -A foo=([$'\001']=$'\001\001\001\001' )
|
||||
assoc16.sub
|
||||
declare -A A=(["\$(echo Darwin ; echo stderr>&2)"]="darjeeling" [Darwin]="darjeeling" )
|
||||
stderr
|
||||
darjsharking
|
||||
@@ -385,6 +401,7 @@ set
|
||||
stderr
|
||||
42
|
||||
42
|
||||
assoc17.sub
|
||||
declare -A A=(["]"]="rbracket" ["["]="lbracket" )
|
||||
declare -A A=()
|
||||
declare -A A=(["]"]="rbracket" ["["]="lbracket" )
|
||||
@@ -395,11 +412,13 @@ declare -A A=(["]"]="rbracket" ["["]="lbracket" )
|
||||
declare -A A=()
|
||||
declare -A A=(["]"]="rbracket" ["["]="lbracket" )
|
||||
declare -A A=()
|
||||
assoc18.sub
|
||||
declare -A A=(["]"]="rbracket" ["["]="lbracket" )
|
||||
declare -A A=()
|
||||
declare -A A=(["]"]="rbracket" ["["]="lbracket" )
|
||||
declare -A A=()
|
||||
5: ok 1
|
||||
assoc19.sub
|
||||
declare -A aa=([key]="/homes/cj/Desktop" )
|
||||
declare -A aa=([key]="/homes/cj/Desktop" )
|
||||
declare -A aa=([k2]="/homes/cj/Library" [key]="/homes/cj/Desktop" )
|
||||
|
||||
+21
-19
@@ -11,6 +11,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
. ./test-aux-functions
|
||||
|
||||
# TEST - basic declaration and assignment
|
||||
typeset -A fluff
|
||||
declare -A
|
||||
@@ -199,19 +201,19 @@ if [ "$T" != "${T[0]}" ]; then
|
||||
echo 'assoc.tests: $T and ${T[0]} mismatch'
|
||||
fi
|
||||
|
||||
${THIS_SH} ./assoc1.sub
|
||||
test_runsub ./assoc1.sub
|
||||
|
||||
${THIS_SH} ./assoc2.sub
|
||||
test_runsub ./assoc2.sub
|
||||
|
||||
${THIS_SH} ./assoc3.sub
|
||||
test_runsub ./assoc3.sub
|
||||
|
||||
${THIS_SH} ./assoc4.sub
|
||||
test_runsub ./assoc4.sub
|
||||
|
||||
${THIS_SH} ./assoc5.sub
|
||||
test_runsub ./assoc5.sub
|
||||
|
||||
${THIS_SH} ./assoc6.sub
|
||||
test_runsub ./assoc6.sub
|
||||
|
||||
${THIS_SH} ./assoc7.sub
|
||||
test_runsub ./assoc7.sub
|
||||
|
||||
# test converting between scalars and assoc arrays
|
||||
unset assoc
|
||||
@@ -240,36 +242,36 @@ declare -p hash
|
||||
|
||||
unset hash
|
||||
|
||||
${THIS_SH} ./assoc8.sub
|
||||
test_runsub ./assoc8.sub
|
||||
|
||||
# new shopt option to prevent multiple expansion of assoc array subscripts
|
||||
${THIS_SH} ./assoc9.sub
|
||||
test_runsub ./assoc9.sub
|
||||
|
||||
${THIS_SH} ./assoc10.sub
|
||||
test_runsub ./assoc10.sub
|
||||
|
||||
# test assigning associative arrays using compound key/value pair assignments
|
||||
${THIS_SH} ./assoc11.sub
|
||||
test_runsub ./assoc11.sub
|
||||
|
||||
# more kvpair associative array assignment tests
|
||||
${THIS_SH} ./assoc12.sub
|
||||
test_runsub ./assoc12.sub
|
||||
|
||||
# assignment to @ and *
|
||||
${THIS_SH} ./assoc13.sub
|
||||
test_runsub ./assoc13.sub
|
||||
|
||||
# tests of the @k transformation on associative arrays
|
||||
${THIS_SH} ./assoc14.sub
|
||||
test_runsub ./assoc14.sub
|
||||
|
||||
# tests with subscripts and values containing 0x01 (some indexed array tests too)
|
||||
${THIS_SH} ./assoc15.sub
|
||||
test_runsub ./assoc15.sub
|
||||
|
||||
# tests with subscripts being expanded more than one in ${xxx} word expansions
|
||||
${THIS_SH} ./assoc16.sub
|
||||
test_runsub ./assoc16.sub
|
||||
|
||||
# tests with `[' and `]' subscripts and `unset'
|
||||
${THIS_SH} ./assoc17.sub
|
||||
test_runsub ./assoc17.sub
|
||||
|
||||
# tests with `[' and `]' subscripts and printf/read/wait builtins
|
||||
${THIS_SH} ./assoc18.sub
|
||||
test_runsub ./assoc18.sub
|
||||
|
||||
# tests with tilde expansion in keys and values post-bash-5.2
|
||||
${THIS_SH} ./assoc19.sub
|
||||
test_runsub ./assoc19.sub
|
||||
|
||||
+5
-3
@@ -1,13 +1,14 @@
|
||||
after f1:declare -ar a=([0]="1")
|
||||
./attr.tests: line 17: f2: a: readonly variable
|
||||
./attr.tests: line 19: f2: a: readonly variable
|
||||
after f2:declare -ar a=([0]="1")
|
||||
./attr.tests: line 18: a: readonly variable
|
||||
./attr.tests: line 20: a: readonly variable
|
||||
after f3:declare -ar a=([0]="1")
|
||||
./attr.tests: line 19: readonly: a: readonly variable
|
||||
./attr.tests: line 21: readonly: a: readonly variable
|
||||
after f4:declare -ar a=([0]="1")
|
||||
after f2:declare -ar b=([0]="2")
|
||||
after f3:declare -ar c=([0]="(3)")
|
||||
after f4:declare -ar d=([0]="4")
|
||||
attr1.sub
|
||||
declare -r m="4"
|
||||
in func:declare -r n="4"
|
||||
declare -r n="4"
|
||||
@@ -30,6 +31,7 @@ in func:declare -ar y1=([0]="4")
|
||||
declare -ar y1=([0]="4")
|
||||
in func:declare -ar z1=([0]="4")
|
||||
declare -ar z1=([0]="4")
|
||||
attr2.sub
|
||||
declare -x p="4"
|
||||
declare -ax r=([0]="4")
|
||||
declare -ax r=([0]="(5)")
|
||||
|
||||
+4
-3
@@ -11,6 +11,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
. ./test-aux-functions
|
||||
|
||||
a=(outside)
|
||||
|
||||
f1() { readonly a=(1) ; }
|
||||
@@ -49,6 +51,5 @@ f4
|
||||
echo -n after f4:
|
||||
declare -p d
|
||||
|
||||
${THIS_SH} ./attr1.sub
|
||||
${THIS_SH} ./attr2.sub
|
||||
|
||||
test_runsub ./attr1.sub
|
||||
test_runsub ./attr2.sub
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ echo and ${word-${ echo work here; }}
|
||||
unset x
|
||||
|
||||
set -- 'a[${ break;}]'
|
||||
declare -in x
|
||||
declare -n x
|
||||
|
||||
for x do :; done
|
||||
echo after for
|
||||
|
||||
+1
-1
@@ -148,7 +148,7 @@ ${THIS_SH} ./exec6.sub
|
||||
# checks for properly deciding what constitutes an executable file
|
||||
${THIS_SH} ./exec7.sub
|
||||
|
||||
${THIS_SH} -i ${PWD}/exec8.sub
|
||||
HISTFILE= ${THIS_SH} --norc -i ${PWD}/exec8.sub
|
||||
|
||||
${THIS_SH} ./exec9.sub
|
||||
|
||||
|
||||
+4
-3
@@ -534,7 +534,7 @@ declare -a array=([0]="one" [1]="two" [2]="three")
|
||||
declare -ai a=([0]="5")
|
||||
declare -ai a=([0]="6")
|
||||
declare -ai a=([0]="42")
|
||||
./nameref23.sub: line 28: declare: a[0]: expands to invalid variable name for name reference
|
||||
./nameref23.sub: line 28: declare: cannot use -n with -i
|
||||
declare -ai a=([0]="1")
|
||||
./nameref23.sub: line 29: declare: b: not found
|
||||
declare -ai a=([0]="1")
|
||||
@@ -546,10 +546,11 @@ declare -- b="110"
|
||||
./nameref23.sub: line 39: declare: `1': invalid variable name for name reference
|
||||
declare -ai a=([0]="1")
|
||||
./nameref23.sub: line 41: declare: b: not found
|
||||
./nameref23.sub: line 48: declare: cannot use -n with -i
|
||||
declare -ai a=([0]="4")
|
||||
declare -in b="a[0]"
|
||||
declare -n b="a[0]"
|
||||
declare -ai a=([0]="6")
|
||||
declare -in b="a[0]"
|
||||
declare -n b="a[0]"
|
||||
foo
|
||||
foo bar
|
||||
declare -a a=([0]="" [1]="foo bar")
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ unset a ; unset -n b
|
||||
#####
|
||||
declare -ai a=('4');
|
||||
declare -n b='a[0]';
|
||||
declare -ni b; # this should maybe not be allowed, but it is for now
|
||||
declare -ni b; # this is now disallowed; doesn't change attributes
|
||||
declare -p a b
|
||||
|
||||
b+=2;
|
||||
|
||||
Reference in New Issue
Block a user