Skip to content

Instantly share code, notes, and snippets.

@shyam-habarakada
Forked from airtonix/.profile
Created May 19, 2016 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shyam-habarakada/cc1e2e75c636b149bc23c5bb8dba9fd3 to your computer and use it in GitHub Desktop.
Save shyam-habarakada/cc1e2e75c636b149bc23c5bb8dba9fd3 to your computer and use it in GitHub Desktop.
dynamic npm .bin.
# Copy this into your `~/.profile`.
# This setup an incredibly ugly hack that recompiles your `PATH`
# everytime the prompt is printed.
# I need this to inject the nearest `node_modules/.bin` into my
# path to make it easy to use the binarys there.
# Your normal PATH exports here
export PATH=$HOME/bin:$PATH
ORIGINAL_PATH=$PATH
function build_path {
export PATH=$(npm bin):$ORIGINAL_PATH
}
#this line causes the PATH to be regenerated each time a new
# prompt is printed to the screen
PROMPT_COMMAND=build_path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment