Bash: Export array doesn't work

From FVue
Jump to: navigation, search

Problem

Bash doesn't allow you to export array variables:

$ declare -ax var1=( foo )
$ declare -x var2=bar
$ bash -c set | grep var  # var1 is missing in `set' subshell
var2=bar
$

Cause

Exporting array variables is not (yet) supported by bash. From info bash:

"BUGS
...
Array variables may not (yet) be exported.
...
"

Journal

20071210

[1] How to export array in bash - comp.unix.shell
Same question asked in newsgroups. With possible workaround...

Comments

blog comments powered by Disqus