title: Append line to /etc/hosts file with shell script
body: <p>I have a new Ubuntu 12.04 VPS. I am trying to write a setup script that completes an entire LAMP installation. Where I am having trouble is appending a line to the <code>/etc/hosts</code> file. My current hosts file looks like this:</p>
  
  <pre><code>127.0.0.1       localhost Venus
  
  # The following lines are desirable for IPv6 capable hosts
  ::1     ip6-localhost ip6-loopback
  fe00::0 ip6-localnet
  ff00::0 ip6-mcastprefix
  ff02::1 ip6-allnodes
  ff02::2 ip6-allrouters
  </code></pre>
  
  <p>I would like it to look like this:</p>
  
  <pre><code>127.0.0.1       localhost Venus
  192.241.xx.xx  venus.example.com venus
  
  # The following lines are desirable for IPv6 capable hosts
  ::1     ip6-localhost ip6-loopback
  fe00::0 ip6-localnet
  ff00::0 ip6-mcastprefix
  ff02::1 ip6-allnodes
  ff02::2 ip6-allrouters
  </code></pre>
  
  <p>I have tried a variety of <code>sed</code> commands using the append (<code>\a</code>) command. For some reason Ubuntu either just echoes the contents of the <code>hosts</code> file in terminal or does nothing at all. How would I properly inject the second line into the file with a bash script?</p>