title: Writing a bash script that writes a variable to the end of a line in another file
body: <p>I am trying to add a line to a bash script that does a bunch of other stuff and what I want it to do is write to the end of a line in another file.  I have a file with a line of IP addresses which is all one line.  This script that I have written asks for user input and one of those things it asks for is an IP address.  That gets stored as a variable inside_ip I want to write that to the end of a line in another file.  I found a similar question and the solution was </p>
  
  <pre><code>sed -i.bck '$s/$/yourText2/' list.txt
  </code></pre>
  
  <p>I tried to put that in a file with </p>
  
  <p><code>sed -i.bck '$s/$/ $inside_ip/' list.txt</code> </p>
  
  <p>but it actually writes $inside_ip to the end of the file, so I just need it to print the variable.</p>