From 16c0be8314ab62e14e6c3c8a883bac86a6d11b94 Mon Sep 17 00:00:00 2001 From: Koen Punt Date: Wed, 28 May 2014 14:32:01 +0200 Subject: [PATCH] export NVM_DIR before sourcing nvm.sh --- install.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 10bf9ca..4e266ab 100755 --- a/install.sh +++ b/install.sh @@ -101,7 +101,7 @@ if [ -z "$PROFILE" ]; then fi fi -SOURCE_STR="[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\" # This loads nvm" +SOURCE_STR="\nexport NVM_DIR=\"$NVM_DIR\"\n[ -s \"\$NVM_DIR/nvm.sh\" ] && . \"\$NVM_DIR/nvm.sh\" # This loads nvm" if [ -z "$PROFILE" ] || [ ! -f "$PROFILE" ] ; then if [ -z $PROFILE ]; then @@ -112,15 +112,13 @@ if [ -z "$PROFILE" ] || [ ! -f "$PROFILE" ] ; then echo "=> Create it (touch $PROFILE) and run this script again" fi echo " OR" - echo "=> Append the following line to the correct file yourself:" - echo - echo " $SOURCE_STR" + echo "=> Append the following lines to the correct file yourself:" + echo -e "$SOURCE_STR" echo else if ! grep -qc 'nvm.sh' $PROFILE; then echo "=> Appending source string to $PROFILE" - echo "" >> "$PROFILE" - echo $SOURCE_STR >> "$PROFILE" + echo -e "$SOURCE_STR" >> "$PROFILE" else echo "=> Source string already in $PROFILE" fi