Bash: call array item by string

You’ll need to use an associative array, declare -A FUNCTION

BUT associative arrays are not a sh feature: declare -A is syntax. Change your #! line.

You’ll also need bash version 4.0 or greater: the default /bin/bash on MacOSX is too old.

You can also find associative arrays in ksh and zsh.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top