I set the a array as an environment variable in this manner eg. script test.sh
in test.sh
#!/bin/bash export STRING=( "str1" "str2" ) source test.sh
now in script test-1.sh
#!/bin/bash echo ${STRING[0]} the response is nothing, just a blank line, whereas, if I try to set STRING="str1" in test.sh and do echo $STRING in test-1.sh, this works.
tests are executed from root user only, Now how to set array as env variable , so that I can call the elements of array as per requirement? Earlier, I have tried to even modify /etc/bashrc and that also didn't result in anything positive.
I need to set the array as env variable as there may be many scripts that i have to write which shall use these variable settings.
can anybody provide me suggestions to correct me where I am doing wrong?