-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logic for when $METHOD is something unexpected #1917
Conversation
… something unexpected.
install.sh
Outdated
@@ -329,6 +329,9 @@ nvm_do_install() { | |||
exit 1 | |||
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.' |
There was a problem hiding this comment.
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.'
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 :-)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
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?