title: edit .bashrc from shell script and source it
body: <p>I am trying to write a script that takes care of all the setup for my aws servers, but I am caught in a catch-22 with my <code>.bashrc</code>. I need to source <code>.bashrc</code> from the script so the next commands can execute properly, but I cannot source <code>.bashrc</code> from my script. I have read other posts about this, but those solutions still require me to source from the parent shell and cannot be done within the script.</p>
  
  <p>I tried </p>
  
  <pre><code>$ echo "alias sbrc='source ~/.bashrc'" &gt;&gt; ~/.bashrc
  </code></pre>
  
  <p>in my script, but I still need to source <code>.bashrc</code> outside my script before <code>sbrc</code> works and I still can't use <code>sbrc</code> in my shell script.</p>
  
  <p>Here's the script thus far (tried with and without the echo command listed above, both fail):</p>
  
  <pre><code>#!/bin/bash
  
  curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash
  source ~/.bashrc
  nvm install 6.0
  </code></pre>