Skip to content

Conversation

@pnickerson-cashstar
Copy link
Contributor

Print an error and exit the script if $METHOD is set to something unexpected.

In my own personal case, Salt was setting $METHOD to "loopback", and I did not realize it. With this patch, the script output will make it clear what's going on, and it will not pretend to complete successfully.

I did a small amount of testing of my own, but I don't have the tools or experience to complete all the testing asked for in CONTRIBUTING.md. Can someone else help with that?

install.sh Outdated
fi
install_nvm_as_script
else
echo >&2 'The environment variable $METHOD is set to "'"${METHOD}"'", which is not recognized as a valid installation method.'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the "'" thing, instead of something like this?:

echo >&2 "The environment variable \$METHOD is set to \"${METHOD}\", which is not recognized as a valid installation method.'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personal style. \" is fine too. I just use "'" by default because \" has been difficult for me to get right when doing more complex quotation escapes in Bash.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems like shellcheck is erroring out on this. can you update it so tests are passing? style choices beyond that can be figured out later :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading it right, this is the cause of the failure: "SC2016: Expressions don't expand in single quotes, use double quotes for that." I think getting rid of the single quotes like you suggest will fix that, so I'll give it a try.

@ljharb ljharb added the installing nvm Problems installing nvm itself label Oct 2, 2018
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ljharb ljharb merged commit caf6208 into nvm-sh:master Oct 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

installing nvm Problems installing nvm itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants