title: Adding YUM Repos With Variables
body: <p>I am trying to add a YUM repo from the command line like so</p>
  
  <pre><code>cat &gt; /etc/yum.repos.d/my_stable_repo.repo &lt;&lt; EOF
  [my_stable_repo]
  name=Stable Repo
  baseurl='https://myurl/$releasever/stable/Packages/'
  enabled=1
  gpgcheck=0
  EOF
  </code></pre>
  
  <p>However, when I do it this way and I take a look at <code>/etc/yum.repos.d/my_stable_repo.repo</code>, I do not see <code>$releasever</code> in the URL. Instead, <code>/etc/yum.repos.d/my_stable_repo.repo</code> looks like:</p>
  
  <pre><code>[my_stable_repo]
  name=Stable Repo
  baseurl='https://myurl//stable/Packages/'
  enabled=1
  gpgcheck=0
  </code></pre>
  
  <p>Notice that the releasever variable was deleted. I am assuming that this is because when I run the command to write the contents to the file from the shell, linux is evaluating the <code>$releasever</code> variable against the global environment, seeing that is empty, and replacing it with an empty string. </p>
  
  <p>But I actually want just the string <code>$releasever</code> to be in <code>/etc/yum.repos.d/my_stable_repo.repo</code>. So the file should look like this the below instead:</p>
  
  <pre><code>[my_stable_repo]
  name=Stable Repo
  baseurl='https://myurl/$releasever/stable/Packages/'
  enabled=1
  gpgcheck=0
  </code></pre>
  
  <p>How can I write the file out like this <strong>with</strong> the <code>$releasever</code> in plain text from the shell?</p>
  
  <p><strong>TLDR: How can I write a string that looks like it has a variable in it (i.e. <code>$releasever</code>) to a file from the command line without actually evaluating the variable?</strong></p>