[Refactor] use a different approach to remove trailing slashes
parent
685312d600
commit
09f7bbb78c
12
nvm.sh
12
nvm.sh
|
@ -258,10 +258,14 @@ if [ -z "${NVM_DIR-}" ]; then
|
||||||
NVM_DIR="$(nvm_cd ${NVM_CD_FLAGS} "$(dirname "${NVM_SCRIPT_SOURCE:-$0}")" > /dev/null && \pwd)"
|
NVM_DIR="$(nvm_cd ${NVM_CD_FLAGS} "$(dirname "${NVM_SCRIPT_SOURCE:-$0}")" > /dev/null && \pwd)"
|
||||||
export NVM_DIR
|
export NVM_DIR
|
||||||
else
|
else
|
||||||
while echo "${NVM_DIR}" | nvm_grep -q "/$"; do
|
# https://unix.stackexchange.com/a/198289
|
||||||
export NVM_DIR="${NVM_DIR%/}"
|
case $NVM_DIR in
|
||||||
done
|
*[!/]*/)
|
||||||
nvm_err "Warning: \$NVM_DIR should not have trailing slash"
|
NVM_DIR="${NVM_DIR%"${NVM_DIR##*[!/]}"}"
|
||||||
|
export NVM_DIR
|
||||||
|
nvm_err "Warning: \$NVM_DIR should not have trailing slashes"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
unset NVM_SCRIPT_SOURCE 2> /dev/null
|
unset NVM_SCRIPT_SOURCE 2> /dev/null
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue