Skip to content
Joachim Ansorg edited this page Oct 31, 2022 · 2 revisions

external-sources can only be enabled in .shellcheckrc, not in individual files.

Problematic code:

# shellcheck external-sources=true
source /dev/zero

Correct code:

Add external-sources=true to .shellcheckrc

Rationale:

Due to its origins as an online tool, ShellCheck will by default run in a sandbox where it only reads the files explicitly named on the command line.

The external-sources directive allows disabling this, but must be specified in .shellcheckrc. This is because the sandbox would be useless if the sandboxed script can disable it for itself.

Exceptions:

None.

Related resources:

  • Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!

ShellCheck

Each individual ShellCheck warning has its own wiki page like SC1000. Use GitHub Wiki's "Pages" feature above to find a specific one, or see Checks.

Clone this wiki locally