Frage

My change_ruby_env.sh file looks something like this :

#!/usr/bin/env bash

rbenv shell 1.9.3-p327
rbenv rehash

#execute something
rbenv shell 2.0.0-p451
rbenv rehash

And when I run this shell script like sh change_ruby_env.sh I get the following error:

rbenv: no such command `shell'

rbenv shell 1.9.3-p327/2.0.0-p451 works for me on interactive shell. I am not able to get it to work in a shell script.

Could anybody please tell me how to overcome this..

War es hilfreich?

Lösung

Adding the following : eval "$(rbenv init -)" to my script solved this issue for me. I also have this line in my .bash_profile.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top