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

Warn when echo'ing: accidental globbing with "?", history expansion with "!!" #1754

Open
2 tasks done
thp-hatch opened this issue Nov 21, 2019 · 0 comments
Open
2 tasks done

Comments

@thp-hatch
Copy link

For new checks and feature suggestions

Here's a snippet or screenshot that shows the problem:

#!/bin/bash

echo File checksum mismatch! Input changed?
#!/bin/bash

echo Something did not work!!

Here's what shellcheck currently says:

No issues detected!

Here's what I wanted or expected to see:

Warn the user that if a file that matches the "changed?" glob expression (e.g. changedd or changed1) exists, the output message will change. To prevent that, quote the string.

Example error case:

$ touch changedd
$ echo File checksum mismatch! Input changed?
File checksum mismatch! Input changedd
$ ls
...
$ echo foo!!
fools

Proposed fix suggestion:

Surround with double quotes.

echo "File checksum mismatch! Input changed?"
echo "foo!!"

Or alternatively:

echo File checksum mismatch! Input "changed?"
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

1 participant