diff --git a/README.md b/README.md index 9eb8c50..bcb42c3 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash **Note:** If the environment variable `$XDG_CONFIG_HOME` is present, it will place the `nvm` files there. ```sh -export NVM_DIR="${XDG_CONFIG_HOME/:-$HOME/.}nvm" +export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm ``` diff --git a/install.sh b/install.sh index 67349ad..be611b3 100755 --- a/install.sh +++ b/install.sh @@ -7,11 +7,7 @@ nvm_has() { } nvm_default_install_dir() { - if [ -n "${XDG_CONFIG_HOME-}" ]; then - printf %s "${XDG_CONFIG_HOME}/nvm" - else - printf %s "${HOME}/.nvm" - fi + [ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm" } nvm_install_dir() {