I would like to change my
$PATH environment variable dependent on my current working directory.
Say I'm in
/foo/bar/baz and I have the directories
/foo/bar/baz/node_modules/.bin. I would like to add every possible
./node_modules/.bin recursively to
But when I
cd into a different directory (like
/foo/bar), I want my original, clean
$PATH to be restored, and then to start to look for
./node_modules/.bin recursively again.
(I want to solve my own question from npm's issue tracker: Can we add locally installed packages to PATH, too?)
Note: I'm on a Mac, but interested in a general solution.