mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 11:19:45 +08:00
Updated SC2148 (markdown)
10
SC2148.md
10
SC2148.md
@@ -1,4 +1,4 @@
|
||||
## Include a shebang (#!) to specify the shell.
|
||||
## Shebang (#!) missing. Assuming Bash.
|
||||
|
||||
### Problematic code:
|
||||
|
||||
@@ -11,12 +11,10 @@
|
||||
|
||||
### Rationale:
|
||||
|
||||
ShellCheck noticed that your file does not start with a shebang. Shebangs are good for a number of reasons:
|
||||
ShellCheck warns about different things for different shells. It uses the shebang to determine which shell to warn for. For the command line client, this can be overridden with `-s`, e.g. `shellcheck -s sh file`.
|
||||
|
||||
* They allow scripts to be executed outside of interactive prompts.
|
||||
* They ensure the script is executed by the correct shell.
|
||||
* Editors and utilities (including shellcheck) use it to determine the file type.
|
||||
If you don't specify the shell type in any way, ShellCheck assumes a default and gives this message.
|
||||
|
||||
### Contraindications
|
||||
|
||||
For checking snippets, use `shellcheck -e 2148`. This is the default for [shellcheck.net](http://www.shellcheck.net).
|
||||
None. Just specify the shell type, either in a shebang or as a cli flag.
|
Reference in New Issue
Block a user