From 3e6265757579221b69eb39888586e66e3ec8d09a Mon Sep 17 00:00:00 2001 From: Gerhard Lazu Date: Tue, 3 Jul 2012 10:36:23 +0100 Subject: [PATCH 1/2] If cd fails, don't run pwd Whitespace... --- nvm.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nvm.sh b/nvm.sh index 516f9a0..6a6b25a 100755 --- a/nvm.sh +++ b/nvm.sh @@ -7,7 +7,7 @@ # Auto detect the NVM_DIR if [ ! -d "$NVM_DIR" ]; then - export NVM_DIR=$(cd $(dirname ${BASH_SOURCE[0]:-$0}); pwd) + export NVM_DIR=$(cd $(dirname ${BASH_SOURCE[0]:-$0}) && pwd) fi # Expand a version using the version cache @@ -21,7 +21,7 @@ nvm_version() VERSION=`nvm_ls $PATTERN | tail -n1` echo "$VERSION" - + if [ "$VERSION" = 'N/A' ]; then return 13 fi @@ -60,11 +60,11 @@ print_versions() for VERSION in $1; do PADDED_VERSION=`printf '%10s' $VERSION` if [[ -d "$NVM_DIR/$VERSION" ]]; then - PADDED_VERSION="\033[0;34m$PADDED_VERSION\033[0m" + PADDED_VERSION="\033[0;34m$PADDED_VERSION\033[0m" fi - OUTPUT="$OUTPUT\n$PADDED_VERSION" + OUTPUT="$OUTPUT\n$PADDED_VERSION" done - echo -e "$OUTPUT" | column + echo -e "$OUTPUT" | column } nvm() @@ -103,7 +103,7 @@ nvm() if [ ! `which curl` ]; then echo 'NVM Needs curl to proceed.' >&2; fi - + if [ $# -ne 2 ]; then nvm help return From d544d8e2eb8cdd90e3663b91b03736daf7a71a31 Mon Sep 17 00:00:00 2001 From: Gerhard Lazu Date: Tue, 3 Jul 2012 10:41:15 +0100 Subject: [PATCH 2/2] If you're using set -e (and why wouldn't you), this halts all execution --- nvm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvm.sh b/nvm.sh index 6a6b25a..448936b 100755 --- a/nvm.sh +++ b/nvm.sh @@ -23,7 +23,7 @@ nvm_version() echo "$VERSION" if [ "$VERSION" = 'N/A' ]; then - return 13 + return fi }