diff --git a/README.md b/README.md index 10b7e7e..2c997d6 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | ```sh export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm ``` You can customize the install source, directory, profile, and version using the `NVM_SOURCE`, `NVM_DIR`, `PROFILE`, and `NODE_VERSION` variables. @@ -148,7 +148,7 @@ export NVM_DIR="$HOME/.nvm" && ( git clone https://github.com/creationix/nvm.git "$NVM_DIR" cd "$NVM_DIR" git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin` -) && . "$NVM_DIR/nvm.sh" +) && \. "$NVM_DIR/nvm.sh" ``` Now add these lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to have it automatically sourced upon login: @@ -156,7 +156,7 @@ Now add these lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to hav ```sh export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm ``` ### Manual upgrade @@ -173,7 +173,7 @@ For manual upgrade with `git` (requires git v1.7.10+): cd "$NVM_DIR" git fetch origin git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin` -) && . "$NVM_DIR/nvm.sh" +) && \. "$NVM_DIR/nvm.sh" ``` ## Usage @@ -426,7 +426,7 @@ Nota bene: Avoid running nvm while the tests are running. To activate, you need to source `bash_completion`: ```sh -[[ -r $NVM_DIR/bash_completion ]] && . $NVM_DIR/bash_completion +[[ -r $NVM_DIR/bash_completion ]] && \. $NVM_DIR/bash_completion ``` Put the above sourcing line just below the sourcing line for nvm in your profile (`.bashrc`, `.bash_profile`). diff --git a/test/install_script/nvm_install_with_aliased_dot b/test/install_script/nvm_install_with_aliased_dot new file mode 100755 index 0000000..bc8953a --- /dev/null +++ b/test/install_script/nvm_install_with_aliased_dot @@ -0,0 +1,23 @@ +#!/bin/sh + +setup () { + shopt -s expand_aliases + alias .=':' + NVM_ENV=testing \. ../../install.sh > /dev/null +} + +cleanup () { + unset -f setup cleanup die + unalias . + shopt -u expand_aliases +} + +die () { echo "$@"; exit 1; } + +setup + +nvm_do_install > /dev/null 2>&1 +command -v nvm || die 'nvm could not be loaded' + +cleanup +