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

SC2148: Should shebangs be required for non-executable files? #237

Closed
mietek opened this issue Oct 19, 2014 · 3 comments
Closed

SC2148: Should shebangs be required for non-executable files? #237

mietek opened this issue Oct 19, 2014 · 3 comments

Comments

@mietek
Copy link

mietek commented Oct 19, 2014

If I'm writing files which are only intended to be sourced, never executed, should I have to include shebangs?

In bashmenot.sh line 1:
export BASHMENOT_TOP_DIR
^-- SC2148: Include a shebang (#!) to specify the shell.
@koalaman
Copy link
Owner

Issue #215 is similar, and the answer is that I'm not entirely sure.

  • Convention is generally to not have a shebang.
  • Shellcheck would prefer having a shebang to determine the shell dialect.
  • A case can be made for using e.g. #!/bin/sh -n to enforce the non-executableness of the file while also letting shellcheck/file/apache/whatever determine the file type.

Maybe the solution is #220 's suggestion for making it easier to permanently ignore these errors, and/or changing the error to a info notification saying "This file has no shebang. Assuming bash."

@koalaman
Copy link
Owner

koalaman commented Nov 1, 2014

Fixed in 0369f43. This is now an info message, and will not appear if -s is specified on the command line.

@koalaman koalaman closed this as completed Nov 1, 2014
@mietek
Copy link
Author

mietek commented Nov 1, 2014

Thanks.

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