title: In Bash how do you see if a string is not in an array?
body: <p>I'm trying to do this without adding additional code, such as another for loop. I can create the positive logic of comparing a string to an array. Although I want the negative logic and only print values not in the array, essentially this is to filter out system accounts.</p>
  
  <p>My directory has files in it like this:</p>
  
  <pre><code>admin.user.xml 
  news-lo.user.xml 
  system.user.xml 
  campus-lo.user.xml
  welcome-lo.user.xml
  </code></pre>
  
  <p>This is the code I used to do a positive match if that file is in the directory:</p>
  
  <pre><code>#!/bin/bash
  
  accounts=(guest admin power_user developer analyst system)
  
  for file in user/*; do
  
      temp=${file%.user.xml}
      account=${temp#user/}
      if [[ ${accounts[*]} =~ "$account" ]]
      then
          echo "worked $account";
      fi 
  done
  </code></pre>
  
  <p>Any help in the right direction would be appreciated, thanks.</p>