diff --git a/nvm.sh b/nvm.sh index bea76ee..858b0cc 100644 --- a/nvm.sh +++ b/nvm.sh @@ -231,7 +231,7 @@ nvm_ls() { fi if [ -d "$(nvm_version_dir new)" ]; then VERSIONS=`find "$(nvm_version_dir new)/" "$(nvm_version_dir old)/" -maxdepth 1 -type d -name "$PATTERN*" -exec basename '{}' ';' \ - | sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n | \grep -v '^ *\.' | \grep -e '^v'` + | sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n | \grep -v '^ *\.' | \grep -e '^v' | \grep -v -e '^versions$'` else VERSIONS=`find "$(nvm_version_dir old)/" -maxdepth 1 -type d -name "$PATTERN*" -exec basename '{}' ';' \ | sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n | \grep -v '^ *\.' | \grep -e '^v'` diff --git "a/test/fast/Listing versions/Running \"nvm ls\" should filter out \"versions\"" "b/test/fast/Listing versions/Running \"nvm ls\" should filter out \"versions\"" new file mode 100755 index 0000000..c9858df --- /dev/null +++ "b/test/fast/Listing versions/Running \"nvm ls\" should filter out \"versions\"" @@ -0,0 +1,14 @@ +#!/bin/sh + +mkdir ../../../v0.1.3 +mkdir ../../../v0.2.3 + +. ../../../nvm.sh + +mkdir ../../../versions + +[ -z "$(nvm ls | \grep 'versions')" ] +# The result should contain only the appropriate version numbers. + +rmdir ../../../versions +