Last active
April 8, 2018 02:18
-
-
Save tsiege/8968730 to your computer and use it in GitHub Desktop.
Adding RVM to bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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