title: Switching rubies in shell script
body: <p>When executing a bash shell script I am using ruby 1.9.3.  Then, within the script, I want to switch to JRub (I'm using rvm).  I tried switching to JRuby by doing <code>rvm use jruby</code> within the script, but this didn't work, it said:</p>
  
  <pre><code>RVM is not a function, selecting rubies with 'rvm use ...' will not work.
  
  You need to change your terminal emulator preferences to allow login shell.
  Sometimes it is required to use `/bin/bash --login` as the command.
  Please visit https://rvm.io/integration/gnome-terminal/ for a example.
  
  ./run.sh: line 10: jruby: command not found
  </code></pre>
  
  <p>When I do <code>type rvm | head -n1</code> at the command prompt, I get: <code>rvm is a function</code>.  So I'm not sure of the problem.  I thought it might be because I installed JRuby using sudo (<code>sudo rvm install jruby</code>).  So I ran the shell script again using sudo.  Again I received the error.</p>
  
  <p>How can I switch rubies from within a bash shell script with rvm?</p>
  
  <p>Thanks</p>