4 ms·
That should be the zeroth rule of all shell/bash scripting. I'm almost tempted to put in a self-linting line in scripts so that they won't run unless shellchec
by ndsipa_pomu 4y ago
That should be the zeroth rule of all shell/bash scripting.
I'm almost tempted to put in a self-linting line in scripts so that they won't run unless shellcheck passes completely. (It would be unnecessary to lint the same script every time it's called though, so it's not a serious suggestion).
There should be an option in bash to auto-lint scripts the first time that they're called, but I don't know how the OS should keep track of when the script was last changed and last linted.
- generalizations 4y agoIt would be simpler to modify shellcheck to add flags to shellcheck that limit the kinds of warnings it produces, and then just run it on every invocation of the script. That keeps everything local and deterministic.
- ndsipa_pomu 4y agoI usually fix the scripts so that shellcheck is completely happy. The occasional times that there's a warning that you know is not relevant, you can add a comment just above the offending line e.g. # shellcheck disable=SC2154 (That's for not warning about using a variable that hasn't been defined)