You should not be running the entire script with sudo; the script itself should call sudo only for those commands that need elevated privileges.
For example:
#!/usr/bin/env bash
curl -sSL https://get.rvm.io > installer # Does not need sudo
bash installer stable # Maybe needs sudo?
sudo rvm install stable # I assume this needs sudo
gem install jekyll
Just running code directly from an external resource without verifying it, let alone running it as root, is a big security risk. You should download the code first, verify it, then pass that as an argument to your script.
#!/usr/bin/env bash
bash "$1" stable # Again, maybe needs sudo
sudo rvm install stable
gem install jekyll
To run the script:
curl -sSL https://get.rvm.io > installer
# Check if installer is the right script and is safe
myscript installer