#! ./testshell

# See whether setting with and without export while -a isn't active isn't
# clobbered by later -a activation
export var1
var1=1
var2=2

# Try whether creation of a new variable under -a causes export
unset var
set -a
var3=3
set +a

# Try whether a reassignment of an existing variable under -a causes export
var4=wrong
set -a
var4=4
set +a

# See whether normal rules still apply while -a has been activated and
# deactiveted  
export var5
var5=5
var6=6


echo 'Must be exported    : var1, var3, var4, var5'
echo 'Must not be exported: var2, var6'
sh -c 'echo var1: $var1; echo var2: $var2; echo var3: $var3; echo var4: $var4'
sh -c 'echo var5: $var5; echo var6: $var6;'

