shellcheck
shellcheck copied to clipboard
Wrong rule when sh script uses `disown`
For bugs
- Rule Id (if any, e.g. SC1000):
- My shellcheck version (
shellcheck --version
or "online"): 0.9.0 - [X] The rule's wiki page does not already cover this (e.g. https://shellcheck.net/wiki/SC2086)
- [X] I tried on https://www.shellcheck.net/ and verified that this is still a problem on the latest commit
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
Here's a snippet or screenshot that shows the problem:
#!/usr/bin/sh
prog & disown
Here's what shellcheck currently says:
In ./
For more information: https://www.shellcheck.net/wiki/SC3044 -- In POSIX sh, 'disown' is undefined.
Here's what I wanted or expected to see:
The page it links to is for declare
, not disown
, and doesn't mention disown
in any way. I couldn't find a page for disown
but it's possible my search wasn't good..
I took a look at the source code and notice that a lot of commands point to the same rule that's specific to declare. Perhaps editing the wiki to make it more generic and mention the other commands would be sufficient.
List of commands that point to the same rule can be found here
The wiki is open for edits, please make it clearer!
I encountered the same issue with pushd
. I think this line should just refer to SC3045 instead of SC3044?
https://github.com/koalaman/shellcheck/blob/ac8fb00504ed6da83fe5c5f83e72e4663ff6b439/src/ShellCheck/Checks/ShellSupport.hs#L398