r26D

.bashrc playing nice with rvm

In recent versions of Ubuntu (I’m looking at you Quantal) gnome terminal does not load the .bashrc properly when you create a new tab or spawn a new window.

 

I modified the profile on gnome terminal Edit > Profiles > Edit> Title and Command to set it “Run command as a login shell”

 

Then you just have to append sourcing this (which loads a local bashrc if you have on)

sudo sh -c ‘echo “[[ -s \”\$HOME/.bashrc\” ]] && . ~/.bashrc” >> /etc/bash.bashrc ‘

 

Then you can add your own customizations in ~/.bashrc and have them loaded everytime you spawn a new terminal.

I added the following to my own .bashrc

[[ -s “$HOME/.rvm/scripts/rvm” ]] && . “$HOME/.rvm/scripts/rvm”
RVM_DEFAULT=”ruby-1.9.3@home –create”
export RVM_DEFAULT
[[ -s “$HOME/.rvm/scripts/rvm” ]] && rvm use $RVM_DEFAULT

This makes sure that rvm is loaded and sets a default ruby with a gem set for global use.