title: Check if the hostname is fully qualified (FQDN)
body: <pre><code>#!/bin/bash
  
  for h in "bert" "ernie" "www.google.com"
  do
      host $h 2&gt;&amp;1 &gt; /dev/null
      if [ $? -eq 0 ]
      then
          echo "$h is a FQDN"
      else
          echo "$h is not a FQDN"
      fi
  done
  </code></pre>
  
  <p>Like to insert the output of 'hostname -f' instead of 'bert' or www.google.com
  If the hostname is FQDN the script should continue, if not an error message should occur. PS. It is NOT important if the TLD exist or not. eg. hostname.domain is a FQDN or hostname.domain.tld is a FQDN. If the TLD is valid on the internet is not important to me. <a href="https://i.stack.imgur.com/GacXF.png" rel="nofollow noreferrer">output of hostname -f</a></p>