Skip to content
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

Fix is variable set test #1100

Merged
merged 1 commit into from
May 22, 2016
Merged

Fix is variable set test #1100

merged 1 commit into from
May 22, 2016

Conversation

stouf
Copy link

@stouf stouf commented May 20, 2016

Issue

Currently, using the nvm.sh script from another script where the check for unbound variables is on (set -u) will give the following error:

NVM_USE_OUTPUT: unbound variable

Note

The issue described above occurs on an Ubuntu 14-04 environment Bash version 4.3.11.
However, it didn't occur on my MacBook Pro (v10.11.4) with Bash version 3.2.57.

@@ -2166,7 +2166,7 @@ nvm() {
return 11
fi
fi
if [ -n "$NVM_USE_OUTPUT" ]; then
if [ -n "${NVM_USE_OUTPUT:-}" ]; then
Copy link
Member

Choose a reason for hiding this comment

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

Thanks! I think this will work just as "${NVM_USE_OUTPUT-}" since there's no default value.

Copy link
Author

Choose a reason for hiding this comment

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

I was actually hesitating with that form hehe. I will update.

@ljharb ljharb added bugs Oh no, something's broken :-( needs followup We need some info or action from whoever filed this issue/PR. labels May 21, 2016
@ljharb
Copy link
Member

ljharb commented May 21, 2016

Not a huge deal, but it'd be awesome if when rebasing in the above comment, you changed the commit message so it starts with "[Fix] set -e: " :-)

@stouf
Copy link
Author

stouf commented May 22, 2016

Not a huge deal, but it'd be awesome if when rebasing in the above comment, you changed the commit message so it starts with "[Fix] set -e: " :-)

Updated. However, I wrote "set -u" and not "set -e" as I guessed that is what you actually meant...?

@ljharb ljharb removed the needs followup We need some info or action from whoever filed this issue/PR. label May 22, 2016
@ljharb ljharb merged commit f62747c into nvm-sh:master May 22, 2016
@ljharb
Copy link
Member

ljharb commented May 22, 2016

Thanks!

@stouf stouf deleted the unbound-variables branch May 23, 2016 00:02
@ljharb ljharb modified the milestone: v0.31.2 Jun 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs Oh no, something's broken :-(
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants