Create associative array in bash 3

Viewed 35719

After thoroughly searching for a way to create an associative array in bash, I found that declare -A array will do the trick. But the problem is, it is only for bash version 4 and the bash version the server has in our system is 3.2.16.

How can I achieve some sort of associative array-like hack in bash 3? The values will be passed to a script like

ARG=array[key];

./script.sh ${ARG}

EDIT: I know that I can do this in awk, or other tools but strict bash is needed for the scenario I am trying to solve.

5 Answers
Related