thoughtbot / dotfiles

A set of vim, zsh, git, and tmux configuration files.
https://thoughtbot.com
Other
7.97k stars 1.87k forks source link

Add only the current project's bin directory to $PATH #188

Closed croaky closed 11 years ago

croaky commented 11 years ago

From https://github.com/sstephenson/rbenv/wiki/Understanding-binstubs#adding-project-specific-binstubs-to-path

export PATH="$PWD/bin:$PATH"
hash -r 2>/dev/null || true
croaky commented 11 years ago

This is a similar attempt to standardize our binstub usage as https://github.com/thoughtbot/dotfiles/pull/166. Our research card is at https://trello.com/card/use-bin-for-binstubs-directory/50f06fb01e671a2e2200ad9a/107

croaky commented 11 years ago

I should note that I don't understand what hash -r 2>/dev/null || true is doing.

pbrisbin commented 11 years ago

hash -r is required when changing PATH because the shell caches program lookup. The redirect and or-true is probably just so that the function operates silently and returns successfully regardless of what hash has to say about it.

croaky commented 11 years ago

Trying an approach @joshuaclayton mentioned:

https://github.com/thoughtbot/dotfiles/pull/191