I am saving my global variable arrays to a file with this:
declare -p hashTable > $File
declare -p testArray >> $File
I would like to load them back to global variables. I was using this:
source $File
That is fine when called from the global scope, but when it is within a function, it loads the variables back as local.
Is there a way to load them to globals? Is there a way to save with the -g option so it loads globally?
declarewas never designed to be a (de)serialization tool. You are better off using a different language if you want this type of control.