Drop invalid -a flag for basename.

basename doesn't accept options in bash. This causes the VERSIONS variable get the 'N/A' value for $ nvm ls command.

From basename man page:
NAME
       basename - strip directory and suffix from filenames

SYNOPSIS
       basename NAME [SUFFIX]
       basename OPTION

DESCRIPTION
       Print NAME with any leading directory components removed.  If specified, also remove a trailing SUFFIX.

       --help display this help and exit

       --version
              output version information and exit



coreutils version used in Linux Mint 14 Nadia.

GNU coreutils 8.12.197-032bb                                               September 2011                                                               BASENAME(1)

No idea if this flag exists on FreeBSD or other unixes (if they use gnu coreutils shouldn't be any problem)
master
Miguel Cobá 2013-05-09 13:50:12 -04:00
parent eade411422
commit 335456d008
1 changed files with 1 additions and 1 deletions

2
nvm.sh
View File

@ -79,7 +79,7 @@ nvm_ls()
if [[ "$PATTERN" == v?*.?*.?* ]]; then if [[ "$PATTERN" == v?*.?*.?* ]]; then
VERSIONS="$PATTERN" VERSIONS="$PATTERN"
else else
VERSIONS=`nvm_set_nullglob; basename -a $NVM_DIR/v${PATTERN}* 2>/dev/null | sort -t. -k 1.2,1n -k 2,2n -k 3,3n` VERSIONS=`nvm_set_nullglob; basename $NVM_DIR/v${PATTERN}* 2>/dev/null | sort -t. -k 1.2,1n -k 2,2n -k 3,3n`
fi fi
if [ ! "$VERSIONS" ]; then if [ ! "$VERSIONS" ]; then
echo "N/A" echo "N/A"