Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch undefined commands / functions #2574

Open
2 tasks done
functicons opened this issue Sep 14, 2022 · 2 comments
Open
2 tasks done

Catch undefined commands / functions #2574

functicons opened this issue Sep 14, 2022 · 2 comments

Comments

@functicons
Copy link

For new checks and feature suggestions

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"

@functicons functicons changed the title Catch undefined command / function Catch undefined commands / functions Sep 14, 2022
@brother
Copy link
Collaborator

brother commented Sep 15, 2022

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.

@christophgil
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants