mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-12 22:50:49 +02:00
commit bash-20070208 snapshot
This commit is contained in:
@@ -714,10 +714,12 @@ tests/source2.sub f
|
||||
tests/source3.sub f
|
||||
tests/source4.sub f
|
||||
tests/source5.sub f
|
||||
tests/source6.sub f
|
||||
tests/comsub.tests f
|
||||
tests/comsub.right f
|
||||
tests/cond.tests f
|
||||
tests/cond.right f
|
||||
tests/cond-regexp.sub f
|
||||
tests/cprint.tests f
|
||||
tests/cprint.right f
|
||||
tests/dbg-support.right f
|
||||
|
||||
+3
-1
@@ -43,7 +43,7 @@ following backslash-escaped characters is turned on:
|
||||
\a alert (bell)
|
||||
\b backspace
|
||||
\c suppress trailing newline
|
||||
\E escape character
|
||||
\e escape character
|
||||
\f form feed
|
||||
\n new line
|
||||
\r carriage return
|
||||
@@ -52,6 +52,8 @@ following backslash-escaped characters is turned on:
|
||||
\\ backslash
|
||||
\0nnn the character whose ASCII code is NNN (octal). NNN can be
|
||||
0 to 3 octal digits
|
||||
\xHH the eight-bit character whose value is HH (hexadecimal). HH
|
||||
can be one or two hex digits
|
||||
|
||||
You can explicitly turn off the interpretation of the above characters
|
||||
with the -E option.
|
||||
|
||||
+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.
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
VAR='[[:alpha:]]'
|
||||
|
||||
[[ $VAR =~ '[[:alpha:]]' ]] && echo match 1
|
||||
|
||||
[[ a =~ '[[:alpha:]]' ]] || echo match 2
|
||||
|
||||
[[ a =~ [[:alpha:]] ]] && echo match 3
|
||||
|
||||
[[ a =~ $VAR ]] && echo match 4
|
||||
|
||||
[[ a =~ "$VAR" ]] || echo match 5
|
||||
|
||||
line=aab
|
||||
[[ $line =~ [[:space:]]*(a)?b ]] && echo match 6
|
||||
|
||||
V="alphabet"
|
||||
[[ $V == alphabet ]] && echo yes 1
|
||||
[[ $V == "alphabet" ]] && echo yes 2
|
||||
[[ $V == 'alphabet' ]] && echo yes 3
|
||||
[[ $V =~ alphabet ]] && echo yes 4
|
||||
[[ $V =~ "alphabet" ]] && echo yes 5
|
||||
[[ $V =~ 'alphabet' ]] && echo yes 6
|
||||
|
||||
DOG="Dog name - 01 - Wiggles"
|
||||
REPAT='([[:alpha:][:blank:]]*)- ([[:digit:]]*) - (.*)$'
|
||||
if [[ $DOG =~ ([[:alpha:][:blank:]]*)-\ ([[:digit:]]*)\ -\ (.*)$ ]]
|
||||
then
|
||||
echo Dog ${BASH_REMATCH[2]} is ${BASH_REMATCH[3]}
|
||||
fi
|
||||
if [[ $DOG =~ $REPAT ]]
|
||||
then
|
||||
echo Dog ${BASH_REMATCH[2]} is ${BASH_REMATCH[3]}
|
||||
fi
|
||||
|
||||
[[ $REPAT =~ "$REPAT" ]] && echo rematch 1
|
||||
|
||||
@@ -40,3 +40,18 @@ 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
|
||||
|
||||
@@ -175,3 +175,5 @@ 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# tests sourcing non-regular files, fixed post-3.2
|
||||
|
||||
: ${TMPDIR:=/tmp}
|
||||
|
||||
rm -f $TMPDIR/foo
|
||||
echo "echo one - OK" > $TMPDIR/foo
|
||||
. $TMPDIR/foo
|
||||
echo $?
|
||||
rm -f $TMPDIR/foo
|
||||
|
||||
# non-regular readable file
|
||||
. /dev/null
|
||||
echo $?
|
||||
|
||||
# FIFO or pipe via /dev/fd
|
||||
. <(echo "echo two - OK")
|
||||
echo $?
|
||||
|
||||
# pipe
|
||||
echo "echo three - OK" | . /dev/stdin
|
||||
echo $?
|
||||
|
||||
# FIFO
|
||||
mkfifo $TMPDIR/fifo-$$
|
||||
echo "echo four - OK" > $TMPDIR/fifo-$$ &
|
||||
sleep 1 # allow the child echo to execute
|
||||
. $TMPDIR/fifo-$$
|
||||
echo $?
|
||||
rm -f $TMPDIR/fifo-$$
|
||||
Reference in New Issue
Block a user