title: Bash script, replace text in file?
body: <p>I currently have</p>
  
  <pre><code>echo -n "MySQL Database Name:  "; read MyVar; sed -i 's/database_name_here/$MyVar/g' config.php
  </code></pre>
  
  <p>It partially works, it prompts me to enter a database name. Once entered it updates the file but it's still putting $MyVar instead of what's typed.</p>
  
  <pre><code>echo -n "MySQL Database Name:  "; read MyVar; echo "$Myvar"
  </code></pre>
  
  <p>^ works just fine.</p>
  
  <p>Any ideas?</p>
  
  <p>UPDATE:</p>
  
  <pre><code>echo -n MySQL Database Name: ; read MyVar; sed -i s/database_name_here/$MyVar/g config.php
  # ////
  echo -n MySQL Username: ; read usr; sed -i s/username_here/$usr/g config.php
  # ////
  echo -n MySQL Password: ; read blackberg; sed -i s/password_here/$blackberg/g config.php
  </code></pre>
  
  <p>If it's just one line on the bash it works and replaces the value.
  But when I have the above, it works partially but replaces the values with blank.</p>
  
  <p>Any tips?</p>