From 0717d5f99508c89c752e2f1b1532e2747c742696 Mon Sep 17 00:00:00 2001 From: elliottcable Date: Wed, 4 Feb 2015 16:39:57 -0600 Subject: [PATCH] install: some tweaks and clean-up --- install.sh | 8 ++++---- test/install_script/nvm_check_global_modules | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 5018540..4339874 100755 --- a/install.sh +++ b/install.sh @@ -133,14 +133,14 @@ nvm_check_global_modules() { [ "${NPM_VERSION%%[!0-9]*}" -gt 1 ] || return 0 local NPM_GLOBAL_MODULES - NPM_GLOBAL_MODULES=$(npm list -g --depth=0 | sed '/ npm@/d') - + NPM_GLOBAL_MODULES="$(npm list -g --depth=0 | sed '/ npm@/d')" + local MODULE_COUNT - MODULE_COUNT=$( + MODULE_COUNT="$( printf %s\\n "$NPM_GLOBAL_MODULES" | sed -ne '1!p' | # Remove the first line wc -l | tr -d ' ' # Count entries - ) + )" if [ $MODULE_COUNT -ne 0 ]; then cat <<-'END_MESSAGE' diff --git a/test/install_script/nvm_check_global_modules b/test/install_script/nvm_check_global_modules index 10e0d40..5d5db22 100755 --- a/test/install_script/nvm_check_global_modules +++ b/test/install_script/nvm_check_global_modules @@ -25,11 +25,11 @@ setup () { setup -npm install -g nop >/dev/null 2>&1 +npm install -g nop >/dev/null message=$(nvm_check_global_modules) [ ! -z "$message" ] || die "nvm_check_global_modules should have printed a notice when npm had global modules installed" -npm uninstall -g nop >/dev/null 2>&1 +npm uninstall -g nop >/dev/null message=$(nvm_check_global_modules) [ -z "$message" ] || die "nvm_check_global_modules should not have printed a notice when npm had no global modules installed"