title: Bash: warning: here-document at line delimited by end-of-file (wanted `EOF')
body: <p>The following function in bash comes up with the error mentioned  in the title. The error usually appears when the final <code>EOF</code> is not at the beginning of the line. </p>
  
  <p><code>EOF</code> is at the beginning so I can't see what is wrong. Further up in the script (not shown) there are other here-docs and they work.</p>
  
  <pre><code>add_testuser()
  {
      kadmin -p admin -q addprinc test
      cat &lt;&lt;EOF &gt; ~/test.ldif
  dn: cn=test,ou=groups,dc=${ARRAY[1]},dc=${ARRAY[2]}
  cn: test
  gidNumber: 20001
  objectClass: top
  objectClass: posixGroup
  
  dn: uid=test,ou=people,dc=${ARRAY[1]},dc=${ARRAY[2]}
  uid: test
  uidNumber: 20001
  gidNumber: 20001
  cn: First_name
  sn: Last_name
  objectClass: top
  objectClass: person
  objectClass: posixAccount
  objectClass: shadowAccount
  loginShell: /bin/bash
  homeDirectory: /home/test
  userPassword: {CRYPT}*
  EOF 
  
      ldapadd -Qf ~/test.ldif
      kdestroy; kinit test
      klist
      ldapwhoami
  }
  </code></pre>