Assuming that you'd want to get a list of keys that correspond to a particular value, and that you'd like to store this list in an array:
#!/bin/bash
declare -A hash
hash=(
[k1]="hello world"
[k2]="hello there"
[k3]="hello world"
[k4]=bumblebees
)
string="hello world"
keys=()
for key in "${!hash[@]}"; do
if [[ ${hash[$key]} == "$string" ]]; then
keys+=( "$key" )
fi
done
printf 'Keys with value "%s":\n' "$string"
printf '\t%s\n' "${keys[@]}"
This walks through the list of keys and tests the value corresponding to each key against the string we're looking for. If there is a match, we store the key in the keys array.
At the end, the found keys are outputted.
The output of this script would be
Keys with value "hello world":
k1
k3