title: How can I delete a newline character in bash script?
body: <p>I have a little problem with a small script. The textfile has a lot of entries like:</p>
  
  <pre><code>permission-project1-admin
  permission-project2-admin
  ....
  </code></pre>
  
  <p>The script looks like this (indeed, it is an awful one but still helps me):</p>
  
  <pre><code>#!/bin/bash
  for i in $(cat adminpermission.txt); do
      permission=$(echo $i | cut -f1)
  
  printf "dn:$permission,ou=groups,dc=domain,dc=com \n"
  printf "objectclass: groupOfUniqueNames \n"
  printf "objectclass: top \n"
  printf "description: \n"
  printf "cn:$permission \n\n"
  done
  </code></pre>
  
  <p>The output looks fine, but because the textfile has a newline character at the end, the first line of printf is devided into two lines like:</p>
  
  <pre><code>dn:permission-project1-admin
  ,ou=groups,dc=domain,dc=com
  objectclass: groupOfUniqueNames
  objectclass: top
  description:
  cn:permission-project1-admin
  </code></pre>
  
  <p>My question is, how I can eliminate the newline character between the first two lines?</p>