mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Added alternative of using a ShellCheck directive. Tweaked language.
10
SC2148.md
10
SC2148.md
@@ -1,10 +1,16 @@
|
|||||||
Add shebang to the top of your script:
|
Add a shebang line to the top of your script:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternatively, if that is not possible / desirable, you can use the `--shell` switch:
|
Or, for scripts that will not be executed (*e.g.*, `~/.bashrc`), use a directive:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# shellcheck shell=sh
|
||||||
|
```
|
||||||
|
|
||||||
|
If neither of those options are possible or desirable, you can invoke ShellCheck with the `--shell` switch:
|
||||||
```bash
|
```bash
|
||||||
shellcheck --shell=bash without-shebang.sh
|
shellcheck --shell=bash without-shebang.sh
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user