Skip to content

Instantly share code, notes, and snippets.

@tsiege
Last active April 8, 2018 02:18
Show Gist options
  • Save tsiege/8968730 to your computer and use it in GitHub Desktop.
Save tsiege/8968730 to your computer and use it in GitHub Desktop.
Adding RVM to bash
export PS1="wd: \[\e[32m\]\W\[\e[0m\]\[\e[0;31m\]\[$IRED\] (ruby v: \$(rvm_version))\$(parse_git_branch)$\n⛵ \[\e[0m\]"
#prints this #=> wd: sql-book-ruby-004 (ruby v: 2.1.0) (master ✔)$
function rvm_version {
local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}')
[ "$gemset" != "" ] && gemset="@$gemset"
local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}')
[ "$version" != "" ] && version="$version"
local full="$version$gemset"
[ "$full" != "" ] && echo "${full}" # add characters in between the closing curly bracket and the quotation mark.
}
# ADD THIS TO PS1 = "\[$IRED\]\$(rvm_version)\[$NO_COLOR\]\W\[$IGRN\][$NO_COLOR\] \$"
#^^^^^^this said to add all that, but I got away without the end, which I think just tells it where the red coloring should end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment