From 4b5204ecc88b0204788f644df6804456c9225542 Mon Sep 17 00:00:00 2001 From: Renee Margaret McConahy Date: Mon, 25 Nov 2019 08:01:47 -0500 Subject: [PATCH] Added alternative of using a ShellCheck directive. Tweaked language. --- SC2148.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/SC2148.md b/SC2148.md index 16afb5c..d825e0b 100644 --- a/SC2148.md +++ b/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 #!/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 shellcheck --shell=bash without-shebang.sh ```