bash-5.1 distribution sources and documentation

This commit is contained in:
Chet Ramey
2020-12-06 15:51:17 -05:00
parent 36f2c406ff
commit 8868edaf22
828 changed files with 94641 additions and 56509 deletions
+11 -1
View File
@@ -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
@@ -30,3 +30,13 @@ a b
a a b
ok 3
ok 4
bar
bad
0
<|cat>
foo
bar
baz
foo
bar
baz
+14
View File
@@ -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
@@ -40,3 +53,4 @@ ${THIS_SH} ./alias1.sub
${THIS_SH} ./alias2.sub
${THIS_SH} ./alias3.sub
${THIS_SH} ./alias4.sub
${THIS_SH} ./alias5.sub
+13
View File
@@ -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
+13
View File
@@ -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
View File
@@ -1,4 +1,3 @@
#!/bin/bash
shopt -s expand_aliases
alias foo='oneword'
foo_word='foo'
+30
View File
@@ -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
@@ -68,3 +81,20 @@ long_comment text after
# comment
comment foo bar
# alias ending in a tab
alias foo="\
echo \"bar\" \
"
foo
alias foo=$'echo bad \t'
foo
# this should probably just echo a blank line to stdout
alias foo='echo 0'
foo>&2
alias a='printf "<%s>\n" \'
a|cat
+28
View File
@@ -0,0 +1,28 @@
# 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}
${THIS_SH} -c "shopt -s expand_aliases &>/dev/null;
alias myalias='/bin/echo foo
echo bar
echo baz'
myalias"
${THIS_SH} -c "shopt -s expand_aliases &>/dev/null;
alias myalias='echo foo
echo bar
echo baz'
myalias"
+3 -3
View File
@@ -15,10 +15,10 @@
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" )
declare -A foo=([0]="zero" [two]="baz" [three]="quux" [one]="bar" )
declare -A foo=([four]="four" [0]="zero" [two]="baz" [three]="quux" [one]="bar" )
declare -ai iarr=([0]="3" [1]="2" [2]="3")
declare -ai iarr=([0]="3" [1]="2" [2]="3" [3]="4" [4]="5" [5]="6")
25 25
+13
View File
@@ -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
+13
View File
@@ -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
+13
View File
@@ -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 "'
+4 -4
View File
@@ -64,11 +64,11 @@ fx ()
0
1
2
bash: -c: line 0: syntax error: arithmetic expression required
bash: -c: line 0: syntax error: `(( i=0; "i < 3" ))'
bash: -c: line 1: syntax error: arithmetic expression required
bash: -c: line 1: syntax error: `(( i=0; "i < 3" ))'
2
bash: -c: line 0: syntax error: `;' unexpected
bash: -c: line 0: syntax error: `(( i=0; i < 3; i++; 7 ))'
bash: -c: line 1: syntax error: `;' unexpected
bash: -c: line 1: syntax error: `(( i=0; i < 3; i++; 7 ))'
2
20
20
+13
View File
@@ -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
+35 -35
View File
@@ -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")
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 162: 3425#56: invalid arithmetic base (error token is "3425#56")
./arith.tests: line 165: 2#: invalid integer constant (error token is "2#")
./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")
+14 -1
View File
@@ -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
@@ -148,7 +161,7 @@ echo $(( 64#_ ))
# weird bases
echo $(( 3425#56 ))
# missing number after base
# missing number after base now generates an error
echo $(( 2# ))
# these should generate errors
+13
View File
@@ -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++ ))
+13
View File
@@ -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 ))
+22 -7
View File
@@ -1,29 +1,44 @@
# 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]++ ))
echo ${dice[5]}
echo ${dice[6]}
(( ++dice[RANDOM%6+1 + RANDOM%6+1] ))
echo ${dice[6]}
echo ${dice[7]}
v=4
DIND=20
(( dice[DIND%6 + 1]=v ))
echo ${dice[3]}
(( dice[DIND/v]+=2 ))
RANDOM=42
(( dice[RANDOM%6+1 + RANDOM%6+1]+=v ))
echo ${dice[5]}
(( dice[RANDOM%6+1 + RANDOM%6+1]-=v ))
echo ${dice[6]}
(( dice[RANDOM%6+1 + RANDOM%6+1]-=v ))
echo ${dice[7]}
(( dice[RANDOM%6+1 + RANDOM%6+1]+=2 ))
echo ${dice[11]}
echo ${dice[8]}
(( dice[RANDOM%6+1 + RANDOM%6+1]*=2 ))
echo ${dice[11]}
echo ${dice[5]}
unset dice1 dice2
RANDOM=42
+16
View File
@@ -1,3 +1,19 @@
# 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 lot of this is technically undefined behavior due to signed 64-bit
# integer overflow, but we're testing exception handling here
intmax_max=$((2**63 - 1))
intmax_min1=$((2**63))
intmax_min2=$((-2**63))
+13
View File
@@ -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) ))
+13
View File
@@ -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
+59 -58
View File
@@ -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
@@ -203,6 +203,7 @@ e
'b
b c
$0
declare -a A=([0]="X=a" [1]="b")
t
[3]=abcde r s t u v
e
@@ -349,10 +350,10 @@ version[agent]
version.agent
version[agent]
version.agent
version[agent] foo[bar]
version.agent bowl
foo foobar] foo[bar]
bbb bleh bleh
foo[bar] version[agent]
bowl version.agent
foobar] foo foo[bar]
bleh bbb bleh
ab]
bar
1
@@ -367,7 +368,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 +396,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,14 +411,15 @@ 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] = <>
argv[3] = <>
argv[1] = <bar>
argv[1] = <-->
argv[1] = <>
argv[1] = <->
argv[2] = <->
argv[1] = < >
argv[1] = <qux>
argv[1] = <->
argv[2] = <->
@@ -426,8 +428,9 @@ argv[1] = <>
argv[2] = <>
argv[3] = <>
argv[1] = <bar>
argv[1] = <-->
argv[1] = <>
argv[1] = <->
argv[2] = <->
argv[1] = < >
argv[1] = <qux>
argv[1] = <->
argv[2] = <->
@@ -440,17 +443,13 @@ 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
declare -A a=()
declare -- a="([0]=a [1]=b)"
declare -a a=([0]="a" [1]="b")
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 89: 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")
@@ -458,7 +457,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 128: 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)")
@@ -475,15 +474,11 @@ 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=()
declare -A c=([1]="2" )
declare -A d=(["a b"]="" )
declare -A e=([Darwin]="" )
a+b+c
x+b+c
a+b+c
@@ -497,8 +492,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")
@@ -523,16 +518,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
@@ -586,7 +581,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
@@ -748,17 +743,23 @@ 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
declare -a bug4=([0]="" [1]="5" [2]="" [3]="1" [4]="")
declare -a bug=([0]="" [1]="5" [2]="" [3]="1" [4]="")
declare -a bug2=([0]="")
declare -a bug3=([0]="" [1]="5" [2]="" [3]="1" [4]="")
declare -a not_bug=([0]="no" [1]="nulls")
declare -a workaround=([0]="")
+21 -2
View File
@@ -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
@@ -155,7 +168,7 @@ echo ${x[4]}
echo efgh | ( read x[1] ; echo ${x[1]} )
echo wxyz | ( declare -a x ; read x ; echo $x ; echo ${x[0]} )
# Make sure that arrays can be used to save the positional paramters verbatim
# Make sure that arrays can be used to save the positional parameters verbatim
set -- a 'b c' d 'e f g' h
ARGV=( [0]=$0 "$@" )
@@ -247,7 +260,7 @@ ${THIS_SH} ./array2.sub
# some old bugs and ksh93 compatibility tests
${THIS_SH} ./array3.sub
# some compound assingment parsing problems that showed up in bash-3.1-release
# some compound assignment parsing problems that showed up in bash-3.1-release
${THIS_SH} ./array4.sub
set +u
@@ -379,6 +392,11 @@ declare -a x=($0)
declare -a x=(\$0)
echo "${x[@]}"
unset A Z
Z='a b'
A=( X=$Z )
declare -p A
# tests for bash-3.1 problems
${THIS_SH} ./array5.sub
@@ -406,3 +424,4 @@ ${THIS_SH} ./array24.sub
${THIS_SH} ./array25.sub
${THIS_SH} ./array26.sub
${THIS_SH} ./array27.sub
${THIS_SH} ./array28.sub
+13
View File
@@ -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[@]}
+13
View File
@@ -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
+13
View File
@@ -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
View File
@@ -1,4 +1,3 @@
#!/bin/bash
func1(){
declare -g variable='function'
+13
View File
@@ -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
+13
View File
@@ -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[@]}"
+13
View File
@@ -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
+13
View File
@@ -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
+13
View File
@@ -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
+13 -5
View File
@@ -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
@@ -42,11 +55,6 @@ 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
+13
View File
@@ -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
+13
View File
@@ -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)
+13
View File
@@ -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
+13
View File
@@ -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
+13
View File
@@ -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=("$@")
+13
View File
@@ -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:
+13
View File
@@ -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
+13
View File
@@ -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
+30
View File
@@ -0,0 +1,30 @@
# 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 assigning empty string array elements without subscripts
function foo()
{
local bug=("" "5" "" 1 "")
declare -a bug2=("")
declare -ga bug3=("" "5" "" 1 "")
local not_bug=("no" "nulls")
local workaround; workaround=("")
declare -p bug bug2 bug3 not_bug workaround
}
declare -a bug4=("" "5" "" 1 "")
declare -p bug4
foo
+13
View File
@@ -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()
{
+13
View File
@@ -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}
+13
View File
@@ -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"
+13
View File
@@ -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
+13
View File
@@ -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 ))
+78 -49
View File
@@ -6,18 +6,18 @@ declare -A BASH_CMDS=()
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
declare -A fluff=([qux]="assigned" [bar]="newval" )
./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 -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
declare -Ai chaff=([one]="10" [zero]="5" )
declare -Ar waste=([pid]="42134" [lineno]="41" [source]="./assoc.tests" [version]="4.0-devel" )
declare -A wheat=([two]="b" [three]="c" [one]="a" [zero]="0" )
declare -A chaff=(["hello world"]="flip" [one]="10" [zero]="5" )
./assoc.tests: line 51: waste: readonly variable
./assoc.tests: line 52: unset: waste: cannot unset: readonly variable
./assoc.tests: line 53: 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,14 +32,14 @@ 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
declare -A wheat=(["foo bar"]="qux qix" [six]="6" )
./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=([six]="6" ["foo bar"]="qux qix" )
argv[1] = <qux>
argv[2] = <qix>
argv[1] = <qux qix>
declare -A wheat=(["foo bar"]="qux qix" [six]="6" )
declare -A wheat=([six]="6" ["foo bar"]="qux qix" )
argv[1] = <2>
argv[1] = <7>
argv[1] = <qux>
@@ -48,16 +48,16 @@ argv[3] = <blat>
argv[1] = <qux qix blat>
argv[1] = <16>
argv[1] = <16>
argv[1] = <flix>
argv[2] = <6>
argv[1] = <foo>
argv[2] = <bar>
argv[3] = <six>
argv[1] = <foo bar>
argv[2] = <six>
argv[1] = <6>
argv[2] = <flix>
argv[1] = <six>
argv[2] = <foo>
argv[3] = <bar>
argv[1] = <six>
argv[2] = <foo bar>
8
/sbin /usr/bin /bin /usr/ucb /usr/local/bin . /usr/sbin /bin
sbin bin bin ucb bin . sbin bin
/usr/local/bin /bin . /usr/bin /usr/ucb /usr/sbin /bin /sbin
bin bin . bin ucb sbin bin sbin
bin
/ / / / / / /
/
@@ -66,27 +66,27 @@ argv[1] = </>
argv[1] = <sbin>
argv[1] = </>
8
/sbin /usr/bin /bin /usr/ucb /usr/local/bin . /usr/sbin /bin
sbin bin bin ucb bin . sbin bin
/usr/local/bin /bin . /usr/bin /usr/ucb /usr/sbin /bin /sbin
bin bin . bin ucb sbin bin sbin
/ / / / / / /
8
4 -- /bin
^sbin ^usr^bin ^bin ^usr^ucb ^usr^local^bin . ^usr^sbin ^bin
^sbin ^usr^bin ^bin ^usr^ucb ^usr^local^bin . ^usr^sbin ^bin
\sbin \usr/bin \bin \usr/ucb \usr/local/bin . \usr/sbin \bin
\sbin \usr\bin \bin \usr\ucb \usr\local\bin . \usr\sbin \bin
\sbin \usr\bin \bin \usr\ucb \usr\local\bin . \usr\sbin \bin
^usr^local^bin ^bin . ^usr^bin ^usr^ucb ^usr^sbin ^bin ^sbin
^usr^local^bin ^bin . ^usr^bin ^usr^ucb ^usr^sbin ^bin ^sbin
\usr/local/bin \bin . \usr/bin \usr/ucb \usr/sbin \bin \sbin
\usr\local\bin \bin . \usr\bin \usr\ucb \usr\sbin \bin \sbin
\usr\local\bin \bin . \usr\bin \usr\ucb \usr\sbin \bin \sbin
([a]=1)
foo qux
/usr/sbin/foo /usr/local/bin/qux
hits command
0 /sbin/blat
0 /usr/sbin/foo
0 /bin/sh
0 /sbin/blat
0 /usr/local/bin/qux
blat foo sh qux
/sbin/blat /usr/sbin/foo /bin/sh /usr/local/bin/qux
foo sh blat qux
/usr/sbin/foo /bin/sh /sbin/blat /usr/local/bin/qux
foo qux
argv[1] = </usr/sbin/foo>
@@ -104,10 +104,10 @@ argv[4] = </usr/local/bin/qux -l>
outside: outside
declare -A BASH_ALIASES=()
declare -A BASH_CMDS=()
declare -A afoo=(["foo bar"]="foo quux" [six]="six" )
declare -A afoo=([six]="six" ["foo bar"]="foo quux" )
argv[1] = <inside:>
argv[2] = <foo quux>
argv[3] = <six>
argv[2] = <six>
argv[3] = <foo quux>
outside 2: outside
argv[1] = </barq//fooq>
argv[1] = <>
@@ -137,12 +137,12 @@ argv[4] = <FOOQ>
abc
def
def
./assoc5.sub: line 13: declare: `myarray[foo[bar]=bleh': not a valid identifier
bleh def abc
myarray=([foo]="bleh" ["]"]="def" ["a]=test1;#a"]="123" ["a]a"]="abc" )
./assoc5.sub: line 26: declare: `myarray[foo[bar]=bleh': not a valid identifier
def bleh abc
myarray=(["]"]="def" [foo]="bleh" ["a]a"]="abc" ["a]=test1;#a"]="123" )
123
myarray=([foo]="bleh" ["]"]="def" ["a]=test2;#a"]="def" ["a]=test1;#a"]="123" ["a]a"]="abc" )
myarray=(["]"]="def" ["a]=test2;#a"]="def" [foo]="bleh" ["a]a"]="abc" ["a]=test1;#a"]="123" )
bar"bie
doll
declare -A foo=(["bar\"bie"]="doll" )
@@ -195,13 +195,15 @@ declare -A assoc=([0]="assoc" )
assoc
declare -A assoc=([two]="twoless" [three]="three" [one]="onemore" )
declare -Ar assoc=([two]="twoless" [three]="three" [one]="onemore" )
declare -A hash=([key]="value1" )
declare -A hash=([key]="value1 value2" )
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=()
@@ -209,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
@@ -220,12 +222,39 @@ 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
foo
./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
main: declare -- a="7"
f: declare -A a
main: declare -- a="42"
declare -A a=([3]="" [1]="2" )
declare -A foo=([d]="4" [c]="3" [b]="2" [a]="1" )
foo=( d "4" c "3" b "2" a "1" )
declare -A foo=(["\\"]="5" ["@"]="3" ["holy hell this works"]="4" ["a b"]="1" ["spa ces"]="2" )
foo=( echo "\\" "5" "@" "3" "holy hell this works" "4" "a b" "1" "spa ces" "2" )
./assoc11.sub: line 34: "": bad array subscript
declare -A foo=([";"]="semicolon" ["]"]="def" [a=b]="assignment" ["a]a"]="abc" ["foo[bar"]="bleh" )
foo=( ";" "semicolon" "]" "def" a=b "assignment" "a]a" "abc" "foo[bar" "bleh" )
declare -A foo=(["'"]="squote" ["\""]="dquote" ["\\"]="bslash" ["\`"]="backquote" )
foo=( "'" "squote" "\"" "dquote" "\\" "bslash" "\`" "backquote" )
declare -A foo=(["bar]bie"]="doll" ["a]=test1;#a"]="123" ["bar\"bie"]="doll" )
foo=( "bar]bie" "doll" "a]=test1;#a" "123" "bar\"bie" "doll" )
declare -A inside=([c]="3" [b]="2" [a]="1" )
inside=( c "3" b "2" a "1" )
declare -A dict=(["?"]="quest" ["*"]="star" ["'"]="squote" ["\$"]="dol" ["\""]="dquote" ["\\"]="bslash" ["@"]="at" ["}"]="rbrace" ["{"]="lbrace" ["\`"]="bquote" )
dict=( "?" "quest" "*" "star" "'" "squote" "\$" "dol" "\"" "dquote" "\\" "bslash" "@" "at" "}" "rbrace" "{" "lbrace" "\`" "bquote" )
declare -A foo=([two]="" [one]="1" )
foo=( two "" one "1" )
rparen dquote rbrace bs
declare -A a=([")"]="rparen" ["\""]="dquote" ["]"]="rbrace" ["\\"]="bs" )
")" "rparen" "\"" "dquote" "]" "rbrace" "\\" "bs"
declare -A a=([")"]="rparen" ["\""]="dquote" ["]"]="rbrace" ["\\"]="bs" )
declare -A a=([")"]="rparen" ["\""]="dquote" ["]"]="rbrace" ["\\"]="bs" )
declare -A a=([")"]="rparen" ["\""]="dquote" ["]"]="rbrace" ["\\"]="bs" )
declare -Arx foo=([two]="2" [three]="3" [one]="1" )
./assoc11.sub: line 90: foo: readonly variable
+26 -1
View File
@@ -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
@@ -18,7 +31,7 @@ declare -p fluff
unset fluff
# TEST - compount assignment and variable attributes
# TEST - compound assignment and variable attributes
declare -A wheat chaff
wheat=( [zero]=0 [one]=a [two]=b [three]=c )
@@ -213,9 +226,21 @@ declare -p assoc
readonly -A assoc
declare -p assoc
declare -A hash
hash=(["key"]="value1")
declare -p hash
hash=(["key"]="${hash["key"]} value2")
declare -p hash
unset hash
${THIS_SH} ./assoc8.sub
# new shopt option to prevent multiple expansion of assoc array subscripts
${THIS_SH} ./assoc9.sub
${THIS_SH} ./assoc10.sub
# test assigning associative arrays using compound key/value pair assignments
${THIS_SH} ./assoc11.sub
+13
View File
@@ -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[@]}
+13
View File
@@ -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
+90
View File
@@ -0,0 +1,90 @@
# 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 tests were previously in array19.sub, but they are acceptable syntax now
declare -A a
declare a='(1 2 3)'
declare -p a
unset a
declare -A foo
v1='spa ces'
v2=@
foo=(a 1 b 2 c 3 d 4 )
declare -p foo
echo foo=\( ${foo[@]@K} \)
foo=('a b' 1 "$v1" 2 "$v2" 3 'holy hell this works' 4 \\ 5)
declare -p foo
echo foo=\( echo ${foo[@]@K} \)
foo=( "" null )
foo=('a]a' abc ']' def $(echo 'foo[bar') bleh \; semicolon a=b assignment)
declare -p foo
echo foo=\( ${foo[@]@K} \)
foo=('`' backquote '"' dquote "'" squote \\ bslash)
declare -p foo
echo foo=\( ${foo[@]@K} \)
bar='a]=test1;#a'
foo=( $bar 123 bar\"bie doll bar]bie doll )
declare -p foo
echo foo=\( ${foo[@]@K} \)
func()
{
declare -A inside=(a 1 b 2 c 3)
declare -p inside
echo inside=\( ${inside[@]@K} \)
}
func
loaddict()
{
dict=( '"' dquote '`' bquote "'" squote '\' bslash)
dict+=( '$' dol @ at * star \{ lbrace \} rbrace ? quest)
declare -p dict
echo dict=\( ${dict[@]@K} \)
}
declare -A dict
loaddict
foo=(one 1 two)
declare -p foo
echo foo=\( ${foo[@]@K} \)
typeset -A a=( [\\]=bs [\"]=dquote [\)]=rparen [\]]=rbrace )
echo ${a[@]}
declare -p a
echo ${a[@]@K}
echo ${a[@]@A}
eval "${a[@]@A}"
declare -p a
eval "a=( ${a[@]@K} )"
declare -p a
unset a foo
readonly -A foo=( one 1 two 2 three 3 )
export foo
declare -p foo
declare foo+=( seven 7 eight 8 )
+13
View File
@@ -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
+13
View File
@@ -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")
+13
View File
@@ -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
+13
View File
@@ -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
+13
View File
@@ -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)
+13
View File
@@ -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()
{
+20
View File
@@ -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+=([\`]= [\]]=)
@@ -108,3 +121,10 @@ declare myarray["foo[bar"]=bleh
myarray["foo"]=bleh
declare -p myarray
key='$(date >&2)'
declare -A aa
aa[$key]=foo
echo "${aa[$key]}"
[[ -v aa[$key] ]] || echo bad assoc expansion
+8 -8
View File
@@ -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")
+13
View File
@@ -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) ; }
+13
View File
@@ -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
+13
View File
@@ -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
+13
View File
@@ -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
+43 -7
View File
@@ -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,40 @@ f2 ()
funcs unset:
one-two
two-two
./builtins.tests: line 266: exit: status: numeric argument required
bash: line 1: notthere: No such file or directory
one
bash: line 1: notthere: No such file or directory
two
bash: line 1: .: notthere: file not found
one
bash: line 1: .: notthere: file not found
0
0
0
0
argv[1] = <one>
0
argv[1] = <two>
0
three
0
four
0
./builtins7.sub: line 19: : command not found
127
0
./builtins7.sub: line 27: notthere: No such file or directory
after 1
./builtins7.sub: line 28: notthere: No such file or directory
after 2
type is a shell builtin
+ command -v type
type
+ command command -v type
type
+ command -p command -v type
type
+ command -p -- command -v type
type
+ set +x
./builtins.tests: line 282: exit: status: numeric argument required
+18 -2
View File
@@ -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
@@ -124,7 +137,7 @@ hash -r
hash
# this had better succeed, since command -p guarantees we will find the
# standard utilties
# standard utilities
command -p hash rm
# check out source/.
@@ -173,7 +186,7 @@ echo "$@"
# test out cd and $CDPATH
${THIS_SH} ./builtins1.sub
# test behavior of `.' when given a non-existant file argument
# test behavior of `.' when given a non-existent file argument
${THIS_SH} ./source5.sub
# test bugs in sourcing non-regular files, fixed post-bash-3.2
@@ -262,6 +275,9 @@ ${THIS_SH} ./builtins5.sub
# test behavior of unset builtin with -f and -v options
${THIS_SH} ./builtins6.sub
# test behavior of command builtin after changing it to a pseudo-keyword
${THIS_SH} ./builtins7.sub
# this must be last -- it is a fatal error
exit status
+13
View File
@@ -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
+13
View File
@@ -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
+13
View File
@@ -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
+38
View File
@@ -0,0 +1,38 @@
: ${THIS_SH:=./bash}
${THIS_SH} -c 'command . notthere ; echo one' bash
${THIS_SH} -c '. notthere ; echo two' bash
${THIS_SH} -o posix -c 'command . notthere ; echo one' bash
${THIS_SH} -o posix -c '. notthere ; echo two' bash
command ; echo $?
command -- ; echo $?
command -p ; echo $?
command -p -- ; echo $?
command recho one; echo $?
command -- recho two; echo $?
command -p echo three; echo $?
command -p -- echo four ; echo $?
command ''
echo $?
command -p
echo $?
${THIS_SH} -c 'set -e ; command false ; echo after' bash
command command command -p . notthere ; echo after 1
command -p command command . notthere ; echo after 2
command -p command -V type
set -x
command -v type
command command -v type
command -p command -v type
command -p -- command -v type
set +x
+1 -1
View File
@@ -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
+13
View File
@@ -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 ;&
+13
View File
@@ -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
+13
View File
@@ -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
View File
@@ -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
+13
View File
@@ -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
-2
View File
@@ -43,7 +43,5 @@ Be Conservative in what you send and Liberal in what you accept
BE CONSERVATIVE IN WHAT YOU SEND AND LIBERAL IN WHAT YOU ACCEPT
Be conservative in what you send and liberal in what you accept
BE CONSERVATIVE IN WHAT YOU SEND AND LIBERAL IN WHAT YOU ACCEPT
AcknOwlEdgEmEnt acknOwlEdgEmEnt
oeNoPHiLe OEnOphIlE
abcdexyz
ABCDEXYZ
+15 -2
View File
@@ -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
@@ -101,8 +114,8 @@ echo ${TEXT2^^}
M1=${S1^^[aeiou]}
M2=${U2,,[AEIOU]}
echo ${M1} ${M1~}
echo ${M2} ${M2~~}
#echo ${M1} ${M1~}
#echo ${M2} ${M2~~}
declare -l lower=aBcDe
lower+=XyZ
+63
View File
@@ -0,0 +1,63 @@
complete -f -X '!*.+(ps|PS)' gs
complete -c nice
complete -e printenv
complete -c gdb
complete -f -X '!*.texi*' texi2html
complete -j -P '%' fg
complete -g groupmod
complete -f -X '!*.dvi' dvips
complete -f -X '!*.texi*' texi2dvi
complete -v -S '=' typeset
complete -f .
complete -c nohup
complete -a unalias
complete -g groupdel
complete -A hostname telnet
complete -v -S '=' declare
complete -v -S '=' export
complete -v -S '=' local
complete -v -S '=' readonly
complete -o bashdefault -o filenames -o nospace -F _comp_cd cd
complete -f -X '!*.dvi' xdvi
complete -c type
complete -f ln
complete -f -X '!*.+(gz|tgz)' gunzip
complete -f -X '!*.texi*' makeinfo
complete -u su
complete -j -P '%' jobs
complete -o dirnames -o filenames -o nospace -d popd
complete -A signal trap
complete -o dirnames -o filenames -o nospace -d pushd
complete -f -X '!*.pdf' acroread
complete -v unset
complete -f -X '!*.+(ps|PS)' ghostview
complete -j -W '$(ps -x | tail +2 | cut -c1-5)' -P '%' wait
complete -A hostname rsh
complete -c exec
complete -f -X '!*.Z' zmore
complete -A signal kill
complete -j -P '%' disown
complete -f -X '!*.+(ps|PS)' gs
complete -f -X '!*.+(ps|PS)' gv
complete -f source
complete -c make
complete -A stopped -P '%' bg
complete -f cat
complete -d mkdir
complete -A helptopic help
complete -c eval
complete -f chown
complete -v read
complete -c -k time
complete -f -X '!*.Z' zcat
complete -f gzip
complete -W '"${GROUPS[@]}"' newgrp
complete -f -X '!*.Z' uncompress
complete -d rmdir
complete -A shopt shopt
complete -A hostname ftp
complete -f more
complete -A hostname rlogin
complete -v getopts
complete -f -X '!*.+(gz|tgz)' gzcat
./complete.tests: line 123: complete: notthere: no completion specification
+126
View File
@@ -0,0 +1,126 @@
# Chet Ramey <chet.ramey@case.edu>
#
# Copyright 2002-2020 Chester Ramey
#
# 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 2, or (at your option)
# any later version.
#
# TThis 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, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
complete
# from zsh, just for testing
complete -A stopped -P '%' bg
complete -j -P '%' fg jobs disown
# this is wrong at this point
complete -j -P '%' -W '$(ps -x | tail +2 | cut -c1-5)' wait
complete -c type
complete -a unalias
complete -v getopts read unset
complete -v -S '=' declare export local readonly typeset
complete -f -- . source
complete -A shopt shopt
complete -e printenv
complete -A helptopic help
complete -c nohup exec nice eval
complete -c -k time
complete -A signal trap kill
complete -f chown ln more cat
complete -d mkdir rmdir
complete -f -X '!*.+(gz|tgz)' gunzip gzcat zcat zmore
complete -f -X '!*.Z' uncompress zmore zcat
complete -f gzip
complete -o dirnames -o filenames -o nospace -d pushd popd
_comp_cd()
{
local IFS=$' \t\n' # normalize IFS
local cur _skipdot _cdpath
local i j k
# Tilde expansion, with side effect of expanding tilde to full pathname
case "$2" in
\~*) eval cur="$2" ;;
*) cur=$2 ;;
esac
# no cdpath or absolute pathname -- straight directory completion
if [[ -z "${CDPATH:-}" ]] || [[ "$cur" == @(./*|../*|/*) ]]; then
# compgen prints paths one per line; could also use while loop
IFS=$'\n'
COMPREPLY=( $(compgen -d -- "$cur") )
IFS=$' \t\n'
# CDPATH+directories in the current directory if not in CDPATH
else
IFS=$'\n'
_skipdot=false
# preprocess CDPATH to convert null directory names to .
_cdpath=${CDPATH/#:/.:}
_cdpath=${_cdpath//::/:.:}
_cdpath=${_cdpath/%:/:.}
for i in ${_cdpath//:/$'\n'}; do
if [[ $i -ef . ]]; then _skipdot=true; fi
k="${#COMPREPLY[@]}"
for j in $( compgen -d -- "$i/$cur" ); do
COMPREPLY[k++]=${j#$i/} # cut off directory
done
done
$_skipdot || COMPREPLY+=( $(compgen -d -- "$cur") )
IFS=$' \t\n'
fi
# variable names if appropriate shell option set and no completions
if shopt -q cdable_vars && [[ ${#COMPREPLY[@]} -eq 0 ]]; then
COMPREPLY=( $(compgen -v -- "$cur") )
fi
# append slash to passed directory name that is the only completion.
# readline will not do this if we complete from CDPATH
if [[ ${#COMPREPLY[@]} -eq 1 ]]; then
i=${COMPREPLY[0]} # shorthand
if [[ "$cur" == "$i" ]] && [[ "$i" != "*/" ]]; then
COMPREPLY[0]+=/
fi
fi
return 0
}
complete -o filenames -o nospace -o bashdefault -F _comp_cd cd
complete -A hostname rsh telnet rlogin ftp
complete -u su
complete -W '"${GROUPS[@]}"' newgrp
complete -g groupdel groupmod
complete -f -X '!*.+(ps|PS)' gs gv ghostview
complete -f -X '!*.dvi' dvips xdvi
complete -f -X '!*.pdf' acroread
complete -f -X '!*.texi*' makeinfo texi2dvi texi2html
complete -c gdb make
complete -p gs
complete -p
complete -r xdvi
complete -r notthere
complete -r
complete
+2
View File
@@ -11,3 +11,5 @@ contents
hi
./comsub-eof5.sub: line 13: warning: here-document at line 11 delimited by end-of-file (wanted `EOF')
hi
./comsub-eof6.sub: line 1: unexpected EOF while looking for matching `)'
+2
View File
@@ -9,3 +9,5 @@ ${THIS_SH} ./comsub-eof3.sub
${THIS_SH} ./comsub-eof4.sub
${THIS_SH} ./comsub-eof5.sub
${THIS_SH} ./comsub-eof6.sub
+5
View File
@@ -0,0 +1,5 @@
read foo <<EOF
$(seq 10
EOF
echo "$foo"
+4
View File
@@ -3,6 +3,7 @@ abmnopyz
ab
abcd
abcd
sh_352.26ax
sh_352.26ay
@@ -47,11 +48,14 @@ after 5
after 6
x
x
x
quoted )
comment
here-doc with )
here-doc with \()
here-doc terminated with a parenthesis
' # or a single back- or doublequote
line terminated with a backslash
./comsub-posix1.sub: command substitution: line 2: syntax error near unexpected token `)'
./comsub-posix1.sub: command substitution: line 2: ` if x; then echo foo )'
after
+28
View File
@@ -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
@@ -14,6 +27,7 @@ echo $(
)
echo $()
echo ab$()cd
echo ab$( )cd
echo $(case a in (a) echo sh_352.26ax; esac )
echo $(case a in (a) echo sh_352.26ay; esac)
@@ -167,6 +181,10 @@ echo $(
case x in x) echo x;; esac
)
echo $(
case x in x) echo x;; esac # followed by a comment
)
echo $(
case x in (x) echo x;; esac
)
@@ -185,6 +203,12 @@ cat <<\eof
eof
)
echo $(
cat <<\eof
here-doc with \()
eof
)
echo $(
cat <<\)
here-doc terminated with a parenthesis
@@ -197,6 +221,10 @@ cat <<\eof
eof
)
echo $(
echo line terminated with a backslash # \
)
${THIS_SH} ./comsub-posix1.sub
${THIS_SH} ./comsub-posix2.sub
+13
View File
@@ -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()
{
+13
View File
@@ -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
View File
@@ -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>
+13
View File
@@ -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`
+13
View File
@@ -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
+13
View File
@@ -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
+13
View File
@@ -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
+13
View File
@@ -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
+13
View File
@@ -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
+13
View File
@@ -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
View File
@@ -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
View File
@@ -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 [[...]]
+13
View File
@@ -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
+13
View File
@@ -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 nonsense script and shell function to test out the command printing code
#
+333 -333
View File
@@ -1,357 +1,357 @@
debug lineno: 63 main
debug lineno: 66 main
debug lineno: 74 main
debug lineno: 77 main
FUNCNAME main
debug lineno: 70 main
debug lineno: 17 fn1
debug lineno: 18 fn1
LINENO 18
debug lineno: 19 fn1
LINENO 19
debug lineno: 20 fn1
BASH_SOURCE[0] ./dbg-support.tests
debug lineno: 21 fn1
FUNCNAME[0] fn1
debug lineno: 22 fn1
debug lineno: 22 fn1 70 ./dbg-support.tests
debug lineno: 23 fn1
debug lineno: 23 fn1 70 main ./dbg-support.tests
debug lineno: 24 fn1
debug lineno: 24 fn1
debug lineno: 25 fn1
./dbg-support.tests: line 25: caller: foo: invalid number
caller: usage: caller [expr]
debug lineno: 25 fn1
debug lineno: 17 fn1
debug lineno: 12 print_return_trap
debug lineno: 13 print_return_trap
return lineno: 17 fn1
debug lineno: 14 print_return_trap
debug lineno: 71 main
debug lineno: 28 fn2
debug lineno: 29 fn2
fn2 here. Calling fn1...
debug lineno: 30 fn2
debug lineno: 17 fn1
debug lineno: 18 fn1
LINENO 18
debug lineno: 19 fn1
LINENO 19
debug lineno: 20 fn1
BASH_SOURCE[0] ./dbg-support.tests
debug lineno: 21 fn1
FUNCNAME[0] fn1
debug lineno: 22 fn1
debug lineno: 22 fn1 30 ./dbg-support.tests
debug lineno: 23 fn1
debug lineno: 23 fn1 30 fn2 ./dbg-support.tests
debug lineno: 24 fn1
debug lineno: 24 fn1 71 main ./dbg-support.tests
debug lineno: 25 fn1
./dbg-support.tests: line 25: caller: foo: invalid number
caller: usage: caller [expr]
debug lineno: 25 fn1
debug lineno: 17 fn1
debug lineno: 12 print_return_trap
debug lineno: 13 print_return_trap
return lineno: 17 fn1
debug lineno: 14 print_return_trap
debug lineno: 28 fn2
debug lineno: 12 print_return_trap
debug lineno: 13 print_return_trap
return lineno: 28 fn2
debug lineno: 14 print_return_trap
debug lineno: 72 main
debug lineno: 33 fn3
debug lineno: 34 fn3
LINENO 34
debug lineno: 35 fn3
BASH_SOURCE[0] ./dbg-support.tests
debug lineno: 38 fn3
debug lineno: 39 fn3
debug lineno: 40 fn3
debug lineno: 40 fn3
debug lineno: 41 fn3
debug lineno: 42 fn3
debug lineno: 43 fn3
fn3 called from file `./dbg-support.tests' at line 0
debug lineno: 40 fn3
debug lineno: 40 fn3
debug lineno: 41 fn3
debug lineno: 42 fn3
debug lineno: 42 fn3
debug lineno: 43 fn3
main called from file `./dbg-support.tests' at line 0
debug lineno: 40 fn3
debug lineno: 40 fn3
debug lineno: 46 fn3
debug lineno: 18 source
SOURCED LINENO 18
debug lineno: 19 source
SOURCED BASH_SOURCE[0] ./dbg-support.sub
debug lineno: 20 source
debug lineno: 3 sourced_fn
debug lineno: 4 sourced_fn
debug lineno: 5 sourced_fn
SOURCED FN LINENO 5
debug lineno: 8 sourced_fn
debug lineno: 9 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 11 sourced_fn
debug lineno: 12 sourced_fn
debug lineno: 13 sourced_fn
FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 20
debug lineno: 10 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 11 sourced_fn
debug lineno: 12 sourced_fn
debug lineno: 13 sourced_fn
FUNCNAME[1]: source called from ./dbg-support.tests at line 46
debug lineno: 10 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 11 sourced_fn
debug lineno: 12 sourced_fn
debug lineno: 13 sourced_fn
FUNCNAME[2]: fn3 called from ./dbg-support.tests at line 72
debug lineno: 10 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 11 sourced_fn
debug lineno: 12 sourced_fn
debug lineno: 12 sourced_fn
debug lineno: 13 sourced_fn
FUNCNAME[3]: main called from ./dbg-support.tests at line 0
debug lineno: 10 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 3 sourced_fn
debug lineno: 12 print_return_trap
debug lineno: 13 print_return_trap
return lineno: 3 sourced_fn
debug lineno: 14 print_return_trap
debug lineno: 46 fn3
debug lineno: 12 print_return_trap
debug lineno: 13 print_return_trap
return lineno: 46 fn3
debug lineno: 14 print_return_trap
debug lineno: 33 fn3
debug lineno: 12 print_return_trap
debug lineno: 13 print_return_trap
return lineno: 33 fn3
debug lineno: 14 print_return_trap
debug lineno: 73 main
debug lineno: 18 source
SOURCED LINENO 18
debug lineno: 19 source
SOURCED BASH_SOURCE[0] ./dbg-support.sub
debug lineno: 20 source
debug lineno: 3 sourced_fn
debug lineno: 4 sourced_fn
debug lineno: 5 sourced_fn
SOURCED FN LINENO 5
debug lineno: 8 sourced_fn
debug lineno: 9 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 11 sourced_fn
debug lineno: 12 sourced_fn
debug lineno: 13 sourced_fn
FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 20
debug lineno: 10 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 11 sourced_fn
debug lineno: 12 sourced_fn
debug lineno: 13 sourced_fn
FUNCNAME[1]: source called from ./dbg-support.tests at line 73
debug lineno: 10 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 11 sourced_fn
debug lineno: 12 sourced_fn
debug lineno: 12 sourced_fn
debug lineno: 13 sourced_fn
FUNCNAME[2]: main called from ./dbg-support.tests at line 0
debug lineno: 10 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 3 sourced_fn
debug lineno: 12 print_return_trap
debug lineno: 13 print_return_trap
return lineno: 3 sourced_fn
debug lineno: 14 print_return_trap
debug lineno: 73 main
debug lineno: 12 print_return_trap
debug lineno: 13 print_return_trap
return lineno: 73 main
debug lineno: 14 print_return_trap
debug lineno: 76 main
debug lineno: 79 main
LINENO 18
LINENO 19
BASH_SOURCE[0] ./dbg-support.tests
FUNCNAME[0] fn1
79 ./dbg-support.tests
79 main ./dbg-support.tests
./dbg-support.tests: line 25: caller: foo: invalid number
caller: usage: caller [expr]
debug lineno: 80 main
fn2 here. Calling fn1...
LINENO 18
LINENO 19
BASH_SOURCE[0] ./dbg-support.tests
FUNCNAME[0] fn1
30 ./dbg-support.tests
30 fn2 ./dbg-support.tests
80 main ./dbg-support.tests
./dbg-support.tests: line 25: caller: foo: invalid number
caller: usage: caller [expr]
debug lineno: 81 main
LINENO 34
debug lineno: 30 fn1
debug lineno: 31 fn1
LINENO 31
debug lineno: 32 fn1
LINENO 32
debug lineno: 33 fn1
BASH_SOURCE[0] ./dbg-support.tests
debug lineno: 34 fn1
FUNCNAME[0] fn1
debug lineno: 35 fn1
debug lineno: 35 fn1 81 ./dbg-support.tests
debug lineno: 36 fn1
debug lineno: 36 fn1 81 main ./dbg-support.tests
debug lineno: 37 fn1
debug lineno: 37 fn1
debug lineno: 38 fn1
./dbg-support.tests: line 38: caller: foo: invalid number
caller: usage: caller [expr]
debug lineno: 38 fn1
debug lineno: 30 fn1
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 30 fn1
debug lineno: 27 print_return_trap
debug lineno: 82 main
debug lineno: 41 fn2
debug lineno: 42 fn2
fn2 here. Calling fn1...
debug lineno: 43 fn2
debug lineno: 30 fn1
debug lineno: 31 fn1
LINENO 31
debug lineno: 32 fn1
LINENO 32
debug lineno: 33 fn1
BASH_SOURCE[0] ./dbg-support.tests
debug lineno: 34 fn1
FUNCNAME[0] fn1
debug lineno: 35 fn1
debug lineno: 35 fn1 43 ./dbg-support.tests
debug lineno: 36 fn1
debug lineno: 36 fn1 43 fn2 ./dbg-support.tests
debug lineno: 37 fn1
debug lineno: 37 fn1 82 main ./dbg-support.tests
debug lineno: 38 fn1
./dbg-support.tests: line 38: caller: foo: invalid number
caller: usage: caller [expr]
debug lineno: 38 fn1
debug lineno: 30 fn1
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 30 fn1
debug lineno: 27 print_return_trap
debug lineno: 41 fn2
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 41 fn2
debug lineno: 27 print_return_trap
debug lineno: 83 main
debug lineno: 46 fn3
debug lineno: 47 fn3
LINENO 47
debug lineno: 48 fn3
BASH_SOURCE[0] ./dbg-support.tests
debug lineno: 51 fn3
debug lineno: 52 fn3
debug lineno: 53 fn3
debug lineno: 53 fn3
debug lineno: 54 fn3
debug lineno: 55 fn3
debug lineno: 56 fn3
fn3 called from file `./dbg-support.tests' at line 0
debug lineno: 53 fn3
debug lineno: 53 fn3
debug lineno: 54 fn3
debug lineno: 55 fn3
debug lineno: 55 fn3
debug lineno: 56 fn3
main called from file `./dbg-support.tests' at line 0
debug lineno: 53 fn3
debug lineno: 53 fn3
debug lineno: 59 fn3
debug lineno: 31 source
SOURCED LINENO 31
debug lineno: 32 source
SOURCED BASH_SOURCE[0] ./dbg-support.sub
debug lineno: 33 source
debug lineno: 16 sourced_fn
debug lineno: 17 sourced_fn
debug lineno: 18 sourced_fn
SOURCED FN LINENO 18
debug lineno: 21 sourced_fn
debug lineno: 22 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 33
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[1]: source called from ./dbg-support.tests at line 59
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[2]: fn3 called from ./dbg-support.tests at line 83
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[3]: main called from ./dbg-support.tests at line 0
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 16 sourced_fn
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 16 sourced_fn
debug lineno: 27 print_return_trap
debug lineno: 59 fn3
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 59 fn3
debug lineno: 27 print_return_trap
debug lineno: 46 fn3
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 46 fn3
debug lineno: 27 print_return_trap
debug lineno: 84 main
debug lineno: 31 source
SOURCED LINENO 31
debug lineno: 32 source
SOURCED BASH_SOURCE[0] ./dbg-support.sub
debug lineno: 33 source
debug lineno: 16 sourced_fn
debug lineno: 17 sourced_fn
debug lineno: 18 sourced_fn
SOURCED FN LINENO 18
debug lineno: 21 sourced_fn
debug lineno: 22 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 33
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[1]: source called from ./dbg-support.tests at line 84
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[2]: main called from ./dbg-support.tests at line 0
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 16 sourced_fn
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 16 sourced_fn
debug lineno: 27 print_return_trap
debug lineno: 84 main
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 84 main
debug lineno: 27 print_return_trap
debug lineno: 87 main
debug lineno: 90 main
LINENO 31
LINENO 32
BASH_SOURCE[0] ./dbg-support.tests
FUNCNAME[0] fn1
90 ./dbg-support.tests
90 main ./dbg-support.tests
./dbg-support.tests: line 38: caller: foo: invalid number
caller: usage: caller [expr]
debug lineno: 91 main
fn2 here. Calling fn1...
LINENO 31
LINENO 32
BASH_SOURCE[0] ./dbg-support.tests
FUNCNAME[0] fn1
43 ./dbg-support.tests
43 fn2 ./dbg-support.tests
91 main ./dbg-support.tests
./dbg-support.tests: line 38: caller: foo: invalid number
caller: usage: caller [expr]
debug lineno: 92 main
LINENO 47
BASH_SOURCE[0] ./dbg-support.tests
fn3 called from file `./dbg-support.tests' at line 0
main called from file `./dbg-support.tests' at line 0
SOURCED LINENO 18
SOURCED LINENO 31
SOURCED BASH_SOURCE[0] ./dbg-support.sub
SOURCED FN LINENO 5
FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 20
FUNCNAME[1]: source called from ./dbg-support.tests at line 46
FUNCNAME[2]: fn3 called from ./dbg-support.tests at line 81
SOURCED FN LINENO 18
FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 33
FUNCNAME[1]: source called from ./dbg-support.tests at line 59
FUNCNAME[2]: fn3 called from ./dbg-support.tests at line 92
FUNCNAME[3]: main called from ./dbg-support.tests at line 0
debug lineno: 82 main
debug lineno: 93 main
fn4 here. Calling fn3...
LINENO 34
LINENO 47
BASH_SOURCE[0] ./dbg-support.tests
fn3 called from file `./dbg-support.tests' at line 82
fn3 called from file `./dbg-support.tests' at line 93
fn4 called from file `./dbg-support.tests' at line 0
main called from file `./dbg-support.tests' at line 0
SOURCED LINENO 18
SOURCED LINENO 31
SOURCED BASH_SOURCE[0] ./dbg-support.sub
SOURCED FN LINENO 5
FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 20
FUNCNAME[1]: source called from ./dbg-support.tests at line 46
FUNCNAME[2]: fn3 called from ./dbg-support.tests at line 51
FUNCNAME[3]: fn4 called from ./dbg-support.tests at line 82
SOURCED FN LINENO 18
FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 33
FUNCNAME[1]: source called from ./dbg-support.tests at line 59
FUNCNAME[2]: fn3 called from ./dbg-support.tests at line 64
FUNCNAME[3]: fn4 called from ./dbg-support.tests at line 93
FUNCNAME[4]: main called from ./dbg-support.tests at line 0
debug lineno: 83 main
SOURCED LINENO 18
debug lineno: 94 main
SOURCED LINENO 31
SOURCED BASH_SOURCE[0] ./dbg-support.sub
SOURCED FN LINENO 5
FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 20
FUNCNAME[1]: source called from ./dbg-support.tests at line 83
SOURCED FN LINENO 18
FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 33
FUNCNAME[1]: source called from ./dbg-support.tests at line 94
FUNCNAME[2]: main called from ./dbg-support.tests at line 0
return lineno: 83 main
debug lineno: 86 main
debug lineno: 89 main
debug lineno: 18 source
SOURCED LINENO 18
debug lineno: 19 source
return lineno: 94 main
debug lineno: 97 main
debug lineno: 100 main
debug lineno: 31 source
SOURCED LINENO 31
debug lineno: 32 source
SOURCED BASH_SOURCE[0] ./dbg-support.sub
debug lineno: 20 source
debug lineno: 3 sourced_fn
debug lineno: 4 sourced_fn
debug lineno: 5 sourced_fn
SOURCED FN LINENO 5
debug lineno: 8 sourced_fn
debug lineno: 9 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 11 sourced_fn
debug lineno: 12 sourced_fn
debug lineno: 13 sourced_fn
FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 20
debug lineno: 10 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 11 sourced_fn
debug lineno: 12 sourced_fn
debug lineno: 13 sourced_fn
FUNCNAME[1]: source called from ./dbg-support.tests at line 89
debug lineno: 10 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 11 sourced_fn
debug lineno: 12 sourced_fn
debug lineno: 12 sourced_fn
debug lineno: 13 sourced_fn
debug lineno: 33 source
debug lineno: 16 sourced_fn
debug lineno: 17 sourced_fn
debug lineno: 18 sourced_fn
SOURCED FN LINENO 18
debug lineno: 21 sourced_fn
debug lineno: 22 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[0]: sourced_fn called from ./dbg-support.sub at line 33
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[1]: source called from ./dbg-support.tests at line 100
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[2]: main called from ./dbg-support.tests at line 0
debug lineno: 10 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 3 sourced_fn
debug lineno: 12 print_return_trap
debug lineno: 13 print_return_trap
return lineno: 3 sourced_fn
debug lineno: 14 print_return_trap
debug lineno: 89 main
debug lineno: 12 print_return_trap
debug lineno: 13 print_return_trap
return lineno: 89 main
debug lineno: 14 print_return_trap
debug lineno: 90 main
debug lineno: 93 main
debug lineno: 93 main
debug lineno: 94 main
debug lineno: 97 main
debug lineno: 93 main
debug lineno: 93 main
debug lineno: 94 main
debug lineno: 97 main
debug lineno: 93 main
debug lineno: 93 main
debug lineno: 94 main
debug lineno: 95 main
Hit 2
debug lineno: 97 main
debug lineno: 93 main
debug lineno: 93 main
debug lineno: 103 main
SOURCED FN LINENO 5 FUNCNAME[0]: sourced_fn called from ./dbg-support.tests at line 103 FUNCNAME[1]: main called from ./dbg-support.tests at line 0
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 16 sourced_fn
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 16 sourced_fn
debug lineno: 27 print_return_trap
debug lineno: 100 main
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 100 main
debug lineno: 27 print_return_trap
debug lineno: 101 main
debug lineno: 104 main
debug lineno: 104 main
debug lineno: 105 main
debug lineno: 108 main
debug lineno: 104 main
debug lineno: 104 main
debug lineno: 105 main
debug lineno: 108 main
debug lineno: 104 main
debug lineno: 104 main
SOURCED FN LINENO 5 FUNCNAME[0]: sourced_fn called from ./dbg-support.tests at line 104 FUNCNAME[1]: main called from ./dbg-support.tests at line 0
debug lineno: 105 main
debug lineno: 106 main
SOURCED FN LINENO 5
FUNCNAME[0]: sourced_fn called from ./dbg-support.tests at line 106
FUNCNAME[1]: main called from ./dbg-support.tests at line 0
debug lineno: 110 main
debug lineno: 111 main
debug lineno: 3 sourced_fn
debug lineno: 4 sourced_fn
debug lineno: 5 sourced_fn
SOURCED FN LINENO 5
debug lineno: 8 sourced_fn
debug lineno: 9 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 11 sourced_fn
debug lineno: 12 sourced_fn
debug lineno: 13 sourced_fn
FUNCNAME[0]: sourced_fn called from ./dbg-support.tests at line 111
debug lineno: 10 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 11 sourced_fn
debug lineno: 12 sourced_fn
debug lineno: 12 sourced_fn
debug lineno: 13 sourced_fn
FUNCNAME[1]: main called from ./dbg-support.tests at line 0
debug lineno: 10 sourced_fn
debug lineno: 10 sourced_fn
debug lineno: 3 sourced_fn
debug lineno: 12 print_return_trap
debug lineno: 13 print_return_trap
return lineno: 3 sourced_fn
debug lineno: 14 print_return_trap
Hit 2
debug lineno: 108 main
debug lineno: 104 main
debug lineno: 104 main
debug lineno: 114 main
debug lineno: 119 main
debug lineno: 123 main
SOURCED FN LINENO 18 FUNCNAME[0]: sourced_fn called from ./dbg-support.tests at line 114 FUNCNAME[1]: main called from ./dbg-support.tests at line 0
debug lineno: 115 main
SOURCED FN LINENO 18 FUNCNAME[0]: sourced_fn called from ./dbg-support.tests at line 115 FUNCNAME[1]: main called from ./dbg-support.tests at line 0
debug lineno: 116 main
debug lineno: 117 main
SOURCED FN LINENO 18
FUNCNAME[0]: sourced_fn called from ./dbg-support.tests at line 117
FUNCNAME[1]: main called from ./dbg-support.tests at line 0
debug lineno: 121 main
debug lineno: 122 main
debug lineno: 16 sourced_fn
debug lineno: 17 sourced_fn
debug lineno: 18 sourced_fn
SOURCED FN LINENO 18
debug lineno: 21 sourced_fn
debug lineno: 22 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[0]: sourced_fn called from ./dbg-support.tests at line 122
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 24 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 25 sourced_fn
debug lineno: 26 sourced_fn
FUNCNAME[1]: main called from ./dbg-support.tests at line 0
debug lineno: 23 sourced_fn
debug lineno: 23 sourced_fn
debug lineno: 16 sourced_fn
debug lineno: 25 print_return_trap
debug lineno: 26 print_return_trap
return lineno: 16 sourced_fn
debug lineno: 27 print_return_trap
debug lineno: 125 main
debug lineno: 130 main
debug lineno: 134 main
got it
debug lineno: 131 main
debug lineno: 132 main
debug lineno: 133 main
debug lineno: 132 main
debug lineno: 133 main
debug lineno: 131 main
debug lineno: 132 main
debug lineno: 133 main
debug lineno: 132 main
debug lineno: 133 main
debug lineno: 137 main
debug lineno: 142 main
debug lineno: 143 main
debug lineno: 144 main
debug lineno: 143 main
debug lineno: 144 main
debug lineno: 142 main
debug lineno: 143 main
debug lineno: 144 main
debug lineno: 143 main
debug lineno: 144 main
debug lineno: 148 main
main: calling f1
f1: calling f2
f2: calling f3
@@ -364,7 +364,7 @@ deep 6
4 x
5 1
FUNCNAME stack: f3 f2 f1 main
26 f2 ./dbg-support3.sub
39 f2 ./dbg-support3.sub
f3: returning
f2: return from f3
f1: return from f2

Some files were not shown because too many files have changed in this diff Show More