Skip to content
Myr

[Docs] [Tests] Add escape sequences; add test for aliased `.`

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Yannick Ihmels · committed by Jordan Harband · parent d34bb32 · Browse files · 2 files+28 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+28 added−5 removed

  • tests:+23 added−0 removed
  • other:+5 added−5 removed

2 files+28 added−5 removed

added:test/install_script/nvm_install_with_aliased_dot+23 added
1#!/bin/sh23setup () {4 shopt -s expand_aliases5 alias .=':'6 NVM_ENV=testing \. ../../install.sh > /dev/null7}89cleanup () {10 unset -f setup cleanup die11 unalias .12 shopt -u expand_aliases13}1415die () { echo "$@"; exit 1; }1617setup1819nvm_do_install > /dev/null 2>&120command -v nvm || die 'nvm could not be loaded'2122cleanup23
modified:README.md+5 added-5 removed
52 unmodified lines
53<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`).</sub>5455```sh56export NVM_DIR="$HOME/.nvm"57[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm57[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm58```5960You can customize the install source, directory, profile, and version using the `NVM_SOURCE`, `NVM_DIR`, `PROFILE`, and `NODE_VERSION` variables.61Eg: `curl ... | NVM_DIR=/usr/local/nvm bash` for a global install.
85 unmodified lines
147export NVM_DIR="$HOME/.nvm" && (148 git clone https://github.com/creationix/nvm.git "$NVM_DIR"149 cd "$NVM_DIR"150 git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin`151) && . "$NVM_DIR/nvm.sh"151) && \. "$NVM_DIR/nvm.sh"152```153154Now add these lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to have it automatically sourced upon login:155(you may have to add to more than one of the above files)156157```sh158export NVM_DIR="$HOME/.nvm"159[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm159[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm160```161162### Manual upgrade163
8 unmodified lines
172(173 cd "$NVM_DIR"174 git fetch origin175 git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin`176) && . "$NVM_DIR/nvm.sh"176) && \. "$NVM_DIR/nvm.sh"177```178179## Usage180
244 unmodified lines
425426To activate, you need to source `bash_completion`:427428```sh429[[ -r $NVM_DIR/bash_completion ]] && . $NVM_DIR/bash_completion429[[ -r $NVM_DIR/bash_completion ]] && \. $NVM_DIR/bash_completion430```431432Put the above sourcing line just below the sourcing line for nvm in your profile (`.bashrc`, `.bash_profile`).433
134 unmodified lines