# Make sure expansion doesn't use assignment statements preceding a builtin
A=ZVAR echo $A
-PATH=/bin:/usr/bin:/usr/local/bin:.
+XPATH=/bin:/usr/bin:/usr/local/bin:.
func2()
{
local z=yy
- local -a avar=( ${PATH//: } )
+ local -a avar=( ${XPATH//: } )
echo ${avar[@]}
local
}
# and make sure it is readonly
readonly -p | grep SHELLOPTS
+
+# This was an error in bash versions prior to bash-2.04. The `set -a'
+# should cause the assignment statement that's an argument to typeset
+# to create an exported variable
+unset FOOFOO
+FOOFOO=bar
+set -a
+typeset FOOFOO=abcde
+
+printenv FOOFOO
+
+# test out export behavior of variable assignments preceding builtins and
+# functions
+$THIS_SH ./varenv1.sub
+
+# more tests; bugs in bash up to version 2.05a
+$THIS_SH ./varenv2.sub
+
+# make sure variable scoping is done right
+tt() { typeset a=b;echo a=$a; };a=z;echo a=$a;tt;echo a=$a