|
|
Question : Exporting arrays in Bash
|
|
Cannot export arrays to a subshell. Expot -a array and declare -x do not actuallly export an array in Bash. The array works fine in the shell it is created, but is blank in all subshells. If I input set, the array shows up as a global variable, but if I type bash to enter a subshell then the set command no longer shows the array. Any trick I can use to get around Bash's unwillingness to export arrays.
|
Answer : Exporting arrays in Bash
|
|
OK, that explains the why.
The short answer is that bash and ksh don't support exporting of arrays. It's something that may be added to bash at a later date. I'm not really sure what the technical reason for ksh/bash not being able to support exporting arrays.
The workarounds are to source the called script or to use some other construct to parse the data.
|
|
|
|