Bash-4.1 distribution source
This commit is contained in:
@@ -2,3 +2,11 @@ alias: 0
|
||||
alias: 0
|
||||
./alias.tests: line 25: qfoo: command not found
|
||||
quux
|
||||
bar
|
||||
value
|
||||
bar
|
||||
value
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
|
||||
@@ -35,3 +35,5 @@ alias baz=quux
|
||||
foo bar
|
||||
|
||||
unalias foo bar baz
|
||||
|
||||
${THIS_SH} ./alias1.sub
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -6,18 +6,18 @@ 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
|
||||
declare -A chaff='([one]="a" [hello world]="flip" )'
|
||||
declare -A chaff='([one]="10" ["hello world"]="flip" [zero]="5" )'
|
||||
./assoc.tests: line 38: unset: waste: cannot unset: readonly variable
|
||||
./assoc.tests: line 39: chaff[*]: bad array subscript
|
||||
./assoc.tests: line 40: [*]=12: invalid associative array key
|
||||
declare -A chaff='([one]="a" ["hello world"]="flip" )'
|
||||
flip
|
||||
argv[1] = <a>
|
||||
argv[2] = <flip>
|
||||
@@ -31,14 +31,14 @@ 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
|
||||
declare -A wheat='([six]="6" [foo bar]="qux qix" )'
|
||||
./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>
|
||||
argv[1] = <qux qix>
|
||||
declare -A wheat='([six]="6" [foo bar]="qux qix" )'
|
||||
declare -A wheat='([six]="6" ["foo bar"]="qux qix" )'
|
||||
argv[1] = <2>
|
||||
argv[1] = <7>
|
||||
argv[1] = <qux>
|
||||
@@ -75,6 +75,7 @@ bin . bin sbin sbin bin bin ucb
|
||||
\usr/local/bin . \bin \sbin \usr/sbin \usr/bin \bin \usr/ucb
|
||||
\usr\local\bin . \bin \sbin \usr\sbin \usr\bin \bin \usr\ucb
|
||||
\usr\local\bin . \bin \sbin \usr\sbin \usr\bin \bin \usr\ucb
|
||||
([a]=1)
|
||||
|
||||
qux foo
|
||||
/usr/local/bin/qux /usr/sbin/foo
|
||||
@@ -102,7 +103,7 @@ argv[4] = </usr/local/bin/qux -l>
|
||||
outside: outside
|
||||
declare -A BASH_ALIASES='()'
|
||||
declare -A BASH_CMDS='()'
|
||||
declare -A afoo='([six]="six" [foo bar]="foo quux" )'
|
||||
declare -A afoo='([six]="six" ["foo bar"]="foo quux" )'
|
||||
argv[1] = <inside:>
|
||||
argv[2] = <six>
|
||||
argv[3] = <foo quux>
|
||||
@@ -132,3 +133,57 @@ 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" )
|
||||
bar"bie
|
||||
doll
|
||||
declare -A foo='(["bar\"bie"]="doll" )'
|
||||
bar"bie
|
||||
doll
|
||||
declare -A foo='(["bar\"bie"]="doll" )'
|
||||
bar"bie
|
||||
doll
|
||||
declare -A foo='(["bar\"bie"]="doll" )'
|
||||
bar"bie
|
||||
doll
|
||||
declare -A foo='(["bar\"bie"]="doll" )'
|
||||
bar"bie
|
||||
doll
|
||||
declare -A foo='(["bar\"bie"]="doll" )'
|
||||
bar'bie
|
||||
doll
|
||||
declare -A foo='(["bar'\''bie"]="doll" )'
|
||||
bar'bie
|
||||
doll
|
||||
declare -A foo='(["bar'\''bie"]="doll" )'
|
||||
bar'bie
|
||||
doll
|
||||
declare -A foo='(["bar'\''bie"]="doll" )'
|
||||
bar'bie
|
||||
doll
|
||||
declare -A foo='(["bar'\''bie"]="doll" )'
|
||||
bar'bie
|
||||
doll
|
||||
declare -A foo='(["bar'\''bie"]="doll" )'
|
||||
bar$bie
|
||||
doll
|
||||
declare -A foo='(["bar\$bie"]="doll" )'
|
||||
bar[bie
|
||||
doll
|
||||
declare -A foo='(["bar[bie"]="doll" )'
|
||||
bar`bie
|
||||
doll
|
||||
declare -A foo='(["bar\`bie"]="doll" )'
|
||||
bar\]bie
|
||||
doll
|
||||
declare -A foo='(["bar\\]bie"]="doll" )'
|
||||
bar${foo}bie
|
||||
doll
|
||||
declare -A foo='(["bar\${foo}bie"]="doll" )'
|
||||
|
||||
@@ -12,6 +12,8 @@ unset fluff[foo]
|
||||
declare -p fluff
|
||||
|
||||
fluff[bar]=newval
|
||||
declare fluff[qux]=assigned
|
||||
|
||||
declare -p fluff
|
||||
|
||||
unset fluff
|
||||
@@ -164,6 +166,13 @@ zecho "${xpath[@]/\//\\}"
|
||||
zecho "${xpath[@]//\//\\}"
|
||||
zecho "${xpath[@]//[\/]/\\}"
|
||||
|
||||
# test assignment to key "0"
|
||||
unset T
|
||||
declare -A T
|
||||
T='([a]=1)'
|
||||
echo "${T[@]}"
|
||||
unset T
|
||||
|
||||
${THIS_SH} ./assoc1.sub
|
||||
|
||||
${THIS_SH} ./assoc2.sub
|
||||
@@ -171,3 +180,7 @@ ${THIS_SH} ./assoc2.sub
|
||||
${THIS_SH} ./assoc3.sub
|
||||
|
||||
${THIS_SH} ./assoc4.sub
|
||||
|
||||
${THIS_SH} ./assoc5.sub
|
||||
|
||||
${THIS_SH} ./assoc6.sub
|
||||
|
||||
@@ -52,11 +52,14 @@ a-{bdef-g-c a-{bdef-i-c
|
||||
10 8 6 4 2
|
||||
1 3 5 7 9 11 13 15 17 19
|
||||
1
|
||||
0100 0095 0090 0085 0080 0075 0070 0065 0060 0055 0050 0045 0040 0035 0030 0025 0020 0015 0010 0005 0000
|
||||
00100 00095 00090 00085 00080 00075 00070 00065 00060 00055 00050 00045 00040 00035 00030 00025 00020 00015 00010 00005 00000
|
||||
100 95 90 85 80 75 70 65 60 55 50 45 40 35 30 25 20 15 10 5 0
|
||||
100 95 90 85 80 75 70 65 60 55 50 45 40 35 30 25 20 15 10 5 0
|
||||
a b c d e f g h i j k l m n o p q r s t u v w x y z
|
||||
a c e g i k m o q s u w y
|
||||
z x v t r p n l j h f d b
|
||||
10 8 6 4 2 0
|
||||
10 8 6 4 2 0
|
||||
-50 -45 -40 -35 -30 -25 -20 -15 -10 -5 0
|
||||
{1..10.f}
|
||||
{1..ff}
|
||||
{1..10..ff}
|
||||
|
||||
@@ -94,6 +94,11 @@ echo {a..z}
|
||||
echo {a..z..2}
|
||||
echo {z..a..-2}
|
||||
|
||||
# unwanted zero-padding -- fixed post-bash-4.0
|
||||
echo {10..0..2}
|
||||
echo {10..0..-2}
|
||||
echo {-50..-0..5}
|
||||
|
||||
# bad
|
||||
echo {1..10.f}
|
||||
echo {1..ff}
|
||||
|
||||
@@ -3,3 +3,4 @@ to here
|
||||
and here
|
||||
retest
|
||||
and match
|
||||
no more clauses
|
||||
|
||||
@@ -12,3 +12,7 @@ foo*) echo retest ;;&
|
||||
*bar) echo and match ;;&
|
||||
qux) echo but not this ;;
|
||||
esac
|
||||
|
||||
case a in
|
||||
a) echo no more clauses;&
|
||||
esac
|
||||
|
||||
@@ -5,3 +5,9 @@ hi
|
||||
hi
|
||||
./comsub-eof3.sub: line 1: unexpected EOF while looking for matching `)'
|
||||
./comsub-eof3.sub: line 5: syntax error: unexpected end of file
|
||||
./comsub-eof4.sub: line 6: warning: here-document at line 4 delimited by end-of-file (wanted `EOF')
|
||||
contents
|
||||
./comsub-eof5.sub: line 8: warning: here-document at line 6 delimited by end-of-file (wanted `)')
|
||||
hi
|
||||
./comsub-eof5.sub: line 13: warning: here-document at line 11 delimited by end-of-file (wanted `EOF')
|
||||
hi
|
||||
|
||||
@@ -5,3 +5,7 @@ ${THIS_SH} ./comsub-eof1.sub
|
||||
${THIS_SH} ./comsub-eof2.sub
|
||||
|
||||
${THIS_SH} ./comsub-eof3.sub
|
||||
|
||||
${THIS_SH} ./comsub-eof4.sub
|
||||
|
||||
${THIS_SH} ./comsub-eof5.sub
|
||||
|
||||
@@ -202,3 +202,6 @@ ${THIS_SH} ./comsub-posix1.sub
|
||||
: $(echo foo)"
|
||||
"
|
||||
|
||||
# fixed after bash-4.0 released
|
||||
: $(case a in a) echo ;; # comment
|
||||
esac)
|
||||
|
||||
@@ -19,3 +19,11 @@ argv[1] = <sed> argv[2] = <-e> argv[3] = <s/[^I:]//g>
|
||||
argv[1] = <foo\^Jbar>
|
||||
argv[1] = <foobar>
|
||||
argv[1] = <foo\^Jbar>
|
||||
#esac
|
||||
a
|
||||
ok 1
|
||||
ok 2
|
||||
ok 3
|
||||
ok 4
|
||||
ok 5
|
||||
ok 6
|
||||
|
||||
@@ -40,3 +40,5 @@ bar'`
|
||||
|
||||
echo $(recho 'foo\
|
||||
bar')
|
||||
|
||||
${THIS_SH} ./comsub1.sub
|
||||
|
||||
@@ -351,3 +351,21 @@ debug lineno: 132 main
|
||||
debug lineno: 133 main
|
||||
debug lineno: 132 main
|
||||
debug lineno: 133 main
|
||||
debug lineno: 137 main
|
||||
main: calling f1
|
||||
f1: calling f2
|
||||
f2: calling f3
|
||||
f3: calling callstack
|
||||
deep 6
|
||||
0 z
|
||||
1 3
|
||||
2 y
|
||||
3 2
|
||||
4 x
|
||||
5 1
|
||||
FUNCNAME stack: f3 f2 f1 main
|
||||
26 f2 ./dbg-support3.sub
|
||||
f3: returning
|
||||
f2: return from f3
|
||||
f1: return from f2
|
||||
main: f1 returns
|
||||
|
||||
@@ -133,6 +133,9 @@ for i in 0 1 ; do
|
||||
((x=i+j))
|
||||
done
|
||||
done
|
||||
|
||||
${THIS_SH} ./dbg-support3.sub
|
||||
|
||||
#;;; Local Variables: ***
|
||||
#;;; mode:shell-script ***
|
||||
#;;; eval: (sh-set-shell "bash") ***
|
||||
|
||||
@@ -227,4 +227,12 @@ ${THIS_SH} ./dollar-star2.sub
|
||||
# default and the array contains null elements
|
||||
${THIS_SH} ./dollar-star3.sub
|
||||
|
||||
# test for set -u and expansions of $@ when there are no positional parameters
|
||||
${THIS_SH} ./dollar-at3.sub
|
||||
# test for set -u and expansions of $* when there are no positional parameters
|
||||
${THIS_SH} ./dollar-star4.sub
|
||||
|
||||
# tests for expansions of $* when IFS is null
|
||||
${THIS_SH} ./dollar-star5.sub
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -149,3 +149,20 @@ argv[1] = <ooq>
|
||||
argv[2] = <>
|
||||
argv[3] = <arq>
|
||||
argv[4] = <>
|
||||
0
|
||||
bar
|
||||
|
||||
after 1
|
||||
|
||||
after 2
|
||||
0
|
||||
bar
|
||||
|
||||
after 1
|
||||
|
||||
after 2
|
||||
a b
|
||||
ab
|
||||
cd
|
||||
ok 1
|
||||
ok 2
|
||||
|
||||
@@ -16,17 +16,17 @@ after exec1.sub without args: 0
|
||||
126
|
||||
./execscript: line 46: .: /: is a directory
|
||||
1
|
||||
127
|
||||
126
|
||||
0
|
||||
this is bashenv
|
||||
./exec3.sub: line 3: /tmp/bash-notthere: No such file or directory
|
||||
./exec3.sub: line 3: exec: /tmp/bash-notthere: cannot execute: No such file or directory
|
||||
126
|
||||
./execscript: line 68: notthere: No such file or directory
|
||||
./execscript: line 70: notthere: No such file or directory
|
||||
127
|
||||
./execscript: line 71: notthere: No such file or directory
|
||||
./execscript: line 73: notthere: No such file or directory
|
||||
127
|
||||
./execscript: line 74: notthere: No such file or directory
|
||||
./execscript: line 76: notthere: command not found
|
||||
127
|
||||
this is sh
|
||||
this is sh
|
||||
|
||||
@@ -48,6 +48,8 @@ echo $?
|
||||
|
||||
# try sourcing a binary file -- post-2.04 versions don't do the binary file
|
||||
# check, and will probably fail with `command not found', or status 127
|
||||
# bash-4.1 and later check for 256 NUL characters and fail as binary files
|
||||
# if there are more than that, it's probably binary
|
||||
. ${THIS_SH} 2>/dev/null
|
||||
echo $?
|
||||
|
||||
|
||||
@@ -162,3 +162,7 @@ argv[1] = <^A^A^?>
|
||||
0.net
|
||||
0.net
|
||||
0.net
|
||||
graph
|
||||
yes
|
||||
a
|
||||
a
|
||||
|
||||
@@ -382,3 +382,5 @@ echo ${a//\?/ }
|
||||
${THIS_SH} ./exp1.sub
|
||||
|
||||
${THIS_SH} ./exp2.sub
|
||||
|
||||
${THIS_SH} ./exp3.sub
|
||||
|
||||
@@ -193,7 +193,8 @@ esac
|
||||
|
||||
MYDIR=$PWD # save where we are
|
||||
|
||||
TESTDIR=/tmp/eglob-test-$$
|
||||
: ${TMPDIR:=/var/tmp}
|
||||
TESTDIR=$TMPDIR/eglob-test-$$
|
||||
mkdir $TESTDIR
|
||||
builtin cd $TESTDIR || { echo $0: cannot cd to $TESTDIR >&2 ; exit 1; }
|
||||
rm -rf *
|
||||
|
||||
@@ -136,6 +136,11 @@ funcc ()
|
||||
func-a
|
||||
func-b
|
||||
func-c
|
||||
foo-bar
|
||||
foo-bar ()
|
||||
{
|
||||
:
|
||||
}
|
||||
expect 5 10
|
||||
5 10
|
||||
expect 20
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -13,7 +13,7 @@ argv[2] = <abc>
|
||||
argv[3] = <abd>
|
||||
argv[4] = <abe>
|
||||
tmp/l1 tmp/l2 tmp/*4 tmp/l3
|
||||
./glob-test: line 44: no match: tmp/*4
|
||||
./glob.tests: line 44: no match: tmp/*4
|
||||
argv[1] = <bdir/>
|
||||
argv[1] = <*>
|
||||
argv[1] = <a*>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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!
|
||||
|
||||
|
||||
@@ -140,3 +140,7 @@ three
|
||||
one
|
||||
two
|
||||
three
|
||||
4.1
|
||||
echo ${BASH_VERSION%\.*}
|
||||
4.1
|
||||
echo ${BASH_VERSION%\.*}
|
||||
|
||||
@@ -109,3 +109,5 @@ shopt -q -o history
|
||||
echo $?
|
||||
|
||||
${THIS_SH} ./history1.sub
|
||||
|
||||
${THIS_SH} ./history2.sub
|
||||
|
||||
@@ -72,8 +72,8 @@ running jobs:
|
||||
[1] Running sleep 300 &
|
||||
[2]- Running sleep 350 &
|
||||
[3]+ Running sleep 400 &
|
||||
./jobs.tests: line 127: kill: %4: no such job
|
||||
./jobs.tests: line 129: jobs: %4: no such job
|
||||
./jobs.tests: line 128: kill: %4: no such job
|
||||
./jobs.tests: line 130: jobs: %4: no such job
|
||||
current job:
|
||||
[3]+ Running sleep 400 &
|
||||
previous job:
|
||||
|
||||
@@ -115,6 +115,7 @@ exit 1 | exit 2 | exit 3
|
||||
echo $? -- ${PIPESTATUS[@]} -- ${PIPESTATUS[0]} - ${PIPESTATUS[1]} - ${PIPESTATUS[2]}
|
||||
|
||||
sleep 300 &
|
||||
sleep300pid=$!
|
||||
sleep 350 &
|
||||
sleep 400 &
|
||||
|
||||
@@ -168,6 +169,7 @@ exec 5>&2
|
||||
exec 2>/dev/null
|
||||
|
||||
echo killing...
|
||||
kill -n 9 $sleep300pid
|
||||
kill -n 9 %2 %3
|
||||
wait # make sure we reap the processes while stderr is still redirected
|
||||
echo done
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -35,3 +35,6 @@ argv[1] = <hello, $world>
|
||||
;foo
|
||||
argv[1] = <^I>
|
||||
argv[1] = <'A^IB'>
|
||||
hello' world
|
||||
hello world!
|
||||
hello' world!
|
||||
|
||||
@@ -114,3 +114,5 @@ args ()
|
||||
unset mytab
|
||||
recho "${mytab:-$'\t'}"
|
||||
recho "$( args $'A\tB' )"
|
||||
|
||||
${THIS_SH} ./nquote1.sub
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
cd ${TMPDIR:=/var/tmp}
|
||||
rm -f u
|
||||
|
||||
${THIS_SH} -c 'exec 10>&1; echo fd 10 >&10' 10>u
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
PATH=$PATH:`pwd`
|
||||
export PATH
|
||||
${THIS_SH} ./glob-test 2>&1 | grep -v '^expect' > /tmp/xx
|
||||
${THIS_SH} ./glob.tests 2>&1 | grep -v '^expect' > /tmp/xx
|
||||
diff /tmp/xx glob.right && rm -f /tmp/xx
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
echo "warning: UNIX versions number signals differently. If output differing" >&2
|
||||
echo "warning: only in line numbers is produced, please do not consider this" >&2
|
||||
echo "warning: a test failure." >&2
|
||||
echo "warning: UNIX versions number signals and schedule processes differently." >&2
|
||||
echo "warning: If output differing only in line numbers is produced, please" >&2
|
||||
echo "warning: do not consider this a test failure." >&2
|
||||
|
||||
${THIS_SH} ./trap.tests > /tmp/xx 2>&1
|
||||
diff /tmp/xx trap.right && rm -f /tmp/xx
|
||||
|
||||
@@ -26,3 +26,31 @@
|
||||
+ x=i
|
||||
+ case x in
|
||||
+ x=i
|
||||
+ set +x
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
+ for f in a b c d e
|
||||
+ echo a
|
||||
a
|
||||
+ for f in a b c d e
|
||||
+ echo b
|
||||
b
|
||||
+ for f in a b c d e
|
||||
+ echo c
|
||||
c
|
||||
+ for f in a b c d e
|
||||
+ echo d
|
||||
d
|
||||
+ for f in a b c d e
|
||||
+ echo e
|
||||
e
|
||||
+ set +x
|
||||
TRACEFILE:
|
||||
+ echo 1
|
||||
+ echo 2
|
||||
+ echo 3
|
||||
+ echo 4
|
||||
+ unset BASH_XTRACEFD
|
||||
=====
|
||||
|
||||
@@ -14,8 +14,7 @@ case x in
|
||||
0) x=i ;;
|
||||
*) x=i ;;
|
||||
esac
|
||||
set +x
|
||||
|
||||
#;;; Local Variables: ***
|
||||
#;;; mode:shell-script ***
|
||||
#;;; eval: (sh-set-shell "bash") ***
|
||||
#;;; End: ***
|
||||
# test BASH_XTRACEFD
|
||||
${THIS_SH} ./set-x1.sub
|
||||
|
||||
@@ -10,6 +10,7 @@ shopt -u checkwinsize
|
||||
shopt -s cmdhist
|
||||
shopt -u compat31
|
||||
shopt -u compat32
|
||||
shopt -u compat40
|
||||
shopt -u dirspell
|
||||
shopt -u dotglob
|
||||
shopt -u execfail
|
||||
@@ -63,6 +64,7 @@ shopt -u checkjobs
|
||||
shopt -u checkwinsize
|
||||
shopt -u compat31
|
||||
shopt -u compat32
|
||||
shopt -u compat40
|
||||
shopt -u dirspell
|
||||
shopt -u dotglob
|
||||
shopt -u execfail
|
||||
@@ -93,6 +95,7 @@ checkjobs off
|
||||
checkwinsize off
|
||||
compat31 off
|
||||
compat32 off
|
||||
compat40 off
|
||||
dirspell off
|
||||
dotglob off
|
||||
execfail off
|
||||
|
||||
@@ -63,6 +63,19 @@ after while
|
||||
before false in trap2a.sub
|
||||
after false in trap2a.sub
|
||||
command substitution
|
||||
+[6] echo 1
|
||||
1
|
||||
+[7] echo 2
|
||||
2
|
||||
+[8] echo 3
|
||||
+[8] cat
|
||||
+[8] false
|
||||
++[8] echo trap: 8
|
||||
trap: 8
|
||||
+[9] echo 4
|
||||
4
|
||||
caught a child death
|
||||
caught a child death
|
||||
caught a child death
|
||||
trap -- 'echo caught a child death' SIGCHLD
|
||||
trap -- 'echo exiting' EXIT
|
||||
|
||||
@@ -66,6 +66,8 @@ trap '' USR2
|
||||
# test ERR trap
|
||||
./trap2.sub
|
||||
|
||||
${THIS_SH} ./trap3.sub
|
||||
|
||||
#
|
||||
# show that setting a trap on SIGCHLD is not disastrous.
|
||||
#
|
||||
@@ -88,3 +90,4 @@ trap
|
||||
|
||||
trap - SIGCHLD
|
||||
wait
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -89,3 +89,5 @@ f() {
|
||||
type f | cat -v
|
||||
|
||||
${THIS_SH} type1.sub
|
||||
|
||||
${THIS_SH} type2.sub
|
||||
|
||||
Reference in New Issue
Block a user