mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-03 10:20:49 +02:00
fixes for read builtin with backslash escapes; change history builtin behavior when HISTFILE is unset or null; change to compopt to make it use the name from the actual compspec it uses; fix for executing coproc in functions; fix for array variables and declare -g
This commit is contained in:
@@ -7315,3 +7315,48 @@ bashline.c
|
||||
- print_unix_command_map: make sure to set rl_macro_display_hook to
|
||||
print_unix_command before calling rl_macro_dumper to print the
|
||||
bound command strings
|
||||
|
||||
8/1
|
||||
---
|
||||
builtins/read.def
|
||||
- read_builtin: saw_escape is now a count of CTLESCs we added to the
|
||||
input
|
||||
- read_builtin: since we increment saw_escape when we add a CTLESC,
|
||||
decrement it when we remove one from the input (\\\n, \\\0)
|
||||
- read_builtin: remove the CTLESC we added if we have a backslash-
|
||||
escaped NULL character ('\0')
|
||||
- read_builtin: if the input ends with an unescaped newline, remove
|
||||
the CTLESC we added
|
||||
From a report by Grisha Levit <grishalevit@gmail.com>
|
||||
|
||||
8/2
|
||||
---
|
||||
builtins/history.def
|
||||
- history_builtin: if history -[anrw] is used without a filename
|
||||
argument, and HISTFILE is unset or null, return success immediately
|
||||
From a report by Grisha Levit <grishalevit@gmail.com>
|
||||
|
||||
doc/{bash.1,bashref.texi},lib/readline/doc/hsuser.texi
|
||||
- history: document that if filename is not supplied, and HISTFILE is
|
||||
unset or null, the [-anrw] options have no effect
|
||||
|
||||
8/3
|
||||
---
|
||||
pcomplete.c
|
||||
- gen_progcomp_completions: if the actual compspec that's run is
|
||||
something different from what's typed (full pathname, alias, etc.),
|
||||
set pcomp_curcmd to the word corresponding to the actual compspec,
|
||||
instead of what was typed. This is what eventually gets used by
|
||||
the compopt builtin's output.
|
||||
From a report by Grisha Levit <grishalevit@gmail.com>
|
||||
|
||||
execute_cmd.c
|
||||
- execute_coproc: in parent, close /dev/fd FIFOs only if we're not
|
||||
executing a shell function, like other calls to unlink_fifo_list().
|
||||
Report from Hal Blackburn in
|
||||
https://savannah.gnu.org/support/index.php?110910
|
||||
|
||||
subst.c
|
||||
- do_compound_assignment: don't attempt to convert a global associative
|
||||
array to an indexed array with declare -g.
|
||||
From a report and patch by Grisha Levit <grishalevit@gmail.com>
|
||||
|
||||
@@ -407,6 +407,12 @@ bash_delete_last_history (void)
|
||||
return r;
|
||||
}
|
||||
|
||||
char *
|
||||
bash_default_histfile (void)
|
||||
{
|
||||
return (bash_tilde_expand (posixly_correct ? "~/.sh_history" : "~/.bash_history", 0));
|
||||
}
|
||||
|
||||
#ifdef INCLUDE_UNUSED
|
||||
/* Write the existing history out to the history file. */
|
||||
void
|
||||
|
||||
@@ -74,6 +74,7 @@ extern int bash_delete_history_range (int, int);
|
||||
extern int bash_delete_last_history (void);
|
||||
extern void load_history (void);
|
||||
extern void save_history (void);
|
||||
extern char *bash_default_histfile (void);
|
||||
extern int maybe_append_history (char *);
|
||||
extern int maybe_save_shell_history (void);
|
||||
extern char *pre_process_line (char *, int, int);
|
||||
|
||||
+13
-1
@@ -46,7 +46,9 @@ Options:
|
||||
-s append the ARGs to the history list as a single entry
|
||||
|
||||
If FILENAME is given, it is used as the history file. Otherwise,
|
||||
if HISTFILE has a value, that is used, else ~/.bash_history.
|
||||
if HISTFILE has a value, that is used. If FILENAME is not supplied
|
||||
and HISTFILE is unset or null, the -a, -n, -r, and -w options have
|
||||
no effect and return success.
|
||||
|
||||
If the HISTTIMEFORMAT variable is set and not null, its value is used
|
||||
as a format string for strftime(3) to print the time stamp associated
|
||||
@@ -267,6 +269,16 @@ history_builtin (WORD_LIST *list)
|
||||
filename = list ? list->word->word : get_string_value ("HISTFILE");
|
||||
result = EXECUTION_SUCCESS;
|
||||
|
||||
if (filename == 0 || *filename == 0)
|
||||
{
|
||||
if (interactive_shell == 0 || interactive)
|
||||
if (list && filename == list->word->word)
|
||||
builtin_error (_("empty filename"));
|
||||
else
|
||||
builtin_error (_("%s: parameter null or not set"), "HISTFILE");
|
||||
return (interactive ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
|
||||
}
|
||||
|
||||
#if defined (RESTRICTED_SHELL)
|
||||
if (restricted && strchr (filename, '/'))
|
||||
{
|
||||
|
||||
+18
-4
@@ -404,7 +404,7 @@ read_builtin (WORD_LIST *list)
|
||||
input_string[0] = '\0';
|
||||
|
||||
pass_next = 0; /* Non-zero signifies last char was backslash. */
|
||||
saw_escape = 0; /* Non-zero signifies that we saw an escape char */
|
||||
saw_escape = 0; /* Non-zero is count of escape chars we added */
|
||||
|
||||
/* More input and options validation */
|
||||
if (nflag == 1 && nchars == 0)
|
||||
@@ -751,11 +751,14 @@ read_builtin (WORD_LIST *list)
|
||||
if (pass_next)
|
||||
{
|
||||
pass_next = 0;
|
||||
if (c == '\n')
|
||||
if (c == '\n' || c == '\0')
|
||||
{
|
||||
if (skip_ctlesc == 0 && i > 0)
|
||||
i--; /* back up over the CTLESC */
|
||||
if (interactive && input_is_tty && raw == 0)
|
||||
{
|
||||
i--; /* back up over the CTLESC */
|
||||
saw_escape--; /* one fewer CTLESC in the input */
|
||||
}
|
||||
if (interactive && input_is_tty && raw == 0 && c == '\n')
|
||||
print_ps2 = 1;
|
||||
}
|
||||
else
|
||||
@@ -825,6 +828,17 @@ add_char:
|
||||
if (nchars > 0 && nr >= nchars)
|
||||
break;
|
||||
}
|
||||
/* Back up over trailing CTLESC if the input ends with an unescaped
|
||||
backslash */
|
||||
if (pass_next && skip_ctlesc == 0)
|
||||
{
|
||||
i--;
|
||||
saw_escape--; /* that CTLESC is no longer in the input */
|
||||
}
|
||||
/* I don't think this clause ever tests true. */
|
||||
if (skip_ctlnul && saw_escape && i == 1 && input_string[0] == CTLNUL)
|
||||
saw_escape = 0; /* Avoid dequoting bare CTLNUL */
|
||||
|
||||
input_string[i] = '\0';
|
||||
check_read_timeout ();
|
||||
|
||||
|
||||
+24
-16
@@ -5,14 +5,14 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\"
|
||||
.\" Last Change: Mon Jul 31 15:50:16 EDT 2023
|
||||
.\" Last Change: Wed Aug 2 16:03:53 EDT 2023
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.\" avoid a warning about an undefined register
|
||||
.\" .if !rzY .nr zY 0
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2023 July 31" "GNU Bash 5.3"
|
||||
.TH BASH 1 "2023 August 2" "GNU Bash 5.3"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -792,7 +792,7 @@ indices. The element of
|
||||
.B BASH_REMATCH
|
||||
with index \fIn\fP is the portion of the
|
||||
string matching the \fIn\fPth parenthesized subexpression.
|
||||
Bash sets
|
||||
\fBBash\fP sets
|
||||
.SM
|
||||
.B BASH_REMATCH
|
||||
in the global scope; declaring it as a local variable will lead to
|
||||
@@ -2199,7 +2199,7 @@ A sample value is
|
||||
.TP
|
||||
.B CHILD_MAX
|
||||
Set the number of exited child status values for the shell to remember.
|
||||
Bash will not allow this value to be decreased below a POSIX-mandated
|
||||
\fBBash\fP will not allow this value to be decreased below a POSIX-mandated
|
||||
minimum, and there is a maximum value (currently 8192) that this may
|
||||
not exceed.
|
||||
The minimum value is system-dependent.
|
||||
@@ -2346,8 +2346,10 @@ not tested, and are added to the history regardless of the value of
|
||||
The name of the file in which command history is saved (see
|
||||
.SM
|
||||
.B HISTORY
|
||||
below). The default value is \fI\(ti/.bash_history\fP. If unset, the
|
||||
command history is not saved when a shell exits.
|
||||
below).
|
||||
\fBBash\fP assigns a default value of \fI\(ti/.bash_history\fP.
|
||||
If \fBHISTFILE\fP is unset or null,
|
||||
the command history is not saved when a shell exits.
|
||||
.TP
|
||||
.B HISTFILESIZE
|
||||
The maximum number of lines contained in the history file. When this
|
||||
@@ -3142,12 +3144,12 @@ and
|
||||
.BR CDPATH ,
|
||||
and the shell assigns the expanded value.
|
||||
.PP
|
||||
Bash also performs tilde expansion on words satisfying the conditions of
|
||||
variable assignments (as described above under
|
||||
\fBBash\fP also performs tilde expansion on words satisfying the conditions
|
||||
of variable assignments (as described above under
|
||||
.SM
|
||||
.BR PARAMETERS )
|
||||
when they appear as arguments to simple commands.
|
||||
Bash does not do this, except for the \fIdeclaration\fP commands listed
|
||||
\fBBash\fP does not do this, except for the \fIdeclaration\fP commands listed
|
||||
above, when in \fIposix mode\fP.
|
||||
.SS Parameter Expansion
|
||||
The `\fB$\fP' character introduces parameter expansion,
|
||||
@@ -7460,8 +7462,8 @@ otherwise the history file is overwritten.
|
||||
If
|
||||
.SM
|
||||
.B HISTFILE
|
||||
is unset, or if the history file is unwritable, the history is
|
||||
not saved.
|
||||
is unset or null,
|
||||
or if the history file is unwritable, the history is not saved.
|
||||
If the
|
||||
.SM
|
||||
.B HISTTIMEFORMAT
|
||||
@@ -7502,7 +7504,7 @@ list. The
|
||||
and
|
||||
.SM
|
||||
.B HISTIGNORE
|
||||
variables may be set to cause the shell to save only a subset of the
|
||||
variables are used to cause the shell to save only a subset of the
|
||||
commands entered.
|
||||
The
|
||||
.B cmdhist
|
||||
@@ -8817,7 +8819,7 @@ option means to load the new builtin command
|
||||
from shared object
|
||||
.IR filename ,
|
||||
on systems that support dynamic loading.
|
||||
Bash will use the value of the \fBBASH_LOADABLES_PATH\fP variable as a
|
||||
\fBBash\fP will use the value of the \fBBASH_LOADABLES_PATH\fP variable as a
|
||||
colon-separated list of directories in which to search for \fIfilename\fP.
|
||||
The default is system-dependent.
|
||||
The
|
||||
@@ -9259,7 +9261,13 @@ If \fIfilename\fP is supplied, it is used as the
|
||||
name of the history file; if not, the value of
|
||||
.SM
|
||||
.B HISTFILE
|
||||
is used. Options, if supplied, have the following meanings:
|
||||
is used.
|
||||
If \fIfilename\fP is not supplied and
|
||||
.SM
|
||||
.B HISTFILE
|
||||
is unset or null, the \fB\-a, \-n, \-r,\fP and \fB\-w\fP options
|
||||
have no effect.
|
||||
Options, if supplied, have the following meanings:
|
||||
.RS
|
||||
.PD 0
|
||||
.TP
|
||||
@@ -11612,7 +11620,7 @@ to this variable (a decimal version number like 4.2, or an integer
|
||||
corresponding to the \fBcompat\fP\fINN\fP option, like 42) determines the
|
||||
compatibility level.
|
||||
.PP
|
||||
Starting with bash-4.4, Bash has begun deprecating older compatibility
|
||||
Starting with bash-4.4, \fBbash\fP has begun deprecating older compatibility
|
||||
levels.
|
||||
Eventually, the options will be removed in favor of
|
||||
.SM
|
||||
@@ -11665,7 +11673,7 @@ entire list)
|
||||
the \fB<\fP and \fB>\fP operators to the \fB[[\fP command do not
|
||||
consider the current locale when comparing strings; they use ASCII
|
||||
ordering.
|
||||
Bash versions prior to bash-4.1 use ASCII collation and
|
||||
\fBBash\fP versions prior to bash-4.1 use ASCII collation and
|
||||
.IR strcmp (3);
|
||||
bash-4.1 and later use the current locale's collation sequence and
|
||||
.IR strcoll (3).
|
||||
|
||||
+9
-6
@@ -5591,7 +5591,7 @@ Turning this option off causes the effective user
|
||||
and group ids to be set to the real user and group ids.
|
||||
|
||||
@item -r
|
||||
Enable restricted shell mode.
|
||||
Enable restricted shell mode (@pxref{The Restricted Shell}).
|
||||
This option cannot be unset once it has been set.
|
||||
|
||||
@item -t
|
||||
@@ -6706,8 +6706,10 @@ not tested, and are added to the history regardless of the value of
|
||||
@env{HISTCONTROL}.
|
||||
|
||||
@item HISTFILE
|
||||
The name of the file to which the command history is saved. The
|
||||
default value is @file{~/.bash_history}.
|
||||
The name of the file to which the command history is saved.
|
||||
Bash assigns a default value of @file{~/.bash_history}.
|
||||
If @env{HISTFILE} is unset or null,
|
||||
the command history is not saved when a shell exits.
|
||||
|
||||
@item HISTFILESIZE
|
||||
The maximum number of lines contained in the history file.
|
||||
@@ -7158,6 +7160,7 @@ standard. @xref{Bash POSIX Mode}, for a description of the Bash
|
||||
@sc{posix} mode.
|
||||
|
||||
@item --restricted
|
||||
Equivalent to @option{-r}.
|
||||
Make the shell a restricted shell (@pxref{The Restricted Shell}).
|
||||
|
||||
@item --verbose
|
||||
@@ -8002,7 +8005,7 @@ and an index of -1 refers to the last element.
|
||||
Referencing an array variable without a subscript is equivalent to
|
||||
referencing with a subscript of 0.
|
||||
Any reference to a variable using a valid subscript is legal, and
|
||||
@code{bash} will create an array if necessary.
|
||||
Bash will create an array if necessary.
|
||||
|
||||
An array variable is considered set if a subscript has been assigned a
|
||||
value. The null string is a valid value.
|
||||
@@ -8473,7 +8476,7 @@ name, rather than on all assignment statements on the line.
|
||||
|
||||
@item
|
||||
The default history file is @file{~/.sh_history} (this is the
|
||||
default value of @env{$HISTFILE}).
|
||||
default value the shell assigns to @env{$HISTFILE}).
|
||||
|
||||
@item
|
||||
Redirection operators do not perform filename expansion on the word
|
||||
@@ -8756,7 +8759,7 @@ processing the @samp{<} and @samp{>} binary operators.
|
||||
@item
|
||||
The @code{test} builtin's @option{-t} unary primary requires an argument.
|
||||
Historical versions of @code{test} made the argument optional in certain
|
||||
cases, and bash attempts to accommodate those for backwards compatibility.
|
||||
cases, and Bash attempts to accommodate those for backwards compatibility.
|
||||
|
||||
@item
|
||||
Command substitutions don't set the @samp{?} special parameter. The exit
|
||||
|
||||
+3
-3
@@ -2,10 +2,10 @@
|
||||
Copyright (C) 1988-2023 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Mon Jul 31 15:55:56 EDT 2023
|
||||
@set LASTCHANGE Wed Aug 2 16:03:53 EDT 2023
|
||||
|
||||
@set EDITION 5.3
|
||||
@set VERSION 5.3
|
||||
|
||||
@set UPDATED 31 July 2023
|
||||
@set UPDATED-MONTH July 2023
|
||||
@set UPDATED 2 August 2023
|
||||
@set UPDATED-MONTH August 2023
|
||||
|
||||
@@ -125,7 +125,7 @@ static const struct conf vars[] =
|
||||
#ifdef _SC_CHAR_MAX
|
||||
{ "CHAR_MAX", _SC_CHAR_MAX, SYSCONF },
|
||||
#else
|
||||
{ "CHAR_BIT", CHAR_MAX, CONSTANT },
|
||||
{ "CHAR_MAX", CHAR_MAX, CONSTANT },
|
||||
#endif
|
||||
#ifdef _SC_CHAR_MIN
|
||||
{ "CHAR_MIN", _SC_CHAR_MIN, SYSCONF },
|
||||
@@ -274,11 +274,13 @@ static const struct conf vars[] =
|
||||
#ifdef _SC_AVPHYS_PAGES
|
||||
{ "_AVPHYS_PAGES", _SC_AVPHYS_PAGES, SYSCONF },
|
||||
#endif
|
||||
#ifdef _NPROCESSORS_CONF
|
||||
#ifdef _SC_NPROCESSORS_CONF
|
||||
{ "_NPROCESSORS_CONF", _SC_NPROCESSORS_CONF, SYSCONF },
|
||||
#endif
|
||||
#ifdef _SC_NPROCESSORS_ONLN
|
||||
{ "_NPROCESSORS_ONLN", _SC_NPROCESSORS_ONLN, SYSCONF },
|
||||
#endif
|
||||
#ifdef _PHYS_PAGES
|
||||
#ifdef _SC_PHYS_PAGES
|
||||
{ "_PHYS_PAGES", _SC_PHYS_PAGES, SYSCONF },
|
||||
#endif
|
||||
#ifdef _SC_ARG_MAX
|
||||
@@ -1057,12 +1059,12 @@ getconf_one (WORD_LIST *list)
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
|
||||
if (c->call_name == PATHCONF && list->next == 0)
|
||||
if (c->call == PATHCONF && list->next == 0)
|
||||
{
|
||||
builtin_usage ();
|
||||
return (EX_USAGE);
|
||||
}
|
||||
else if (c->call_name != PATHCONF && list->next)
|
||||
else if (c->call != PATHCONF && list->next)
|
||||
{
|
||||
builtin_usage ();
|
||||
return (EX_USAGE);
|
||||
|
||||
+2
-1
@@ -2476,7 +2476,8 @@ execute_coproc (COMMAND *command, int pipe_in, int pipe_out, struct fd_bitmap *f
|
||||
|
||||
close_pipes (pipe_in, pipe_out);
|
||||
#if defined (PROCESS_SUBSTITUTION) && defined (HAVE_DEV_FD)
|
||||
unlink_fifo_list ();
|
||||
if (variable_context == 0)
|
||||
unlink_fifo_list ();
|
||||
#endif
|
||||
stop_pipeline (1, (COMMAND *)NULL);
|
||||
DESCRIBE_PID (coproc_pid);
|
||||
|
||||
@@ -90,8 +90,8 @@ named by @env{$HISTFILE}.
|
||||
If the @code{histappend} shell option is set (@pxref{Bash Builtins}),
|
||||
the lines are appended to the history file,
|
||||
otherwise the history file is overwritten.
|
||||
If @env{HISTFILE}
|
||||
is unset, or if the history file is unwritable, the history is not saved.
|
||||
If @env{HISTFILE} is unset or null,
|
||||
or if the history file is unwritable, the history is not saved.
|
||||
After saving the history, the history file is truncated
|
||||
to contain no more than @env{$HISTFILESIZE} lines.
|
||||
If @env{HISTFILESIZE} is unset, or set to null, a non-numeric value, or
|
||||
@@ -104,7 +104,7 @@ When the history file is read, lines beginning with the history
|
||||
comment character followed immediately by a digit are interpreted
|
||||
as timestamps for the following history entry.
|
||||
|
||||
The builtin command @code{fc} may be used to list or edit and re-execute
|
||||
The @code{fc} builtin command may be used to list or edit and re-execute
|
||||
a portion of the history list.
|
||||
The @code{history} builtin may be used to display or modify the history
|
||||
list and manipulate the history file.
|
||||
@@ -113,8 +113,9 @@ are available in each editing mode that provide access to the
|
||||
history list (@pxref{Commands For History}).
|
||||
|
||||
The shell allows control over which commands are saved on the history
|
||||
list. The @env{HISTCONTROL} and @env{HISTIGNORE}
|
||||
variables may be set to cause the shell to save only a subset of the
|
||||
list.
|
||||
The @env{HISTCONTROL} and @env{HISTIGNORE}
|
||||
variables are used to cause the shell to save only a subset of the
|
||||
commands entered.
|
||||
The @code{cmdhist}
|
||||
shell option, if enabled, causes the shell to attempt to save each
|
||||
@@ -250,6 +251,7 @@ If a @var{filename} argument is supplied
|
||||
when any of the @option{-w}, @option{-r}, @option{-a}, or @option{-n} options
|
||||
is used, Bash uses @var{filename} as the history file.
|
||||
If not, then the value of the @env{HISTFILE} variable is used.
|
||||
If @env{HISTFILE} is unset or null, these options have no effect.
|
||||
|
||||
The return value is 0 unless an invalid option is encountered, an
|
||||
error occurs while reading or writing the history file, an invalid
|
||||
|
||||
+1
-1
@@ -1522,7 +1522,7 @@ gen_progcomp_completions (const char *ocmd, const char *cmd, const char *word,
|
||||
oldtxt = pcomp_curtxt;
|
||||
|
||||
pcomp_curcs = cs;
|
||||
pcomp_curcmd = cmd;
|
||||
pcomp_curcmd = ocmd;
|
||||
pcomp_curtxt = word;
|
||||
|
||||
ret = gen_compspec_completions (cs, cmd, word, start, end, foundp);
|
||||
|
||||
@@ -3446,8 +3446,7 @@ do_compound_assignment (const char *name, char *value, int flags)
|
||||
v = make_local_assoc_variable (newname, 0);
|
||||
else if (v == 0 || (array_p (v) == 0 && assoc_p (v) == 0) || v->context != variable_context)
|
||||
v = make_local_array_variable (newname, 0);
|
||||
if (v)
|
||||
r = assign_compound_array_list (v, list, flags);
|
||||
r = v? assign_compound_array_list (v, list, flags) : 0;
|
||||
if (list)
|
||||
dispose_words (list);
|
||||
if (r == 0) /* compound assignment error */
|
||||
@@ -3473,14 +3472,13 @@ do_compound_assignment (const char *name, char *value, int flags)
|
||||
list = expand_compound_array_assignment (v, value, flags);
|
||||
if (v == 0 && mkassoc)
|
||||
v = make_new_assoc_variable (newname);
|
||||
else if (v && mkassoc && assoc_p (v) == 0)
|
||||
else if (v && mkassoc && assoc_p (v) == 0) /* convert array? */
|
||||
v = convert_var_to_assoc (v);
|
||||
else if (v == 0)
|
||||
v = make_new_array_variable (newname);
|
||||
else if (v && mkassoc == 0 && array_p (v) == 0)
|
||||
else if (v && mkassoc == 0 && array_p (v) == 0 && assoc_p (v) == 0)
|
||||
v = convert_var_to_array (v);
|
||||
if (v)
|
||||
r = assign_compound_array_list (v, list, flags);
|
||||
r = v ? assign_compound_array_list (v, list, flags) : 0;
|
||||
if (list)
|
||||
dispose_words (list);
|
||||
if (r == 0) /* compound assignment error */
|
||||
|
||||
+32
-20
@@ -799,32 +799,44 @@ 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: line 7: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 8: declare: a: not found
|
||||
./array32.sub: line 11: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 12: declare: a: not found
|
||||
./array32.sub: line 16: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
declare -a a=([0]="hi")
|
||||
./array32.sub: line 22: declare: a: not found
|
||||
./array32.sub: line 25: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 26: declare: a: not found
|
||||
./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)")
|
||||
./array32.sub: line 25: declare: a: not found
|
||||
./array32.sub: line 29: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
declare -a a=([0]="hi")
|
||||
./array32.sub: line 35: declare: a: not found
|
||||
./array32.sub: line 38: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 39: declare: a: not found
|
||||
./array32.sub: line 42: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
declare -a a
|
||||
./array32.sub: line 37: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 50: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
declare -a a
|
||||
./array32.sub: line 44: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 57: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
declare -ai a
|
||||
./array32.sub: line 52: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 53: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 55: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 62: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 65: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 66: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 68: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 75: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
declare -a a
|
||||
./array32.sub: line 64: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 77: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
declare -a a
|
||||
./array32.sub: line 67: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 80: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
declare -a a
|
||||
./array32.sub: line 72: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 78: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 85: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./array32.sub: line 91: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
declare -a a=()
|
||||
./array32.sub: line 82: $(echo INJECTION! >&2 ; echo 0): arithmetic syntax error: operand expected (error token is "$(echo INJECTION! >&2 ; echo 0)")
|
||||
./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=()
|
||||
declare -A A=([x]="x" )
|
||||
declare -A A=([1]="1" )
|
||||
./array33.sub: line 27: f: A: cannot convert associative to indexed array
|
||||
./array33.sub: line 27: declare: A: cannot convert associative to indexed array
|
||||
./array33.sub: line 31: A: cannot convert associative to indexed array
|
||||
declare -A A=([1]="1" )
|
||||
declare -a A=([0]="x" [1]="x")
|
||||
./array33.sub: line 40: f: A: cannot convert indexed to associative array
|
||||
./array33.sub: line 40: declare: A: cannot convert indexed to associative array
|
||||
declare -a A=([0]="x" [1]="x")
|
||||
./array33.sub: line 46: A: cannot convert indexed to associative array
|
||||
declare -a A=([0]="x" [1]="x")
|
||||
|
||||
@@ -439,3 +439,4 @@ ${THIS_SH} ./array29.sub
|
||||
${THIS_SH} ./array30.sub
|
||||
${THIS_SH} ./array31.sub
|
||||
${THIS_SH} ./array32.sub
|
||||
${THIS_SH} ./array33.sub
|
||||
|
||||
+13
-1
@@ -1,3 +1,16 @@
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# change behavior of shell builtins to extend assoc_expand_once to indexed
|
||||
# arrays
|
||||
|
||||
@@ -83,4 +96,3 @@ a=( [$subscript]=hi )
|
||||
declare -p a
|
||||
|
||||
unset -v a
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# implicit and explicit variable type conversions
|
||||
|
||||
declare -A A=(x x)
|
||||
declare -p A
|
||||
|
||||
f() { declare -g A=([1]=1); }
|
||||
f
|
||||
|
||||
declare -p A
|
||||
|
||||
unset -f f
|
||||
# error to convert associative to indexed
|
||||
f() { declare -ga A=([1]=1); }
|
||||
f
|
||||
|
||||
# error to convert associative to indexed
|
||||
declare -a A=([1]=1)
|
||||
declare -p A
|
||||
|
||||
unset -v A
|
||||
|
||||
declare -a A=(x x)
|
||||
declare -p A
|
||||
|
||||
# error to convert indexed to associative
|
||||
f() { declare -gA A=([1]=1); }
|
||||
f
|
||||
|
||||
declare -p A
|
||||
|
||||
# error to convert indexed to associative
|
||||
declare -A A=([1]=1)
|
||||
declare -p A
|
||||
+1
-1
@@ -658,7 +658,7 @@ initialize_shell_variables (char **env, int privmode)
|
||||
that we are remembering commands on the history list. */
|
||||
if (remember_on_history)
|
||||
{
|
||||
name = bash_tilde_expand (posixly_correct ? "~/.sh_history" : "~/.bash_history", 0);
|
||||
name = bash_default_histfile ();
|
||||
|
||||
set_if_not ("HISTFILE", name);
|
||||
free (name);
|
||||
|
||||
Reference in New Issue
Block a user