If you type the command in console, it works.
But if you put them in a bash script, problem comes.
#!/bin/bash
rvm use 1.8.7
rvm list # This shows the ruby used in parent shell's rvm.
The shell functions installed by RVM aren't necessarily exported to subshells. In your shell script, you can re-initialize RVM with something like the same command line that's in your .bash_profile or .bashrc:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
After you do that, the rvm functions will be available within the shell script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With