I have a bash script which basically contains all export variables and I am trying to add associative array into that script. This is my export's script:
#!/bin/bash
export declare -A oldLinks
oldLinks["A"]="linkA"
oldLinks["B"]="linkB"
oldLinks["C"]="linkC"
oldLinks["D"]="linkD"
export declare -A newLinks
newLinks["E"]="linkE"
newLinks["F"]="linkF"
newLinks["G"]="linkG"
newLinks["H"]="linkH"
This is the main script:
#!/bin/bash
source ArraysFile
for i in "${!oldLinks[@]}"
do
echo "${i} -> ${oldLinks[$i]}"
done
for i in "${!newLinks[@]}"
do
echo "${i} -> ${newLinks[$i]}"
done
This is the error which I'm getting:
export: `-A': not a valid identifier