title: Check for duplicate word in comma-separated string in bash
body: <p>I need to check that a variable does not contain a duplicate entry in a comma-separated string.</p>
  
  <p>For example, inside of <code>$animals</code>, if I have:</p>
  
  <pre><code>,dog,cat,bird,goat,fish,
  </code></pre>
  
  <p>That would be considered valid since every word is unique.</p>
  
  <p>The string:</p>
  
  <pre><code>,dog,cat,dog,bird,fish,
  </code></pre>
  
  <p>would be invalid since <code>dog</code> is entered twice.</p>
  
  <pre><code>,dog,cat,dogs,bird,fish,
  </code></pre>
  
  <p>Would be valid since there is only one instance of <code>dog</code> (<code>dogs</code> is there but allowed since it's not the same exact word)</p>
  
  <p>The string:</p>
  
  <pre><code>,dog,cat,DOG,bird,fish
  </code></pre>
  
  <p>Would also be invalid since <code>dog</code> is the same as <code>DOG</code> only in uppercase.</p>
  
  <p>Is there any way I can do this? I would put some code I've tried but I don't know what to use to even experiment.</p>
  
  <p>Using bash 3.2.57(1)-release on 10.11.6 El Capitan</p>