Add trailing newline char to $SOURCE_STR
Line 302/301 `printf "$SOURCE_STR"` is missing a trailing newline char, while line 281/282 and 285/286 have their own new line char, so I just remove the manually added newline char, and add it to the end of the variable "$SOURCE_STR", so no more manually newline char needed there.
parent
88fc93a71b
commit
364096a3c3
|
@ -270,7 +270,7 @@ nvm_do_install() {
|
||||||
local INSTALL_DIR
|
local INSTALL_DIR
|
||||||
INSTALL_DIR="$(nvm_install_dir)"
|
INSTALL_DIR="$(nvm_install_dir)"
|
||||||
|
|
||||||
SOURCE_STR="\nexport NVM_DIR=\"$INSTALL_DIR\"\n[ -s \"\$NVM_DIR/nvm.sh\" ] && . \"\$NVM_DIR/nvm.sh\" # This loads nvm"
|
SOURCE_STR="\nexport NVM_DIR=\"$INSTALL_DIR\"\n[ -s \"\$NVM_DIR/nvm.sh\" ] && . \"\$NVM_DIR/nvm.sh\" # This loads nvm\n"
|
||||||
|
|
||||||
if [ -z "$NVM_PROFILE" ] ; then
|
if [ -z "$NVM_PROFILE" ] ; then
|
||||||
echo "=> Profile not found. Tried $NVM_PROFILE (as defined in \$PROFILE), ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile."
|
echo "=> Profile not found. Tried $NVM_PROFILE (as defined in \$PROFILE), ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile."
|
||||||
|
@ -279,11 +279,10 @@ nvm_do_install() {
|
||||||
echo " OR"
|
echo " OR"
|
||||||
echo "=> Append the following lines to the correct file yourself:"
|
echo "=> Append the following lines to the correct file yourself:"
|
||||||
printf "$SOURCE_STR"
|
printf "$SOURCE_STR"
|
||||||
echo
|
|
||||||
else
|
else
|
||||||
if ! command grep -qc '/nvm.sh' "$NVM_PROFILE"; then
|
if ! command grep -qc '/nvm.sh' "$NVM_PROFILE"; then
|
||||||
echo "=> Appending source string to $NVM_PROFILE"
|
echo "=> Appending source string to $NVM_PROFILE"
|
||||||
printf "$SOURCE_STR\n" >> "$NVM_PROFILE"
|
printf "$SOURCE_STR" >> "$NVM_PROFILE"
|
||||||
else
|
else
|
||||||
echo "=> Source string already in $NVM_PROFILE"
|
echo "=> Source string already in $NVM_PROFILE"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue