我正在使用 bash,但仍然不熟悉.profile
, .bashrc
, .bash_profile
.
我想要的结果是拥有 ruby 版本并rvm gemset
显示在我的 bash 提示符上。
我添加PS1="\$(~/.rvm/bin/rvm-prompt) $PS1"
到 .bash_profile (通过 xcode)并显示
ruby-1.9.3-p286 John-MacBook-Air:~ john$
我想要得到的是
ruby-1.9.3-p286@rails3 $
“rails3”是rvm gemset
.
如何John-MacBook-Air:~ john
从提示中删除?
我尝试在 .profile 和 .bashrc 中添加该行,但没有成功,但它似乎在 .bash_profile 中有效。这些文件之间的任何澄清将不胜感激。我在 Mac 上运行 rvm。
解决方案
在 .bash_profile 中包含以下内容
PS1='\W \$ '
PS1="\$(~/.rvm/bin/rvm-prompt) $PS1"
提示看起来像
ruby-1.9.3-p286@rails3 ~ $