4 ms·
You seem to be quite advanced in the topic of cross-unix coding. One thing that bothers me since a few weeks is to absence of 'local' [1] from POSIX. On the on
by arendtio 8y ago
You seem to be quite advanced in the topic of cross-unix coding.
One thing that bothers me since a few weeks is to absence of 'local' [1] from POSIX. On the one hand, I consider using 'local' for function variables good style, on the other hand that is not POSIX compliant.
I have found some Stack Overflow discussion about it [2] but that doesn't really solve the problem either. For the moment I just keep using 'local' as my scripts are unlikely to be run on anything else than a linux, but using the 'sh' shebang feels wrong while using 'local' :-/
Any ideas how to solve that dilemma?
[1]: http://www.tldp.org/LDP/abs/html/localvar.html http://www.tldp.org/LDP/abs/html/localvar.html
[2]: https://stackoverflow.com/questions/18597697/posix-compliant-way-to-scope-variables-to-a-function-in-a-shell-script https://stackoverflow.com/questions/18597697/posix-compliant...