Open oxr463 opened 3 years ago
"POSIX-Compliant Way to Scope Variables to a Function in a Shell Script" on Stack Overflow features some options to get rid of all those
^-- SC2039: In POSIX sh, 'local' is undefined.
errors.
Ya, this would be good to set up. Most of them should be ignored I think (local
works on all the shells I'm interested in supporting, for example). Thanks for the suggestion!
Oh wait. So a narrowly compliant POSIX sh implementation just ignores the local
s? Then it might be actually desirable to just leave them there. The thing is variable scoping would differ between shells, but turning every function body into a subshell sounds like it would have side effects.
If we want to leave the local
's in there, we can just create a shellcheck directive to disable SC2039...
👍 for disabling SC2039.
See also: https://github.com/marketplace/actions/shellcheck-action