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

SG2086: useless to double quote exit #1961

Open
mcollica opened this issue May 23, 2020 · 1 comment
Open

SG2086: useless to double quote exit #1961

mcollica opened this issue May 23, 2020 · 1 comment

Comments

@mcollica
Copy link

mcollica commented May 23, 2020

For bugs

  • Rule Id (if any, e.g. SC1000): SC2086
  • My shellcheck version (shellcheck --version or "online"): 0.7.1
  • [V] The rule's wiki page does not already cover this (e.g. https://shellcheck.net/wiki/SC2086)
  • [V] I tried on shellcheck.net and verified that this is still a problem on the latest commit

For new checks and feature suggestions

Here's a snippet or screenshot that shows the problem:

#!/bin/bash
exit $1

Here's what shellcheck currently says:

In snippet.sh line 2:
exit $1
^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean:
exit "$1"

For more information:
https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...

Here's what I wanted or expected to see:

Nothing, that's useless to double quote a single number

@mcollica mcollica changed the title SG2086 - useless to double quote exit SG2086: useless to double quote exit May 23, 2020
@koalaman
Copy link
Owner

ShellCheck is correct in this case. Since this value comes from whatever invokes the script, there is no guarantee that it's a single number.

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

No branches or pull requests

2 participants