mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-07 12:20:50 +02:00
commit bash-20070329 snapshot
This commit is contained in:
@@ -1 +1,3 @@
|
||||
Type `sh run-all'.
|
||||
|
||||
Read COPYRIGHT for copyright information.
|
||||
|
||||
@@ -139,6 +139,12 @@ value = new1 new2 new3
|
||||
7 8 9
|
||||
8 11
|
||||
8 11
|
||||
6
|
||||
6
|
||||
nordholz
|
||||
8
|
||||
8
|
||||
8
|
||||
|
||||
a b c d e f g
|
||||
for case if then else
|
||||
@@ -199,3 +205,4 @@ t
|
||||
[3]=abcde r s t u v
|
||||
e
|
||||
9
|
||||
2
|
||||
|
||||
@@ -399,3 +399,7 @@ unset x[2]
|
||||
x[9]='9'
|
||||
|
||||
echo ${x[*]: -1}
|
||||
|
||||
TOOLKIT=(1 2 3 4 5 6 7 8 9 10)
|
||||
ARRAY="1"
|
||||
echo ${TOOLKIT["$ARRAY"]}
|
||||
|
||||
@@ -18,3 +18,15 @@ echo $a $b
|
||||
typeset -i a b
|
||||
a=(5+3) b=(4+7)
|
||||
echo $a $b
|
||||
|
||||
let a=(4*3)/2
|
||||
echo $a
|
||||
a=(4*3)/2
|
||||
echo $a
|
||||
|
||||
LNAME=nordholz
|
||||
echo ${LNAME}
|
||||
echo ${#LNAME}
|
||||
|
||||
echo ${#LNAME[$(( 0 ))]}
|
||||
echo ${#LNAME[$(( 0+0 ))]}
|
||||
|
||||
@@ -41,3 +41,5 @@ f
|
||||
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
|
||||
a-{bd}-c a-{be}-c
|
||||
a-{bdef-g-c a-{bdef-i-c
|
||||
|
||||
@@ -68,3 +68,8 @@ echo 0{1..9} {10..20}
|
||||
# do negative numbers work?
|
||||
echo {-1..-10}
|
||||
echo {-20..0}
|
||||
|
||||
# weirdly-formed brace expansions -- fixed in post-bash-3.1
|
||||
echo a-{b{d,e}}-c
|
||||
|
||||
echo a-{bdef-{g,i}-c
|
||||
|
||||
+12
-3
@@ -108,6 +108,15 @@ m n o p
|
||||
./source5.sub: line 10: /tmp/source-notthere: No such file or directory
|
||||
after bad source 1
|
||||
./source5.sub: line 17: /tmp/source-notthere: No such file or directory
|
||||
one - OK
|
||||
0
|
||||
0
|
||||
two - OK
|
||||
0
|
||||
three - OK
|
||||
0
|
||||
four - OK
|
||||
0
|
||||
AVAR
|
||||
foo
|
||||
foo
|
||||
@@ -118,15 +127,15 @@ AVAR
|
||||
foo
|
||||
declare -x foo=""
|
||||
declare -x FOO="\$\$"
|
||||
./builtins.tests: line 207: declare: FOO: not found
|
||||
./builtins.tests: line 210: declare: FOO: not found
|
||||
declare -x FOO="\$\$"
|
||||
ok
|
||||
ok
|
||||
./builtins.tests: line 239: kill: 4096: invalid signal specification
|
||||
./builtins.tests: line 242: kill: 4096: invalid signal specification
|
||||
1
|
||||
a\n\n\nb
|
||||
a
|
||||
|
||||
|
||||
b
|
||||
./builtins.tests: line 248: exit: status: numeric argument required
|
||||
./builtins.tests: line 251: exit: status: numeric argument required
|
||||
|
||||
@@ -176,6 +176,9 @@ ${THIS_SH} ./builtins1.sub
|
||||
# test behavior of `.' when given a non-existant file argument
|
||||
${THIS_SH} ./source5.sub
|
||||
|
||||
# test bugs in sourcing non-regular files, fixed post-bash-3.2
|
||||
${THIS_SH} ./source6.sub
|
||||
|
||||
# in posix mode, assignment statements preceding special builtins are
|
||||
# reflected in the shell environment. `.' and `eval' need special-case
|
||||
# code.
|
||||
|
||||
@@ -33,5 +33,28 @@ returns: 0
|
||||
returns: 1
|
||||
returns: 0
|
||||
ok
|
||||
jbig2dec
|
||||
found 1
|
||||
libc
|
||||
found 2
|
||||
libc
|
||||
ok 42
|
||||
ok 43
|
||||
match 1
|
||||
match 2
|
||||
match 3
|
||||
match 4
|
||||
match 5
|
||||
match 6
|
||||
yes 1
|
||||
yes 2
|
||||
yes 3
|
||||
yes 4
|
||||
yes 5
|
||||
yes 6
|
||||
Dog 01 is Wiggles
|
||||
Dog 01 is Wiggles
|
||||
rematch 1
|
||||
matches 7
|
||||
matches 8
|
||||
matches 9
|
||||
|
||||
@@ -154,6 +154,26 @@ if [[ $STR = $PAT ]]; then
|
||||
echo ok
|
||||
fi
|
||||
|
||||
# test the regular expression conditional operator
|
||||
[[ jbig2dec-0.9-i586-001.tgz =~ ([^-]+)-([^-]+)-([^-]+)-0*([1-9][0-9]*)\.tgz ]]
|
||||
echo ${BASH_REMATCH[1]}
|
||||
|
||||
LDD_BASH=" linux-gate.so.1 => (0xffffe000)
|
||||
libreadline.so.5 => /lib/libreadline.so.5 (0xb7f91000)
|
||||
libhistory.so.5 => /lib/libhistory.so.5 (0xb7f8a000)
|
||||
libncurses.so.5 => /lib/libncurses.so.5 (0xb7f55000)
|
||||
libdl.so.2 => /lib/libdl.so.2 (0xb7f51000)
|
||||
libc.so.6 => /lib/libc.so.6 (0xb7e34000)
|
||||
/lib/ld-linux.so.2 (0xb7fd0000)"
|
||||
|
||||
[[ "$LDD_BASH" =~ "libc" ]] && echo "found 1"
|
||||
echo ${BASH_REMATCH[@]}
|
||||
|
||||
[[ "$LDD_BASH" =~ libc ]] && echo "found 2"
|
||||
echo ${BASH_REMATCH[@]}
|
||||
|
||||
# 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
|
||||
|
||||
${THIS_SH} ./cond-regexp.sub
|
||||
|
||||
+10
-10
@@ -1,14 +1,14 @@
|
||||
tf is a function
|
||||
tf ()
|
||||
{
|
||||
echo this is ${0##*/} >/dev/null;
|
||||
echo a | cat - >/dev/null;
|
||||
echo this is ${0##*/} > /dev/null;
|
||||
echo a | cat - > /dev/null;
|
||||
test -f ${0##*/} && echo ${0##*/} is a regular file;
|
||||
test -d ${0##*/} || echo ${0##*/} is not a directory;
|
||||
echo a;
|
||||
echo b;
|
||||
echo c;
|
||||
echo background >/dev/null & ( exit 1 );
|
||||
echo background > /dev/null & ( exit 1 );
|
||||
echo $?;
|
||||
{
|
||||
echo a
|
||||
@@ -18,20 +18,20 @@ tf ()
|
||||
test -r /dev/fd/$i;
|
||||
i=$(( i + 1 ));
|
||||
done;
|
||||
[[ -r /dev/fd/0 && -w /dev/fd/1 ]] || echo oops >/dev/null;
|
||||
[[ -r /dev/fd/0 && -w /dev/fd/1 ]] || echo oops > /dev/null;
|
||||
for name in $( echo 1 2 3 );
|
||||
do
|
||||
test -r /dev/fd/$name;
|
||||
done;
|
||||
if [[ -r /dev/fd/0 && -w /dev/fd/1 ]]; then
|
||||
echo ok >/dev/null;
|
||||
echo ok > /dev/null;
|
||||
else
|
||||
if (( 7 > 40 )); then
|
||||
echo oops;
|
||||
else
|
||||
echo done;
|
||||
fi;
|
||||
fi >/dev/null;
|
||||
fi > /dev/null;
|
||||
case $PATH in
|
||||
*$PWD*)
|
||||
echo \$PWD in \$PATH
|
||||
@@ -39,13 +39,13 @@ tf ()
|
||||
*)
|
||||
echo \$PWD not in \$PATH
|
||||
;;
|
||||
esac >/dev/null;
|
||||
esac > /dev/null;
|
||||
while false; do
|
||||
echo z;
|
||||
done >/dev/null;
|
||||
done > /dev/null;
|
||||
until true; do
|
||||
echo z;
|
||||
done >/dev/null;
|
||||
done > /dev/null;
|
||||
echo \&\|'()' \{ echo abcde \; \};
|
||||
eval fu\%nc'()' \{ echo abcde \; \};
|
||||
type fu\%nc
|
||||
@@ -54,7 +54,7 @@ tf2 is a function
|
||||
tf2 ()
|
||||
{
|
||||
( {
|
||||
time -p echo a | cat - >/dev/null
|
||||
time -p echo a | cat - > /dev/null
|
||||
} ) 2>&1
|
||||
}
|
||||
cprint.tests is a regular file
|
||||
|
||||
@@ -19,7 +19,7 @@ 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]
|
||||
caller: usage: caller [expr]
|
||||
debug lineno: 25 fn1
|
||||
debug lineno: 17 fn1
|
||||
debug lineno: 12 print_return_trap
|
||||
@@ -48,7 +48,7 @@ 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]
|
||||
caller: usage: caller [expr]
|
||||
debug lineno: 25 fn1
|
||||
debug lineno: 17 fn1
|
||||
debug lineno: 12 print_return_trap
|
||||
@@ -190,7 +190,7 @@ FUNCNAME[0] fn1
|
||||
79 main ./dbg-support.tests
|
||||
|
||||
./dbg-support.tests: line 25: caller: foo: invalid number
|
||||
caller: usage: caller [EXPR]
|
||||
caller: usage: caller [expr]
|
||||
|
||||
debug lineno: 80 main
|
||||
fn2 here. Calling fn1...
|
||||
@@ -202,7 +202,7 @@ FUNCNAME[0] fn1
|
||||
30 fn2 ./dbg-support.tests
|
||||
80 main ./dbg-support.tests
|
||||
./dbg-support.tests: line 25: caller: foo: invalid number
|
||||
caller: usage: caller [EXPR]
|
||||
caller: usage: caller [expr]
|
||||
|
||||
debug lineno: 81 main
|
||||
LINENO 34
|
||||
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
./dstack.tests: line 9: pushd: no other directory
|
||||
./dstack.tests: line 10: popd: directory stack empty
|
||||
./dstack.tests: line 13: pushd: -m: invalid number
|
||||
pushd: usage: pushd [dir | +N | -N] [-n]
|
||||
pushd: usage: pushd [-n] [+N | -N | dir]
|
||||
./dstack.tests: line 14: popd: -m: invalid number
|
||||
popd: usage: popd [+N | -N] [-n]
|
||||
popd: usage: popd [-n] [+N | -N]
|
||||
./dstack.tests: line 15: dirs: -m: invalid number
|
||||
dirs: usage: dirs [-clpv] [+N] [-N]
|
||||
./dstack.tests: line 16: dirs: 7: invalid option
|
||||
|
||||
+2
-2
@@ -68,7 +68,7 @@ source: usage: source filename [arguments]
|
||||
./errors.tests: line 184: .: -i: invalid option
|
||||
.: usage: . filename [arguments]
|
||||
./errors.tests: line 187: set: -q: invalid option
|
||||
set: usage: set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
|
||||
set: usage: set [--abefhkmnptuvxBCHP] [-o option-name] [arg ...]
|
||||
./errors.tests: line 190: enable: sh: not a shell builtin
|
||||
./errors.tests: line 190: enable: bash: not a shell builtin
|
||||
./errors.tests: line 193: shopt: cannot set and unset shell options simultaneously
|
||||
@@ -85,7 +85,7 @@ command: usage: command [-pVv] command [arg ...]
|
||||
./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 [-lp] [arg signal_spec ...]
|
||||
trap: usage: trap [-lp] [[arg] signal_spec ...]
|
||||
./errors.tests: line 225: return: can only `return' from a function or sourced script
|
||||
./errors.tests: line 229: break: 0: loop count out of range
|
||||
./errors.tests: line 233: continue: 0: loop count out of range
|
||||
|
||||
+2
-1
@@ -27,7 +27,7 @@ f1 ()
|
||||
return $status
|
||||
}
|
||||
before: try to assign to FUNCNAME
|
||||
outside: FUNCNAME =
|
||||
outside: FUNCNAME = main
|
||||
before: FUNCNAME = func
|
||||
FUNCNAME = func2
|
||||
after: FUNCNAME = func
|
||||
@@ -148,3 +148,4 @@ expect 2 40
|
||||
2 40
|
||||
expect 5 20
|
||||
5 20
|
||||
5
|
||||
|
||||
+9
-1
@@ -132,7 +132,7 @@ func()
|
||||
}
|
||||
|
||||
echo before: try to assign to FUNCNAME
|
||||
FUCNAME=7
|
||||
FUNCNAME=7
|
||||
|
||||
echo outside: FUNCNAME = $FUNCNAME
|
||||
func
|
||||
@@ -165,4 +165,12 @@ myfunction() {
|
||||
myfunction
|
||||
myfunction | cat
|
||||
|
||||
segv()
|
||||
{
|
||||
echo foo | return 5
|
||||
}
|
||||
|
||||
segv
|
||||
echo $?
|
||||
|
||||
exit 0
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ jkl mno
|
||||
fff is a function
|
||||
fff ()
|
||||
{
|
||||
ed /tmp/foo >/dev/null <<ENDOFINPUT
|
||||
ed /tmp/foo > /dev/null <<ENDOFINPUT
|
||||
/^name/d
|
||||
w
|
||||
q
|
||||
@@ -31,7 +31,7 @@ ENDOFINPUT
|
||||
fff is a function
|
||||
fff ()
|
||||
{
|
||||
ed /tmp/foo >/dev/null <<ENDOFINPUT
|
||||
ed /tmp/foo > /dev/null <<ENDOFINPUT
|
||||
/^name/d
|
||||
w
|
||||
q
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
./history.tests: line 4: history: -x: invalid option
|
||||
history: usage: history [-c] [-d offset] [n] or history -awrn [filename] or history -ps arg [arg...]
|
||||
history: usage: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]
|
||||
./history.tests: line 6: history: cannot use more than one of -anrw
|
||||
./history.tests: line 9: fc: -v: invalid option
|
||||
fc: usage: fc [-e ename] [-nlr] [first] [last] or fc -s [pat=rep] [cmd]
|
||||
fc: usage: fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command]
|
||||
1 for i in one two three; do echo $i; done
|
||||
2 /bin/sh -c 'echo this is $0'
|
||||
3 ls
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
export LANG=en_US.UTF-8
|
||||
export LC_ALL=en_US.UTF-8
|
||||
|
||||
a=$'\303\251'
|
||||
|
||||
|
||||
+18
-2
@@ -430,7 +430,7 @@ 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
|
||||
./new-exp.tests: line 506: ${$(($#-1))}: bad substitution
|
||||
argv[1] = <a>
|
||||
argv[2] = <b>
|
||||
argv[3] = <c>
|
||||
@@ -502,4 +502,20 @@ h
|
||||
--blah
|
||||
lah
|
||||
lah
|
||||
./new-exp.tests: line 558: ABXD: parameter unset
|
||||
argv[1] = <>
|
||||
argv[1] = <+>
|
||||
argv[1] = <+^?>
|
||||
argv[1] = <+>
|
||||
argv[1] = <^?2>
|
||||
argv[1] = <^?2>
|
||||
argv[1] = <^?>
|
||||
argv[1] = <^?>
|
||||
argv[1] = <>
|
||||
argv[1] = <>
|
||||
argv[1] = <>
|
||||
argv[1] = <>
|
||||
argv[1] = <12>
|
||||
argv[1] = <>
|
||||
argv[1] = <>
|
||||
argv[1] = </tmp/test/TEST>
|
||||
./new-exp.tests: line 560: ABXD: parameter unset
|
||||
|
||||
@@ -553,6 +553,8 @@ echo ${var/#/--}
|
||||
echo ${var[@]##?}
|
||||
echo ${var##?}
|
||||
|
||||
${THIS_SH} ./new-exp6.sub
|
||||
|
||||
# this must be last!
|
||||
expect $0: 'ABXD: parameter unset'
|
||||
recho ${ABXD:?"parameter unset"}
|
||||
|
||||
Binary file not shown.
+55
-1
@@ -67,7 +67,7 @@ printf -- "--%b--\n" '\t\0101'
|
||||
printf -- "--%b--\n" '\t\101'
|
||||
|
||||
# these should all display `A7'
|
||||
echo -e "\1017"
|
||||
echo -e "\01017"
|
||||
echo -e "\x417"
|
||||
|
||||
printf "%b\n" '\01017'
|
||||
@@ -246,3 +246,57 @@ printf '\x07e\n'
|
||||
|
||||
# additional backslash escapes
|
||||
printf '\"\?\n'
|
||||
|
||||
# failures with decimal precisions until after bash-3.1
|
||||
printf '%0.5d\n' 1
|
||||
|
||||
printf '%05d\n' 1
|
||||
printf '%5d\n' 1
|
||||
printf '%0d\n' 1
|
||||
|
||||
# failures with various floating point formats and 0 after bash-3.2
|
||||
|
||||
printf "%G\n" 0
|
||||
printf "%g\n" 0
|
||||
printf "%4.2G\n" 0
|
||||
printf "%4.2g\n" 0
|
||||
|
||||
printf "%G\n" 4
|
||||
printf "%g\n" 4
|
||||
printf "%4.2G\n" 4
|
||||
printf "%4.2g\n" 4
|
||||
|
||||
printf "%F\n" 0
|
||||
printf "%f\n" 0
|
||||
printf "%4.2F\n" 0
|
||||
printf "%4.2f\n" 0
|
||||
|
||||
printf "%F\n" 4
|
||||
printf "%f\n" 4
|
||||
printf "%4.2F\n" 4
|
||||
printf "%4.2f\n" 4
|
||||
|
||||
printf "%E\n" 0
|
||||
printf "%e\n" 0
|
||||
printf "%4.2E\n" 0
|
||||
printf "%4.2e\n" 0
|
||||
|
||||
printf "%E\n" 4
|
||||
printf "%e\n" 4
|
||||
printf "%4.2E\n" 4
|
||||
printf "%4.2e\n" 4
|
||||
|
||||
printf "%08X\n" 2604292517
|
||||
|
||||
# make sure these format specifiers all output '' for empty string arguments
|
||||
echo q
|
||||
printf "%q\n" ""
|
||||
printf "%q\n"
|
||||
|
||||
echo s
|
||||
printf "%s\n" ''
|
||||
printf "%s\n"
|
||||
|
||||
echo b
|
||||
printf "%b\n" ''
|
||||
printf "%b\n"
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ read line
|
||||
echo $line
|
||||
f ()
|
||||
{
|
||||
exec 5<$0;
|
||||
exec 5< $0;
|
||||
exec 0<&5-;
|
||||
while read line; do
|
||||
echo "$line";
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
./rsh.tests: line 21: /tmp/restricted: restricted: cannot redirect output
|
||||
./rsh.tests: line 26: command: -p: restricted
|
||||
./rsh.tests: line 28: set: +r: invalid option
|
||||
set: usage: set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
|
||||
set: usage: set [--abefhkmnptuvxBCHP] [-o option-name] [arg ...]
|
||||
./rsh.tests: line 29: set: restricted: invalid option name
|
||||
./rsh.tests: line 31: exec: restricted
|
||||
./rsh.tests: after exec
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
echo "warning: some of these tests may fail if process substitution has not" >&2
|
||||
echo "warning: been compiled into the shell" >&2
|
||||
|
||||
${THIS_SH} ./builtins.tests > /tmp/xx 2>&1
|
||||
diff /tmp/xx builtins.right && rm -f /tmp/xx
|
||||
|
||||
+6
-1
@@ -1,9 +1,11 @@
|
||||
./shopt.tests: line 2: shopt: -z: invalid option
|
||||
shopt: usage: shopt [-pqsu] [-o long-option] optname [optname...]
|
||||
shopt: usage: shopt [-pqsu] [-o] [optname ...]
|
||||
--
|
||||
shopt -s autocd
|
||||
shopt -u cdable_vars
|
||||
shopt -s cdspell
|
||||
shopt -u checkhash
|
||||
shopt -u checkjobs
|
||||
shopt -u checkwinsize
|
||||
shopt -s cmdhist
|
||||
shopt -u dotglob
|
||||
@@ -39,6 +41,7 @@ shopt -u huponexit
|
||||
shopt -u checkwinsize
|
||||
shopt -s sourcepath
|
||||
--
|
||||
shopt -s autocd
|
||||
shopt -s cdspell
|
||||
shopt -s cmdhist
|
||||
shopt -s expand_aliases
|
||||
@@ -52,6 +55,7 @@ shopt -s sourcepath
|
||||
--
|
||||
shopt -u cdable_vars
|
||||
shopt -u checkhash
|
||||
shopt -u checkjobs
|
||||
shopt -u checkwinsize
|
||||
shopt -u dotglob
|
||||
shopt -u execfail
|
||||
@@ -76,6 +80,7 @@ shopt -u xpg_echo
|
||||
--
|
||||
cdable_vars off
|
||||
checkhash off
|
||||
checkjobs off
|
||||
checkwinsize off
|
||||
dotglob off
|
||||
execfail off
|
||||
|
||||
Reference in New Issue
Block a user