mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-03 02:10:50 +02:00
commit bash-20141031 snapshot
This commit is contained in:
@@ -411,3 +411,24 @@ one
|
||||
two
|
||||
two
|
||||
./array17.sub: line 76: ~ : syntax error: operand expected (error token is "~ ")
|
||||
1
|
||||
argv[1] = <>
|
||||
argv[2] = <>
|
||||
argv[3] = <>
|
||||
argv[1] = <bar>
|
||||
argv[1] = <-->
|
||||
argv[1] = <>
|
||||
argv[1] = <qux>
|
||||
argv[1] = <->
|
||||
argv[2] = <->
|
||||
argv[1] = < >
|
||||
argv[1] = <>
|
||||
argv[2] = <>
|
||||
argv[3] = <>
|
||||
argv[1] = <bar>
|
||||
argv[1] = <-->
|
||||
argv[1] = <>
|
||||
argv[1] = <qux>
|
||||
argv[1] = <->
|
||||
argv[2] = <->
|
||||
argv[1] = < >
|
||||
|
||||
@@ -402,3 +402,5 @@ ${THIS_SH} ./array15.sub
|
||||
${THIS_SH} ./array16.sub
|
||||
|
||||
${THIS_SH} ./array17.sub
|
||||
|
||||
${THIS_SH} ./array18.sub
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# arrays referenced using @ subscript and positional parameters should behave
|
||||
# the same way
|
||||
|
||||
foo=(0 0 0); [[ -z ${foo[@]#0} ]]; echo $?
|
||||
|
||||
recho "${foo[@]#0}"
|
||||
bar=${foo[@]#0}
|
||||
recho bar
|
||||
recho $bar
|
||||
recho -$bar-
|
||||
recho "$bar"
|
||||
|
||||
qux="${foo[@]#0}"
|
||||
recho qux
|
||||
recho $qux
|
||||
recho -$qux-
|
||||
recho "$qux"
|
||||
|
||||
unset foo qux bar
|
||||
|
||||
set -- 0 0 0
|
||||
|
||||
recho "${@#0}"
|
||||
bar=${@#0}
|
||||
recho bar
|
||||
recho $bar
|
||||
recho -$bar-
|
||||
recho "$bar"
|
||||
|
||||
qux="${@#0}"
|
||||
recho qux
|
||||
recho $qux
|
||||
recho -$qux-
|
||||
recho "$qux"
|
||||
@@ -216,6 +216,7 @@ ${THIS_SH} ./dollar-at-star1.sub
|
||||
${THIS_SH} ./dollar-at-star2.sub
|
||||
${THIS_SH} ./dollar-at-star3.sub
|
||||
${THIS_SH} ./dollar-at-star4.sub
|
||||
${THIS_SH} ./dollar-at-star5.sub
|
||||
|
||||
# tests for special expansion of "$*" and "${array[*]}" when used with other
|
||||
# expansions -- bugs through bash-2.05b
|
||||
|
||||
@@ -3,9 +3,35 @@ unset f ; f=abcd
|
||||
first_char=${f[@]:0:1}
|
||||
recho $first_char
|
||||
|
||||
first_char=${f[0]:0:1}
|
||||
recho $first_char
|
||||
|
||||
first_char=${f:0:1}
|
||||
recho $first_char
|
||||
|
||||
first_char="${f[@]:0:1}"
|
||||
recho $first_char
|
||||
|
||||
first_char="${f[@]:0:1}"
|
||||
recho $first_char
|
||||
|
||||
first_char="${f[0]:0:1}"
|
||||
recho $first_char
|
||||
|
||||
first_char="${f:0:1}"
|
||||
recho $first_char
|
||||
|
||||
unset f;
|
||||
f=( one two three )
|
||||
first_word=${f[@]:0:1}
|
||||
recho $first_word
|
||||
|
||||
first_word=${f[0]:0:1}
|
||||
recho $first_word
|
||||
|
||||
first_word=${f:0:1}
|
||||
recho $first_word
|
||||
|
||||
unset f;
|
||||
f=( one two three )
|
||||
first_word=${f[@]:0:1}
|
||||
@@ -15,3 +41,4 @@ set -- abc def ghi
|
||||
|
||||
printf '<%s> ' "123 $@ 456"; echo
|
||||
printf '<%s> ' "123 $@\ 456"; echo
|
||||
|
||||
|
||||
@@ -81,4 +81,17 @@ recho ${foo=$@}
|
||||
recho "$foo"
|
||||
|
||||
shift $#
|
||||
unset foo
|
||||
unset foo x
|
||||
|
||||
set -- a b
|
||||
x=abc
|
||||
|
||||
IFS=
|
||||
printf "<%s>\n" ${x#$*}
|
||||
printf "<%s>\n" "${x#$*}"
|
||||
|
||||
x=abcd
|
||||
set a c
|
||||
IFS='?'
|
||||
printf "<%s>\n" ${x#$*}
|
||||
printf "<%s>\n" "${x#$*}"
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
# testing various combinations of quoted and unquoted expansions of $@, and
|
||||
# whether they generate empty words after expansion
|
||||
|
||||
n() { echo "$#"; }
|
||||
|
||||
n "$@"
|
||||
n ${foo-"$@"}
|
||||
n "${foo-$@}"
|
||||
|
||||
n ""$@
|
||||
n """$@"
|
||||
|
||||
n $(true)$@
|
||||
n "$(true)$@"
|
||||
n "$(true)$@"
|
||||
n "$(true)""$@"
|
||||
|
||||
n $xxx$@
|
||||
n "$xxx$@"
|
||||
n $xxx"$@"
|
||||
n "$xxx""$@"
|
||||
|
||||
recho $xxx"$@"
|
||||
echo after 1
|
||||
|
||||
recho "$xxx$@"
|
||||
echo after 2
|
||||
|
||||
recho ${foo:-$xxx"$@"}
|
||||
echo after 3
|
||||
|
||||
# this is where these things start to differ
|
||||
echo same as 1
|
||||
recho "${foo:-$xxx"$@"}"
|
||||
echo same as 2
|
||||
recho "${foo:-$xxx$@}"
|
||||
|
||||
echo null fields
|
||||
recho ""$@
|
||||
recho """$@"
|
||||
|
||||
echo null fields in rhs
|
||||
echo null string with unquoted '$@'
|
||||
recho ${foo:-""$@}
|
||||
echo null string with quoted '$@'
|
||||
recho ${foo:-"""$@"}
|
||||
|
||||
echo assignment
|
||||
recho "${foo=$@}"
|
||||
echo variable
|
||||
recho "$foo"
|
||||
echo dollar-at
|
||||
recho "${@}"
|
||||
@@ -158,6 +158,14 @@ ok at 8
|
||||
ok at 9
|
||||
argv[1] = <a>
|
||||
argv[1] = <a>
|
||||
argv[1] = <a>
|
||||
argv[1] = <a>
|
||||
argv[1] = <a>
|
||||
argv[1] = <a>
|
||||
argv[1] = <a>
|
||||
argv[1] = <one>
|
||||
argv[1] = <o>
|
||||
argv[1] = <o>
|
||||
argv[1] = <one>
|
||||
<123 abc> <def> <ghi 456>
|
||||
<123 abc> <def> <ghi\ 456>
|
||||
@@ -185,6 +193,42 @@ argv[1] = <abcd>
|
||||
argv[1] = <a>
|
||||
argv[2] = <b>
|
||||
argv[1] = <a b>
|
||||
<c>
|
||||
<c>
|
||||
<d>
|
||||
<d>
|
||||
0
|
||||
0
|
||||
1
|
||||
1
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
after 1
|
||||
after 2
|
||||
after 3
|
||||
same as 1
|
||||
argv[1] = <>
|
||||
same as 2
|
||||
argv[1] = <>
|
||||
null fields
|
||||
argv[1] = <>
|
||||
argv[1] = <>
|
||||
null fields in rhs
|
||||
null string with unquoted $@
|
||||
argv[1] = <>
|
||||
null string with quoted $@
|
||||
assignment
|
||||
argv[1] = <>
|
||||
variable
|
||||
argv[1] = <>
|
||||
dollar-at
|
||||
xa|xb|xc
|
||||
xa|xb|xc
|
||||
a|b|c
|
||||
|
||||
Reference in New Issue
Block a user