Skip to content

Commit

Permalink
Merge pull request #428 from koenpunt/export-nvm-dir-in-profile
Browse files Browse the repository at this point in the history
export NVM_DIR in profile before sourcing nvm.sh
  • Loading branch information
ljharb committed May 29, 2014
2 parents 085e314 + 16c0be8 commit 931cc45
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 931cc45

Please sign in to comment.