Problem using rvm in bash script

I am using rvm installed on Ubuntu 10.04 as recommended in the rvm
docs (including changes to .bashrc) and all is working well with
several versions of Rails, and Ruby 1.8.7 and 1.9.2.
If I run
rvm use 1.9.2
it says
Using /home/colinl/.rvm/gems/ruby-1.9.2-p0
and if I run
rvm info
It shows exactly what I would expect for 1.9.2 and I can start the
rails server and all is well.

The problem arises if I put the above commands in a bash script:
#!/usr/bin/env bash
rvm use 1.9.2
rvm info

When I run this it shows
Using /home/colinl/.rvm/gems/ruby-1.9.2-p0
from the rvm use command, which suggests that it if finding rvm ok,
but the output from rvm info is:

system:

system:
uname: “Linux piglet 2.6.32-26-generic #48-Ubuntu SMP Wed
Nov 24 09:00:03 UTC 2010 i686 GNU/Linux”
bash: “/bin/bash => GNU bash, version 4.1.5(1)-release
(i486-pc-linux-gnu)”
zsh: " => not installed"

rvm:
version: “rvm 1.1.2 by Wayne E. Seguin
([email protected]) [http://rvm.beginrescueend.com/]”

homes:
gem: “not set”
ruby: “not set”

binaries:
ruby: “/usr/local/bin/ruby”
irb: “/usr/local/bin/irb”
gem: “/usr/local/bin/gem”
rake: “/usr/bin/rake”

environment:
PATH:
“/home/colinl/bin/piglet:/home/colinl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/colinl/.rvm/bin:/home/colinl/.rvm/bin”
GEM_HOME: “”
GEM_PATH: “”
MY_RUBY_HOME: “”
IRBRC: “”
RUBYOPT: “”
gemset: “”

Which is not right at all, it being the same as i get if I enter rvm
info without preceding it with rvm use.

Google has not helped me to a solution. Has anyone experienced this
problem, or can suggest what I am doing wrong?

Colin

On 11 December 2010 21:53, Colin L. [email protected] wrote:

rails server and all is well.

The problem arises if I put the above commands in a bash script:
#!/usr/bin/env bash
rvm use 1.9.2
rvm info

When I run this it shows
Using /home/colinl/.rvm/gems/ruby-1.9.2-p0
from the rvm use command, which suggests that it if finding rvm ok,
but the output from rvm info is:

Why is it that one so often finds the solution within two minutes of
posting a question over which one has been struggling for hours?

The answer is at http://rvm.beginrescueend.com/workflow/scripting/

Sorry for the noise.

Colin

On Sat, Dec 11, 2010 at 3:53 PM, Colin L. [email protected]
wrote:

rails server and all is well.

The problem arises if I put the above commands in a bash script:
#!/usr/bin/env bash
rvm use 1.9.2
rvm info

Colin, not sure if this will help at all but I have never used the ‘use’
word. I do:

rvm 1.9.2-p0

not

rvm use 1.9.2-p0

To select the Ruby I want to use…