-1

I wanted to write a small bash script to automatically setup the correct ruby version and gemset for a new project. For testing I have rvm installed with ruby 2.3.1 and two gemsets: foo and bar.

Even a simple test like this doesn't return what expected:

$ rvm current
ruby-2.3.1@foo

$ ./script
Using ruby-2.3.1 with gemset bar
Using /(...)/.rvm/gems/ruby-2.3.1 with gemset bar
ruby-2.3.1@bar

$ rvm current
ruby-2.3.1@foo

Contents of the script:

#!/bin/bash --login
rvm gemset use bar
rvm use 2.3.1@bar
rvm current

Other operations like installing rubies or creating gemsets seem to work, I just can't get use to modify the current version used by the script caller. Any ideas?

Luka Kerr
  • 4,161
  • 7
  • 39
  • 50
Piotr Kruczek
  • 2,384
  • 11
  • 18

1 Answers1

0

The answer was obviously simple, I should have called the script using

. ./script
Piotr Kruczek
  • 2,384
  • 11
  • 18