Skip to content

Commit

Permalink
nvm_strip_path: Error out when $NVM_DIR is not set.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed May 9, 2016
1 parent 6311a0e commit 0880539
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,10 @@ nvm_num_version_groups() {
}

nvm_strip_path() {
if [ -z "${NVM_DIR-}" ]; then
nvm_err '$NVM_DIR not set!'
return 1
fi
nvm_echo "$1" | command sed \
-e "s#$NVM_DIR/[^/]*$2[^:]*:##g" \
-e "s#:$NVM_DIR/[^/]*$2[^:]*##g" \
Expand Down

0 comments on commit 0880539

Please sign in to comment.