shellcheck
shellcheck copied to clipboard
Catch undefined commands / functions
For new checks and feature suggestions
- [x] https://www.shellcheck.net/ (i.e. the latest commit) currently gives no useful warnings about this
- [x] I searched through https://github.com/koalaman/shellcheck/issues and didn't find anything related
Is it possible to generate warning for undefined command / function? The use case is to catch typos. In practice, I'm okay to maintain a dictionary of command / function names.
Here's a snippet or screenshot that shows the problem:
#!/bin/bash
echa "hello world"
Here's what shellcheck currently says:
No issues detected!
Here's what I wanted or expected to see:
Unknown command "echa"
maybe a sounds like match to catch common misspellings or such. it's hard to know what binaries are installed in the PATH of the system and so on.
Shellcheck is extremly helpful. Thanks for this!
I would highly vote for - Indicating misspelled functions/shell commands.
However, searching executable paths may be time consuming. Furthermore, it will also yield false positives when the dev-environment is not the target machine.
Therefore I think that searching for misspelled commands/functions should not be the default. It should be activated by a command line option.
Many Thanks!