1
0
mirror of https://github.com/meineerde/dotfiles.git synced 2026-02-05 16:43:22 +00:00

Show Ruby version in PS1 using various possible means

This commit is contained in:
Holger Just 2018-08-06 18:45:36 +02:00 committed by Holger Just
parent f41e33a747
commit 001cd7ff74

11
.bashrc
View File

@ -177,7 +177,16 @@ ps1_host='\h'
. $HOME/bin/bash_vcs.sh
ps1_vcs='$(__prompt_command)'
ps1_ruby=' \[\e[0;34m\]$(rvm-prompt v g)\[\e[00m\]'
if type rvm-prompt >/dev/null 2>&1; then
ps1_ruby=' \[\e[0;34m\]$(rvm-prompt v g)\[\e[00m\]'
elif [[ -n "$RUBY_VERSION" ]]; then
ps1_ruby=' \[\e[0;34m\]$RUBY_VERSION\[\e[00m\]'
elif type ruby >/dev/null 2>&1; then
ps1_ruby=' \[\e[0;34m\]$(ruby -e "puts RUBY_VERSION")\[\e[00m\]'
else
ps1_ruby=''
fi
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then