문제

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..

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top