mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created 2148 (markdown)
22
2148.md
Normal file
22
2148.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
## Include a shebang (#!) to specify the shell.
|
||||||
|
|
||||||
|
### Problematic code:
|
||||||
|
|
||||||
|
echo "Hello World"
|
||||||
|
|
||||||
|
### Correct code:
|
||||||
|
|
||||||
|
#!/bin/sh
|
||||||
|
echo "Hello World"
|
||||||
|
|
||||||
|
### Rationale:
|
||||||
|
|
||||||
|
ShellCheck noticed that your file does not start with a shebang. Shebangs are good for a number of reasons:
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
|
### Contraindications
|
||||||
|
|
||||||
|
For checking snippets, use `shellcheck -e 2148`. This is the default for [shellcheck.net](http://www.shellcheck.net).
|
Reference in New Issue
Block a user