Use [0-9] instead of [[:digit:]] per https://github.com/creationix/nvm/pull/466#discussion_r14853668 - it's simpler (and probably more portable).

master
Jordan Harband 2014-07-12 08:58:20 -07:00
parent 4cfe62d3d1
commit 83efa2288d
1 changed files with 2 additions and 2 deletions

4
nvm.sh
View File

@ -153,13 +153,13 @@ nvm_ls() {
return
fi
# If it looks like an explicit version, don't do anything funny
if [ `expr "$PATTERN" : "v[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*$"` != 0 ]; then
if [ `expr "$PATTERN" : "v[0-9]*\.[0-9]*\.[0-9]*$"` != 0 ]; then
if [ -d "$NVM_DIR/$PATTERN" ]; then
VERSIONS="$PATTERN"
fi
else
PATTERN=$(nvm_format_version $PATTERN)
if [ `expr "$PATTERN" : "v[[:digit:]]*\.[[:digit:]]*$"` != 0 ]; then
if [ `expr "$PATTERN" : "v[0-9]*\.[0-9]*$"` != 0 ]; then
PATTERN="$PATTERN."
fi
VERSIONS=`find "$NVM_DIR/" -maxdepth 1 -type d -name "$PATTERN*" -exec basename '{}' ';' \