0

I want ./bin as first element in my PATH variable. I have this is my bashrc.

export PATH=./bin:~/bin:$PATH

However the PATH is prepended with the bin of the current gemset by RVM... So rvm is prepending my path. Is there any solution for this?

Boti
  • 3,275
  • 1
  • 29
  • 54
  • It's not a very elegant solution, but this post http://stackoverflow.com/questions/3360738/execute-a-bash-function-upon-entering-a-directory asks about calling a bash function every time you cd into *any* directory. You could have a bash function which moves `./bin` to the start of PATH, if it's not at the start already. Although it would be interesting to see if this gets called before or after rvm does its magic: if it gets called before then it probably wouldn't work. – Max Williams May 07 '14 at 09:28
  • Since my dotfiles were very well organized I needed to but the PATH setup after invoking the rvm utility scripts... So finally I found the solution. – Boti May 07 '14 at 09:29
  • Ah cool. It's worth answering your own question in case anyone else has the same problem in the future. – Max Williams May 07 '14 at 09:37

1 Answers1

0

Finally since my dotfiles were very well organized I need to put the PATH prepend right after invoking the rvm utility scripts:

# ----------------------------------- RVM -----------------------------------
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
[[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion
export PATH=./bin:$PATH
Boti
  • 3,275
  • 1
  • 29
  • 54