commit bash-20090226 snapshot

This commit is contained in:
Chet Ramey
2011-12-08 20:05:53 -05:00
parent 76af2125b7
commit 6932f7f549
56 changed files with 17670 additions and 7478 deletions
+25 -25
View File
@@ -25,13 +25,13 @@ bdef
hello world
11
3
bdef hello world test expression
./array.tests: line 74: readonly: `a[5]': not a valid identifier
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
bdef hello world test expression test 2
./array.tests: line 76: readonly: `a[5]': not a valid identifier
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")'
declare -ar c='()'
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")'
declare -ar c='()'
readonly -a a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
readonly -a a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")'
readonly -a c='()'
a test
declare -a BASH_ARGC='()'
@@ -40,36 +40,36 @@ declare -a BASH_LINENO='([0]="0")'
declare -a BASH_SOURCE='([0]="./array.tests")'
declare -a DIRSTACK='()'
declare -a FUNCNAME='([0]="main")'
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")'
declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
declare -ar c='()'
declare -a d='([1]="" [2]="bdef" [5]="hello world" [6]="test" [9]="ninth element")'
declare -a e='([0]="test")'
declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")'
./array.tests: line 98: a: readonly variable
./array.tests: line 100: b[]: bad array subscript
./array.tests: line 101: b[*]: bad array subscript
./array.tests: line 102: ${b[ ]}: bad substitution
./array.tests: line 104: c[-2]: bad array subscript
./array.tests: line 105: c: bad array subscript
./array.tests: line 100: a: readonly variable
./array.tests: line 102: b[]: bad array subscript
./array.tests: line 103: b[*]: bad array subscript
./array.tests: line 104: ${b[ ]}: bad substitution
./array.tests: line 106: c[-2]: bad array subscript
./array.tests: line 107: c: bad array subscript
./array.tests: line 107: d[7]: cannot assign list to array member
./array.tests: line 109: []=abcde: bad array subscript
./array.tests: line 109: [*]=last: cannot assign to non-numeric index
./array.tests: line 109: [-65]=negative: bad array subscript
./array.tests: line 109: d[7]: cannot assign list to array member
./array.tests: line 111: []=abcde: bad array subscript
./array.tests: line 111: [*]=last: cannot assign to non-numeric index
./array.tests: line 111: [-65]=negative: bad array subscript
declare -a BASH_ARGC='()'
declare -a BASH_ARGV='()'
declare -a BASH_LINENO='([0]="0")'
declare -a BASH_SOURCE='([0]="./array.tests")'
declare -a DIRSTACK='()'
declare -a FUNCNAME='([0]="main")'
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")'
declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
declare -ar c='()'
declare -a d='([1]="test test")'
declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")'
./array.tests: line 117: unset: ps1: not an array variable
./array.tests: line 121: declare: c: cannot destroy array variables in this way
./array.tests: line 119: unset: ps1: not an array variable
./array.tests: line 123: declare: c: cannot destroy array variables in this way
this of
this is a test of read using arrays
this test
@@ -80,7 +80,7 @@ declare -a BASH_LINENO='([0]="0")'
declare -a BASH_SOURCE='([0]="./array.tests")'
declare -a DIRSTACK='()'
declare -a FUNCNAME='([0]="main")'
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")'
declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
declare -ar c='()'
declare -a d='([1]="test test")'
@@ -127,7 +127,7 @@ grep [ 123 ] *
6 7 9 5
length = 3
value = new1 new2 new3
./array.tests: line 237: narray: unbound variable
./array.tests: line 239: 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: syntax error near unexpected token `('
@@ -152,10 +152,10 @@ for case if then else
12 14 16 18 20
4414758999202
aaa bbb
./array.tests: line 287: syntax error near unexpected token `<>'
./array.tests: line 287: `metas=( <> < > ! )'
./array.tests: line 288: syntax error near unexpected token `<>'
./array.tests: line 288: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
./array.tests: line 289: syntax error near unexpected token `<>'
./array.tests: line 289: `metas=( <> < > ! )'
./array.tests: line 290: syntax error near unexpected token `<>'
./array.tests: line 290: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
abc 3
case 4
abc case if then else 5
+2
View File
@@ -69,6 +69,8 @@ echo ${#a[5]}
echo ${#a[@]}
a[4+5/2]="test expression"
declare a["7 + 8"]="test 2"
a[7 + 8]="test 2"
echo ${a[@]}
readonly a[5]
+18 -9
View File
@@ -6,17 +6,17 @@ declare -A BASH_CMDS='()'
declare -A fluff='([bar]="two" [foo]="one" )'
declare -A fluff='([bar]="two" [foo]="one" )'
declare -A fluff='([bar]="two" )'
declare -A fluff='([bar]="newval" )'
./assoc.tests: line 24: chaff: four: must use subscript when assigning associative array
declare -A fluff='([bar]="newval" [qux]="assigned" )'
./assoc.tests: line 26: chaff: four: must use subscript when assigning associative array
declare -A BASH_ALIASES='()'
declare -A BASH_CMDS='()'
declare -Ai chaff='([one]="10" [zero]="5" )'
declare -Ar waste='([version]="4.0-devel" [source]="./assoc.tests" [lineno]="26" [pid]="42134" )'
declare -Ar waste='([version]="4.0-devel" [source]="./assoc.tests" [lineno]="28" [pid]="42134" )'
declare -A wheat='([one]="a" [zero]="0" [two]="b" [three]="c" )'
declare -A chaff='([one]="10" [hello world]="flip" [zero]="5" )'
./assoc.tests: line 36: unset: waste: cannot unset: readonly variable
./assoc.tests: line 37: chaff[*]: bad array subscript
./assoc.tests: line 38: [*]=12: invalid associative array key
./assoc.tests: line 38: unset: waste: cannot unset: readonly variable
./assoc.tests: line 39: chaff[*]: bad array subscript
./assoc.tests: line 40: [*]=12: invalid associative array key
declare -A chaff='([one]="a" [hello world]="flip" )'
flip
argv[1] = <a>
@@ -31,9 +31,9 @@ argv[2] = <flip>
argv[3] = <multiple>
argv[4] = <words>
argv[1] = <a flip multiple words>
./assoc.tests: line 55: declare: chaff: cannot destroy array variables in this way
./assoc.tests: line 57: chaff[*]: bad array subscript
./assoc.tests: line 58: [*]=12: invalid associative array key
./assoc.tests: line 57: declare: chaff: cannot destroy array variables in this way
./assoc.tests: line 59: chaff[*]: bad array subscript
./assoc.tests: line 60: [*]=12: invalid associative array key
declare -A wheat='([six]="6" [foo bar]="qux qix" )'
argv[1] = <qux>
argv[2] = <qix>
@@ -132,3 +132,12 @@ argv[1] = <FOOQ>
argv[2] = <>
argv[3] = <BARQ>
argv[4] = <>
abc
def
def
./assoc5.sub: line 13: declare: `myarray[foo[bar]=bleh': not a valid identifier
abc def bleh
myarray=([a]a]="abc" []]="def" [a]=test1;#a]="123" [foo]="bleh" )
123
myarray=([a]a]="abc" [a]=test2;#a]="def" []]="def" [a]=test1;#a]="123" [foo]="bleh" )
+4
View File
@@ -12,6 +12,8 @@ unset fluff[foo]
declare -p fluff
fluff[bar]=newval
declare fluff[qux]=assigned
declare -p fluff
unset fluff
@@ -171,3 +173,5 @@ ${THIS_SH} ./assoc2.sub
${THIS_SH} ./assoc3.sub
${THIS_SH} ./assoc4.sub
${THIS_SH} ./assoc5.sub
+27
View File
@@ -0,0 +1,27 @@
declare -A myarray
# this needs fixes to skipsubscript
myarray["a]a"]="abc"
echo ${myarray["a]a"]}
myarray[$(echo ])]=def
echo ${myarray[']']}
echo ${myarray[\]]}
declare myarray["foo[bar"]=bleh
myarray["foo"]=bleh
echo "${myarray[@]}"
bar='a]=test1;#a'
myarray[$bar]=123
set | grep ^myarray=
echo ${myarray[a]}
echo "${myarray['a]=test1;#a']}"
myarray['a]=test2;#a']="def"
set | grep ^myarray=
+5
View File
@@ -136,6 +136,11 @@ funcc ()
func-a
func-b
func-c
foo-bar
foo-bar ()
{
:
}
expect 5 10
5 10
expect 20
+10
View File
@@ -15,3 +15,13 @@ type funcc
funca
funcb
funcc
# when not in posix mode, bash allows non-identifiers as function names
set +o posix
foo-bar()
{
:;
}
declare -F foo-bar
declare -f foo-bar
+2 -1
View File
@@ -58,6 +58,7 @@ qux
bar
qux
./heredoc.tests: line 96: warning: here-document at line 94 delimited by end-of-file (wanted `EOF')
comsub here-string
./heredoc.tests: line 100: warning: here-document at line 98 delimited by end-of-file (wanted `EOF')
hi
there
+4
View File
@@ -88,6 +88,10 @@ ${THIS_SH} -c 'type fff'
${THIS_SH} ./heredoc1.sub
echo $(
cat <<< "comsub here-string"
)
# check that end of file delimits a here-document
# THIS MUST BE LAST!
+3 -1
View File
@@ -504,6 +504,8 @@ h
--blah
lah
lah
abcde abcfg abchi
foode foofg foohi
argv[1] = <>
argv[1] = <+>
argv[1] = <+^?>
@@ -537,4 +539,4 @@ bar ()
}
argv[1] = </>
argv[1] = </>
./new-exp.tests: line 568: ABXD: parameter unset
./new-exp.tests: line 576: ABXD: parameter unset
+8
View File
@@ -553,6 +553,14 @@ echo ${var/#/--}
echo ${var[@]##?}
echo ${var##?}
unset var
var=(abcde abcfg abchi)
# problems with anchoring pattern replacements
echo ${var[*]//#abc/foo}
echo ${var[*]/#abc/foo}
unset var
${THIS_SH} ./new-exp6.sub
${THIS_SH} ./new-exp7.sub
+2
View File
@@ -307,3 +307,5 @@ printf -v var "%s" '/current/working/directory/*.@(m3|i3|ig|mg)'
shopt -s nullglob extglob
echo "x$(printf "%b" @(hugo))x"
printf -v var "%b" @(hugo); echo "x${var}x"
${THIS_SH} ./printf2.sub
+6
View File
@@ -0,0 +1,6 @@
export LANG=en_US.UTF-8
case $(printf %d\\n \'À) in
192) exit 0;;
*) echo "printf2.sub: multibyte character conversion failed" >&2 ; exit 2 ;;
esac
+19
View File
@@ -61,3 +61,22 @@ bar ()
{
echo $(<x1)
}
foo is a function
foo ()
{
echo;
cat <<END
bar
END
cat <<EOF
qux
EOF
}
bar
qux
bar
qux
+2
View File
@@ -89,3 +89,5 @@ f() {
type f | cat -v
${THIS_SH} type1.sub
${THIS_SH} type2.sub
+16
View File
@@ -0,0 +1,16 @@
foo()
{
echo
cat <<END
bar
END
cat <<EOF
qux
EOF
}
type foo
foo
eval "$(type foo | sed 1d)"
foo