mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-04 19:00:50 +02:00
commit bash-20190830 snapshot
This commit is contained in:
@@ -6475,3 +6475,51 @@ variables.c
|
||||
incarnation and tests based on a report to Debian BTS from
|
||||
Thorsten Glaser <tg@mirbsd.de>
|
||||
|
||||
8/26
|
||||
----
|
||||
shell.c,bashhist.c
|
||||
- __P -> PARAMS
|
||||
|
||||
shell.c
|
||||
- set_option_defaults,reset_option_defaults: before calling
|
||||
list_minus_o_options at invocation, call set_option_defaults to
|
||||
set the options that are initialized to -1 to either 1 or 0, as
|
||||
appropriate; then call reset_option_defaults to set them back to -1
|
||||
after list_minus_o_options returns
|
||||
- init_interactive: if enable_history_list == -1, set it to 1, then
|
||||
set remember_on_history to enable_history_list. Fixes bug reported
|
||||
by Alex Kerzner <alex.j.kerzner@gmail.com>
|
||||
- init_noninteractive: if enable_history_list == -1, set it to 0, let
|
||||
bash_history_reinit take care of setting remember_on_history
|
||||
- init_interactive_script: if enable_history_list == -1, set it to 1,
|
||||
then set remember_on_history to enable_history_list
|
||||
|
||||
bashhist.c
|
||||
- enable_history_list: initialize to -1 to note when it gets changed
|
||||
by -o history or +o history at invocation
|
||||
|
||||
8/28
|
||||
----
|
||||
lib/readline/terminal.c
|
||||
- TGETENT_SUCCESS, TGETFLAG_SUCCESS: defines to represent successful
|
||||
returns from tgetent and tgetflag, since HPUX manages to get them
|
||||
wrong. New patch from Osipov, Michael <michael.osipov@siemens.com>
|
||||
- TGETFLAG: new define, make sure tgetflag returns TGETENT_SUCCESS
|
||||
- _rl_init_terminal_io: use TGETENT_SUCCESS and TGETFLAG
|
||||
|
||||
configure.ac
|
||||
- hpux: make sure to define TGETFLAG_BROKEN
|
||||
|
||||
8/30
|
||||
----
|
||||
tests
|
||||
- add copyright notices to all scripts longer than 15 lines at the
|
||||
request of the FSF
|
||||
|
||||
9/1
|
||||
---
|
||||
lib/readline/complete.c
|
||||
- _rl_complete_internal: move logic that checks whether the last
|
||||
completion attempt failed and the current attempt returned a single
|
||||
match and insert the single completion here. A better implementation
|
||||
of Richard Stallman's suggestion of 2/23.
|
||||
|
||||
+13
-13
@@ -68,10 +68,10 @@ extern int rl_done, rl_dispatching; /* should really include readline.h */
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
static int histignore_item_func __P((struct ign *));
|
||||
static int check_history_control __P((char *));
|
||||
static void hc_erasedups __P((char *));
|
||||
static void really_add_history __P((char *));
|
||||
static int histignore_item_func PARAMS((struct ign *));
|
||||
static int check_history_control PARAMS((char *));
|
||||
static void hc_erasedups PARAMS((char *));
|
||||
static void really_add_history PARAMS((char *));
|
||||
|
||||
static struct ignorevar histignore =
|
||||
{
|
||||
@@ -89,7 +89,7 @@ static struct ignorevar histignore =
|
||||
list. This is different than the user-controlled behaviour; this
|
||||
becomes zero when we read lines from a file, for example. */
|
||||
int remember_on_history = 0;
|
||||
int enable_history_list = 0; /* value for `set -o history' */
|
||||
int enable_history_list = -1; /* value for `set -o history' */
|
||||
|
||||
/* The number of lines that Bash has added to this history session. The
|
||||
difference between the number of the top element in the history list
|
||||
@@ -193,17 +193,17 @@ int hist_verify;
|
||||
int dont_save_function_defs;
|
||||
|
||||
#if defined (BANG_HISTORY)
|
||||
static int bash_history_inhibit_expansion __P((char *, int));
|
||||
static int bash_history_inhibit_expansion PARAMS((char *, int));
|
||||
#endif
|
||||
#if defined (READLINE)
|
||||
static void re_edit __P((char *));
|
||||
static void re_edit PARAMS((char *));
|
||||
#endif
|
||||
static int history_expansion_p __P((char *));
|
||||
static int shell_comment __P((char *));
|
||||
static int should_expand __P((char *));
|
||||
static HIST_ENTRY *last_history_entry __P((void));
|
||||
static char *expand_histignore_pattern __P((char *));
|
||||
static int history_should_ignore __P((char *));
|
||||
static int history_expansion_p PARAMS((char *));
|
||||
static int shell_comment PARAMS((char *));
|
||||
static int should_expand PARAMS((char *));
|
||||
static HIST_ENTRY *last_history_entry PARAMS((void));
|
||||
static char *expand_histignore_pattern PARAMS((char *));
|
||||
static int history_should_ignore PARAMS((char *));
|
||||
|
||||
#if defined (BANG_HISTORY)
|
||||
/* Is the history expansion starting at string[i] one that should not
|
||||
|
||||
@@ -440,6 +440,8 @@ parse_and_execute (string, from_file, flags)
|
||||
}
|
||||
#endif /* ONESHOT */
|
||||
|
||||
itrace("evalstring: command->type == %d but string = `%s'", command->type, bash_input.location.string);
|
||||
|
||||
/* See if this is a candidate for $( <file ). */
|
||||
if (startup_state == 2 &&
|
||||
(subshell_environment & SUBSHELL_COMSUB) &&
|
||||
|
||||
+1
-1
@@ -646,7 +646,7 @@ reset_shell_options ()
|
||||
#endif
|
||||
#if defined (HISTORY)
|
||||
dont_save_function_defs = 0;
|
||||
remember_on_history = enable_history_list = 1;
|
||||
remember_on_history = enable_history_list = 1; /* XXX */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -20263,8 +20263,8 @@ sysv4*) $as_echo "#define SVR4 1" >>confdefs.h
|
||||
;;
|
||||
sysv5*) $as_echo "#define SVR5 1" >>confdefs.h
|
||||
;;
|
||||
hpux9*) LOCAL_CFLAGS="-DHPUX9 -DHPUX -DTGETENT_BROKEN" ;;
|
||||
hpux*) LOCAL_CFLAGS="-DHPUX -DTGETENT_BROKEN" ;;
|
||||
hpux9*) LOCAL_CFLAGS="-DHPUX9 -DHPUX -DTGETENT_BROKEN -DTGETFLAG_BROKEN" ;;
|
||||
hpux*) LOCAL_CFLAGS="-DHPUX -DTGETENT_BROKEN -DTGETFLAG_BROKEN" ;;
|
||||
dgux*) LOCAL_CFLAGS=-D_DGUX_SOURCE; LOCAL_LIBS=-ldgc ;;
|
||||
isc*) LOCAL_CFLAGS=-Disc386 ;;
|
||||
rhapsody*) LOCAL_CFLAGS=-DRHAPSODY ;;
|
||||
|
||||
+2
-2
@@ -1132,8 +1132,8 @@ sysv4.2*) AC_DEFINE(SVR4_2)
|
||||
AC_DEFINE(SVR4) ;;
|
||||
sysv4*) AC_DEFINE(SVR4) ;;
|
||||
sysv5*) AC_DEFINE(SVR5) ;;
|
||||
hpux9*) LOCAL_CFLAGS="-DHPUX9 -DHPUX -DTGETENT_BROKEN" ;;
|
||||
hpux*) LOCAL_CFLAGS="-DHPUX -DTGETENT_BROKEN" ;;
|
||||
hpux9*) LOCAL_CFLAGS="-DHPUX9 -DHPUX -DTGETENT_BROKEN -DTGETFLAG_BROKEN" ;;
|
||||
hpux*) LOCAL_CFLAGS="-DHPUX -DTGETENT_BROKEN -DTGETFLAG_BROKEN" ;;
|
||||
dgux*) LOCAL_CFLAGS=-D_DGUX_SOURCE; LOCAL_LIBS=-ldgc ;;
|
||||
isc*) LOCAL_CFLAGS=-Disc386 ;;
|
||||
rhapsody*) LOCAL_CFLAGS=-DRHAPSODY ;;
|
||||
|
||||
+16
-1
@@ -429,7 +429,11 @@ rl_complete (int ignore, int invoking_key)
|
||||
|
||||
if (rl_inhibit_completion)
|
||||
return (_rl_insert_char (ignore, invoking_key));
|
||||
#if 0
|
||||
else if (rl_last_func == rl_complete && completion_changed_buffer == 0 && last_completion_failed == 0)
|
||||
#else
|
||||
else if (rl_last_func == rl_complete && completion_changed_buffer == 0)
|
||||
#endif
|
||||
return (rl_complete_internal ('?'));
|
||||
else if (_rl_complete_show_all)
|
||||
return (rl_complete_internal ('!'));
|
||||
@@ -1987,10 +1991,12 @@ rl_complete_internal (int what_to_do)
|
||||
int start, end, delimiter, found_quote, i, nontrivial_lcd;
|
||||
char *text, *saved_line_buffer;
|
||||
char quote_char;
|
||||
int tlen, mlen;
|
||||
int tlen, mlen, saved_last_completion_failed;
|
||||
|
||||
RL_SETSTATE(RL_STATE_COMPLETING);
|
||||
|
||||
saved_last_completion_failed = last_completion_failed;
|
||||
|
||||
set_completion_defaults (what_to_do);
|
||||
|
||||
saved_line_buffer = rl_line_buffer ? savestring (rl_line_buffer) : (char *)NULL;
|
||||
@@ -2104,6 +2110,15 @@ rl_complete_internal (int what_to_do)
|
||||
break;
|
||||
|
||||
case '?':
|
||||
/* Let's try to insert a single match here if the last completion failed
|
||||
but this attempt returned a single match. */
|
||||
if (saved_last_completion_failed && matches[0] && *matches[0] && matches[1] == 0)
|
||||
{
|
||||
insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, "e_char);
|
||||
append_to_match (matches[0], delimiter, quote_char, nontrivial_lcd);
|
||||
break;
|
||||
}
|
||||
|
||||
if (rl_completion_display_matches_hook == 0)
|
||||
{
|
||||
_rl_sigcleanup = _rl_complete_sigcleanup;
|
||||
|
||||
+16
-7
@@ -177,6 +177,19 @@ static char *_rl_term_kI;
|
||||
static char *_rl_term_vs; /* very visible */
|
||||
static char *_rl_term_ve; /* normal */
|
||||
|
||||
/* It's not clear how HPUX is so broken here. */
|
||||
#ifdef TGETENT_BROKEN
|
||||
# define TGETENT_SUCCESS 0
|
||||
#else
|
||||
# define TGETENT_SUCCESS 1
|
||||
#endif
|
||||
#ifdef TGETFLAG_BROKEN
|
||||
# define TGETFLAG_SUCCESS 0
|
||||
#else
|
||||
# define TGETFLAG_SUCCESS 1
|
||||
#endif
|
||||
#define TGETFLAG(cap) (tgetflag (cap) == TGETFLAG_SUCCESS)
|
||||
|
||||
static void bind_termcap_arrow_keys PARAMS((Keymap));
|
||||
|
||||
/* Variables that hold the screen dimensions, used by the display code. */
|
||||
@@ -483,11 +496,7 @@ _rl_init_terminal_io (const char *terminal_name)
|
||||
tgetent_ret = tgetent (term_buffer, term);
|
||||
}
|
||||
|
||||
#ifdef TGETENT_BROKEN
|
||||
if (tgetent_ret < 0)
|
||||
#else
|
||||
if (tgetent_ret <= 0)
|
||||
#endif
|
||||
if (tgetent_ret != TGETENT_SUCCESS)
|
||||
{
|
||||
FREE (term_string_buffer);
|
||||
FREE (term_buffer);
|
||||
@@ -548,7 +557,7 @@ _rl_init_terminal_io (const char *terminal_name)
|
||||
if (!_rl_term_cr)
|
||||
_rl_term_cr = "\r";
|
||||
|
||||
_rl_term_autowrap = tgetflag ("am") && tgetflag ("xn");
|
||||
_rl_term_autowrap = TGETFLAG ("am") && TGETFLAG ("xn");
|
||||
|
||||
/* Allow calling application to set default height and width, using
|
||||
rl_set_screen_size */
|
||||
@@ -563,7 +572,7 @@ _rl_init_terminal_io (const char *terminal_name)
|
||||
|
||||
/* Check to see if this terminal has a meta key and clear the capability
|
||||
variables if there is none. */
|
||||
term_has_meta = tgetflag ("km") != 0;
|
||||
term_has_meta = TGETFLAG ("km");
|
||||
if (term_has_meta == 0)
|
||||
_rl_term_mm = _rl_term_mo = (char *)NULL;
|
||||
#endif /* !__MSDOS__ */
|
||||
|
||||
+1
-1
@@ -25,6 +25,6 @@
|
||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
||||
looks for to find the patch level (for the sccs version string). */
|
||||
|
||||
#define PATCHLEVEL 10
|
||||
#define PATCHLEVEL 11
|
||||
|
||||
#endif /* _PATCHLEVEL_H_ */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* shell.c -- GNU's idea of the POSIX shell specification. */
|
||||
|
||||
/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2019 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -303,35 +303,38 @@ static FILE *default_input;
|
||||
static STRING_INT_ALIST *shopt_alist;
|
||||
static int shopt_ind = 0, shopt_len = 0;
|
||||
|
||||
static int parse_long_options __P((char **, int, int));
|
||||
static int parse_shell_options __P((char **, int, int));
|
||||
static int bind_args __P((char **, int, int, int));
|
||||
static int parse_long_options PARAMS((char **, int, int));
|
||||
static int parse_shell_options PARAMS((char **, int, int));
|
||||
static int bind_args PARAMS((char **, int, int, int));
|
||||
|
||||
static void start_debugger __P((void));
|
||||
static void start_debugger PARAMS((void));
|
||||
|
||||
static void add_shopt_to_alist __P((char *, int));
|
||||
static void run_shopt_alist __P((void));
|
||||
static void add_shopt_to_alist PARAMS((char *, int));
|
||||
static void run_shopt_alist PARAMS((void));
|
||||
|
||||
static void execute_env_file __P((char *));
|
||||
static void run_startup_files __P((void));
|
||||
static int open_shell_script __P((char *));
|
||||
static void set_bash_input __P((void));
|
||||
static int run_one_command __P((char *));
|
||||
static void execute_env_file PARAMS((char *));
|
||||
static void run_startup_files PARAMS((void));
|
||||
static int open_shell_script PARAMS((char *));
|
||||
static void set_bash_input PARAMS((void));
|
||||
static int run_one_command PARAMS((char *));
|
||||
#if defined (WORDEXP_OPTION)
|
||||
static int run_wordexp __P((char *));
|
||||
static int run_wordexp PARAMS((char *));
|
||||
#endif
|
||||
|
||||
static int uidget __P((void));
|
||||
static int uidget PARAMS((void));
|
||||
|
||||
static void init_interactive __P((void));
|
||||
static void init_noninteractive __P((void));
|
||||
static void init_interactive_script __P((void));
|
||||
static void set_option_defaults PARAMS((void));
|
||||
static void reset_option_defaults PARAMS((void));
|
||||
|
||||
static void set_shell_name __P((char *));
|
||||
static void shell_initialize __P((void));
|
||||
static void shell_reinitialize __P((void));
|
||||
static void init_interactive PARAMS((void));
|
||||
static void init_noninteractive PARAMS((void));
|
||||
static void init_interactive_script PARAMS((void));
|
||||
|
||||
static void show_shell_usage __P((FILE *, int));
|
||||
static void set_shell_name PARAMS((char *));
|
||||
static void shell_initialize PARAMS((void));
|
||||
static void shell_reinitialize PARAMS((void));
|
||||
|
||||
static void show_shell_usage PARAMS((FILE *, int));
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
static void
|
||||
@@ -907,7 +910,9 @@ parse_shell_options (argv, arg_start, arg_end)
|
||||
o_option = argv[next_arg];
|
||||
if (o_option == 0)
|
||||
{
|
||||
set_option_defaults ();
|
||||
list_minus_o_opts (-1, (on_or_off == '-') ? 0 : 1);
|
||||
reset_option_defaults ();
|
||||
break;
|
||||
}
|
||||
if (set_minus_o_option (on_or_off, o_option) != EXECUTION_SUCCESS)
|
||||
@@ -1778,13 +1783,36 @@ set_shell_name (argv0)
|
||||
shell_name = PROGRAM;
|
||||
}
|
||||
|
||||
/* Some options are initialized to -1 so we have a way to determine whether
|
||||
they were set on the command line. This is an issue when listing the option
|
||||
values at invocation (`bash -o'), so we set the defaults here and reset
|
||||
them after the call to list_minus_o_options (). */
|
||||
/* XXX - could also do this for histexp_flag, jobs_m_flag */
|
||||
static void
|
||||
set_option_defaults ()
|
||||
{
|
||||
#if defined (HISTORY)
|
||||
enable_history_list = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
reset_option_defaults ()
|
||||
{
|
||||
#if defined (HISTORY)
|
||||
enable_history_list = -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
init_interactive ()
|
||||
{
|
||||
expand_aliases = interactive_shell = startup_state = 1;
|
||||
interactive = 1;
|
||||
#if defined (HISTORY)
|
||||
remember_on_history = enable_history_list = 1; /* XXX */
|
||||
if (enable_history_list == -1)
|
||||
enable_history_list = 1; /* set default */
|
||||
remember_on_history = enable_history_list;
|
||||
# if defined (BANG_HISTORY)
|
||||
histexp_flag = history_expansion; /* XXX */
|
||||
# endif
|
||||
@@ -1795,6 +1823,8 @@ static void
|
||||
init_noninteractive ()
|
||||
{
|
||||
#if defined (HISTORY)
|
||||
if (enable_history_list == -1) /* set default */
|
||||
enable_history_list = 0;
|
||||
bash_history_reinit (0);
|
||||
#endif /* HISTORY */
|
||||
interactive_shell = startup_state = interactive = 0;
|
||||
@@ -1810,10 +1840,14 @@ init_noninteractive ()
|
||||
static void
|
||||
init_interactive_script ()
|
||||
{
|
||||
#if defined (HISTORY)
|
||||
if (enable_history_list == -1)
|
||||
enable_history_list = 1;
|
||||
#endif
|
||||
init_noninteractive ();
|
||||
expand_aliases = interactive_shell = startup_state = 1;
|
||||
#if defined (HISTORY)
|
||||
remember_on_history = enable_history_list = 1; /* XXX */
|
||||
remember_on_history = enable_history_list; /* XXX */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# 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/>.
|
||||
#
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
copyright-makefile
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
BUILD_DIR=/usr/local/build/bash/bash-current
|
||||
BUILD_DIR=/usr/local/build/chet/bash/bash-current
|
||||
THIS_SH=$BUILD_DIR/bash
|
||||
PATH=$PATH:$BUILD_DIR
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
alias: 0
|
||||
alias: 0
|
||||
./alias.tests: line 25: qfoo: command not found
|
||||
./alias.tests: line 38: qfoo: command not found
|
||||
quux
|
||||
bar
|
||||
value
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# place holder for future alias testing
|
||||
shopt -s expand_aliases
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
shopt -s expand_aliases
|
||||
|
||||
alias foo=echo
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
THIS=alias2
|
||||
FN=$TMPDIR/$THIS.script
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/bin/bash
|
||||
shopt -s expand_aliases
|
||||
alias foo='oneword'
|
||||
foo_word='foo'
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
shopt -s expand_aliases
|
||||
|
||||
# from an austin-group report
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# -c commands ending with multi-line aliases; post-bash-5.0
|
||||
|
||||
: ${THIS_SH:=./bash}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
4
|
||||
9
|
||||
16
|
||||
./appendop.tests: line 84: x: readonly variable
|
||||
./appendop.tests: line 97: x: readonly variable
|
||||
declare -A foo=([two]="baz" [three]="quux" [one]="bar" )
|
||||
declare -A foo=([two]="baz" [0]="zero" [three]="quux" [one]="bar" )
|
||||
declare -A foo=([two]="baz" [0]="zero" [three]="quux" [four]="four" [one]="bar" )
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# basic cases
|
||||
a=1
|
||||
a+=4
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
typeset -A foo=([one]=bar [two]=baz [three]=quux)
|
||||
typeset -p foo
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
POSIXLY_CORRECT=1
|
||||
x=2
|
||||
x+=5 eval printf '"$x "'
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
fx()
|
||||
{
|
||||
i=0
|
||||
|
||||
+34
-34
@@ -60,7 +60,7 @@
|
||||
1,i+=2
|
||||
30
|
||||
1,j+=2
|
||||
./arith.tests: line 114: 1 ? 20 : x+=2: attempted assignment to non-variable (error token is "+=2")
|
||||
./arith.tests: line 127: 1 ? 20 : x+=2: attempted assignment to non-variable (error token is "+=2")
|
||||
20
|
||||
6
|
||||
6,5,3
|
||||
@@ -80,16 +80,16 @@
|
||||
36
|
||||
62
|
||||
63
|
||||
./arith.tests: line 149: 3425#56: invalid arithmetic base (error token is "3425#56")
|
||||
./arith.tests: line 162: 3425#56: invalid arithmetic base (error token is "3425#56")
|
||||
0
|
||||
./arith.tests: line 155: 7 = 43 : attempted assignment to non-variable (error token is "= 43 ")
|
||||
./arith.tests: line 156: 2#44: value too great for base (error token is "2#44")
|
||||
./arith.tests: line 157: 44 / 0 : division by 0 (error token is "0 ")
|
||||
./arith.tests: line 158: let: jv += $iv: syntax error: operand expected (error token is "$iv")
|
||||
./arith.tests: line 159: jv += $iv : syntax error: operand expected (error token is "$iv ")
|
||||
./arith.tests: line 160: let: rv = 7 + (43 * 6: missing `)' (error token is "6")
|
||||
./arith.tests: line 164: 0#4: invalid number (error token is "0#4")
|
||||
./arith.tests: line 165: 2#110#11: invalid number (error token is "2#110#11")
|
||||
./arith.tests: line 168: 7 = 43 : attempted assignment to non-variable (error token is "= 43 ")
|
||||
./arith.tests: line 169: 2#44: value too great for base (error token is "2#44")
|
||||
./arith.tests: line 170: 44 / 0 : division by 0 (error token is "0 ")
|
||||
./arith.tests: line 171: let: jv += $iv: syntax error: operand expected (error token is "$iv")
|
||||
./arith.tests: line 172: jv += $iv : syntax error: operand expected (error token is "$iv ")
|
||||
./arith.tests: line 173: let: rv = 7 + (43 * 6: missing `)' (error token is "6")
|
||||
./arith.tests: line 177: 0#4: invalid number (error token is "0#4")
|
||||
./arith.tests: line 178: 2#110#11: invalid number (error token is "2#110#11")
|
||||
abc
|
||||
def
|
||||
ghi
|
||||
@@ -97,15 +97,15 @@ ok
|
||||
6
|
||||
1
|
||||
0
|
||||
./arith.tests: line 183: 4 + : syntax error: operand expected (error token is "+ ")
|
||||
./arith.tests: line 196: 4 + : syntax error: operand expected (error token is "+ ")
|
||||
16
|
||||
./arith.tests: line 188: 4 ? : 3 + 5 : expression expected (error token is ": 3 + 5 ")
|
||||
./arith.tests: line 189: 1 ? 20 : `:' expected for conditional expression (error token is "20 ")
|
||||
./arith.tests: line 190: 4 ? 20 : : expression expected (error token is ": ")
|
||||
./arith.tests: line 201: 4 ? : 3 + 5 : expression expected (error token is ": 3 + 5 ")
|
||||
./arith.tests: line 202: 1 ? 20 : `:' expected for conditional expression (error token is "20 ")
|
||||
./arith.tests: line 203: 4 ? 20 : : expression expected (error token is ": ")
|
||||
9
|
||||
./arith.tests: line 196: 0 && B=42 : attempted assignment to non-variable (error token is "=42 ")
|
||||
./arith.tests: line 209: 0 && B=42 : attempted assignment to non-variable (error token is "=42 ")
|
||||
9
|
||||
./arith.tests: line 199: 1 || B=88 : attempted assignment to non-variable (error token is "=88 ")
|
||||
./arith.tests: line 212: 1 || B=88 : attempted assignment to non-variable (error token is "=88 ")
|
||||
9
|
||||
0
|
||||
9
|
||||
@@ -131,11 +131,11 @@ ok
|
||||
4
|
||||
4
|
||||
7
|
||||
./arith.tests: line 247: 7-- : syntax error: operand expected (error token is "- ")
|
||||
./arith.tests: line 249: --x=7 : attempted assignment to non-variable (error token is "=7 ")
|
||||
./arith.tests: line 250: ++x=7 : attempted assignment to non-variable (error token is "=7 ")
|
||||
./arith.tests: line 252: x++=7 : attempted assignment to non-variable (error token is "=7 ")
|
||||
./arith.tests: line 253: x--=7 : attempted assignment to non-variable (error token is "=7 ")
|
||||
./arith.tests: line 260: 7-- : syntax error: operand expected (error token is "- ")
|
||||
./arith.tests: line 262: --x=7 : attempted assignment to non-variable (error token is "=7 ")
|
||||
./arith.tests: line 263: ++x=7 : attempted assignment to non-variable (error token is "=7 ")
|
||||
./arith.tests: line 265: x++=7 : attempted assignment to non-variable (error token is "=7 ")
|
||||
./arith.tests: line 266: x--=7 : attempted assignment to non-variable (error token is "=7 ")
|
||||
4
|
||||
7
|
||||
-7
|
||||
@@ -143,10 +143,10 @@ ok
|
||||
7
|
||||
2
|
||||
2
|
||||
./arith1.sub: line 2: 4-- : syntax error: operand expected (error token is "- ")
|
||||
./arith1.sub: line 3: 4++ : syntax error: operand expected (error token is "+ ")
|
||||
./arith1.sub: line 4: 4 -- : syntax error: operand expected (error token is "- ")
|
||||
./arith1.sub: line 5: 4 ++ : syntax error: operand expected (error token is "+ ")
|
||||
./arith1.sub: line 15: 4-- : syntax error: operand expected (error token is "- ")
|
||||
./arith1.sub: line 16: 4++ : syntax error: operand expected (error token is "+ ")
|
||||
./arith1.sub: line 17: 4 -- : syntax error: operand expected (error token is "- ")
|
||||
./arith1.sub: line 18: 4 ++ : syntax error: operand expected (error token is "+ ")
|
||||
1
|
||||
2
|
||||
1
|
||||
@@ -161,10 +161,10 @@ ok
|
||||
2
|
||||
-2
|
||||
1
|
||||
./arith1.sub: line 35: ((: ++ : syntax error: operand expected (error token is "+ ")
|
||||
./arith1.sub: line 48: ((: ++ : syntax error: operand expected (error token is "+ ")
|
||||
7
|
||||
7
|
||||
./arith1.sub: line 38: ((: -- : syntax error: operand expected (error token is "- ")
|
||||
./arith1.sub: line 51: ((: -- : syntax error: operand expected (error token is "- ")
|
||||
7
|
||||
7
|
||||
7
|
||||
@@ -183,10 +183,10 @@ ok
|
||||
1
|
||||
4
|
||||
0
|
||||
./arith2.sub: line 33: ((: -- : syntax error: operand expected (error token is "- ")
|
||||
./arith2.sub: line 46: ((: -- : syntax error: operand expected (error token is "- ")
|
||||
-7
|
||||
-7
|
||||
./arith2.sub: line 37: ((: ++ : syntax error: operand expected (error token is "+ ")
|
||||
./arith2.sub: line 50: ((: ++ : syntax error: operand expected (error token is "+ ")
|
||||
7
|
||||
7
|
||||
-7
|
||||
@@ -250,14 +250,14 @@ efg
|
||||
0
|
||||
0
|
||||
8 12
|
||||
./arith.tests: line 297: ((: x=9 y=41 : syntax error in expression (error token is "y=41 ")
|
||||
./arith.tests: line 301: a b: syntax error in expression (error token is "b")
|
||||
./arith.tests: line 302: ((: a b: syntax error in expression (error token is "b")
|
||||
./arith.tests: line 310: ((: x=9 y=41 : syntax error in expression (error token is "y=41 ")
|
||||
./arith.tests: line 314: a b: syntax error in expression (error token is "b")
|
||||
./arith.tests: line 315: ((: a b: syntax error in expression (error token is "b")
|
||||
42
|
||||
42
|
||||
42
|
||||
42
|
||||
42
|
||||
42
|
||||
./arith.tests: line 314: 'foo' : syntax error: operand expected (error token is "'foo' ")
|
||||
./arith.tests: line 318: b[c]d: syntax error in expression (error token is "d")
|
||||
./arith.tests: line 327: 'foo' : syntax error: operand expected (error token is "'foo' ")
|
||||
./arith.tests: line 331: b[c]d: syntax error in expression (error token is "d")
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
set +o posix
|
||||
declare -i iv jv
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# test of redone post-increment and post-decrement code
|
||||
echo $(( 4-- ))
|
||||
echo $(( 4++ ))
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
echo $(( --7 ))
|
||||
echo $(( ++7 ))
|
||||
echo $(( -- 7 ))
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# this depends on the sequence of random numbers from the internal LCRNG
|
||||
RANDOM=42
|
||||
(( dice[RANDOM%6+1 + RANDOM%6+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/>.
|
||||
#
|
||||
intmax_max=$((2**63 - 1))
|
||||
intmax_min1=$((2**63))
|
||||
intmax_min2=$((-2**63))
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
function reorder
|
||||
{
|
||||
(( x[1] < x && (x=x[1], x[1]=$x) ))
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# problems with evaluation of wrong terms in conditional expressions through
|
||||
# bash-4.4
|
||||
|
||||
|
||||
+46
-46
@@ -1,6 +1,6 @@
|
||||
|
||||
./array.tests: line 15: syntax error near unexpected token `&'
|
||||
./array.tests: line 15: `test=(first & second)'
|
||||
./array.tests: line 28: syntax error near unexpected token `&'
|
||||
./array.tests: line 28: `test=(first & second)'
|
||||
1
|
||||
abcde
|
||||
abcde
|
||||
@@ -26,7 +26,7 @@ hello world
|
||||
11
|
||||
3
|
||||
bdef hello world test expression test 2
|
||||
./array.tests: line 79: readonly: `a[5]': not a valid identifier
|
||||
./array.tests: line 92: 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")
|
||||
@@ -46,17 +46,17 @@ 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 103: a: readonly variable
|
||||
./array.tests: line 105: b[]: bad array subscript
|
||||
./array.tests: line 106: b[*]: bad array subscript
|
||||
./array.tests: line 116: a: readonly variable
|
||||
./array.tests: line 118: b[]: bad array subscript
|
||||
./array.tests: line 119: b[*]: bad array subscript
|
||||
this
|
||||
./array.tests: line 109: c[-2]: bad array subscript
|
||||
./array.tests: line 110: c: bad array subscript
|
||||
./array.tests: line 122: c[-2]: bad array subscript
|
||||
./array.tests: line 123: c: bad array subscript
|
||||
|
||||
./array.tests: line 112: d[7]: cannot assign list to array member
|
||||
./array.tests: line 114: []=abcde: bad array subscript
|
||||
./array.tests: line 114: [*]=last: cannot assign to non-numeric index
|
||||
./array.tests: line 114: [-65]=negative: bad array subscript
|
||||
./array.tests: line 125: d[7]: cannot assign list to array member
|
||||
./array.tests: line 127: []=abcde: bad array subscript
|
||||
./array.tests: line 127: [*]=last: cannot assign to non-numeric index
|
||||
./array.tests: line 127: [-65]=negative: bad array subscript
|
||||
declare -a BASH_ARGC=()
|
||||
declare -a BASH_ARGV=()
|
||||
declare -a BASH_LINENO=([0]="0")
|
||||
@@ -68,8 +68,8 @@ declare -a b=([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")
|
||||
declare -ar c
|
||||
declare -a d=([1]="test test")
|
||||
declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
|
||||
./array.tests: line 122: unset: ps1: not an array variable
|
||||
./array.tests: line 126: declare: c: cannot destroy array variables in this way
|
||||
./array.tests: line 135: unset: ps1: not an array variable
|
||||
./array.tests: line 139: declare: c: cannot destroy array variables in this way
|
||||
this of
|
||||
this is a test of read using arrays
|
||||
this test
|
||||
@@ -127,7 +127,7 @@ grep [ 123 ] *
|
||||
6 7 9 5
|
||||
length = 3
|
||||
value = new1 new2 new3
|
||||
./array.tests: line 242: narray: unbound variable
|
||||
./array.tests: line 255: narray: unbound variable
|
||||
./array1.sub: line 1: syntax error near unexpected token `('
|
||||
./array1.sub: line 1: `printf "%s\n" -a a=(a 'b c')'
|
||||
./array2.sub: line 1: declare: `[]=asdf': not a valid identifier
|
||||
@@ -154,10 +154,10 @@ for case if then else
|
||||
12 14 16 18 20
|
||||
4414758999202
|
||||
aaa bbb
|
||||
./array.tests: line 292: syntax error near unexpected token `<>'
|
||||
./array.tests: line 292: `metas=( <> < > ! )'
|
||||
./array.tests: line 293: syntax error near unexpected token `<>'
|
||||
./array.tests: line 293: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
|
||||
./array.tests: line 305: syntax error near unexpected token `<>'
|
||||
./array.tests: line 305: `metas=( <> < > ! )'
|
||||
./array.tests: line 306: syntax error near unexpected token `<>'
|
||||
./array.tests: line 306: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
|
||||
abc 3
|
||||
case 4
|
||||
abc case if then else 5
|
||||
@@ -367,7 +367,7 @@ function function
|
||||
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")
|
||||
./array14.sub: line 11: unset: [-10]: bad array subscript
|
||||
./array14.sub: line 24: unset: [-10]: bad array subscript
|
||||
declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4")
|
||||
declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="five")
|
||||
declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="5")
|
||||
@@ -395,7 +395,7 @@ qux: unset array element 0: ok
|
||||
0
|
||||
0
|
||||
1
|
||||
./array17.sub: line 30: ~: syntax error: operand expected (error token is "~")
|
||||
./array17.sub: line 43: ~: syntax error: operand expected (error token is "~")
|
||||
0
|
||||
0
|
||||
3
|
||||
@@ -410,7 +410,7 @@ one
|
||||
one
|
||||
two
|
||||
two
|
||||
./array17.sub: line 76: ~ : syntax error: operand expected (error token is "~ ")
|
||||
./array17.sub: line 89: ~ : syntax error: operand expected (error token is "~ ")
|
||||
1
|
||||
argv[1] = <>
|
||||
argv[2] = <>
|
||||
@@ -442,9 +442,9 @@ declare -a foo=([0]="[0]=bar")
|
||||
declare -a foo=([0]="[0]=bar")
|
||||
declare -- a="(1 2 3)"
|
||||
declare -a a=([0]="1" [1]="2" [2]="3")
|
||||
./array19.sub: line 46: a: 1: must use subscript when assigning associative array
|
||||
./array19.sub: line 46: a: 2: must use subscript when assigning associative array
|
||||
./array19.sub: line 46: a: 3: must use subscript when assigning associative array
|
||||
./array19.sub: line 59: a: 1: must use subscript when assigning associative array
|
||||
./array19.sub: line 59: a: 2: must use subscript when assigning associative array
|
||||
./array19.sub: line 59: a: 3: must use subscript when assigning associative array
|
||||
declare -A a=()
|
||||
declare -- a="([0]=a [1]=b)"
|
||||
declare -a a=([0]="a" [1]="b")
|
||||
@@ -452,7 +452,7 @@ declare -A a=([1]="b" [0]="a" )
|
||||
declare -a var=([0]="[\$(echo" [1]="total" [2]="0)]=1" [3]="[2]=2]")
|
||||
declare -a var=([0]="[\$(echo total 0)]=1 [2]=2]")
|
||||
declare -a var=([0]="[\$(echo" [1]="total" [2]="0)]=1" [3]="[2]=2]")
|
||||
./array19.sub: line 81: total 0: syntax error in expression (error token is "0")
|
||||
./array19.sub: line 94: total 0: syntax error in expression (error token is "0")
|
||||
declare -a var=()
|
||||
declare -al foo=([0]="abcde" [1]="two" [2]="three")
|
||||
declare -al foo=([0]="abcde")
|
||||
@@ -460,7 +460,7 @@ declare -al ar=([0]="one" [1]="two" [2]="three")
|
||||
declare -a a=([2]="foo")
|
||||
declare -a a=([2]="foo")
|
||||
declare -a a=([1]="(var)" [2]="foo")
|
||||
./array19.sub: line 120: warning: a[1]=(var): quoted compound array assignment deprecated
|
||||
./array19.sub: line 133: warning: a[1]=(var): quoted compound array assignment deprecated
|
||||
declare -a a=([1]="(var)")
|
||||
declare -a a=([0]="1" [1]="2" [2]="(1 2 3)")
|
||||
declare -a a=([0]="1" [1]="2" [2]="(1 2 3)")
|
||||
@@ -477,10 +477,10 @@ declare -a b=([0]="/scratch/bash")
|
||||
declare -a c=([0]="1" [1]="2")
|
||||
declare -a d=([0]="a" [1]="b")
|
||||
declare -a e=([0]="Darwin")
|
||||
./array19.sub: line 166: c: 1: must use subscript when assigning associative array
|
||||
./array19.sub: line 166: c: 2: must use subscript when assigning associative array
|
||||
./array19.sub: line 166: d: $a: must use subscript when assigning associative array
|
||||
./array19.sub: line 166: e: $(echo Darwin): must use subscript when assigning associative array
|
||||
./array19.sub: line 179: c: 1: must use subscript when assigning associative array
|
||||
./array19.sub: line 179: c: 2: must use subscript when assigning associative array
|
||||
./array19.sub: line 179: d: $a: must use subscript when assigning associative array
|
||||
./array19.sub: line 179: e: $(echo Darwin): must use subscript when assigning associative array
|
||||
declare -A a=([0]="a b" )
|
||||
declare -A b=([0]="/scratch/bash" )
|
||||
declare -A c=()
|
||||
@@ -499,8 +499,8 @@ x b c
|
||||
declare -a a=([1]="2" [2]="3" [3]="4")
|
||||
abcd
|
||||
unset
|
||||
./array21.sub: line 17: typeset: a: not found
|
||||
./array21.sub: line 20: typeset: A: not found
|
||||
./array21.sub: line 30: typeset: a: not found
|
||||
./array21.sub: line 33: typeset: A: not found
|
||||
declare -a a=()
|
||||
declare -A A=()
|
||||
declare -a foo=([0]="1" [1]="(4 5 6)" [2]="3")
|
||||
@@ -525,16 +525,16 @@ p3
|
||||
argv[1] = <y>
|
||||
<X> <X> <X> <X>
|
||||
<X> <X> <X> <X>
|
||||
./array23.sub: line 9: $( echo >&2 foo ) : syntax error: operand expected (error token is "$( echo >&2 foo ) ")
|
||||
./array23.sub: line 10: $( echo >&2 foo ) : syntax error: operand expected (error token is "$( echo >&2 foo ) ")
|
||||
./array23.sub: line 22: $( echo >&2 foo ) : syntax error: operand expected (error token is "$( echo >&2 foo ) ")
|
||||
./array23.sub: line 23: $( echo >&2 foo ) : syntax error: operand expected (error token is "$( echo >&2 foo ) ")
|
||||
foo
|
||||
0
|
||||
foo
|
||||
foo
|
||||
foo
|
||||
6
|
||||
./array23.sub: line 21: $( echo >&2 foo ): syntax error: operand expected (error token is "$( echo >&2 foo )")
|
||||
./array23.sub: line 22: $( echo >&2 foo ): syntax error: operand expected (error token is "$( echo >&2 foo )")
|
||||
./array23.sub: line 34: $( echo >&2 foo ): syntax error: operand expected (error token is "$( echo >&2 foo )")
|
||||
./array23.sub: line 35: $( echo >&2 foo ): syntax error: operand expected (error token is "$( echo >&2 foo )")
|
||||
0
|
||||
0
|
||||
0
|
||||
@@ -588,7 +588,7 @@ jkl
|
||||
1. indexed:
|
||||
reference:
|
||||
1. 0
|
||||
./array25.sub: line 11: ' ': syntax error: operand expected (error token is "' '")
|
||||
./array25.sub: line 24: ' ': syntax error: operand expected (error token is "' '")
|
||||
3. 0
|
||||
4. 0
|
||||
5. 0
|
||||
@@ -750,17 +750,17 @@ argv[1] = <b>
|
||||
argv[2] = <a>
|
||||
argv[1] = <b+a>
|
||||
7
|
||||
./array27.sub: line 11: a[]]=7 : syntax error: invalid arithmetic operator (error token is "]=7 ")
|
||||
./array27.sub: line 24: a[]]=7 : syntax error: invalid arithmetic operator (error token is "]=7 ")
|
||||
declare -A A=([$'\t']="2" [" "]="2" )
|
||||
./array27.sub: line 23: ((: A[]]=2 : syntax error: invalid arithmetic operator (error token is "]=2 ")
|
||||
./array27.sub: line 36: ((: A[]]=2 : syntax error: invalid arithmetic operator (error token is "]=2 ")
|
||||
declare -A A=([$'\t']="2" ["*"]="2" [" "]="2" ["@"]="2" )
|
||||
./array27.sub: line 32: A[]]: bad array subscript
|
||||
./array27.sub: line 45: A[]]: bad array subscript
|
||||
declare -A A=([$'\t']="X" ["*"]="X" [" "]="X" ["@"]="X" )
|
||||
./array27.sub: line 40: A[]]: bad array subscript
|
||||
./array27.sub: line 53: A[]]: bad array subscript
|
||||
declare -A A=([$'\t']="X" ["*"]="X" [" "]="X" ["@"]="X" )
|
||||
./array27.sub: line 48: declare: `A[]]=X': not a valid identifier
|
||||
./array27.sub: line 61: declare: `A[]]=X': not a valid identifier
|
||||
declare -A A=(["*"]="X" ["@"]="X" )
|
||||
./array27.sub: line 56: declare: `A[]]=X': not a valid identifier
|
||||
./array27.sub: line 56: A[*]: bad array subscript
|
||||
./array27.sub: line 56: A[@]: bad array subscript
|
||||
./array27.sub: line 69: declare: `A[]]=X': not a valid identifier
|
||||
./array27.sub: line 69: A[*]: bad array subscript
|
||||
./array27.sub: line 69: A[@]: bad array subscript
|
||||
declare -A A
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# this is needed so that the bad assignments (b[]=bcde, for example) do not
|
||||
# cause fatal shell errors when in posix mode
|
||||
set +o posix
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
days=({Mon,Tues,Wednes,Thurs,Fri,Satur,Sun}day)
|
||||
echo ${days[@]}
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# problems with associative array keys with ] and unbalanced [ ]
|
||||
# fixed after bash-4.2
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# problems with fix for posix interp 217 introduced in bash-4.2
|
||||
|
||||
declare -ax array
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
func1(){
|
||||
declare -g variable='function'
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# start at a test suite for negative indexed array subscripts -- post bash-4.2
|
||||
x=( 0 1 2 3 4 5)
|
||||
declare -p x
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# fixes for make_internal_declare not handling integer attribute for arrays
|
||||
declare -ai -g foo=(1 2 xx 3)
|
||||
echo "${foo[@]}"
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
foo[0]=a
|
||||
foo[1]=b
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# this shows the expansions an array subscript undergoes before being run
|
||||
# through the arithmetic evaluator
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# arrays referenced using @ subscript and positional parameters should behave
|
||||
# the same way
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# tests for changes to declare and assignment statement arguments post-bash-4.3
|
||||
|
||||
unset foo l a b
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# tests to make sure that $* and ${array[*]} expand consistently in `list'
|
||||
# and `scalar' contexts
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
typeset -a a
|
||||
a=(1 2 3 4)
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# This isn't perfect behavior, but it establishes a baseline and will provide
|
||||
# a way to detect behavior changes
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# this captures how bash and ksh93 expand indexed array subscripts in
|
||||
# various contexts. if changes are ever made, or an option added to do
|
||||
# this differently, the diffs will show up here
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
set -- "abc" "def ghi" "jkl"
|
||||
A=("$@")
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# tests with blank subscripts, indexed and associative
|
||||
|
||||
echo 1. indexed:
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# these should produce the same results
|
||||
a=(aa bb)
|
||||
set -- aa bb
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# tests for `problem' keys when using associative arrays and assoc_expand_once
|
||||
# deal with problems for now; this is a placeholder for if and when I fix them
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# compound assignment parsing problems in bash-3.1-release
|
||||
func()
|
||||
{
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
|
||||
: ${TMPDIR:=/tmp}
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# test cases for array quoting and escaping fixed post bash-3.2-release
|
||||
|
||||
oIFS="$IFS"
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
IFS=/
|
||||
declare -a i
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
echo $(( 0x7e ))
|
||||
echo $(( 0x7f ))
|
||||
echo $(( 0x80 ))
|
||||
|
||||
+18
-18
@@ -7,17 +7,17 @@ declare -A fluff=([foo]="one" [bar]="two" )
|
||||
declare -A fluff=([foo]="one" [bar]="two" )
|
||||
declare -A fluff=([bar]="two" )
|
||||
declare -A fluff=([bar]="newval" [qux]="assigned" )
|
||||
./assoc.tests: line 26: chaff: four: must use subscript when assigning associative array
|
||||
./assoc.tests: line 39: chaff: four: must use subscript when assigning associative array
|
||||
declare -A BASH_ALIASES=()
|
||||
declare -A BASH_CMDS=()
|
||||
declare -Ai chaff=([zero]="5" [one]="10" )
|
||||
declare -Ar waste=([lineno]="28" [source]="./assoc.tests" [version]="4.0-devel" [pid]="42134" )
|
||||
declare -Ar waste=([lineno]="41" [source]="./assoc.tests" [version]="4.0-devel" [pid]="42134" )
|
||||
declare -A wheat=([two]="b" [three]="c" [zero]="0" [one]="a" )
|
||||
declare -A chaff=(["hello world"]="flip" [zero]="5" [one]="10" )
|
||||
./assoc.tests: line 38: waste: readonly variable
|
||||
./assoc.tests: line 39: unset: waste: cannot unset: readonly variable
|
||||
./assoc.tests: line 40: chaff[*]: bad array subscript
|
||||
./assoc.tests: line 41: [*]=12: invalid associative array key
|
||||
./assoc.tests: line 51: waste: readonly variable
|
||||
./assoc.tests: line 52: unset: waste: cannot unset: readonly variable
|
||||
./assoc.tests: line 53: chaff[*]: bad array subscript
|
||||
./assoc.tests: line 54: [*]=12: invalid associative array key
|
||||
declare -A chaff=(["hello world"]="flip" [one]="a" )
|
||||
flip
|
||||
argv[1] = <multiple>
|
||||
@@ -32,9 +32,9 @@ argv[2] = <words>
|
||||
argv[3] = <flip>
|
||||
argv[4] = <a>
|
||||
argv[1] = <multiple words flip a>
|
||||
./assoc.tests: line 58: declare: chaff: cannot destroy array variables in this way
|
||||
./assoc.tests: line 60: chaff[*]: bad array subscript
|
||||
./assoc.tests: line 61: [*]=12: invalid associative array key
|
||||
./assoc.tests: line 71: declare: chaff: cannot destroy array variables in this way
|
||||
./assoc.tests: line 73: chaff[*]: bad array subscript
|
||||
./assoc.tests: line 74: [*]=12: invalid associative array key
|
||||
declare -A wheat=(["foo bar"]="qux qix" [six]="6" )
|
||||
argv[1] = <qux>
|
||||
argv[2] = <qix>
|
||||
@@ -137,7 +137,7 @@ argv[4] = <FOOQ>
|
||||
abc
|
||||
def
|
||||
def
|
||||
./assoc5.sub: line 13: declare: `myarray[foo[bar]=bleh': not a valid identifier
|
||||
./assoc5.sub: line 26: declare: `myarray[foo[bar]=bleh': not a valid identifier
|
||||
bleh def abc
|
||||
myarray=([foo]="bleh" ["]"]="def" ["a]=test1;#a"]="123" ["a]a"]="abc" )
|
||||
|
||||
@@ -200,10 +200,10 @@ declare -A hash=([key]="value1 value2" )
|
||||
declare -A b=([")"]="" ["\""]="" ["]"]="" ["\\"]="" ["\`"]="" )
|
||||
declare -A b=(["]"]="" ["\`"]="" )
|
||||
declare -A dict=(["'"]="3" ["\""]="1" ["\\"]="4" ["\`"]="2" )
|
||||
./assoc9.sub: line 23: unset: `dict[']': not a valid identifier
|
||||
./assoc9.sub: line 23: unset: `dict["]': not a valid identifier
|
||||
./assoc9.sub: line 23: unset: `dict[\]': not a valid identifier
|
||||
./assoc9.sub: line 23: unset: `dict[`]': not a valid identifier
|
||||
./assoc9.sub: line 36: unset: `dict[']': not a valid identifier
|
||||
./assoc9.sub: line 36: unset: `dict["]': not a valid identifier
|
||||
./assoc9.sub: line 36: unset: `dict[\]': not a valid identifier
|
||||
./assoc9.sub: line 36: unset: `dict[`]': not a valid identifier
|
||||
declare -A dict=(["'"]="3" ["\""]="1" ["\\"]="4" ["\`"]="2" )
|
||||
declare -A dict=(["'"]="3" ["\""]="1" ["\\"]="4" ["\`"]="2" )
|
||||
declare -A dict=()
|
||||
@@ -211,10 +211,10 @@ declare -A dict=()
|
||||
4
|
||||
a[$b]= 5
|
||||
declare -A a=(["80's"]="Depeche Mode" )
|
||||
./assoc9.sub: line 71: read: `a[80's]': not a valid identifier
|
||||
./assoc9.sub: line 84: read: `a[80's]': not a valid identifier
|
||||
declare -A a
|
||||
declare -A a=(["80's"]="Depeche Mode" )
|
||||
./assoc9.sub: line 83: printf: `a[80's]': not a valid identifier
|
||||
./assoc9.sub: line 96: printf: `a[80's]': not a valid identifier
|
||||
declare -A a
|
||||
declare -A a=(["80's"]="Depeche Mode" )
|
||||
6
|
||||
@@ -222,9 +222,9 @@ declare -A a=(["80's"]="Depeche Mode" )
|
||||
1+5
|
||||
declare -A a=(["\$(date >&2)"]="5" )
|
||||
declare -A myarray=([foo]="bleh" ["foo[bar"]="bleh" )
|
||||
./assoc10.sub: line 1: declare: a: cannot convert indexed to associative array
|
||||
./assoc10.sub: line 14: declare: a: cannot convert indexed to associative array
|
||||
f: declare -a a
|
||||
./assoc10.sub: line 4: declare: a: cannot convert associative to indexed array
|
||||
./assoc10.sub: line 17: declare: a: cannot convert associative to indexed array
|
||||
f: declare -A a
|
||||
|
||||
f: declare -a a
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# TEST - basic declaration and assignment
|
||||
typeset -A fluff
|
||||
declare -A
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
hash -r
|
||||
echo ${BASH_CMDS[@]}
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
f() { declare -a a; declare -A a; echo -n "$FUNCNAME: " ; declare -p a; }
|
||||
f
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
echo ${BASH_ALIASES[@]}
|
||||
|
||||
alias foo=/usr/sbin/foo
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
foo()
|
||||
{
|
||||
declare -A afoo=([six]="six" [foo bar]="foo quux")
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
IFS=/
|
||||
declare -A i
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
declare -A myarray
|
||||
|
||||
# this needs fixes to skipsubscript
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
declare -A foo
|
||||
|
||||
foo=([bar\"bie]=doll)
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# problem with bash versions through bash-4.2
|
||||
foo()
|
||||
{
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
typeset -A a=( [\\]= [\"]= [\)]= ) b
|
||||
for x in "${!a[@]}"; do b[$x]=; done
|
||||
b+=([\`]= [\]]=)
|
||||
|
||||
+8
-8
@@ -1,9 +1,9 @@
|
||||
after f1:declare -ar a=([0]="1")
|
||||
./attr.tests: line 4: a: readonly variable
|
||||
./attr.tests: line 17: a: readonly variable
|
||||
after f2:declare -ar a=([0]="1")
|
||||
./attr.tests: line 5: a: readonly variable
|
||||
./attr.tests: line 18: a: readonly variable
|
||||
after f3:declare -ar a=([0]="1")
|
||||
./attr.tests: line 6: readonly: a: readonly variable
|
||||
./attr.tests: line 19: 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)")
|
||||
@@ -11,15 +11,15 @@ after f4:declare -ar d=([0]="4")
|
||||
declare -r m="4"
|
||||
in func:declare -r n="4"
|
||||
declare -r n="4"
|
||||
./attr1.sub: line 13: p: readonly variable
|
||||
./attr1.sub: line 26: p: readonly variable
|
||||
declare -r p="1"
|
||||
./attr1.sub: line 19: r: readonly variable
|
||||
./attr1.sub: line 32: r: readonly variable
|
||||
declare -ar r=([0]="1")
|
||||
./attr1.sub: line 23: r: readonly variable
|
||||
./attr1.sub: line 36: r: readonly variable
|
||||
declare -ar r=([0]="1")
|
||||
./attr1.sub: line 27: r: readonly variable
|
||||
./attr1.sub: line 40: r: readonly variable
|
||||
declare -ar r=([0]="1")
|
||||
./attr1.sub: line 31: readonly: r: readonly variable
|
||||
./attr1.sub: line 44: readonly: r: readonly variable
|
||||
declare -ar r=([0]="1")
|
||||
declare -ar x=([0]="4")
|
||||
in func:declare -ar y=([0]="4")
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
a=(outside)
|
||||
|
||||
f1() { readonly a=(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/>.
|
||||
#
|
||||
m=1
|
||||
readonly m=4
|
||||
declare -p m
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
p=1
|
||||
export p
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
echo ff{c,b,a}
|
||||
echo f{d,e,f}g
|
||||
echo {l,n,m}xyz
|
||||
|
||||
@@ -105,9 +105,9 @@ m n o p
|
||||
/tmp/bash-dir-a
|
||||
/tmp/bash-dir-a
|
||||
/tmp/bash-dir-a
|
||||
./source5.sub: line 10: /tmp/source-notthere: No such file or directory
|
||||
./source5.sub: line 23: /tmp/source-notthere: No such file or directory
|
||||
after bad source 1
|
||||
./source5.sub: line 17: /tmp/source-notthere: No such file or directory
|
||||
./source5.sub: line 30: /tmp/source-notthere: No such file or directory
|
||||
one - OK
|
||||
0
|
||||
0
|
||||
@@ -144,11 +144,11 @@ AVAR
|
||||
foo
|
||||
declare -x foo=""
|
||||
declare -x FOO="\$\$"
|
||||
./builtins.tests: line 213: declare: FOO: not found
|
||||
./builtins.tests: line 226: declare: FOO: not found
|
||||
declare -x FOO="\$\$"
|
||||
ok
|
||||
ok
|
||||
./builtins.tests: line 245: kill: 4096: invalid signal specification
|
||||
./builtins.tests: line 258: kill: 4096: invalid signal specification
|
||||
1
|
||||
a\n\n\nb
|
||||
a
|
||||
@@ -208,8 +208,8 @@ f2 ()
|
||||
all unset:
|
||||
unset1
|
||||
unset2
|
||||
./builtins6.sub: line 28: declare: f1: not found
|
||||
./builtins6.sub: line 28: declare: f2: not found
|
||||
./builtins6.sub: line 41: declare: f1: not found
|
||||
./builtins6.sub: line 41: declare: f2: not found
|
||||
all reset:
|
||||
one-one
|
||||
two-one
|
||||
@@ -235,4 +235,4 @@ f2 ()
|
||||
funcs unset:
|
||||
one-two
|
||||
two-two
|
||||
./builtins.tests: line 266: exit: status: numeric argument required
|
||||
./builtins.tests: line 279: exit: status: numeric argument required
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# tests for miscellaneous builtins not tested elsewhere
|
||||
set +p
|
||||
set +o posix
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
declare -a c
|
||||
declare -p c
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# a start at a test suite for what it means for an array to be set or unset and
|
||||
# how to test that state
|
||||
typeset -A A
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
f1()
|
||||
{
|
||||
echo f1
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ retest
|
||||
and match
|
||||
no more clauses
|
||||
1.0
|
||||
./case.tests: line 29: xx: readonly variable
|
||||
./case.tests: line 42: xx: readonly variable
|
||||
1.1
|
||||
matches 1
|
||||
no
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
case foo in
|
||||
bar) echo skip ;;
|
||||
foo) echo fallthrough ;&
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
x='\x'
|
||||
|
||||
case x in
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
x=$'\\a\\b\\c\\\001\\d\\e\\f'
|
||||
y='\a\b\c\\d\e\f'
|
||||
z=$'abc\001def'
|
||||
|
||||
+13
-1
@@ -1,4 +1,16 @@
|
||||
#!/bin/sh
|
||||
# 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/>.
|
||||
#
|
||||
|
||||
testmatch() {
|
||||
case $1 in
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
shopt -s -o posix
|
||||
two="t w o"
|
||||
ten="t e
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
S1=acknowledgement
|
||||
S2=oenophile
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
: ${HOME:=/}
|
||||
|
||||
# works right
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# problem with bash-4.x versions before bash-4.2. required posix interp
|
||||
swap32_posix()
|
||||
{
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# parsing errors before bash-4.2
|
||||
|
||||
a=$(/bin/cat << EOF | wc -l
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
./comsub.tests: line 7: hijkl: command not found
|
||||
./comsub.tests: line 20: hijkl: command not found
|
||||
argv[1] = <ab>
|
||||
argv[2] = <cd>
|
||||
argv[1] = <abmn>
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# command substution parsing tests
|
||||
|
||||
TABSIZE=`grep -v '^[ #]' $CAPS </dev/null | grep -v "^$" | grep -v "^capalias"| grep -v "^infoalias" | wc -l`
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
: $(echo \;)
|
||||
|
||||
: $(case a in a) echo ;;# comment
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
x=$(
|
||||
case 1 in
|
||||
1) echo 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/>.
|
||||
#
|
||||
x=$(cat <<'EOT'
|
||||
d \
|
||||
g
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
VAR='[[:alpha:]]'
|
||||
|
||||
[[ $VAR =~ '[[:alpha:]]' ]] && echo match 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/>.
|
||||
#
|
||||
[[ "\\" =~ ["."] ]] && echo bad 1
|
||||
|
||||
[[ "\\" =~ "[.]" ]] && echo bad 2
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
# simple expansion -- no problem, it's quote_string_for_globbing that was flawed
|
||||
c=$'\177'
|
||||
r="\\$c"
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ returns: 0
|
||||
returns: 1
|
||||
returns: 1
|
||||
returns: 0
|
||||
./cond.tests: line 101: [[: 4+: syntax error: operand expected (error token is "+")
|
||||
./cond.tests: line 114: [[: 4+: syntax error: operand expected (error token is "+")
|
||||
returns: 1
|
||||
returns: 0
|
||||
returns: 0
|
||||
|
||||
Executable → Regular
+13
@@ -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/>.
|
||||
#
|
||||
#
|
||||
# the test/[ code is tested elsewhere, and the [[...]] just uses the same
|
||||
# code. this tests the special features of [[...]]
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
: ${TMPDIR:=/tmp}
|
||||
TMPOUT=${TMPDIR}/coproc-wait-$BASHPID
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user