diff --git a/SC2016.md b/SC2016.md index 0d0894c..313dbc8 100644 --- a/SC2016.md +++ b/SC2016.md @@ -38,15 +38,23 @@ echo 'PATH=$PATH:/usr/local/bin' >> ~/.bashrc ``` # We also want this variable to expand "$BASH_SOURCE:$LINE..." during an execution trace. +# shellcheck disable=SC2016 PS4='+$BASH_SOURCE:$LINENO:$FUNCNAME: ' ``` +``` +# We want to control which environment variables envsubst replaces +# shellcheck disable=SC2016 +envsubst '${SERVICE_HOST}:${SERVICE_PORT}' config.template > config +``` + ShellCheck also does not warn about escaped expansions in double quotes: ``` echo "PATH=\$PATH:/usr/local/bin" >> ~/.bashrc ``` + This suggestion is primarily meant to help newbies who assume single and double quotes are basically the same, like in Python and JavaScript. It's not at all meant to discourage experienced users from using single quotes in general. If you are well aware of the difference, please do not hesitate to permanently disable this suggestion with `disable=SC2016` in your `.shellcheckrc`. ShellCheck tries to increase the signal-to-noise ratio of this warning by ignoring certain well known commands that frequently expect literal dollar signs, such as `sh` and `perl`. However, there's a long tail of less common commands and flags that also frequently expect `$`s, and it's not in ShellCheck's scope to try to keep track of them all. When you come across such a command, please [[ignore]] the suggestion, either permanently or for that one instance.