mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-05 01:32:28 +02:00
commit bash-20150529 snapshot
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
|
||||
@@ -133,3 +133,37 @@ idx2
|
||||
idX2
|
||||
idx2
|
||||
idX2
|
||||
declare -n foo="x[\$zero]"
|
||||
42
|
||||
declare -a x=([0]="4")
|
||||
declare -n foo="x[\$(echo 0)]"
|
||||
4
|
||||
comsub
|
||||
x[i=0]
|
||||
comsub
|
||||
4
|
||||
comsub
|
||||
4
|
||||
comsub
|
||||
4
|
||||
declare -n foo="somevariable"
|
||||
./nameref10.sub: line 38: typeset: somevariable: not found
|
||||
foo =
|
||||
declare -n foo="somevariable"
|
||||
declare -A somevariable=([jug]="brown" )
|
||||
./nameref10.sub: line 45: warning: foo=([jug]="brown" ): quoted compound array assignment deprecated
|
||||
declare -n foo="somevariable"
|
||||
declare -A somevariable=([jug]="brown" )
|
||||
declare -n foo="somevariable"
|
||||
./nameref10.sub: line 49: typeset: somevariable: not found
|
||||
./nameref10.sub: line 51: typeset: foo: not found
|
||||
./nameref10.sub: line 51: typeset: somevariable: not found
|
||||
declare -n foo="bar"
|
||||
./nameref10.sub: line 55: typeset: bar: not found
|
||||
declare -n foo="bar"
|
||||
./nameref10.sub: line 57: typeset: bar: not found
|
||||
declare -n foo="bar"
|
||||
declare -i bar="8"
|
||||
8
|
||||
declare -n foo="bar"
|
||||
./nameref10.sub: line 64: typeset: bar: not found
|
||||
|
||||
@@ -124,3 +124,4 @@ ${THIS_SH} ./nameref6.sub
|
||||
${THIS_SH} ./nameref7.sub
|
||||
${THIS_SH} ./nameref8.sub
|
||||
${THIS_SH} ./nameref9.sub
|
||||
${THIS_SH} ./nameref10.sub
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
# testing behavior of command substitution as one of expansions performed by
|
||||
# array subscripting; should behave the same directly as when done through
|
||||
# a nameref
|
||||
|
||||
x[0]=42
|
||||
zero=0
|
||||
f() { typeset -n foo="$1"; declare -p foo; echo "$foo"; }
|
||||
|
||||
f 'x[$zero]'
|
||||
|
||||
x[$(echo 0)]=4
|
||||
declare -p x
|
||||
|
||||
f 'x[$(echo 0)]'
|
||||
|
||||
unset -f f
|
||||
f()
|
||||
{
|
||||
typeset -n foo="$1";
|
||||
|
||||
echo "x[i=0$(echo comsub >&2)]"
|
||||
echo "${x[i=0$(echo comsub >&2)]}"
|
||||
echo "${!1}"
|
||||
echo "$foo"
|
||||
}
|
||||
|
||||
f 'x[i=0$(echo comsub >&2)]'
|
||||
|
||||
unset -f f
|
||||
unset x
|
||||
|
||||
# problems with unset and namerefs pointing to non-existent variables pointed
|
||||
# out after bash-4.3 released
|
||||
|
||||
typeset -n foo=somevariable
|
||||
foo=bar
|
||||
unset foo # unsets somevariable
|
||||
typeset -p foo somevariable
|
||||
echo foo = $foo
|
||||
|
||||
typeset -A foo # should create array variable named somevariable
|
||||
foo["jug"]="brown"
|
||||
|
||||
typeset -p foo somevariable
|
||||
typeset -A foo='([jug]="brown" )'
|
||||
typeset -p foo somevariable
|
||||
|
||||
unset foo
|
||||
typeset -p foo somevariable
|
||||
unset -n foo
|
||||
typeset -p foo somevariable
|
||||
|
||||
unset bar
|
||||
typeset -n foo=bar
|
||||
typeset -p foo bar
|
||||
unset foo
|
||||
typeset -p foo bar
|
||||
typeset -i foo
|
||||
foo=4+4
|
||||
typeset -p foo bar
|
||||
echo "$foo"
|
||||
|
||||
unset foo
|
||||
typeset -p foo bar
|
||||
+13
-4
@@ -66,7 +66,9 @@ ckval bar hello
|
||||
|
||||
# XXX -- another self-referencing error?
|
||||
# ksh93 makes this another invalid self-reference
|
||||
unset foo bar
|
||||
unset foo
|
||||
unset -n bar
|
||||
|
||||
bar=123
|
||||
foobar()
|
||||
{
|
||||
@@ -80,14 +82,16 @@ typeset -n short=long
|
||||
short=( a b )
|
||||
echo "expect <a b>"
|
||||
echo ${long[@]}
|
||||
unset short long
|
||||
unset long
|
||||
unset -n short
|
||||
|
||||
# assignment to a previously-unset variable
|
||||
typeset -n short=long
|
||||
short=foo
|
||||
echo "expect <foo>"
|
||||
echo ${long}
|
||||
unset short long
|
||||
unset long
|
||||
unset -n short
|
||||
|
||||
unset foo bar
|
||||
|
||||
@@ -110,7 +114,8 @@ barfunc()
|
||||
barfunc bar
|
||||
|
||||
unset -f foobar
|
||||
unset foo bar
|
||||
unset bar
|
||||
unset -n foo
|
||||
|
||||
# should ref at global scope survive call to foobar()?
|
||||
unset ref x
|
||||
@@ -151,6 +156,8 @@ echo "expect <zero> <one> <seven> <three> <four>"
|
||||
recho "${x[@]}"
|
||||
|
||||
unset ref x
|
||||
unset -n ref
|
||||
|
||||
typeset -n ref
|
||||
ref=x
|
||||
# make sure nameref to a previously-unset variable creates the variable
|
||||
@@ -159,6 +166,8 @@ ckval x 42
|
||||
|
||||
# make sure they work inside arithmetic expressions
|
||||
unset foo bar ref x xxx
|
||||
unset -n ref
|
||||
|
||||
typeset -i ivar
|
||||
typeset -n iref=ivar
|
||||
|
||||
|
||||
Reference in New Issue
Block a user