title: bash script with sed does not work in Ubuntu 15.04
body: <p>I have a bash script to add a few lines of text into the end of a file.</p>
  
  <p>The script works in Ubuntu 14.04 but not in 15.04.</p>
  
  <p>Here is the sed command that I use:</p>
  
  <pre><code>    sed -i.bak "\$a&lt;text to add&gt;" &lt;/absolute/path/to/file&gt;
  </code></pre>
  
  <p>Tried to check for answers here, but could not found one. Any ideas?</p>
  
  <p>Running the same command in terminal works.</p>
  
  <p>EDIT: - more info</p>
  
  <p>The same script also creates the files before editing them, and the creation works as expected.</p>
  
  <p>File creation code:</p>
  
  <pre><code>    if [ -f "$file" ]
  
      then
  
          echo "$file found."
  
      else
  
          echo "$file not found." 
  
          touch $file
      fi
  </code></pre>