commit bash-20111028 snapshot

This commit is contained in:
Chet Ramey
2012-01-09 08:31:05 -05:00
parent 3d4f66ca82
commit 77638cbf4e
36 changed files with 6981 additions and 3273 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
BUILD_DIR=/usr/local/build/chet/bash/bash-current
BUILD_DIR=/usr/local/build/bash/bash-current
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR
+12
View File
@@ -72,3 +72,15 @@ fx ()
2
20
20
12345678 987654321 012345678 987654321 012345678 987654321 012345678 987654321 012345678 987654321 012345678
12345678 987654321 012345678 987654321 012345678 987654321 012345678 987654321 012345678 987654321 012345678
4
3
2
1
0
4
3
2
1
0
+19
View File
@@ -92,3 +92,22 @@ echo $i
for ((i=0; i < 20; i++)) { : ; }
echo $i
# added post-bash-4.2
for (( i = j = k = 1; i % 9 || (j *= -1, $( ((i%9)) || printf " " >&2; echo 0), k++ <= 10); i += j ))
do
printf "$i"
done
echo
( for (( i = j = k = 1; i % 9 || (j *= -1, $( ((i%9)) || printf " " >&2; echo 0), k++ <= 10); i += j ))
do
printf "$i"
done )
echo
for (( i = 4; ;i--)) ; do echo $i; if (( $i == 0 )); then break; fi; done
for (( i = 4;;i--)) ; do echo $i; if (( $i == 0 )); then break; fi; done
+94
View File
@@ -0,0 +1,94 @@
fx()
{
i=0
for (( ; i < 3; i++ ))
do
echo $i
done
for (( i=0; ; i++ ))
do
if (( i >= 3 )); then
break;
fi
echo $i
done
for (( i=0; i<3; ))
do
echo $i
(( i++ ))
done
i=0
for (( ; ; ))
do
if (( i > 2 )); then
break;
fi
echo $i;
(( i++ ))
done
i=0
for ((;;))
do
if (( i > 2 )); then
break;
fi
echo $i;
(( i++ ))
done
}
for (( i=0; "i < 3" ; i++ ))
do
echo $i
done
i=0
for (( ; "i < 3"; i++ ))
do
echo $i
done
for (( i=0; ; i++ ))
do
if (( i >= 3 )); then
break;
fi
echo $i
done
for ((i = 0; ;i++ ))
do
echo $i
if (( i < 3 )); then
(( i++ ))
continue;
fi
break
done
type fx
fx
# errors
for (( i=0; "i < 3" ))
do
echo $i
done
echo $?
for (( i=0; i < 3; i++; 7 ))
do
echo $i
done
echo $?
# one-liners added in post-bash-2.04
for ((i=0; i < 20; i++)) do : ; done
echo $i
for ((i=0; i < 20; i++)) { : ; }
echo $i
+20 -4
View File
@@ -205,14 +205,30 @@ ok
0
1
2147483649
0
0
0
0
0
0
-9223372036854775808
-9223372036854775808
-9223372036854775808
-9223372036854775808
-9223372036854775808
-9223372036854775808
-9223372036854775808
-9223372036854775808
-9223372036854775808
-9223372036854775808
8 12
./arith.tests: line 279: ((: x=9 y=41 : syntax error in expression (error token is "y=41 ")
./arith.tests: line 283: a b: syntax error in expression (error token is "b")
./arith.tests: line 284: ((: a b: syntax error in expression (error token is "b")
./arith.tests: line 283: ((: x=9 y=41 : syntax error in expression (error token is "y=41 ")
./arith.tests: line 287: a b: syntax error in expression (error token is "b")
./arith.tests: line 288: ((: a b: syntax error in expression (error token is "b")
42
42
42
42
42
42
./arith.tests: line 295: b[c]d: syntax error in expression (error token is "d")
./arith.tests: line 299: b[c]d: syntax error in expression (error token is "d")
+4
View File
@@ -268,6 +268,10 @@ ${THIS_SH} ./arith4.sub
# make sure arithmetic expansion handles ints > 2**31 - 1 using intmax_t
echo $(( 2147483645 + 4 ))
# other tests using INTMAX_MIN and INTMAX_MAX that cause exceptions if not
# handled correctly -- problem through bash-4.2
${THIS_SH} ./arith5.sub
x=4
y=7
+52
View File
@@ -0,0 +1,52 @@
intmax_max=$((2**63 - 1))
intmax_min1=$((2**63))
intmax_min2=$((-2**63))
case $intmax_max in
9223372036854775807) ;;
*) echo "warning: your machine does not support 64-bit arithmetic using intmax_t" 2>&1 ;;
esac
# these are actually the same
echo $(( $intmax_min1 % -1 ))
echo $(( $intmax_min2 % -1 ))
echo $(( $intmax_max % -1 ))
lvalue=$intmax_min1
(( lvalue%= -1 ))
echo $lvalue
lvalue=$intmax_min2
(( lvalue%= -1 ))
echo $lvalue
lvalue=$intmax_max
(( lvalue%= -1 ))
echo $lvalue
# and these
echo $(( $intmax_min1 / -1 ))
echo $(( $intmax_min2 / -1 ))
lvalue=$intmax_min1
(( lvalue /= -1 ))
echo $lvalue
lvalue=$intmax_min2
(( lvalue /= -1 ))
echo $lvalue
echo $(( $intmax_min1 * -1 ))
echo $(( $intmax_min2 * -1 ))
lvalue=$intmax_min1
(( lvalue *= -1 ))
echo $lvalue
lvalue=$intmax_min2
(( lvalue *= -1 ))
echo $lvalue
echo $(( -${intmax_min1} ))
echo $(( -${intmax_min2} ))
+4
View File
@@ -81,6 +81,10 @@ argv[1] = <bc>
argv[1] = <c>
argv[1] = <ab>
argv[1] = <ab>
argv[1] = <aacc>
argv[1] = <aacc>
argv[1] = <aabbcc>
argv[1] = <aabbcc>
argv[1] = <Oenophile>
argv[1] = <OEnOphIlE>
argv[1] = <>
+13
View File
@@ -14,6 +14,19 @@ recho ${f/""a""b/}
recho ${f/""c/}
recho ${f/"$v"c/}
unset foo empty
foo=aabbcc
recho ${foo/bb/}
recho ${foo/bb/$empty}
recho ${foo/}
recho ${empty/}
recho ${foo/ }
recho ${empty/ }
unset foo empty
S2=oenophile
recho ${S2^"$v"[aeiou]}