Initial devel branch import from bash-3.0-alpha

This commit is contained in:
Chet Ramey
2011-11-28 14:41:26 -05:00
parent 7117c2d221
commit d3a24ed242
261 changed files with 24280 additions and 6327 deletions
+4
View File
@@ -0,0 +1,4 @@
alias: 0
alias: 0
./alias.tests: line 25: qfoo: command not found
quux
+37
View File
@@ -0,0 +1,37 @@
# place holder for future alias testing
shopt -s expand_aliases
# alias/unalias tests originally in builtins.tests
unalias -a
# this should return success, according to POSIX.2
alias
echo alias: $?
alias foo=bar
unalias foo
# this had better return success, according to POSIX.2
alias
echo alias: $?
# bug in all versions through bash-2.05b
unalias qfoo qbar qbaz quux 2>/dev/null
alias qfoo=qbar
alias qbar=qbaz
alias qbaz=quux
alias quux=qfoo
qfoo
unalias qfoo qbar qbaz quux
unalias -a
alias foo='echo '
alias bar=baz
alias baz=quux
foo bar
unalias foo bar baz
+11 -11
View File
@@ -14,39 +14,39 @@ fx is a function
fx ()
{
i=0;
for (( 1 ; i < 3 ; i++ ))
for ((1 ; i < 3 ; i++ ))
do
echo $i;
done;
for (( i=0 ; 1 ; i++ ))
for ((i=0 ; 1 ; i++ ))
do
if (( " i >= 3 " )); then
if (( i >= 3 )); then
break;
fi;
echo $i;
done;
for (( i=0 ; i<3 ; 1 ))
for ((i=0 ; i<3 ; 1))
do
echo $i;
(( " i++ " ));
(( i++ ));
done;
i=0;
for (( 1 ; 1 ; 1 ))
for ((1 ; 1 ; 1))
do
if (( " i > 2 " )); then
if (( i > 2 )); then
break;
fi;
echo $i;
(( " i++ " ));
(( i++ ));
done;
i=0;
for (( 1 ; 1 ; 1 ))
for ((1 ; 1 ; 1))
do
if (( " i > 2 " )); then
if (( i > 2 )); then
break;
fi;
echo $i;
(( " i++ " ));
(( i++ ));
done
}
0
+1
View File
@@ -150,3 +150,4 @@ ok
42
42
42
./arith.tests: line 281: b[c]d: syntax error in expression (error token is "d")
+3
View File
@@ -276,3 +276,6 @@ echo $(( 8#$(printf "%o\n" $n) ))
printf "%u\n" $n
echo $(( 16#$(printf "%x\n" $n) ))
echo $(( 16#$(printf "%X\n" $n) ))
# causes longjmp botches through bash-2.05b
a[b[c]d]=e
+33
View File
@@ -6,7 +6,12 @@ abcde
abcde
abcde bdef
abcde bdef
declare -a BASH_ARGC='()'
declare -a BASH_ARGV='()'
declare -a BASH_LINENO='([0]="0")'
declare -a BASH_SOURCE='([0]="./array.tests")'
declare -a DIRSTACK='()'
declare -a FUNCNAME='([0]="main")'
declare -a a='([0]="abcde" [1]="" [2]="bdef")'
declare -a b='()'
declare -ar c='()'
@@ -29,7 +34,12 @@ declare -ar c='()'
readonly -a a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
readonly -a c='()'
a test
declare -a BASH_ARGC='()'
declare -a BASH_ARGV='()'
declare -a BASH_LINENO='([0]="0")'
declare -a BASH_SOURCE='([0]="./array.tests")'
declare -a DIRSTACK='()'
declare -a FUNCNAME='([0]="main")'
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
declare -ar c='()'
@@ -47,7 +57,12 @@ declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element
./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
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 -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
declare -ar c='()'
@@ -59,7 +74,12 @@ this of
this is a test of read using arrays
this test
this is a test of arrays
declare -a BASH_ARGC='()'
declare -a BASH_ARGV='()'
declare -a BASH_LINENO='([0]="0")'
declare -a BASH_SOURCE='([0]="./array.tests")'
declare -a DIRSTACK='()'
declare -a FUNCNAME='([0]="main")'
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
declare -ar c='()'
@@ -127,3 +147,16 @@ abc case if then else 5
case 4
case if then else 5
case if then else 5
argv[1] = <0>
argv[2] = <1>
argv[3] = <4>
argv[4] = <10>
argv[1] = <0>
argv[2] = <1>
argv[3] = <4>
argv[4] = <10>
argv[1] = <0>
argv[2] = <1>
argv[3] = <4>
argv[4] = <10>
argv[1] = <0 1 4 10>
+11
View File
@@ -289,3 +289,14 @@ echo ${foo[0]} ${#foo[0]}
echo ${foo[1]} ${#foo[1]}
echo ${foo[@]} ${#foo[@]}
echo ${foo[*]} ${#foo[*]}
# new expansions added after bash-2.05b
x[0]=zero
x[1]=one
x[4]=four
x[10]=ten
recho ${!x[@]}
recho "${!x[@]}"
recho ${!x[*]}
recho "${!x[*]}"
+19
View File
@@ -17,3 +17,22 @@ abcd{efgh
foo 1 2 bar
foo 1 2 bar
foo 1 2 bar
1 2 3 4 5 6 7 8 9 10
0..10 braces
0 1 2 3 4 5 6 7 8 9 10 braces
x0y x1y x2y x3y x4y x5y x6y x7y x8y x9y x10y xbracesy
3
x3y
10 9 8 7 6 5 4 3 2 1
10y 9y 8y 7y 6y 5y 4y 3y 2y 1y
x10y x9y x8y x7y x6y x5y x4y x3y x2y x1y
a b c d e f
f e d c b a
a _ ^ ] [ Z Y X W V U T S R Q P O N M L K J I H G F E D C B A
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
f
{1..f}
{f..1}
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20
-1 -2 -3 -4 -5 -6 -7 -8 -9 -10
-20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0
+57
View File
@@ -0,0 +1,57 @@
echo ff{c,b,a}
echo f{d,e,f}g
echo {l,n,m}xyz
echo {abc\,def}
echo {abc}
echo \{a,b,c,d,e}
echo {x,y,\{a,b,c}}
echo {x\,y,\{abc\},trie}
echo /usr/{ucb/{ex,edit},lib/{ex,how_ex}}
echo XXXX\{`echo a b c | tr ' ' ','`\}
eval echo XXXX\{`echo a b c | tr ' ' ','`\}
echo {}
echo { }
echo }
echo {
echo abcd{efgh
echo foo {1,2} bar
echo `zecho foo {1,2} bar`
echo $(zecho foo {1,2} bar)
# new sequence brace operators
echo {1..10}
# this doesn't work yet
echo {0..10,braces}
# but this does
echo {{0..10},braces}
echo x{{0..10},braces}y
echo {3..3}
echo x{3..3}y
echo {10..1}
echo {10..1}y
echo x{10..1}y
echo {a..f}
echo {f..a}
echo {a..A}
echo {A..a}
echo {f..f}
# mixes are incorrectly-formed brace expansions
echo {1..f}
echo {f..1}
echo 0{1..9} {10..20}
# do negative numbers work?
echo {-1..-10}
echo {-20..0}
+3 -5
View File
@@ -1,5 +1,3 @@
alias: 0
alias: 0
a
end-1
a
@@ -118,15 +116,15 @@ AVAR
foo
declare -x foo=""
declare -x FOO="\$\$"
./builtins.tests: line 219: declare: FOO: not found
./builtins.tests: line 207: declare: FOO: not found
declare -x FOO="\$\$"
ok
ok
./builtins.tests: line 251: kill: 4096: invalid signal specification
./builtins.tests: line 239: kill: 4096: invalid signal specification
1
a\n\n\nb
a
b
./builtins.tests: line 260: exit: status: numeric argument required
./builtins.tests: line 248: exit: status: numeric argument required
-12
View File
@@ -4,18 +4,6 @@ set +o posix
ulimit -c 0 2>/dev/null
# alias/unalias tests
unalias -a
# this should return success, according to POSIX.2
alias
echo alias: $?
alias foo=bar
unalias foo
# this had better return success, according to POSIX.2
alias
echo alias: $?
# check that break breaks loops
for i in a b c; do echo $i; break; echo bad-$i; done
echo end-1
+2
View File
@@ -33,3 +33,5 @@ returns: 0
returns: 1
returns: 0
ok
ok 42
ok 43
+4
View File
@@ -153,3 +153,7 @@ PAT=
if [[ $STR = $PAT ]]; then
echo ok
fi
# bug in all versions up to and including bash-2.05b
if [[ "123abc" == *?(a)bc ]]; then echo ok 42; else echo bad 42; fi
if [[ "123abc" == *?(a)bc ]]; then echo ok 43; else echo bad 43; fi
+2 -2
View File
@@ -14,7 +14,7 @@ tf ()
echo a
};
i=0;
while (( " i < 3 " )); do
while (( i < 3 )); do
test -r /dev/fd/$i;
i=$(( i + 1 ));
done;
@@ -26,7 +26,7 @@ tf ()
if [[ -r /dev/fd/0 && -w /dev/fd/1 ]]; then
echo ok >/dev/null;
else
if (( " 7 > 40 " )); then
if (( 7 > 40 )); then
echo oops;
else
echo done;
+353
View File
@@ -0,0 +1,353 @@
debug lineno: 63 main
debug lineno: 66 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
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 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
FUNCNAME[3]: main called from ./dbg-support.tests at line 0
debug lineno: 82 main
fn4 here. Calling fn3...
LINENO 34
BASH_SOURCE[0] ./dbg-support.tests
fn3 called from file `./dbg-support.tests' at line 82
fn4 called from file `./dbg-support.tests' at line 0
main called from file `./dbg-support.tests' at line 0
SOURCED LINENO 18
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
FUNCNAME[4]: main called from ./dbg-support.tests at line 0
debug lineno: 83 main
SOURCED LINENO 18
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
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
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
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: 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
debug lineno: 114 main
debug lineno: 119 main
debug lineno: 123 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
+26
View File
@@ -0,0 +1,26 @@
# This file is intended to be sourced from one of the bashdb test programs
sourced_fn() {
name="fn2"
echo "SOURCED FN LINENO $LINENO"
# Print a stack trace
declare -i n
n=${#FUNCNAME[@]}
for (( i=0 ; (( i < $n )) ; i++ )) ; do
local -i j=i+1
[ $j -eq $n ] && j=i # main()'s file is the same as the first caller
echo "FUNCNAME[$i]: ${FUNCNAME[$i]} called from ${BASH_SOURCE[$j]}" \
"at line ${BASH_LINENO[$i]}"
done
}
echo "SOURCED LINENO $LINENO"
echo "SOURCED BASH_SOURCE[0]" ${BASH_SOURCE[0]}
sourced_fn
#;;; Local Variables: ***
#;;; mode:shell-script ***
#;;; eval: (sh-set-shell "bash") ***
#;;; End: ***
+139
View File
@@ -0,0 +1,139 @@
#!../bash
#
# Test correct functioning bash debug support not via the bashdb
# debugger but merely by printing via print_trap()
# $Id: dbg-support.tests,v 1.13 2003/02/17 22:02:25 rockyb Exp $
shopt -s extdebug
print_debug_trap() {
echo "debug lineno: $1 ${FUNCNAME[1]}"
return
}
print_return_trap() {
echo "return lineno: $1 ${FUNCNAME[1]}"
return
}
fn1() {
echo "LINENO $LINENO"
echo "LINENO $LINENO"
echo "BASH_SOURCE[0]" ${BASH_SOURCE[0]}
echo "FUNCNAME[0]" ${FUNCNAME[0]}
echo `caller`
echo `caller 0`
echo `caller 1`
echo `caller foo`
}
fn2() {
echo "fn2 here. Calling fn1..."
fn1
}
fn3() {
echo "LINENO $LINENO"
echo "BASH_SOURCE[0]" ${BASH_SOURCE[0]}
# Print a stack trace
declare -i n
n=${#FUNCNAME[@]}
for (( i=0 ; (( i < $n )) ; i++ )) ; do
local -i j=i+1
[ $j -eq $n ] && j=i # main()'s file is the same as the first caller
echo "${FUNCNAME[$i]} called from file " \
"\`${BASH_SOURCE[$j]}' at line ${BASH_LINENO[$j]}"
done
source ./dbg-support.sub
}
fn4() {
echo "fn4 here. Calling fn3..."
fn3
}
#!../bash
#
# Test of support for debugging facilities in bash
#
# Test debugger set option fntrace - set on. Not in vanilla Bash 2.05
#
set -o functrace
trap 'print_debug_trap $LINENO' DEBUG
trap 'print_return_trap $LINENO' RETURN
# Funcname is now an array. Vanilla Bash 2.05 doesn't have FUNCNAME array.
echo "FUNCNAME" ${FUNCNAME[0]}
# We should trace into the below.
# Start easy with a simple function.
fn1
fn2
fn3
source ./dbg-support.sub
# Test debugger set option fntrace - set off
set +T
# We should not trace into this.
fn1
fn2
fn3
fn4
source ./dbg-support.sub
# Another way to say: set -o fntrace
set -T
# We should trace into this.
source ./dbg-support.sub
set +T
# Test that the line numbers in the presence of conditionals are correct.
for (( i=0 ; (( i <= 2 )) ; i++ )) ; do
if [ $i -eq 2 ] ; then
echo "Hit 2"
fi
j=4
done
#
# Check line numbers in command substitution
#
echo $(sourced_fn)
echo `sourced_fn`
x=$((sourced_fn))
x={ sourced_fn }
# Make sure we step into sourced_fn as a comand when we request to do so.
# Vanilla bash 2.0 doesn't do.
set -o functrace
x={ sourced_fn }
# Should see line number of xyzzy below. Vanilla bash 2.05b doesn't do
case xyzzy in
a )
x=5
;;
xyzz? )
case 3 in
2 )
x=6 ;;
3 )
echo "got it" ;;
* ) echo "no good" ;;
esac
;;
* )
esac
# Should see line numbers for initial for lines.
for i in 0 1 ; do
for j in 3 4 ; do
((x=i+j))
done
done
#;;; Local Variables: ***
#;;; mode:shell-script ***
#;;; eval: (sh-set-shell "bash") ***
#;;; End: ***
+7
View File
@@ -0,0 +1,7 @@
lineno: 17 (6) main
lineno: 18 (6) main
x is 1
lineno: 19 (6) main
lineno: 20 (6) main
lineno: 21 (6) main
x is 1
+26
View File
@@ -0,0 +1,26 @@
#!../bash
#
# Test correct trap return codes = 2 means skip execution.
shopt -s extdebug
print_trap() {
echo "lineno: $1 ($LINENO) ${FUNCNAME[1]}"
if [[ $debug_exit == 2 ]] ; then
debug_exit=0
return 2
fi
return 0
}
debug_exit=0
trap 'print_trap $LINENO' DEBUG
x=1
echo "x is $x"
debug_exit=2
x=2
echo "x is $x"
#;;; Local Variables: ***
#;;; mode:shell-script ***
#;;; eval: (sh-set-shell "bash") ***
#;;; End: ***
+4
View File
@@ -207,4 +207,8 @@ case "$@" in
*) echo bad 4;;
esac
# tests for special expansion of "$*" and "${array[*]}" when used with other
# expansions -- bugs through bash-2.05b
${THIS_SH} ./dollar-star1.sub
exit 0
+31
View File
@@ -0,0 +1,31 @@
set -- a b c
x=(a b c); IFS='|'
echo "${*/#/x}"
echo "${x[*]/#/x}"
echo "$*"
echo "${x[*]}"
echo "$@"
echo "${x[@]}"
echo "${@/#/x}"
echo "${x[@]/#/x}"
echo "${*:1:2}"
echo "${x[*]:1:2}"
echo "${@:1:2}"
echo "${x[@]:1:2}"
IFS=$' \t\n'
set -- xa xb xc
x=(xa xb xc)
IFS='|'
echo "${*#x}"
echo "${x[*]#x}"
echo "$*"
echo "${x[*]}"
+16
View File
@@ -95,3 +95,19 @@ ok 1
ok 2
ok 3
ok 4
xa|xb|xc
xa|xb|xc
a|b|c
a|b|c
a b c
a b c
xa xb xc
xa xb xc
a|b
b|c
a b
b c
a|b|c
a|b|c
xa|xb|xc
xa|xb|xc
+10 -10
View File
@@ -15,7 +15,7 @@ unset: usage: unset [-f] [-v] [name ...]
./errors.tests: line 52: unset: `/bin/sh': not a valid identifier
./errors.tests: line 55: unset: cannot simultaneously unset a function and a variable
./errors.tests: line 58: declare: -z: invalid option
declare: usage: declare [-afFirtx] [-p] name[=value] ...
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
./errors.tests: line 60: declare: `-z': not a valid identifier
./errors.tests: line 61: declare: `/bin/sh': not a valid identifier
./errors.tests: line 65: declare: cannot use `-f' to make functions
@@ -53,20 +53,20 @@ umask: usage: umask [-p] [-S] [mode]
./errors.tests: line 159: declare: VAR: readonly variable
./errors.tests: line 161: declare: unset: not found
./errors.tests: line 164: VAR: readonly variable
./errors.tests: command substitution: line 2: syntax error: unexpected end of file
./errors.tests: command substitution: line 1: syntax error near unexpected token `done'
./errors.tests: command substitution: line 1: ` for z in 1 2 3; done '
./errors.tests: command substitution: line 168: syntax error: unexpected end of file
./errors.tests: command substitution: line 168: syntax error near unexpected token `done'
./errors.tests: command substitution: line 168: ` for z in 1 2 3; done '
./errors.tests: line 171: cd: HOME not set
./errors.tests: line 172: cd: /tmp/xyz.bash: No such file or directory
./errors.tests: line 174: cd: OLDPWD not set
./errors.tests: line 175: cd: /bin/sh: Not a directory
./errors.tests: line 177: cd: /tmp/cd-notthere: No such file or directory
./errors.tests: line 180: .: filename argument required
.: usage: . filename
.: usage: . filename [arguments]
./errors.tests: line 181: source: filename argument required
source: usage: source filename
source: usage: source filename [arguments]
./errors.tests: line 184: .: -i: invalid option
.: usage: . filename
.: usage: . filename [arguments]
./errors.tests: line 187: set: -q: invalid option
set: usage: set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
./errors.tests: line 190: enable: sh: not a shell builtin
@@ -76,13 +76,13 @@ set: usage: set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
./errors.tests: line 199: read: `/bin/sh': not a valid identifier
./errors.tests: line 202: VAR: readonly variable
./errors.tests: line 205: readonly: -x: invalid option
readonly: usage: readonly [-anf] [name[=value] ...] or readonly -p
readonly: usage: readonly [-af] [name[=value] ...] or readonly -p
./errors.tests: line 208: eval: -i: invalid option
eval: usage: eval [arg ...]
./errors.tests: line 209: command: -i: invalid option
command: usage: command [-pVv] command [arg ...]
./errors.tests: line 1: /bin/sh + 0: syntax error: operand expected (error token is "/bin/sh + 0")
./errors.tests: line 1: /bin/sh + 0: syntax error: operand expected (error token is "/bin/sh + 0")
./errors.tests: line 212: /bin/sh + 0: syntax error: operand expected (error token is "/bin/sh + 0")
./errors.tests: line 213: /bin/sh + 0: syntax error: operand expected (error token is "/bin/sh + 0")
./errors.tests: line 216: trap: NOSIG: invalid signal specification
./errors.tests: line 219: trap: -s: invalid option
trap: usage: trap [arg] [signal_spec ...] or trap -l
+1
View File
@@ -50,3 +50,4 @@ this is ohio-state
1
0
1
testb
+20
View File
@@ -0,0 +1,20 @@
# make sure that bash really checks the right things when deciding what
# constitutes an executable file
[ $UID -eq 0 ] && { echo "exec7.sub: the test suite should not be run as root" >&2 ; }
: ${TMPDIR:=/tmp}
cd $TMPDIR || { echo "cannot cd to $TMPDIR" >&2 ; exit 2; }
mkdir testa testb
echo 'echo "testa"' > testa/foo
echo 'echo "testb"' > testb/foo
chmod 655 testa/foo
chmod 755 testb/foo
PATH=$TMPDIR/testa:$TMPDIR/testb $THIS_SH -c foo
rm -rf testa testb
+4 -1
View File
@@ -1,7 +1,7 @@
export LC_ALL=C
export LANG=C
if (( $UID == 0 )); then
if [ $UID -eq 0 ]; then
echo "execscript: the test suite should not be run as root" >&2
fi
@@ -94,3 +94,6 @@ ${THIS_SH} -c 'cat </dev/null | cat >/dev/null' >&-
# values
${THIS_SH} ./exec6.sub
# checks for properly deciding what constitutes an executable file
${THIS_SH} ./exec7.sub
+1
View File
@@ -67,6 +67,7 @@ ok 38
ok 39
ok 40
ok 41
ok 42
a b a,b a-b a.b a:b a;b a_b
a b a,b a-b a.b a:b a;b a_b
a b a,b a-b a.b a:b a;b a_b
+6
View File
@@ -321,6 +321,12 @@ ab**) echo ok 41;;
*) echo bad 41;;
esac
# bug in all versions up to and including bash-2.05b
case "123abc" in
*?(a)bc) echo ok 42;;
*) echo bad 42;;
esac
# clean up and do the next one
builtin cd /
+10
View File
@@ -35,6 +35,16 @@ recho a* X*
shopt -u nullglob
# see if the failglob option works
mkdir tmp
touch tmp/l1 tmp/l2 tmp/l3
builtin echo tmp/l[12] tmp/*4 tmp/*3
shopt -s failglob
builtin echo tmp/l[12] tmp/*4 tmp/*3
rm -r tmp
shopt -u failglob
# see if the code that expands directories only works
expect '<bdir/>'
recho b*/
+2
View File
@@ -12,6 +12,8 @@ argv[1] = <a>
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
argv[1] = <bdir/>
argv[1] = <*>
argv[1] = <a*>
+2
View File
@@ -24,3 +24,5 @@ f3 ()
echo $(echo hi)
echo ho
echo off to work we go
declare -a uu='([0]="" [1]="kghfjk" [2]="jkfzuk" [3]="i\
")'
+3
View File
@@ -34,3 +34,6 @@ cat <<< 'echo $(echo hi)'
cat <<< "echo ho"
cat <<< "echo $(echo off to work we go)"
IFS="/" read -r -d $'\000' -a uu <<< /kghfjk/jkfzuk/i
declare -p uu
+1 -1
View File
@@ -43,7 +43,7 @@ fg-bg 4
sleep 5
fg-bg 5
./jobs.tests: line 83: fg: %2: no such job
./jobs.tests: line 84: bg: bg background job?
./jobs.tests: line 84: bg: job %1 already in background
fg-bg 6
./jobs.tests: line 91: fg: -s: invalid option
fg: usage: fg [job_spec]
+11 -3
View File
@@ -422,7 +422,15 @@ argv[1] = <_QUANTITY-_QUART-_QUEST-_QUILL-_QUOTA-_QUOTE>
./new-exp3.sub: line 19: ${!_Q* }: bad substitution
./new-exp3.sub: line 24: ${!1*}: bad substitution
./new-exp3.sub: line 26: ${!@*}: bad substitution
./new-exp.tests: line 503: ${$(($#-1))}: bad substitution
Case01---3---A:B:C---
Case02---1---A B C::---
Case03---3---A:B:C---
Case04---3---A:B:C---
Case05---3---A:B:C---
Case06---1---A B C::---
Case07---3---A:B:C---
Case08---3---A:B:C---
./new-exp.tests: line 506: ${$(($#-1))}: bad substitution
argv[1] = <a>
argv[2] = <b>
argv[3] = <c>
@@ -439,7 +447,7 @@ argv[1] = <a>
argv[1] = <a>
argv[2] = <b>
argv[1] = <>
./new-exp.tests: line 522: $(($# - 2)): substring expression < 0
./new-exp.tests: line 525: $(($# - 2)): substring expression < 0
argv[1] = <bin>
argv[2] = <bin>
argv[3] = <ucb>
@@ -471,4 +479,4 @@ argv[1] = </full/path/to>
argv[1] = </>
argv[1] = <full/path/to/x16>
argv[1] = <x16>
./new-exp.tests: line 542: ABXD: parameter unset
./new-exp.tests: line 545: ABXD: parameter unset
+3
View File
@@ -498,6 +498,9 @@ recho "${RECEIVED:$((${#RECEIVED}-1)):1}"
# tests of new prefix expansion ${!prefix*}
${THIS_SH} ./new-exp3.sub
# bug with indirect expansion through bash-2.05b
${THIS_SH} ./new-exp4.sub
# these caused errors and core dumps in versions before bash-2.04
c=""
echo ${c//${$(($#-1))}/x/}
+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash
arrayA=("A" "B" "C")
arrayB=( ${arrayA[*]} )
echo "Case01---${#arrayB[*]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---"
arrayB=( "${arrayA[*]}" )
echo "Case02---${#arrayB[*]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---"
arrayB=( ${arrayA[@]} )
echo "Case03---${#arrayB[@]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---"
arrayB=( "${arrayA[@]}" )
echo "Case04---${#arrayB[@]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---"
xx="arrayA[*]"
arrayB=( ${!xx} )
echo "Case05---${#arrayB[*]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---"
arrayB=( "${!xx}" )
echo "Case06---${#arrayB[*]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---"
xx="arrayA[@]"
arrayB=( ${!xx} )
echo "Case07---${#arrayB[@]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---"
arrayB=( "${!xx}" )
echo "Case08---${#arrayB[@]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---"
+18
View File
@@ -0,0 +1,18 @@
argv[1] = <ab>
argv[1] = <abAcd>
argv[1] = <abAcd>
argv[1] = <ab^Dcd>
argv[1] = <abLd>
argv[1] = <abÞ>
argv[1] = <abÞ>
argv[1] = <abÍe>
argv[1] = <ab^Lde>
argv[1] = <¼X>
argv[1] = <«cX>
argv[1] = <>
argv[1] = <>
argv[1] = <gX>
argv[1] = <Ab>
argv[1] = <>
argv[1] = <^Abcd>
argv[1] = <Þ>
+24
View File
@@ -0,0 +1,24 @@
recho $'ab\x{}cd'
recho $'ab\x{41}cd'
recho $'ab\x41cd'
recho $'ab\x{4}cd'
recho $'ab\x4cd'
recho $'ab\x{cde'
recho $'ab\x{cde'
recho $'ab\x{cd}e'
recho $'ab\x{c}de'
recho $'\x{abcX'
recho $'\x{ab}cX'
recho $'\x{}X'
recho $'\x{X'
recho $'\x{01234567X'
recho $'\x{41}b'
recho $'\x{}bc'
recho $'\x{1}bcd'
recho $'\x{bde'
+2 -2
View File
@@ -1,6 +1,6 @@
a=4
read -t 2 a
read -t 2 a < /dev/tty
echo $?
echo $a
@@ -10,7 +10,7 @@ echo $?
echo $a
read -t -3 a
read -t -3 a < /dev/tty
echo $?
echo $a
+6
View File
@@ -88,3 +88,9 @@ f ()
after read
./redir5.sub: line 27: read: read error: 0: Bad file descriptor
# tests of ksh93-like dup-and-close redirection operators
/
/
/
0
0
0
+3
View File
@@ -153,3 +153,6 @@ cat < redir1.*
# test ksh93 dup-and-close (move fd) redirections
${THIS_SH} ./redir5.sub
# test behavior after a write error with a builtin command
${THIS_SH} ./redir6.sub
+8
View File
@@ -0,0 +1,8 @@
cd /
pwd
help >&-
pwd
pwd
echo $?
echo $?
echo $?
+2
View File
@@ -0,0 +1,2 @@
${THIS_SH} ./alias.tests > /tmp/xx 2>&1
diff /tmp/xx alias.right && rm -f /tmp/xx
+1 -1
View File
@@ -1,2 +1,2 @@
${THIS_SH} ./braces-tests > /tmp/xx
${THIS_SH} ./braces.tests > /tmp/xx
diff /tmp/xx braces.right && rm -f /tmp/xx
+11
View File
@@ -0,0 +1,11 @@
#!../bash
#$Id: run-dbg-support,v 1.5 2002/11/14 06:08:16 rockyb Exp $
TEST_NAME='dbg-support'
TEST_FILE="/tmp/${TEST_NAME}.check"
${THIS_SH} ./${TEST_NAME}.tests > $TEST_FILE 2>&1 < /dev/null
set -f
diff $TEST_FILE ${TEST_NAME}.right && rm -f $TEST_FILE
# Return code tells testing mechanism whether passed or not.
exit $?
+16
View File
@@ -0,0 +1,16 @@
#!../bash
#$Id: run-dbg-support2,v 1.3 2002/11/14 06:08:16 rockyb Exp $
TEST_NAME='dbg-support2'
TEST_FILE="/tmp/${TEST_NAME}.check"
${THIS_SH} ./${TEST_NAME}.tests > $TEST_FILE 2>&1 < /dev/null
set -f
diff $TEST_FILE ${TEST_NAME}.right && rm -f $TEST_FILE
# Return code tells testing mechanism whether passed or not.
exit $?
#;;; Local Variables: ***
#;;; mode:shell-script ***
#;;; eval: (sh-set-shell "bash") ***
#;;; End: ***
+1 -1
View File
@@ -1,4 +1,4 @@
PATH=$PATH:`pwd`
export PATH
${THIS_SH} ./glob-test | grep -v '^expect' > /tmp/xx
${THIS_SH} ./glob-test 2>&1 | grep -v '^expect' > /tmp/xx
diff /tmp/xx glob.right && rm -f /tmp/xx
+2
View File
@@ -0,0 +1,2 @@
${THIS_SH} ./nquote.tests 2>&1 | grep -v '^expect' > /tmp/xx
diff /tmp/xx nquote.right && rm -f /tmp/xx
+11
View File
@@ -0,0 +1,11 @@
#!../bash
#$Id: run-set-x,v 1.1 2002/12/09 13:12:37 rockyb Exp $
TEST_NAME='set-x'
TEST_FILE="/tmp/${TEST_NAME}.check"
${THIS_SH} ./${TEST_NAME}.tests > $TEST_FILE 2>&1 < /dev/null
set -f
diff $TEST_FILE ${TEST_NAME}.right && rm -f $TEST_FILE
# Return code tells testing mechanism whether passed or not.
exit $?
+2
View File
@@ -1,2 +1,4 @@
unset GROUPS UID 2>/dev/null
${THIS_SH} ./test.tests >/tmp/xx 2>&1
diff /tmp/xx test.right && rm -f /tmp/xx
+28
View File
@@ -0,0 +1,28 @@
+ (( i=0 ))
+ (( i<=5 ))
+ x=0
+ (( i++ ))
+ (( i<=5 ))
+ x=0
+ (( i++ ))
+ (( i<=5 ))
+ x=0
+ (( i++ ))
+ (( i<=5 ))
+ x=0
+ (( i++ ))
+ (( i<=5 ))
+ x=0
+ (( i++ ))
+ (( i<=5 ))
+ x=0
+ (( i++ ))
+ (( i<=5 ))
+ for i in 0 1 2
+ x=i
+ for i in 0 1 2
+ x=i
+ for i in 0 1 2
+ x=i
+ case x in
+ x=i
+21
View File
@@ -0,0 +1,21 @@
#!../bash
# $Id: set-x.tests,v 1.1 2002/12/09 13:12:37 rockyb Exp $
#
# Test that "set -x" shows what we think it should.
#
set -x
for ((i=0; i<=5; i++ )) ; do
x=0
done
for i in 0 1 2 ; do
x=i
done
case x in
0) x=i ;;
*) x=i ;;
esac
#;;; Local Variables: ***
#;;; mode:shell-script ***
#;;; eval: (sh-set-shell "bash") ***
#;;; End: ***
+28
View File
@@ -9,7 +9,12 @@ shopt -s cmdhist
shopt -u dotglob
shopt -u execfail
shopt -s expand_aliases
shopt -u extdebug
shopt -u extglob
shopt -s extquote
shopt -u failglob
shopt -s force_fignore
shopt -u gnu_errfmt
shopt -u histreedit
shopt -u histappend
shopt -u histverify
@@ -36,6 +41,8 @@ shopt -s sourcepath
shopt -s cdspell
shopt -s cmdhist
shopt -s expand_aliases
shopt -s extquote
shopt -s force_fignore
shopt -s hostcomplete
shopt -s interactive_comments
shopt -s progcomp
@@ -47,7 +54,10 @@ shopt -u checkhash
shopt -u checkwinsize
shopt -u dotglob
shopt -u execfail
shopt -u extdebug
shopt -u extglob
shopt -u failglob
shopt -u gnu_errfmt
shopt -u histreedit
shopt -u histappend
shopt -u histverify
@@ -67,7 +77,10 @@ checkhash off
checkwinsize off
dotglob off
execfail off
extdebug off
extglob off
failglob off
gnu_errfmt off
histreedit off
histappend off
histverify off
@@ -86,6 +99,8 @@ set +o allexport
set -o braceexpand
set -o emacs
set +o errexit
set +o errtrace
set +o functrace
set -o hashall
set -o histexpand
set -o history
@@ -101,6 +116,7 @@ set +o notify
set +o nounset
set +o onecmd
set +o physical
set +o pipefail
set +o posix
set -o privileged
set +o verbose
@@ -111,6 +127,8 @@ allexport off
braceexpand on
emacs on
errexit off
errtrace off
functrace off
hashall on
histexpand on
history on
@@ -126,6 +144,7 @@ notify off
nounset off
onecmd off
physical off
pipefail off
posix off
privileged on
verbose off
@@ -136,6 +155,8 @@ set +o allexport
set -o braceexpand
set -o emacs
set +o errexit
set +o errtrace
set +o functrace
set -o hashall
set -o histexpand
set -o history
@@ -151,6 +172,7 @@ set +o notify
set +o nounset
set +o onecmd
set +o physical
set +o pipefail
set +o posix
set -o privileged
set +o verbose
@@ -171,6 +193,8 @@ set -o privileged
--
set +o allexport
set +o errexit
set +o errtrace
set +o functrace
set +o ignoreeof
set +o keyword
set +o noclobber
@@ -181,6 +205,7 @@ set +o notify
set +o nounset
set +o onecmd
set +o physical
set +o pipefail
set +o posix
set +o verbose
set +o vi
@@ -188,6 +213,8 @@ set +o xtrace
--
allexport off
errexit off
errtrace off
functrace off
ignoreeof off
keyword off
noclobber off
@@ -198,6 +225,7 @@ notify off
nounset off
onecmd off
physical off
pipefail off
posix off
verbose off
vi off
+1 -1
View File
@@ -99,7 +99,7 @@ t -s run-all
echo 't -t 20'
t -t 20
echo 't -t 0'
t -t 0
t -t 0 < /dev/tty
echo 't -u noexist'
t -u noexist
+1
View File
@@ -29,6 +29,7 @@ trap -- 'echo [$LINENO] debug' DEBUG
[28] debug
./trap.tests[33] debug
./trap.tests[34] debug
func2[30] debug
func2[31] debug
func2debug line
./trap.tests[36] debug
+8 -4
View File
@@ -4,7 +4,6 @@ type: usage: type [-afptP] name [name ...]
./type.tests: line 13: command: notthere: not found
function
keyword
alias
builtin
file
file
@@ -16,7 +15,6 @@ func ()
}
while is a shell keyword
while is a shell keyword
m is aliased to `more'
builtin is a shell builtin
/bin/sh is /bin/sh
func
@@ -27,6 +25,12 @@ func ()
}
while
while is a shell keyword
./type.tests: line 42: type: m: not found
./type.tests: line 43: command: m: not found
alias m='more'
alias m='more'
m is aliased to `more'
alias
alias m='more'
alias m='more'
alias m='more'
@@ -35,8 +39,8 @@ builtin
builtin is a shell builtin
/bin/sh
/bin/sh is /bin/sh
./type.tests: line 51: type: func: not found
./type.tests: line 53: type: m: not found
./type.tests: line 64: type: func: not found
./type.tests: line 66: type: m: not found
/bin/sh
/tmp/bash
bash is hashed (/tmp/bash)
+15 -2
View File
@@ -19,7 +19,6 @@ func() { echo this is func; }
type -t func
type -t while
type -t m
type -t builtin
type -t /bin/sh
type -t ${THIS_SH}
@@ -29,7 +28,6 @@ type func
# the following two should produce identical output
type while
type -a while
type m
type builtin
type /bin/sh
@@ -37,11 +35,26 @@ command -v func
command -V func
command -v while
command -V while
# the following three lines should produce the same output
# first test with alias expansion off (should all fail or produce no output)
type -t m
type m
command -v m
alias -p
alias m
# then test with alias expansion on
shopt -s expand_aliases
type m
type -t m
command -v m
alias -p
alias m
command -V m
shopt -u expand_aliases
command -v builtin
command -V builtin
command -v /bin/sh
+1 -1
View File
@@ -30,7 +30,7 @@ unset
declare -x ivar="42"
hB
braceexpand:hashall:interactive-comments
hPB
hBP
braceexpand:hashall:interactive-comments:physical
declare -r SHELLOPTS="braceexpand:hashall:interactive-comments:physical"
abcde