title: How to check if a group exists and add if it doesn't in Linux Shell Script
body: <p>this is a summary of what i want my code to do:</p>
  
  <pre><code>if (group exists)
  then
  
    (add user to group)
  
  else
  
    (create group)
  
    (add user to group)
  
  fi
  </code></pre>
  
  <p>I am using the Ubuntu virtual machine but all of the results i have found on similar sites do not work.</p>