Skip to content

Instantly share code, notes, and snippets.

@chrislerum
Created April 23, 2010 14:37
Show Gist options
  • Save chrislerum/376595 to your computer and use it in GitHub Desktop.
Save chrislerum/376595 to your computer and use it in GitHub Desktop.
my PS1:
PS1="\w $(~/.rvm/bin/rvm-prompt)\n"
here, first i open a new terminal, then i source ~/.bash_profile and then seems to work:
Last login: Fri Apr 23 10:35:56 on ttys001
+ rvm_gemset_separator=+
++ command -v ruby
+ ruby=/usr/bin/ruby
+ [[ ! -z /usr/bin/ruby ]]
++ echo /usr/bin/ruby
++ awk '/rvm/{print}'
+ [[ ! -z '' ]]
+ echo system
+ exit 0
~ system
source ~/.bash_profile
+ rvm_gemset_separator=@
++ command -v ruby
+ ruby=/Users/chris/.rvm/rubies/ruby-1.9.2-head/bin/ruby
+ [[ ! -z /Users/chris/.rvm/rubies/ruby-1.9.2-head/bin/ruby ]]
++ echo /Users/chris/.rvm/rubies/ruby-1.9.2-head/bin/ruby
++ awk '/rvm/{print}'
+ [[ ! -z /Users/chris/.rvm/rubies/ruby-1.9.2-head/bin/ruby ]]
+ unset format
+ [[ 0 -gt 0 ]]
+ [[ -z '' ]]
+ add interpreter
+ token=interpreter
+ eval interpreter_flag=1
++ interpreter_flag=1
+ shift
+ [[ ! -z '' ]]
+ format='$interpreter'
+ add version
+ token=version
+ eval version_flag=1
++ version_flag=1
+ shift
+ [[ ! -z $interpreter ]]
+ format='$interpreter-$version'
+ add patchlevel
+ token=patchlevel
+ eval patchlevel_flag=1
++ patchlevel_flag=1
+ shift
+ [[ ! -z $interpreter-$version ]]
+ format='$interpreter-$version-$patchlevel'
+ add gemset
+ token=gemset
+ eval gemset_flag=1
++ gemset_flag=1
+ shift
+ [[ ! -z $interpreter-$version-$patchlevel ]]
+ format='$interpreter-$version-$patchlevel-$gemset'
++ dirname /Users/chris/.rvm/rubies/ruby-1.9.2-head/bin/ruby
++ xargs dirname
++ xargs basename
+ ruby_string=ruby-1.9.2-head
+ [[ ! -z 1 ]]
++ echo ruby-1.9.2-head
++ awk -F- '{print $1}'
+ interpreter=ruby
+ [[ ! -z 1 ]]
++ echo ruby-1.9.2-head
++ awk -F- '{print $2}'
+ version=1.9.2
+ [[ ! -z 1 ]]
++ echo ruby-1.9.2-head
++ awk -F- '{print $3}'
+ patchlevel=head
+ [[ ! -z '' ]]
+ [[ ! -z 1 ]]
++ echo /Users/chris/.rvm/gems/ruby-1.9.2-head@my_rails3
++ awk -F@ '{print $2}'
+ gemset=my_rails3
+ [[ ! -z my_rails3 ]]
+ gemset=@my_rails3
+ [[ ! -z '' ]]
+ command='prompt="$interpreter-$version-$patchlevel-$gemset"'
+ eval 'prompt="$interpreter-$version-$patchlevel-$gemset"'
++ prompt=ruby-1.9.2-head-@my_rails3
+ echo ruby-1.9.2-head-@my_rails3
+ sed 's#-\s*$##'
+ sed s#-@#@#
+ exit 0
~ ruby-1.9.2-head@my_rails3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment