Skip to content

Instantly share code, notes, and snippets.

@jasonkarns jasonkarns/npx.bash
Created Jan 4, 2019

Embed
What would you like to do?
nodenv exec hook to make npx happy
[ "$NODENV_COMMAND" = npx ] || return 0
remove_from_path() {
local path_to_remove="$1"
local path_before
local result=":${PATH//\~/$HOME}:"
while [ "$path_before" != "$result" ]; do
path_before="$result"
result="${result//:$path_to_remove:/:}"
done
result="${result%:}"
echo "${result#:}"
}
PATH="$(remove_from_path "${NODENV_ROOT}/shims")"
export PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.