From d1d53ea97927d76897e38b8b0a11404df2a5312f Mon Sep 17 00:00:00 2001 From: Derek Keller Date: Sun, 9 Jun 2013 21:44:46 -0500 Subject: [PATCH] Updated fix for issues #232 and #244 Fixes issues #232 and #244 where "nvm ls" returns inconsistent results depending on the number of node versions installed. This updated fix uses the find and sort commands only. Tested in bash v3.2.48 and v4.2.25, and zsh v4.3.11. --- nvm.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nvm.sh b/nvm.sh index ed5e343..0c16722 100755 --- a/nvm.sh +++ b/nvm.sh @@ -79,9 +79,7 @@ nvm_ls() if [[ "$PATTERN" == v?*.?*.?* ]]; then VERSIONS="$PATTERN" else - VERSIONS=`find $NVM_DIR -type d -name "v$PATTERN*" -print \ - | tr '\n' '\0' \ - | xargs -0 -n 1 basename 2>/dev/null \ + VERSIONS=`find "$NVM_DIR/" -maxdepth 1 -type d -name "v$PATTERN*" -exec basename '{}' ';' \ | sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n` fi if [ ! "$VERSIONS" ]; then