title: BASH script to pass variables without substitution into new script
body: <p>As part of a system build script I have a script that creates various files and configurations.</p>
  
  <p>However one part of the build script creates a new script that contains variables that I don't want resolved when the build script runs. Code snippet example</p>
  
  <pre><code>cat - &gt; /etc/profile.d/mymotd.sh &lt;&lt;EOF
  hostname=`uname -n`
  echo -e "Hostname is $hostname"
  EOF
  </code></pre>
  
  <p>I have tried all sorts of combinations of ' and " and ( and [ but I cannot get the script to send the content without substituting the values and placing the substitutes in the new script rather than the original text.</p>
  
  <p>Ideas?</p>