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 open string in line 784 #1415

Merged
merged 1 commit into from
Mar 19, 2017
Merged

fix open string in line 784 #1415

merged 1 commit into from
Mar 19, 2017

Conversation

zhirzh
Copy link
Contributor

@zhirzh zhirzh commented Mar 7, 2017

remove extra pair of quotes that vim suggests as syntax error in line 784

@@ -781,7 +781,7 @@ nvm_strip_iojs_prefix() {
if [ "${1-}" = "${NVM_IOJS_PREFIX}" ]; then
nvm_echo
else
nvm_echo "${1#"${NVM_IOJS_PREFIX}"-}"
nvm_echo "${1#${NVM_IOJS_PREFIX}-}"
Copy link
Member

Choose a reason for hiding this comment

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

vim is incorrect - these nested quotes are quite valid.

You can test this on the command line with:

export A='iojs-1.2.3"
export NVM_IOJS_PREFIX='iojs'
echo "${A#"${NVM_IOJS_PREFIX}"-}"

and it will output "1.2.3"

Copy link
Contributor Author

@zhirzh zhirzh Mar 7, 2017

Choose a reason for hiding this comment

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

The nested quotes "${NVM_IOJS_PREFIX}" aren't necessary. And some editors will either show/highlight a syntax error or show treat the following as a big string, rather than valid bash (or sh) code.

with quotes

with-quotes

without quotes

without-quotes

Copy link
Member

Choose a reason for hiding this comment

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

That sounds like a bug in some editors to me.

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.

I'm going to merge this (thanks for the contribution) but in general, if editors can't handle valid syntax, it's the editor that's broken.

@ljharb ljharb merged commit dcd008f into nvm-sh:master Mar 19, 2017
@zhirzh zhirzh deleted the fix-open-string branch March 20, 2017 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants