After fiddling for hours with a script born of a Frankenstein marriage between AppleScript and bash, I found out what I am trying to do impossible. >:-o
Arrays cannot be exported in the bash shell. Let me say that again for posterity. You cannot export an array in bash, ever! This fact is a real pain in the ass. I think I understand why; The environment is actually an array of variables and bash only supports one-dimensional arrays. Therefore, you can't move an array into an array.
I scoured the web and found nothing about this at all. I read two bash books and did not find any indication of this. It seems to me something that others would have tried, gotten frustrated, and informed others but I guess I missed that memo. :-[ Anyway, here is proof so you don't have to go through the pain that I did:
Export and echo a regular variable:
$ foo=myvalue ¬
$ export foo ¬
$ bash ¬
$ echo $foo ¬
myvalue
$ unset foo ¬
Echo an array:
$ foo=("zero" "one" "two") ¬
$ echo ${foo[@]} ¬
zero one two
$ unset foo ¬
Export an array:
$ foo=("zero" "one" "two") ¬
$ export foo ¬
$ bash ¬
$ echo ${foo[@]} ¬
$ unset foo ¬
Oh well.