shellcheck
shellcheck copied to clipboard
POSIX find
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:
#!/bin/sh
find . -readable
Here's what shellcheck currently says:
Nothing.
Here's what I wanted or expected to see:
Line 2:
find . -readable
^-- SCXXXX Operand "-readable" is not defined in POSIX standard.
If so, then we would need to be consistent and check all other commands for non POSIX switches.
Out of my head comes recursive grep, ie. grep -r which is widely used but not documented in the POSIX standard.
I don't believe we should go down this route. There are useful switches that are not described in POSIX.
This could be an opt-in lint. See also #2902.
duplicate of #2406.