[Fix] `read` exits 1 when `.nvmrc` lacks a trailing newline - avoid that.

Per https://github.com/creationix/nvm/issues/993#issuecomment-205399603
Jordan Harband 2016-04-04 22:08:36 -07:00
parent 6299cba467
commit d3e334d86d
1 changed files with 1 additions and 1 deletions

2
nvm.sh
View File

@ -140,7 +140,7 @@ nvm_rc_version() {
local NVMRC_PATH
NVMRC_PATH="$(nvm_find_nvmrc)"
if [ -e "$NVMRC_PATH" ]; then
read -r NVM_RC_VERSION < "$NVMRC_PATH"
read -r NVM_RC_VERSION < "$NVMRC_PATH" || printf ''
echo "Found '$NVMRC_PATH' with version <$NVM_RC_VERSION>"
else
>&2 echo "No .nvmrc file found"