title: How can I check if an associative array element exists in my Bash script?
body: <p>I have an array of animals:</p>
  
  <pre><code>declare -A animals=()
  animals+=([horse])
  </code></pre>
  
  <p>and I want to check if an animal exists or not:</p>
  
  <pre><code>if [ -z "$animals[horse]"]; then
      echo "horse exists";
  fi
  </code></pre>
  
  <p>but this does not work.</p>