title: Multiple simultaneous patterns for grep
body: <p>I need to see if user exists in <code>/etc/passwd</code>. I'm using grep, but I'm having a hard time passing multiple patterns to grep.</p>
  
  <p>I tried </p>
  
  <pre><code>if [[ ! $( cat /etc/passwd | egrep "$name&amp;/home" ) ]];then
     #user doesn't exist, do something
  fi
  </code></pre>
  
  <p>I used ampersand instead of | because both conditions must be true, but it's not working.</p>