title: Check if a variable contains a domain name in a set of TLDs
body: <p>I have a variable name which contains name of DNS record. I want to check for certain conditions, for example if it ends with <code>.com</code> or <code>.es</code>.</p>
  
  <p>Right now I am using </p>
  
  <pre><code>name="test.com"
  
  namecheck=`echo $name | grep -w  "^[A-Za-z]*..com"`
  </code></pre>
  
  <p>but it only checks the <code>com</code> and ignores the <code>.</code> also is it possible to check it against series of value stored in array like </p>
  
  <pre><code>domain=[ ".es" ".com" ".de"]
  </code></pre>