title: Cat EOF shell script not working as intended?
body: <p>I'm trying to write a shell script that uses cat &lt;> somefilepath/file </p>
  
  <p>to append some information to the end of file. </p>
  
  <pre><code>    cat &lt;&lt;EOF&gt;&gt; /etc/mysql/mysql.conf.d/mysqld.cnf
      default_storage_engine = innodb
      innodb_file_per_table = 1
      innodb_file_format = Barracuda
      EOF
  
      service mysql restart
  
      echo ""
      echo "" 
  
      # Create moodle table in mysql 
  
      echo ------------------------# 
      echo 'Setting up moodle mysql'
      echo ------------------------#
  </code></pre>
  
  <p>weirdly, when running the shell script it seems to ignore the ending EOF and pastes everything seen into the file, breaking stuff. However, in Sublime and in Vi on the server it seems to recognize the EOF correctly, but it breaks when running. How can I get the server to recognize this ending EOF correctly? </p>
  
  <p>I've tried this as well, no luck </p>
  
  <pre><code>    cat &lt;&lt;'EOF'&gt;&gt; somefilepath/file 
      blah 
      blah 
      blah 
      EOF 
  </code></pre>