Skip to content

Instantly share code, notes, and snippets.

@kiliczsh
Created September 15, 2018 07:38
Show Gist options
  • Select an option

  • Save kiliczsh/25fae2553d2baa8913c10b841e375d52 to your computer and use it in GitHub Desktop.

Select an option

Save kiliczsh/25fae2553d2baa8913c10b841e375d52 to your computer and use it in GitHub Desktop.
install_ruby.sh
#!/bin/bash
# Bash Menu Script Example
sudo apt update
PS3='Please enter your choice: '
options=("Just Ruby" "Rbenv" "RVM" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Option 1")
echo "you chose choice 1"
sudo apt install ruby-full
ruby --version
echo "installation is completed!"
break
;;
"Option 2")
echo "you chose choice 2"
sudo apt install git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev
curl -sL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash -
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
echo "Ruby version 2.5.1 will be installed as default"
rbenv install 2.5.1
rbenv global 2.5.1
ruby --version
echo "installation is completed!"
;;
"Option 3")
echo "you chose choice $REPLY which is $opt"
sudo apt install curl g++, gcc, autoconf, automake, bison, libc6-dev, libffi-dev, libgdbm-dev, libncurses5-dev, libsqlite3-dev, libtool, libyaml-dev, make, pkg-config, sqlite3, zlib1g-dev, libgmp-dev, libreadline-dev, libssl-dev
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm install 2.5.1
rvm use 2.5.1 --default
ruby --version
echo "installation is completed!"
;;
"Quit")
break
;;
*) echo "invalid option $REPLY";;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment