title: Unix script appends ^M at end of each line
body: <p>I have a Unix shell script which does the following:</p>
  
  <ol>
  <li>creates a backup of a file </li>
  <li>appends some text to a file</li>
  </ol>
  
  <p>Now in #2 if I insert a text, ^M gets appended on all the lines of the file.</p>
  
  <p>For example:</p>
  
  <pre><code>echo " a" &gt;&gt; /cust/vivek.txt
  echo " b" &gt;&gt; /cust/vivek.txt
  
  vi vivek.txt
  abc^M
  bcd^M
  a^M
  b^M
  </code></pre>
  
  <p>Any way to avoid this?</p>