commit bash-20141226 snapshot

This commit is contained in:
Chet Ramey
2015-01-12 10:57:11 -05:00
parent 5e37553a07
commit 83633b6f04
18 changed files with 387 additions and 117 deletions
+46 -1
View File
@@ -7613,7 +7613,7 @@ builtins/declare.def
is of the form (word) and is assigned to an array variable like so:
declare -x var=$value. Bug reported by Stephane Chazelas
<stephane.chazelas@gmail.com>. Will eventually be contingent on
compatibility level > 43, but not there yet
compatibility level > 43, but not there yet. TENTATIVE
12/15
-----
@@ -7637,6 +7637,8 @@ execute_cmd.c
like `declare -al foo=(UPONE UPTWO UPTHREE)' not being lowercased on
assignment reported by Linda Walsh <bash@tlinx.org>
12/18
-----
lib/readline/readline.c
@@ -7654,3 +7656,46 @@ lib/readline/readline.c
most recently identified by Jiri Kukacka <jiri.kukacka@orcle.com>,
it has come up in the past
12/21
-----
builtins/declare.def
- declare_internal: keep track of whether or not an assignment statement
argument to declare is an array subscript assignment; need to
differentiate assignments from straight declarations (declare a[4])
which are accepted for backwards compatibility
- assignment statements like declare a[2]=foo are now treated as
straight subscript assignment statements if a already exists as an
array variable
- declare foo='(1 2 3)' is treated as an assignment to foo[0] if foo
exists and is an array, just as it would be if it were an assignment
statement and `declare' was not present. All this from a proposal
by Stephane Chazelas <stephane.chazelas@gmail.com>
12/22
-----
builtins/read.def
- read_tty_modified: function to tell the rest of the shell if the
read builtin has modified the tty
- read_builtin: make sure to initialize terminating signals before
installing a SIGALRM signal handler in case we modify the tty as
well as ask for a timeout; the subsequent call to
initialize_terminating_signals would overwrite the read-builtin-
local SIGALRM handler
builtins/common.h
- read_tty_modified: new extern declaration
shell.c
- exit_shell: if read_tty_modified() returns true, call read_tty_cleanup
to undo the terminal modifications. Extension of previous fixes;
fixes bug with read -s reported by Richard W. Marsden
<richard@marsden.nu>
12/23
-----
builtins/setattr.def
- show_var_attributes: call print_array_assignment and print_assoc_assignment
with a `not quoted' flag so the assignment statements are not
surrounded by single quotes. Caused changes to a lot of test output
+1
View File
@@ -833,6 +833,7 @@ tests/array15.sub f
tests/array16.sub f
tests/array17.sub f
tests/array18.sub f
tests/array19.sub f
tests/array-at-star f
tests/array2.right f
tests/assoc.tests f
+1
View File
@@ -145,6 +145,7 @@ extern void builtin_help __P((void));
/* Functions from read.def */
extern void read_tty_cleanup __P((void));
extern int read_tty_modified __P((void));
/* Functions from set.def */
extern int minus_o_option_value __P((char *));
-5
View File
@@ -558,12 +558,7 @@ declare_internal (list, local_var)
#if 0 /* bash-4.4 */
if (value[0] == '(' && value[vlen-1] == ')' && (shell_compatibility_level <= 43 || (wflags & W_COMPASSIGN)))
#else
# if 0
if (value[0] == '(' && value[vlen-1] == ')' && (wflags & W_COMPASSIGN))
# else
/* This is the code as in bash-4.3 */
if (array_exists == 0 && value[0] == '(' && value[vlen-1] == ')')
# endif
#endif
compound_array_assign = 1;
else
+8
View File
@@ -439,6 +439,8 @@ read_builtin (list)
retval = 128+SIGALRM;
goto assign_vars;
}
if (interactive_shell == 0)
initialize_terminating_signals ();
old_alrm = set_signal_handler (SIGALRM, sigalrm);
add_unwind_protect (reset_alarm, (char *)NULL);
#if defined (READLINE)
@@ -997,6 +999,12 @@ read_tty_cleanup ()
ttyrestore (&termsave);
}
int
read_tty_modified ()
{
return (tty_modified);
}
#if defined (READLINE)
static rl_completion_func_t *old_attempted_completion_function = 0;
static rl_hook_func_t *old_startup_hook;
+3 -3
View File
@@ -1,7 +1,7 @@
This file is setattr.def, from which is created setattr.c.
It implements the builtins "export" and "readonly", in Bash.
Copyright (C) 1987-2012 Free Software Foundation, Inc.
Copyright (C) 1987-2014 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -452,9 +452,9 @@ show_var_attributes (var, pattr, nodefs)
if (invisible_p (var) && (array_p (var) || assoc_p (var)))
printf ("%s\n", var->name);
else if (array_p (var))
print_array_assignment (var, 1);
print_array_assignment (var, 0);
else if (assoc_p (var))
print_assoc_assignment (var, 1);
print_assoc_assignment (var, 0);
else
#endif
/* force `readonly' and `export' to not print out function definitions
+1 -1
View File
@@ -2492,7 +2492,7 @@ wait_for (pid)
job to finish. Otherwise, we are waiting for the child to finish.
We check for JDEAD in case the job state has been set by waitchld
after receipt of a SIGCHLD. */
if (job == NO_JOB)
if (job == NO_JOB) /* XXX -- && pid != ANY_PID ? */
job = find_job (pid, 0, NULL);
/* waitchld() takes care of setting the state of the job. If the job
BIN
View File
Binary file not shown.
+3
View File
@@ -911,10 +911,13 @@ exit_shell (s)
fflush (stdout); /* XXX */
fflush (stderr);
/* Clean up the terminal if we are in a state where it's been modified. */
#if defined (READLINE)
if (RL_ISSTATE (RL_STATE_TERMPREPPED) && rl_deprep_term_function)
(*rl_deprep_term_function) ();
#endif
if (read_tty_modified ())
read_tty_cleanup ();
/* Do trap[0] if defined. Allow it to override the exit status
passed to us. */
+5 -5
View File
@@ -16,11 +16,11 @@
9
16
./appendop.tests: line 84: 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" )'
declare -ai iarr='([0]="3" [1]="2" [2]="3")'
declare -ai iarr='([0]="3" [1]="2" [2]="3" [3]="4" [4]="5" [5]="6")'
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" )
declare -ai iarr=([0]="3" [1]="2" [2]="3")
declare -ai iarr=([0]="3" [1]="2" [2]="3" [3]="4" [4]="5" [5]="6")
25 25
7 7
14
+98 -50
View File
@@ -6,13 +6,13 @@ abcde
abcde
abcde bdef
abcde bdef
declare -a BASH_ARGC='()'
declare -a BASH_ARGV='()'
declare -a BASH_LINENO='([0]="0")'
declare -a BASH_SOURCE='([0]="./array.tests")'
declare -a DIRSTACK='()'
declare -a BASH_ARGC=()
declare -a BASH_ARGV=()
declare -a BASH_LINENO=([0]="0")
declare -a BASH_SOURCE=([0]="./array.tests")
declare -a DIRSTACK=()
declare -a FUNCNAME
declare -a a='([0]="abcde" [1]="" [2]="bdef")'
declare -a a=([0]="abcde" [1]="" [2]="bdef")
declare -a b
declare -ar c
abcde bdef
@@ -27,25 +27,25 @@ hello world
3
bdef hello world test expression test 2
./array.tests: line 76: readonly: `a[5]': not a valid identifier
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")'
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")'
declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
declare -ar c
readonly -a a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")'
readonly -a a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
readonly -a c
a test
declare -a BASH_ARGC='()'
declare -a BASH_ARGV='()'
declare -a BASH_LINENO='([0]="0")'
declare -a BASH_SOURCE='([0]="./array.tests")'
declare -a DIRSTACK='()'
declare -a BASH_ARGC=()
declare -a BASH_ARGV=()
declare -a BASH_LINENO=([0]="0")
declare -a BASH_SOURCE=([0]="./array.tests")
declare -a DIRSTACK=()
declare -a FUNCNAME
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")'
declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
declare -a b=([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")
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")'
declare -a d=([1]="" [2]="bdef" [5]="hello world" [6]="test" [9]="ninth element")
declare -a e=([10]="(test)")
declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
./array.tests: line 100: a: readonly variable
./array.tests: line 102: b[]: bad array subscript
./array.tests: line 103: b[*]: bad array subscript
@@ -57,35 +57,35 @@ declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element
./array.tests: line 111: []=abcde: bad array subscript
./array.tests: line 111: [*]=last: cannot assign to non-numeric index
./array.tests: line 111: [-65]=negative: bad array subscript
declare -a BASH_ARGC='()'
declare -a BASH_ARGV='()'
declare -a BASH_LINENO='([0]="0")'
declare -a BASH_SOURCE='([0]="./array.tests")'
declare -a DIRSTACK='()'
declare -a BASH_ARGC=()
declare -a BASH_ARGV=()
declare -a BASH_LINENO=([0]="0")
declare -a BASH_SOURCE=([0]="./array.tests")
declare -a DIRSTACK=()
declare -a FUNCNAME
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")'
declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
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")'
declare -a d=([1]="test test")
declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
./array.tests: line 119: unset: ps1: not an array variable
./array.tests: line 123: declare: c: cannot destroy array variables in this way
this of
this is a test of read using arrays
this test
this is a test of arrays
declare -a BASH_ARGC='()'
declare -a BASH_ARGV='()'
declare -a BASH_LINENO='([0]="0")'
declare -a BASH_SOURCE='([0]="./array.tests")'
declare -a DIRSTACK='()'
declare -a BASH_ARGC=()
declare -a BASH_ARGV=()
declare -a BASH_LINENO=([0]="0")
declare -a BASH_SOURCE=([0]="./array.tests")
declare -a DIRSTACK=()
declare -a FUNCNAME
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")'
declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
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")'
declare -a rv='([0]="this" [1]="is" [2]="a" [3]="test" [4]="of" [5]="read" [6]="using" [7]="arrays")'
declare -a d=([1]="test test")
declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
declare -a rv=([0]="this" [1]="is" [2]="a" [3]="test" [4]="of" [5]="read" [6]="using" [7]="arrays")
abde
abde
bbb
@@ -364,22 +364,22 @@ bar
main main
function function
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")'
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: [-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")'
declare -a x='([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="foo")'
declare -a x='([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="5")'
declare -a x='([0]="0" [1]="1" [2]="2" [3]="3" [4]="4four" [5]="5")'
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")
declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="foo")
declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="5")
declare -a x=([0]="0" [1]="1" [2]="2" [3]="3" [4]="4four" [5]="5")
strlen(4four) = 5
1 2 xx 3
1 2 0 3
1 2 xx 3
1 2 0 3
1 2 xx 3
1 2 0 3
1 2 0 3
1 2 0 3
foo index 1: ok
foo index 2: ok
foo: implicit reference to element 0: ok
@@ -432,3 +432,51 @@ argv[1] = <qux>
argv[1] = <->
argv[2] = <->
argv[1] = < >
declare -a foo=([0]="( zeroind )")
declare -a foo=([0]="zeroind")
declare -a foo=([0]="zeroind")
declare -a foo=([0]="[0]=bar")
declare -a foo=([0]="[0]=bar")
declare -a foo=([0]="[0]=bar")
declare -- a="(1 2 3)"
declare -a a=([0]="(1 2 3)")
declare -A a=([0]="(1 2 3)" )
declare -- a="([0]=a [1]=b)"
declare -a a=([0]="([0]=a [1]=b)")
declare -A a=([0]="([0]=a [1]=b)" )
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")
declare -a var=()
declare -al foo=([0]="abcde" [1]="two" [2]="three")
declare -al foo=([0]="(abcde)" [1]="two" [2]="three")
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")
declare -a a=([0]="var")
declare -a a=([0]="1" [1]="2" [2]="(1 2 3)")
declare -a a=([0]="1" [1]="2" [2]="(1 2 3)")
declare -a a=([0]="(1 2 3)" [1]="2" [2]="3")
declare -a a=([0]="(1 2 3)" [1]="2" [2]="3")
declare -a a=([0]="1" [1]="2" [2]="3")
declare -- a="a b"
declare -- b="/scratch/bash"
declare -- c="(1 2)"
declare -- d="(\$a)"
declare -- e="(\$(echo Darwin))"
declare -a a=([0]="a b")
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
declare -A a=([0]="a b" )
declare -A b=([0]="/scratch/bash" )
declare -A c=()
declare -A d=()
declare -A e=()
+2
View File
@@ -404,3 +404,5 @@ ${THIS_SH} ./array16.sub
${THIS_SH} ./array17.sub
${THIS_SH} ./array18.sub
${THIS_SH} ./array19.sub
+167
View File
@@ -0,0 +1,167 @@
# tests for changes to declare and assignment statement arguments post-bash-4.3
unset foo l a b
l="( zeroind )"
unset foo
declare -a foo
foo="$l"
declare -p foo
unset foo
declare -a foo="$l"
declare -p foo
unset foo
declare -a foo=$l
declare -p foo
b='[0]=bar'
unset foo
declare -a foo="$b"
declare -p foo
unset foo
declare -a foo=("$b")
declare -p foo
unset foo
declare -a foo=($b)
declare -p foo
unset a
declare a='(1 2 3)'
declare -p a
unset a
declare -a a
declare a='(1 2 3)'
declare -p a
unset a
declare -A a
declare a='(1 2 3)'
declare -p a
unset a
declare a='([0]=a [1]=b)'
declare -p a
unset a
declare -a a
declare a='([0]=a [1]=b)'
declare -p a
unset a
declare -A a
declare a='([0]=a [1]=b)'
declare -p a
unset a
unset var value
value='[$(echo total 0)]=1 [2]=2]'
unset var
declare -a var
var=($value)
declare -p var
unset var
declare -a var=("$value")
declare -p var
unset var
declare -a var=($value)
declare -p var
unset var
declare -a var="($value)"
declare -p var
unset foo value
value="AbCdE"
declare -a foo
foo=( one two three )
declare -l foo="$value"
declare -p foo
unset foo
value='(AbCdE)'
declare -a foo
foo=( one two three )
declare -l foo="$value"
declare -p foo
unset ar
declare -a ar=(ONE TWO THREE)
declare -al ar=(${ar[@]})
declare -p ar
unset a
declare -a a
a[2]=foo
declare -p a
unset a
declare -a a
declare a[2]=foo
declare -p a
declare a[1]='(var)'
declare -p a
unset a
declare a[1]='(var)'
declare -p a
unset a
a=(1 2 3)
a[2]='(1 2 3)'
declare -p a
unset a
a=(1 2 3)
declare a[2]='(1 2 3)'
declare -p a
unset a
a=(1 2 3)
declare a='(1 2 3)'
declare -p a
unset a
a=(1 2 3)
declare 'a=(1 2 3)'
declare -p a
unset a
declare -a a='(1 2 3)'
declare -p a
unset a b c d e x y
HOME=/scratch/bash
x='a b'
y='($(echo Darwin))'
declare a=$x b=~ c='(1 2)' d='($a)' e=$y
declare -p a b c d e
unset a b c d e
declare -a a=$x b=~ c='(1 2)' d='($a)' e=$y
declare -p a b c d e
unset a b c d e
declare -A a=$x b=~ c='(1 2)' d='($a)' e=$y
declare -p a b c d e
+35 -35
View File
@@ -1,23 +1,23 @@
declare -A BASH_ALIASES='()'
declare -A BASH_CMDS='()'
declare -A BASH_ALIASES=()
declare -A BASH_CMDS=()
declare -A fluff
declare -A BASH_ALIASES='()'
declare -A BASH_CMDS='()'
declare -A fluff='([bar]="two" [foo]="one" )'
declare -A fluff='([bar]="two" [foo]="one" )'
declare -A fluff='([bar]="two" )'
declare -A fluff='([bar]="newval" [qux]="assigned" )'
declare -A BASH_ALIASES=()
declare -A BASH_CMDS=()
declare -A fluff=([bar]="two" [foo]="one" )
declare -A fluff=([bar]="two" [foo]="one" )
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
declare -A BASH_ALIASES='()'
declare -A BASH_CMDS='()'
declare -Ai chaff='([one]="10" [zero]="5" )'
declare -Ar waste='([version]="4.0-devel" [source]="./assoc.tests" [lineno]="28" [pid]="42134" )'
declare -A wheat='([two]="b" [three]="c" [one]="a" [zero]="0" )'
declare -A chaff='([one]="10" ["hello world"]="flip" [zero]="5" )'
declare -A BASH_ALIASES=()
declare -A BASH_CMDS=()
declare -Ai chaff=([one]="10" [zero]="5" )
declare -Ar waste=([version]="4.0-devel" [source]="./assoc.tests" [lineno]="28" [pid]="42134" )
declare -A wheat=([two]="b" [three]="c" [one]="a" [zero]="0" )
declare -A chaff=([one]="10" ["hello world"]="flip" [zero]="5" )
./assoc.tests: line 38: unset: waste: cannot unset: readonly variable
./assoc.tests: line 39: chaff[*]: bad array subscript
./assoc.tests: line 40: [*]=12: invalid associative array key
declare -A chaff='([one]="a" ["hello world"]="flip" )'
declare -A chaff=([one]="a" ["hello world"]="flip" )
flip
argv[1] = <a>
argv[2] = <flip>
@@ -34,11 +34,11 @@ argv[1] = <a flip multiple words>
./assoc.tests: line 57: declare: chaff: cannot destroy array variables in this way
./assoc.tests: line 59: chaff[*]: bad array subscript
./assoc.tests: line 60: [*]=12: invalid associative array key
declare -A wheat='([six]="6" ["foo bar"]="qux qix" )'
declare -A wheat=([six]="6" ["foo bar"]="qux qix" )
argv[1] = <qux>
argv[2] = <qix>
argv[1] = <qux qix>
declare -A wheat='([six]="6" ["foo bar"]="qux qix" )'
declare -A wheat=([six]="6" ["foo bar"]="qux qix" )
argv[1] = <2>
argv[1] = <7>
argv[1] = <qux>
@@ -101,9 +101,9 @@ argv[2] = </usr/sbin/foo>
argv[3] = <cd /blat ; echo $PWD>
argv[4] = </usr/local/bin/qux -l>
outside: outside
declare -A BASH_ALIASES='()'
declare -A BASH_CMDS='()'
declare -A afoo='([six]="six" ["foo bar"]="foo quux" )'
declare -A BASH_ALIASES=()
declare -A BASH_CMDS=()
declare -A afoo=([six]="six" ["foo bar"]="foo quux" )
argv[1] = <inside:>
argv[2] = <six>
argv[3] = <foo quux>
@@ -144,49 +144,49 @@ myarray=(["a]=test1;#a"]="123" [foo]="bleh" ["a]a"]="abc" ["]"]="def" )
myarray=(["a]=test1;#a"]="123" [foo]="bleh" ["a]a"]="abc" ["a]=test2;#a"]="def" ["]"]="def" )
bar"bie
doll
declare -A foo='(["bar\"bie"]="doll" )'
declare -A foo=(["bar\"bie"]="doll" )
bar"bie
doll
declare -A foo='(["bar\"bie"]="doll" )'
declare -A foo=(["bar\"bie"]="doll" )
bar"bie
doll
declare -A foo='(["bar\"bie"]="doll" )'
declare -A foo=(["bar\"bie"]="doll" )
bar"bie
doll
declare -A foo='(["bar\"bie"]="doll" )'
declare -A foo=(["bar\"bie"]="doll" )
bar"bie
doll
declare -A foo='(["bar\"bie"]="doll" )'
declare -A foo=(["bar\"bie"]="doll" )
bar'bie
doll
declare -A foo='(["bar'\''bie"]="doll" )'
declare -A foo=(["bar'bie"]="doll" )
bar'bie
doll
declare -A foo='(["bar'\''bie"]="doll" )'
declare -A foo=(["bar'bie"]="doll" )
bar'bie
doll
declare -A foo='(["bar'\''bie"]="doll" )'
declare -A foo=(["bar'bie"]="doll" )
bar'bie
doll
declare -A foo='(["bar'\''bie"]="doll" )'
declare -A foo=(["bar'bie"]="doll" )
bar'bie
doll
declare -A foo='(["bar'\''bie"]="doll" )'
declare -A foo=(["bar'bie"]="doll" )
bar$bie
doll
declare -A foo='(["bar\$bie"]="doll" )'
declare -A foo=(["bar\$bie"]="doll" )
bar[bie
doll
declare -A foo='(["bar[bie"]="doll" )'
declare -A foo=(["bar[bie"]="doll" )
bar`bie
doll
declare -A foo='(["bar\`bie"]="doll" )'
declare -A foo=(["bar\`bie"]="doll" )
bar\]bie
doll
declare -A foo='(["bar\\]bie"]="doll" )'
declare -A foo=(["bar\\]bie"]="doll" )
bar${foo}bie
doll
declare -A foo='(["bar\${foo}bie"]="doll" )'
declare -A foo=(["bar\${foo}bie"]="doll" )
bar
after printf
after use: 0
+6 -6
View File
@@ -160,12 +160,12 @@ inside
after: f = 8 bar = 4
declare -a c
declare -A d
declare -a c='([0]="4")'
declare -A c='([0]="4" )'
declare -a c='([0]="1" [1]="2" [2]="3")'
declare -A c='([two]="2" [three]="3" [one]="1" )'
declare -a c='([0]="1" [1]="2" [2]="3")'
declare -a c='([0]="1" [1]="2" [2]="3")'
declare -a c=([0]="4")
declare -A c=([0]="4" )
declare -a c=([0]="1" [1]="2" [2]="3")
declare -A c=([two]="2" [three]="3" [one]="1" )
declare -a c=([0]="1" [1]="2" [2]="3")
declare -a c=([0]="1" [1]="2" [2]="3")
unset
unset
./builtins.tests: line 260: exit: status: numeric argument required
+3 -3
View File
@@ -348,17 +348,17 @@ third set:
"${@:2}a3 a2" a$1 #works as long as $1 and 3 are swapped
set y za3 a2 ax
0
declare -a a='([0]="y" [1]="za3 a2" [2]="ax")'
declare -a a=([0]="y" [1]="za3 a2" [2]="ax")
"${@:2}b$1 b2" b3 #fails! why?
set y zbx b2 b3
0
declare -a b='([0]="y" [1]="zbx b2" [2]="b3")'
declare -a b=([0]="y" [1]="zbx b2" [2]="b3")
${@:2}c$1 c2 c3 #works as long as quoting omitted
set y zcx c2 c3
0
declare -a c='([0]="y" [1]="zcx" [2]="c2" [3]="c3")'
declare -a c=([0]="y" [1]="zcx" [2]="c2" [3]="c3")
argv[1] = <>
argv[2] = <x>
argv[1] = <>
+2 -2
View File
@@ -24,5 +24,5 @@ f3 ()
echo $(echo hi)
echo ho
echo off to work we go
declare -a uu='([0]="" [1]="kghfjk" [2]="jkfzuk" [3]="i
")'
declare -a uu=([0]="" [1]="kghfjk" [2]="jkfzuk" [3]="i
")
+6 -6
View File
@@ -60,17 +60,17 @@ FIN: asdf fdsa, asdf fdsa
g: v = , w =
f: v = , w =
FIN: v = two, w = one
declare -Ar FOOBAR='([foo]="bar" )'
declare -Ar FOOBAR='([foo]="bar" )'
declare -ar FOOBAR2='([0]="bar")'
declare -ar FOOBAR2='([0]="bar")'
declare -Ar FOOBAR=([foo]="bar" )
declare -Ar FOOBAR=([foo]="bar" )
declare -ar FOOBAR2=([0]="bar")
declare -ar FOOBAR2=([0]="bar")
F OUTSIDE
F OUTSIDE
declare -ar outside='()'
declare -ar outside=()
declare -ir outside1="1"
tempenv = foo
0
declare -ar myvar='([0]="0")'
declare -ar myvar=([0]="0")
1
declare -ir myvar="1"
declare -rx tempvar1='foo'