When none of the directories exist, don't `find` within them.

master
Jordan Harband 2015-02-20 23:12:00 -08:00
parent 12ca8f2607
commit cd481ff548
1 changed files with 14 additions and 12 deletions

2
nvm.sh
View File

@ -557,6 +557,7 @@ nvm_ls() {
if [ -z "$PATTERN" ]; then if [ -z "$PATTERN" ]; then
PATTERN='v' PATTERN='v'
fi fi
if [ -n "$NVM_DIRS_TO_SEARCH" ]; then
VERSIONS="$(command find $NVM_DIRS_TO_SEARCH -maxdepth 1 -type d -name "$PATTERN*" \ VERSIONS="$(command find $NVM_DIRS_TO_SEARCH -maxdepth 1 -type d -name "$PATTERN*" \
| command sed "s#$NVM_VERSION_DIR_IOJS/#"$NVM_IOJS_PREFIX"-#" \ | command sed "s#$NVM_VERSION_DIR_IOJS/#"$NVM_IOJS_PREFIX"-#" \
| command grep -v "$NVM_VERSION_DIR_IOJS" \ | command grep -v "$NVM_VERSION_DIR_IOJS" \
@ -569,6 +570,7 @@ nvm_ls() {
| command sort -s -t- -k1.1,1.1 \ | command sort -s -t- -k1.1,1.1 \
| command sed "s/^\($NVM_IOJS_PREFIX\)\./\1-/" \ | command sed "s/^\($NVM_IOJS_PREFIX\)\./\1-/" \
| command sed "s/^$NVM_NODE_PREFIX\.//")" | command sed "s/^$NVM_NODE_PREFIX\.//")"
fi
if [ $ZHS_HAS_SHWORDSPLIT_UNSET -eq 1 ] && nvm_has "unsetopt"; then if [ $ZHS_HAS_SHWORDSPLIT_UNSET -eq 1 ] && nvm_has "unsetopt"; then
unsetopt shwordsplit unsetopt shwordsplit