The shell script below runs without error but when it finishes , I discovered that it only ran the first part of the script that installs rbenv but doesn't call all the lines from echo "========= Cloning ruby build =========" till the end. I am using Ubuntu 13.10 the Lubuntu variant.
If I type each command in the script directly into the terminal everything works and ruby 2.1.2 is installed but if run the script instead, ruby_build and ruby 2.1.2 are not installed though rbenv is.
Any suggestion how to resolve this.
rbenv_ruby_installer.sh
rbenv_install.sh
sudo apt-get -y update && apt-get upgrade
echo "======================================="
echo "========= Cloning Rbenv ========="
echo "======================================="
cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
echo "======================================="
echo "========= Cloning ruby build ========="
echo "======================================="
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
echo "======================================="
echo "========= Installing Ruby with Rbenv ========="
echo "======================================="
rbenv install 2.1.2
rbenv global 2.1.2
rbenv rehash
ruby -v