title: RVM and Jenkins setup
body: <p>I am new to Jenkins CI. I'm install RVM in my remote Jenkins and when I execute below shell. </p>
  
  <pre><code>#!/bin/bash -x
  source ~/.bashrc
  rvm use 1.9.3@rails-3.2.3
  </code></pre>
  
  <p>I get following errors. </p>
  
  <pre><code>+ source /var/lib/jenkins/.bashrc
  ++ PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/var/lib/jenkins/.rvm/bin:/var/lib/jenkins/.rvm/bin
  + rvm use 1.9.3@rails-3.2.3
  
  RVM is not a function, selecting rubies with 'rvm use ...' will not work.
  You need to change your terminal settings to allow shell login.
  Please visit https://rvm.io/workflow/screen/ for example.
  </code></pre>
  
  <p>What does it mean? I don't have any idea. Please help me.</p>
  
  <p><strong>UPDATED:</strong> I'm tried below script but I still get errors:</p>
  
  <pre><code>#!/bin/bash -x
  source /home/zeck/.bashrc
  [[ -s ".rvmrc" ]] &amp;&amp; source .rvmrc
  export RAILS_ENV=test
  bundle install
  </code></pre>
  
  <p>Errors:</p>
  
  <pre><code>/tmp/hudson457106939700368111.sh: line 5: bundle: command not found
  Build step 'Execute shell' marked build as failure
  Finished: FAILURE
  </code></pre>
  
  <p>Jenkins build shell can't detect RVM, gemsets and gems. What should I do?</p>
  
  <p><strong>UPDATED 2:</strong> Therefore jenkins can't detect ruby.</p>
  
  <pre><code>+ ruby -v
  /tmp/hudson2505951775163045158.sh: line 5: ruby: command not found
  Build step 'Execute shell' marked build as failure
  Finished: FAILUR
  </code></pre>
  
  <p>I'm not using any jenkins plugn and I'm just run script from Build->Execute shell section.</p>