Associative array

I have an associative array named table

declare -A table
table["apple"]="fruit"
table["tomato"]="veggie"
table["highway"]="GT"
table["artist"]="eminem"

Now say I have a variable returning the value highway

How do I find corresponding value GT ??

(this value that I find (GT in this case) is supposed to be the name of a mysql table)

:slight_smile:

~thanks

printf ${table[$variable]} ?

Where $variable returns "highway" and printf will return GT.