Imported from ../bash-3.1.tar.gz.
[platform/upstream/bash.git] / tests / varenv.sh
index 8f5a716..77776f9 100644 (file)
@@ -125,11 +125,11 @@ export A
 # 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
 }
@@ -184,3 +184,23 @@ echo ${SHELLOPTS}
 
 # 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