`nvm_strip_path`: Error out when `$NVM_DIR` is not set.

Per https://github.com/creationix/nvm/issues/1083#issuecomment-217752185
Jordan Harband 2016-05-08 20:05:59 -07:00
parent 6311a0e9c4
commit 0880539972
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55
1 changed files with 4 additions and 0 deletions

4
nvm.sh
View File

@ -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" \