Open mcandre opened 2 years ago
#!/bin/sh echo $somearray[@] echo $somearray[*]
These lines may be fine in bash, zsh, dash, posh, etc., but the lines are invalid in (POSIX) sh, ksh, and so on.
Bash array syntax used, though a strict POSIX sh interpreter was detected.
Isn't the current warning enough?
SC3054 (warning): In POSIX sh, array references are undefined.
(you need to add the curly braces to get the error. SC1087 (error): Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet). )
For new checks and feature suggestions
Here's a snippet or screenshot that shows the problem:
These lines may be fine in bash, zsh, dash, posh, etc., but the lines are invalid in (POSIX) sh, ksh, and so on.
Here's what shellcheck currently says:
Here's what I wanted or expected to see:
Bash array syntax used, though a strict POSIX sh interpreter was detected.