koalaman / shellcheck

ShellCheck, a static analysis tool for shell scripts
https://www.shellcheck.net
GNU General Public License v3.0
36.2k stars 1.77k forks source link

Option to specify shell iff shebang and in-file directives are missing #3023

Open sparr opened 2 months ago

sparr commented 2 months ago

For new checks and feature suggestions

I have some files with no shebang and some with. I would like to run the same shellcheck command across all of them, with the dialect set by the shebang in files with one, and to a default otherwise. Unfortunately shellcheck -s dash overrides the shebang in files that have one. I'd like a "soft" equivalent to -s that only applies of there's no shebang or #shellcheck shell= directive in the file.

My use case is testing a bunch of files with a script, without having to code my own shebang-presence checker.